aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2013-01-05 18:23:51 -0800
committerJohn MacFarlane <fiddlosopher@gmail.com>2013-01-05 18:23:51 -0800
commit4343f0dbcd941394e1e5bb3eeff1c14dbfbbe3ec (patch)
treec7e80e452473c9e70ca48c9850d40e7645bf0d92 /src/Text/Pandoc/Writers
parent65d01857fbb4041b68ce3767773c151b4f135a27 (diff)
downloadpandoc-4343f0dbcd941394e1e5bb3eeff1c14dbfbbe3ec.tar.gz
Implemented --toc-depth (and --toc!) for RTF writer.
Diffstat (limited to 'src/Text/Pandoc/Writers')
-rw-r--r--src/Text/Pandoc/Writers/RTF.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/RTF.hs b/src/Text/Pandoc/Writers/RTF.hs
index 1919eb3f2..619e7086f 100644
--- a/src/Text/Pandoc/Writers/RTF.hs
+++ b/src/Text/Pandoc/Writers/RTF.hs
@@ -72,13 +72,15 @@ writeRTF options (Pandoc (Meta title authors date) blocks) =
datetext = inlineListToRTF date
spacer = not $ all null $ titletext : datetext : authorstext
body = concatMap (blockToRTF 0 AlignDefault) blocks
+ isTOCHeader (Header lev _) = lev <= writerTOCDepth options
+ isTOCHeader _ = False
context = writerVariables options ++
[ ("body", body)
, ("title", titletext)
, ("date", datetext) ] ++
[ ("author", a) | a <- authorstext ] ++
[ ("spacer", "yes") | spacer ] ++
- [ ("toc", tableOfContents $ filter isHeaderBlock blocks) |
+ [ ("toc", tableOfContents $ filter isTOCHeader blocks) |
writerTableOfContents options ]
in if writerStandalone options
then renderTemplate context $ writerTemplate options