Skip to content

Commit

Permalink
simplifying parsing logic
Browse files Browse the repository at this point in the history
  • Loading branch information
shyamd committed Jan 6, 2022
1 parent 3584351 commit 15ff2b3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions mkdocs_bibtex/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,16 +196,16 @@ def to_markdown_pandoc(entry, csl_path):
)

# This should cut off the pandoc preamble and ending triple colons
markdown = "\n".join(markdown.split("\n")[2:-2])
markdown = " ".join(markdown.split("\n")[2:-2])

citation_regex = re.compile(
r"\{\.csl-left-margin\}\[(.*)\]\{\.csl-right-inline\}"
)
try:

citation = citation_regex.findall(" ".join(markdown.split("\n")))[0]
citation = citation_regex.findall(markdown)[0]
except IndexError:
citation = " ".join(markdown.split("\n"))
citation = markdown
else:
# Older citeproc-filter version of pandoc
with tempfile.TemporaryDirectory() as tmpdir:
Expand Down

0 comments on commit 15ff2b3

Please sign in to comment.