How to use the betterbib.tools.get_short_doi 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_crossref.py View on Github external
"author": [
                    pybtex.database.Person("Gaul, Andr\xe9"),
                    pybtex.database.Person("Gutknecht, Martin H."),
                    pybtex.database.Person("Liesen, J\xf6rg"),
                    pybtex.database.Person("Nabben, Reinhard"),
                ]
            }
        ),
    )

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

    assert (
        betterbib.tools.get_short_doi(betterbib.tools.doi_from_url(bt.fields["url"]))
        == "10/f44kd7"
    )
github nschloe / betterbib / test / test_crossref.py View on Github external
'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 / betterbib / adapt_doi_urls.py View on Github external
def update_to_short_doi(doi):
            short_doi = tools.get_short_doi(doi)
            if short_doi:
                return "https://doi.org/" + short_doi
            return None