本文整理汇总了Python中pybtex.style.template.field函数的典型用法代码示例。如果您正苦于以下问题:Python field函数的具体用法?Python field怎么用?Python field使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了field函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: format_inbook
def format_inbook(self, e):
template = toplevel [
tag('pubtitle') [tag('b') [field('title')]],
Symbol('br'),
sentence [self.format_names('author')],
self.format_volume_and_series(e),
Symbol('br'),
words [
sentence(capfirst=True) [
self.format_chapter_and_pages(e),
#optional[ self.format_editor(e, as_sentence=False) ],
self.format_btitle(e, 'booktitle', as_sentence=False),
#self.format_volume_and_series(e, as_sentence=False),
#self.format_chapter_and_pages(e),
],
Symbol('br'),
sentence [
field('publisher'),
optional_field('address'),
optional [
words [field('edition'), 'edition']
],
#date,
#Symbol('br'),
#optional_field('note'),
],
],
Symbol('br'),
sentence [
optional_field('note'),
],
Symbol('br'),
#self.format_web_refs(e),
]
return template.format_data(e)
示例2: format_patent
def format_patent(self, e):
template = toplevel [
self.format_names('author'),
self.format_title(e, 'title'),
join [tag('emph') [field('number')], ' ', '(', field('year'), ')']
]
return template.format_data(e)
示例3: format_volume_and_series
def format_volume_and_series(self, e, as_sentence=True):
volume_and_series = optional [
words [
'volume', field('volume'), optional [
words ['of', field('series')]
]
]
]
number_and_series = optional [
words [
join(sep=Symbol('nbsp')) ['number', field('number')],
optional [
words ['in', field('series')]
]
]
]
series = optional_field('series')
result = first_of [
volume_and_series,
number_and_series,
series,
]
if as_sentence:
return sentence(capfirst=False) [result]
else:
return result
示例4: format_article
def format_article(self, e):
volume_and_pages = first_of [
# volume and pages, with optional issue number
optional [
join [
field('volume'),
optional['(', field('number'),')'],
':', pages
],
],
# pages only
words ['pages', pages],
]
template = toplevel [
self.format_title(e, 'title'),
Symbol('br'),
self.format_names('author'),
Symbol('br'),
tag('journal') [tag('b') [field('journal')]],
optional[ volume_and_pages ],
Symbol('br'),
optional [
words [
field('note'),
Symbol('br')
]
],
#self.format_web_refs(e),
#sentence(capfirst=False) [ optional_field('note') ],
]
return template.format_data(e)
示例5: format_book
def format_book(self, e):
template = toplevel [
self.format_author_or_editor(e),
tag('emph') [sentence [field('title')]],
self.format_volume_and_series(e),
sentence [field('publisher'), date],
]
return template.format_data(e)
示例6: format_chapter_and_pages
def format_chapter_and_pages(self, e):
return join(sep=', ') [
field('title', apply_func=dquote),
words [
optional [words ['chapter', field('chapter'), 'of']],
tag('emph') [field('booktitle')]
],
optional [words ['pages', pages]],
]
示例7: format_url
def format_url(self, e):
# based on urlbst format.url
return href [
field('url'),
join(' ') [
'URL:',
field('url')
]
]
示例8: format_article
def format_article(self, e):
template = toplevel [
self.format_names('author'),
self.format_title(e, 'title'),
join [tag('emph') [field('journal')], ' ',
tag('strong')[field('volume')], ', ', unsrt.pages,
' (', field('year'), ')'],
sentence(capfirst=False) [ optional_field('note') ],
self.format_web_refs(e),
]
return template.format_data(e)
示例9: format_patent
def format_patent(self, e):
template = toplevel [
self.format_title(e, 'title'),
sentence(capfirst=False) [ date, ],
href [
field('howpublished'),
sentence(capfirst=False) [ field('note') ],
],
self.format_web_refs(e),
]
return template.format_data(e)
示例10: format_article
def format_article(self, e):
volume_and_pages = first_of [
join [field('volume'), optional [':', pages]],
words ['pages', optional [pages]]
]
template = toplevel [
self.format_names('author'),
sentence [field('title')],
sentence [
tag('emph') [field('journal')], volume_and_pages, date],
]
return template.format_data(e)
示例11: format_doi
def format_doi(self, e):
# based on urlbst format.doi
return href [
join [
'http://dx.doi.org/',
field('doi')
],
join [
'doi:',
field('doi')
]
]
示例12: format_eprint
def format_eprint(self, e):
# based on urlbst format.eprint
return href [
join [
'http://arxiv.org/abs/',
field('eprint')
],
join [
'arXiv:',
field('eprint')
]
]
示例13: format_pubmed
def format_pubmed(self, e):
# based on urlbst format.pubmed
return href [
join [
'http://www.ncbi.nlm.nih.gov/pubmed/',
field('pubmed')
],
join [
'PMID:',
field('pubmed')
]
]
示例14: format_article
def format_article(self, e):
volume_and_pages = first_of [
join [ optional [ 'vol. ', field('volume'), ', '],
optional [ words [ 'no.', field('number') ] ],
optional [': ', pages] ],
optional [ words ['pages', pages] ]
]
template = toplevel [
self.format_names('author'),
sentence [field('title', apply_func=dquote)],
sentence [
tag('emph') [field('journal')], volume_and_pages, date],
]
return template.format_data(e)
示例15: format_article
def format_article(self, entry):
#author = entry.fields['author']
if 'volume' in entry.fields:
volume_and_pages = join [field('volume'), optional [':', 'pages']]
else:
volume_and_pages = words ['pages', optional ['pages']]
#import pdb
#pdb.set_trace()
template = toplevel [
self.format_name(entry.persons['author'][0]),
sentence [field('title')],
sentence [
tag('emph') [field('journal')], volume_and_pages, field('year')],
]
return template.format_data(entry)