@@ -183,14 +183,24 @@ def dest_path(self, value):
183183
184184 page : Optional [Page ]
185185
186- def __init__ (self , path : str , src_dir : str , dest_dir : str , use_directory_urls : bool ) -> None :
186+ def __init__ (
187+ self ,
188+ path : str ,
189+ src_dir : str ,
190+ dest_dir : str ,
191+ use_directory_urls : bool ,
192+ * ,
193+ dest_uri : Optional [str ] = None ,
194+ ) -> None :
187195 self .page = None
188196 self .src_path = path
189- self .abs_src_path = os .path .normpath (os .path .join (src_dir , self .src_path ))
190197 self .name = self ._get_stem ()
191- self .dest_uri = self ._get_dest_path (use_directory_urls )
192- self .abs_dest_path = os .path .normpath (os .path .join (dest_dir , self .dest_path ))
198+ if dest_uri is None :
199+ dest_uri = self ._get_dest_path (use_directory_urls )
200+ self .dest_uri = dest_uri
193201 self .url = self ._get_url (use_directory_urls )
202+ self .abs_src_path = os .path .normpath (os .path .join (src_dir , self .src_uri ))
203+ self .abs_dest_path = os .path .normpath (os .path .join (dest_dir , self .dest_uri ))
194204
195205 def __eq__ (self , other ) -> bool :
196206 return (
@@ -207,10 +217,10 @@ def __repr__(self):
207217 )
208218
209219 def _get_stem (self ) -> str :
210- """Return the name of the file without it's extension."""
220+ """Return the name of the file without its extension."""
211221 filename = posixpath .basename (self .src_uri )
212222 stem , ext = posixpath .splitext (filename )
213- return 'index' if stem in ( 'index' , ' README') else stem
223+ return 'index' if stem == ' README' else stem
214224
215225 def _get_dest_path (self , use_directory_urls : bool ) -> str :
216226 """Return destination path based on source path."""
0 commit comments