Commit graph

8825 commits

Author SHA1 Message Date
Albert Krewinkel
c2567b2bd0 API change: move writer functions to Text.Pandoc.Writers
Writer helper functions were defined in the top-level Text.Pandoc
module. These functions are moved to the Writer submodule as to enable
reuse in other submodules.
2017-04-26 23:28:40 +02:00
Albert Krewinkel
0e107a305f API change: move reader functions to Text.Pandoc.Readers
Reader helper functions were defined in the top-level Text.Pandoc
module. These functions are moved to the Readers submodule as to enable
reuse in other submodules.
2017-04-26 23:28:40 +02:00
Albert Krewinkel
3ac23ab615 API change: move extension handling to Text.Pandoc.Extensions
Extension parsing and processing functions were defined in the top-level
Text.Pandoc module.  These functions are moved to the Extensions
submodule as to enable reuse in other submodules.
2017-04-26 23:28:40 +02:00
Albert Krewinkel
9cd20c9b8b Lua filter: allow filtering of meta data only 2017-04-26 23:28:40 +02:00
Albert Krewinkel
5416fb14ab Lua filter: allow natural access to meta elements
Meta elements that are treated as lua tables (i.e. MetaList,
MetaInlines, MetaBlocks, and MetaMap), are no longer wrapped in an
additional table but simply marked via a metatable.  This allows
treating those meta values just like normal tables, while still making
empty elements of those values distinguishable.
2017-04-26 23:28:40 +02:00
schrieveslaach
a29fa15a7b LaTeX reader: Add basic support for hyphenat package (#3603) 2017-04-26 12:05:13 +02:00
Alexander Krotov
256e3a6a5d Simplify linkText in Text.Pandoc.Readers.TWiki (#3605)
Avoid constructing list of one element ([B.str url]) just to flatten it
back with mconcat.
2017-04-26 12:04:28 +02:00
schrieveslaach
81548960d5 LaTeX reader: Add support for \vdots (#3607) 2017-04-26 12:03:07 +02:00
John MacFarlane
66b08391b3 HTML line block: Use class instead of style attribute.
We now issue `<div class="line-block">` and include a
default definition for `line-block` in the default
templates, instead of hard-coding a `style` on the
div.

Closes #1623.
2017-04-25 23:07:30 +02:00
John MacFarlane
ee160d7c4c LaTeX writer: fix error with line breaks after empty content.
LaTeX requires something before a line break, so we insert a
`~` if no printable content has yet been emitted.

Closes #2874.
2017-04-25 15:00:27 +02:00
John MacFarlane
d17f0dab84 LaTeX reader: better support for subfigure package.
A figure with two subfigures turns into two pandoc
figures; the subcaptions are used and the main caption
ignored, unless there are no subcaptions.

Closes #3577.
2017-04-24 23:39:14 +02:00
Alexander Krotov
624e5b2f92 TWiki reader: remove unnecessary $ (#3597) 2017-04-24 10:17:53 +02:00
Albert Krewinkel
04cb602d79
Org reader: allow multi-word arguments to src block params
The reader now correctly parses src block parameter list even if
parameter arguments contain multiple words.

Closes: #3477
2017-04-23 13:58:16 +02:00
Albert Krewinkel
2e43e27e5c
Org reader: stop adding rundoc prefix to src params
Source block parameter names are no longer prefixed with *rundoc*. This
was intended to simplify working with the rundoc project, a babel
runner. However, the rundoc project is unmaintained, and adding those
markers is not the reader's job anyway.

The original language that is specified for a source element is now
retained as the `data-org-language` attribute and only added if it
differs from the translated language.
2017-04-23 12:56:11 +02:00
Albert Krewinkel
04658c491b
Org reader: handle line numbering switch for src blocks
The line-numbering switch that can be given to source blocks (`-n` with
an start number as an optional parameter) is parsed and translated to a
class/key-value combination used by highlighting and other readers and
writers.
2017-04-23 11:54:36 +02:00
John MacFarlane
51a46b7e31 HTML reader: Revise treatment of li with id attribute.
Previously we always added an empty div before the list
item, but this created problems with spacing in tight
lists.  Now we do this:

If the list item contents begin with a Plain block,
we modify the Plain block by adding a Span around
its contents.

Otherwise, we add a Div around the contents of the
list item (instead of adding an empty Div to the
beginning, as before).

Closes #3596.
2017-04-23 11:03:48 +02:00
John MacFarlane
c5f4a0b9c5 Use foundation-0.0.7.
See https://github.com/haskell-foundation/foundation/issues/238
for the bug on Windows with 0.0.6.
2017-04-22 22:17:57 +02:00
schrieveslaach
020dc63e23 Add siunitx Support (#3588)
For example:


```latex
\SI[round-precision=2]{1}{m} is equal to \SI{1000}{mm}.

\SI[round-precision=2]{1}[\$]{} is equal to \SI{0.938094}{\euro}
```
2017-04-22 21:57:21 +02:00
John MacFarlane
b68135d34d Allow aeson 1.2.0.0. 2017-04-22 17:59:13 +02:00
John MacFarlane
e30a25701f Use skylighitng >= 0.3.3. 2017-04-22 11:15:09 +02:00
John MacFarlane
ba27620e4f Use latest skylighting, lts. 2017-04-22 10:54:56 +02:00
Albert Krewinkel
57a0759def
Lua: drop useless filter function type parameter
The return-type parameter for lua filter functions is removed.  It only
complicated the code without introducing any additional type safety.
2017-04-18 19:21:03 +02:00
Albert Krewinkel
464db59394
Org reader: allow emphasized text to be followed by [
Closes: #3577
2017-04-16 21:19:35 +02:00
schrieveslaach
1c8683f205 Read image size of Inkscape SVGs (#3580) 2017-04-16 19:39:24 +02:00
Albert Krewinkel
56dddcc3f5
Org reader: convert markup at beginning of footnotes
Closes: #3576
2017-04-16 17:22:47 +02:00
Albert Krewinkel
e6a536befc
Lua filter: revert to non-destructuring filters
We want to provide an interface familiar to users of other filtering
libraries.
2017-04-15 21:40:48 +02:00
Albert Krewinkel
291e4f39e8
Lua module: provide accessors to element properties 2017-04-15 21:36:39 +02:00
John MacFarlane
629c6494a5 Small fix to error reporting in App.
Closes #3548.
2017-04-15 13:46:46 +02:00
John MacFarlane
bcc848d773 Avoid parsing "Notes:**" as a bare URI.
This avoids parsing bare URIs that start with a scheme
+ colon + `*`, `_`, or `]`.

Closes #3570.
2017-04-15 13:32:28 +02:00
John MacFarlane
1fe1c162ac Error: Added PandocCouldNotFindDataFileError.
Use this instead of PandocAppError when appropriate.
Removed exit code from PandocAppError, use 1 for all.
2017-04-15 12:05:58 +02:00
John MacFarlane
76b051f7b4 Fixed shadowing warnings 2017-04-15 11:59:48 +02:00
John MacFarlane
8e0032940f Docx reader: removed readDocxWithWarnings (API change).
No longer necessary with pandoc 2.0 framework.
2017-04-15 11:53:46 +02:00
John MacFarlane
35e9da28b8 App: use PandocOptionError instead of PandocAppError where appropriate. 2017-04-15 11:53:45 +02:00
John MacFarlane
d722d93b61 Error: Added PandocFilterError. 2017-04-15 11:53:45 +02:00
John MacFarlane
306dc624d9 Error: Added PandocPDFError 2017-04-15 11:53:45 +02:00
John MacFarlane
d5701e625c Text.Pandoc.Error: added new constructors.
- PandocSyntaxMapError String
- PandocFailOnWarningError
- PandocPDFProgramNotFoundError String
2017-04-15 11:53:45 +02:00
John MacFarlane
dd4110fb09 Revised error message for pandoc -t pdf. 2017-04-15 11:53:45 +02:00
Albert Krewinkel
3d6edbd9e3
Lua filter: use Attributes constructor for Attrs
Element attributes are pushed to the stack via the `Attributes`
function. `Attributes` creates an Attr like triple, but the triple also
allows table-like access to key-value pairs.
2017-04-15 09:31:09 +02:00
Albert Krewinkel
ac275528c2
Lua module: fix doc generation, reorder code
Ensure that documentation generated with `ldoc` is readable and correct.
2017-04-15 00:12:51 +02:00
Albert Krewinkel
8c2e6a66b9
Lua module: provide builder functions for math and quoted
Provide functions `pandoc.SingleQuoted`, `pandoc.DoubleQuoted`,
`pandoc.DisplayMath`, and `pandoc.InlineMath` to allow simple building
of Math and Quoted elements.
2017-04-15 00:10:33 +02:00
Albert Krewinkel
3aeed816e1
Lua filter: allow shorthand functions for math and quoted
Allow to use functions named `SingleQuoted`, `DoubleQuoted`,
`DisplayMath`, and `InlineMath` in filters.
2017-04-14 23:43:59 +02:00
Albert Krewinkel
eb8de6514b
Lua filter: Re-order code of stack value instances 2017-04-14 22:58:00 +02:00
Albert Krewinkel
d671b69b87
Lua filter: use lua strings for nullary constructors
Lua string are used to represent nullary data constructors. The previous
table-based representation was based on the JSON serialization, but can
be simplified. This also matches the way those arguments are passed to
custom writers.
2017-04-14 22:32:08 +02:00
Albert Krewinkel
0add4253e6
Avoid repeating StackValue instances definitions
The lua filters and custom lua writer system defined very similar
StackValue instances for strings and tuples.  These instance definitions
are extracted to a separate module to enable sharing.
2017-04-14 19:07:55 +02:00
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