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


Python BibTexWriter.entry_separator方法代码示例

本文整理汇总了Python中bibtexparser.bwriter.BibTexWriter.entry_separator方法的典型用法代码示例。如果您正苦于以下问题:Python BibTexWriter.entry_separator方法的具体用法?Python BibTexWriter.entry_separator怎么用?Python BibTexWriter.entry_separator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在bibtexparser.bwriter.BibTexWriter的用法示例。


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

示例1: test_entry_separator

# 需要导入模块: from bibtexparser.bwriter import BibTexWriter [as 别名]
# 或者: from bibtexparser.bwriter.BibTexWriter import entry_separator [as 别名]
    def test_entry_separator(self):
        bib_database = BibDatabase()
        bib_database.entries = [{'ID': 'abc123',
                                 'ENTRYTYPE': 'book',
                                 'author': 'test'}]
        writer = BibTexWriter()
        writer.entry_separator = ''
        result = bibtexparser.dumps(bib_database, writer)
        expected = \
"""@book{abc123,
 author = {test}
}
"""
        self.assertEqual(result, expected)
开发者ID:gpoo,项目名称:python-bibtexparser,代码行数:16,代码来源:test_bibtexwriter.py

示例2: write_bibtex_dict

# 需要导入模块: from bibtexparser.bwriter import BibTexWriter [as 别名]
# 或者: from bibtexparser.bwriter.BibTexWriter import entry_separator [as 别名]
def write_bibtex_dict (stream, entries):
    """bibtexparser.write converts the entire database to one big string and
    writes it out in one go. I'm sure it will always all fit in RAM but some
    things just will not stand.

    """
    from bibtexparser.bwriter import BibTexWriter

    writer = BibTexWriter ()
    writer.indent = '  '
    writer.entry_separator = ''
    first = True

    for rec in entries:
        if first:
            first = False
        else:
            stream.write ('\n')
        stream.write (writer._entry_to_bibtex (rec))
开发者ID:dkhikhlukha,项目名称:pwkit,代码行数:21,代码来源:latexdriver.py


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