@@ -183,14 +183,24 @@ def dest_path(self, value):
183
183
184
184
page : Optional [Page ]
185
185
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 :
187
195
self .page = None
188
196
self .src_path = path
189
- self .abs_src_path = os .path .normpath (os .path .join (src_dir , self .src_path ))
190
197
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
193
201
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 ))
194
204
195
205
def __eq__ (self , other ) -> bool :
196
206
return (
@@ -207,10 +217,10 @@ def __repr__(self):
207
217
)
208
218
209
219
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."""
211
221
filename = posixpath .basename (self .src_uri )
212
222
stem , ext = posixpath .splitext (filename )
213
- return 'index' if stem in ( 'index' , ' README') else stem
223
+ return 'index' if stem == ' README' else stem
214
224
215
225
def _get_dest_path (self , use_directory_urls : bool ) -> str :
216
226
"""Return destination path based on source path."""
0 commit comments