@@ -710,7 +710,11 @@ def get_object(self) -> Module: # type:ignore[override]
710710 return analyzer ._modules_by_path .get (self ._partial_path )
711711
712712 def rst_for_group (self , objects : Iterable [TopLevel ]) -> list [str ]:
713- return [self .rst_for (obj ) for obj in objects ]
713+ return [
714+ self .rst_for (obj )
715+ for obj in objects
716+ if "@omitFromAutoModule" not in obj .modifier_tags
717+ ]
714718
715719 def rst ( # type:ignore[override]
716720 self ,
@@ -722,7 +726,7 @@ def rst( # type:ignore[override]
722726 rst .append ([f".. js:module:: { '' .join (partial_path )} " ])
723727 for group_name in _SECTION_ORDER :
724728 rst .append (self .rst_for_group (getattr (obj , group_name )))
725- return "\n \n " .join (["\n \n " .join (r ) for r in rst ])
729+ return "\n \n " .join (["\n \n " .join (r ) for r in rst if r ])
726730
727731
728732class AutoSummaryRenderer (Renderer ):
@@ -787,26 +791,27 @@ def get_sig(self, obj: TopLevel) -> str:
787791 else :
788792 return ""
789793
790- def get_summary_row (
791- self , pkgname : str , obj : TopLevel
792- ) -> tuple [str , str , str , str , str , str ]:
794+ def get_summary_row (self , pkgname : str , obj : TopLevel ) -> tuple [str , str , str ]:
793795 """Get the summary table row for obj.
794796
795797 The output is designed to be input to format_table. The link name
796798 needs to be set up so that :any:`link_name` makes a link to the
797799 actual API docs for this object.
798800 """
799- sig = self .get_sig (obj )
800801 display_name = obj .name
801802 prefix = "**async** " if getattr (obj , "is_async" , False ) else ""
802803 qualifier = "any"
803- summary = self .extract_summary (render_description (obj .description ))
804804 link_name = pkgname + "." + display_name
805- return (prefix , qualifier , display_name , sig , summary , link_name )
805+ main = f"{ prefix } :{ qualifier } :`{ display_name } <{ link_name } >`"
806+ if slink := obj .block_tags .get ("summaryLink" ):
807+ main = render_description (slink [0 ])
808+ sig = self .get_sig (obj )
809+ summary = self .extract_summary (render_description (obj .description ))
810+ return (main , sig , summary )
806811
807812 def get_summary_table (
808813 self , pkgname : str , group : Iterable [TopLevel ]
809- ) -> list [tuple [str , str , str , str , str , str ]]:
814+ ) -> list [tuple [str , str , str ]]:
810815 """Get the data for a summary tget_summary_tableable. Return value
811816 is set up to be an argument of format_table.
812817 """
@@ -818,9 +823,7 @@ def get_summary_table(
818823 # We have to change the value of one string: qualifier = 'obj ==>
819824 # qualifier = 'any'
820825 # https://github.com/sphinx-doc/sphinx/blob/6.0.x/sphinx/ext/autosummary/__init__.py#L375
821- def format_table (
822- self , items : list [tuple [str , str , str , str , str , str ]]
823- ) -> list [Node ]:
826+ def format_table (self , items : list [tuple [str , str , str ]]) -> list [Node ]:
824827 """Generate a proper list of table nodes for autosummary:: directive.
825828
826829 *items* is a list produced by :meth:`get_items`.
@@ -857,16 +860,13 @@ def append_row(column_texts: list[tuple[str, str]]) -> None:
857860 row .append (entry )
858861 body .append (row )
859862
860- for prefix , qualifier , name , sig , summary , real_name in items :
863+ for name , sig , summary in items :
861864 # The body of this loop is changed from copied code.
862- sig = rst .escape (sig )
863- if sig :
864- sig = f"**{ sig } **"
865865 if "nosignatures" not in self ._options :
866- col1 = rf" { prefix } : { qualifier } :` { name } < { real_name } >`\ { sig } "
867- else :
868- col1 = f"{ prefix } : { qualifier } :` { name } < { real_name } >` "
869- col2 = summary
870- append_row ([(col1 , "name" ), (col2 , "summary" )])
866+ sig = rst . escape ( sig )
867+ if sig :
868+ sig = f"** { sig } ** "
869+ name = rf" { name } \ { sig } "
870+ append_row ([(name , "name" ), (summary , "summary" )])
871871
872872 return [table_spec , table ]
0 commit comments