aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/RTF.hs
AgeCommit message (Collapse)AuthorFilesLines
2021-10-12Revert "Depend on pandoc-types 1.23, remove Null constructor on Block."John MacFarlane1-0/+1
This reverts commit fb0d6c7cb63a791fa72becf21ed493282e65ea91.
2021-10-01Depend on pandoc-types 1.23, remove Null constructor on Block.John MacFarlane1-1/+0
2021-08-04RTF writer: emit \outlinelevel for section headings.John MacFarlane1-1/+2
2021-08-01RTF writer: omit `\bin` in `\pict`.John MacFarlane1-1/+1
According to the spec, this is not needed or wanted when the data is in hexadecimal format, as it is here.
2021-03-20T.P.Shared: remove `backslashEscapes`, `escapeStringUsing`.John MacFarlane1-10/+16
[API change] These are inefficient association list lookups. Replace with more efficient functions in the writers that used them (with 10-25% performance improvements in haddock, org, rtf, texinfo writers).
2021-01-08Update copyright notices for 2021 (#7012)Albert Krewinkel1-1/+1
2020-09-13Fix hlint suggestions, update hlint.yaml (#6680)Christian Despres1-3/+3
* Fix hlint suggestions, update hlint.yaml Most suggestions were redundant brackets. Some required LambdaCase. The .hlint.yaml file had a small typo, and didn't ignore camelCase suggestions in certain modules.
2020-05-14Fix underline in RTF writer.John MacFarlane1-1/+1
It should be `\ul` not `\pnul`.
2020-04-28Support new Underline element in readers and writers (#6277)Vaibhav Sagar1-0/+3
Deprecate `underlineSpan` in Shared in favor of `Text.Pandoc.Builder.underline`.
2020-04-15Adapt to the newest Table type, fix some previous adaptation issuesdespresc1-1/+1
- Writers.Native is now adapted to the new Table type. - Inline captions should now be conditionally wrapped in a Plain, not a Para block. - The toLegacyTable function now lives in Writers.Shared.
2020-04-15Implement the new Table typedespresc1-1/+2
2020-03-22Finer grained imports of Text.Pandoc.Class submodules (#6203)Albert Krewinkel1-2/+2
This should speed-up recompilation after changes in `Text.Pandoc.Class`, as the number of modules affected by a change will be smaller in general. It also offers faster insights into the parts of `T.P.Class` used within a module.
2020-03-15Use implicit Prelude (#6187)Albert Krewinkel1-2/+0
* Use implicit Prelude The previous behavior was introduced as a fix for #4464. It seems that this change alone did not fix the issue, and `stack ghci` and `cabal repl` only work with GHC 8.4.1 or newer, as no custom Prelude is loaded for these versions. Given this, it seems cleaner to revert to the implicit Prelude. * PandocMonad: remove outdated check for base version Only base versions 4.9 and later are supported, the check for `MIN_VERSION_base(4,8,0)` is therefore unnecessary. * Always use custom prelude Previously, the custom prelude was used only with older GHC versions, as a workaround for problems with ghci. The ghci problems are resolved by replacing package `base` with `base-noprelude`, allowing for consistent use of the custom prelude across all GHC versions.
2020-03-13Update copyright year (#6186)Albert Krewinkel1-1/+1
* Update copyright year * Copyright: add notes for Lua and Jira modules
2019-12-17Improved --toc generation.John MacFarlane1-2/+1
2019-11-12Switch to new pandoc-types and use Text instead of String [API change].despresc1-93/+96
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-10-29Changes to build with new doctemplates/doclayout.John MacFarlane1-9/+11
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-08-25Use new doctemplates, doclayout.John MacFarlane1-4/+3
+ 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-07-28Use doctemplates 0.3, change type of writerTemplate.John MacFarlane1-4/+5
* Require recent doctemplates. It is more flexible and supports partials. * Changed type of writerTemplate to Maybe Template instead of Maybe String. * Remove code from the LaTeX, Docbook, and JATS writers that looked in the template for strings to determine whether it is a book or an article, or whether csquotes is used. This was always kludgy and unreliable. To use csquotes for LaTeX, set `csquotes` in your variables or metadata. It is no longer sufficient to put `\usepackage{csquotes}` in your template or header includes. To specify a book style, use the `documentclass` variable or `--top-level-division`. * Change template code to use new API for doctemplates.
2019-07-23Templates: Change type of renderTemplate'.John MacFarlane1-7/+6
Return value is now Text rather than being polymorphic. This makes room for upcoming removal of the TemplateTarget class from doctemplates. Other code modified accordingly, and should compile with both current and upcoming version of doctemplates.
2019-03-01Remove license boilerplate.John MacFarlane1-18/+0
The haddock module header contains essentially the same information, so the boilerplate is redundant and just one more thing to get out of sync.
2019-02-04Add missing copyright notices and remove license boilerplate (#5112)Albert Krewinkel1-2/+2
Quite a few modules were missing copyright notices. This commit adds copyright notices everywhere via haddock module headers. The old license boilerplate comment is redundant with this and has been removed. Update copyright years to 2019. Closes #4592.
2019-01-04RTF writer: use toTableOfContents from T.P.W.Shared.John MacFarlane1-17/+2
2018-11-22RTF writer: fix warnings for skipped raw inlines.John MacFarlane1-1/+1
2018-09-24RTF writer: Fix build failure with ghc-8.6.1 caused by missing MonadFail ↵Jonas Scholl1-2/+4
instance.
2018-03-18Use NoImplicitPrelude and explicitly import Prelude.John MacFarlane1-0/+2
This seems to be necessary if we are to use our custom Prelude with ghci. Closes #4464.
2018-01-19hlint code improvements.John MacFarlane1-4/+4
2018-01-05Update copyright notices to include 2018Albert Krewinkel1-2/+2
2017-11-01hlintAlexander Krotov1-1/+1
2017-10-29hlint suggestions.John MacFarlane1-28/+27
2017-10-27Automatic reformating by stylish-haskell.John MacFarlane1-1/+1
2017-09-30Removed writerSourceURL, add source URL to common state.John MacFarlane1-1/+1
Removed `writerSourceURL` from `WriterOptions` (API change). Added `stSourceURL` to `CommonState`. It is set automatically by `setInputFiles`. Text.Pandoc.Class now exports `setInputFiles`, `setOutputFile`. The type of `getInputFiles` has changed; it now returns `[FilePath]` instead of `Maybe [FilePath]`. Functions in Class that formerly took the source URL as a parameter now have one fewer parameter (`fetchItem`, `downloadOrRead`, `setMediaResource`, `fillMediaBag`). Removed `WriterOptions` parameter from `makeSelfContained` in `SelfContained`.
2017-06-26Use `table-of-contents` for contents of toc, make `toc` a boolean.John MacFarlane1-1/+5
Changed markdown, rtf, and HTML-based templates accordingly. This allows you to set `toc: true` in the metadata; this previously produced strange results in some output formats. Closes #2872. For backwards compatibility, `toc` is still set to the toc contents. But it is recommended that you update templates to use `table-of-contents` for the toc contents and `toc` for a boolean flag.
2017-06-20Writers: adjusted for renderTemplate' changes.John MacFarlane1-3/+4
Now we raise a proper error on template failure.
2017-06-11Switched Writer types to use Text.John MacFarlane1-2/+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-05-02Added PandocResourceNotFound error.John MacFarlane1-4/+1
Use this instead of PandocIOError when a resource is not found in path. This improves the error message in this case, see #3629.
2017-03-04Stylish-haskell automatic formatting changes.John MacFarlane1-18/+18
2017-02-24Use catchError instead of runExceptT.John MacFarlane1-38/+45
2017-02-22imageSize interface changemb211-1/+1
`imageSize img` is now `imageSize opts img`
2017-02-17Added warnings for non-rendered blocks to some writers.John MacFarlane1-4/+8
2017-02-11Use new warnings throughout the code base.John MacFarlane1-8/+7
2017-01-25Revert "Added page breaks into Pandoc."John MacFarlane1-1/+0
This reverts commit f02a12aff638fa2339192231b8f601bffdfe3e14.
2017-01-25Text.Pandoc.Shared: Removed fetchItem, fetchItem'.John MacFarlane1-3/+4
Made changes where these are used, so that the version of fetchItem from PandocMonad can be used instead.
2017-01-25Class: rename addWarning[WithPos] to warning[WithPos].John MacFarlane1-6/+6
There's already a function addWarning in Parsing! Maybe we can dispense with that now, but I still like 'warning' better as a name.
2017-01-25Class: Renamed 'warn' to 'addWarning' and consolidated RTF writer.John MacFarlane1-15/+19
* Renaming Text.Pandoc.Class.warn to addWarning avoids conflict with Text.Pandoc.Shared.warn. * Removed writeRTFWithEmbeddedImages from Text.Pandoc.Writers.RTF. This is no longer needed; we automatically handle embedded images using the PandocM functions. [API change]
2017-01-25Refactored math conversion in writers.John MacFarlane1-112/+147
* Remove exported module `Text.Pandoc.Readers.TeXMath` * Add exported module `Text.Pandoc.Writers.Math` * The function `texMathToInlines` now lives in `Text.Pandoc.Writers.Math` * Export helper function `convertMath` from `Text.Pandoc.Writers.Math` * Use these functions in all writers that do math conversion. This ensures that warnings will always be issued for failed math conversions.
2017-01-25Unify Errors.Jesse Rosenthal1-1/+2
2017-01-25Implement Errors in PandocMonadJesse Rosenthal1-5/+6
Errors can be thrown purely with `throwError`. At the moment there are only three kinds of errors: 1. PandocFileReadError FilePath (for problems reading a file from the filesystem) 2. PandocShouldNeverHappenError String (for stuff that should never happen but we need to pattern-match anyway) 3. PandocSomeError String (a grab bag of everything else) Of course, we need to subdivide the third item in this list.
2017-01-25Convert writers to use PandocMonad typeclass.Jesse Rosenthal1-9/+4
Instead of Free Monad with runIO