pandoc/test/command/7067.md
John MacFarlane 02d3c71e72 BibTeX writer: use doclayout and doctemplate.
This change allows bibtex/biblatex output to wrap as other
formats do, depending on the settings of `--wrap` and `--columns`.

It also introduces default templates for bibtex and biblatex,
which allow for using the variables `header-include`, `include-before`
or `include-after` (or alternatively the command line options
`--include-in-header`, `--include-before-body`, `--include-after-body`)
to insert content into the generated bibtex/biblatex.

This change requires a change in the return type of the unexported
`T.P.Citeproc.writeBibTeXString` from `Text` to `Doc Text`.

Closes #7068.
2021-02-01 18:05:20 -08:00

2 KiB
Raw Blame History

% pandoc -t biblatex
---
references:
- id: garaud
  author:
    - family: Garaud
      given: Marcel
  container-title: Bulletin de la Societé des antiquaires de lOuest
  collection-title: 4
  issued:
    - year: 1967
  language: fr-FR
  page: 11-27
  title: Recherches sur les défrichements dans la Gâtine poitevine aux XI^e^ et XII^e^ siècles
  type: article-journal
  volume: 9
...
^D
@article{garaud,
  author = {Garaud, Marcel},
  title = {Recherches sur les défrichements dans la Gâtine poitevine aux
    XI\textsuperscript{e} et XII\textsuperscript{e} siècles},
  journal = {Bulletin de la Societé des antiquaires de lOuest},
  series = {4},
  volume = {9},
  pages = {11-27},
  date = {1967},
  langid = {fr-FR}
}
% pandoc -t bibtex
---
references:
- id: garaud
  author:
    - family: Garaud
      given: Marcel
  container-title: Bulletin de la Société des antiquaires de lOuest
  collection-title: 4
  issued:
    - year: 1967
  language: fr-FR
  page: 11-27
  title: Recherches sur les défrichements dans la Gâtine poitevine aux XI^e^ et XII^e^ siècles
  type: article-journal
  volume: 9
...
^D
@article{garaud,
  author = {Garaud, Marcel},
  title = {{Recherches sur les défrichements dans la Gâtine poitevine
    aux XI\textsuperscript{e} et XII\textsuperscript{e} siècles}},
  journal = {Bulletin de la Société des antiquaires de lOuest},
  series = {4},
  volume = {9},
  pages = {11-27},
  year = {1967}
}

This tests the titlecasing of a word with an accented second letter:

% pandoc -t bibtex
---
references:
- id: garaud
  author:
    - family: Garaud
      given: Marcel
  container-title: English Journal
  issued:
    - year: 1967
  language: en-US
  title: Research on the défrichements in the Gâtine poitevine
  type: article-journal
  volume: 9
...
^D
@article{garaud,
  author = {Garaud, Marcel},
  title = {Research on the Défrichements in the {Gâtine} Poitevine},
  journal = {English Journal},
  volume = {9},
  year = {1967}
}