Commit graph

8981 commits

Author SHA1 Message Date
Albert Krewinkel
feb1c1a930
Extract lua helper functions into Lua.Util module 2017-04-14 18:26:42 +02:00
Albert Krewinkel
1d9742bb5d
Use lua bools and strings for MetaBool, MetaString
Native lua booleans and strings are used to represent MetaBool and
MetaString values.  This is more natural than the previous table-based
representation.  The old lua representation can still be read back to
haskell, ensuring compatibility with the `pandoc.MetaBool` and
`pandoc.MetaString` lua constructors.
2017-04-14 14:59:17 +02:00
Albert Krewinkel
932e395e53 Merge pull request #3569 from tarleb/lua-destructured-filter-functions
Destructuring lua filter functions
2017-04-14 11:57:30 +02:00
Albert Krewinkel
07f41a5515
Lua filter: use destructured functions for block filters
Filtering functions take element components as arguments instead of the
whole block elements. This resembles the way elements are handled in
custom writers.
2017-04-14 11:34:44 +02:00
Albert Krewinkel
0516b5127c
Drop dependency on hslua-aeson
Pushing values to the lua stack via custom functions is faster and more
flexible.
2017-04-14 11:21:12 +02:00
Albert Krewinkel
540a3e80ad
Push blocks via lua constructors and constants
All element creation tasks are handled by lua functions defined in the
pandoc module.
2017-04-14 10:33:38 +02:00
Alexander Krotov
624ccbd45e s/safed/saved/ 2017-04-14 08:27:56 +02:00
Albert Krewinkel
0085251ec7
Push inlines via lua constructors and constants
All element creation tasks are handled in the lua module.
2017-04-14 00:35:38 +02:00
Albert Krewinkel
425df8fff4
Use lua constructors to push meta values 2017-04-13 22:57:50 +02:00
Albert Krewinkel
00746c3c76
Improve lua module documentation 2017-04-13 19:10:51 +02:00
John MacFarlane
07778ade39 Use lowercase a4 for latex papersize example. 2017-04-12 23:41:31 +02:00
Albert Krewinkel
97dfe782cf
Lua module: provide multi-param Inline constructors
Instead of taking only a single argument containing the pre-packed
element contents, `Inline` constructors now take the same arguments as
the respective filter and `Custom` writer function
2017-04-12 21:21:25 +02:00
Albert Krewinkel
2761a38e53
Lua filter: use destructured functions for inline filters
Instead of taking the whole inline element, forcing users to destructure it
themselves, the components of the elements are passed to the filtering
functions.
2017-04-12 20:48:44 +02:00
John MacFarlane
31a36cf186 Man writer: Fix handling of nested font commands.
Previously pandoc emitted incorrect markup for bold + italic, for example,
or bold + code.

Closes #3568.
2017-04-12 12:23:29 +02:00
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