Changed --toc-level to --toc-depth.
This commit is contained in:
parent
2e0894554c
commit
c45ae571cc
7 changed files with 13 additions and 13 deletions
2
README
2
README
|
@ -296,7 +296,7 @@ General writer options
|
|||
one) in the output document. This option has no effect on `man`,
|
||||
`docbook`, `slidy`, `slideous`, or `s5` output.
|
||||
|
||||
`--toc-level=`*NUMBER*
|
||||
`--toc-depth=`*NUMBER*
|
||||
: Specify the number of section levels to include in the table
|
||||
of contents. The default is 3 (which means that level 1, 2, and 3
|
||||
headers will be listed in the contents). Implies `--toc`.
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 9575f4f56f6c59776938dfcfce7e284055937298
|
||||
Subproject commit 25ad173f00bc7e07c72468deb1d955f707aeaea0
|
12
pandoc.hs
12
pandoc.hs
|
@ -115,7 +115,7 @@ data Opt = Opt
|
|||
, optEpubMetadata :: String -- ^ EPUB metadata
|
||||
, optEpubFonts :: [FilePath] -- ^ EPUB fonts to embed
|
||||
, optEpubChapterLevel :: Int -- ^ Header level at which to split chapters
|
||||
, optTOCLevel :: Int -- ^ Number of levels to include in TOC
|
||||
, optTOCDepth :: Int -- ^ Number of levels to include in TOC
|
||||
, optDumpArgs :: Bool -- ^ Output command-line arguments
|
||||
, optIgnoreArgs :: Bool -- ^ Ignore command-line arguments
|
||||
, optReferenceLinks :: Bool -- ^ Use reference links in writing markdown, rst
|
||||
|
@ -169,7 +169,7 @@ defaultOpts = Opt
|
|||
, optEpubMetadata = ""
|
||||
, optEpubFonts = []
|
||||
, optEpubChapterLevel = 1
|
||||
, optTOCLevel = 3
|
||||
, optTOCDepth = 3
|
||||
, optDumpArgs = False
|
||||
, optIgnoreArgs = False
|
||||
, optReferenceLinks = False
|
||||
|
@ -340,12 +340,12 @@ options =
|
|||
(\opt -> return opt { optTableOfContents = True }))
|
||||
"" -- "Include table of contents"
|
||||
|
||||
, Option "" ["toc-level"]
|
||||
, Option "" ["toc-depth"]
|
||||
(ReqArg
|
||||
(\arg opt -> do
|
||||
case safeRead arg of
|
||||
Just t | t >= 1 && t <= 6 ->
|
||||
return opt { optTOCLevel = t,
|
||||
return opt { optTOCDepth = t,
|
||||
optTableOfContents = True }
|
||||
_ -> err 57 $
|
||||
"TOC level must be a number between 1 and 6")
|
||||
|
@ -831,7 +831,7 @@ main = do
|
|||
, optEpubMetadata = epubMetadata
|
||||
, optEpubFonts = epubFonts
|
||||
, optEpubChapterLevel = epubChapterLevel
|
||||
, optTOCLevel = epubTOCLevel
|
||||
, optTOCDepth = epubTOCDepth
|
||||
, optDumpArgs = dumpArgs
|
||||
, optIgnoreArgs = ignoreArgs
|
||||
, optReferenceLinks = referenceLinks
|
||||
|
@ -1022,7 +1022,7 @@ main = do
|
|||
writerEpubStylesheet = epubStylesheet,
|
||||
writerEpubFonts = epubFonts,
|
||||
writerEpubChapterLevel = epubChapterLevel,
|
||||
writerTOCLevel = epubTOCLevel,
|
||||
writerTOCDepth = epubTOCDepth,
|
||||
writerReferenceODT = referenceODT,
|
||||
writerReferenceDocx = referenceDocx
|
||||
}
|
||||
|
|
|
@ -238,7 +238,7 @@ data WriterOptions = WriterOptions
|
|||
, writerEpubStylesheet :: Maybe String -- ^ EPUB stylesheet specified at command line
|
||||
, writerEpubFonts :: [FilePath] -- ^ Paths to fonts to embed
|
||||
, writerEpubChapterLevel :: Int -- ^ Header level for chapters (separate files)
|
||||
, writerTOCLevel :: Int -- ^ Number of levels to include in TOC
|
||||
, writerTOCDepth :: Int -- ^ Number of levels to include in TOC
|
||||
, writerReferenceODT :: Maybe FilePath -- ^ Path to reference ODT if specified
|
||||
, writerReferenceDocx :: Maybe FilePath -- ^ Ptah to reference DOCX if specified
|
||||
} deriving Show
|
||||
|
@ -278,7 +278,7 @@ instance Default WriterOptions where
|
|||
, writerEpubStylesheet = Nothing
|
||||
, writerEpubFonts = []
|
||||
, writerEpubChapterLevel = 1
|
||||
, writerTOCLevel = 3
|
||||
, writerTOCDepth = 3
|
||||
, writerReferenceODT = Nothing
|
||||
, writerReferenceDocx = Nothing
|
||||
}
|
||||
|
|
|
@ -229,7 +229,7 @@ writeEPUB version opts doc@(Pandoc meta _) = do
|
|||
-- toc.ncx
|
||||
let secs = hierarchicalize blocks''
|
||||
|
||||
let tocLevel = writerTOCLevel opts
|
||||
let tocLevel = writerTOCDepth opts
|
||||
|
||||
let navPointNode :: (Int -> String -> String -> [Element] -> Element)
|
||||
-> Shared.Element -> State Int Element
|
||||
|
|
|
@ -131,7 +131,7 @@ pandocToLaTeX options (Pandoc (Meta title authors date) blocks) = do
|
|||
_ -> []
|
||||
context = writerVariables options ++
|
||||
[ ("toc", if writerTableOfContents options then "yes" else "")
|
||||
, ("toc-level", show (writerTOCLevel options -
|
||||
, ("toc-depth", show (writerTOCDepth options -
|
||||
if writerChapters options
|
||||
then 1
|
||||
else 0))
|
||||
|
|
|
@ -81,7 +81,7 @@ pandocToRST (Pandoc (Meta tit auth dat) blocks) = do
|
|||
, ("title", render Nothing title)
|
||||
, ("date", render colwidth date)
|
||||
, ("toc", if writerTableOfContents opts then "yes" else "")
|
||||
, ("toc-level", show (writerTOCLevel opts)) ] ++
|
||||
, ("toc-depth", show (writerTOCDepth opts)) ] ++
|
||||
[ ("math", "yes") | hasMath ] ++
|
||||
[ ("author", render colwidth a) | a <- authors ]
|
||||
if writerStandalone opts
|
||||
|
|
Loading…
Add table
Reference in a new issue