From 2ecccea48a2f0ee4b7e62714f4fa04c411392753 Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Thu, 25 Apr 2019 14:44:06 +0300 Subject: [PATCH] Fix bibliography arguments --- pandoc_reader.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pandoc_reader.py b/pandoc_reader.py index ea4e9b7..6e39b04 100644 --- a/pandoc_reader.py +++ b/pandoc_reader.py @@ -60,9 +60,6 @@ class PandocReader(BaseReader): text = list(fp.splitlines()) metadata, content = self._get_meta_and_content(text) - bib_dir = self.settings.get('PANDOC_BIBDIR', '') - - bib_header = self.settings.get('PANDOC_BIBHEADER', None) filters = self.settings.get('PANDOC_FILTERS', []) extensions = self.settings.get('PANDOC_EXTENSIONS', '') @@ -79,16 +76,19 @@ class PandocReader(BaseReader): pandoc_cmd.extend(["--filter", filt]) pandoc_cmd.extend(extra_args) + bib_dir = self.settings.get('PANDOC_BIBDIR', '') + bib_header = self.settings.get('PANDOC_BIBHEADER', None) if "bibliography" in metadata.keys(): bib_file = os.path.join(bib_dir, metadata['bibliography']) if not os.path.exists(bib_file): raise FileNotFoundError(bib_file) - extra_args = extra_args + ['--bibliography={}'.format(bib_file)] + bib_args = ['--bibliography={}'.format(bib_file)] if bib_header is not None: - extra_args = extra_args + [ + bib_args = bib_args + [ '--metadata=reference-section-title="{}"'.format( bib_header)] + pandoc_cmd.extend(bib_args) proc = subprocess.Popen( pandoc_cmd,