@@ -145,29 +145,31 @@ def generate_operator_doc(server, operator_name, include_private):
145145 with Path .open (Path (file_dir ) / f"{ file_name } .md" , "w" ) as file :
146146 file .write (output )
147147
148+
148149def generate_toc_tree (docs_path ):
149150 data = []
150151 for folder in docs_path .iterdir ():
151152 if folder .is_dir (): # Ensure 'folder' is a directory
152153 category = folder .name
153154 operators = [] # Reset operators for each category
154155 for file in folder .iterdir ():
155- if file .is_file () and file .suffix == ".md" : # Ensure 'file' is a file with .md extension
156+ if (
157+ file .is_file () and file .suffix == ".md"
158+ ): # Ensure 'file' is a file with .md extension
156159 file_name = file .name
157160 operator_name = file_name .replace ("_" , " " ).replace (".md" , "" )
158161 operators .append ({"operator_name" : operator_name , "file_name" : file_name })
159162 data .append ({"category" : category , "operators" : operators })
160163
161164 # Render the Jinja2 template
162165 template_path = docs_path / "toc_template.j2"
163- with open (template_path , "r" ) as template_file :
166+ with Path . open (template_path , "r" ) as template_file :
164167 template = Template (template_file .read ())
165168 output = template .render (data = data ) # Pass 'data' as a named argument
166169
167170 # Write the rendered output to toc.md
168- with open (docs_path / "toc.md" , "w" ) as file :
171+ with Path . open (docs_path / "toc.md" , "w" ) as file :
169172 file .write (output )
170-
171173
172174
173175def main ():
0 commit comments