本文整理汇总了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)