As well as the CSL style itself, this repository also contains the apparatus for testing its output against the specification web page. You may find it helpful to see how the examples from that page have been coded into a YAML database. The YAML format follows the same principles as CSL-JSON.
-
Things will automatically get tagged ‘[Online]’ if you include a URL, DOI, or access date.
-
For many resource types, you can use
genreto put something in square brackets after the title. The exceptions arebroadcast,motion_picture,thesisand, if you supply anumber,bill,patent,report, andstandard. -
For preprints, use resource type
articleorreportand put the repository name underarchive. Put the location and name of the institution that runs the repository (if known) underpublisher-placeandpublisherrespectively. -
Use
article-newspaperorarticle-magazineinstead ofarticle-journalto display the month and day. -
With a
thesis, usegenreto record the type of thesis; -
With a
reportorpatent, record the report/patent series ascollection-title, the report/patent type asgenreand the report/patent number asnumber. The difference is that a series is typically plural and followed by a comma, while a type is typically singular and followed by a space. -
Record a standard as a
standardor, failing that,report. Include the identifier at the beginning of thetitle. -
For unpublished materials, use the closest applicable entry type and put ‘Unpublished’ under
annote. Thepamphlettype is useful for many materials of this sort. -
With a
graphic, you can specifyarchiveandarchive-place, as in the Bowden bicycle example. -
With a
map, usescalefor the scale. -
With a
motion_picture, usemediumorgenreto specify the type, e.g. ‘Film’. -
With a
broadcast, usepublisherfor the channel,mediumorgenrefor ‘Radio’ or ‘TV’, andannotefor the time. If it is an untitled episode of a series, put the series and episode number as thetitle, otherwise put the series incontainer-titleand the episode number as ‘Episode series:episode’ innumber. -
Use
datasetfor database entries and datasets. Give the name of a containing database incontainer-title. -
Use
softwarefor software. This type was introduced in CSL v1.0.2, so if your toolset doesn't support it, usedatasetinstead; unfortunately the ‘[Online]’ won't be suppressed in this case. -
When citing social media posts, there is no standard way of including the author's social media handle. As a workaround, you can include it as the
dropping-particlename part, but you must supply the surrounding square brackets as part of the value. This works best with personal accounts; with corporate accounts you would have to use thefamilyname part instead ofliteral, and you get a stray comma between the name and handle. Alternatively, you could include the handle as part of theliteralname part, but depending on your software you might not be able to work around including it in your citations as well. -
When citing works in non-English languages, use
original-titlefor the English translation of the non-English title. This reverses the intended semantics oftitleandoriginal-titlebut makes a sort of sense regarding the priority of the reference elements. -
With transliterated works, provide the transliteration of names as the
dropping-particlecomponent for (inverted) names at the head of the reference and as thesuffixfor later (natural order) names. Provide transliterated titles directly within the respectivetitlefield. -
Use the
legislationtype for primary legislation such as Acts of Parliament and EU Directives. For secondary legislation such as Statutory Instruments, use theregulationtype if available, otherwiselegislation. With Acts, usechapter-numberfor the chapter and, for statutes before 1963, usecollection-titlefor the series. With directives, usecontainer-titlefor the journal (OJ),collection-titlefor the series,volumefor the volume andpagefor the starting page. -
Use the
billtype for House of Commons/Lords Bills but also for House of Commons/Lords Papers and Command Papers. Usecollection-titlefor the series and session (e.g. ‘Bills | 1987/88’) orgenrefor the type (e.g. ‘Cm.’) andnumberfor the printing. -
Use
hearingorpaper-conferencefor Parliamentary debates, with the year inissued, the full date of the debate inevent-date, and the Hansard volume involume. -
For legal cases, only approximate support is possible, especially now that Harvard (Bath) has introduced its own unique style. The following variations are available:
-
To get the legal case format introduced in 2024, you must supply both the
authority(court) andnumber(case number). If citing a particular court division, you can add it manually to the end ofauthorityor supply it separately indivision. Usecontainer-titlefor the reporting journal, andvolume,issueandpagefor pinpointing within it. -
To get the format for a Judgment of the European Court of Justice, (that is, with the case number in parentheses between the title and year), supply a
number(case number) but noauthority. To cite a case reported in ECR or equivalent, put the reporting journal incollection-title, and usevolumeandpagefor pinpointing. To cite a case in the OJ, put ‘OJ’ as thecontainer-titleand follow the instructions above for pinpointing EU Directives. -
To cite any other case in the OJ, don't give a
number; put ‘OJ’ as thecontainer-titleand follow the instructions above for pinpointing EU Directives. -
To get the traditional or neutral legal case format, don't give a
numberor acontainer-title. Usecollection-title(reporting journal or court abbreviation) andpage(first page, or case number with or without division suffix). The year will be shown in square brackets unlessvolumeis given, in which case it will be in parentheses.
The use of
collection-titlein the above is quirky, but the simplifying principle behind it is thatcontainer-titleis printed in italics andcollection-titleis not. One motivation for it is that CSL cannot detect ‘OJ’ as a special value, but Harvard (Bath) treats it specially. -
The technique used here to test the CSL style follows these steps:
-
Use
pandocto convert the reference examples from the companion LaTeX styles into HTML. -
Use
pandocand its built-inciteproclibrary to convertbath-csl-test.yamlinto HTML formatted references. -
Convert
bath-csl-test.yamlinto JSON and useciteproc-js-server(henceciteproc-js) to convert it again into HTML formatted references. -
Compare the target (LaTeX-derived) references against the
pandoc-generated references, and thepandoc-generated references against theciteproc-js-generated references.
This process is automated as much as possible, which unfortunately means a dependency on a wide range of utilities. Some trivial or irreconcilable discrepancies are erased at different points in this process, so some potential quirks with real-life implementations won't show up.
Dependencies:
- GNU Make
bash,awk,sedpandocv2.11+- Python v3.8+
An HTML document comparing the expected and actual output from pandoc can be
generated like so:
bash make bath-csl-test.html
This invokes the check-output.py script to tidy up the raw output and perform
the comparison.
Dependencies are the same as for Pandoc-based testing, plus:
curlciteproc-js-serverrunning athttp://127.0.0.1:8085- Python packages
clickandpyyaml - LibYAML
An HTML document containing the output from citeproc-js can be generated like
so:
bash make bath-csl-test-js.html
This invokes the yaml2json.py script to generate the correct input to
citeproc-js-server; the check-output.py script is then used to inject
the results into the raw output from pandoc.
CSL processors can be quite forgiving, so before submitting changes upstream, the style should be checked with the official CSL Validator.