aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2012-12-23 00:18:44 +0100
committerMatěj Cepl <mcepl@redhat.com>2012-12-23 00:18:44 +0100
commit08893d5fb0dbbdce85aaa25d771cf239d9e45b16 (patch)
tree25b28f79051f8724c7c2167472290a9821002485
parent5658977fea79964f849cd63050721910d69f8038 (diff)
downloadhesla-08893d5fb0dbbdce85aaa25d771cf239d9e45b16.tar.gz
Use correct biblical references.
Original source uses weird names of the biblical books (e.g., Thr for Lamentations). I have added a dict with which I translate those to the standard names understood by the biblical references (namely, http://www.crosswire.org/study/). Fixes #78.
-rwxr-xr-xgenerate_html_cs.py39
-rw-r--r--templates/base.html4
2 files changed, 41 insertions, 2 deletions
diff --git a/generate_html_cs.py b/generate_html_cs.py
index 4bae29e..c74309d 100755
--- a/generate_html_cs.py
+++ b/generate_html_cs.py
@@ -9,6 +9,41 @@ import jinja2
cur_year = 2012
+book_abbrs = {
+ "Gn": "Gen", "Ex": "Exod",
+ "Lv": "Lev", # NA in source code,
+ "Nu": "Num", "Dt": "Deut", "Jos": "Josh", "Jdc": "Judg",
+ "Ruth": "Ruth", # NA in source code
+ "1Sm": "1Sam", "2Sm": "2Sam", "1Rg": "1Kgs", "2Rg": "2Kgs",
+ "1Chr": "1Chr", "2Chr": "2Chr",
+ "Ezra": "Ezra", # NA in source code,
+ "Neh": "Neh",
+ "Esth": "Esth", # NA in source code,
+ "Job": "Job", "Ps": "Ps", "Prv": "Prov", "Eccl": "Eccl",
+ "Song": "Song", # NA in source code,
+ "Is": "Isa", "Jr": "Jer", "Thr": "Lam", "Ez": "Ezek",
+ "Dn": "Dan", "Hos": "Hos", "Joel": "Joel",
+ "Amos": "Amos", # NA in source code
+ "Obad": "Obad", # NA in source code
+ "Jon": "Jonah", "Mch": "Mic",
+ "Nah": "Nah", # NA in source code
+ "Hab": "Hab",
+ "Zeph": "Zeph", # NA in source code
+ "Hag": "Hag", # NA in source code
+ "Zch": "Zech", "Ml": "Mal",
+ "Mt": "Matt", "Mc": "Mark", "L": "Luke", "J": "John",
+ "Act": "Acts",
+ "R": "Rom", "1K": "1Cor", "2K": "2Cor",
+ "G": "Gal", "E": "Eph", "Ph": "Phil", "Kol": "Col",
+ "1Th": "1Thess", "2Th": "2Thess", "1T": "1Tim", "2T": "2Tim",
+ "Tt": "Titus",
+ "Phlm": "Phlm", # NA in source code
+ "H": "Heb", "Jc": "Jas",
+ "1P": "1Pet", "2P": "2Pet",
+ "1J": "1John", "2J": "2John", "3J": "3John",
+ "Jd": "Jude", "Ap": "Rev"
+}
+
def csv2dict(filename):
out_dict = {}
splitRE = re.compile(r'\s+')
@@ -45,6 +80,10 @@ def parse_body(elem):
"verse": source_elem.attrib['v'],
}
+ # biblical reference (compatible with the English Bible programs)
+ wword['int_ref_id'] = wword['ref_id'].copy()
+ wword['int_ref_id']['book'] = book_abbrs[wword['ref_id']['book']]
+
# text of the verse
verses = list(elem.getiterator("L"))
logging.debug("verses = %s", verses)
diff --git a/templates/base.html b/templates/base.html
index b86e6f2..db30760 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -18,8 +18,8 @@
<article id="{{ art.date_id }}"><header><h1>{{ art.date_full }}{%-
if art.sunday %}<br>{{ art.sunday }}{%- endif %}</h1></header>
{% for wword in art.watchwords %}<p>{{ wword.text }}</p>
- <p class="reference">{% if wword.ref_id -%}
- <a href="{{ bible_url(wword.ref_id) }}">
+ <p class="reference">{% if wword.int_ref_id -%}
+ <a href="{{ bible_url(wword.int_ref_id) }}">
{{ wword.ref }}
</a>
{%- else %}