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


Python BibTexWriter._entry_to_bibtex方法代码示例

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


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

示例1: parse

# 需要导入模块: from bibtexparser.bwriter import BibTexWriter [as 别名]
# 或者: from bibtexparser.bwriter.BibTexWriter import _entry_to_bibtex [as 别名]
def parse(bibfile):

	with open(bibfile) as bibtex_file:
		writer = BibTexWriter()
		bib_database = bibtexparser.load(bibtex_file)

		for entry in bib_database.entries:
			print "\t-"
			print "\t\tlayout: paper"
			print "\t\tpaper-type: "+ preprocess(entry["type"])
			print "\t\tyear: " + preprocess(entry["year"])
			print "\t\tselected: no"
			print "\t\ttitle: >\n\t\t\t"+preprocess(entry["title"])
			print "\t\tauthors: "+ parseauthors(preprocess(entry["author"])).encode('UTF8')
			print "\t\timg: "
			print "\t\tvenue: "
			if("pages" in entry.keys()):
				print "\t\tpages: "+preprocess(entry["pages"])
			if("booktitle" in entry.keys()):
				print "\t\tbooktitle: "+preprocess(entry["booktitle"])
			if("journal" in entry.keys()):
				print "\t\tjournal: "+preprocess(entry["journal"])
			if("url" in entry.keys()):
				print "\t\tdoc-url: "+preprocess(entry["url"])
			else:
				print "\t\tdoc-url: "

			if("abstract" in entry.keys()):
				print "\t\tabstract: >\n\t\t\t" + preprocess(entry["abstract"]).encode('UTF8')

			print "\t\tbibtex: >\n\t\t\t"+ writer._entry_to_bibtex(entry).replace("\n","\n\t\t\t").encode('UTF8')
开发者ID:hsajjad,项目名称:guzmanhe.github.io,代码行数:33,代码来源:parsebib.py

示例2: write_bibtex_dict

# 需要导入模块: from bibtexparser.bwriter import BibTexWriter [as 别名]
# 或者: from bibtexparser.bwriter.BibTexWriter import _entry_to_bibtex [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

示例3: bibTexIn

# 需要导入模块: from bibtexparser.bwriter import BibTexWriter [as 别名]
# 或者: from bibtexparser.bwriter.BibTexWriter import _entry_to_bibtex [as 别名]
def bibTexIn(filename):
    #load database into bibtexdatabase object
    with codecs.open(filename, 'r', 'utf-8') as bibtex_file:
        parser = BibTexParser()
        parser.customization = convert_to_unicode
        bibtex_database = bibtexparser.load(bibtex_file,parser)

    #load all the keys we want to add into the dialectsDB database
    dbbibtexkeys = [x.bibTexKey for x in BiblioEntryBibTex.objects.all()]
    btdbdict = bibtex_database.entries_dict

    for item in dbbibtexkeys:
        try:
            currentbtitem = btdbdict[item]
            currentBEobject = BiblioEntryBibTex.objects.get(bibTexKey=item)
            writer = BibTexWriter()
            bibtexofentry = writer._entry_to_bibtex(currentbtitem)
            currentBEobject.fullBibtex = bibtexofentry
            print("Currently saving: {}".format(item))
            currentBEobject.save() #The saving function should put the relevant info into the other fields
        except KeyError:
            print("No bibliography entry for: {}".format(item))
开发者ID:amagidow,项目名称:dialects,代码行数:24,代码来源:BiblioIn.py

示例4: toString

# 需要导入模块: from bibtexparser.bwriter import BibTexWriter [as 别名]
# 或者: from bibtexparser.bwriter.BibTexWriter import _entry_to_bibtex [as 别名]
def toString(e):
    writer = BibTexWriter()
    writer.indent = '    '     # indent entries with 4 spaces instead of one
    writer.comma_first = True  # place the comma at the beginning of the line

    return writer._entry_to_bibtex(e)
开发者ID:alastairreid,项目名称:alastairreid.github.io,代码行数:8,代码来源:bib2papers.py


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