parent
b6e8139bc3
commit
ec98221d1c
@ -1,9 +1,16 @@
|
|||||||
# display formatting
|
# display formatting
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
from . import color
|
from . import color
|
||||||
from .bibstruct import TYPE_KEY
|
from .bibstruct import TYPE_KEY
|
||||||
|
|
||||||
|
|
||||||
|
CHARS = re.compile('[{}\n\t\r]')
|
||||||
|
|
||||||
|
def sanitize(s):
|
||||||
|
return CHARS.sub('', s)
|
||||||
|
|
||||||
# should be adaptated to bibtexparser dicts
|
# should be adaptated to bibtexparser dicts
|
||||||
def person_repr(p):
|
def person_repr(p):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
@ -32,13 +39,13 @@ def bib_oneliner(bibdata):
|
|||||||
elif bibdata[TYPE_KEY] == 'inproceedings':
|
elif bibdata[TYPE_KEY] == 'inproceedings':
|
||||||
journal = ' ' + bibdata.get('booktitle', '')
|
journal = ' ' + bibdata.get('booktitle', '')
|
||||||
|
|
||||||
return u'{authors} \"{title}\"{journal}{year}'.format(
|
return sanitize(u'{authors} \"{title}\"{journal}{year}'.format(
|
||||||
authors=color.dye_out(authors, 'author'),
|
authors=color.dye_out(authors, 'author'),
|
||||||
title=color.dye_out(bibdata.get('title', ''), 'title'),
|
title=color.dye_out(bibdata.get('title', ''), 'title'),
|
||||||
journal=color.dye_out(journal, 'publisher'),
|
journal=color.dye_out(journal, 'publisher'),
|
||||||
year=' ({})'.format(color.dye_out(bibdata['year'], 'year'))
|
year=' ({})'.format(color.dye_out(bibdata['year'], 'year'))
|
||||||
if 'year' in bibdata else ''
|
if 'year' in bibdata else ''
|
||||||
)
|
))
|
||||||
|
|
||||||
|
|
||||||
def bib_desc(bib_data):
|
def bib_desc(bib_data):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user