6623 Commits
Author SHA1 Message Date
John MacFarlane 817d2048da Improved template API and fixed a bug. Closes #5979.
* Text.Pandoc.Templates [API change]

  + Add Monad wrappers `WithDefaultPartials` and `WithPartials`.
    Wrapping these around an instance of `PandocMonad` gives
    us different instances of `TemplateMonad`, with different
    search behavior in retrieving partials.
    To compile a template and limit partial search to pandoc's
    data files, use `runWithDefaultPartials (compileTemplate ...)`.
    To compile a template and allow partials to be found locally
    (either on the file system or via HTTP, in the event that
    the main template has an absolute URL), ue
    `runWithPartials (compileTemplate ...)`.

  + Export `getTemplate`, which seeks a template locally,
    or via HTTP if the template has an absolute URL, falling
    back to the data files if not found.

  + Export `compileDefaultTemplate` -- does `getDefaultTemplate`
    and compiles the result, raising an error on failure.

* Text.Pandoc.Class [API change]

  + Remove `TemplateMonad` instances for `PandocIO` and `PandocPure`.
    These were too limiting and caused a bug whereby a local
    partial could be used even when the default template was requested.
    We now rely on instances provided in the Templates module.

Text.Pandoc.App.OutputSettings

  + Simplify template retrieval code.
2019-12-11 10:53:24 -08:00
John MacFarlane a6297d252e More informative JSON parse error.
Closes #5973.
2019-12-09 07:25:37 -08:00
John MacFarlane 0bfe478a69 Use external emojis package.
Moved the emoji-specified code into an external package
we can depend on.
2019-12-08 17:27:18 -08:00
John MacFarlane 8d00331115 Fix --toc-depth regression in 2.8.
Closes #5967.
2019-12-07 15:15:55 -08:00
John MacFarlane 0b54d6282b Fix --toc-depth regression in 2.8.
Closes #5967.
2019-12-07 14:20:41 -08:00
John MacFarlane d96f1fdc40 Avoid deprecation warning for minimumDef using CPP. 2019-12-05 10:35:16 -08:00
John MacFarlane 992f77c17c Roll back part of of --shift-heading-level-by change.
With positive heading shifts, starting in 2.8 this option caused
metadata titles to be removed and changed to regular headings.
This behavior is incompatible with the old behavior of
`--base-header-level` and breaks old workflows, so with this
commit we are rolling back this change.

Now, there is an asymmetry in positive and negative heading
level shifts:

+ With positive shifts, the metadata title stays the same and
  does not get changed to a heading in the body.
+ With negative shifts, a heading can be converted into the
  metadata title.

I think this is a desirable combination of features, despite
the asymmetry.  One might, e.g., want to have a document
with level-1 section headigs, but render it to HTML with
level-2 headings, retaining the metadata title (which pandoc
will render as a level-1 heading with the default template).

Closes #5957.
Revises #5615.
2019-12-05 09:59:50 -08:00
John MacFarlane 79a10388da HTML writer: add task-list class to ul if all elements are task list items.
This will allow styling unordered task lists in a way that omits
the bullet.
2019-12-05 09:32:40 -08:00
John MacFarlane 4489283b03 Fix makeSections so it doesn't turn column divs into sections. 2019-12-05 09:17:28 -08:00
John MacFarlane 28a2a6e534 Fix regression with behavior of --variable.
Previously -Vfoo=1 -Vfoo=2 would produce a list value for foo;
with 2.8 it produced just '2'.  This commit restores the earlier
beahvior.

Closes #5962.
2019-12-04 17:49:12 -08:00
John MacFarlane 6c435a17cd Move data/emoji.json to emoji.json, add to extra-source-files.
This doesn't really belong in data-files as it's not loaded
dynamically.
2019-12-03 16:38:19 -08:00
John MacFarlane 67f5d65cd5 Add ascii_identifiers as a supported extension for markdown.
This fixes a regression in 2.8.
2019-11-29 11:27:05 -08:00
John MacFarlane 36b4c04ffd Use [|..|] syntax to simplify Emoji.TH. 2019-11-27 21:50:55 -08:00
John MacFarlane 14ed6fa141 Remove redundant import. 2019-11-27 21:32:00 -08:00
John MacFarlane 0d0ec98dd5 Generate Emoji module with TH.
- Add Text.Pandoc.Emoji.TH.
- Replace long literal list in Text.Pandoc.Emoji with one-liner
  generating it from data/emoji.json using TH.
