Skip to content

Commit ebbd502

Browse files
committed
Make normaliz anchors option true by default + fix nil pointer condition
1 parent 2ecad6f commit ebbd502

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

disco/option.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ type DiscoOptions struct {
1919
RemoveExtraSpaces bool `default:"true" aliases:"removeExtraSpaces" help:"remove extraneous spaces" group:"Discoballing:"`
2020
NormalizeFeatureNames bool `default:"true" aliases:"normalizeFeatureNames" help:"correct invalid feature names" group:"Discoballing:"`
2121
DisambiguateConformanceChoice bool `default:"true" aliases:"disambiguateConformanceChoice" help:"ensure conformance choices are only used once per document" group:"Discoballing:"`
22-
NormalizeAnchors bool `default:"false" aliases:"normalizeAnchors" help:"rewrite anchors and references without labels" group:"Discoballing:"`
22+
NormalizeAnchors bool `default:"true" aliases:"normalizeAnchors" help:"rewrite anchors and references without labels" group:"Discoballing:"`
2323
RemoveMandatoryFallbacks bool `default:"true" aliases:"removeMandatoryFallbacks" help:"remove fallback values for mandatory fields" group:"Discoballing:"`
2424
RenameSections bool `default:"false" help:"rename sections to disco-ball standard names" group:"Discoballing:"`
2525
XrefStyleOnlyInRoot bool `default:"true" aliases:"xrefStyleOnlyInRoot" help:"enforce xrefstyle: basic only in root" group:"Discoballing:"`
@@ -42,7 +42,7 @@ var DefaultOptions = DiscoOptions{
4242
RemoveExtraSpaces: true,
4343
NormalizeFeatureNames: true,
4444
DisambiguateConformanceChoice: true,
45-
NormalizeAnchors: false,
45+
NormalizeAnchors: true,
4646
RemoveMandatoryFallbacks: true,
4747
RenameSections: false,
4848
XrefStyleOnlyInRoot: true,

disco/references.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ func (an AnchorNormalizer) rewriteCrossReferences(doc *asciidoc.Document) {
9696
}
9797

9898
func removeCrossReferenceStutter(library *spec.Library, doc *asciidoc.Document, icr *asciidoc.CrossReference, parent asciidoc.Parent, index int) {
99+
if parent == nil {
100+
return
101+
}
99102
if len(icr.Elements) > 0 {
100103
return
101104
}

0 commit comments

Comments
 (0)