Commit graph

129 commits

Author SHA1 Message Date
John MacFarlane
9061635a6a Use latest citeproc. 2020-09-26 15:05:08 -07:00
John MacFarlane
1a72581286 Use latest citeproc commit. 2020-09-24 20:33:05 -07:00
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
Albert Krewinkel
fbdc0b3ad4
cabal.project: disallow base16-bytestring-1.*
This is a temporary fix to work around a missing constraint in package
text-conversions. It should be removed once a new revision or new
version fixes the underlying issue.
2020-09-20 21:32:54 +02:00
John MacFarlane
ce33a97ad4 cabal.project - use dev version of pandoc-citeproc. 2020-09-20 09:58:58 -07:00
John MacFarlane
1dd9f8b654 Use released pandoc-types 1.22. 2020-09-19 09:58:16 -07:00
Christian Despres
10c6c411f9
Add Writers.Tables helper functions and types, add tests for those (#6655)
Add Writers.Tables helper functions and types, add tests for those

The Writers.Tables module contains an AnnTable type that is a pandoc
Table with added inferred information that should be enough for
writers (in particular the HTML writer) to operate on without having
to lay out the table themselves.

The toAnnTable and fromAnnTable functions in that module convert
between AnnTable and Table. In addition to producing an AnnTable with
coherent and well-formed annotations, the toAnnTable function also
normalizes its input Table like the table builder does.

Various tests ensure that toAnnTable normalizes tables exactly like
the table builder, and that its annotations are coherent.
2020-09-05 14:36:51 -07:00
John MacFarlane
971b861ef2 Use new pandoc-citeproc, rfc5051. 2020-08-02 09:40:24 -07:00
John MacFarlane
d6b7b1dc77 Remove use of cmark-gfm for commonmark/gfm rendering.
Instead rely on the markdown writer with appropriate extensions.

Export writeCommonMark variant from Markdown writer.
This changes a few small things in rendering markdown,
e.g. w/r/t requiring backslashes before spaces inside
super/subscripts.
2020-07-19 22:51:59 -07:00
John MacFarlane
0df5ea87cf Use released versions of commonmark libraries. 2020-07-19 22:51:59 -07:00
John MacFarlane
f1c678a97e re-add pandoc-citeproc to cabal.project. 2020-06-24 09:43:47 -07:00
John MacFarlane
3b25511e47 Use released pandoc-citeproc. 2020-06-23 10:44:22 -07:00
John MacFarlane
c5c8bc96a1 Use released pandoc-types 1.21. 2020-06-22 16:39:04 -07:00
John MacFarlane
8d09a92d97 Use latest pandoc-types master with underline addition. 2020-04-27 09:35:34 -07:00
John MacFarlane
64e84d8a3e Use dev version of pandoc-citeproc...
so we can use pandoc-types 1.21 with it.
2020-04-19 09:00:18 -07:00
John MacFarlane
61771e2c9b Use pandoc-types 1.21, new texmath. 2020-04-19 08:17:32 -07:00
John MacFarlane
2877ca70ec Fix typo. 2020-04-17 11:02:47 -07:00
John MacFarlane
7accbd585e Use main pandoc-types repository...
now that @despresc's changes have been merged.
2020-04-17 10:05:55 -07:00
Albert Krewinkel
75d7e69532 Use custom pandoc-types repo with new table types 2020-04-15 23:03:22 -04:00
John MacFarlane
21b1358a52 Whitespace change to cabal.project...
to invalidate cache.
2020-04-12 22:27:54 -07:00
John MacFarlane
87b9ee87e6 Use pandoc-citeproc 0.17. 2020-02-15 21:51:39 -08:00
John MacFarlane
d3a8423183 Use pandoc-citeproc 0.16.4.1 (cabal). 2019-12-11 19:19:20 -08:00
John MacFarlane
97387f8fac Increase GC allocation space for compilation in cabal.project. 2019-11-27 18:49:44 -08:00
John MacFarlane
20f8391a56 Re-add pandoc-citeproc to cabal.project. 2019-11-22 07:57:40 -08:00
John MacFarlane
138d0b1b3e Use released pandoc-citeproc 0.16.4. 2019-11-21 21:40:35 -08:00
despresc
90e436d496 Switch to new pandoc-types and use Text instead of String [API change].
PR #5884.

+ Use pandoc-types 1.20 and texmath 0.12.
+ Text is now used instead of String, with a few exceptions.
+ In the MediaBag module, some of the types using Strings
  were switched to use FilePath instead (not Text).
+ In the Parsing module, new parsers `manyChar`, `many1Char`,
  `manyTillChar`, `many1TillChar`, `many1Till`, `manyUntil`,
  `mantyUntilChar` have been added: these are like their
  unsuffixed counterparts but pack some or all of their output.
+ `glob` in Text.Pandoc.Class still takes String since it seems
  to be intended as an interface to Glob, which uses strings.
  It seems to be used only once in the package, in the EPUB writer,
  so that is not hard to change.
2019-11-12 16:03:45 -08:00
John MacFarlane
b44a4c803e FIx typo in cabal.project. 2019-11-07 14:16:02 -08:00
John MacFarlane
9c7f75afb5 Change merge behavior for metadata.
Previously, if a document contained two YAML metadata blocks
that set the same field, the conflict would be resolved in favor
of the first. Now it is resolved in favor of the second (due to
a change in pandoc-types).

This makes the behavior more uniform with other things in pandoc
(such as reference links and `--metadata-file`).
2019-11-07 10:48:38 -08:00
John MacFarlane
803ab48a20 Use latest pandoc-citeproc 0.16.3.1 in binary packages. 2019-11-04 09:32:56 -08:00
John MacFarlane
1fe9742263 Changes to build with new doctemplates/doclayout.
The new version of doctemplates adds many features to pandoc's
templating system, while remaining backwards-compatible.
New features include partials and filters.  Using template filters,
one can lay out data in enumerated lists and tables.

Templates are now layout-sensitive: so, for example, if a
text with soft line breaks is interpolated near the end of
a line, the text will break and wrap naturally.  This makes
the templating system much more suitable for programatically
generating markdown or other plain-text files from metadata.
2019-10-29 22:21:35 -07:00
John MacFarlane
b80bd174a2 Use latest dev doctemplates 2019-10-16 09:25:52 -07:00
John MacFarlane
f1fd120d4a Use latest dev doctemplates. 2019-10-15 22:33:29 -07:00
John MacFarlane
a0aeb135b3 Minor template & test changes for latest dev doctemplates. 2019-10-14 23:42:29 -07:00
John MacFarlane
7388cd3e7a Improve parsing of --defaults.
- Add FromYAML instances to Opt and to all subsidiary types.
- Remove the use of HsYAML-aeson, which doesn't give good
  position information on errors.
- Rename some fields in Opt to better match cli options or
  reflect what the ycontain [API change]:

  + optMetadataFile -> optMetadataFiles
  + optPDFEngineArgs -> optPDFEngineOpts
  + optWrapText -> optWrap
- Add IpynbOutput enumerated type to Text.Pandoc.App.Opts.
  Use this instead fo a string for optIpynbOutput.
- Add FromYAML instance for Filter in Text.Pandoc.Filters.

With these changes parsing of defaults files should be
complete and should give decent error messages.

Now (unlike before) we get an error if an unknown field
is used.
2019-10-10 23:21:18 -07:00
John MacFarlane
8a77bbf6eb Update cabal.project to use dev version of doctemplates. 2019-10-09 14:23:29 -07:00
John MacFarlane
d98dde07c9 Used released pandoc-citeproc 0.16.3. 2019-09-25 18:03:57 -07:00
John MacFarlane
f60ae7f327 Update pandoc-citeproc commit. 2019-09-22 22:09:51 -07:00
John MacFarlane
74e25c5480 Use latest pandoc-citeproc. 2019-09-22 17:03:40 -07:00
John MacFarlane
a9d106d1d1 Use released doctemplates 2019-09-22 10:58:04 -07:00
John MacFarlane
bb362fd76c Add partial styles.html in HTML5 template.
Avoid duplication in HTML templates by using styles.html partial.
Change indentation of styles in template.
2019-09-05 12:39:50 -07:00
John MacFarlane
d0bddaf7b9 Use latest pandoc-citeproc. 2019-09-02 21:26:20 -07:00
John MacFarlane
e9ba29e57f Use doctemplates 0.6. 2019-09-02 11:14:14 -07:00
Albert Krewinkel
cd4b8f66bb Cabal cleanup (#5693)
* pandoc.cabal: remove conditionals for ghc < 8.0. Support for GHC 7.10 has been dropped.
* pandoc.cabal: compile with `-Wcpp-undef` when possible
* pandoc.cabal: compile with `-fhide-source-paths` if possible
2019-08-26 17:04:30 -07:00
John MacFarlane
8a26422bfc Use dev version of doctemplates. 2019-08-25 23:49:40 -07:00
John MacFarlane
188bd5e1e9 Update cabal.project to use released doctemplates. 2019-08-25 14:30:19 -07:00
John MacFarlane
1ee6e0e087 Use new doctemplates, doclayout.
+ Remove Text.Pandoc.Pretty; use doclayout instead. [API change]
+ Text.Pandoc.Writers.Shared: remove metaToJSON, metaToJSON'
  [API change].
+ Text.Pandoc.Writers.Shared: modify `addVariablesToContext`,
  `defField`, `setField`, `getField`, `resetField` to work with
  Context rather than JSON values. [API change]
+ Text.Pandoc.Writers.Shared: export new function `endsWithPlain` [API
  change].
+ Use new templates and doclayout in writers.
+ Use Doc-based templates in all writers.
+ Adjust three tests for minor template rendering differences.
+ Added indentation to body in docbook4, docbook5 templates.

The main impact of this change is better reflowing of content
interpolated into templates.  Previously, interpolated variables
were rendered independently and intepolated as strings, which could lead
to overly long lines.  Now the templates interpolated as Doc values
which may include breaking spaces, and reflowing occurs
after template interpolation rather than before.
2019-08-25 14:24:31 -07:00
John MacFarlane
5b11ca03e1 Use released pandoc-types. 2019-08-23 12:50:58 -07:00
Albert Krewinkel
6166f9499f
cabal.project: remove options unsupported by GHC 8.0 2019-08-16 20:52:15 +02:00
Albert Krewinkel
813e1fc7e0
Lua: add module for AST element sequence traversal
Lua filters must be able to traverse sequences of AST elements and to
replace elements by splicing sequences back in their place. Special
`Walkable` instances can be used for this; those are provided in a new
module `Text.Pandoc.Lua.Walk`.
2019-08-16 20:52:15 +02:00
John MacFarlane
ea3a779f7b Use dev version of pandoc-citeproc. 2019-08-05 10:51:06 -07:00
John MacFarlane
3ab1f21568 Use latest pandoc-citeproc. 2019-07-28 23:43:04 -07:00
John MacFarlane
dddad515e8 Update pandoc-citeproc and skylighting versions. 2019-06-04 09:01:50 -07:00
John MacFarlane
9e63924f28 Add ghc-options to cabal.project. 2019-03-27 09:36:52 -07:00
John MacFarlane
12e36ba827 Use latest pandoc-citeproc. 2019-03-12 23:27:45 -07:00
John MacFarlane
a286ef2eb5 Update pandoc-citeproc version in cabal.project. 2019-03-07 22:38:14 -08:00
John MacFarlane
994ca26199 cabal.project - update pandoc-citeproc version. 2019-03-03 09:16:28 -08:00
John MacFarlane
fb5bafd13e Use latest pandoc-citeproc (0.16.1). 2019-02-15 15:05:46 -08:00
John MacFarlane
4ef23623d3 Use pandoc-citeproc-0.16.0.2 2019-02-07 10:00:21 -08:00
John MacFarlane
5d3b8ede15 cabal.project - use released pandoc-citeproc (take 2). 2019-02-06 17:32:46 -08:00
John MacFarlane
23932d5e05 cabal.project - use released pandoc-citeproc. 2019-02-06 10:56:28 -08:00
John MacFarlane
aec7afa24a Fix cabal.project. 2019-01-25 08:11:24 -08:00
John MacFarlane
975d8efb3b cabal.project - set flag defaults, revise pandoc-citeproc commit. 2019-01-25 06:56:08 -08:00
John MacFarlane
395ea03069 Support ipynb (Jupyter notebook) as input and output format.
[API change]

* Depend on ipynb library.

* Add `ipynb` as input and output format.

* Added Text.Pandoc.Readers.Ipynb (supports both nbformat v3 and v4).

* Added Text.Pandoc.Writers.Ipynb (supports nbformat v4).

* Added ipynb readers and writers to T.P.Readers,
  T.P.Writers, and T.P.Extensions.  Register the
  file extension .ipynb for this format.

* Add `PandocIpynbDecodingError` constructor to Text.Pandoc.Error.Error.

* Note: there is no template for ipynb.
2019-01-22 21:45:59 -08:00
John MacFarlane
80e86109a2 Use compatible version of pandoc-citeproc. 2018-12-02 09:33:50 -08:00
John MacFarlane
465f11833f Remove tag on pandoc-citeproc in cabal.project. 2018-10-18 20:45:20 -07:00
John MacFarlane
2cd8f1f155 cabal.project - add tag for pandoc-citeproc. 2018-10-18 17:01:56 -07:00
John MacFarlane
19d9afcae6 Revert "cabal.project - removed git repo for pandoc-citeproc."
This reverts commit 29ea3e734d.
2018-10-18 16:58:47 -07:00
John MacFarlane
29ea3e734d cabal.project - removed git repo for pandoc-citeproc.
Released version is okay.
2018-10-18 16:43:36 -07:00
John MacFarlane
ebdb2deb0d Updated version bounds for containers and haddock-library.
Allow haddock-library 1.7 and containers 0.6.*.

Closes #4974.
2018-10-17 17:30:14 -07:00
John MacFarlane
65cf5cfe7b cabal.project - use latest pandoc-citeproc from git. 2018-10-04 10:34:10 -07:00
John MacFarlane
7bf80575b5 cabal.project - added pandoc.citeproc again. 2018-10-02 10:48:24 -07:00
John MacFarlane
2bec94e49f cabal.project - remove source-dependency stanzas.
They shouldn't be needed given new releases of these packages.
2018-10-01 23:58:25 -07:00
John MacFarlane
890d67bc2f Use released pandoc-citeproc, texmath. 2018-09-28 16:28:56 -07:00
John MacFarlane
4461134b14 Added 'allow-newer' to cabal.project. 2018-09-26 22:20:14 -07:00
John MacFarlane
881a1e0145 Add texmath to cabal.project. 2018-09-25 19:00:34 -07:00
John MacFarlane
b3ada2f11b cabal.project - use source repository stanzas. 2018-09-25 17:48:33 -07:00
John MacFarlane
225062a2bc cabal.project - use vendor/*/*.cabal. 2018-09-25 15:24:22 -07:00
John MacFarlane
cc993460be cabal.project - use ./pandoc-citeproc. 2018-09-25 15:23:02 -07:00
John MacFarlane
cbdf7f4199 Added cabal.project. 2018-09-25 15:07:46 -07:00