git.iko.soy/typeable/pandoc
on master help sign in
Added writerTableOfContents to WriterOptions, and added a
fdf31cdfiddlosopher
src/Main.hs+10
@@ -107,6 +107,7 @@ data Opt = Opt
107 , optWriter :: String -- ^ Writer format
107 , optWriter :: String -- ^ Writer format
108 , optParseRaw :: Bool -- ^ Parse unconvertable HTML and TeX
108 , optParseRaw :: Bool -- ^ Parse unconvertable HTML and TeX
109 , optCSS :: String -- ^ CSS file to link to
109 , optCSS :: String -- ^ CSS file to link to
110+ , optTableOfContents :: Bool -- ^ Include table of contents
110 , optIncludeInHeader :: String -- ^ File to include in header
111 , optIncludeInHeader :: String -- ^ File to include in header
111 , optIncludeBeforeBody :: String -- ^ File to include at top of body
112 , optIncludeBeforeBody :: String -- ^ File to include at top of body
112 , optIncludeAfterBody :: String -- ^ File to include at end of body
113 , optIncludeAfterBody :: String -- ^ File to include at end of body
@@ -133,6 +134,7 @@ defaultOpts = Opt
133 , optWriter = "" -- null for default writer
134 , optWriter = "" -- null for default writer
134 , optParseRaw = False
135 , optParseRaw = False
135 , optCSS = ""
136 , optCSS = ""
137+ , optTableOfContents = False
136 , optIncludeInHeader = ""
138 , optIncludeInHeader = ""
137 , optIncludeBeforeBody = ""
139 , optIncludeBeforeBody = ""
138 , optIncludeAfterBody = ""
140 , optIncludeAfterBody = ""
@@ -230,6 +232,11 @@ options =
230 "CSS")
232 "CSS")
231 "" -- "Link to CSS style sheet"
233 "" -- "Link to CSS style sheet"
232
234
235+ , Option "" ["toc", "table-of-contents"]
236+ (NoArg
237+ (\opt -> return opt { optTableOfContents = True }))
238+ "" -- "Include table of contents"
239+
233 , Option "H" ["include-in-header"]
240 , Option "H" ["include-in-header"]
234 (ReqArg
241 (ReqArg
235 (\arg opt -> do
242 (\arg opt -> do
@@ -395,6 +402,7 @@ main = do
395 , optWriter = writerName
402 , optWriter = writerName
396 , optParseRaw = parseRaw
403 , optParseRaw = parseRaw
397 , optCSS = css
404 , optCSS = css
405+ , optTableOfContents = toc
398 , optIncludeInHeader = includeHeader
406 , optIncludeInHeader = includeHeader
399 , optIncludeBeforeBody = includeBefore
407 , optIncludeBeforeBody = includeBefore
400 , optIncludeAfterBody = includeAfter
408 , optIncludeAfterBody = includeAfter
@@ -471,6 +479,8 @@ main = do
471 writerHeader = header,
479 writerHeader = header,
472 writerTitlePrefix = titlePrefix,
480 writerTitlePrefix = titlePrefix,
473 writerTabStop = tabStop,
481 writerTabStop = tabStop,
482+ writerTableOfContents = toc &&
483+ (not strict),
474 writerS5 = (writerName=="s5"),
484 writerS5 = (writerName=="s5"),
475 writerIncremental = incremental,
485 writerIncremental = incremental,
476 writerNumberSections = numberSections,
486 writerNumberSections = numberSections,
src/Text/Pandoc/Shared.hs+13−11
@@ -375,6 +375,7 @@ data WriterOptions = WriterOptions
375 , writerHeader :: String -- ^ Header for the document
375 , writerHeader :: String -- ^ Header for the document
376 , writerIncludeBefore :: String -- ^ String to include before the body
376 , writerIncludeBefore :: String -- ^ String to include before the body
377 , writerIncludeAfter :: String -- ^ String to include after the body
377 , writerIncludeAfter :: String -- ^ String to include after the body
378+ , writerTableOfContents :: Bool -- ^ Include table of contents
378 , writerS5 :: Bool -- ^ We're writing S5
379 , writerS5 :: Bool -- ^ We're writing S5
379 , writerIncremental :: Bool -- ^ Incremental S5 lists
380 , writerIncremental :: Bool -- ^ Incremental S5 lists
380 , writerNumberSections :: Bool -- ^ Number sections in LaTeX
381 , writerNumberSections :: Bool -- ^ Number sections in LaTeX
@@ -386,17 +387,18 @@ data WriterOptions = WriterOptions
386
387
387-- | Default writer options.
388-- | Default writer options.
388defaultWriterOptions =
389defaultWriterOptions =
389− WriterOptions { writerStandalone = True,
390+ WriterOptions { writerStandalone = True,
390− writerHeader = "",
391+ writerHeader = "",
391− writerTitlePrefix = "",
392+ writerTitlePrefix = "",
392− writerTabStop = 4,
393+ writerTabStop = 4,
394+ writerTableOfContents = False,
393− writerS5 = False,
395+ writerS5 = False,
394− writerIncremental = False,
396+ writerIncremental = False,
395− writerNumberSections = False,
397+ writerNumberSections = False,
396− writerIncludeBefore = "",
398+ writerIncludeBefore = "",
397− writerIncludeAfter = "",
399+ writerIncludeAfter = "",
398− writerStrictMarkdown = False,
400+ writerStrictMarkdown = False,
399− writerReferenceLinks = False }
401+ writerReferenceLinks = False }
400
402
401--
403--
402-- code to lookup reference keys in key table
404-- code to lookup reference keys in key table