Skip to content

Commit

Permalink
Fixed eating paranthetical statements (#211)
Browse files Browse the repository at this point in the history
  • Loading branch information
whitead authored Nov 21, 2023
1 parent 30e9989 commit 6092eab
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion paperqa/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand All @@ -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":
Expand Down
2 changes: 1 addition & 1 deletion paperqa/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "3.13.1"
__version__ = "3.13.2"

0 comments on commit 6092eab

Please sign in to comment.