From 4343f0dbcd941394e1e5bb3eeff1c14dbfbbe3ec Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 5 Jan 2013 18:23:51 -0800 Subject: Implemented --toc-depth (and --toc!) for RTF writer. --- data/templates | 2 +- src/Text/Pandoc/Writers/RTF.hs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/data/templates b/data/templates index f0347e7af..b49608bf9 160000 --- a/data/templates +++ b/data/templates @@ -1 +1 @@ -Subproject commit f0347e7af09f8aad32287b2b2d808cfb57e4e50e +Subproject commit b49608bf92ad66f255cd3371da834ddb7bee5211 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 -- cgit v1.2.3