Skip to content
This repository was archived by the owner on Nov 28, 2025. It is now read-only.

Commit 5edea1d

Browse files
authored
🐛 Regular expressions for parsing pandoc output of citations do not work on Windows systems because of Windows-style linebreaks. (#320)
1 parent 9717a10 commit 5edea1d

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/mkdocs_bibtex/registry.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,10 +222,10 @@ def _process_with_pandoc(self, citation_blocks: list[CitationBlock]) -> tuple[di
222222
reference_cache = {}
223223

224224
# Pattern for format with .csl-left-margin and .csl-right-inline
225-
pattern1 = r"::: \{#ref-(?P<key>[^\s]+) .csl-entry\}\n\[.*?\]\{\.csl-left-margin\}\[(?P<citation>.*?)\]\{\.csl-right-inline\}" # noqa: E501
225+
pattern1 = r"::: \{#ref-(?P<key>[^\s]+) .csl-entry\}\r?\n\[.*?\]\{\.csl-left-margin\}\[(?P<citation>.*?)\]\{\.csl-right-inline\}" # noqa: E501
226226

227227
# Pattern for simple reference format
228-
pattern2 = r"::: \{#ref-(?P<key>[^\s]+) .csl-entry\}\n(?P<citation>.*?)(?=:::|$)"
228+
pattern2 = r"::: \{#ref-(?P<key>[^\s]+) .csl-entry\}\r?\n(?P<citation>.*?)(?=:::|$)"
229229

230230
# Try first pattern
231231
matches1 = re.finditer(pattern1, references, re.DOTALL)

0 commit comments

Comments
 (0)