Commit graph

8767 commits

Author SHA1 Message Date
Albert Krewinkel
7e3705c1c4
Lua filter: use custom StackValue Inline instance
Inline elements are no longer pushed and pulled via aeson's Value.
2017-04-11 23:31:55 +02:00
John MacFarlane
d4e5fe02b0 Docx writer: don't take "distArchive" from datadir.
The docx writer takes components from the distribution's
version of reference.docx when it can't find them in a
user's custom reference.docx.  (This sometimes happens
because Word will sometimes omit components needed for larger
documents when saving a simple one.)

Previously, we allowed a reference.docx in the data directory
(e.g. `~/.pandoc`) to be used as the distribution's reference.docx.
This led to a bizarre situation where pandoc would produce a
good docx using `--template ~/.pandoc/ref.docx`, but if `ref.docx`
were moved to `~/.pandoc/reference.docx`, it would then produce
a corrupted docx.

Closes #3322 (I think).
2017-04-10 23:59:32 +02:00
Alexander Krotov
9ac9e8d278 stack.yaml: update foundation to 0.0.6 (#3565)
foundation-0.0.4 from lts-8.8 does not build on FreeBSD
2017-04-09 18:19:33 +02:00
John MacFarlane
1778f23292 Use stack lts-8.8.
This gives us a newer verison of executable-path, which we need
for FreeBSD.
2017-04-09 10:16:55 +02:00
Sam Kim
7fe37d0b79 Fixed a typo (#3562) 2017-04-07 22:23:29 +02:00
Albert Krewinkel
41ebdee5df
Lua filter: improve doc filter performance
Pandoc elements are pushed and pulled from the lua stack via custom
instances.
2017-04-07 21:04:22 +02:00
Albert Krewinkel
d412c38c71
Ensure correctness of StackValue instances 2017-04-06 21:00:38 +02:00
Albert Krewinkel
9278a6325d
Lua filter: Improve block filter performance
Reading of simple block values from the lua stack is handled manually,
but most block constructors are still handled via instances of aeson's
Value type.
2017-04-06 19:32:21 +02:00
Albert Krewinkel
dd00163a35 Lua filter: Improve inline filter performance
Getting inline instances from the lua stack is handled manually for some
simple inline constructors, including the `Str` constructor. This avoids
the indirect route through aeson's Value type and improves performance
considerably (approx. 30% speedup for some filters).
2017-04-06 19:25:42 +02:00
Albert Krewinkel
fca93efb62
Use lua registry instead of named globals
This is slightly cleaner while keeping performance approximately the
same.
2017-04-04 21:51:51 +02:00
John MacFarlane
6b0d3d1582 Ms writer: wider indents for lists.
Previously some indents weren't wide enough, leading
the list item to start on a line after the marker.
2017-04-06 12:45:23 +02:00
John MacFarlane
12ae1df5bf Allow raw latex commands starting with \start in Markdown.
Previously these weren't allowed because they were interpreted
as starting ConTeXt environments, even without a corresponding
\stop...

Closes #3558.
2017-04-06 11:30:03 +02:00
John MacFarlane
12a3481632 Ms writer: respect text wrapping options. 2017-04-05 15:17:35 +02:00
John MacFarlane
48729f9715 Ms writer improvements:
- added some variables to the default template.
- cleaner output for images (stringify alt text).
2017-04-04 17:21:02 +02:00
John MacFarlane
65b692b413 Small fixes to ms template. 2017-04-04 16:19:53 +02:00
John MacFarlane
1ebb766aff Ms writer: ensure that @ is escaped in URIs.
Otherwise we may get unescaped @s that give eqn fits,
with @ as the delimiter character.
2017-04-04 16:13:24 +02:00
John MacFarlane
e650d1fbfd Error: Added PandocOptionError. 2017-04-04 14:35:00 +02:00
Timm Albers
f1eb3b3169 Add original classes to JS obfuscated links (#3554)
HTML links containing classes originally now preserve them when using
javascript email obfuscation.

Fixes #2989
2017-04-04 10:36:00 +02:00
John MacFarlane
7410d259c2 Merge pull request #3556 from nunull/issue1831_footnoteBackRefs
Add class to footnote back references
2017-04-04 10:34:16 +02:00
Timm Albers
3e817124fe Add class to footnote back references
The HTML writer now also adds the class footnoteBack to back references
of footnotes. This allows for easier CSS styling.
2017-04-03 17:02:16 +02:00
John MacFarlane
13cee8c32f Merge pull request #3553 from nunull/master
Include \VerbatimFootnotes for highlighted code blocks
2017-04-03 16:15:27 +02:00
Timm Albers
6e2019d588 Include \VerbatimFootnotes for highlighted code blocks
Updated the LaTeX writer to also include \VerbatimFootnotes in the
preamble for highlighted code blocks. Previously this was only done for
raw code blocks.
2017-04-03 14:36:36 +02:00
John MacFarlane
e3e52aa4c1 Removed unused import. 2017-04-03 10:20:51 +02:00
John MacFarlane
7daea9d8c1 Removed unused imports from Setup.hs. 2017-04-03 09:50:44 +02:00
John MacFarlane
e62fbc1c3c Merge pull request #3550 from tarleb/lua-readers-submodule
Lua module: add readers submodule
2017-04-03 09:47:16 +02:00
John MacFarlane
e281a7cda0 Make sure docx/_rels/.rels gets into data files.
embedDir in file-embed excludes hidden files, so we need
to add this manually.
2017-04-02 23:29:58 +02:00
John MacFarlane
b474a23296 MANUAL: document highlighting support in ms. 2017-04-02 23:10:42 +02:00
John MacFarlane
ff991d1e21 Revert "Revert "Use file-embed instead of hsb2hs to embed data files.""
This reverts commit 1fa15c225b.
2017-04-02 23:10:10 +02:00
John MacFarlane
913db947a9 Text.Pandoc.App: Throw errors rather than exiting.
These are caught (and lead to exit) in pandoc.hs, but
other uses of Text.Pandoc.App may want to recover in another
way.

Added PandocAppError to PandocError (API change).
This is a stopgap:  later we should have a separate constructor
for each type of error.

Also fixed uses of 'exit' in Shared.readDataFile, and
removed 'err' from Shared (API change).

Finally, removed the dependency on extensible-exceptions.

See #3548.
2017-04-02 23:04:48 +02:00
Albert Krewinkel
e7eb21ecca
Lua module: add readers submodule
Plain text readers are exposed to lua scripts via the `pandoc.reader`
submodule, which is further subdivided by format.  Converting e.g. a
markdown string into a pandoc document is possible from within lua:

    doc = pandoc.reader.markdown.read_doc("Hello, World!")

A `read_block` convenience function is provided for all formats,
although it will still parse the whole string but return only the first
block as the result.

Custom reader options are not supported yet, default options are used
for all parsing operations.
2017-04-02 17:28:07 +02:00
John MacFarlane
9e78a9d26b Added data/default.theme to repository. 2017-04-01 22:59:10 +02:00
John MacFarlane
420e3eb26e Allow a theme file as argument to --highlight-style.
Also include a sample, `default.theme`, in `data/`.
2017-04-01 22:27:00 +02:00
John MacFarlane
1c84a03509 Ms writer: added syntax highlighting.
Closes #3547.

Macro definitions are inserted in the template when there is highlighted
code.

Limitations: background colors and underline currently not
supported.
2017-04-01 22:05:38 +02:00
John MacFarlane
1c7f4e97e2 Use latest skylighting.
This means we no longer need language.dtd when loading
custom highlighting definitions.

See #3334.
2017-04-01 12:54:26 +02:00
John MacFarlane
34b9bee5a4 OpenDocument writer: wider labels for lists.
This avoids overly narrow labels for ordered lists with
() delimiters.

However, arguably it creates overly wide labels for bullets.

Also, lists now start flush with the margin, rather than
indented.

Fixes #2421.
2017-04-01 12:27:40 +02:00
John MacFarlane
8761d57750 Change MathJax CDN default since old one is shutting down.
New URL: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js
Announcement: https://www.mathjax.org/cdn-shutting-down/

NOTE:  The new URL requires a version number, which we'll have
to update manually in subsequent pandoc releases in order to
take advantage of mathjax improvements.

Closes #3544.
2017-04-01 11:05:12 +02:00
John MacFarlane
80c3c93273 JATS writer: don't include jats.csl in metadata if csl already specified. 2017-03-31 15:15:49 +02:00
John MacFarlane
8a3ef99882 JATS template: always include <back> element even if empty. 2017-03-31 15:15:34 +02:00
John MacFarlane
3217bc192e JATS writer: put references in <back>.
Modified template to include a `<back>` and `<body>` section.
This should give authors more flexibility, e.g. to put
acknowledgements metadata in `<back>`.  References are
automatically extracted and put into `<back>`.
2017-03-31 11:07:09 +02:00
John MacFarlane
136a53edc8 Fix compiler warning. 2017-03-30 23:03:57 +02:00
John MacFarlane
48039a1d80 Add JATS to description in pandoc.cabal. 2017-03-30 23:00:12 +02:00
John MacFarlane
560cfadb92 jats template: added xml-stylesheet variable. 2017-03-30 22:49:22 +02:00
John MacFarlane
80d093843b Allow dynamic loading of syntax definitions.
See #3334.

* Add writerSyntaxMap to WriterOptions.
* Highlighting: added parameter for SyntaxMap to highlight.
* Implemented --syntax-definition option.

TODO:

[ ] Figure out whether we want to have the xml parsing
    depend on the dtd (it currently does, and fails unless
    the language.dtd is found in the same directory).
[ ] Add an option to read a KDE syntax highlighting theme
    as a custom style.
[ ] Add tests.
2017-03-30 22:36:36 +02:00
John MacFarlane
ea84cd0842 ZimWiki writer: put in PandocMonad, added warnings for raw. 2017-03-30 21:43:22 +02:00
John MacFarlane
d8a3228617 Textile writer: moved into PandocMonad.
Warnings for omitted raw content.
2017-03-30 21:37:13 +02:00
John MacFarlane
b27836666f Org writer: move everything into PandocMonad. 2017-03-30 21:31:43 +02:00
John MacFarlane
8d50f37d53 Don't read jats.csl unless we actually need it. 2017-03-30 17:23:16 +02:00
John MacFarlane
6ad486c3c3 Automatically include URI-encoded jats.csl for jats output.
This way people can do

    pandoc -s -t jats --filter pandoc-citeproc

and it will just work.  If they want to specify a stylesheet,
they still can.
2017-03-30 16:43:17 +02:00
John MacFarlane
2f19b5daac SelfContained: export makeDataURI 2017-03-30 16:43:12 +02:00
John MacFarlane
e5e2a6e0a5 JATS writer: use both tex and mml alternatives for math when possible. 2017-03-30 16:22:54 +02:00