@link :section links to a section by its heading, with an alone value (from dev 831455f36fcd)
A section link names the TEXT of a heading: :section alone means the current file, a value names the file of the same @document that has it. Resolved by @document at assembly in html and tex; errors for a missing file, a missing title, a doubled title and a link outside a @document. The Markdown converter reads a Markdown anchor as a section link to the heading its slug names. Also from dev: the converter's four silent defects fixed and --chapter (9ae2c4cd), and the engine's alone-value error text. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
32aa47d41c
commit
f4dcdf3ffd
15 files changed
+594
-114
No files matched your search
@@ -417,3 +417,20 @@ def html_format_footnotes(text, K=None):
|
||||
# Temporarily add room for footnotes to move to the top of the window for the test:
|
||||
result += '<div style="height: 100lh"></div>\n'
|
||||
return result
|
||||
|
||||
|
||||
|
||||
# @link :section outside a @document (2026-10-12). A section link is
|
||||
# resolved when @document assembles its chapters, so one that is applied
|
||||
# outside any document can never be resolved: its marker would reach the
|
||||
# output. @document sets K_document_file on each chapter's Machine; a
|
||||
# Machine without it that still holds the marker after its own apply is
|
||||
# that case. (Inside a document the outer Machine's apply ends with the
|
||||
# resolved text -- html writes files and returns nothing -- so the marker
|
||||
# is gone by the time this runs there.)
|
||||
def check_section_links(text, K):
|
||||
if "__seclink__" in text and not getattr(K, "K_document_file", ""):
|
||||
raise ValueError("A @link with :section names a section by its heading, "
|
||||
"which only a @document can resolve, and this link is "
|
||||
"outside any @document")
|
||||
return text
|
||||
Reference in new issue
Block a user