diff --git a/eoatex2imxml.py b/eoatex2imxml.py index 4e667f0..5a01ad1 100755 --- a/eoatex2imxml.py +++ b/eoatex2imxml.py @@ -180,33 +180,6 @@ if not os.path.exists( DEBUG_DIR ): os.mkdir( DEBUG_DIR ) -''' -# Check for folder and necessary files -if not os.path.exists(CONVERT_DIR): - logging.info(f"The directory {CONVERT_DIR} has not been created yet. Creating it for you") - time.sleep(1) - os.makedirs(CONVERT_DIR) -if not os.path.exists(CONVERT_DIR / "publication.cfg"): - logging.info(f"The publication.cfg file is missing in {CONVERT_DIR} directory.") - if os.path.exists(INPUT_DIR / "publication.cfg"): - shutil.copy(INPUT_DIR / "publication.cfg", CONVERT_DIR) - logging.info(f"Copied from {INPUT_DIR}.") - else: - logging.error("Found no publication.cfg. Exiting") - sys.exit() -if not os.path.exists(CONVERT_DIR / "cover.jpg"): - logging.info(f"The file cover.jpg in {CONVERT_DIR} directory is missing.") - if os.path.exists(INPUT_DIR / "Cover.jpg"): - shutil.copy("Cover.jpg", CONVERT_DIR / "cover.jpg") - logging.info("Copied from current directory.") - else: - logging.error("No coverfile found. You can create a temporary one with the mkimage.py script") - sys.exit() -# if os.path.exists(os.getcwd() + "/pre_xml.tex") == False: -# print ("pre_xml fehlt") -# sys.exit() -''' - # Copy Support-Files from /Library/MPIWG to current directory shutil.copy(SUPPORT_PATH / "classes.dtd", OUTPUT_DIR) shutil.copy(SUPPORT_PATH / "mathml2-qname-1.mod", OUTPUT_DIR) @@ -215,16 +188,6 @@ copy_dir_overwrite(SUPPORT_PATH / "iso8879", (OUTPUT_DIR / "iso8879")) copy_dir_overwrite(SUPPORT_PATH / "iso9573-13", (OUTPUT_DIR / "iso9573-13")) copy_dir_overwrite(SUPPORT_PATH / "mathml", (OUTPUT_DIR / "mathml")) -''' -shutil.copy(SUPPORT_PATH / "classes.dtd", os.getcwd()) -shutil.copy(SUPPORT_PATH / "mathml2-qname-1.mod", os.getcwd()) -shutil.copy(SUPPORT_PATH / "mathml2.dtd", os.getcwd()) -copy_dir_overwrite(SUPPORT_PATH / "html", (os.getcwd() + "/html")) -copy_dir_overwrite(SUPPORT_PATH / "iso8879", (os.getcwd() + "/iso8879")) -copy_dir_overwrite(SUPPORT_PATH / "iso9573-13", (os.getcwd() + "/iso9573-13")) -copy_dir_overwrite(SUPPORT_PATH / "mathml", (os.getcwd() + "/mathml")) -# shutil.copytree(SUPPORT_PATH + "mathml2", (os.getcwd() + "/mathml2")) -''' ######################################## # Certain functions for specific tasks # @@ -515,14 +478,8 @@ def run_tralics( fixed_tex_file_path, "xml" ) - # other possible tralics options: - # -output_dir DIR - # -output_file FILENAME - # Convert TeX to XML via Tralics - logging.info( f"executing {TRALICS_PATH_EXEC}. log file: {TRALICS_LOG_PATH}" ) - # input_dir = Path(input_file).absolute().parent exec_command( "{cmd} -log_file {log_file} -confdir {conf_dir}/tralics_conf -config {conf_dir}/tralics.tcf -utf8 -utf8output -output_dir={output_dir} -input_dir={input_dir} -input_file={input_file}".format( cmd = TRALICS_PATH_EXEC, @@ -534,17 +491,6 @@ def run_tralics( ), ignore_fail = True # :-D ) - ''' - exec_command( - f"{TRALICS_PATH_EXEC} -log_file {TRALICS_LOG_PATH} -confdir {TRALICS_PATH_LIB}/tralics_conf -config {TRALICS_PATH_LIB}/tralics.tcf -utf8 -utf8output -output_dir={output_dir} -input_dir={input_dir} -input_file={input_file}", - ignore_fail = True # :-D - ) - Kommando = \ - f"{TRALICS_PATH_EXEC} -log_file {TRALICS_LOG_PATH} -confdir {TRALICS_PATH_LIB}/tralics_conf -config {TRALICS_PATH_LIB}/tralics.tcf -utf8 -utf8output {input_file}" - Argumente = shlex.split(Kommando) - Prozess = subprocess.call(Argumente) - logging.debug(f"Tralics command: {Kommando}") - ''' run_tralics( input_file = INPUT_PATH_NO_EXT + '.tex',