pandoc/test/command/pandoc-citeproc-320.md

255 lines
4.4 KiB
Markdown
Raw Normal View History

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.
2020-09-07 01:25:16 +02:00
```
% pandoc --citeproc -t markdown-citations
---
csl: command/apa.csl
references:
- author:
- family: Benjamin
given: A. S.
id: itemA1
- author:
- family: Yaakov
given: D.
non-dropping-particle: ben
id: itemA2
- author:
- family: Brown
given: J. R.
id: itemA3
- author:
- family: Browning
given: A. R.
id: itemA4
- author:
- family: Girard
given: 'J.-B.'
id: itemA5
- author:
- family: 'Girard-Perregaux'
given: A. S.
id: itemA6
- author:
- family: Ibn Abdulaziz
given: T.
id: itemA7
- author:
- family: Ibn Nidal
given: A. K. M.
id: itemA8
- author:
- family: López
given: M. E.
id: itemA9
- author:
- family: López de Molina
given: G.
id: itemA10
- author:
- family: Singh
given: Y.
id: itemA11
- author:
- family: Singh Siddhu
given: N.
id: itemA12
- author:
- family: Villafuerte
given: S. A.
id: itemA13
- author:
- family: 'Villa-Lobos'
given: J.
id: itemA14
- author:
- family: Macalister
given: Donald
id: itemB1
- author:
- family: MacAlister
given: Paul
id: itemB2
- author:
- family: Macauley
given: Catharine
id: itemB3
- author:
- family: Macmillan
given: Harold
id: itemB4
- author:
- family: Madison
given: James
id: itemB5
- author:
- family: McAllister
given: Ward
id: itemB6
- author:
- family: McAuley
given: Catherine
id: itemB7
- author:
- family: McMillan
given: Edwin M.
id: itemB8
- author:
- family: 'Sainte-Beuve'
given: 'Charles-Augustin'
id: itemC1
- author:
- family: 'Saint-Gaudens'
given: Augustus
id: itemC2
- author:
- family: 'Saint-Saëns'
given: Camille
id: itemC3
- author:
- dropping-particle: de
family: San Martin
given: José
id: itemC4
- author:
- family: St. Denis
given: Ruth
id: itemC5
- author:
- family: St. Laurent
given: Louis Stephen
id: itemC6
---
Foo
[@itemA1; @itemA2; @itemA3; @itemA4; @itemA5; @itemA6; @itemA7; @itemA8; @itemA9; @itemA10; @itemA11; @itemA12; @itemA13; @itemA14].
Foo
[@itemB1; @itemB2; @itemB3; @itemB4; @itemB5; @itemB6; @itemB7; @itemB8].
Foo [@itemC1; @itemC2; @itemC3; @itemC4; @itemC5; @itemC6].
^D
Foo (ben Yaakov, n.d.; Benjamin, n.d.; Brown, n.d.; Browning, n.d.;
Girard, n.d.; Girard-Perregaux, n.d.; Ibn Abdulaziz, n.d.; Ibn Nidal,
n.d.; López de Molina, n.d.; López, n.d.; Singh Siddhu, n.d.; Singh,
n.d.; Villafuerte, n.d.; Villa-Lobos, n.d.).
Foo (Macalister, n.d.; MacAlister, n.d.; Macauley, n.d.; Macmillan,
n.d.; Madison, n.d.; McAllister, n.d.; McAuley, n.d.; McMillan, n.d.).
Foo (Sainte-Beuve, n.d.; Saint-Gaudens, n.d.; Saint-Saëns, n.d.; San
Martin, n.d.; St. Denis, n.d.; St. Laurent, n.d.).
::: {#refs .references .csl-bib-body .hanging-indent line-spacing="2"}
::: {#ref-itemA2 .csl-entry}
ben Yaakov, D. (n.d.).
:::
::: {#ref-itemA1 .csl-entry}
Benjamin, A. S. (n.d.).
:::
::: {#ref-itemA3 .csl-entry}
Brown, J. R. (n.d.).
:::
::: {#ref-itemA4 .csl-entry}
Browning, A. R. (n.d.).
:::
::: {#ref-itemA5 .csl-entry}
Girard, J.-B. (n.d.).
:::
::: {#ref-itemA6 .csl-entry}
Girard-Perregaux, A. S. (n.d.).
:::
::: {#ref-itemA7 .csl-entry}
Ibn Abdulaziz, T. (n.d.).
:::
::: {#ref-itemA8 .csl-entry}
Ibn Nidal, A. K. M. (n.d.).
:::
::: {#ref-itemA10 .csl-entry}
López de Molina, G. (n.d.).
:::
::: {#ref-itemA9 .csl-entry}
López, M. E. (n.d.).
:::
::: {#ref-itemB1 .csl-entry}
Macalister, D. (n.d.).
:::
::: {#ref-itemB2 .csl-entry}
MacAlister, P. (n.d.).
:::
::: {#ref-itemB3 .csl-entry}
Macauley, C. (n.d.).
:::
::: {#ref-itemB4 .csl-entry}
Macmillan, H. (n.d.).
:::
::: {#ref-itemB5 .csl-entry}
Madison, J. (n.d.).
:::
::: {#ref-itemB6 .csl-entry}
McAllister, W. (n.d.).
:::
::: {#ref-itemB7 .csl-entry}
McAuley, C. (n.d.).
:::
::: {#ref-itemB8 .csl-entry}
McMillan, E. M. (n.d.).
:::
::: {#ref-itemC1 .csl-entry}
Sainte-Beuve, C.-A. (n.d.).
:::
::: {#ref-itemC2 .csl-entry}
Saint-Gaudens, A. (n.d.).
:::
::: {#ref-itemC3 .csl-entry}
Saint-Saëns, C. (n.d.).
:::
::: {#ref-itemC4 .csl-entry}
San Martin, J. de. (n.d.).
:::
::: {#ref-itemA12 .csl-entry}
Singh Siddhu, N. (n.d.).
:::
::: {#ref-itemA11 .csl-entry}
Singh, Y. (n.d.).
:::
::: {#ref-itemC5 .csl-entry}
St. Denis, R. (n.d.).
:::
::: {#ref-itemC6 .csl-entry}
St. Laurent, L. S. (n.d.).
:::
::: {#ref-itemA13 .csl-entry}
Villafuerte, S. A. (n.d.).
:::
::: {#ref-itemA14 .csl-entry}
Villa-Lobos, J. (n.d.).
:::
:::
```