Decent
This commit is contained in:
1 parent
77bf8d9f2e
commit
ea193e1264
53 files changed
+545
-347
No files matched your search
+17
-11
@@ -3,11 +3,11 @@
|
||||
|
||||
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 carrying data-template. The surrounding shell is assembled at request
|
||||
time by the service worker from the nunjucks templates in assets/, 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 templates without regenerating it.
|
||||
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
|
||||
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.
|
||||
|
||||
This is the only build step left, and books/ is all it owns: everything
|
||||
hand-written lives in assets/ and is served straight from there. Run it when
|
||||
@@ -176,8 +176,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 whose
|
||||
# data-template names the template that wraps it.
|
||||
# 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.
|
||||
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'
|
||||
@@ -187,8 +187,15 @@ def render_book(book, translation, out_dir):
|
||||
out.append(' <header class="book-header">\n')
|
||||
out.append(" <h1>")
|
||||
if book["titles"]:
|
||||
for part in book["titles"]:
|
||||
out.append('<span class="%s">%s</span>' % (part["style"], esc(part["text"])))
|
||||
# Separated by a space, not run together. The spans record what USFM
|
||||
# called them -- mt2 and mt3 were lines above and below the main title
|
||||
# -- but they are set as one line here, and without the space between
|
||||
# them Genesis reads "The First Book of Moses,Commonly CalledGenesis".
|
||||
# The markup still says what each part is, so stacking them again is a
|
||||
# stylesheet away.
|
||||
out.append(" ".join('<span class="%s">%s</span>'
|
||||
% (part["style"], esc(part["text"]))
|
||||
for part in book["titles"]))
|
||||
else:
|
||||
out.append(esc(name))
|
||||
out.append("</h1>\n")
|
||||
@@ -226,8 +233,7 @@ SECTION_LABELS = [
|
||||
|
||||
def render_index(books, translation, out_dir):
|
||||
out = ["<title>%s</title>\n" % esc(translation["name"]),
|
||||
'<div class="index" data-template="index">\n <h1>%s</h1>\n'
|
||||
% esc(translation["name"])]
|
||||
'<div class="index" data-template="index">\n']
|
||||
for key, label in SECTION_LABELS:
|
||||
group = [b for b in books if b["section"] == key]
|
||||
if not group:
|
||||
|
||||
Reference in new issue
Block a user