@@ -212,6 +212,8 @@ def parse_parameters_and_returns(parameters, returns):
212212
213213 function ['syntaxes' ] = syntaxes
214214
215+ function ['path_html' ] = f"/{ function ['name' ]} /"
216+
215217 self .functions .append (function )
216218 except Exception as e :
217219 self .logger .exception (e )
@@ -321,20 +323,11 @@ def render_page(self, title, content):
321323 content = content
322324 )
323325
324- def create_function (self , function_name ):
325-
326- for function2 in self .functions :
327- if function2 ['name' ] == function_name :
328- function = function2
329- break
330- if not function :
331- raise WikiBuilderError (f'Function not found: { function_name } ' )
332- return
333-
326+ def create_function_page (self , function ):
334327 function_template = self .input_env .get_template ('function.html' )
335328 html_content = self .render_page (function ['name' ], function_template .render (function = function ))
336329
337- web_path = f"/ { function ['name' ] } /"
330+ web_path = function ["path_html" ]
338331 function_folder = OUTPUT_HTML_PATH + web_path
339332
340333 Path (function_folder ).mkdir (parents = True , exist_ok = True )
@@ -343,12 +336,8 @@ def create_function(self, function_name):
343336 with open (output_path , 'w' ) as html_file :
344337 html_file .write (html_content )
345338
346- function ["path_html" ] = web_path
347-
348339 self .logger .info (f"Generated { output_path } " )
349340
350- return function
351-
352341 def create_article (self , article_name , articles_folder = '' , custom_web_path = False ):
353342 article_real_path = os .path .join (DOCS_REPO_PATH , 'articles' , articles_folder , article_name , f"article.yaml" )
354343 article = utils .load_and_validate_yaml (article_real_path , self .schema_article )
@@ -423,7 +412,7 @@ def create_category(self, web_path, category_data):
423412 functions_folder_path = os .path .join (DOCS_REPO_PATH , 'functions' , functions_folder )
424413 for function in self .functions :
425414 if function ['type_name' ] == functions_type and function ['folder' ] == functions_folder :
426- function = self . create_function ( function [ 'name' ])
415+ function [ "category" ] = category_name
427416 items .append ({
428417 'name' : function ['name' ],
429418 'path_html' : function ['path_html' ]
@@ -440,6 +429,8 @@ def create_category(self, web_path, category_data):
440429 'path_html' : f"/lua/functions/{ functions_type } /{ functions_folder } "
441430 })
442431
432+ self .categories [category_name ] = items
433+
443434 category_template = self .input_env .get_template ('category.html' )
444435 html_content = self .render_page (category_name , category_template .render (
445436 category_name = category_name ,
@@ -560,6 +551,8 @@ def create_pages(self):
560551 with open (os .path .join (DOCS_REPO_PATH , 'VERSION' ), 'r' ) as file :
561552 self .wiki_version = file .read ().strip ()
562553
554+ self .categories = {}
555+
563556 def create_item (item ):
564557 if 'article' in item :
565558 self .create_article (item ['article' ]['name' ], item ['article' ]['folder' ], item ['path_html' ])
@@ -572,10 +565,45 @@ def create_item(item):
572565 create_item (subitem )
573566 else :
574567 create_item (item )
568+
569+ # Generate related pages for each function
570+ for function in self .functions :
571+ function ['related' ] = []
572+
573+ # Fill with the function's category items
574+ function_category = function .get ('category' )
575+ if function_category :
576+ category_items = self .categories .get (function_category )
577+ function ['related' ].append ({
578+ 'category' : function_category ,
579+ 'items' : category_items
580+ })
581+
582+ # Fill with other see_also entries
583+ for type_name in ['shared' , 'client' , 'server' ]:
584+ type_info = function .get (type_name , {})
585+ if not type_info :
586+ continue
587+ for see_also in type_info .get ('see_also' , []):
588+ parts = see_also .split (':' )
589+ if len (parts ) != 2 :
590+ continue
591+ entry_type = parts [0 ]
592+ entry_name = parts [1 ]
593+ if entry_type == 'category' :
594+ category_items = self .categories .get (entry_name )
595+ if category_items :
596+ function ['related' ].append ({
597+ 'category' : entry_name ,
598+ 'items' : category_items
599+ })
600+
601+ # Create function pages
602+ for function in self .functions :
603+ self .create_function_page (function )
575604
576605 self .create_misc_pages ()
577-
578-
606+
579607 def copy_assets (self ):
580608
581609 copy_files = [
0 commit comments