@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
+10
-2
@@ -49,10 +49,15 @@ class Section(klammer_base.Klammer_base):
|
||||
# names = "part chapter section subsection subsubsection paragraph subparagraph subsubparagraph subsubsubparagraph".split()
|
||||
names = "part sA sB sC sD sE".split()
|
||||
|
||||
# The \hypertarget name. K_document_file is the chapter's basename,
|
||||
# set by @document (document_latex.cpp): with it the name is stable
|
||||
# across the page cache, where a counter alone collided when some
|
||||
# chapters were served from cache and others reprocessed.
|
||||
basename = getattr(self, "K_document_file", "") or ""
|
||||
if self.id:
|
||||
id = self.id
|
||||
else:
|
||||
id = f"-s{Section.label_number}"
|
||||
id = f"{basename}-s{Section.label_number}"
|
||||
Section.label_number += 1
|
||||
|
||||
result = ''
|
||||
@@ -64,7 +69,10 @@ class Section(klammer_base.Klammer_base):
|
||||
|
||||
# result = kutil.protect_klammertext_special_characters(result)
|
||||
|
||||
result = f"%__sectionlink__{id}__{self.title}__" + "\n" + result
|
||||
# The announcement @document's section-link resolver reads (fields
|
||||
# separated by KTSL; see sks/document/section_link.h). Title last:
|
||||
# it may hold anything.
|
||||
result = f"%__sectionlink__{id}__KTSL__{basename}__KTSL__{self.title}__" + "\n" + result
|
||||
return result
|
||||
|
||||
def txt(self):
|
||||
|
||||
Reference in new issue
Block a user