← GDG /

#309 gdtest_bibliography_csl

#309 gdtest_bibliography_csl OK CONFIG
Project-level bibliography with a custom (numeric) CSL style
Like gdtest_bibliography, but great-docs.yml also sets the optional `csl: docs/numeric.csl` key. The custom Citation Style Language file is copied into the build and wired into _quarto.yml, so citations render as bracketed numbers ([1], [2]) and the reference list is numbered, instead of the default Chicago author-date style. Confirms CSL selection works end to end (issue #214's optional CSL support).
View Site → Build Log ๐Ÿงช Test Coverage

Build Mode

● Has great-docs.yml

This package ships a pre-supplied config. The great-docs init step is skipped and great-docs build uses the spec-defined configuration directly. Tests specific config options and their rendered output.

Dimensions

A1 B1 C1 D1 E6 F1 G1 H7 K58
A1Flat layoutlayout
B1Explicit __all__exports
C1Functions onlyobjects
D1NumPydocstrings
E6No directivesdirectives
F1Auto-discoveruser_guide
G1README.mdlanding
H7No extrasextras
K58citation style (CSL)config

Source Files

๐Ÿ“ docs/
๐Ÿ“„ numeric.csl
<?xml version="1.0" encoding="utf-8"?>
<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" default-locale="en-US">
  <info>
    <title>GD Test Numeric</title>
    <id>gd-test-numeric</id>
    <updated>2024-01-01T00:00:00+00:00</updated>
  </info>
  <citation collapse="citation-number">
    <layout prefix="[" suffix="]" delimiter=",">
      <text variable="citation-number"/>
    </layout>
  </citation>
  <bibliography>
    <layout>
      <text variable="citation-number" prefix="[" suffix="] "/>
      <names variable="author" suffix=". "><name/></names>
      <text variable="title" suffix="."/>
    </layout>
  </bibliography>
</style>
๐Ÿ“„ references.bib
@article{knuth1984,
  title = {Literate Programming},
  author = {Knuth, Donald E.},
  year = {1984},
  journal = {The Computer Journal},
}

@book{lamport1994,
  title = {LaTeX: A Document Preparation System},
  author = {Lamport, Leslie},
  year = {1994},
  publisher = {Addison-Wesley},
}
๐Ÿ“ gdtest_bibliography_csl/
๐Ÿ“„ __init__.py
"""Package demonstrating a custom citation style."""

__version__ = "0.1.0"
__all__ = ["cite"]


def cite(key: str) -> str:
    """
    Return a citation key.

    Parameters
    ----------
    key
        The citation key.

    Returns
    -------
    str
        The same key.
    """
    return key
๐Ÿ“ user_guide/
๐Ÿ“„ 01-citations.qmd
---
title: Numbered Citations
---

Literate programming was introduced by Knuth [@knuth1984], and LaTeX
by Lamport [@lamport1994]. With a numeric CSL, these render as
bracketed numbers rather than author-year text.

## References

::: {#refs}
:::
๐Ÿ“„ README.md
# gdtest-bibliography-csl

Synthetic test for the optional `csl:` key (issue #214). A custom
numeric Citation Style Language file selects bracketed-number
citations instead of the default author-date style.
๐Ÿ“„ great-docs.yml
bibliography: docs/references.bib
csl: docs/numeric.csl