Sphinx/pybtex plugin for URN:NBN identifier support in bibliographies
Project description
sphinxcontrib-bibtex-urn
A Sphinx plugin that extends sphinxcontrib-bibtex with support for URN identifiers (specifically National Bibliography Numbers).
BibTeX entries containing a urn field are rendered with a hyperlinked identifier, similar to how doi fields work:
[Sav23] Niko Savola. Design and modelling of long-coherence qubits using energy participation ratios. Master's thesis, Aalto University, May 2023. URN:NBN:fi:aalto-202305213270.
where URN:NBN:fi:aalto-202305213270 is a clickable link pointing to https://urn.fi/URN:NBN:fi:aalto-202305213270.
Features
- Country-specific NBNs: Resolution for National Bibliography Numbers for:
- 🇦🇹 Austria (resolver.obvsg.at)
- 🇨🇿 Czech Republic (resolver.nkp.cz)
- 🇫🇮 Finland (urn.fi)
- 🇭🇷 Croatia (urn.nsk.hr)
- 🇭🇺 Hungary (nbn.urn.hu)
- 🇮🇹 Italy (nbn.depositolegale.it)
- 🇳🇱 Netherlands (persistent-identifier.nl)
- 🇳🇴 Norway (nb.no)
- 🇸🇪 Sweden (urn.kb.se)
- 🇸🇮 Slovenia (nbn.si)
- Global NBNs: Other
URN:NBN:...identifiers resolved via nbn-resolving.org. - Auto-deduplication: Automatically suppresses redundant
urlfields that point to the same URN resolver. - Any pybtex style: Works with all built-in and third-party pybtex formatting styles.
Installation
uv add sphinxcontrib-bibtex-urn # or: pip install sphinxcontrib-bibtex-urn
Usage
Option A – Sphinx extension (recommended)
Add the extension to your conf.py after sphinxcontrib.bibtex. It automatically wraps whatever
bibtex_default_style you have configured:
extensions = [
"sphinxcontrib.bibtex",
"sphinxcontrib_bibtex_urn",
]
bibtex_default_style = "alpha" # any pybtex style works
bibtex_bibfiles = ["refs.bib"]
Option B – Direct pybtex style
If you prefer not to use the Sphinx extension, select one of the pre-built styles directly:
extensions = [
"sphinxcontrib.bibtex",
]
bibtex_default_style = "urn_alpha" # or urn_plain, urn_unsrt, urn_unsrtalpha
bibtex_bibfiles = ["refs.bib"]
BibTeX entries
Add a urn field to your .bib entries. All URN:NBN namespaces are supported:
% URN:NBN:fi – Finnish National Bibliography Number
@mastersthesis{Sav23,
author = {Niko Savola},
title = {Design and modelling of long-coherence qubits using energy
participation ratios},
school = {Aalto University},
year = {2023},
month = {5},
urn = {URN:NBN:fi:aalto-202305213270},
}
% URN:NBN:de – German National Bibliography Number
@book{Example23,
author = {Author, Example},
title = {An Example German Book},
publisher = {Springer},
year = {2023},
urn = {URN:NBN:de:101:1-202301011234},
}
The identifier is rendered as a hyperlink pointing to the appropriate national resolver or the general
nbn-resolving.org service. For instance, URN:NBN:fi:aalto-202305213270 links to
https://urn.fi/URN:NBN:fi:aalto-202305213270.
URNs in the url field
If the urn field is missing, the plugin also scans the url field. If it contains a link to a supported URN resolver
(e.g., https://urn.fi/... or https://nbn-resolving.org/...), it is automatically "promoted" and formatted as a
hyperlinked URN identifier.
If the entry contains both a urn field and a url field pointing at the same resolver, the redundant URL is
automatically suppressed to avoid duplication. The comparison is case-insensitive (per
RFC 8141) and handles both http:// and https:// resolver URLs.
How it works
The plugin provides UrnStyleMixin, a pybtex style mixin that overrides format_entry to append a hyperlinked URN when
the field is present. The Sphinx extension (sphinxcontrib_bibtex_urn) dynamically wraps your configured style at build
time, so it works with any pybtex formatting style, including third-party ones.
Development
For information on how to set up the development environment, run tests, and contribute to the project, please see CONTRIBUTING.md.
All participants are expected to follow the Code of Conduct.
See the Security Policy for information on how to report vulnerabilities.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sphinxcontrib_bibtex_urn-0.1.1.tar.gz.
File metadata
- Download URL: sphinxcontrib_bibtex_urn-0.1.1.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5601b5b2b5ace71aea976bb306d16a9c4e43c08ce870ac746f9d2ef5728b67b3
|
|
| MD5 |
bfcbdd4da685775c5e8764f32e60b22f
|
|
| BLAKE2b-256 |
30af339d2ce345394ad6ce8e37752c9e4c78dd1b591b6c7dddd3139b782e4456
|
Provenance
The following attestation bundles were made for sphinxcontrib_bibtex_urn-0.1.1.tar.gz:
Publisher:
release.yml on nikosavola/sphinxcontrib-bibtex-urn
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sphinxcontrib_bibtex_urn-0.1.1.tar.gz -
Subject digest:
5601b5b2b5ace71aea976bb306d16a9c4e43c08ce870ac746f9d2ef5728b67b3 - Sigstore transparency entry: 1215348359
- Sigstore integration time:
-
Permalink:
nikosavola/sphinxcontrib-bibtex-urn@cc531242993127dc5e860b709ebfc728b725c654 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/nikosavola
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@cc531242993127dc5e860b709ebfc728b725c654 -
Trigger Event:
push
-
Statement type:
File details
Details for the file sphinxcontrib_bibtex_urn-0.1.1-py3-none-any.whl.
File metadata
- Download URL: sphinxcontrib_bibtex_urn-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3668869ba7c6d6739763293ee326e3cdfb350405f3f1f5b61adb8f567bfcfcd7
|
|
| MD5 |
2fef301dd87ab157258863f195479b5c
|
|
| BLAKE2b-256 |
d9504e0a2b568c6a69ba07490009feadbd81ab861fb8bc5f55246d5b86f84287
|
Provenance
The following attestation bundles were made for sphinxcontrib_bibtex_urn-0.1.1-py3-none-any.whl:
Publisher:
release.yml on nikosavola/sphinxcontrib-bibtex-urn
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sphinxcontrib_bibtex_urn-0.1.1-py3-none-any.whl -
Subject digest:
3668869ba7c6d6739763293ee326e3cdfb350405f3f1f5b61adb8f567bfcfcd7 - Sigstore transparency entry: 1215348416
- Sigstore integration time:
-
Permalink:
nikosavola/sphinxcontrib-bibtex-urn@cc531242993127dc5e860b709ebfc728b725c654 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/nikosavola
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@cc531242993127dc5e860b709ebfc728b725c654 -
Trigger Event:
push
-
Statement type: