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


Python BibTexWriter.display_order方法代码示例

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


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

示例1: test_display_order

# 需要导入模块: from bibtexparser.bwriter import BibTexWriter [as 别名]
# 或者: from bibtexparser.bwriter.BibTexWriter import display_order [as 别名]
    def test_display_order(self):
        with open('bibtexparser/tests/data/multiple_entries_and_comments.bib') as bibtex_file:
            bib_database = bibtexparser.load(bibtex_file)
        writer = BibTexWriter()
        writer.contents = ['entries']
        writer.display_order = ['year', 'publisher', 'title']
        result = bibtexparser.dumps(bib_database, writer)
        expected = \
"""@book{Toto3000,
 title = {A title},
 author = {Toto, A and Titi, B}
}

@article{Wigner1938,
 year = {1938},
 publisher = {The Royal Society of Chemistry},
 title = {The transition state method},
 author = {Wigner, E.},
 doi = {10.1039/TF9383400029},
 issn = {0014-7672},
 journal = {Trans. Faraday Soc.},
 owner = {fr},
 pages = {29--41},
 volume = {34}
}

@book{Yablon2005,
 year = {2005},
 publisher = {Springer},
 title = {Optical fiber fusion slicing},
 author = {Yablon, A.D.}
}

"""
        self.assertEqual(result, expected)
开发者ID:gpoo,项目名称:python-bibtexparser,代码行数:37,代码来源:test_bibtexwriter.py


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