@@ -19,7 +19,7 @@ def plural(name: str, qu: int) -> str:
1919
2020 @staticmethod
2121 def nav_link (name : str , path : str ) -> str :
22- return f" <a href=\ "{ path } \ " class=\ " btn btn-link\ " >{ name } </a>"
22+ return f' <a href="{ path } " class="btn btn-link">{ name } </a>'
2323
2424 @staticmethod
2525 def anchorize (name : str ) -> str :
@@ -33,7 +33,7 @@ def nav_item(name: str, anchor: str) -> str:
3333
3434 @staticmethod
3535 def a (name : str , path : str ) -> str :
36- return f" <a href=\ "{ path } \ " >{ name } </a>"
36+ return f' <a href="{ path } ">{ name } </a>'
3737
3838 @staticmethod
3939 def b (content : str ) -> str :
@@ -52,7 +52,7 @@ def code(content: str) -> str:
5252</pre>"""
5353
5454 @staticmethod
55- def section (title : str , content : str , anchor : str = "" ) -> str :
55+ def section (title : str , content : str , anchor : str = "" ) -> str :
5656 return f"""<section { f'id="{ anchor } "' if anchor else '' } >
5757 <h2>{ title } </h2>
5858
@@ -91,7 +91,9 @@ def h4(name: str) -> str:
9191
9292class HTMLGenerator (Generator ):
9393 def __init__ (self , parsers : List [Parser ], output : str , ark_version : str ):
94- super ().__init__ (parsers , spec .HTML_TEMPLATE_FOLDER , "*.html" , output , ark_version )
94+ super ().__init__ (
95+ parsers , spec .HTML_TEMPLATE_FOLDER , "*.html" , output , ark_version
96+ )
9597
9698 self .footer = f"<i>Last generation at { datetime .now ()} </i>"
9799
@@ -100,12 +102,19 @@ def create_dir(self, name: str):
100102
101103 def generate_index (self ):
102104 if not (self .output_path / "assets" ).exists ():
103- shutil .copytree (str (self .template_folder / "assets" ), str (self .output_path / "assets" ))
105+ shutil .copytree (
106+ str (self .template_folder / "assets" ), str (self .output_path / "assets" )
107+ )
104108
105109 sections = html .section (
106110 f"ArkScript { self .version } documentation" ,
107- f"Welcome! This is the official documentation for ArkScript { self .version } " +
108- html .ul ([html .a (file .path , f"/{ self .version } /{ file .path } .html" ) for file in self .list .files ])
111+ f"Welcome! This is the official documentation for ArkScript { self .version } "
112+ + html .ul (
113+ [
114+ html .a (file .path , f"/{ self .version } /{ file .path } .html" )
115+ for file in self .list .files
116+ ]
117+ ),
109118 )
110119
111120 content = self .templates ["index.html" ]
@@ -117,7 +126,7 @@ def generate_index(self):
117126 table_of_content = "" ,
118127 navigation_links = "" ,
119128 sections = sections ,
120- footer = self .footer
129+ footer = self .footer ,
121130 )
122131
123132 (self .output_path_ver / "index.html" ).write_text (content )
@@ -131,31 +140,31 @@ def generate_one(self, path: str, functions: List[spec.Function]):
131140 for func in functions :
132141 links += html .nav_item (func .name , html .anchorize (func .name ))
133142 content = html .div (
134- html .inline_code (func .signature ), "<br>" ,
143+ html .inline_code (func .signature ),
144+ "<br>" ,
135145 html .div (func .desc .brief ),
136- html .div (
137- html .b ("Note" ), ": " ,
138- func .desc .details
139- ),
146+ html .div (html .b ("Note" ), ": " , func .desc .details ),
140147 html .div (
141148 html .h4 (html .plural ("Parameter" , len (func .desc .params ))),
142- html .ul ([
143- f"{ html .inline_code (p .name )} : { p .desc } " for p in func .desc .params
144- ])
149+ html .ul (
150+ [
151+ f"{ html .inline_code (p .name )} : { p .desc } "
152+ for p in func .desc .params
153+ ]
154+ ),
145155 ),
146156 html .div (
147157 html .h4 (html .plural ("Author" , len (func .desc .authors ))),
148- ", " .join ([
149- html .a (f"@{ a .split ('/' )[- 1 ]} " , a ) for a in func .desc .authors
150- ])
151- )
158+ ", " .join (
159+ [ html .a (f"@{ a .split ('/' )[- 1 ]} " , a ) for a in func .desc .authors ]
160+ ),
161+ ),
152162 )
153163 if func .desc .code :
154- content += html .div (
155- html .h4 ("Example" ),
156- html .code (func .desc .code )
157- )
158- sections += html .section (func .name , content , anchor = html .anchorize (func .name ))
164+ content += html .div (html .h4 ("Example" ), html .code (func .desc .code ))
165+ sections += html .section (
166+ func .name , content , anchor = html .anchorize (func .name )
167+ )
159168
160169 table_of_content = table_of_content .format (table_of_content_links = links )
161170
@@ -168,7 +177,7 @@ def generate_one(self, path: str, functions: List[spec.Function]):
168177 table_of_content = table_of_content ,
169178 navigation_links = "" ,
170179 sections = sections ,
171- footer = self .footer
180+ footer = self .footer ,
172181 )
173182
174183 (self .output_path_ver / f"{ path } .html" ).write_text (content )
0 commit comments