aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/Custom.hs
AgeCommit message (Collapse)AuthorFilesLines
2018-02-24Lua: register script name in global variableAlbert Krewinkel1-1/+2
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
2018-01-05Update copyright notices to include 2018Albert Krewinkel1-2/+2
2017-12-27Fix regression of DefinitionLists in custom writerAlbert Krewinkel1-1/+11
Pairs where serialized as two-element lists instead, and are now pushed again as a table with a single key/value pair. Fixes: #4202
2017-12-27Fix custom writer regressionAlbert Krewinkel1-2/+1
An additional `Lua.call` was left in during refactoring, which caused an exception "attempt to call a nil value". Fixes: #4202
2017-12-13Custom writer: use init file to setup Lua interpreterAlbert Krewinkel1-11/+12
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.
2017-12-13Custom writer: define instances for newtype wrapperAlbert Krewinkel1-69/+57
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.
2017-10-29hlint suggestions.John MacFarlane1-1/+1
2017-10-27Automatic reformating by stylish-haskell.John MacFarlane1-3/+3
2017-08-16Update to hslua-0.8.0Albert Krewinkel1-0/+6
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.
2017-08-13Delete Text.Pandoc.Lua.SharedInstancesAlbert Krewinkel1-1/+0
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
2017-08-13Use hslua >= 0.7, update Lua codeAlbert Krewinkel1-128/+109
2017-06-20Writers: adjusted for renderTemplate' changes.John MacFarlane1-2/+5
Now we raise a proper error on template failure.
2017-06-11Switched Writer types to use Text.John MacFarlane1-3/+5
* 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-05-13Update dates in copyright noticesAlbert Krewinkel1-2/+2
This follows the suggestions given by the FSF for GPL licensed software. <https://www.gnu.org/prep/maintain/html_node/Copyright-Notices.html>
2017-04-14Avoid repeating StackValue instances definitionsAlbert Krewinkel1-30/+1
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-14Extract lua helper functions into Lua.Util moduleAlbert Krewinkel1-10/+7
2017-03-28Custom writer: remove old preprocesesor conditionalsAlbert Krewinkel1-36/+0
The minimum required hslua version is 0.4.0, the conditionals inserted to support hslua-0.3.* can hence be removed.
2017-03-24Ensure compatibility with hslua 0.5.*Albert Krewinkel1-1/+2
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.
2017-03-04Stylish-haskell automatic formatting changes.John MacFarlane1-22/+25
2016-11-30Options: Removed writerStandalone, made writerTemplate a Maybe.John MacFarlane1-5/+3
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]
2016-10-13Add support for the LineBlock element to writersAlbert Krewinkel1-0/+2
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.
2016-02-05Custom writer: Pass attributes parameter to CaptionedImage.John MacFarlane1-2/+2
Closes #2697.
2015-12-11Implemented SoftBreak and new `--wrap` option.John MacFarlane1-4/+6
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.
2015-11-19Merge branch 'new-image-attributes' of https://github.com/mb21/pandoc into ↵John MacFarlane1-3/+3
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.
2015-11-09Revert "Use -XNoImplicitPrelude and 'import Prelude' explicitly."John MacFarlane1-1/+0
This reverts commit c423dbb5a34c2d1195020e0f0ca3aae883d0749b.
2015-11-08Use -XNoImplicitPrelude and 'import Prelude' explicitly.John MacFarlane1-0/+1
This is needed for ghci to work with pandoc, given that we now use a custom prelude. Closes #2503.
2015-10-14Use custom Prelude to avoid compiler warnings.John MacFarlane1-1/+0
- 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.
2015-08-07Updated readers, writers and README for link attributemb211-1/+1
2015-08-07Updated readers and writers for new image attribute parameter.John MacFarlane1-2/+2
(mb21)
2015-05-31Custom writer: fixed some compiler warnings for ghc < 7.10.John MacFarlane1-12/+17
2015-05-31Allow building with hslua 0.4.John MacFarlane1-0/+20
2015-05-05Deal with deprecation warning in Custom.John MacFarlane1-2/+10
2015-04-26Merge pull request #2112 from lierdakil/issue2101John MacFarlane1-33/+29
Custom Writer: Set foreign encoding to UTF-8
2015-04-26Updated copyright notices to -2015. Closes #2111.John MacFarlane1-2/+2
2015-04-26Custom Writer: Set foreign encoding to UTF-8Nikolay Yakimov1-33/+29
Closes #2101, #1634 Also factored out ByteString, since it's only used as an intermediate representation.
2015-04-21Custom writer: use UTF-8 aware bytestring conversion.John MacFarlane1-7/+8
This might help with #2101.
2015-01-18Custom writer: Raise `PandocLuaException` instead of using 'error'.John MacFarlane1-2/+9
Eventually we'll change the return type so that no exception is involved, but at least this can be trapped.
2015-01-18Custom writer: raise error if loadstring returns an error status.John MacFarlane1-1/+6
This will make debugging custom scripts much easier.
2014-07-16Remove unused import.John MacFarlane1-1/+0
2014-07-16Custom writers now work with `--template`.John MacFarlane1-2/+14
Removed HTML header scaffolding from data/sample.lua.
2014-07-16Made Citation information available in lua custom writer.John MacFarlane1-2/+17
2014-05-09Update copyright notices for 2014, add missing noticesAlbert Krewinkel1-2/+2
2014-04-04Correctly handle UTF-8 in custom lua scripts. Closes #1189.John MacFarlane1-2/+1
2014-04-04Custom writer: read lua script as UTF-8.John MacFarlane1-1/+2
This should fix #1189.
2013-08-10Adjustments for new Format newtype.John MacFarlane1-0/+6
2013-08-08Preliminary support for new Div and Span elements in writers.John MacFarlane1-0/+5
Currently these are "transparent" containers, except in HTML, where they produce div and span elements with attributes.
2013-08-06Added support for MetaBool.John MacFarlane1-0/+2
2013-06-27Custom writer: Pass full metadata, not just tit/auth/date.John MacFarlane1-5/+15
2013-06-24Use new flexible metadata type.John MacFarlane1-4/+4
* Depend on pandoc 1.12. * Added yaml dependency. * `Text.Pandoc.XML`: Removed `stripTags`. (API change.) * `Text.Pandoc.Shared`: Added `metaToJSON`. This will be used in writers to create a JSON object for use in the templates from the pandoc metadata. * Revised readers and writers to use the new Meta type. * `Text.Pandoc.Options`: Added `Ext_yaml_title_block`. * Markdown reader: Added support for YAML metadata block. Note that it must come at the beginning of the document. * `Text.Pandoc.Parsing.ParserState`: Replace `stateTitle`, `stateAuthors`, `stateDate` with `stateMeta`. * RST reader: Improved metadata. Treat initial field list as metadata when standalone specified. Previously ALL fields "title", "author", "date" in field lists were treated as metadata, even if not at the beginning. Use `subtitle` metadata field for subtitle. * `Text.Pandoc.Templates`: Export `renderTemplate'` that takes a string instead of a compiled template.. * OPML template: Use 'for' loop for authors. * Org template: '#+TITLE:' is inserted before the title. Previously the writer did this.
2013-04-14Added `Text.Pandoc.Writers.Custom`, `--print-custom-lua-writer`.John MacFarlane1-0/+230
pandoc -t data/sample.lua will load the script sample.lua and use it as a custom writer. data/sample.lua is provided as an example. Added `--print-custom-lua-writer` option to print the sample script.