aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/RTF.hs
diff options
context:
space:
mode:
authorMarc Schreiber <marc.schreiber@fh-aachen.de>2017-07-13 11:35:35 +0200
committerMarc Schreiber <marc.schreiber@fh-aachen.de>2017-07-13 11:51:40 +0200
commitf93d7d06f688654137b5e728601441881ff5aebf (patch)
treee36c6fe213491dfe97e3b9de47a773ebfff8c133 /src/Text/Pandoc/Writers/RTF.hs
parent635f299b441e238ccd34e3ad61c5e36f0ca30067 (diff)
parent8b502dd50ff842bdbbf346a67a607d1a7905bda3 (diff)
downloadpandoc-f93d7d06f688654137b5e728601441881ff5aebf.tar.gz
Merge branch 'master' of https://github.com/jgm/pandoc into textcolor-support
Diffstat (limited to 'src/Text/Pandoc/Writers/RTF.hs')
-rw-r--r--src/Text/Pandoc/Writers/RTF.hs13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Writers/RTF.hs b/src/Text/Pandoc/Writers/RTF.hs
index 5c990f324..48d31c7bf 100644
--- a/src/Text/Pandoc/Writers/RTF.hs
+++ b/src/Text/Pandoc/Writers/RTF.hs
@@ -122,13 +122,18 @@ writeRTF options doc = do
let context = defField "body" body
$ defField "spacer" spacer
$ (if writerTableOfContents options
- then defField "toc" toc
+ then defField "table-of-contents" toc
+ -- for backwards compatibility,
+ -- we populate toc with the contents
+ -- of the toc rather than a boolean:
+ . defField "toc" toc
else id)
$ metadata
- return $ T.pack
- $ case writerTemplate options of
+ T.pack <$>
+ case writerTemplate options of
Just tpl -> renderTemplate' tpl context
- Nothing -> case reverse body of
+ Nothing -> return $
+ case reverse body of
('\n':_) -> body
_ -> body ++ "\n"