Skip to content
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
2 changes: 1 addition & 1 deletion wenxian/feeder/semanticscholar.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def _from_identifier(self, identifier: str) -> Reference | None:
authors.append(Author(first=first, last=last))
# journal may be null, e.g.,
# https://api.semanticscholar.org/graph/v1/paper/10.1103/PhysRevB.109.174106?fields=title,year,abstract,authors.name,journal,externalIds
if res["journal"] is not None:
if res["journal"] is not None and "name" in res["journal"]:
journal = res["journal"]["name"]
# the journal might be HTML escaped, e.g., Journal of Materials Science & Technology
# https://api.semanticscholar.org/graph/v1/paper/10.1016/j.jmst.2023.09.059?fields=title,year,abstract,authors.name,journal,externalIds
Expand Down
4 changes: 4 additions & 0 deletions wenxian/reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,10 @@ def bibtex(self) -> str:
# prevent {} in author that is used to split first and last name
# be escaped
valuestr = valuestr.replace(r"{\{}", r"{").replace(r"{\}}", r"}")
if key == "doi":
# for DOI, underscore should not be escaped
# https://tex.stackexchange.com/questions/550123/underscore-in-doi-in-bibtex-file
valuestr = valuestr.replace(r"{\_}", r"_")
if key == "title":
valuestr = f"{{{{{valuestr}}}}}"
else:
Expand Down