Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed eating paranthetical statements #211

Merged
merged 1 commit into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
Loading