diff --git a/README.md b/README.md index 3abccaa..616a4cf 100644 --- a/README.md +++ b/README.md @@ -93,15 +93,15 @@ In order to apply the workflow to any other publication copy it into the `runtim $ ./scripts/run.py # run if not yet running $ ./scripts/exec_in_container.py # enter container -1. eoatex -> pdf +1. process eoatex: - $ process_eoa_latex.py -f input/example/eoatex/EOASample.tex + $ process_eoa_latex.py input/example/124_eoatex (adjust filename if necessary) This script calls several other scripts to compile the input into several different output formats. Every script can be run seperately if needed. Just check the contents of the script for details. -## The DocX workflow (docx -> TEI -> pdf, django, epub) (TODO: complete documentation, test and fix workflow) +## The TEI workflow (TEI -> pdf, django, epub) The following description uses the example publication in `input/example` (from the `eoa-publication-model` repository). In order to apply the workflow to any other publication copy it into the `input/` directory and adjust paths in the description accordingly. @@ -111,25 +111,10 @@ In order to apply the workflow to any other publication copy it into the `input/ $ ./scripts/run.py # run if not yet running $ ./scripts/exec_in_container.py # enter container -1. eoaTEI -> eoaTEI with bibliography +1. process tei - $ tei_add_bibl.py input/example/tei + $ process_tei.py input/example/125_tei_part -1. eoaTEI -> eoaTEX +## The DocX workflow (DocX -> TEI -> ...) (TODO: describe how) - $ tei2eoatex.py -f input/example/tei/exampleTEI.xml - -1. eoaTEX -> pdf - - $ eoatex2pdf.py -f output/from_tei/eoatex/main.tex -o output/from_tei/pdf - - (adjust filename if necessary) - -1. eoaTEI -> imxml (to intermediate xml) - - $ gather_pickledata.py input/example/tei/exampleTEI.xml input/example/tei/example.bib - $ tei2imxml.py -f input/example/tei/exampleTEI.xml - -1. eoaTEI -> html - - $ tei2html.py +Convert from DocX to eoaTEI, then continue with the tei workflow (adjust paths accordingly) as described above. diff --git a/dependencies.conf b/dependencies.conf index 3b3e90c..1cd7964 100644 --- a/dependencies.conf +++ b/dependencies.conf @@ -13,7 +13,7 @@ hash = 2a01be46ee82fce5eba6074359b3d18db2222e0c [eoa-publication-model] uri = https://github.molgen.mpg.de/EditionOpenAccess/eoa-publication-model.git -hash = 5ff326580a6bc34756bce511a23146453fdb82b6 +hash = 62eb49dd05ebe3697e47acac31a1cff2f60c6f7a # init not needed, since only example publication is needed [webdesign_platform] diff --git a/src/eoatex2imxml.py b/src/eoatex2imxml.py index 7e4f303..e7603b1 100755 --- a/src/eoatex2imxml.py +++ b/src/eoatex2imxml.py @@ -67,40 +67,26 @@ default = BASE_DIR / "config" / "eoaconvert.cfg", help="Name of config file" ) -parser.add_argument( - "-l", "--log-dir", - default = DEFAULT_OUTPUT_DIR / "logs", - help="logfile" -) parser.add_argument( "--log-level", default = "INFO", help="log level: choose between DEBUG, INFO, WARNING, ERROR, CRITICAL" ) -parser.add_argument( - "--tei-guidelines", - default = DEFAULT_DEPENDENCIES_DIR / "TEI", - help="path to the https://github.com/TEIC/TEI" -) -parser.add_argument( - "--tei-stylesheets", - default = DEFAULT_DEPENDENCIES_DIR / "Stylesheets", - help="path to the https://github.com/TEIC/Stylesheets" -) parser.add_argument( "-f", "--filename", - required = True, - help="Name of main EOATeX file (without suffix!)." + default = Path("*.tex"), + type = Path, + help = "xml file inside INPUT_DIR, or absolute path. Patterns like '*.xml' are also acceptable" ) parser.add_argument( "--latex-dir", - default = DEFAULT_OUTPUT_DIR / "latex", - help="directory where to find the output generated by eoatex2pdf.py" + type = Path, + help="directory where to find the output generated by eoatex2pdf.py. default: {DEFAULT_OUTPUT_DIR}/INPUT_DIR/pdf" ) parser.add_argument( "-o", "--output-dir", - default = DEFAULT_OUTPUT_DIR / "imxml", - help="where to dump all output files" + type = Path, + help = f"output directory. default: {DEFAULT_OUTPUT_DIR}/INPUT_DIR/imxml" ) parser.add_argument( "-t", "--trash", @@ -116,6 +102,11 @@ action="store_true", help="Embed webdesign of EOA1.0 into XML" ) +parser.add_argument( + "INPUT_DIR", + help = "directory containing the publication (including resources like pictures, etc.)", + type = Path, +) args = parser.parse_args() @@ -129,17 +120,6 @@ # run biber_2.1 -O biber2-1n.bbl $INPUT to obtain this file BIBERFILE = "biber2-1.bbl" -################################## -# Reading the configuration file # -################################## - -CONFIG = load_config( - CONFIG_FILE, - args.log_level, - (Path(args.log_dir) / SCRIPT_NAME) . with_suffix( ".log" ), - # args.log_file, -) - ######################## # Paths to executables # ######################## @@ -150,25 +130,19 @@ # TL_PATH = CONFIG['Executables']['texlive'] # TEXBIN_PATH = CONFIG['Executables']['texbin'] -############################ -# Paths to auxiliary files # -############################ -TRALICS_PATH_LIB = BASE_DIR / CONFIG['Auxiliaries']['TRALICS_PATH_LIB'] -TEMPLATE_PATH = BASE_DIR / CONFIG['Auxiliaries']['template_path'] -SUPPORT_PATH = BASE_DIR / CONFIG['Auxiliaries']['support_path'] - ############################ # Paths: ############################ -INPUT_DIR = Path( args.filename ).resolve().parent -INPUT_PATH = Path( args.filename ) -if INPUT_PATH.suffix == '': - INPUT_PATH = INPUT_PATH.with_suffix( ".tex" ) -elif INPUT_PATH.suffix != ".tex": - raise( Exception( "input file matching '*.tex' expected" ) ) -OUTPUT_DIR = Path( args.output_dir ) -LATEX_DIR = Path ( args.latex_dir ) -LOG_DIR = Path( args.log_dir ) +INPUT_DIR = args.INPUT_DIR +INPUT_PATH = args.filename +INPUT_PATH = \ + args.filename if args.filename . is_absolute() else list(INPUT_DIR . glob( str(args.filename) ))[0] +OUTPUT_DIR = \ + args.output_dir if args.output_dir is not None else (DEFAULT_OUTPUT_DIR / INPUT_DIR.resolve().stem) / "imxml" +LATEX_DIR = \ + args.latex_dir if args.latex_dir is not None else (DEFAULT_OUTPUT_DIR / INPUT_DIR.resolve().stem) / "pdf" +LOG_DIR = OUTPUT_DIR / "log" +LOG_FILE = (LOG_DIR / SCRIPT_NAME) . with_suffix( ".log" ) TEMP_DIR = OUTPUT_DIR / "tmp_files" DEBUG_DIR = OUTPUT_DIR / "debug" @@ -178,6 +152,23 @@ BIB2HTML_FILENAME = "temp" +################################## +# Reading the configuration file # +################################## + +CONFIG = load_config( + CONFIG_FILE, + args.log_level, + LOG_FILE, +) + +############################ +# Paths to auxiliary files # +############################ +TRALICS_PATH_LIB = BASE_DIR / CONFIG['Auxiliaries']['TRALICS_PATH_LIB'] +TEMPLATE_PATH = BASE_DIR / CONFIG['Auxiliaries']['template_path'] +SUPPORT_PATH = BASE_DIR / CONFIG['Auxiliaries']['support_path'] + ################################################# # Checking for existance of tools and libraries # diff --git a/src/eoatex2pdf.py b/src/eoatex2pdf.py index a7be5a3..d86abc0 100755 --- a/src/eoatex2pdf.py +++ b/src/eoatex2pdf.py @@ -16,10 +16,10 @@ SCRIPT_PATH = Path( __file__ ) SCRIPT_NAME = SCRIPT_PATH.stem -INPUT_DIR = \ +DEFAULT_INPUT_DIR = \ Path(os.environ['INPUT_DIR'] if 'INPUT_DIR' in os.environ else './input') -OUTPUT_DIR = \ +DEFAULT_OUTPUT_DIR = \ Path(os.environ['OUTPUT_DIR'] if 'OUTPUT_DIR' in os.environ else './output') def main( @@ -110,24 +110,20 @@ def copy_bib_file(): ) parser.add_argument( "-f", "--filename", - required = True, - help="Name of main EOATeX file without .tex extension." + default = Path("*.tex"), + type = Path, + help = "xml file inside INPUT_DIR, or absolute path. Patterns like '*.xml' are also acceptable" ) parser.add_argument( "-o", "--output-dir", - default = OUTPUT_DIR / "latex", - help = "output directory" + type = Path, + help = f"output directory. default: {DEFAULT_OUTPUT_DIR}/INPUT_DIR/pdf" ) parser.add_argument( "-c", "--config", default = BASE_DIR / "config" / "eoaconvert.cfg", help="Name of config file" ) - parser.add_argument( - "-l", "--log-file", - default = (OUTPUT_DIR / "logs" / SCRIPT_NAME).with_suffix(".log"), - help="logfile" - ) parser.add_argument( "--log-level", default = "INFO", @@ -139,16 +135,30 @@ def copy_bib_file(): default = False, help="Run only two passes of XeLaTeX and no biber." ) + parser.add_argument( + "INPUT_DIR", + help = "directory containing the publication (including resources like pictures, etc.)", + type = Path, + ) + args = parser.parse_args() + input_dir = args.INPUT_DIR + input_file = \ + args.filename if args.filename . is_absolute() else list(input_dir . glob( str(args.filename) ))[0] + # output_dir = args.output_dir + output_dir = \ + args.output_dir if args.output_dir is not None else (DEFAULT_OUTPUT_DIR / input_dir.resolve().stem) / "pdf" + log_dir = output_dir / "log" + log_file = (log_dir / SCRIPT_NAME) . with_suffix( ".log" ) load_config( args.config, args.log_level, - args.log_file + log_file ) main( - input_file = args.filename, - output_dir = args.output_dir, + input_file = input_file, + output_dir = output_dir, nobiber = args.no_biber ) diff --git a/src/gather_pickledata.py b/src/gather_pickledata.py deleted file mode 100755 index 5fbcfd0..0000000 --- a/src/gather_pickledata.py +++ /dev/null @@ -1,93 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8; mode: python -*- - -""" -Gather some data for further conversion steps. This is originally part of fix_tei. -""" - -__version__ = "1.0" -__date__ = "20190718" -__author__ = "kthoden@mpiwg-berlin.mpg.de" - -from utils.load_config import load_config - -from pathlib import Path -import os -import shutil -import argparse -import logging -import pickle -import fix_tei -from lxml import etree - -DEFAULT_INPUT_DIR = \ - Path(os.environ['INPUT_DIR'] if 'INPUT_DIR' in os.environ else './input') -DEFAULT_OUTPUT_DIR = \ - Path(os.environ['OUTPUT_DIR'] if 'OUTPUT_DIR' in os.environ else './output') - - -ns_tei = "http://www.tei-c.org/ns/1.0" -NS_MAP = {"t" : ns_tei} - -logging.basicConfig(level=logging.DEBUG, format=' %(asctime)s - %(levelname)s - %(message)s') - -def main( - teifile, - bibfile, - output, -): - """The main bit""" - xml_tree = etree.parse(args.teifile) - - bibdata = fix_tei.parse_bibtex(args.bibfile) - - cited = xml_tree.xpath("//t:bibl/t:ref/@target", namespaces=NS_MAP) - used_citekeys = [fix_tei.unescape(c[1:]) for c in cited] - citekeys_not_in_bib = fix_tei.validate_citations(used_citekeys, bibdata) - - fix_tei.pickle_data(citekeys_not_in_bib, used_citekeys, output) -# def main ends here - -if __name__ == '__main__': - parser = argparse.ArgumentParser( - formatter_class=argparse.ArgumentDefaultsHelpFormatter - ) - parser.add_argument( - "teifile", - help="The XML file from which data is pickled." - ) - parser.add_argument( - "bibfile", - help="The bibliography file for checking the references." - ) - parser.add_argument( - "-o", "--output-dir", - default = DEFAULT_OUTPUT_DIR / "from_tei/pickle", - metavar = "OUTPUT_DIR", - help="output directory" - ) - # picklefile = "output/imxml/tmp_files/data.pickle" - parser.add_argument( - "-!", "--overwrite", - action = "store_true", - default = False, - help="overwrite files at OUTPUT_DIR" - ) - args = parser.parse_args() - - output_dir = Path( args.output_dir ) - - if output_dir.exists(): - if args.overwrite: - shutil.rmtree( output_dir ) - else: - raise( Exception( f"output directory already existing: '{output_dir}'!" ) ) - if not output_dir.exists(): - os.mkdir( output_dir ) - - main( - teifile = args.teifile, - bibfile = args.bibfile, - output = output_dir / "data.pickle", - ) -# finis diff --git a/src/imxml2django.py b/src/imxml2django.py index dfe51d0..6b64bd8 100755 --- a/src/imxml2django.py +++ b/src/imxml2django.py @@ -51,12 +51,8 @@ default = BASE_DIR / "config" / "eoaconvert.cfg", dest="CONFIG_FILE", help="Name of configuration file", - metavar="CONFIGURATION" -) -parser.add_argument( - "-l", "--log-file", - default = (DEFAULT_OUTPUT_DIR / 'logs' / SCRIPT_NAME).with_suffix(".log"), - help="logfile" + metavar="CONFIGURATION", + type = Path, ) parser.add_argument( "--log-level", @@ -68,38 +64,24 @@ help="Check the publication.cfg for completeness.", action="store_true" ) -parser.add_argument( - "--publication-dir", - required = True, - # default = DEFAULT_INPUT_DIR, - help="directory containing publication.cfg and the Cover.jpg" -) parser.add_argument( "-i", "--input-dir", - default = DEFAULT_OUTPUT_DIR / "imxml", - help="directory containing the intermediate xml generated by eoatex2imxml.py" + help = f"directory containing some intermediate xml created by previous steps. default: {DEFAULT_OUTPUT_DIR}/PUBLICATION_NAME/imxml", + type = Path, ) parser.add_argument( "-o", "--output-dir", - default = DEFAULT_OUTPUT_DIR / "django", - help="where to dump all output files" + help = f"output directory. default: {DEFAULT_OUTPUT_DIR}/PUBLICATION_NAME/django", + type = Path, +) +parser.add_argument( + "PUBLICATION_DIR", + help = "directory containing the publication (including resources like pictures, etc.)", + type = Path, ) args = parser.parse_args() -config_file = args.CONFIG_FILE - -print("The configfile is %s." % config_file) - -################################## -# Reading the configuration file # -################################## -CONFIG = load_config( - config_file, - args.log_level, - args.log_file, -) - ######################## # Paths to executables # ######################## @@ -109,13 +91,29 @@ ############################ # Paths: ############################ -INPUT_DIR = Path( args.input_dir ) -OUTPUT_DIR = Path( args.output_dir ) -PUBLICATION_DIR = Path( args.publication_dir ) +PUBLICATION_DIR = args.PUBLICATION_DIR +INPUT_DIR = \ + args.input_dir if args.input_dir is not None else DEFAULT_OUTPUT_DIR / PUBLICATION_DIR.resolve().stem / "imxml" +OUTPUT_DIR = \ + args.output_dir if args.output_dir is not None else (DEFAULT_OUTPUT_DIR / PUBLICATION_DIR.resolve().stem) / "django" +LOG_DIR = OUTPUT_DIR / "log" +LOG_FILE = (LOG_DIR / SCRIPT_NAME) . with_suffix( ".log" ) TEMP_DIR = OUTPUT_DIR / "tmp_files" -# CONVERT_DIR = OUTPUT_DIR / "CONVERT" DEBUG_DIR = OUTPUT_DIR / "debug" +config_file = args.CONFIG_FILE + +print("The configfile is %s." % config_file) + +################################## +# Reading the configuration file # +################################## +CONFIG = load_config( + config_file, + args.log_level, + LOG_FILE, +) + ############################ # Paths to auxiliary files # ############################ @@ -128,16 +126,10 @@ if not TEMP_DIR.exists(): os.makedirs( TEMP_DIR ) -# if not CONVERT_DIR.exists(): -# os.makedirs( CONVERT_DIR ) if not DEBUG_DIR.exists(): os.makedirs( 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) logging.info(f"The publication.cfg file is missing in django directory.") if os.path.exists(INPUT_DIR / "publication.cfg"): shutil.copy(INPUT_DIR / "publication.cfg", OUTPUT_DIR) @@ -185,10 +177,6 @@ # Convert tralics-XML to Django Data Structure # ############################################################################ """) -# Create django File Structure -# if not os.path.exists(CONVERT_DIR / "django"): -# os.mkdir(CONVERT_DIR / "django") - # os.mkdir(CONVERT_DIR / "django" / "images") if not os.path.exists(OUTPUT_DIR / "images"): os.mkdir(OUTPUT_DIR / "images") if not os.path.exists(OUTPUT_DIR / "images" / "embedded"): diff --git a/src/imxml2epub.py b/src/imxml2epub.py index ebe65d1..4280e0a 100755 --- a/src/imxml2epub.py +++ b/src/imxml2epub.py @@ -52,33 +52,21 @@ help="Name of configuration file", metavar="CONFIGURATION" ) -parser.add_argument( - "-l", "--log-file", - default = (DEFAULT_OUTPUT_DIR / "logs" / SCRIPT_NAME) . with_suffix( ".log" ), - help="logfile" -) parser.add_argument( "--log-level", default = "INFO", help="log level: choose between DEBUG, INFO, WARNING, ERROR, CRITICAL" ) - -parser.add_argument( - "--publication-dir", - default = DEFAULT_INPUT_DIR, - help="directory containing publication.cfg and the Cover.jpg" -) parser.add_argument( "-i", "--input-dir", - default = DEFAULT_OUTPUT_DIR / "imxml", - help="directory containing the intermediate xml generated by eoatex2imxml.py" + help = f"directory containing some intermediate xml created by previous steps. default: {DEFAULT_OUTPUT_DIR}/PUBLICATION_NAME/imxml", + type = Path, ) parser.add_argument( "-o", "--output-dir", - default = DEFAULT_OUTPUT_DIR / "epub", - help="where to dump all output files" + help = f"output directory. default: {DEFAULT_OUTPUT_DIR}/PUBLICATION_NAME/imxml", + type = Path, ) - parser.add_argument( "-f", "--font", help="Font to be used, default is TeX Gyre Termes", @@ -97,6 +85,11 @@ "--extra-font-files-directory", help="Specify the directory with files of the font (the font itself, License)", ) +parser.add_argument( + "PUBLICATION_DIR", + help = "directory containing the publication (including resources like pictures, etc.)", + type = Path, +) parser.add_argument( "-him", "--hyperimage", @@ -107,21 +100,6 @@ args = parser.parse_args() -config_file = args.CONFIG_FILE - -print(f"The config file is {config_file}") -logseparator = "-"*53 + "\n" - -################################## -# Reading the configuration file # -################################## - -CONFIG = load_config( - config_file, - args.log_level, - args.log_file, -) - ######################## # Paths to executables # ######################## @@ -134,12 +112,32 @@ ############################ # Paths: ############################ -INPUT_DIR = Path( args.input_dir ) -OUTPUT_DIR = Path( args.output_dir ) -PUBLICATION_DIR = Path( args.publication_dir ) +PUBLICATION_DIR = args.PUBLICATION_DIR +INPUT_DIR = \ + args.input_dir if args.input_dir is not None else DEFAULT_OUTPUT_DIR / PUBLICATION_DIR.resolve().stem / "imxml" +OUTPUT_DIR = \ + args.output_dir if args.output_dir is not None else (DEFAULT_OUTPUT_DIR / PUBLICATION_DIR.resolve().stem) / "django" +LOG_DIR = OUTPUT_DIR / "log" +LOG_FILE = (LOG_DIR / SCRIPT_NAME) . with_suffix( ".log" ) TEMP_DIR = OUTPUT_DIR / "tmp_files" DEBUG_DIR = OUTPUT_DIR / "debug" +################################## +# Reading the configuration file # +################################## + +config_file = args.CONFIG_FILE + +print(f"The config file is {config_file}") +logseparator = "-"*53 + "\n" + +CONFIG = load_config( + config_file, + args.log_level, + LOG_FILE, + # args.log_file, +) + ############################ # Paths to auxiliary files # ############################ diff --git a/src/process_eoa_latex.py b/src/process_eoa_latex.py index cf2f9cd..809a1fd 100755 --- a/src/process_eoa_latex.py +++ b/src/process_eoa_latex.py @@ -25,19 +25,19 @@ Path(os.environ['DEPENDENCIES_DIR'] if 'DEPENDENCIES_DIR' in os.environ else './dependencies') def main( - input_file + publ_dir ): exec_command( - f"eoatex2pdf.py -f \"{input_file}\"" + f"eoatex2pdf.py \"{publ_dir}\"" ) exec_command( - f"eoatex2imxml.py -f \"{input_file}\"" + f"eoatex2imxml.py \"{publ_dir}\"" ) exec_command( - f"imxml2django.py --publication-dir \"{input_file.parent}\"" + f"imxml2django.py \"{publ_dir}\"" ) exec_command( - f"imxml2epub.py --publication-dir \"{input_file.parent}\"" + f"imxml2epub.py \"{publ_dir}\"" ) if __name__ == "__main__": @@ -49,11 +49,6 @@ def main( parser = argparse.ArgumentParser( formatter_class=argparse.ArgumentDefaultsHelpFormatter ) - parser.add_argument( - "-f", "--filename", - required = True, - help="Name of main EOATeX file (without suffix!)." - ) parser.add_argument( "-c", "--config", default = BASE_DIR / "config" / "eoaconvert.cfg", @@ -71,6 +66,11 @@ def main( default = "INFO", help="log level: choose between DEBUG, INFO, WARNING, ERROR, CRITICAL" ) + parser.add_argument( + "PUBLICATION_DIR", + help = "directory containing the publication (including resources like pictures, etc.)", + type = Path, +) args = parser.parse_args() @@ -81,5 +81,5 @@ def main( ) main( - input_file = Path( args.filename ) + publ_dir = Path( args.PUBLICATION_DIR ) ) diff --git a/src/process_tei.py b/src/process_tei.py new file mode 100755 index 0000000..6b42cf5 --- /dev/null +++ b/src/process_tei.py @@ -0,0 +1,92 @@ +#!/usr/bin/env python3 + +from utils.load_config import load_config, exec_command + +# imports +import argparse +from pathlib import Path +import glob +import os +import subprocess +import shutil +import logging + +BASE_DIR = Path( __file__ ).resolve().parent +SCRIPT_PATH = Path( __file__ ) +SCRIPT_NAME = SCRIPT_PATH.stem + +DEFAULT_INPUT_DIR = \ + Path(os.environ['INPUT_DIR'] if 'INPUT_DIR' in os.environ else './input') + +DEFAULT_OUTPUT_DIR = \ + Path(os.environ['OUTPUT_DIR'] if 'OUTPUT_DIR' in os.environ else './output') + +DEFAULT_DEPENDENCIES_DIR = \ + Path(os.environ['DEPENDENCIES_DIR'] if 'DEPENDENCIES_DIR' in os.environ else './dependencies') + +def main( + publ_dir +): + PUBL_NAME = publ_dir.resolve().stem + exec_command( + f"tei_add_bibl.py -! \"{publ_dir}\"" + ) + exec_command( + f"tei2eoatex.py -! \"{publ_dir}\"" + ) + exec_command( + f"eoatex2pdf.py --output-dir \"{DEFAULT_OUTPUT_DIR}/{PUBL_NAME}/pdf\" \"{DEFAULT_OUTPUT_DIR}/{PUBL_NAME}/eoatex\"" + ) + exec_command( + f"tei_pickle.py -! \"{DEFAULT_OUTPUT_DIR}/with_bibl/{PUBL_NAME}\"" + ) + exec_command( + f"tei2imxml.py --filename no_bibl.xml \"{DEFAULT_OUTPUT_DIR}/with_bibl/{PUBL_NAME}\"" + ) + exec_command( + f"tei2html.py -! --filename \"with_bibl.xml\" \"{DEFAULT_OUTPUT_DIR}/with_bibl/{PUBL_NAME}\"" + ) + +if __name__ == "__main__": + + ##################### + # Parsing arguments # + ##################### + + parser = argparse.ArgumentParser( + formatter_class=argparse.ArgumentDefaultsHelpFormatter + ) + parser.add_argument( + "-c", "--config", + default = BASE_DIR / "config" / "eoaconvert.cfg", + dest="CONFIG_FILE", + help="Name of configuration file", + metavar="CONFIGURATION" + ) + parser.add_argument( + "-l", "--log-file", + default = (DEFAULT_OUTPUT_DIR / 'logs' / SCRIPT_NAME).with_suffix(".log"), + help="logfile" + ) + parser.add_argument( + "--log-level", + default = "INFO", + help="log level: choose between DEBUG, INFO, WARNING, ERROR, CRITICAL" + ) + parser.add_argument( + "PUBLICATION_DIR", + help = "directory containing the publication (including resources like pictures, etc.)", + type = Path, +) + + args = parser.parse_args() + + CONFIG = load_config( + args.CONFIG_FILE, + args.log_level, + args.log_file, + ) + + main( + publ_dir = Path( args.PUBLICATION_DIR ) + ) diff --git a/src/stylesheets/insert_bibliography.xsl b/src/stylesheets/insert_bibliography.xsl index 4ad9367..11a3fba 100644 --- a/src/stylesheets/insert_bibliography.xsl +++ b/src/stylesheets/insert_bibliography.xsl @@ -15,8 +15,17 @@ version="1.0" /> - - + + + +