File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change 1
1
# ReScience yaml parser
2
2
# Released under the BSD two-clauses licence
3
+ import unicodedata
3
4
4
5
import yaml
5
6
import dateutil .parser
@@ -155,6 +156,14 @@ def __init__(self, data):
155
156
self .authors_full += self .authors [n - 2 ].fullname + " and "
156
157
self .authors_full += self .authors [n - 1 ].fullname
157
158
159
+ # create ASCII bibtex label
160
+ # - Try to convert unicode character to their ASCII equivalent
161
+ bibtex_label_bytes = \
162
+ unicodedata .normalize ('NFKD' , self .authors [0 ].lastname ).encode ('ascii' ,
163
+ 'ignore' )
164
+ self .bibtex_label = str (bibtex_label_bytes , 'ascii' )
165
+
166
+
158
167
159
168
160
169
def parse (self , data ):
Original file line number Diff line number Diff line change 4
4
5
5
def generate_bibtex (filename , article ):
6
6
content = (
7
- "@Article {{{_.authors[0].lastname }:{_.date_published.year},\n "
7
+ "@Article {{{_.bibtex_label }:{_.date_published.year},\n "
8
8
" author = {{{_.authors_full}}},\n "
9
9
" title = {{{{{_.title}}}}},\n "
10
10
" journal = {{{_.journal_name}}},\n "
You can’t perform that action at this time.
0 commit comments