Age | Commit message (Collapse) | Author | Files | Lines |
|
Newly exported from Text.Pandoc.Lua:
- `runFilterFile` to run a Lua filter from file;
- data type `Global` and its constructors; and
- `setGlobals` to add globals to a Lua environment.
This module also contains `Pushable` and `Peekable` instances required
to get pandoc's data types to and from Lua. Low-level Lua operation
remain hidden in Text.Pandoc.Lua.
|
|
|
|
|
|
Custom writers have access to the global variable `PANDOC_DOCUMENT`. The
variable contains a userdata wrapper around the full pandoc AST and
exposes two fields, `meta` and `blocks`. The field content is only
marshaled on-demand, performance of scripts not accessing the fields
remains unaffected.
|
|
Custom writers can specify an optional `Setup` function. The function
takes the full Pandoc document as input and should not return any value.
Users can use this function to configure the writer depending on the
given document's content or its metadata.
data/sample.lua: add sample use of Setup function.
The change allows to control the image format used to encode the image
produced from dot code.
Closes #4957
|
|
A proper Lua traceback is added if either loading of a file or execution
of a filter function fails. This should be of help to authors of Lua
filters who need to debug their code.
|
|
|
|
|
|
Error messages produced by Lua were not displayed by Pandoc. The writer
was using the bottom-most stack element, while the error message is the
top-most element. This lead to the writer to always show "Lua 5.3" as
error message, disregarding the actual message.
|
|
This seems to be necessary if we are to use our custom Prelude
with ghci.
Closes #4464.
|
|
The name of the Lua script which is executed is made available in the
global Lua variable `PANDOC_SCRIPT_FILE`, both for Lua filters and
custom writers.
Closes: #4393
|
|
|
|
Pairs where serialized as two-element lists instead, and are now pushed
again as a table with a single key/value pair.
Fixes: #4202
|
|
An additional `Lua.call` was left in during refactoring, which caused an
exception "attempt to call a nil value".
Fixes: #4202
|
|
The same init file (`data/init`) that is used to setup the Lua
interpreter for Lua filters is also used to setup the interpreter of
custom writers.lua.
|
|
The custom writer used its own `ToLuaStack` instance definitions, which
made it difficult to share code with Lua filters, as this could result
in conflicting instances. A `Stringify` wrapper is introduced to avoid
this problem.
|
|
|
|
|
|
hslua no longer provides lua stack instances for Int and Double, the
necessary instances are added to the Custom writer and the lua filtering
system.
|
|
Stack instances for common data types are now provides by hslua. The
instance for Either was useful only for a very specific case; the
function that was using the `ToLuaStack Either` instance was rewritten
to work without it.
Closes: #3805
|
|
|
|
Now we raise a proper error on template failure.
|
|
* 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.
|
|
This follows the suggestions given by the FSF for GPL licensed software.
<https://www.gnu.org/prep/maintain/html_node/Copyright-Notices.html>
|
|
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.
|
|
|
|
The minimum required hslua version is 0.4.0, the conditionals inserted
to support hslua-0.3.* can hence be removed.
|
|
The 0.5.0 release of hslua fixes problems with lua C modules on linux.
The signature of the `loadstring` function changed, so a compatibility
wrapper is introduced to allow both 0.4.* and 0.5.* versions to be used.
|
|
|
|
Previously setting writerStandalone = True did nothing unless
a template was provided in writerTemplate. Now a fragment
will be generated if writerTemplate is Nothing; otherwise,
the specified template will be used and standalone output
generated. [API change]
|
|
The following markup features are used to output the lines of the `LineBlock`
element:
- AsciiDoc: a `[verse]` block,
- ConTeXt: text surrounded by `\startlines` and `\endlines`,
- HTML: `div` with an per-element style setting to interpret the content as
pre-wrapped,
- Markdown: line blocks if the `line_blocks` extension is enabled, a simple
paragraph with hard linebreaks otherwise,
- Org: VERSE block,
- RST: a line block, and
- all other formats: a paragraph, containing hard linebreaks between lines.
Custom lua writers should be updated to use the `LineBlock` element.
|
|
Closes #2697.
|
|
Added threefold wrapping option.
* Command line option: deprecated `--no-wrap`, added
`--wrap=[auto|none|preserve]`
* Added WrapOption, exported from Text.Pandoc.Options
* Changed type of writerWrapText in WriterOptions from
Bool to WrapOption.
* Modified Text.Pandoc.Shared functions for SoftBreak.
* Supported SoftBreak in writers.
* Updated tests.
* Updated README.
Closes #1701.
|
|
mb21-new-image-attributes
* Bumped version to 1.16.
* Added Attr field to Link and Image.
* Added `common_link_attributes` extension.
* Updated readers for link attributes.
* Updated writers for link attributes.
* Updated tests
* Updated stack.yaml to build against unreleased versions of
pandoc-types and texmath.
* Fixed various compiler warnings.
Closes #261.
TODO:
* Relative (percentage) image widths in docx writer.
* ODT/OpenDocument writer (untested, same issue about percentage widths).
* Update pandoc-citeproc.
|
|
This reverts commit c423dbb5a34c2d1195020e0f0ca3aae883d0749b.
|
|
This is needed for ghci to work with pandoc, given that we
now use a custom prelude.
Closes #2503.
|
|
- The (non-exported) prelude is in prelude/Prelude.hs.
- It exports Monoid and Applicative, like base 4.8 prelude,
but works with older base versions.
- It exports (<>) for mappend.
- It hides 'catch' on older base versions.
This allows us to remove many imports of Data.Monoid
and Control.Applicative, and remove Text.Pandoc.Compat.Monoid.
It should allow us to use -Wall again for ghc 7.10.
|
|
|
|
(mb21)
|
|
|
|
|
|
|
|
Custom Writer: Set foreign encoding to UTF-8
|
|
|
|
Closes #2101, #1634
Also factored out ByteString, since it's only used as an intermediate
representation.
|
|
This might help with #2101.
|
|
Eventually we'll change the return type so that no exception
is involved, but at least this can be trapped.
|
|
This will make debugging custom scripts much easier.
|
|
|
|
Removed HTML header scaffolding from data/sample.lua.
|