@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
@@ -1,8 +1,19 @@
|
||||
|
||||
// In-text links to a section on another (or the same) page of a book:
|
||||
// <a class="pagelink" data-page="BASENAME" data-id="ID">, which @document
|
||||
// emits for @link ... :section @ (document_html.cpp, resolve_section_links).
|
||||
// go_to_section() swaps in the embedded page and scrolls to the id, and
|
||||
// calls this again for the links of the page it just showed. Each anchor
|
||||
// is bound once: a page shown twice is the same nodes bound twice otherwise.
|
||||
function set_link_listeners() {
|
||||
Array.from(document.getElementsByClassName("pagelink")).forEach(
|
||||
function (elt) {
|
||||
if (elt.getAttribute("data-bound")) {
|
||||
return;
|
||||
}
|
||||
elt.setAttribute("data-bound", "true");
|
||||
elt.addEventListener("click", function(event) {
|
||||
event.preventDefault();
|
||||
let basename = elt.getAttribute("data-page");
|
||||
let id = elt.getAttribute("data-id");
|
||||
go_to_section(elt, basename, id);
|
||||
@@ -10,3 +21,4 @@ function set_link_listeners() {
|
||||
});
|
||||
}
|
||||
|
||||
window.addEventListener("load", set_link_listeners);
|
||||
Reference in new issue
Block a user