@@ -578,6 +578,7 @@ async def write_collection_namespace_index(namespace: str, collections: t.Iterab
578578
579579async def write_plugin_type_index (plugin_type : str ,
580580 per_collection_plugins : t .Mapping [str , t .Mapping [str , str ]],
581+ collection_metadata : t .Mapping [str , AnsibleCollectionMetadata ],
581582 template : Template ,
582583 dest_filename : str ,
583584 for_official_docsite : bool = False ) -> None :
@@ -587,16 +588,28 @@ async def write_plugin_type_index(plugin_type: str,
587588 :arg plugin_type: The plugin type to write the index for.
588589 :arg per_collection_plugins: Mapping of collection_name to Mapping of plugin_name to
589590 short_description.
591+ :arg collection_metadata: Dictionary mapping collection names to collection metadata objects.
590592 :arg template: A template to render the plugin index.
591593 :arg dest_filename: The destination filename.
592594 :kwarg for_official_docsite: Default False. Set to True to use wording specific for the
593595 official docsite on docs.ansible.com.
594596 """
597+ public_per_collection_plugins = {}
598+ for collection_name , plugins in per_collection_plugins .items ():
599+ public_plugins = {}
600+ collection_meta = collection_metadata [collection_name ]
601+ private_plugins = collection_meta .private_plugins .get (plugin_type ) or []
602+ for plugin_name , plugin_data in plugins .items ():
603+ if plugin_name not in private_plugins :
604+ public_plugins [plugin_name ] = plugin_data
605+ if public_plugins :
606+ public_per_collection_plugins [collection_name ] = public_plugins
607+
595608 index_contents = _render_template (
596609 template ,
597610 dest_filename ,
598611 plugin_type = plugin_type ,
599- per_collection_plugins = per_collection_plugins ,
612+ per_collection_plugins = public_per_collection_plugins ,
600613 for_official_docsite = for_official_docsite ,
601614 )
602615
@@ -669,11 +682,22 @@ async def write_plugin_lists(collection_name: str,
669682 'Cannot parse required_ansible specifier set for {collection_name}' ,
670683 collection_name = collection_name ,
671684 )
685+
686+ public_plugin_maps : t .Dict [str , t .Mapping [str , str ]] = {}
687+ for plugin_type , plugin_data in plugin_maps .items ():
688+ private_plugins = collection_meta .private_plugins .get (plugin_type ) or []
689+ public_plugin_data = {}
690+ for plugin_name , plugin_info in plugin_data .items ():
691+ if plugin_name not in private_plugins :
692+ public_plugin_data [plugin_name ] = plugin_info
693+ if public_plugin_data :
694+ public_plugin_maps [plugin_type ] = public_plugin_data
695+
672696 index_contents = _render_template (
673697 template ,
674698 dest_dir ,
675699 collection_name = collection_name ,
676- plugin_maps = plugin_maps ,
700+ plugin_maps = public_plugin_maps ,
677701 collection_version = collection_meta .version ,
678702 requires_ansible = requires_ansible ,
679703 link_data = link_data ,
@@ -786,6 +810,7 @@ async def output_collection_namespace_indexes(collection_namespaces: t.Mapping[s
786810
787811
788812async def output_plugin_indexes (plugin_info : PluginCollectionInfoT ,
813+ collection_metadata : t .Mapping [str , AnsibleCollectionMetadata ],
789814 dest_dir : str ,
790815 collection_url : CollectionNameTransformer ,
791816 collection_install : CollectionNameTransformer ,
@@ -795,6 +820,7 @@ async def output_plugin_indexes(plugin_info: PluginCollectionInfoT,
795820
796821 :arg plugin_info: Mapping of plugin_type to Mapping of collection_name to Mapping of
797822 plugin_name to short_description.
823+ :arg collection_metadata: Dictionary mapping collection names to collection metadata objects.
798824 :arg dest_dir: The directory to place the documentation in.
799825 :kwarg for_official_docsite: Default False. Set to True to use wording specific for the
800826 official docsite on docs.ansible.com.
@@ -823,8 +849,8 @@ async def output_plugin_indexes(plugin_info: PluginCollectionInfoT,
823849 filename = os .path .join (collection_toplevel , f'index_{ plugin_type } .rst' )
824850 writers .append (await pool .spawn (
825851 write_plugin_type_index (
826- plugin_type , per_collection_data , plugin_list_tmpl , filename ,
827- for_official_docsite = for_official_docsite )))
852+ plugin_type , per_collection_data , collection_metadata , plugin_list_tmpl ,
853+ filename , for_official_docsite = for_official_docsite )))
828854
829855 await asyncio .gather (* writers )
830856
0 commit comments