diff options
-rw-r--r-- | src/Main.hs | 10 | ||||
-rw-r--r-- | src/Text/Pandoc/Shared.hs | 24 |
2 files changed, 23 insertions, 11 deletions
diff --git a/src/Main.hs b/src/Main.hs index 95b4420c1..d25e38911 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -107,6 +107,7 @@ data Opt = Opt , optWriter :: String -- ^ Writer format , optParseRaw :: Bool -- ^ Parse unconvertable HTML and TeX , optCSS :: String -- ^ CSS file to link to + , optTableOfContents :: Bool -- ^ Include table of contents , optIncludeInHeader :: String -- ^ File to include in header , optIncludeBeforeBody :: String -- ^ File to include at top of body , optIncludeAfterBody :: String -- ^ File to include at end of body @@ -133,6 +134,7 @@ defaultOpts = Opt , optWriter = "" -- null for default writer , optParseRaw = False , optCSS = "" + , optTableOfContents = False , optIncludeInHeader = "" , optIncludeBeforeBody = "" , optIncludeAfterBody = "" @@ -230,6 +232,11 @@ options = "CSS") "" -- "Link to CSS style sheet" + , Option "" ["toc", "table-of-contents"] + (NoArg + (\opt -> return opt { optTableOfContents = True })) + "" -- "Include table of contents" + , Option "H" ["include-in-header"] (ReqArg (\arg opt -> do @@ -395,6 +402,7 @@ main = do , optWriter = writerName , optParseRaw = parseRaw , optCSS = css + , optTableOfContents = toc , optIncludeInHeader = includeHeader , optIncludeBeforeBody = includeBefore , optIncludeAfterBody = includeAfter @@ -471,6 +479,8 @@ main = do writerHeader = header, writerTitlePrefix = titlePrefix, writerTabStop = tabStop, + writerTableOfContents = toc && + (not strict), writerS5 = (writerName=="s5"), writerIncremental = incremental, writerNumberSections = numberSections, diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs index 00a467ca4..d0b134534 100644 --- a/src/Text/Pandoc/Shared.hs +++ b/src/Text/Pandoc/Shared.hs @@ -375,6 +375,7 @@ data WriterOptions = WriterOptions , writerHeader :: String -- ^ Header for the document , writerIncludeBefore :: String -- ^ String to include before the body , writerIncludeAfter :: String -- ^ String to include after the body + , writerTableOfContents :: Bool -- ^ Include table of contents , writerS5 :: Bool -- ^ We're writing S5 , writerIncremental :: Bool -- ^ Incremental S5 lists , writerNumberSections :: Bool -- ^ Number sections in LaTeX @@ -386,17 +387,18 @@ data WriterOptions = WriterOptions -- | Default writer options. defaultWriterOptions = - WriterOptions { writerStandalone = True, - writerHeader = "", - writerTitlePrefix = "", - writerTabStop = 4, - writerS5 = False, - writerIncremental = False, - writerNumberSections = False, - writerIncludeBefore = "", - writerIncludeAfter = "", - writerStrictMarkdown = False, - writerReferenceLinks = False } + WriterOptions { writerStandalone = True, + writerHeader = "", + writerTitlePrefix = "", + writerTabStop = 4, + writerTableOfContents = False, + writerS5 = False, + writerIncremental = False, + writerNumberSections = False, + writerIncludeBefore = "", + writerIncludeAfter = "", + writerStrictMarkdown = False, + writerReferenceLinks = False } -- -- code to lookup reference keys in key table |