Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
More debugging messages
  • Loading branch information
kthoden committed Feb 15, 2019
1 parent 52c579a commit 9904abf
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions eoatex2imxml.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
# -*- coding: utf-8; mode: python -*-
# Time-stamp: <2019-02-15 15:01:28 (kthoden)>
# Time-stamp: <2019-02-15 15:08:37 (kthoden)>

"""
Converts Latex files into a customized DocBook XML file.
Expand Down Expand Up @@ -429,6 +429,7 @@ def cleanup():
Kommando = "%s -log_file %s -confdir %s/tralics_conf -config %s/tralics.tcf -utf8 -utf8output %s.tex" % (TRALICS_PATH_EXEC, args.filename + "-tralics.log", TRALICS_PATH_LIB, TRALICS_PATH_LIB, args.filename)
Argumente = shlex.split(Kommando)
Prozess = subprocess.call(Argumente)
logging.debug(f"Tralics command: {Kommando}")

# Fix underscore und fix EOAtranscripted
tmpFile = open ((args.filename) + ".xml", "r")
Expand Down Expand Up @@ -764,7 +765,6 @@ def cleanup():
xmlEOAineqs = xmlChapter.findall(".//EOAineq")
intEOAineqnumber = 1
for xmlEOAineq in xmlEOAineqs:

if xmlEOAineq.find('.//texmath') is not None:
strSourceCode = xmlEOAineq.find('.//texmath').text
else:
Expand Down Expand Up @@ -1074,9 +1074,9 @@ def cleanup():
bib_database = xmlTree.find(".//EOAbibliographydatabase").text
HAS_BIBLIOGRAPHY = True
else:
logging.info("No database found.")
logging.waruning("No database found.")
input("Do you want to continue? Press enter.")
HAS_BIBLIOGRAPHY = False
input()

bib_type = xmlTree.find(".//EOAbibliographytype").text
if bib_type not in ["monograph", "anthology", "monograph-numeric", "anthology-numeric"]:
Expand All @@ -1094,8 +1094,9 @@ def cleanup():
# for x in citations_json:
# print(x["title"])

# with open(interim_bib_json_file, 'w') as ibjf:
# json.dump(citeproc_json.decode('utf-8'), ibjf)
logging.debug(f"Dumping bib json file: {interim_bib_json_file}.")
with open(interim_bib_json_file, 'w') as ibjf:
json.dump(citeproc_json.decode('utf-8'), ibjf)



Expand Down Expand Up @@ -1182,7 +1183,14 @@ def cleanup():
if bib_type == "monograph":

if xmlTree.find(".//EOAprintbibliography") is not None:
# to insert here: with keywords we can have multiple bibliographies
xmlBibliography = xmlTree.find(".//EOAprintbibliography")
bibliography_keyword = xmlBibliography.get("keyword")
if bibliography_keyword:
logging.debug(f"Found bibliography keyword {bibliography_keyword}")
else:
logging.debug(f"No bibliography keyword found")

xmlBibliography.clear()
xmlBibliography.tag = "div"

Expand Down Expand Up @@ -1671,6 +1679,9 @@ def cleanup():
for element in other_content:
previous_div0.append(element)

etree.strip_tags(xmlTree, "tagtobestripped")
etree.strip_elements(xmlTree, "elementtobestripped", with_tail=False)

# here followed the conversion to epub and the conversion to django.xml
# both parts were removed and put into separate files.

Expand Down

0 comments on commit 9904abf

Please sign in to comment.