diff options
author | John MacFarlane <jgm@berkeley.edu> | 2020-09-06 16:25:16 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2020-09-21 10:15:50 -0700 |
commit | e0984a43a99231e72c02a0a716c8d0315de9abdf (patch) | |
tree | 8531ef58c2470d372ff2427a6ae09a6284461471 /test/command/apa.csl | |
parent | 89c577befb78b32a0884b6092e0415c0dcadab72 (diff) | |
download | pandoc-e0984a43a99231e72c02a0a716c8d0315de9abdf.tar.gz |
Add built-in citation support using new citeproc library.
This deprecates the use of the external pandoc-citeproc
filter; citation processing is now built in to pandoc.
* Add dependency on citeproc library.
* Add Text.Pandoc.Citeproc module (and some associated unexported
modules under Text.Pandoc.Citeproc). Exports `processCitations`.
[API change]
* Add data files needed for Text.Pandoc.Citeproc: default.csl
in the data directory, and a citeproc directory that is just
used at compile-time. Note that we've added file-embed as a mandatory
rather than a conditional depedency, because of the biblatex
localization files. We might eventually want to use readDataFile
for this, but it would take some code reorganization.
* Text.Pandoc.Loging: Add `CiteprocWarning` to `LogMessage` and use it
in `processCitations`. [API change]
* Add tests from the pandoc-citeproc package as command tests (including
some tests pandoc-citeproc did not pass).
* Remove instructions for building pandoc-citeproc from CI and
release binary build instructions. We will no longer distribute
pandoc-citeproc.
* Markdown reader: tweak abbreviation support. Don't insert a
nonbreaking space after a potential abbreviation if it comes right before
a note or citation. This messes up several things, including citeproc's
moving of note citations.
* Add `csljson` as and input and output format. This allows pandoc
to convert between `csljson` and other bibliography formats,
and to generate formatted versions of CSL JSON bibliographies.
* Add module Text.Pandoc.Writers.CslJson, exporting `writeCslJson`. [API
change]
* Add module Text.Pandoc.Readers.CslJson, exporting `readCslJson`. [API
change]
* Added `bibtex`, `biblatex` as input formats. This allows pandoc
to convert between BibLaTeX and BibTeX and other bibliography formats,
and to generated formatted versions of BibTeX/BibLaTeX bibliographies.
* Add module Text.Pandoc.Readers.BibTeX, exporting `readBibTeX` and
`readBibLaTeX`. [API change]
* Make "standalone" implicit if output format is a bibliography format.
This is needed because pandoc readers for bibliography formats put
the bibliographic information in the `references` field of metadata;
and unless standalone is specified, metadata gets ignored.
(TODO: This needs improvement. We should trigger standalone for the
reader when the input format is bibliographic, and for the writer
when the output format is markdown.)
* Carry over `citationNoteNum` to `citationNoteNumber`. This was just
ignored in pandoc-citeproc.
* Text.Pandoc.Filter: Add `CiteprocFilter` constructor to Filter.
[API change] This runs the processCitations transformation.
We need to treat it like a filter so it can be placed
in the sequence of filter runs (after some, before others).
In FromYAML, this is parsed from `citeproc` or `{type: citeproc}`,
so this special filter may be specified either way in a defaults file
(or by `citeproc: true`, though this gives no control of positioning
relative to other filters). TODO: we need to add something to the
manual section on defaults files for this.
* Add deprecation warning if `upandoc-citeproc` filter is used.
* Add `--citeproc/-C` option to trigger citation processing.
This behaves like a filter and will be positioned
relative to filters as they appear on the command line.
* Rewrote the manual on citatations, adding a dedicated Citations
section which also includes some information formerly found in
the pandoc-citeproc man page.
* Look for CSL styles in the `csl` subdirectory of the pandoc user data
directory. This changes the old pandoc-citeproc behavior, which looked
in `~/.csl`. Users can simply symlink `~/.csl` to the `csl`
subdirectory of their pandoc user data directory if they want
the old behavior.
* Add support for CSL bibliography entry formatting to LaTeX, HTML,
Ms writers. Added CSL-related CSS to styles.html.
Diffstat (limited to 'test/command/apa.csl')
-rw-r--r-- | test/command/apa.csl | 474 |
1 files changed, 474 insertions, 0 deletions
diff --git a/test/command/apa.csl b/test/command/apa.csl new file mode 100644 index 000000000..999f8bf7f --- /dev/null +++ b/test/command/apa.csl @@ -0,0 +1,474 @@ +<?xml version="1.0" encoding="utf-8"?> +<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" demote-non-dropping-particle="never"> + <!-- This style was edited with the Visual CSL Editor (http://steveridout.com/csl/visualEditor/) --> + <info> + <title>American Psychological Association 6th edition</title> + <title-short>APA</title-short> + <id>http://www.zotero.org/styles/apa</id> + <link href="http://www.zotero.org/styles/apa" rel="self"/> + <link href="http://owl.english.purdue.edu/owl/resource/560/01/" rel="documentation"/> + <author> + <name>Simon Kornblith</name> + <email>simon@simonster.com</email> + </author> + <contributor> + <name>Bruce D'Arcus</name> + </contributor> + <contributor> + <name>Curtis M. Humphrey</name> + </contributor> + <contributor> + <name>Richard Karnesky</name> + <email>karnesky+zotero@gmail.com</email> + <uri>http://arc.nucapt.northwestern.edu/Richard_Karnesky</uri> + </contributor> + <contributor> + <name>Sebastian Karcher</name> + </contributor> + <category citation-format="author-date"/> + <category field="psychology"/> + <category field="generic-base"/> + <updated>2014-04-12T01:20:52+00:00</updated> + <rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights> + </info> + <locale xml:lang="en"> + <terms> + <term name="editortranslator" form="short"> + <single>ed. & trans.</single> + <multiple>eds. & trans.</multiple> + </term> + <term name="translator" form="short"> + <single>trans.</single> + <multiple>trans.</multiple> + </term> + </terms> + </locale> + <macro name="container-contributors"> + <choose> + <if type="chapter paper-conference" match="any"> + <names variable="editor translator container-author" delimiter=", " suffix=", "> + <name and="symbol" initialize-with=". " delimiter=", "/> + <label form="short" prefix=" (" text-case="title" suffix=")"/> + </names> + </if> + </choose> + </macro> + <macro name="secondary-contributors"> + <choose> + <if type="article-journal chapter paper-conference" match="none"> + <names variable="translator editor container-author" delimiter=", " prefix=" (" suffix=")"> + <name and="symbol" initialize-with=". " delimiter=", "/> + <label form="short" prefix=", " text-case="title"/> + </names> + </if> + </choose> + </macro> + <macro name="author"> + <names variable="author"> + <name name-as-sort-order="all" and="symbol" sort-separator=", " initialize-with=". " delimiter=", " delimiter-precedes-last="always"/> + <label form="short" prefix=" (" suffix=")" text-case="capitalize-first"/> + <substitute> + <names variable="editor"/> + <names variable="translator"/> + <choose> + <if type="report"> + <text variable="publisher"/> + <text macro="title"/> + </if> + <else> + <text macro="title"/> + </else> + </choose> + </substitute> + </names> + </macro> + <macro name="author-short"> + <names variable="author"> + <name form="short" and="symbol" delimiter=", " initialize-with=". "/> + <substitute> + <names variable="editor"/> + <names variable="translator"/> + <choose> + <if type="report"> + <text variable="publisher"/> + <text variable="title" form="short" font-style="italic"/> + </if> + <else-if type="legal_case"> + <text variable="title" font-style="italic"/> + </else-if> + <else-if type="bill book graphic legislation motion_picture song" match="any"> + <text variable="title" form="short" font-style="italic"/> + </else-if> + <else> + <text variable="title" form="short" quotes="true"/> + </else> + </choose> + </substitute> + </names> + </macro> + <macro name="access"> + <choose> + <if type="thesis"> + <choose> + <if variable="archive" match="any"> + <group> + <text term="retrieved" text-case="capitalize-first" suffix=" "/> + <text term="from" suffix=" "/> + <text variable="archive" suffix="."/> + <text variable="archive_location" prefix=" (" suffix=")"/> + </group> + </if> + <else> + <group> + <text term="retrieved" text-case="capitalize-first" suffix=" "/> + <text term="from" suffix=" "/> + <text variable="URL"/> + </group> + </else> + </choose> + </if> + <else> + <choose> + <if variable="DOI"> + <text variable="DOI" prefix="doi:"/> + </if> + <else> + <choose> + <if type="webpage"> + <group delimiter=" "> + <text term="retrieved" text-case="capitalize-first" suffix=" "/> + <group> + <date variable="accessed" form="text" suffix=", "/> + </group> + <text term="from"/> + <text variable="URL"/> + </group> + </if> + <else> + <group> + <text term="retrieved" text-case="capitalize-first" suffix=" "/> + <text term="from" suffix=" "/> + <text variable="URL"/> + </group> + </else> + </choose> + </else> + </choose> + </else> + </choose> + </macro> + <macro name="title"> + <choose> + <if type="report thesis" match="any"> + <text variable="title" font-style="italic"/> + <group prefix=" (" suffix=")" delimiter=" "> + <text variable="genre"/> + <text variable="number" prefix="No. "/> + </group> + </if> + <else-if type="book graphic motion_picture report song manuscript speech" match="any"> + <!---This is a hack until we have a computer program type --> + <choose> + <if variable="version"> + <group delimiter=" "> + <text variable="title"/> + <group delimiter=" " prefix="(" suffix=")"> + <text term="version" text-case="capitalize-first"/> + <text variable="version"/> + </group> + </group> + </if> + <else> + <text variable="title" font-style="italic"/> + </else> + </choose> + </else-if> + <else> + <text variable="title"/> + </else> + </choose> + </macro> + <macro name="publisher"> + <choose> + <if type="report" match="any"> + <group delimiter=": "> + <text variable="publisher-place"/> + <text variable="publisher"/> + </group> + </if> + <else-if type="thesis" match="any"> + <group delimiter=", "> + <text variable="publisher"/> + <text variable="publisher-place"/> + </group> + </else-if> + <else> + <group delimiter=", "> + <choose> + <if variable="event" match="none"> + <text variable="genre"/> + </if> + </choose> + <choose> + <if type="article-journal article-magazine" match="none"> + <group delimiter=": "> + <text variable="publisher-place"/> + <text variable="publisher"/> + </group> + </if> + </choose> + </group> + </else> + </choose> + </macro> + <macro name="event"> + <choose> + <if variable="container-title" match="none"> + <choose> + <if variable="event"> + <choose> + <if variable="genre" match="none"> + <text term="presented at" text-case="capitalize-first" suffix=" "/> + <text variable="event"/> + </if> + <else> + <group delimiter=" "> + <text variable="genre" text-case="capitalize-first"/> + <text term="presented at"/> + <text variable="event"/> + </group> + </else> + </choose> + </if> + </choose> + </if> + </choose> + </macro> + <macro name="issued"> + <choose> + <if type="bill legal_case legislation" match="none"> + <choose> + <if variable="issued"> + <group prefix=" (" suffix=")"> + <date variable="issued"> + <date-part name="year"/> + </date> + <text variable="year-suffix"/> + <choose> + <if type="article-journal bill book chapter graphic legal_case legislation motion_picture paper-conference report song" match="none"> + <date variable="issued"> + <date-part prefix=", " name="month"/> + <date-part prefix=" " name="day"/> + </date> + </if> + </choose> + </group> + </if> + <else> + <group prefix=" (" suffix=")"> + <text term="no date" form="short"/> + <text variable="year-suffix" prefix="-"/> + </group> + </else> + </choose> + </if> + </choose> + </macro> + <macro name="issued-sort"> + <choose> + <if type="article-journal bill book chapter graphic legal_case legislation motion_picture paper-conference report song" match="none"> + <date variable="issued"> + <date-part name="year"/> + <date-part name="month"/> + <date-part name="day"/> + </date> + </if> + <else> + <date variable="issued"> + <date-part name="year"/> + </date> + </else> + </choose> + </macro> + <macro name="issued-year"> + <choose> + <if variable="issued"> + <date variable="issued"> + <date-part name="year"/> + </date> + <text variable="year-suffix"/> + </if> + <else> + <text term="no date" form="short"/> + <text variable="year-suffix" prefix="-"/> + </else> + </choose> + </macro> + <macro name="edition"> + <choose> + <if is-numeric="edition"> + <group delimiter=" "> + <number variable="edition" form="ordinal"/> + <text term="edition" form="short"/> + </group> + </if> + <else> + <text variable="edition" suffix="."/> + </else> + </choose> + </macro> + <macro name="locators"> + <choose> + <if type="article-journal article-magazine" match="any"> + <group prefix=", " delimiter=", "> + <group> + <text variable="volume" font-style="italic"/> + <text variable="issue" prefix="(" suffix=")"/> + </group> + <text variable="page"/> + </group> + </if> + <else-if type="article-newspaper"> + <group delimiter=" " prefix=", "> + <label variable="page" form="short"/> + <text variable="page"/> + </group> + </else-if> + <else-if type="book graphic motion_picture report song chapter paper-conference" match="any"> + <group prefix=" (" suffix=")" delimiter=", "> + <text macro="edition"/> + <group> + <text term="volume" form="short" plural="true" text-case="capitalize-first" suffix=" "/> + <number variable="number-of-volumes" form="numeric" prefix="1-"/> + </group> + <group> + <text term="volume" form="short" text-case="capitalize-first" suffix=" "/> + <number variable="volume" form="numeric"/> + </group> + <group> + <label variable="page" form="short" suffix=" "/> + <text variable="page"/> + </group> + </group> + </else-if> + <else-if type="legal_case"> + <group prefix=" (" suffix=")" delimiter=" "> + <text variable="authority"/> + <date variable="issued" form="text"/> + </group> + </else-if> + <else-if type="bill legislation" match="any"> + <date variable="issued" prefix=" (" suffix=")"> + <date-part name="year"/> + </date> + </else-if> + </choose> + </macro> + <macro name="citation-locator"> + <group> + <choose> + <if locator="chapter"> + <label variable="locator" form="long" text-case="capitalize-first"/> + </if> + <else> + <label variable="locator" form="short"/> + </else> + </choose> + <text variable="locator" prefix=" "/> + </group> + </macro> + <macro name="container"> + <group> + <choose> + <if type="chapter paper-conference entry-encyclopedia" match="any"> + <text term="in" text-case="capitalize-first" suffix=" "/> + </if> + </choose> + <text macro="container-contributors"/> + <text macro="secondary-contributors"/> + <text macro="container-title"/> + </group> + </macro> + <macro name="container-title"> + <choose> + <if type="article article-journal article-magazine article-newspaper" match="any"> + <text variable="container-title" font-style="italic" text-case="title"/> + </if> + <else-if type="bill legal_case legislation" match="none"> + <text variable="container-title" font-style="italic"/> + </else-if> + </choose> + </macro> + <macro name="legal-cites"> + <choose> + <if type="bill legal_case legislation" match="any"> + <group delimiter=" " prefix=", "> + <choose> + <if variable="container-title"> + <text variable="volume"/> + <text variable="container-title"/> + <group delimiter=" "> + <!--change to label variable="section" as that becomes available --> + <text term="section" form="symbol"/> + <text variable="section"/> + </group> + <text variable="page"/> + </if> + <else> + <choose> + <if type="legal_case"> + <text variable="number" prefix="No. "/> + </if> + <else> + <text variable="number" prefix="Pub. L. No. "/> + <group delimiter=" "> + <!--change to label variable="section" as that becomes available --> + <text term="section" form="symbol"/> + <text variable="section"/> + </group> + </else> + </choose> + </else> + </choose> + </group> + </if> + </choose> + </macro> + <citation et-al-min="6" et-al-use-first="1" et-al-subsequent-min="3" et-al-subsequent-use-first="1" disambiguate-add-year-suffix="true" disambiguate-add-names="true" disambiguate-add-givenname="true" collapse="year" givenname-disambiguation-rule="primary-name"> + <sort> + <key macro="author"/> + <key macro="issued-sort"/> + </sort> + <layout prefix="(" suffix=")" delimiter="; "> + <group delimiter=", "> + <text macro="author-short"/> + <text macro="issued-year"/> + <text macro="citation-locator"/> + </group> + </layout> + </citation> + <bibliography hanging-indent="true" et-al-min="8" et-al-use-first="6" et-al-use-last="true" entry-spacing="0" line-spacing="2"> + <sort> + <key macro="author"/> + <key macro="issued-sort" sort="ascending"/> + <key macro="title"/> + </sort> + <layout> + <group suffix="."> + <group delimiter=". "> + <text macro="author"/> + <text macro="issued"/> + <text macro="title" prefix=" "/> + <text macro="container"/> + </group> + <text macro="legal-cites"/> + <text macro="locators"/> + <group delimiter=", " prefix=". "> + <text macro="event"/> + <text macro="publisher"/> + </group> + </group> + <text macro="access" prefix=" "/> + </layout> + </bibliography> +</style> |