citeformer.render.formatters¶
Home-grown CSL formatters.
Each concrete formatter is a CitationFormatter subclass that takes a
CSL-JSON item (our Source.metadata) and a 1-indexed citation number and
emits the inline marker + bibliography entry for its specific style. No
citeproc-py involvement; quirks-free output owned by us.
Adding a new style is the skill at .claude/skills/add-citation-format/.
The short version:
Create
src/citeformer/render/formatters/<name>.pywith a subclass.Register it in
_REGISTRYbelow (with any canonical aliases).Add fixtures to
tests/unit/test_formatters.pycovering at least the four canonical CSL types (book / article-journal / chapter / thesis).
Public API:
CitationFormatter— the base ABC.Author— CSL-author record used across formatters.get_formatter(name)— registry lookup.available_formatters()— list of canonical style names.
Submodules¶
Package Contents¶
Functions¶
Look up and instantiate a formatter by style name. |
|
Return the canonical list of built-in style identifiers (no aliases). |
API¶
- citeformer.render.formatters.get_formatter(name: str) citeformer.render.formatters._base.CitationFormatter¶
Look up and instantiate a formatter by style name.
Args: name: Style identifier (canonical or alias). Case-insensitive.
Returns: A fresh
CitationFormatterinstance. Formatters are stateless, so this is cheap to call per-generation.Raises: ValueError: If
nameisn’t in the registry.