Commit graph

9073 commits

Author SHA1 Message Date
John MacFarlane
379b99f63a Added writerEpubSubdirectory to WriterOptions.
[API change]

The EPUB writer now takes its EPUB subdirectory from this option.

Also added `PandocEpubSubdirectoryError` to `PandocError`.
This is raised if the EPUB subdirectory is not all ASCII
alphanumerics.

See #3720.
2017-06-22 11:43:50 +02:00
John MacFarlane
242e2a064f Change default EPUB directory structure in OCF container.
See #3720.
We now put all EPUB related content in an EPUB/ subdirectory
by default (later this will be configurable).

    mimetype
    META-INF/
      com.apple.ibooks.display-options.xml
      container.xml
    EPUB/ <<--configurable-->>
      fonts/ <<--static-->>
      font.otf
    media/ <<--static-->>
      cover.jpg
      fig1.jpg
    styles/ <<--static-->>
      stylesheet.css
    content.opf
    toc.ncx
    text/ <<--static-->>
      ch001.xhtml
2017-06-21 23:54:16 +02:00
John MacFarlane
6e6324bade Removed an 'error' bomb. 2017-06-20 22:44:09 +02:00
John MacFarlane
c349f0b0ba Writers: adjusted for renderTemplate' changes.
Now we raise a proper error on template failure.
2017-06-20 22:43:48 +02:00
John MacFarlane
21c4281b13 Odt reader: replaced collectRights with rights from Data.Either. 2017-06-20 22:43:06 +02:00
John MacFarlane
c0a1286025 Text.Pandoc.Templates: change type of renderTemplate'.
Now it runs in PandocMonad and raises a proper
PandocTemplateError if there are problems, rather
than failing with uncatchable 'error'.
2017-06-20 22:41:56 +02:00
John MacFarlane
8f8f505fd4 Text.Pandoc.Error: added PandocTemplateError. 2017-06-20 22:41:34 +02:00
John MacFarlane
2363e6a15b Move CR filtering from tabFilter to the readers.
The readers previously assumed that CRs had been filtered
from the input.  Now we strip the CRs in the readers themselves,
before parsing.  (The point of this is just to simplify the
parsers.)

