How to use betterbib - 10 common examples

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_bibtex_title.py View on Github external
def test():
    assert (
        betterbib.tools._translate_title(
            "The Magnus expansion and some of its applications"
        )
        == "The {Magnus} expansion and some of its applications"
    )

    assert (
        betterbib.tools._translate_title("VODE: a variable-coefficient ODE solver")
        == "{VODE:} {A} variable-coefficient {ODE} solver"
    )

    assert (
        betterbib.tools._translate_title(
            "Peano's kernel theorem for vector-valued functions"
        )
        == "{Peano's} kernel theorem for vector-valued functions"
    )
github nschloe / betterbib / test / test_bibtex_title.py View on Github external
def test():
    assert (
        betterbib.tools._translate_title(
            "The Magnus expansion and some of its applications"
        )
        == "The {Magnus} expansion and some of its applications"
    )

    assert (
        betterbib.tools._translate_title("VODE: a variable-coefficient ODE solver")
        == "{VODE:} {A} variable-coefficient {ODE} solver"
    )

    assert (
        betterbib.tools._translate_title(
            "Peano's kernel theorem for vector-valued functions"
        )
        == "{Peano's} kernel theorem for vector-valued functions"
    )

    assert (
        betterbib.tools._translate_title(
            "Exponential Runge-Kutta methods for parabolic problems"
        )
        == "Exponential {Runge}-{Kutta} methods for parabolic problems"
    )
github nschloe / betterbib / test / test_bibtex_title.py View on Github external
def test():
    assert (
        betterbib.tools._translate_title(
            "The Magnus expansion and some of its applications"
        )
        == "The {Magnus} expansion and some of its applications"
    )

    assert (
        betterbib.tools._translate_title("VODE: a variable-coefficient ODE solver")
        == "{VODE:} {A} variable-coefficient {ODE} solver"
    )

    assert (
        betterbib.tools._translate_title(
            "Peano's kernel theorem for vector-valued functions"
        )
        == "{Peano's} kernel theorem for vector-valued functions"
    )

    assert (
        betterbib.tools._translate_title(
            "Exponential Runge-Kutta methods for parabolic problems"
        )
        == "Exponential {Runge}-{Kutta} methods for parabolic problems"
    )

    assert (
        betterbib.tools._translate_title(
            "GMRES: A generalized minimal residual algorithm"
        )
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