From 523ad2339cd8f73c5834bf4d4dd5cec1404b5d91 Mon Sep 17 00:00:00 2001 From: Klaus Thoden Date: Tue, 5 Dec 2017 14:37:44 +0100 Subject: [PATCH] Disabling a tralics module that broke the conversion --- .../amsmath.plt | 0 eoaconvert.py | 21 +++++-------------- 2 files changed, 5 insertions(+), 16 deletions(-) rename config/{tralics_conf => disabled_tralics_conf}/amsmath.plt (100%) diff --git a/config/tralics_conf/amsmath.plt b/config/disabled_tralics_conf/amsmath.plt similarity index 100% rename from config/tralics_conf/amsmath.plt rename to config/disabled_tralics_conf/amsmath.plt diff --git a/eoaconvert.py b/eoaconvert.py index 75dae82..960a0f5 100755 --- a/eoaconvert.py +++ b/eoaconvert.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -*- coding: utf-8; mode: python -*- -# Time-stamp: <2017-10-30 13:12:19 (kthoden)> +# Time-stamp: <2017-12-05 14:41:09 (kthoden)> # license? __version__="" @@ -69,15 +69,7 @@ numeric_level = getattr(logging, LOGLEVEL.upper(), None) if not isinstance(numeric_level, int): raise ValueError('Invalid log level: %s' % loglevel) -logging.basicConfig(filename=LOGFILE, level=numeric_level, format='%(asctime)s - %(levelname)s - %(message)s') - -LOGFILE = CONFIG['General']['logfile'] -LOGLEVEL = CONFIG['General']['loglevel'] - -numeric_level = getattr(logging, LOGLEVEL.upper(), None) -if not isinstance(numeric_level, int): - raise ValueError('Invalid log level: %s' % loglevel) -logging.basicConfig(filename=LOGFILE, level=numeric_level, format='%(asctime)s - %(levelname)s - %(message)s') +logging.basicConfig(filename=LOGFILE, level=LOGLEVEL, format='%(asctime)s - %(levelname)s - %(message)s') ######################## # Paths to executables # @@ -329,7 +321,7 @@ def progress(count, total, status=''): bar = '#' * filled_len + '-' * (bar_len - filled_len) sys.stdout.write('[%s] %s%s ... %s\r' % (bar, percents, '%', status)) - sys.stdout.flush() + sys.stdout.flush() # def progress ends here def cleanup(): @@ -399,7 +391,7 @@ def cleanup(): ############################################################## # Convert TeX to XML via Tralics -Kommando = "%s -confdir %s/tralics_conf -config %s/tralics.tcf -utf8 -utf8output %s.tex" % (TRALICS_PATH_EXEC, TRALICS_PATH_LIB, TRALICS_PATH_LIB, options.filename) +Kommando = "%s -log_file %s -confdir %s/tralics_conf -config %s/tralics.tcf -utf8 -utf8output %s.tex" % (TRALICS_PATH_EXEC, options.filename + "-tralics.log", TRALICS_PATH_LIB, TRALICS_PATH_LIB, options.filename) Argumente = shlex.split(Kommando) Prozess = subprocess.call(Argumente) @@ -473,8 +465,6 @@ def cleanup(): dictChapters[Chapteruid] = str(Chapternumber) Chapternumber += 1 - - # EOAequation, EOAsubequation and EOAequationarray Numbering per Chapter intChapterNumber = 1 print("-----------------------------------------------------") @@ -483,7 +473,6 @@ def cleanup(): intEquationnumber = 1 xmlDinge = xmlChapter.xpath(".//EOAequation | .//EOAequationarray | .//EOAsubequations") print("Working on Chapter %d which contains %d formulæ." % (intChapterNumber, len(xmlDinge))) - # print ("Es wurden " + str(len(xmlDinge)) + " Formeln gefunden") for xmlDing in xmlDinge: if xmlDing.tag == "EOAequationarray": # tmpNumberinArray is only being used for filename @@ -747,7 +736,7 @@ def cleanup(): strSourceCode = xmlEOAineq.text progress(intEOAineqnumber, len(xmlEOAineqs),"Processing EOAineq %s of %s." % (intEOAineqnumber, len(xmlEOAineqs))) - + strSourceCode = os.linesep.join([s for s in strSourceCode.splitlines() if s]) strTeXEquations = strTeXEquations + "$" + strSourceCode + "$\n\\newpage\n" # Add intEOAineqRunningOrder : Filename to dictionary