Implemented --toc-depth (and --toc!) for RTF writer.

This commit is contained in:
John MacFarlane
2013-01-05 18:23:51 -08:00
parent 65d01857fb
commit 4343f0dbcd
2 changed files with 4 additions and 2 deletions
+3 -1
View File
@@ -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