Citation#
- class documenteer.citations.Citation(*, title, doi=None, authors=(), publisher=None, date=None, url=None, number=None)#
Bases:
objectA bibliographic citation for a work, composable as plain text or BibTeX.
The fields are the DataCite mandatory metadata (creators, title, publisher, publication year, identifier) plus the landing-page URL, which is the metadata a Documenteer site can supply from its own configuration without asking a registration agency.
- Parameters:
Attributes Summary
The work's authors, in the order they should be credited.
The citation key that
to_bibtexuses by default.The publication date.
The work's DOI, normalized to its bare
10.NNNN/suffixform.The DOI as a resolvable
https://doi.orgURL, orNonewhen the work has no DOI.its DOI as a resolvable URL, or its landing page when it has no DOI, or
Nonewhen it has neither.The work's number within its series, such as a technote's
SQR-000handle.The organization that published the work.
The title of the work.
The work's landing page, when it is not simply the DOI's target.
Methods Summary
to_bibtex(*[, entry_type, key])Compose the citation as a BibTeX entry.
Compose the citation as a plain-text bibliographic reference.
Attributes Documentation
- authors: tuple[PersonAuthor | OrganizationAuthor, ...] = ()#
The work’s authors, in the order they should be credited.
- bibtex_key#
The citation key that
to_bibtexuses by default.The key is the first author, the publication year, and the first word of the title, each reduced to lowercase ASCII alphanumerics — for example
sick2026citations. It is derived only from the citation’s own fields, so the same metadata always yields the same key and a bibliography that is regenerated on every build stays stable.
- doi: str | None = None#
The work’s DOI, normalized to its bare
10.NNNN/suffixform.A DOI given in any spelling
normalize_doiaccepts is normalized when the citation is constructed; a value that is not a DOI raisesValueErrorthere rather than reaching a rendered page.
- location#
its DOI as a resolvable URL, or its landing page when it has no DOI, or
Nonewhen it has neither.This is the identifier
to_plain_textwrites at the end of the citation, and the URL a rendered citation hyperlinks.- Type:
Where the work is found
- number: str | None = None#
The work’s number within its series, such as a technote’s
SQR-000handle.This is a
BibtexEntryType.techreportfield; aBibtexEntryType.miscentry has nowhere to put it and omits it.
Methods Documentation
- to_bibtex(*, entry_type=BibtexEntryType.misc, key=None)#
Compose the citation as a BibTeX entry.
- Parameters:
entry_type (
BibtexEntryType, default:<BibtexEntryType.misc: 'misc'>) – The BibTeX entry type. UseBibtexEntryType.techreportfor a technote andBibtexEntryType.misc, the default, for a dataset or a website.key (
str|None, default:None) – The entry’s citation key. Defaults tobibtex_key.
- Returns:
The BibTeX entry, without a trailing newline. Fields appear in a fixed order, so regenerating the entry from unchanged metadata never churns a file that stores it.
- Return type:
Notes
The publisher is the
publisherfield of aBibtexEntryType.miscentry and theinstitutionfield of aBibtexEntryType.techreportone;Citation.numberis atechreportfield and amiscentry omits it. Theurlfield is the work’s own landing page when it has one, falling back to the DOI URL;doiandurlare written verbatim rather than LaTeX-escaped, matching what DataCite, Crossref, and Zenodo export, since a style’s\urlmacro takes its argument literally.An optional field whose value reduces to nothing once collapsed and escaped is omitted, rather than written as an empty pair of braces. The required
titlefield is always written, so that a blank title shows up as an entry to fix rather than as a silently missing field.
- to_plain_text()#
Compose the citation as a plain-text bibliographic reference.
- Returns:
The citation in DataCite’s recommended display format:
Creators (PublicationYear). Title. Publisher. Identifier. Creators are separated by semicolons because a person’s name itself contains a comma, and the identifier is the DOI URL when the work has a DOI and its landing page otherwise. A segment with no value — including one that is only whitespace — is dropped rather than left as empty punctuation.- Return type:
Notes
A dataset citation credited to an organization composes as:
Vera C. Rubin Observatory (2025). Data Preview 2. Vera C. Rubin Observatory. https://doi.org/10.71929/rubin/2570308