• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python template.field函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pybtex.style.template.field函数的典型用法代码示例。如果您正苦于以下问题:Python field函数的具体用法?Python field怎么用?Python field使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了field函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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)
开发者ID:rahulsavani,项目名称:pelican_homepage,代码行数:35,代码来源:rahul_style.py


示例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)
开发者ID:cycomanic,项目名称:pelican-bibtex,代码行数:7,代码来源:pelican_perpagepublications.py


示例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
开发者ID:OVii,项目名称:communityvisweb,代码行数:26,代码来源:unsrt.py


示例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)
开发者ID:rahulsavani,项目名称:pelican_homepage,代码行数:31,代码来源:rahul_style.py


示例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)
开发者ID:rybesh,项目名称:pybtex,代码行数:8,代码来源:custom.py


示例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]],
     ]
开发者ID:rybesh,项目名称:pybtex,代码行数:9,代码来源:custom.py


示例7: format_url

 def format_url(self, e):
     # based on urlbst format.url
     return href [
         field('url'),
         join(' ') [
             'URL:',
             field('url')
             ]
         ]
开发者ID:andreas-h,项目名称:pybtex,代码行数:9,代码来源:unsrt.py


示例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)
开发者ID:cycomanic,项目名称:pelican-bibtex,代码行数:11,代码来源:pelican_perpagepublications.py


示例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)
开发者ID:mkoval,项目名称:mkoval.github.com,代码行数:11,代码来源:style.py


示例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)
开发者ID:rybesh,项目名称:pybtex,代码行数:12,代码来源:unsrt.py


示例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')
             ]
         ]
开发者ID:andreas-h,项目名称:pybtex,代码行数:12,代码来源:unsrt.py


示例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')
             ]
         ]
开发者ID:andreas-h,项目名称:pybtex,代码行数:12,代码来源:unsrt.py


示例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')
             ]
         ]
开发者ID:andreas-h,项目名称:pybtex,代码行数:12,代码来源:unsrt.py


示例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)
开发者ID:rybesh,项目名称:pybtex,代码行数:14,代码来源:custom.py


示例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)
开发者ID:mattpap,项目名称:masters-thesis,代码行数:15,代码来源:bibtex.py


示例16: format_title

    def format_title(self, e, which_field, as_sentence=False):

        def protected_capitalize(x):
            """Capitalize string, but protect {...} parts."""
            result = ""
            level = 0
            for pos, c in enumerate(x):
                if c == '{':
                    level += 1
                elif c == '}':
                    level -= 1
                elif pos == 0:
                    c = c.upper()
                elif level <= 0:
                    c = c.lower()
                result += c
            return result

        # formatted_title = field(which_field)

        formatted_title = tag('pubtitle') [ tag('b') [field(which_field)]]

        # formatted_title = field(  ABC ERROR
            # which_field, apply_func=protected_capitalize)

        

        if as_sentence:
            return sentence(capfirst=False) [tag('b') [ formatted_title ]]
        else:
            return formatted_title
开发者ID:rahulsavani,项目名称:pelican_homepage,代码行数:31,代码来源:rahul_style.py


示例17: format_inproceedings

    def format_inproceedings(self, e):
        template = toplevel [
            tag('b') [self.format_title(e, 'title')],
            Symbol('br'),
            self.format_names('author'),
            Symbol('br'),
            words [
                # 'In',
                # optional[ self.format_editor(e, as_sentence=False) ],
                # tag('conference') [self.format_btitle(e, 'booktitle', as_sentence=False)],
                tag('conference') [self.format_btitle(e, 'shorttitle', as_sentence=False)],
                # self.format_volume_and_series(e, as_sentence=False),
                # optional[ words [pages] ], 
                # optional[ field('pages') ],
                # optional_field('pages',apply_func=dashify) # ABC ERROR
                #self.format_address_organization_publisher_date(e),
                Symbol('br'),
            ],
            optional [
                words [
                    field('note'),
                    Symbol('br')  
                ]
            ],
            #self.format_web_refs(e),
        ]
        # print field('pages',apply_func=dashify) # ABC error

        return template.format_data(e)
开发者ID:rahulsavani,项目名称:pelican_homepage,代码行数:29,代码来源:rahul_style.py


示例18: format_title

    def format_title(self, e, which_field, as_sentence=True):

        def protected_capitalize(x):
            """Capitalize string, but protect {...} parts."""

            result = Text()
            level = 0
            for pos, c in enumerate(x):
                if c == '{':
                    level += 1
                    c = ''
                elif c == '}':
                    level -= 1
                    c = ''
                elif pos == 0:
                    c = c.upper()
                elif level <= 0:
                    c = c.lower()

                result += c

            return result

        formatted_title = field(
            which_field, apply_func=protected_capitalize)
        if as_sentence:
            return sentence(capfirst=False) [ formatted_title ]
        else:
            return formatted_title
开发者ID:mkoval,项目名称:mkoval.github.com,代码行数:29,代码来源:style.py


示例19: format_misc

 def format_misc(self, e):
     template = toplevel [
          sentence [self.format_names('author')],
          sentence [field('title')],
          sentence [date]
     ]
     return template.format_data(e)
开发者ID:rybesh,项目名称:pybtex,代码行数:7,代码来源:custom.py


示例20: format_inbook

 def format_inbook(self, e):
     template = toplevel [
         sentence [self.format_names('author')],
         sentence [self.format_chapter_and_pages(e)],
         self.format_volume_and_series(e),
         sentence [
             field('publisher'),
             optional_field('address'),
             optional [
                 words [field('edition'), 'edition']
             ],
             date,
             optional_field('note'),
         ]
     ]
     return template.format_data(e)
开发者ID:rybesh,项目名称:pybtex,代码行数:16,代码来源:custom.py



注:本文中的pybtex.style.template.field函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python template.join函数代码示例发布时间:2022-05-25
下一篇:
Python utilities.percentError函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap