This commit is contained in:
mark committed 2026-09-04 09:05:14 -04:00
1 parent ea193e1264
commit 2fea308b38
106 files changed
+1234 -878

No files matched your search

+9 -7
View File
@@ -3,8 +3,10 @@
Reads the JSON produced by extract_bible.py and writes books/GEN.html and so
on, plus an index. These are fragments, not documents: a <title> and one root
element. The document around them is assets/shell.html, which is static and the
same for every page, so chrome changes never require running this. The markup
element carrying data-template. The document around them is assembled from the
nunjucks templates in assets/templates/ -- by the service worker, or by
boot.html when there can never be one -- so chrome changes never require
running this. The markup
carries structure and no presentation: every USFM distinction survives as a
class or data attribute, so the whole corpus can be restyled from the
stylesheet without regenerating it.
@@ -66,7 +68,7 @@ def ref_href(node, book, chapter):
target_book = node.get("book") or book
target_ch = node.get("chapter", chapter)
verse = node.get("verse")
base = "" if target_book == book else "%s.html" % target_book
base = "" if target_book == book else target_book
if verse:
return "%s#%s" % (base, verse_id(target_ch, verse))
return "%s#ch%d" % (base, target_ch)
@@ -176,8 +178,8 @@ def render_book(book, translation, out_dir):
code, name = book["code"], book["name"]
out = []
title = "%s — %s" % (name, translation["name"])
# A fragment: the title the shell will use, then one root element. The
# class on it is what identifies the kind of page to CSS.
# A fragment: the title the shell will use, then one root element whose
# data-template names the template that wraps it.
out.append("<title>%s</title>\n" % esc(title))
out.append('<article class="book" data-template="book" id="%s" data-book="%s" '
'data-name="%s" data-section="%s">\n'
@@ -205,7 +207,7 @@ def render_book(book, translation, out_dir):
out.append(' <li><a href="#ch%d">%d</a></li>\n'
% (chapter["number"], chapter["number"]))
out.append(" </ul>\n </nav>\n")
out.append(' <p class="home"><a href="index.html">All books</a></p>\n')
out.append(' <p class="home"><a href="./">All books</a></p>\n')
out.append(" </header>\n")
out.append(' <div class="chapters">\n')
@@ -241,7 +243,7 @@ def render_index(books, translation, out_dir):
out.append(' <section class="book-group" data-section="%s">\n' % key)
out.append(" <h2>%s</h2>\n <ul>\n" % esc(label))
for book in group:
out.append(' <li><a href="%s.html">%s</a> '
out.append(' <li><a href="%s">%s</a> '
'<span class="count">%d</span></li>\n'
% (book["code"], esc(book["name"]), len(book["chapters"])))
out.append(" </ul>\n </section>\n")