From 9786f3b8de631272435e9b35c50a1ab9de81cbd0 Mon Sep 17 00:00:00 2001 From: Andrew White Date: Tue, 21 Nov 2023 10:23:23 -0800 Subject: [PATCH] Fixed eating paranthetical statements --- paperqa/types.py | 7 ++++++- paperqa/version.py | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/paperqa/types.py b/paperqa/types.py index 41a907eaf..60f4c3c80 100644 --- a/paperqa/types.py +++ b/paperqa/types.py @@ -145,6 +145,7 @@ def markdown(self) -> Tuple[str, str]: index = 1 for citation in iter_citations(self.answer): compound = "" + strip = True for c in citation.split(",;"): c = c.strip("() ") if c == "Extra background information": @@ -157,17 +158,21 @@ def markdown(self) -> Tuple[str, str]: self.get_citation(c) except ValueError: # not a citation + strip = False continue refs[c] = index compound += f"[^{index}]" index += 1 - output = output.replace(citation, compound) + if strip: + output = output.replace(citation, compound) formatted_refs = "\n".join( [ f"[^{i}]: [{self.get_citation(r)}]({extract_doi(self.get_citation(r))})" for r, i in refs.items() ] ) + # quick fix of space before period + output = output.replace(" .", ".") return output, formatted_refs def combine_with(self, other: "Answer") -> "Answer": diff --git a/paperqa/version.py b/paperqa/version.py index 641cc7839..d8c1804a3 100644 --- a/paperqa/version.py +++ b/paperqa/version.py @@ -1 +1 @@ -__version__ = "3.13.1" +__version__ = "3.13.2"