Shared now exports a new function `crFilter`. [API change]
And `tabFilter` no longer filters CRs.
2017-06-20 21:52:13 +02:00
John MacFarlane
4ba5ef46ae Updated code example. 2017-06-20 21:25:39 +02:00
John MacFarlane
5ec84bfeb4 Text.Pandoc.Lua - added DeriveDataTypeable for ghc 7.8. 2017-06-20 21:11:21 +02:00
Albert Krewinkel
f4c12606e1
Lua: use registry to store function references
Using the registry directly instead of a custom table is cleaner and
more efficient. The performance improvement is especially noticable when
filtering on frequent elements like Str.
2017-06-20 20:51:10 +02:00
Albert Krewinkel
bd5a7e5258
Lua: apply hslint suggestions 2017-06-20 19:20:50 +02:00
John MacFarlane
9ac0a99292 Added mention of vimwiki raeder more places. 2017-06-20 16:57:39 +02:00
John MacFarlane
429c4620df Removed redundant import. 2017-06-20 16:44:05 +02:00
John MacFarlane
32f86067ec App: issue proper errors instead of using 'error'. 2017-06-20 16:19:59 +02:00
John MacFarlane
b78afbd980 Text.Pandoc.Lua: throw LuaException instead of using 'error'.
Text.Pandoc.App: trap LuaException and issue a PandocFilterError.
2017-06-20 16:19:59 +02:00
Alexander Krotov
2192528424 Muse reader: check that headers start at the first column (#3749) 2017-06-20 14:48:00 +02:00
John MacFarlane
ea1724e35e Docbook, JATS, TEI writers: print INFO message when omitting interior header.
This only applies to section headers inside list items, e.g.,
which were otherwise silently omitted.

See #3750.
2017-06-20 14:22:19 +02:00
John MacFarlane
b26d3c4522 FB2 writer: don't fail with an error on interior headers (e.g. in list).
Instead, omit them with an INFO message.

Closes #3750.
2017-06-20 14:21:43 +02:00
John MacFarlane
6a077ac9c7 Fixed footnotes in table captions.
Note that if the table has a first page header and a
continuation page header, the notes will appear only
on the first occurrence of the header.

Closes #2378.
2017-06-20 11:21:32 +02:00
John MacFarlane
8af1c065d2 latex template: fix typo in fix for notes in tables.
See 1475299c9a (diff-c7c27b8e99f898fde7715afd9ae8cd02R126)

However, this is not a complete fix:
https://github.com/jgm/pandoc-templates/pull/208#issuecomment-309631622

Thanks to zeeMonkeez.  See #2378.
2017-06-20 10:24:35 +02:00
John MacFarlane
710bb18443 Fixed name shadowing in benchmark. 2017-06-19 23:42:27 +02:00
John MacFarlane
328655e863 Tracing: give less misleading line information with parseWithString.
Previously positions would be reported past the end of the chunk.
We now reset the source position within the chunk and report
positions "in chunk."
2017-06-19 22:41:09 +02:00
John MacFarlane
b6a38ed111 Vimwiki reader: adjusted for changes in trace. 2017-06-19 22:29:01 +02:00
John MacFarlane
814ac51d32 Separated tracing from logging.
Formerly tracing was just log messages with a DEBUG log
level.  We now make these things independent.  Tracing
can be turned on or off in PandocMonad using `setTrace`;
it is independent of logging.

* Removed `DEBUG` from `Verbosity`.
* Removed `ParserTrace` from `LogMessage`.
* Added `trace`, `setTrace` to `PandocMonad`.
2017-06-19 22:17:43 +02:00
Alexander Krotov
4929d027dc Muse reader: fix list item continuation parsing (#3747) 2017-06-19 22:16:21 +02:00
Yuchen Pei
564c77964d Added Vimwiki reader (#3705).
* New module Text.Pandoc.Readers.Vimwiki, exporting readVimwiki [API change].
* New input format `vimwiki`.
* New data file, `data/vimwiki.css`, for displaying the HTML produced by this reader and pandoc's HTML writer in the style of vimwiki's own HTML export.
2017-06-19 22:15:12 +02:00
John MacFarlane
b3041de2fc Text.Pandoc.Writers.Math: export defaultMathJaxURL, defaultKaTeXURL.
This will ensure that we only need to update these in one place.
(Currently, for example, the mathjax URL is used in both
App and trypandoc.)

Closes #3685.
2017-06-19 11:10:29 +02:00
John MacFarlane
aface549a0 Mention muse reader in README, MANUAL, debian control, cabal description. 2017-06-19 10:50:59 +02:00
Alexander Krotov
a91b9b2a1d Add Muse reader (#3620) 2017-06-19 10:46:02 +02:00
Alexander Krotov
10e3ce361f Mention Muse writer in MANUAL.txt (#3744) 2017-06-19 09:38:47 +02:00
John MacFarlane
ec3992b2f0 Use revealjs's math plugin for mathjax.
This is a thin wrapper around mathjax that makes math look better
on revealjs.

See https://github.com/hakimel/reveal.js/#mathjax

We do this by setting the 'mathjax' boolean variable and
using it in the revealjs template. Also, for revealjs
and mathjax, we don't assign the usual thing to the 'math'
variable, since it's handled by mathjax config.

Closes #3743.
2017-06-18 11:44:21 +02:00
John MacFarlane
abd2e94f5a In producing PDFs, warn if the font is missing some characters.
* Added `MissingCharacter` to `LogMessage` in Text.Pandoc.Logging.
* Parse the (xe)latex log for missing character warnings and issue
  the warning.

Closes #3742.
2017-06-18 11:17:00 +02:00
John MacFarlane
6166655b52 Allow QuickCheck 2.10 2017-06-17 23:58:12 +02:00
Bartosz Nitka
ec01d26a1b Relax time and process in preparation for GHC 8.2 (#3739)
GHC 8.2 is very likely to ship with process-1.6.0.0
and time-1.8.0.1.

Consult:
https://ghc.haskell.org/trac/ghc/wiki/Commentary/Libraries/VersionHistory
2017-06-17 23:48:01 +02:00
John MacFarlane
9849ba7fd7 Use Control.Monad.State.Strict throughout.
This gives 20-30% speedup and reduction of memory
usage in most of the writers.
2017-06-17 07:45:28 +02:00
John MacFarlane
23f3c2d7b4 Changed "extracting..." warning to a regular log message.
This makes it sensitive to proper verbosity settings.
(It is now treated as INFO rather than WARNING, so one
doesn't get these messages for creation of tmp images
while making a pdf.)

API changes:

* Removed extractMediaBag from Text.Pandoc.MediaBag.
* Added Extracting as constructor for LogMessage.
2017-06-12 15:28:39 +02:00
John MacFarlane
8a000e3ecc Markdown writer: don't allow soft break in header.
Closes #3736.
2017-06-12 09:23:30 +02:00
John MacFarlane
b466152d61 Don't allow backslash + newline to affect block structure.
Note that as a result of this change, the following,
which formerly produced a header with two lines separated
by a line break, will now produce a header followed by a
paragraph:

    # Hi\
    there

This may affect some existing documents that relied on
this undocumented and unintended behavior.

This change makes pandoc more consistent with other
Markdown implementations, and with itself (since the two-space
version of a line break doesn't work inside ATX headers, and
neither version works inside Setext headers).

Closes #3730.
2017-06-11 22:24:20 +02:00
John MacFarlane
d1da54a4c3 Properly decode source from stdin.
This should fix the appveyor failures.
2017-06-11 21:22:44 +02:00
John MacFarlane
f5d2d77ed9 Revert "Command tests: small change to try to fix appveyor failures."
This reverts commit 0ab26ac9eb.

Failed experiment.
2017-06-11 21:18:42 +02:00
John MacFarlane
49b738de4e Rewrote HTML reader to use Text throughout.
- Export new NamedTag class from HTML reader.
- Effect on memory usage is modest (< 10%).
2017-06-11 21:15:58 +02:00
John MacFarlane
0ab26ac9eb Command tests: small change to try to fix appveyor failures. 2017-06-11 11:52:53 +02:00
John MacFarlane
850105e8db stack.pkg.yaml - update pandoc-citeproc commit. 2017-06-11 08:08:07 +02:00
schrieveslaach
f36de77a25 Support for \faCheck and \faClose (#3727) 2017-06-11 07:47:42 +02:00
John MacFarlane
49830555fa Removed redundant import. 2017-06-11 07:45:35 +02:00
John MacFarlane
fa719d0264 Switched Writer types to use Text.
* XML.toEntities: changed type to Text -> Text.
* Shared.tabFilter -- fixed so it strips out CRs as before.
* Modified writers to take Text.
* Updated tests, benchmarks, trypandoc.

[API change]

Closes #3731.
2017-06-11 00:46:31 +02:00
John MacFarlane
0c2a509dfb Writers.Shared: metaToJSON, generalized type so it can take a Text.
Previously a String was needed as argument; now any ToJSON
instance will do.

API change.
2017-06-10 23:10:33 +02:00
John MacFarlane
e8cc9faa41 Writers: changed StringWriter -> TextWriter. 2017-06-10 21:54:26 +02:00
John MacFarlane
86282d6560 Fixed trypandoc to work with new API. 2017-06-10 21:38:08 +02:00