Skip to content

feat(CSwLMeta): add {cref}, cross-references to sections and exercises - #67

Merged
arademaker merged 1 commit into
mainfrom
feat/cref
Nov 20, 2026
Merged

arademaker merged 1 commit into
mainfrom
feat/cref

Conversation

@arademaker

Copy link
Copy Markdown
Member

Adds {cref "tag"}[], a role that links to the section with that tag or to the exercise with that name, and generates the link text from the target: the section's title, or the exercise's name in code. Nothing else is added; the prose says what is cited ("no exercício {cref …}[]"). {cref "tag"}[texto] keeps hand-written text.

  • The text is filled in during traversal, so both the HTML and the generated Lean projects carry it.
  • An unknown tag, or one that is both a section and an exercise, fails the build.
  • Exercises get an HTML anchor (ex-<name>) and register their names in a domain of their own.
  • The two references in Logic/PL.lean point back at exercise implication-as-disj, and Logic/Proof.lean links to exercise prop-exchange.
  • STYLE-CODE.md and STYLE-WRITING.md record the role.

Tested by running the generator for all four variants: anchors, generated text in HTML and in the student .lean, cross-page and forward references, and a failing build on an unknown tag. LaTeX is not emitted (emitTeX := false), so toTeX only renders the text.

The role is named cref because Verso already defines Manual.xref. Existing {ref} uses are not migrated here.

Closes #24.

🤖 Generated with Claude Code

{cref "tag"}[] links to the section with that tag or to the exercise
with that name, and generates the link text from the target: the
section's title, or the exercise's name. Nothing else is added; the
prose says what is cited. The text is filled in during traversal, so
the HTML and the generated Lean projects both carry it. An unknown or
ambiguous tag fails the build.

Exercises now get an HTML anchor and register their names in a domain
of their own. The two references in Logic/PL.lean point back at
exercise implication-as-disj, and Logic/Proof.lean links to exercise
prop-exchange. STYLE-CODE.md and STYLE-WRITING.md record the role.

Closes #24.

AI usage: Claude (Anthropic) designed and implemented the role and the
exercise anchors and drafted the style-guide entries; the author
reviewed and approved the changes.
Copilot AI balanced review requested due to automatic review settings November 20, 2026 22:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@arademaker
arademaker merged commit ef53728 into main Nov 20, 2026
1 check passed
@arademaker
arademaker deleted the feat/cref branch November 20, 2026 22:15
arademaker added a commit that referenced this pull request Nov 20, 2026
Bring in {cref} (#67) and the ModelChecking revision (#68), so the
chapter can cite by {cref} and follow the new layout of the mutual
blocks.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cross-references to exercises are not possible

2 participants