Refine Xrefstyle Rules in Disco#58
Merged
AryaHassanli merged 5 commits intoApr 7, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces the XrefStyleOnlyInRoot option to ensure the xrefstyle attribute is exclusively present in root documents, adding it after the copyright notice if missing and removing it from non-root files. The review feedback suggests using SectionName() for more robust title parsing, optimizing slice manipulations for better performance, and moving test-only helper functions out of the production source files.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Description: Refine Xrefstyle Rules in Disco
This PR refines the XrefStyleOnlyInRoot feature in the disco package to enforce stricter rules for :xrefstyle: attribute management in AsciiDoc files.
Summary of Logic
The goal is to ensure consistent cross-reference styling across the specification by managing the :xrefstyle: attribute based on whether a document is a root document or a sub-document (non-root).
Rules Enforced:
Non-Root Documents:
Root Documents:
Changes
disco Package
tests Package
Verification
Ran all tests in the tests package, and they passed successfully:
go test -v ./tests/
Output confirmed that TestXrefStyleOnlyInRoot passed along with all other tests.