Skip to content

Commit eb7ee0c

Browse files
committed
Assume normalized anchor without suggesting fixes on them
1 parent ebbd502 commit eb7ee0c

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

disco/references.go

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,19 @@ func (an AnchorNormalizer) rewriteCrossReferences(doc *asciidoc.Document) {
5353
}
5454
continue
5555
}
56-
anchorLabel := labelText(anchor.LabelElements)
56+
var anchorLabel string
57+
if an.options.NormalizeAnchors {
58+
if _, isSection := anchor.Element.(*asciidoc.Section); isSection {
59+
anchorLabel = library.SectionName(anchor.Element.(*asciidoc.Section))
60+
}
61+
}
5762
if anchorLabel == "" {
58-
section, isSection := anchor.Element.(*asciidoc.Section)
59-
if isSection {
60-
anchorLabel = library.SectionName(section)
63+
anchorLabel = labelText(anchor.LabelElements)
64+
if anchorLabel == "" {
65+
section, isSection := anchor.Element.(*asciidoc.Section)
66+
if isSection {
67+
anchorLabel = library.SectionName(section)
68+
}
6169
}
6270
}
6371
// We're going to be modifying the underlying array, so we need to make a copy of the slice

0 commit comments

Comments
 (0)