@@ -89,7 +89,8 @@ def get_modules(builder, limit=None):
8989 modules ["modm" ].addSortKey (lambda mo : (mo .name , mo ["filename" ]))
9090 for init in imodules :
9191 if init .name .startswith ("__" ): continue
92- if init .name .isdigit (): continue ;
92+ # Keep numeric instance submodules (":...:1", ":...:2", ...),
93+ # their options/collectors/queries are merged into the parent docs node later.
9394 m = modules [init .parent ].addChild (init .fullname .split (":" )[- 1 ])
9495 modules [init .fullname ] = m
9596 m .addSortKey (lambda mo : (mo .name , m ["filename" ], mo .get ("value" , "" ), mo .get ("option" , "" )))
@@ -228,6 +229,34 @@ def render_dependency_graphs(node):
228229 return svg
229230
230231
232+ def _is_instance_module (node ):
233+ return node .get ("type" , "" ) == "Module" and node .name .isdigit ()
234+
235+ def _merge_child_into (parent , child ):
236+ for existing in parent .children :
237+ if existing == child :
238+ existing .merge (child )
239+ return
240+ merged = child .copy (parent )
241+ merged .parent = parent
242+ parent .children .append (merged )
243+
244+ def _merge_instance_members_into_parent (node ):
245+ # Collapse per-instance members into the parent module so availability
246+ # reflects all families even though instance pages are hidden from docs.
247+ instance_modules = [c for c in node .children if _is_instance_module (c )]
248+ instance_option_names = set ()
249+ for inst in instance_modules :
250+ for child in inst .children :
251+ ctype = child .get ("type" , "" )
252+ if "Option" in ctype :
253+ instance_option_names .add (child .name )
254+ if ("Option" in ctype ) or ("Collector" in ctype ) or ("Query" in ctype ):
255+ _merge_child_into (node , child )
256+ for key in node .sortKeys :
257+ node .children .sort (key = key )
258+ return instance_modules , instance_option_names
259+
231260def format_module (modules , node ):
232261 fullname = node .name
233262 nname = node .parent
@@ -237,6 +266,8 @@ def format_module(modules, node):
237266
238267 # ident = node.ids.string if (node.parent and node.parent.ids != node.ids) else ""
239268
269+ instance_modules , instance_option_names = _merge_instance_members_into_parent (node )
270+
240271 title , descr = split_description (node ["_description" ])
241272 mprops = {
242273 "name" : fullname ,
@@ -246,7 +277,7 @@ def format_module(modules, node):
246277 "is_limited" : node .ids != all_targets ,
247278 "url" : url_name (fullname ),
248279 "dependencies" : {},
249- "options" : [], "collectors" : [], "queries" : []
280+ "options" : [], "instance_options" : [], " collectors" : [], "queries" : []
250281 }
251282
252283 for child in node .children :
@@ -266,7 +297,10 @@ def format_module(modules, node):
266297 for name , targets in op ["dependencies" ].items ():
267298 name = name .split ("-> " )[1 ]
268299 mprops ["dependencies" ][name ] = mprops ["dependencies" ].get (name , False )
269- mprops ["options" ].append (op )
300+ if child .name in instance_option_names :
301+ mprops .setdefault ("instance_options" , []).append (op )
302+ else :
303+ mprops ["options" ].append (op )
270304
271305 elif "Collector" in ctype :
272306 op = {"name" : child .name ,
@@ -288,7 +322,8 @@ def format_module(modules, node):
288322
289323 print ("." , end = "" , flush = True )
290324
291- for child in [c for c in node .children if "filename" in c ]:
325+ # Merge instance options/collectors/queries into parent and omit instance pages.
326+ for child in [c for c in node .children if "filename" in c and c not in instance_modules ]:
292327 format_module (modules , child )
293328
294329def format_config (configs , node ):
0 commit comments