Skip to content

Commit aa67dfa

Browse files
authored
DOP-1171: prepend term to the term's name in the glossary node
1 parent 476ed5d commit aa67dfa

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313
- Support additional ordered list labels (DOP-1129)
1414
- Support ordered list "start" attribute (DOP-1210)
1515
- Logging of the parser's version at startup (DOP-1213).
16+
- Snooty parser yields glossary IDs that match the IDs generated by legacy tooling (DOP-1171)
1617

1718
### Changed
1819

snooty/parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ def dispatch_departure(self, node: docutils.nodes.Node) -> None:
363363

364364
for item in definition_list.get_child_of_type(n.DefinitionListItem):
365365
term_text = "".join(term.get_text() for term in item.term)
366-
term_identifier = make_id(term_text)
366+
term_identifier = make_id(f"term-{term_text}")
367367
identifier = n.TargetIdentifier(item.start, [], [term_identifier])
368368
identifier.children = item.term[:]
369369
target = n.InlineTarget(item.start, [], "std", "term", None)

snooty/test_parser.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,7 @@ def test_glossary_node() -> None:
841841
<term>
842842
<text>$cmd</text>
843843
<inline_target domain="std" name="term">
844-
<target_identifier ids="['cmd']">
844+
<target_identifier ids="['term-cmd']">
845845
<text>$cmd</text></target_identifier>
846846
</inline_target>
847847
</term>
@@ -852,7 +852,7 @@ def test_glossary_node() -> None:
852852
<term>
853853
<text>_id</text>
854854
<inline_target domain="std" name="term">
855-
<target_identifier ids="['id']">
855+
<target_identifier ids="['term-id']">
856856
<text>_id</text>
857857
</target_identifier>
858858
</inline_target>
@@ -864,7 +864,7 @@ def test_glossary_node() -> None:
864864
<term>
865865
<text>aggregate</text>
866866
<inline_target domain="std" name="term">
867-
<target_identifier ids="['aggregate']">
867+
<target_identifier ids="['term-aggregate']">
868868
<text>aggregate</text></target_identifier>
869869
</inline_target>
870870
</term>
@@ -875,7 +875,7 @@ def test_glossary_node() -> None:
875875
<term>
876876
<text>index</text>
877877
<inline_target domain="std" name="term">
878-
<target_identifier ids="['index']">
878+
<target_identifier ids="['term-index']">
879879
<text>index</text></target_identifier>
880880
</inline_target>
881881
</term>

0 commit comments

Comments
 (0)