pandoc/test/command/biblatex-dates.md
John MacFarlane e0984a43a9 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-21 10:15:50 -07:00

4.4 KiB

% pandoc -f biblatex -t markdown -s
@comment{
    - Dates
    - Not included in tests:
        - malformed dates and date ranges
        - literal dates ("13th century"; not supported by biblatex)
        - seasons (would have to come from parsing the issue field)
        - uncertain dates (use "doubtfuldate" from biblatex-apa?)
        - dates with single-digit day or month (not supported by biblatex)
        - negative dates (not supported by biblatex)
    - Note: biblatex supports years < 1000 but only if padded with leading zeros
    - TODO:
        - either biblio2yaml or, probably better, citeproc should strip leading zeros
         from days and months (CSL can add leading zeros to its output, but not remove
         them when they are in its input data)
}

@article{year-month-old,
    Author = {Author, Al},
    Journal = {Journal},
    Month = aug,
    Title = {Year and Month, bibtex style, supported by biblatex for backwards compatibility},
    Year = {1999}}

@article{year-month-new,
    Author = {Author, Al},
    Journal = {Journal},
    Month = {08},
    Title = {Year and Month, biblatex style; note that biblatex does not have a ``day'' field},
    Year = {1999}}

@article{dates,
    Author = {Author, Al},
    Date = {2012-12-13},
    Eventdate = {2011-10-03},
    Journal = {Journal},
    Month = may,
    Origdate = {1888-10-01},
    Title = {Dates, default biblatex style; year, month to be ignored if date exists},
    Urldate = {1999-05-23},
    Year = {9999}}

@article{date-ranges-different-years,
    Author = {Author, Al},
    Date = {1999-10-14/2010-01-23},
    Eventdate = {1999-12/2000-01},
    Journal = {Journal},
    Origdate = {1888-01-02/1913-12-13},
    Title = {Date ranges; different years},
    Urldate = {2012-10-12/2013-01-31}}

@article{date-ranges-same-year,
    Author = {Author, Al},
    Date = {1999-10-14/1999-10-15},
    Eventdate = {1999-10/1999-11},
    Journal = {Journal},
    Origdate = {1888-01-02/1888-12-13},
    Title = {Date ranges; same year},
    Urldate = {2012-10-31/2012-11-01}}

@article{date-ranges-open,
    Author = {Author, Al},
    Date = {1999-10-14/},
    Eventdate = {1999-10/},
    Journal = {Journal},
    Origdate = {1888-01-02/},
    Title = {Date ranges, open-ended},
    Urldate = {2012-10-31/}}

@article{dates-very-old,
    Author = {Author, Al},
    Date = {0712-12-13},
    Eventdate = {0311-10-03},
    Journal = {Journal},
    Month = may,
    Origdate = {0088-10-01},
    Title = {Dates, year less than 1000},
    Urldate = {0999-12-14}}

^D
---
nocite: '[@*]'
references:
- author:
  - family: Author
    given: Al
  container-title: Journal
  id: 'year-month-old'
  issued: '1999-08'
  title: 'Year and month, bibtex style, supported by biblatex for
    backwards compatibility'
  type: 'article-journal'
- author:
  - family: Author
    given: Al
  container-title: Journal
  id: 'year-month-new'
  issued: '1999-08'
  title: 'Year and month, biblatex style; note that biblatex does not
    have a "day" field'
  type: 'article-journal'
- accessed: '1999-05-23'
  author:
  - family: Author
    given: Al
  container-title: Journal
  event-date: '2011-10-03'
  id: dates
  issued: '2012-12-13'
  original-date: '1888-10-01'
  title: 'Dates, default biblatex style; year, month to be ignored if
    date exists'
  type: 'article-journal'
- accessed: '2012-10-12/2013-01-31'
  author:
  - family: Author
    given: Al
  container-title: Journal
  event-date: '1999-12/2000-01'
  id: 'date-ranges-different-years'
  issued: '1999-10-14/2010-01-23'
  original-date: '1888-01-02/1913-12-13'
  title: Date ranges; different years
  type: 'article-journal'
- accessed: '2012-10-31/2012-11-01'
  author:
  - family: Author
    given: Al
  container-title: Journal
  event-date: '1999-10/1999-11'
  id: 'date-ranges-same-year'
  issued: '1999-10-14/1999-10-15'
  original-date: '1888-01-02/1888-12-13'
  title: Date ranges; same year
  type: 'article-journal'
- accessed: '2012-10-31/'
  author:
  - family: Author
    given: Al
  container-title: Journal
  event-date: '1999-10/'
  id: 'date-ranges-open'
  issued: '1999-10-14/'
  original-date: '1888-01-02/'
  title: 'Date ranges, open-ended'
  type: 'article-journal'
- accessed: '0999-12-14'
  author:
  - family: Author
    given: Al
  container-title: Journal
  event-date: '0311-10-03'
  id: 'dates-very-old'
  issued: '0712-12-13'
  original-date: '0088-10-01'
  title: 'Dates, year less than 1000'
  type: 'article-journal'
---