1515# Get the terminal path from which the script is executed
1616BASE_DIR = os .getcwd ()
1717MODULE_DIR = os .path .dirname (os .path .abspath (__file__ )) # Main script folder
18- DEFAULT_FOOTER = os .path .join (MODULE_DIR , "data" , "footer.md " )
18+ DEFAULT_FOOTER = os .path .join (MODULE_DIR , "data" , "footer.html " )
1919
2020# Initialize paths used throughout the script
2121FOOTER_PATH = os .path .join (BASE_DIR , "data" )
@@ -87,12 +87,12 @@ def initial_setup():
8787
8888 # Copying the input data to the "_temp" folder to keep the src clean
8989 shutil .copytree (SRC_PATH , os .path .join (TEMP_PATH , "src" ), dirs_exist_ok = True )
90- footer_path = os .path .join (FOOTER_PATH , "footer.md " )
90+ footer_path = os .path .join (FOOTER_PATH , "footer.html " )
9191 if os .path .exists (footer_path ):
92- shutil .copy (footer_path , os .path .join (TEMP_PATH , "data" , "footer.md " ))
92+ shutil .copy (footer_path , os .path .join (TEMP_PATH , "data" , "footer.html " ))
9393 else :
9494 warning (f"Using the default footer: { DEFAULT_FOOTER } " )
95- shutil .copy (DEFAULT_FOOTER , os .path .join (TEMP_PATH , "data" , "footer.md " ))
95+ shutil .copy (DEFAULT_FOOTER , os .path .join (TEMP_PATH , "data" , "footer.html " ))
9696
9797 info ("Data has been copied successfully." )
9898
@@ -168,15 +168,15 @@ def project_data_setup(versions):
168168 for i , v in enumerate (versions )
169169 )
170170
171- with open (f"{ TEMP_PATH } /data/footer.md " , "r" ) as footer_file :
171+ with open (f"{ TEMP_PATH } /data/footer.html " , "r" ) as footer_file :
172172 footer = footer_file .read ()
173173
174174 # Replacing the file placeholders
175175 footer = footer .replace ("{html_v}" , html_versions )
176176 footer = footer .replace ("{v_list}" , version_list )
177177 footer = footer .replace ("{default_language}" , default_language )
178178
179- with open (f"{ TEMP_PATH } /data/footer.md " , "w" ) as footer_file :
179+ with open (f"{ TEMP_PATH } /data/footer.html " , "w" ) as footer_file :
180180 footer_file .write (footer )
181181
182182 # Printing the usefull infos
@@ -207,7 +207,7 @@ def add_versioning(versions):
207207 # Getting all the ".md" files inside the folders
208208 source_files = find_md (lang_path )
209209
210- with open (f"{ TEMP_PATH } /data/temp_footer.md " , "r" ) as footer_file :
210+ with open (f"{ TEMP_PATH } /data/temp_footer.html " , "r" ) as footer_file :
211211 footer_content = footer_file .read ()
212212
213213 footer_content_rst = '.. raw:: html\n \n ' + '\n ' .join (f'\t { line } ' for line in footer_content .splitlines ())
@@ -239,14 +239,14 @@ def languages_current_version_setup(version):
239239 languages = []
240240
241241 # Creating a copy of the "standard project" footer where I'm gonna add only the specific version/file data
242- shutil .copy (f"{ TEMP_PATH } /data/footer.md " , f"{ TEMP_PATH } /data/temp_footer.md " )
242+ shutil .copy (f"{ TEMP_PATH } /data/footer.html " , f"{ TEMP_PATH } /data/temp_footer.html " )
243243
244244 # Variables intitial set-up
245245 language_list = "["
246246 version_path = f"{ TEMP_PATH } /src/{ version } "
247247
248248
249- with open (f"{ TEMP_PATH } /data/temp_footer.md " , "r" ) as footer_file :
249+ with open (f"{ TEMP_PATH } /data/temp_footer.html " , "r" ) as footer_file :
250250 footer = footer_file .read ()
251251
252252 for folder in os .listdir (version_path ):
@@ -269,7 +269,7 @@ def languages_current_version_setup(version):
269269 footer = footer .replace ("{l_list}" , language_list )
270270 footer = footer .replace ("{default_language}" , default_language )
271271
272- with open (f"{ TEMP_PATH } /data/temp_footer.md " , "w" ) as footer_file :
272+ with open (f"{ TEMP_PATH } /data/temp_footer.html " , "w" ) as footer_file :
273273 footer_file .write (footer )
274274
275275 info (f"Found languages for version '{ version } ': { language_list } ." )
@@ -282,7 +282,7 @@ def change_language(language):
282282 Insert the selected language into the temporary footer file.
283283 """
284284
285- with open (f"{ TEMP_PATH } /data/temp_footer.md " , "r" ) as footer_file :
285+ with open (f"{ TEMP_PATH } /data/temp_footer.html " , "r" ) as footer_file :
286286 footer = footer_file .read ()
287287
288288 # Replacing the placeholder with the languages the first time and than back with the placeholder
@@ -291,7 +291,7 @@ def change_language(language):
291291 else :
292292 footer = footer .replace (f"{ language } </s" , "{language}</s" )
293293
294- with open (f"{ TEMP_PATH } /data/temp_footer.md " , "w" ) as footer_file :
294+ with open (f"{ TEMP_PATH } /data/temp_footer.html " , "w" ) as footer_file :
295295 footer_file .write (footer )
296296
297297# Function that search for all the ".md" files inside of a directory
@@ -530,11 +530,11 @@ def initial_set_up():
530530 title = args [0 ] if len (args ) > 0 else "Documentation"
531531 author = args [1 ] if len (args ) > 1 else "Author"
532532
533- src_path = os .path .join (TEMP_PATH , "src" ) # "src" folder path
534- data_path = os .path .join (TEMP_PATH , "data" ) # "data" folder path
533+ src_path = os .path .join (BASE_DIR , "src" ) # "src" folder path
534+ data_path = os .path .join (BASE_DIR , "data" ) # "data" folder path
535535 version_paths = [
536- [os .path .join (TEMP_PATH , "src" , "V. 1.0" ), "1.0" ],
537- [os .path .join (TEMP_PATH , "src" , "V. 2.0" ), "2.0" ]
536+ [os .path .join (BASE_DIR , "src" , "V. 1.0" ), "1.0" ],
537+ [os .path .join (BASE_DIR , "src" , "V. 2.0" ), "2.0" ]
538538 ] # Versions of the documentation folder
539539
540540 if not os .path .exists (src_path ): # If no "src" folder is found
0 commit comments