@@ -1864,36 +1864,15 @@ def add_target(id: str) -> None:
18641864 and node ['refid' ] == prev_node ['refid' ]
18651865 ):
18661866 # a target for a hyperlink reference having alias
1867- pass
1867+ return
18681868 else :
18691869 add_target (node ['refid' ])
1870- # Temporary fix for https://github.com/sphinx-doc/sphinx/issues/11093
1871- # TODO: investigate if a more elegant solution exists
1872- # (see comments of https://github.com/sphinx-doc/sphinx/issues/11093)
1873- if node .get ('ismod' , False ):
1874- # Detect if the previous nodes are label targets. If so, remove
1875- # the refid thereof from node['ids'] to avoid duplicated ids.
1876- prev = get_prev_node (node )
1877- if self ._has_dup_label (prev , node ):
1878- ids = node ['ids' ][:] # copy to avoid side-effects
1879- while self ._has_dup_label (prev , node ):
1880- ids .remove (prev ['refid' ]) # type: ignore[index]
1881- prev = get_prev_node (prev ) # type: ignore[arg-type]
1882- else :
1883- ids = iter (node ['ids' ]) # read-only iterator
1884- else :
1885- ids = iter (node ['ids' ]) # read-only iterator
1886-
1887- for id in ids :
1870+ for id in node ['ids' ]:
18881871 add_target (id )
18891872
18901873 def depart_target (self , node : Element ) -> None :
18911874 pass
18921875
1893- @staticmethod
1894- def _has_dup_label (sib : Node | None , node : Element ) -> bool :
1895- return isinstance (sib , nodes .target ) and sib .get ('refid' ) in node ['ids' ]
1896-
18971876 def visit_attribution (self , node : Element ) -> None :
18981877 self .body .append (CR + r'\begin{flushright}' + CR )
18991878 self .body .append ('---' )
0 commit comments