@@ -89,37 +89,38 @@ def generate_api_docs(root_folder: str, output_folder: str, index_file: str, mkd
8989
9090 # Process tutorials folder only if no existing Tutorials nav found
9191 tutorials_folder = 'tutorials'
92- if existing_tutorials_nav is None and os .path .exists (tutorials_folder ):
92+ if os .path .exists (tutorials_folder ):
9393 # Copy tutorials folder to docs
9494 tutorials_output = os .path .join (output_folder , 'tutorials' )
9595 if os .path .exists (tutorials_output ):
9696 shutil .rmtree (tutorials_output )
9797 shutil .copytree (tutorials_folder , tutorials_output )
98-
99- # Build tutorials navigation structure
100- for root , dirs , files in os .walk (tutorials_folder ):
101- relative_root = os .path .relpath (root , tutorials_folder )
102- for file in files :
103- if file .endswith ('.md' ):
104- file_path = os .path .join (root , file )
105- relative_path = os .path .relpath (file_path , tutorials_folder )
106- output_path = os .path .join ('tutorials' , relative_path ).replace ('\\ ' , '/' )
107-
108- # Build nested structure
109- current_nav = tutorials_structure
110- parts = relative_path .split (os .sep )
111-
112- # Handle nested directories
113- for part in parts [:- 1 ]: # All parts except the filename
114- if part :
115- current_nav = current_nav .setdefault (part , {})
116-
117- # Add the markdown file
118- file_name_without_ext = os .path .splitext (parts [- 1 ])[0 ]
119- if isinstance (current_nav , dict ):
120- current_nav [file_name_without_ext ] = output_path
121- else :
122- current_nav = {file_name_without_ext : output_path }
98+
99+ # Build tutorials navigation structure only if no existing Tutorials nav found
100+ if existing_tutorials_nav is None :
101+ for root , dirs , files in os .walk (tutorials_folder ):
102+ relative_root = os .path .relpath (root , tutorials_folder )
103+ for file in files :
104+ if file .endswith ('.md' ):
105+ file_path = os .path .join (root , file )
106+ relative_path = os .path .relpath (file_path , tutorials_folder )
107+ output_path = os .path .join ('tutorials' , relative_path ).replace ('\\ ' , '/' )
108+
109+ # Build nested structure
110+ current_nav = tutorials_structure
111+ parts = relative_path .split (os .sep )
112+
113+ # Handle nested directories
114+ for part in parts [:- 1 ]: # All parts except the filename
115+ if part :
116+ current_nav = current_nav .setdefault (part , {})
117+
118+ # Add the markdown file
119+ file_name_without_ext = os .path .splitext (parts [- 1 ])[0 ]
120+ if isinstance (current_nav , dict ):
121+ current_nav [file_name_without_ext ] = output_path
122+ else :
123+ current_nav = {file_name_without_ext : output_path }
123124
124125 # Copy assets folder if exists
125126 if os .path .exists (ex_assets_folder ):
0 commit comments