当前位置: 首页>>代码示例>>Python>>正文


Python template.sentence函数代码示例

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


在下文中一共展示了sentence函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: 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

示例2: format_proceedings

 def format_proceedings(self, e):
     template = toplevel [
         first_of [
             # there are editors
             optional [
                 join(' ')[
                     self.format_editor(e),
                     sentence [
                         self.format_btitle(e, 'title', as_sentence=False),
                         self.format_volume_and_series(e, as_sentence=False),
                         self.format_address_organization_publisher_date(e),
                     ],
                 ],
             ],
             # there is no editor
             optional_field('organization'),
             sentence [
                 self.format_btitle(e, 'title', as_sentence=False),
                 self.format_volume_and_series(e, as_sentence=False),
                 self.format_address_organization_publisher_date(
                     e, include_organization=False),
             ],
         ],
         sentence(capfirst=False) [ optional_field('note') ],
     ]
     return template.format_data(e)
开发者ID:OVii,项目名称:communityvisweb,代码行数:26,代码来源:unsrt.py

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: format_web_refs

 def format_web_refs(self, e):
     # based on urlbst output.web.refs
     return sentence(capfirst=False) [
         optional [ self.format_url(e) ],
         optional [ self.format_eprint(e) ],
         optional [ self.format_pubmed(e) ],
         optional [ self.format_doi(e) ],
         ]
开发者ID:andreas-h,项目名称:pybtex,代码行数:8,代码来源:unsrt.py

示例8: format_inproceedings

 def format_inproceedings(self, e):
     template = toplevel [
         sentence [self.format_names('author')],
         self.format_title(e, 'title'),
         words [
             'In',
             sentence(capfirst=False) [
                 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),
                 optional[ pages ],
             ],
             self.format_address_organization_publisher_date(e),
         ],
         sentence(capfirst=False) [ optional_field('note') ],
     ]
     return template.format_data(e)
开发者ID:OVii,项目名称:communityvisweb,代码行数:17,代码来源:unsrt.py

示例9: format_title

    def format_title(self, e, which_field, as_sentence=True):
        from pybtex.bibtex.utils import change_case

        formatted_title = field(
            which_field, apply_func=lambda text: change_case(text, 't'))
        if as_sentence:
            return sentence(capitalize=False) [ formatted_title ]
        else:
            return formatted_title
开发者ID:himito,项目名称:pelican-bibtex,代码行数:9,代码来源:mystyle.py

示例10: format_unpublished

 def format_unpublished(self, e):
     template = toplevel [
         sentence [self.format_names('author')],
         self.format_title(e, 'title'),
         sentence(capfirst=False) [
             field('note'),
             optional[ date ]
         ],
     ]
     return template.format_data(e)
开发者ID:OVii,项目名称:communityvisweb,代码行数:10,代码来源:unsrt.py

示例11: 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

示例12: format_misc

 def format_misc(self, e):
     template = toplevel [
         optional[ sentence [self.format_names('author')] ],
         optional[ self.format_title(e, 'title') ],
         sentence[
             optional[ field('howpublished') ],
             optional[ date ],
         ],
         sentence(capfirst=False) [ optional_field('note') ],
     ]
     return template.format_data(e)
开发者ID:OVii,项目名称:communityvisweb,代码行数:11,代码来源:unsrt.py

示例13: format_phdthesis

 def format_phdthesis(self, e):
     template = toplevel [
         sentence [self.format_names('author')],
         self.format_btitle(e, 'title'),
         sentence[
             'PhD thesis',
             field('school'),
             optional_field('address'),
             date,
         ],
         sentence(capfirst=False) [ optional_field('note') ],
     ]
     return template.format_data(e)
开发者ID:OVii,项目名称:communityvisweb,代码行数:13,代码来源:unsrt.py

示例14: format_volume_and_series

 def format_volume_and_series(self, e):
     volume_and_series = optional [
         sentence(capfirst=False, sep=' ') [
             'Volume', field('volume'), optional [
                 words ['of', field('series')]
             ]
         ]
     ]
     number_and_series = optional [
         sentence(capfirst=False, sep=' ') [
             join(sep=Symbol('nbsp')) ['Number', field('number')],
             optional [
                 words ['in', field('series')]
             ]
         ]
     ]
     series = optional [ sentence(capfirst=False) [field('series')] ]
     return first_of [
             volume_and_series,
             number_and_series,
             series,
         ]
开发者ID:rybesh,项目名称:pybtex,代码行数:22,代码来源:custom.py

示例15: 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_names('author'),
         self.format_title(e, 'title'),
         sentence(capfirst=False) [
             tag('emph') [field('journal')],
             optional[ volume_and_pages ],
             date],
         sentence(capfirst=False) [ optional_field('note') ],
     ]
     return template.format_data(e)
开发者ID:OVii,项目名称:communityvisweb,代码行数:23,代码来源:unsrt.py


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