- Add Makefile target to download data/emoji.json.
- Remove tools/emoji.hs.
2019-11-27 21:31:53 -08:00
John MacFarlane 8a42ca41cf LaTeX writer - hlint. 2019-11-27 10:04:00 -08:00
John MacFarlane 982d2f6cd3 HTML writer: hlint improvements. 2019-11-27 09:52:11 -08:00
John MacFarlane 3accc2a5cd Removed useless cpp for old versions of blaze. 2019-11-27 09:45:00 -08:00
John MacFarlane 0f800b9d37 Removed unneeded pragma. 2019-11-27 09:40:24 -08:00
John MacFarlane b4f434ae0d Add pdf to list of output formats (--list-output-formats).
Closes #5938.
2019-11-26 09:28:05 -08:00
John MacFarlane 421ae44cdf EPUB writer: Fix regression with `--css option.
Closes #5937.
2019-11-25 17:50:27 -08:00
John MacFarlane ce0a4f8c47 RST writers: Use grid tables for 1-column tables.
With simple tables, we have a clash with heading syntax.
Closes #5936.
2019-11-25 07:31:28 -08:00
John MacFarlane 659ee98176 Add unexported Text.Pandoc.Readers.Metadata.
For YAML metadata parsing. A step in the direction of #5914.
No API change.
2019-11-24 11:50:28 -08:00
Albert Krewinkel d948e13fea Jira writer: improve escaping of special chars (#5925)
Backslash-escaping is used instead of HTML entities, as escaped
characters are easier to read this way. Furthermore, Confluence, which
seems to use a subset of Jira markup, seems to get confused by HTML
entities.
2019-11-22 07:57:24 -08:00
Jose Luis Duran ff8d143836 LaTeX reader: parse \micro siunitx unit command (#5921)
This was somehow missed in 884aef31c5.
2019-11-21 09:22:53 -08:00
John MacFarlane 5a7a4451ca TEI writer: don't strip hash from internal links.
Closes #5922.
2019-11-21 09:21:15 -08:00
Brian Wignall a946424e3c Fix typos (#5919) 2019-11-20 09:44:23 -08:00
John MacFarlane c1b51b1282 Improve markdown escaping in list items.
Closes #5918.
2019-11-19 22:33:14 -08:00
Alexander Krotov 33d2a1a84f DokuWiki reader: parse markup inside monospace ('') (#5917)
Fixes #5916
2019-11-18 15:05:19 -08:00
John MacFarlane 73fb9496bc Reverted the behavior change with --title-prefix.
It now implies `--standalone` again, as before.
2019-11-17 17:35:50 -08:00
John MacFarlane 147ef90fde Ensure that options imply --standalone even in defaults file.
Certain options (`--self-contained`, `--include-in-header`, etc.)
imply `--standalone`.  We now handle this after option parsing
so that it affects options specified in defaults files too.

Behavior change: `--title-prefix` no longer implies `--standalone`.
2019-11-17 17:21:55 -08:00
John MacFarlane 1bf17a7c87 Ms writer: boldface definition terms in DefinitionLists.
Like LaTeX, ConTeXt.
2019-11-16 19:01:53 -08:00
John MacFarlane 202d404d65 ConTeXt writer: set csl-hanging-ident variable if needed. 2019-11-16 18:21:33 -08:00
John MacFarlane 2a44140e11 ConTeXt writer: Use special environment for CSL references. 2019-11-16 17:31:47 -08:00
John MacFarlane 8683cb596d ConTeXt writer: use braces, not start/stop, for inline language tags.
This prevents unwanted gobbling of spaces.
2019-11-16 17:31:47 -08:00
John MacFarlane 5bd6d966f4 Add Ext_smart to list of possible extensions for HTML. 2019-11-16 16:58:10 -08:00
John MacFarlane 1f69162ffd RST writer: Improve spacing for tables with no width information.
If a simple table would be too wide, we use a grid table.
The code for generating grid tables has been adjusted to
give more intelligent column widths when widths aren't
given. (This also affects the markdown writer.)

Closes #5899.
2019-11-15 23:09:53 -08:00
Andrew Dunning 6c1692ea22 LaTeX Reader: Add KOMA-Script metadata commands (#5910)
Add all titling commands to existing definition for `\dedication`.
2019-11-15 08:45:18 -08:00
John MacFarlane bfa6c0b57d Default files: Allow leaving input-files blank again.
Leaving it blank yields a Nothing value (interpreted as stdin).
Providing an empty list is intepreted as no input.

This resolves one part of #5888.
2019-11-14 21:46:35 -08:00
John MacFarlane 81fae63a54 Change optInputFiles to a Maybe [FilePath].
`Nothing` means: nothing specified.
`Just []` means: an empty list specified (e.g. in defaults).
Potentially these could lead to different behavior: see #5888.
2019-11-14 18:42:55 -08:00
John MacFarlane 871bfaf794 Writers.Shared: Clean up code for adding metadata to variables. 2019-11-14 11:01:43 -08:00
John MacFarlane 703cbf437c Markdown reader: use take1WhileP for table row. 2019-11-14 08:10:53 -08:00
John MacFarlane cc5afbb834 Markdown reader: Use take1WhileP for str.
This yields a small but measurable performance improvement.
2019-11-14 07:58:50 -08:00
John MacFarlane db6e9de091 Parsing: Rename takeWhileP -> take1WhileP and clean it up.
(It doesn't match the empty sequence.)
2019-11-14 07:49:32 -08:00
John MacFarlane a60eb60a3d Allow combining -Vheader-includes and --include-in-header.
Closes #5904.
2019-11-14 07:48:19 -08:00
John MacFarlane a1f69b1c7d Fix regression preventing header-includes from being set using -V.
See #5904.
2019-11-14 05:48:20 -08:00
Albert Krewinkel e43c2e75a1 RST writer: fix backslash escaping after strings
The check whether a complex inline element following a string must be
escaped, now depends on the last character of the string instead of the
first.

Fixes: #5906
2019-11-14 14:46:32 +01:00
John MacFarlane 8ff7fd484f Fix regression introduced by last commit. 2019-11-13 22:46:24 -08:00
John MacFarlane 3982b23428 Markdown reader: don't parse footnote body unless extension enabled. 2019-11-13 21:19:06 -08:00
John MacFarlane ec043e0d97 Default files: combine with prior values when appropriate.
Certain command-line arguments can be repeated:
`--metadata-file`, `--css`, `--include-in-header`,
`--include-before-body`, `--include-after-body`, `--variable`,
`--metadata`, `--syntax-definition`.  In these cases, values
specified in default files should be added to the list rather
than replacing values specified earlier on the command line
(perhaps in other default files).

So, for example, if one does

    pandoc --variable foo=3 --defaults d1 --defaults d2

and `d1` sets the variable `bar` and `d2` sets `baz`,
all three variables will be set.

Closes #5894.
2019-11-13 16:51:02 -08:00