How to use the betterbib.tools.pybtex_to_bibtex_string function in betterbib

To help you get started, we’ve selected a few betterbib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nschloe / betterbib / betterbib / cli / dedup_doi.py View on Github external
def _write(od, out, delimeter_type):
    # Write header to the output file.
    out.write(
        "%comment{{This file was created with betterbib v{}.}}\n\n".format(
            __about__.__version__
        )
    )

    # write the data out sequentially to respect ordering
    for bib_id, d in od.items():
        brace_delimeters = delimeter_type == "curly"
        a = tools.pybtex_to_bibtex_string(d, bib_id, brace_delimeters=brace_delimeters)
        out.write(a + "\n\n")
    return
github nschloe / betterbib / betterbib / cli / doi2bibtex.py View on Github external
def main(argv=None):
    parser = _get_parser()
    args = parser.parse_args(argv)
    source = crossref.Crossref()
    entry = source.get_by_doi(args.doi)

    bibtex_key = "key"
    string = tools.pybtex_to_bibtex_string(entry, bibtex_key)
    args.outfile.write(string)
    return