aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers
AgeCommit message (Collapse)AuthorFilesLines
2019-11-12Switch to new pandoc-types and use Text instead of String [API change].despresc39-2601/+2687
PR #5884. + Use pandoc-types 1.20 and texmath 0.12. + Text is now used instead of String, with a few exceptions. + In the MediaBag module, some of the types using Strings were switched to use FilePath instead (not Text). + In the Parsing module, new parsers `manyChar`, `many1Char`, `manyTillChar`, `many1TillChar`, `many1Till`, `manyUntil`, `mantyUntilChar` have been added: these are like their unsuffixed counterparts but pack some or all of their output. + `glob` in Text.Pandoc.Class still takes String since it seems to be intended as an interface to Glob, which uses strings. It seems to be used only once in the package, in the EPUB writer, so that is not hard to change.
2019-11-11Fix typos (#5896)Brian Wignall1-1/+1
2019-11-11Change the implementation of `htmlSpanLikeElements` and implement `<dfn>` ↵Florian Beeres1-2/+4
(#5882) * Add HTML Reader support for `<dfn>`, parsing this as a Span with class `dfn`. * Change `htmlSpanLikeElements` implementation to retain classes, attributes and inline content.
2019-11-07Fix list fields in Opt so they aren't reversed.John MacFarlane1-2/+6
Previously optIncludeInHeader, etc. were in reverse order. This has been changed to promote #5881. Note also that the `sourcefile` variable used to be sometimes a string, sometimes a list (when there was more than one). Now it is always a list.
2019-11-04HTML Reader/Writer - Add support for <var> and <samp> (#5861)Amogh Rathore1-6/+15
Closes #5799
2019-11-03EPUB writer: ensure that `lang` variable is set on all chapters.John MacFarlane1-3/+5
2019-11-03Place caption before table in OpenDocument format. (#5869)Dmitry Pogodin1-3/+5
Closes #5681.
2019-10-31Jira writer: remove extraneous newline after single-line block quotesAlbert Krewinkel1-1/+1
See #5858
2019-10-29T.P.W.Shared: Changed gridTables so it does better at...John MacFarlane1-16/+20
...keeping the widths of columns. See #4320. Adjust test case for #4320.
2019-10-29Changes to build with new doctemplates/doclayout.John MacFarlane16-72/+92
The new version of doctemplates adds many features to pandoc's templating system, while remaining backwards-compatible. New features include partials and filters. Using template filters, one can lay out data in enumerated lists and tables. Templates are now layout-sensitive: so, for example, if a text with soft line breaks is interpolated near the end of a line, the text will break and wrap naturally. This makes the templating system much more suitable for programatically generating markdown or other plain-text files from metadata.
2019-10-25Beamer writer: fix regression with hrules separating slides.John MacFarlane1-3/+3
2019-10-24HTML reader/writer: Better handling of <q> with cite attribute (#5837)Ole Martin Ruud1-2/+10
* HTML reader: Handle cite attribute for quotes. If a `<q>` tag has a `cite` attribute, we interpret it as a Quoted element with an inner Span. Closes #5798 * Refactor url canonicalization into a helper function * Modify HTML writer to handle quote with cite. [0]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/q
2019-10-15Add support for reading and writing <kbd> elementsDaniele D'Orazio1-25/+39
* Text.Pandoc.Shared: export `htmlSpanLikeElements` [API change] This commit also introduces a mapping of HTML span like elements that are internally represented as a Span with a single class, but that are converted back to the original element by the html writer. As of now, only the kbd element is handled this way. Ideally these elements should be handled as plain AST values, but since that would be a breaking change with a large impact, we revert to this stop-gap solution. Fixes https://github.com/jgm/pandoc/issues/5796.
2019-10-14change indentation of math part in Writers/HTML.hsmb211-33/+44
2019-10-14KaTeX math: respect classoption=fleqn variablemb211-2/+6
closes #5815
2019-10-12LaTeX writer: fix horizontal rule.John MacFarlane1-1/+1
We change to use 0.5pt rather than `\linethickness`, which apparently only ever worked "by accident" and no longer works with recent updates to texlive. Closes #5801.
2019-10-11Markdown writer: prefer pipe_tables to raw html...John MacFarlane1-3/+3
...even when we must lose width information. All in all this seems to be people's preferred behavior, even though it is slightly lossier. Closes #2608. Closes #4497.
2019-10-10Improve parsing of --defaults.John MacFarlane1-5/+1
- Add FromYAML instances to Opt and to all subsidiary types. - Remove the use of HsYAML-aeson, which doesn't give good position information on errors. - Rename some fields in Opt to better match cli options or reflect what the ycontain [API change]: + optMetadataFile -> optMetadataFiles + optPDFEngineArgs -> optPDFEngineOpts + optWrapText -> optWrap - Add IpynbOutput enumerated type to Text.Pandoc.App.Opts. Use this instead fo a string for optIpynbOutput. - Add FromYAML instance for Filter in Text.Pandoc.Filters. With these changes parsing of defaults files should be complete and should give decent error messages. Now (unlike before) we get an error if an unknown field is used.
2019-10-10Make some writers sensitive to 'unlisted' class on headings.John MacFarlane2-7/+10
If this is present on a heading with the 'unnumbered' class, the heading won't appear in the TOC. This class has no effect if 'unnumbered' is not also specified. This affects HTML-based writers (including slide shows and epub), LateX (including beamer), RTF, and PowerPoint. Other writers do not yet support `unlisted`. Closes #1762.
2019-10-09RST writer: proper handling of :align: on figures, images.John MacFarlane1-6/+12
When the image has the `align-right` (etc.) class, we now use an `:align:` attribute. Closes #4420.
2019-10-09Basic changes for MathJax 3.zorkow1-1/+1
2019-10-09Options.WriterOptions: Change type of writerVariables to Context Text.John MacFarlane5-45/+80
This will allow structured values. [API change]
2019-10-04hlint Muse writerAlexander Krotov1-1/+1
2019-09-28More throwError in place of fail.John MacFarlane2-1/+3
2019-09-28Replace some more fails with throwErrors.John MacFarlane3-4/+9
2019-09-28Use throwError instead of fail when appropriate.John MacFarlane2-4/+11
2019-09-28Use Prelude.fail to avoid ambiguity with fail from GHC.Base.John MacFarlane5-8/+8
2019-09-24odt: Add external option for native numberingNils Carlson1-7/+7
This adds an external options +native_numbering to the ODT writer enabling enumeration of figures and tables in ODT output.
2019-09-23Man writer: suppress non-absolute link URLs.John MacFarlane1-3/+3
Motivation: in a man page there's not much use for relative URLs, which you can't follow. Absolute URLs are still useful. We previously suppressed relative URLs starting with '#' (purely internal links), but it makes sense to go a bit farther. Closes #5770.
2019-09-22[Docx Writer] Re-use Readers.Docx.Parse for StyleMap (#5766)Nikolay Yakimov2-31/+78
* [Docx Parser] Move style-parsing-specific code to a new module * [Docx Writer] Re-use Readers.Docx.Parse.Styles for StyleMap * [Docx Writer] Move Readers.Docx.StyleMap to Writers.Docx.StyleMap It's never used outside of writer code, so it makes more sense to scope it under writers really.
2019-09-22Make `plain` output plainer.John MacFarlane1-5/+16
Previously we used the following Project Gutenberg conventions for plain output: - extra space before and after level 1 and 2 headings - all-caps for strong emphasis `LIKE THIS` - underscores surrounding regular emphasis `_like this_` This commit makes `plain` output plainer. Strong and Emph inlines are rendered without special formatting. Headings are also rendered without special formatting, and with only one blank line following. To restore the former behavior, use `-t plain+gutenberg`. API change: Add `Ext_gutenberg` constructor to `Extension`. See #5741.
2019-09-21[Docx Writer] Consistently use style names, not style idsNikolay Yakimov1-27/+25
Styles that this change affects: paragraph styles: Author, Abstract, Compact, Figure, Captioned Figure, Image Caption, First Paragraph, Source Code, Table Caption, Definition, Definition Term; character styles: Verbatim Char, token styles (those with names ending in Tok)
2019-09-21[Docx Writer] Code clean-upNikolay Yakimov1-40/+37
Reduce code duplication, remove redundant brackets
2019-09-20Preserve built-in styles in DOCX with custom style (#5670)Ben Steinberg1-22/+55
This commit prevents custom styles on divs and spans from overriding styles on certain elements inside them, like headings, blockquotes, and links. On those elements, the "native" style is required for the element to display correctly. This change also allows nesting of custom styles; in order to do so, it removes the default "Compact" style applied to Plain blocks, except when inside a table.
2019-09-20Bug fixes to EPUB chapter splitting.John MacFarlane1-15/+16
2019-09-19EPUB writer: make --epub-chapter-level work again.John MacFarlane1-19/+15
It was temporarily broken by the latest change to chapter splitting code.
2019-09-19EPUB writer: improve splitting into chapters.John MacFarlane1-36/+23
+ Use makeSection from T.P.Shared. This deals better with embedded divs. (Closes #5761.) + Remove chapter-title class from chapter h1, for now. (Reverts one change made earlier; we may revisit this in light of #5749.) + Avoid issuing warning multiple times when title not set (see #5760).
2019-09-19Remove admonition-title remnants.John MacFarlane1-1/+1
Completes 8e01ccb41dde8a5e6123f5b0746c36f240576047
2019-09-18LaTeX writer: use `\hspace{0pt}` for 0-width space U+200B.John MacFarlane1-0/+1
Closes #5756.
2019-09-14Add chapter-title class to EPUB chapter title h1 elements.John MacFarlane1-3/+5
See #5269.
2019-09-14EPUB toChapters: don't treat "refs" Div specially.John MacFarlane1-1/+1
This should make toChapters work better if there are Divs around sections.
2019-09-08Replace Element and makeHierarchical with makeSections.John MacFarlane12-462/+387
Text.Pandoc.Shared: + Remove `Element` type [API change] + Remove `makeHierarchicalize` [API change] + Add `makeSections` [API change] + Export `deLink` [API change] Now that we have Divs, we can use them to represent the structure of sections, and we don't need a special Element type. `makeSections` reorganizes a block list, adding Divs with class `section` around sections, and adding numbering if needed. This change also fixes some longstanding issues recognizing section structure when the document contains Divs. Closes #3057, see also #997. All writers have been changed to use `makeSections`. Note that in the process we have reverted the change c1d058aeb1c6a331a2cc22786ffaab17f7118ccd made in response to #5168, which I'm not completely sure was a good idea. Lua modules have also been adjusted accordingly. Existing lua filters that use `hierarchicalize` will need to be rewritten to use `make_sections`.
2019-09-04asciidoc writer: don't include `+` in code blocks for regular asciidoc.John MacFarlane1-2/+7
This is asciidoctor-specific. Amends 98ee6ca289ad7117b7336a57bcfc6f4b54463f4e.
2019-09-02LaTeX writer: use `cslreferences` environment for csl bibliographies.John MacFarlane1-3/+18
this allows bibliographies to receive special formatting. The template now contains definition of this environment (enabled only when CSL is used). It also defines a `\cslhangindent` length. This is set to 2em by default when the bibliography style specifies a hanging indent. To override the length, you can use e.g. \setlength{\cslhangindent}{7em} in header-includes. Closes jgm/pandoc-citeproc#410.
2019-09-02HTML writer: use numeric character references with `--ascii`.John MacFarlane1-6/+2
Previously we used named character references with html5 output. But these aren't valid XML, and we aim to produce html5 that is also valid XHTML (polyglot markup). (This is also needed for epub3.) Closes #5718.
2019-09-02LaTeX writer: strip off `{}` around locator for biblatex/natbib output.John MacFarlane1-1/+7
Closes #5722.
2019-08-27PowerPoint writer: Start numbering at appopriate numbers.Jesse Rosenthal1-4/+8
Starting numbers for ordered lists were previously ignored. Now we specify the number if it is something other than 1. Closes: #5709
2019-08-25Use new doctemplates, doclayout.John MacFarlane31-786/+808
+ Remove Text.Pandoc.Pretty; use doclayout instead. [API change] + Text.Pandoc.Writers.Shared: remove metaToJSON, metaToJSON' [API change]. + Text.Pandoc.Writers.Shared: modify `addVariablesToContext`, `defField`, `setField`, `getField`, `resetField` to work with Context rather than JSON values. [API change] + Text.Pandoc.Writers.Shared: export new function `endsWithPlain` [API change]. + Use new templates and doclayout in writers. + Use Doc-based templates in all writers. + Adjust three tests for minor template rendering differences. + Added indentation to body in docbook4, docbook5 templates. The main impact of this change is better reflowing of content interpolated into templates. Previously, interpolated variables were rendered independently and intepolated as strings, which could lead to overly long lines. Now the templates interpolated as Doc values which may include breaking spaces, and reflowing occurs after template interpolation rather than before.
2019-08-23Asciidoc writer: handle admonitions.John MacFarlane1-3/+22
Closes #5690.
2019-08-23Ensure proper nesting when we have long ordered list markers.John MacFarlane1-2/+5
Closes #5705.