git.iko.soy/typeable/pandoc
on master help sign in
Changed `--epub-toc-level` to `--toc-level`.

Also writerEpubTOCLevel -> writerTOCLevel. So far this is only implemented in the EPUB writer.

commit7c10e579976a3016d86b613cf4f8b25e3c01a7da authorJohn MacFarlane <fiddlosopher@gmail.com> dateSat 5 Jan 2013, 11:34 (14 years ago) parent91e8d80
4 files changed+24−23
README+5−5 pandoc.hs+16−15 src/Text/Pandoc/Options.hs+2−2 src/Text/Pandoc/Writers/EPUB.hs+1−1
README+5−5
@@ -296,6 +296,11 @@ General writer options
296296 one) in the output document. This option has no effect on `man`,
297297 `docbook`, `slidy`, `slideous`, or `s5` output.
298298
299+`--toc-level=`*NUMBER*
300+: Specify the number of section levels to include in the table
301+ of contents. The default is 3 (which means that level 1, 2, and 3
302+ headers will be listed in the contents). Implies `--toc`.
303+
299304`--no-highlight`
300305: Disables syntax highlighting for code blocks and inlines, even when
301306 a language attribute is given.
@@ -521,11 +526,6 @@ Options affecting specific writers
521526 documents with few level 1 headers, one might want to use a chapter
522527 level of 2 or 3.
523528
524−`--epub-toc-level=`*NUMBER*
525−: Specify the number of section levels to include in an EPUB's table
526− of contents. The default is 3 (which means that level 1, 2, and 3
527− headers will be listed in the contents).
528−
529529`--latex-engine=`*pdflatex|lualatex|xelatex*
530530: Use the specified LaTeX engine when producing PDF output.
531531 The default is `pdflatex`. If the engine is not in your PATH,
pandoc.hs+16−15
@@ -115,7 +115,7 @@ data Opt = Opt
115115 , optEpubMetadata :: String -- ^ EPUB metadata
116116 , optEpubFonts :: [FilePath] -- ^ EPUB fonts to embed
117117 , optEpubChapterLevel :: Int -- ^ Header level at which to split chapters
118− , optEpubTOCLevel :: Int -- ^ Number of levels to include in TOC
118+ , optTOCLevel :: Int -- ^ Number of levels to include in TOC
119119 , optDumpArgs :: Bool -- ^ Output command-line arguments
120120 , optIgnoreArgs :: Bool -- ^ Ignore command-line arguments
121121 , optReferenceLinks :: Bool -- ^ Use reference links in writing markdown, rst
@@ -169,7 +169,7 @@ defaultOpts = Opt
169169 , optEpubMetadata = ""
170170 , optEpubFonts = []
171171 , optEpubChapterLevel = 1
172− , optEpubTOCLevel = 3
172+ , optTOCLevel = 3
173173 , optDumpArgs = False
174174 , optIgnoreArgs = False
175175 , optReferenceLinks = False
@@ -340,6 +340,18 @@ options =
340340 (\opt -> return opt { optTableOfContents = True }))
341341 "" -- "Include table of contents"
342342
343+ , Option "" ["toc-level"]
344+ (ReqArg
345+ (\arg opt -> do
346+ case safeRead arg of
347+ Just t | t >= 1 && t <= 6 ->
348+ return opt { optTOCLevel = t,
349+ optTableOfContents = True }
350+ _ -> err 57 $
351+ "TOC level must be a number between 1 and 6")
352+ "NUMBER")
353+ "" -- "Number of levels to include in TOC"
354+
343355 , Option "" ["no-highlight"]
344356 (NoArg
345357 (\opt -> return opt { optHighlight = False }))
@@ -569,17 +581,6 @@ options =
569581 "NUMBER")
570582 "" -- "Header level at which to split chapters in EPUB"
571583
572− , Option "" ["epub-toc-level"]
573− (ReqArg
574− (\arg opt -> do
575− case safeRead arg of
576− Just t | t >= 1 && t <= 6 ->
577− return opt { optEpubTOCLevel = t }
578− _ -> err 57 $
579− "TOC level must be a number between 1 and 6")
580− "NUMBER")
581− "" -- "Number of levels to include in EPUB TOC"
582−
583584 , Option "" ["latex-engine"]
584585 (ReqArg
585586 (\arg opt -> do
@@ -830,7 +831,7 @@ main = do
830831 , optEpubMetadata = epubMetadata
831832 , optEpubFonts = epubFonts
832833 , optEpubChapterLevel = epubChapterLevel
833− , optEpubTOCLevel = epubTOCLevel
834+ , optTOCLevel = epubTOCLevel
834835 , optDumpArgs = dumpArgs
835836 , optIgnoreArgs = ignoreArgs
836837 , optReferenceLinks = referenceLinks
@@ -1021,7 +1022,7 @@ main = do
10211022 writerEpubStylesheet = epubStylesheet,
10221023 writerEpubFonts = epubFonts,
10231024 writerEpubChapterLevel = epubChapterLevel,
1024− writerEpubTOCLevel = epubTOCLevel,
1025+ writerTOCLevel = epubTOCLevel,
10251026 writerReferenceODT = referenceODT,
10261027 writerReferenceDocx = referenceDocx
10271028 }
src/Text/Pandoc/Options.hs+2−2
@@ -238,7 +238,7 @@ data WriterOptions = WriterOptions
238238 , writerEpubStylesheet :: Maybe String -- ^ EPUB stylesheet specified at command line
239239 , writerEpubFonts :: [FilePath] -- ^ Paths to fonts to embed
240240 , writerEpubChapterLevel :: Int -- ^ Header level for chapters (separate files)
241− , writerEpubTOCLevel :: Int -- ^ Number of levels to include in TOC
241+ , writerTOCLevel :: Int -- ^ Number of levels to include in TOC
242242 , writerReferenceODT :: Maybe FilePath -- ^ Path to reference ODT if specified
243243 , writerReferenceDocx :: Maybe FilePath -- ^ Ptah to reference DOCX if specified
244244 } deriving Show
@@ -278,7 +278,7 @@ instance Default WriterOptions where
278278 , writerEpubStylesheet = Nothing
279279 , writerEpubFonts = []
280280 , writerEpubChapterLevel = 1
281− , writerEpubTOCLevel = 3
281+ , writerTOCLevel = 3
282282 , writerReferenceODT = Nothing
283283 , writerReferenceDocx = Nothing
284284 }
src/Text/Pandoc/Writers/EPUB.hs+1−1
@@ -229,7 +229,7 @@ writeEPUB version opts doc@(Pandoc meta _) = do
229229 -- toc.ncx
230230 let secs = hierarchicalize blocks''
231231
232− let tocLevel = writerEpubTOCLevel opts
232+ let tocLevel = writerTOCLevel opts
233233
234234 let navPointNode :: (Int -> String -> String -> [Element] -> Element)
235235 -> Shared.Element -> State Int Element