How to use the betterbib.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 / test / test_tools.py View on Github external
def test_encode_url():
    url = "https://www.wolframalpha.com/input/?i=integrate+from+0+to+2pi+(cos(x)+e%5E(i+*+(m+-+n)+*+x))"
    d = {
        "wolframalphai1": pybtex.database.Entry(
            "misc", fields=[("url", url), ("note", "Online; accessed 19-February-2019")]
        )
    }

    out = betterbib.pybtex_to_bibtex_string(d["wolframalphai1"], "wolframalphai1")

    # Split string and fetch entry with url
    url_entry = out.split()[3]
    # Remove braces and trailing comma
    url_entry = url_entry[1:-2]
    assert url_entry == url
github nschloe / betterbib / test / test_crossref.py View on Github external
'source': u'Crossref',
            'url': u'http://dx.doi.org/10.1002/0470868279',
            'publisher': u'John Wiley & Sons, Ltd',
            'title': u'Numerical Methods for Ordinary Differential Equations',
            'isbn': '9780470868270, 9780471967583',
            'year': 2003,
            'month': 6,
            },
        persons=pybtex.database.OrderedCaseInsensitiveDict({
            'author': [
                pybtex.database.Person(u'Butcher, J.C.'),
                ]
            }))

    assert betterbib.pybtex_to_bibtex_string(bt, 'key') \
        == betterbib.pybtex_to_bibtex_string(reference, 'key')

    return
github nschloe / betterbib / test / test_crossref.py View on Github external
'volume': u'34',
            'issn': u'0895-4798, 1095-7162',
            'year': 2013,
            'month': 1,
            },
        persons=pybtex.database.OrderedCaseInsensitiveDict({
            'author': [
                pybtex.database.Person(u'Gaul, Andr\xe9'),
                pybtex.database.Person(u'Gutknecht, Martin H.'),
                pybtex.database.Person(u'Liesen, J\xf6rg'),
                pybtex.database.Person(u'Nabben, Reinhard')
                ]
            }))

    assert betterbib.pybtex_to_bibtex_string(bt, 'key') \
        == betterbib.pybtex_to_bibtex_string(reference, 'key')

    assert betterbib.tools.get_short_doi(
        betterbib.tools.doi_from_url(bt.fields['url'])
        ) == '10/f44kd7'

    return
github nschloe / betterbib / test / test_crossref.py View on Github external
'Krylov Subspace Methods',
            'volume': u'34',
            'issn': u'0895-4798, 1095-7162',
            'year': 2013,
            'month': 1,
            },
        persons=pybtex.database.OrderedCaseInsensitiveDict({
            'author': [
                pybtex.database.Person(u'Gaul, Andr\xe9'),
                pybtex.database.Person(u'Gutknecht, Martin H.'),
                pybtex.database.Person(u'Liesen, J\xf6rg'),
                pybtex.database.Person(u'Nabben, Reinhard')
                ]
            }))

    assert betterbib.pybtex_to_bibtex_string(bt, 'key') \
        == betterbib.pybtex_to_bibtex_string(reference, 'key')

    return
github nschloe / betterbib / test / test_crossref.py View on Github external
"doi": "10.1002/0470868279",
            "publisher": "John Wiley & Sons, Ltd",
            "title": "Numerical Methods for Ordinary Differential Equations",
            "subtitle": "Butcher/Numerical Methods",
            "url": "http://dx.doi.org/10.1002/0470868279",
            "month": 6,
            "source": "Crossref",
            "year": 2003,
            "isbn": "9780470868270, 9780471967583",
        },
        persons=pybtex.database.OrderedCaseInsensitiveDict(
            {"author": [pybtex.database.Person("Butcher, J.C.")]}
        ),
    )

    assert betterbib.pybtex_to_bibtex_string(
        bt, "key", sort=True
    ) == betterbib.pybtex_to_bibtex_string(reference, "key", sort=True)
github nschloe / betterbib / test / test_crossref.py View on Github external
'url': u'http://dx.doi.org/10.2172/15014765',
            'institution': 'Office of Scientific ' +
                           'and Technical Information  (OSTI)',
            'title': 'CT Scan of NASA Booster Nozzle',
            'year': 2004,
            'month': 7,
            },
        persons=pybtex.database.OrderedCaseInsensitiveDict({
            'author': [
                pybtex.database.Person(u'Schneberk, D'),
                pybtex.database.Person(u'Perry, R'),
                pybtex.database.Person(u'Thompson, R'),
                ]})
        )

    assert betterbib.pybtex_to_bibtex_string(bt, 'key') \
        == betterbib.pybtex_to_bibtex_string(reference, 'key')

    return
github nschloe / betterbib / test / test_crossref.py View on Github external
'isbn': u'9780444501684',
            'year': 2002,
            },
        persons=pybtex.database.OrderedCaseInsensitiveDict({
            'author': [
                pybtex.database.Person(u'Beyn, Wolf-J\xfcrgen'),
                pybtex.database.Person(u'Champneys, Alan'),
                pybtex.database.Person(u'Doedel, Eusebius'),
                pybtex.database.Person(u'Govaerts, Willy'),
                pybtex.database.Person(u'Kuznetsov, Yuri A.'),
                pybtex.database.Person(u'Sandstede, Bj\xf6rn')
                ]})
        )

    assert betterbib.pybtex_to_bibtex_string(bt, 'key') \
        == betterbib.pybtex_to_bibtex_string(reference, 'key')

    return
github nschloe / betterbib / test / test_crossref.py View on Github external
"inbook",
        fields={
            "doi": "10.1002/0470868279.ch1",
            "publisher": "John Wiley & Sons, Ltd",
            "chapter": "Differential and Difference Equations",
            "url": "http://dx.doi.org/10.1002/0470868279.ch1",
            "booktitle": "Numerical Methods " + "for Ordinary Differential Equations",
            "month": 1,
            "source": "Crossref",
            "year": 2005,
            "pages": "1-44",
            "isbn": "9780470868270, 9780471967583",
        },
    )

    assert betterbib.pybtex_to_bibtex_string(
        bt, "key", sort=True
    ) == betterbib.pybtex_to_bibtex_string(reference, "key", sort=True)
github nschloe / betterbib / test / test_crossref.py View on Github external
reference = pybtex.database.Entry(
        "proceedings",
        fields={
            "publisher": "Wydawnictwo Uniwersytetu Ekonomicznego " + "we Wrocławiu",
            "doi": "10.15611/amse.2014.17",
            "title": "International Scientific Conference",
            "url": "http://dx.doi.org/10.15611/amse.2014.17",
            "source": "Crossref",
            "year": 2014,
        },
    )

    assert betterbib.pybtex_to_bibtex_string(
        bt, "key", sort=True
    ) == betterbib.pybtex_to_bibtex_string(reference, "key", sort=True)
github nschloe / betterbib / test / test_crossref.py View on Github external
"title": "Numerical Methods for Ordinary Differential Equations",
            "subtitle": "Butcher/Numerical Methods",
            "url": "http://dx.doi.org/10.1002/0470868279",
            "month": 6,
            "source": "Crossref",
            "year": 2003,
            "isbn": "9780470868270, 9780471967583",
        },
        persons=pybtex.database.OrderedCaseInsensitiveDict(
            {"author": [pybtex.database.Person("Butcher, J.C.")]}
        ),
    )

    assert betterbib.pybtex_to_bibtex_string(
        bt, "key", sort=True
    ) == betterbib.pybtex_to_bibtex_string(reference, "key", sort=True)