Fix
This commit is contained in:
1 parent
6925c46568
commit
7127e3ff9d
27 files changed
+721
-676
No files matched your search
+18
-2
@@ -88,7 +88,7 @@ def render_inline(nodes, book, chapter, out):
|
||||
n = node["id"].replace("FN", "")
|
||||
out.append('<a class="noteref" id="fnref%s_%s" href="#fn%s_%s">'
|
||||
"<sup>%s</sup></a>" % (chapter, n, chapter, n,
|
||||
esc(node.get("marker") or "*")))
|
||||
esc(caller(node.get("marker")))))
|
||||
elif kind == "br":
|
||||
out.append("<br>")
|
||||
elif kind == "ref":
|
||||
@@ -118,6 +118,22 @@ def render_block(block, book, chapter, out):
|
||||
out.append("</%s>\n" % tag)
|
||||
|
||||
|
||||
# Footnote callers arrive from the source as * † ‡ § ✡. The star is the only
|
||||
# one of them a browser may decide is an emoji: no serif font carries a glyph
|
||||
# for U+2721, so the fallback chain reaches the colour emoji font and drops a
|
||||
# purple tile into the middle of a verse. U+FE0E is the standardised way to ask
|
||||
# for the text glyph of the same character -- the symbol, not the emoji. There
|
||||
# is no separate text codepoint to switch to; this is the only lever.
|
||||
TEXT_PRESENTATION = "\ufe0e"
|
||||
EMOJI_CAPABLE = "\u2721"
|
||||
|
||||
|
||||
def caller(marker):
|
||||
"""A footnote marker, asked to render as text rather than as an emoji."""
|
||||
return "".join(c + TEXT_PRESENTATION if c in EMOJI_CAPABLE else c
|
||||
for c in (marker or "*"))
|
||||
|
||||
|
||||
def render_notes(notes, chapter, book, out):
|
||||
if not notes:
|
||||
return
|
||||
@@ -128,7 +144,7 @@ def render_notes(notes, chapter, book, out):
|
||||
n = (note["id"] or "").replace("FN", "")
|
||||
out.append(' <li class="note" id="fn%s_%s" data-kind="%s">'
|
||||
% (chapter, n, note["kind"]))
|
||||
out.append('<span class="marker">%s</span> ' % esc(note.get("marker") or "*"))
|
||||
out.append('<span class="marker">%s</span> ' % esc(caller(note.get("marker"))))
|
||||
if note.get("ref"):
|
||||
out.append('<a class="backref" href="#fnref%s_%s">%s</a> '
|
||||
% (chapter, n, esc(note["ref"])))
|
||||
|
||||
Reference in new issue
Block a user