git.iko.soy/typeable/pandoc
on master help sign in
Implemented --toc-depth (and --toc!) for RTF writer.
4343f0dJohn MacFarlane
data/templates+1−1

Submodule changed.

src/Text/Pandoc/Writers/RTF.hs+3−1
@@ -72,13 +72,15 @@ writeRTF options (Pandoc (Meta title authors date) blocks) =
72 datetext = inlineListToRTF date
72 datetext = inlineListToRTF date
73 spacer = not $ all null $ titletext : datetext : authorstext
73 spacer = not $ all null $ titletext : datetext : authorstext
74 body = concatMap (blockToRTF 0 AlignDefault) blocks
74 body = concatMap (blockToRTF 0 AlignDefault) blocks
75+ isTOCHeader (Header lev _) = lev <= writerTOCDepth options
76+ isTOCHeader _ = False
75 context = writerVariables options ++
77 context = writerVariables options ++
76 [ ("body", body)
78 [ ("body", body)
77 , ("title", titletext)
79 , ("title", titletext)
78 , ("date", datetext) ] ++
80 , ("date", datetext) ] ++
79 [ ("author", a) | a <- authorstext ] ++
81 [ ("author", a) | a <- authorstext ] ++
80 [ ("spacer", "yes") | spacer ] ++
82 [ ("spacer", "yes") | spacer ] ++
81− [ ("toc", tableOfContents $ filter isHeaderBlock blocks) |
83+ [ ("toc", tableOfContents $ filter isTOCHeader blocks) |
82 writerTableOfContents options ]
84 writerTableOfContents options ]
83 in if writerStandalone options
85 in if writerStandalone options
84 then renderTemplate context $ writerTemplate options
86 then renderTemplate context $ writerTemplate options