-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: use bibtexparser convert_to_unicode function
- Loading branch information
perrette
committed
Apr 21, 2023
1 parent
635aeed
commit 4742508
Showing
3 changed files
with
27 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,8 @@ | |
import papers | ||
from papers.config import cached | ||
from papers import logger | ||
from papers.encoding import family_names, latex_to_unicode | ||
from papers.encoding import family_names | ||
from bibtexparser.customization import convert_to_unicode | ||
|
||
my_etiquette = Etiquette('papers', papers.__version__, 'https://github.com/perrette/papers', '[email protected]') | ||
|
||
|
@@ -369,14 +370,15 @@ def fetch_entry(e): | |
if 'doi' in e and isvaliddoi(e['doi']): | ||
bibtex = fetch_bibtex_by_doi(e['doi']) | ||
else: | ||
e = convert_to_unicode(e) | ||
kw = {} | ||
if e.get('author',''): | ||
kw['author'] = latex_to_unicode(family_names(e['author'])) | ||
kw['author'] = family_names(e['author']) | ||
if e.get('title',''): | ||
kw['title'] = latex_to_unicode(family_names(e['title'])) | ||
kw['title'] = e['title'] | ||
if kw: | ||
bibtex = fetch_bibtex_by_fulltext_crossref('', **kw) | ||
else: | ||
ValueError('no author not title field') | ||
ValueError('no author nor title field') | ||
db = bibtexparser.loads(bibtex) | ||
return db.entries[0] |