Changed --epub-toc-level
to --toc-level
.
Also writerEpubTOCLevel -> writerTOCLevel. So far this is only implemented in the EPUB writer.
This commit is contained in:
parent
91e8d80eee
commit
7c10e57997
4 changed files with 24 additions and 23 deletions
10
README
10
README
|
@ -296,6 +296,11 @@ General writer options
|
|||
one) in the output document. This option has no effect on `man`,
|
||||
`docbook`, `slidy`, `slideous`, or `s5` output.
|
||||
|
||||
`--toc-level=`*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`.
|
||||
|
||||
`--no-highlight`
|
||||
: Disables syntax highlighting for code blocks and inlines, even when
|
||||
a language attribute is given.
|
||||
|
@ -521,11 +526,6 @@ Options affecting specific writers
|
|||
documents with few level 1 headers, one might want to use a chapter
|
||||
level of 2 or 3.
|
||||
|
||||
`--epub-toc-level=`*NUMBER*
|
||||
: Specify the number of section levels to include in an EPUB's table
|
||||
of contents. The default is 3 (which means that level 1, 2, and 3
|
||||
headers will be listed in the contents).
|
||||
|
||||
`--latex-engine=`*pdflatex|lualatex|xelatex*
|
||||
: Use the specified LaTeX engine when producing PDF output.
|
||||
The default is `pdflatex`. If the engine is not in your PATH,
|
||||
|
|
31
pandoc.hs
31
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
|
||||
, optEpubTOCLevel :: Int -- ^ Number of levels to include in TOC
|
||||
, optTOCLevel :: 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
|
||||
, optEpubTOCLevel = 3
|
||||
, optTOCLevel = 3
|
||||
, optDumpArgs = False
|
||||
, optIgnoreArgs = False
|
||||
, optReferenceLinks = False
|
||||
|
@ -340,6 +340,18 @@ options =
|
|||
(\opt -> return opt { optTableOfContents = True }))
|
||||
"" -- "Include table of contents"
|
||||
|
||||
, Option "" ["toc-level"]
|
||||
(ReqArg
|
||||
(\arg opt -> do
|
||||
case safeRead arg of
|
||||
Just t | t >= 1 && t <= 6 ->
|
||||
return opt { optTOCLevel = t,
|
||||
optTableOfContents = True }
|
||||
_ -> err 57 $
|
||||
"TOC level must be a number between 1 and 6")
|
||||
"NUMBER")
|
||||
"" -- "Number of levels to include in TOC"
|
||||
|
||||
, Option "" ["no-highlight"]
|
||||
(NoArg
|
||||
(\opt -> return opt { optHighlight = False }))
|
||||
|
@ -569,17 +581,6 @@ options =
|
|||
"NUMBER")
|
||||
"" -- "Header level at which to split chapters in EPUB"
|
||||
|
||||
, Option "" ["epub-toc-level"]
|
||||
(ReqArg
|
||||
(\arg opt -> do
|
||||
case safeRead arg of
|
||||
Just t | t >= 1 && t <= 6 ->
|
||||
return opt { optEpubTOCLevel = t }
|
||||
_ -> err 57 $
|
||||
"TOC level must be a number between 1 and 6")
|
||||
"NUMBER")
|
||||
"" -- "Number of levels to include in EPUB TOC"
|
||||
|
||||
, Option "" ["latex-engine"]
|
||||
(ReqArg
|
||||
(\arg opt -> do
|
||||
|
@ -830,7 +831,7 @@ main = do
|
|||
, optEpubMetadata = epubMetadata
|
||||
, optEpubFonts = epubFonts
|
||||
, optEpubChapterLevel = epubChapterLevel
|
||||
, optEpubTOCLevel = epubTOCLevel
|
||||
, optTOCLevel = epubTOCLevel
|
||||
, optDumpArgs = dumpArgs
|
||||
, optIgnoreArgs = ignoreArgs
|
||||
, optReferenceLinks = referenceLinks
|
||||
|
@ -1021,7 +1022,7 @@ main = do
|
|||
writerEpubStylesheet = epubStylesheet,
|
||||
writerEpubFonts = epubFonts,
|
||||
writerEpubChapterLevel = epubChapterLevel,
|
||||
writerEpubTOCLevel = epubTOCLevel,
|
||||
writerTOCLevel = epubTOCLevel,
|
||||
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)
|
||||
, writerEpubTOCLevel :: Int -- ^ Number of levels to include in TOC
|
||||
, writerTOCLevel :: 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
|
||||
, writerEpubTOCLevel = 3
|
||||
, writerTOCLevel = 3
|
||||
, writerReferenceODT = Nothing
|
||||
, writerReferenceDocx = Nothing
|
||||
}
|
||||
|
|
|
@ -229,7 +229,7 @@ writeEPUB version opts doc@(Pandoc meta _) = do
|
|||
-- toc.ncx
|
||||
let secs = hierarchicalize blocks''
|
||||
|
||||
let tocLevel = writerEpubTOCLevel opts
|
||||
let tocLevel = writerTOCLevel opts
|
||||
|
||||
let navPointNode :: (Int -> String -> String -> [Element] -> Element)
|
||||
-> Shared.Element -> State Int Element
|
||||
|
|
Loading…
Reference in a new issue