aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers
AgeCommit message (Collapse)AuthorFilesLines
2018-10-23Groff writer character escaping changes.John MacFarlane3-46/+56
T.P.GroffChar: replaced `essentialEscapes` with `manEscapes`, which includes all the escapes mentioned in the groff_man manual. T.P.Writers.Groff: removed escapeCode; changed parameter on escapeString from Bool to new type `EscapeMode`. Rewrote `escapeString`.
2018-10-23Fix Muse writer styleAlexander Krotov1-42/+42
2018-10-23Muse writer: use length instead of realLength to calculate definition ↵Alexander Krotov1-1/+2
indentation Muse parsers don't take character width into account when calculating indentation.
2018-10-22Groff writers escaping changes.John MacFarlane1-22/+24
- Improve escaping of accented characters with `--ascii`. Combining accents are now handled properly. - Don't escape spaces and tabs in code blocks. This doesn't seem to be necessary.
2018-10-22T.P.Writers.Groff - don't export escapeChar.John MacFarlane2-2/+1
2018-10-23Muse writer: do not insert newline before listsAlexander Krotov1-3/+3
2018-10-23Muse writer: code cleanupAlexander Krotov1-4/+2
2018-10-22Reduce code duplication in Muse writerAlexander Krotov1-34/+18
2018-10-22hlint Muse writerAlexander Krotov1-5/+3
2018-10-21Muse writer: use lightweight markup after </em> tagAlexander Krotov1-0/+1
2018-10-20Powerpoint: Support raw openxml in pptx writer.Jesse Rosenthal2-12/+25
This allows raw openxml blocks and inlines to be used in the pptx writer. A few caveats: 1. It's up to the user to write well-formed openxml. The chances for corruption, especially with such a brittle format as pptx, is pretty high. 2. Because of the tricky way that blocks map onto shapes, if you are using a raw block, it should be the only block on a slide (otherwise other text might end up overlapping it). 3. The pptx ooxml namespace abbreviations are different from the docx ooxml namespaces. Again, it's up to the user to get it right. Unzipped document and ooxml specification should be consulted. Closes: #4976
2018-10-19Man writer: avoid unnecessary `.RS`/`.RE` pair in defn lists.John MacFarlane1-1/+3
When the definition is just one paragraph, we don't need the `.RS\n.RE`.
2018-10-18Remove unneeded import.John MacFarlane1-1/+0
2018-10-18Groff escaping changes.John MacFarlane3-48/+54
- `--ascii` is now turned on automatically for man output, for portability. All man output will be escaped to ASCII. - In T.P.Writers.Groff, `escapeChar`, `escapeString`, and `escapeCode` now take a boolean parameter that selects ascii-only output. This is used by the Ms writer for `--ascii`, instead of doing an extra pass after writing the document. - In ms output without `--ascii`, unicode is used whenever possible (e.g. for double quotes). - A few escapes are changed: e.g. `\[rs]` instead of `\\` for backslash, and `\ga]` instead of `` \` `` for backtick.
2018-10-18Add Text.Pandoc.GroffChar.John MacFarlane1-20/+2
This will hold common escaping data for groff characters.
2018-10-17man/ms writers: use `\[at]` for escaped `@`.John MacFarlane1-1/+1
2018-10-17Move common groff functions to Text.Pandoc.Writers.GroffJohn MacFarlane4-151/+155
(unexported module). These are used in both the man and ms writers. Moved groffEscape out of Text.Pandoc.Writers.Shared [cancels earlier API change from adding it, which was after last release]. This fixes strong/code combination on man (should be `\f[CB]` not `\f[BC]`), mentioned in #4973. Updated tests. Closes #4975.
2018-10-17Man writer: use \f[R] instead of \f[] to reset fontAlexander Krotov1-2/+2
Fixes #4973
2018-10-14Markdown writer: ensure blank between raw block and normal content.John MacFarlane1-0/+7
Otherwise a raw block can prevent a paragraph from being recognized as such. Closes #4629.
2018-10-14Custom writer: provide PANDOC_DOCUMENT instead of Setup functionAlbert Krewinkel1-18/+26
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.
2018-10-13Custom writer: give full access to doc in optional Setup function (#4967)Albert Krewinkel1-1/+16
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
2018-10-09Docx writer: added framework for custom properties.John MacFarlane1-1/+20
So far, we don't actually write any custom properties, but we have the infrastructure to add this. See #3034.
2018-10-09hlint Muse writerAlexander Krotov1-4/+4
2018-10-08LaTeX writer with `--listings`: don't pass through org-babel attributes.John MacFarlane1-1/+4
So far: just, tangle, exports, results which are used by org mode. It might be better to use a whitelist of legal listings attributes, but there are a large number, and these may change. Closes #4889.
2018-10-08LaTeX writer: with `--biblatex`, use `\autocite` when possible.John MacFarlane1-13/+21
`\autocites{a1}{a2}{a3}` will not collapse the entries. So, if we don't have prefixes and suffixes, we use instead `\autocite{a1;a2;a3}`. Closes #4960.
2018-10-08ODT writer: improve metadata.John MacFarlane1-7/+26
- Author, date added to metadata. - Remaining metadata properties (besides author, date, title, lang) are added as meta:user-defined tags.
2018-10-07Docx writer: handle tables in table cells.John MacFarlane1-2/+7
Although this is not documented in the spec, some versions of Word require a 'w:p' element inside every table cell. Thus, we add one when the contents of a cell do not already include one (e.g. when a table cell contains a table). Closes #4953.
2018-10-07Revert export of hasSimpleCells from T.P.Writers.Shared.John MacFarlane1-18/+0
This wasn't necessary.
2018-10-06RST writer: use simple tables when possible.John MacFarlane2-4/+52
Closes #4750. Text.Pandoc.Writers.Shared now exports hasSimpleCells [API change].
2018-10-05CommonMark writer: add plain text fallbacks. (#4531)quasicomputational3-39/+73
Previously, the writer would unconditionally emit HTMLish output for subscripts, superscripts, strikeouts (if the strikeout extension is disabled) and small caps, even with raw_html disabled. Now there are plain-text (and, where possible, fancy Unicode) fallbacks for all of these corresponding (mostly) to the Markdown fallbacks, and the HTMLish output is only used when raw_html is enabled. This commit adds exported functions `toSuperscript` and `toSubscript` to `Text.Pandoc.Writers.Shared`. [API change] Closes #4528.
2018-10-05OpenDocument writer: Implement table caption numbering (#4949)Nils Carlson1-36/+53
Implement table caption numbering with a format "Table 1: <caption>". Translations are enabled and numbering is consecutive for captioned tables, uncaptioned tables are not enumerated. Captioned figures are now also numbered consecutively and uncaptioned figures are not enumerated.
2018-10-04KaTeX: don't use autorenderer.John MacFarlane2-6/+6
We no longer surround formulas with `\(..\)` or `\[..\]` and rely on the autorenderer. Instead, we tell katex to convert the contents of span elements with class "math". Since math has already been identified, this avoids wasted time parsing for LaTeX delimiters. Note, however, that this may yield unexpected results if you have span elements with class "math" that don't contain LaTeX math. Also, use latest version of KaTeX by default (0.9.0). Closes #4946.
2018-10-04Add lookupMeta* functions to Text.Pandoc.Writers.Shared (#4907)Mauro Bieg5-57/+67
Remove exported functions `metaValueToInlines`, `metaValueToString`. Add new exported functions `lookupMetaBool`, `lookupMetaBlocks`, `lookupMetaInlines`, `lookupMetaString`. Use these whenever possible for uniformity in writers. API change (major, because of removed function `metaValueToInlines`. `metaValueToString` wasn't in any released version.)
2018-10-03OpenDocument writer: make 'Figure' term sensitive to `lang` in metadata.John MacFarlane1-9/+16
We use the new translations API.
2018-10-03Text.Pandoc.Writers.Shared: added `metaValueToString`.John MacFarlane1-0/+9
[API change]
2018-10-03OpenDocument writer: Implement figure numbering in captions (#4944)Nils Carlson1-1/+13
Figure captions are now numbered 1, 2, 3, ... The format in the caption is "Figure 1: <caption>" and so on. This is necessary in order for libreoffice to generate an Illustration Index (Table of Figures) for included figures.
2018-10-02Removed Text.Pandoc.Groff.John MacFarlane3-2/+11
Moved groffEscape function to Text.Pandoc.Writers.Shared. [API change, since T.P.W.S is exported.]
2018-10-02OpenDocument writer: improve bullet/numbering alignment.John MacFarlane1-4/+12
This patch eliminates the large gap we used to have between bullet and text, and also ensures that numbers in numbered lists will be right-aligned. Closes #4385.
2018-10-01Shared: new export `splitSentences` [API change].John MacFarlane2-52/+0
This was duplicated in the Man and Ms writers, and really belongs in Shared.
2018-10-01Lua filters: report traceback when an error occursAlbert Krewinkel1-2/+2
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.
2018-09-30Implement `--ascii` (`writerPreferAscii`) in writers, not App.John MacFarlane8-54/+132
Now the `write*` functions for Docbook, HTML, ICML, JATS, Man, Ms, OPML are sensitive to `writerPreferAscii`. Previously the to-ascii translation was done in Text.Pandoc.App, and thus not available to those using the writer functions directly. In addition, the LaTeX writer is now sensitive to `writerPreferAscii` and to `--ascii`. 100% ASCII output can't be guaranteed, but the writer will use commands like `\"{a}` and `\l` whenever possible, to avoid emiting a non-ASCII character. A new unexported module, Text.Pandoc.Groff, has been added to store functions used in the different groff-based writers.
2018-09-29LaTeX writer: Fix description lists contining highlighted code.John MacFarlane1-2/+4
Closes #4662.
2018-09-27HTML writer: avoid adding extra section nestings for revealjs.John MacFarlane1-1/+1
Previously revealjs title slides at level (slidelevel - 1) were nested under an extra section element, even when the section contained no additional (vertical) content. That caused problems for some transition effects. See hakimel/reveal.js#1947.
2018-09-27JATS writer: remove 'role' attribute on 'bold' and 'sc' elements.John MacFarlane1-3/+2
The JATS spec does not allow these. Closes #4937.
2018-09-27HTML writer: omit unknown attributes in EPUB2 output.John MacFarlane1-8/+140
This allows users to include `epub:type` attributes, which will be passed through to epub3 but not epub2.
2018-09-24Use hslua v1.0.0Albert Krewinkel1-69/+74
2018-09-24Merge pull request #4921 from pyssling/masterJohn MacFarlane1-13/+21
ODT Writer: Improve table header row style handling
2018-09-24RTF writer: Fix build failure with ghc-8.6.1 caused by missing MonadFail ↵Jonas Scholl1-2/+4
instance.
2018-09-23ODT Writer: Improve table header row style handlingNils Carlson1-13/+21
This changes the way styles for cells in the header row and normal rows are handled in ODT tables. Previously a new (but identical) style was generated for every table, specifying the style of the cells within the table. After this change there are two style definitions for table cells, one for the cells in the header row, one for all other cells. This doesn't change the actual styles, but makes post-processing changes to the table styles much simpler as it is no longer necessary to introduce new styles for header rows and there are now only two styles where there was previously one per table.
2018-09-22LaTeX writer: fix a use of `last` that might take empty list.John MacFarlane1-3/+3
If you ran with `--biblatex` and have an empty document (metadata but no blocks), pandoc would previously raise an error because of the use of `last` on an empty list.