Add chapter headers

This commit is contained in:
mark committed 2026-09-28 22:39:57 -04:00
1 parent 48daaf7ce3
commit e087ba9933
3 files changed
+31 -11

No files matched your search

+11 -4
View File
@@ -460,11 +460,16 @@ def render_inline(nodes, book, chapter, out):
out.append(esc(node["v"]))
elif kind == "verse":
label = esc(node["label"])
out.append('<span class="v" id="%s" role="button" tabindex="0" '
vid = verse_id(chapter, node["label"])
# A link to itself: the click both puts the verse in the address
# bar, which is what the options dialog offers to copy, and opens
# that dialog. Being a real link is also what gives it the
# keyboard and context menu a reader expects.
out.append('<a class="v" id="%s" href="#%s" '
# A non-breaking space keeps the number on the same
# line as the word it introduces, as the source does.
'aria-label="Verse %s, options">%s</span>&#160;'
% (verse_id(chapter, node["label"]), label, label))
'aria-label="Verse %s, options">%s</a>&#160;'
% (vid, vid, label, label))
elif kind == "noteref":
n = node["id"].replace("FN", "")
out.append('<a class="noteref" id="fnref%s_%s" href="#fn%s_%s">'
@@ -531,7 +536,9 @@ def render_chapter(chapter, book, out):
num = chapter["number"]
out.append(' <section class="chapter" id="ch%d" data-chapter="%d">\n'
% (num, num))
out.append(' <h2 class="chapter-number">%d</h2>\n' % num)
out.append(' <h2 class="chapter-number">'
'<a href="#ch%d" aria-label="Chapter %d">%d</a></h2>\n'
% (num, num, num))
group = None