aboutsummaryrefslogtreecommitdiffstats
path: root/generate_html_cs.py
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@cepl.eu>2022-03-26 19:19:17 +0100
committerMatěj Cepl <mcepl@cepl.eu>2022-03-26 19:19:17 +0100
commiteaecff23868edec4e313735b492bc00090d85c4e (patch)
treefbaf50700383e5d4785cbf234c60261d7516830e /generate_html_cs.py
parentddd8eba57685112295baa0d6883b8e1b128a1257 (diff)
downloadhesla-eaecff23868edec4e313735b492bc00090d85c4e.tar.gz
Fix icons, so the website could be installed (tested on Android).
Diffstat (limited to 'generate_html_cs.py')
-rwxr-xr-xgenerate_html_cs.py31
1 files changed, 17 insertions, 14 deletions
diff --git a/generate_html_cs.py b/generate_html_cs.py
index a9cf382..01db782 100755
--- a/generate_html_cs.py
+++ b/generate_html_cs.py
@@ -103,7 +103,8 @@ def parse_verses(lines):
<BR> elements where necessary).
"""
out = ""
- logging.debug("lines = %s", lines)
+ logging.debug("lines = %s", ",".join(
+ [et.tostring(l, encoding='unicode') for l in lines]))
logging.debug("lines = len %s", len(lines))
if len(lines) > 0:
out = lines[0].text
@@ -126,12 +127,13 @@ def parse_body(elem):
<SL>Žalm 91,9</SL>
</OT>
"""
+ logging.debug('elem:%s', et.tostring(elem, encoding='unicode'))
if len(list(elem)) == 0:
return None
wword = {"text": ""}
source_elem = elem.find("S")
- logging.debug("S elem = %s", source_elem)
+ logging.debug("S elem = %s", et.tostring(source_elem, encoding='unicode'))
logging.debug("S elem = attrib %s", source_elem.attrib)
# biblical reference (computer readable)
@@ -146,6 +148,7 @@ def parse_body(elem):
try:
wword["int_ref_id"] = wword["ref_id"].copy()
wword["int_ref_id"]["book"] = book_abbrs[wword["ref_id"]["book"]]
+ logging.debug("book = %s / %s", wword["ref_id"], wword["int_ref_id"])
except KeyError:
logging.error("book = %s", wword["ref_id"])
raise
@@ -155,9 +158,9 @@ def parse_body(elem):
# references
ref = elem.find("SL")
- logging.debug("ref = %s", ref)
- logging.debug("ref = len %s", len(ref))
+ logging.debug("ref = %s", et.tostring(ref, encoding='unicode'))
if ref is not None:
+ logging.debug("ref.text = %s", ref.text)
wword["ref"] = ref.text
return wword
@@ -206,7 +209,7 @@ def parse_losung(elem):
<CR><SL>Lukáš 3,1-6</SL></CR>
</LOSUNG>
"""
- logging.debug("losung = %s", elem)
+ logging.debug("losung = %s\n", et.tostring(elem, encoding='unicode'))
out = {}
date_id = (
cur_year,
@@ -226,13 +229,14 @@ def parse_losung(elem):
out["readings"] = []
for read in ["SR", "CR", "Ev", "Ep", "Pr", "AT", "Bl"]:
sect = elem.find(read)
- logging.debug("read %s = %s", read, sect)
- try:
- out["readings"].append(
- "\n".join([el.text for el in sect.findall("SL")])
- )
- except AttributeError:
- logging.exception("Parsing heslo pro %s", sect)
+ if sect is not None:
+ try:
+ out["readings"].append(
+ "\n".join([el.text for el in sect.findall("SL")])
+ )
+ except AttributeError:
+ logging.exception("Parsing heslo pro %s", sect)
+ logging.debug("readings = %s", out['readings'])
out["chronicles"] = []
for chron in elem.findall("C"):
@@ -302,8 +306,7 @@ def parse_file(filename):
parse_day(los, article_dict)
article_list = []
- article_keys = sorted(article_dict.keys())
- for key in article_keys:
+ for key in sorted(article_dict.keys()):
article_list.append(article_dict[key])
return template.render(articles=article_list)