Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Adding CSL file to configuration
  • Loading branch information
Klaus Thoden committed Feb 28, 2018
1 parent f626aa5 commit b8704ef
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions config/eoaconvert.cfg
Expand Up @@ -14,3 +14,4 @@ TRALICS_PATH_EXEC: /Users/kthoden/bin/tralics-2.15.4
TRALICS_PATH_LIB: /Users/kthoden/EOAKram/dev/EOASkripts/config/ TRALICS_PATH_LIB: /Users/kthoden/EOAKram/dev/EOASkripts/config/
TEMPLATE_PATH: /Users/kthoden/EOAKram/dev/EOASkripts/data/aux/ TEMPLATE_PATH: /Users/kthoden/EOAKram/dev/EOASkripts/data/aux/
SUPPORT_PATH: /Users/kthoden/EOAKram/dev/EOASkripts/data/dtd_files/ SUPPORT_PATH: /Users/kthoden/EOAKram/dev/EOASkripts/data/dtd_files/
CSL_FILE: /Users/kthoden/EOAKram/dev/eoa-csl/chicago-author-date-custom.csl
6 changes: 3 additions & 3 deletions libeoaconvert.py
Expand Up @@ -9,21 +9,21 @@
import configparser import configparser
from lxml.html import soupparser from lxml.html import soupparser



################################## ##################################
# Reading the configuration file # # Reading the configuration file #
################################## ##################################
CONFIG_FILE = os.path.dirname(sys.argv[0]) + "/config/eoaconvert.cfg" CONFIG_FILE = os.path.dirname(sys.argv[0]) + "/config/eoaconvert.cfg"
CONFIG = configparser.ConfigParser() CONFIG = configparser.ConfigParser()
CONFIG.read(CONFIG_FILE) CONFIG.read(CONFIG_FILE)



###################### ######################
# Setting up logging # # Setting up logging #
###################### ######################
LOGFILE = CONFIG['General']['logfile'] LOGFILE = CONFIG['General']['logfile']
LOGLEVEL = CONFIG['General']['loglevel'] LOGLEVEL = CONFIG['General']['loglevel']


CSL_FILE = CONFIG['Auxiliaries']['CSL_FILE']

logging.basicConfig(level=LOGLEVEL, format='%(asctime)s - %(levelname)s - %(message)s') logging.basicConfig(level=LOGLEVEL, format='%(asctime)s - %(levelname)s - %(message)s')




Expand Down Expand Up @@ -172,7 +172,7 @@ def format_citations(used_citekeys, bibdata, language):
# citation_formatter.write("@%s\n" % entry) # citation_formatter.write("@%s\n" % entry)
citation_formatter.write("\n# References\n") citation_formatter.write("\n# References\n")


command = "pandoc -o tmp_files/formatted_citations.html -t html --filter=pandoc-citeproc --bibliography=%s --csl=/Users/kthoden/EOAKram/dev/eoa-csl/eoa.csl tmp_files/used_citations.md" % bibdata command = "pandoc -o tmp_files/formatted_citations.html -t html --filter=pandoc-citeproc --bibliography=%s --csl=%s tmp_files/used_citations.md" % (CSL_FILE, bibdata)
arguments = shlex.split(command) arguments = shlex.split(command)
logging.info("Using external command pandoc with command %s" % command) logging.info("Using external command pandoc with command %s" % command)
subprocess.call(arguments) subprocess.call(arguments)
Expand Down

0 comments on commit b8704ef

Please sign in to comment.