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`,
|
one) in the output document. This option has no effect on `man`,
|
||||||
`docbook`, `slidy`, `slideous`, or `s5` output.
|
`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`
|
`--no-highlight`
|
||||||
: Disables syntax highlighting for code blocks and inlines, even when
|
: Disables syntax highlighting for code blocks and inlines, even when
|
||||||
a language attribute is given.
|
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
|
documents with few level 1 headers, one might want to use a chapter
|
||||||
level of 2 or 3.
|
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*
|
`--latex-engine=`*pdflatex|lualatex|xelatex*
|
||||||
: Use the specified LaTeX engine when producing PDF output.
|
: Use the specified LaTeX engine when producing PDF output.
|
||||||
The default is `pdflatex`. If the engine is not in your PATH,
|
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
|
, optEpubMetadata :: String -- ^ EPUB metadata
|
||||||
, optEpubFonts :: [FilePath] -- ^ EPUB fonts to embed
|
, optEpubFonts :: [FilePath] -- ^ EPUB fonts to embed
|
||||||
, optEpubChapterLevel :: Int -- ^ Header level at which to split chapters
|
, 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
|
, optDumpArgs :: Bool -- ^ Output command-line arguments
|
||||||
, optIgnoreArgs :: Bool -- ^ Ignore command-line arguments
|
, optIgnoreArgs :: Bool -- ^ Ignore command-line arguments
|
||||||
, optReferenceLinks :: Bool -- ^ Use reference links in writing markdown, rst
|
, optReferenceLinks :: Bool -- ^ Use reference links in writing markdown, rst
|
||||||
|
@ -169,7 +169,7 @@ defaultOpts = Opt
|
||||||
, optEpubMetadata = ""
|
, optEpubMetadata = ""
|
||||||
, optEpubFonts = []
|
, optEpubFonts = []
|
||||||
, optEpubChapterLevel = 1
|
, optEpubChapterLevel = 1
|
||||||
, optEpubTOCLevel = 3
|
, optTOCLevel = 3
|
||||||
, optDumpArgs = False
|
, optDumpArgs = False
|
||||||
, optIgnoreArgs = False
|
, optIgnoreArgs = False
|
||||||
, optReferenceLinks = False
|
, optReferenceLinks = False
|
||||||
|
@ -340,6 +340,18 @@ options =
|
||||||
(\opt -> return opt { optTableOfContents = True }))
|
(\opt -> return opt { optTableOfContents = True }))
|
||||||
"" -- "Include table of contents"
|
"" -- "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"]
|
, Option "" ["no-highlight"]
|
||||||
(NoArg
|
(NoArg
|
||||||
(\opt -> return opt { optHighlight = False }))
|
(\opt -> return opt { optHighlight = False }))
|
||||||
|
@ -569,17 +581,6 @@ options =
|
||||||
"NUMBER")
|
"NUMBER")
|
||||||
"" -- "Header level at which to split chapters in EPUB"
|
"" -- "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"]
|
, Option "" ["latex-engine"]
|
||||||
(ReqArg
|
(ReqArg
|
||||||
(\arg opt -> do
|
(\arg opt -> do
|
||||||
|
@ -830,7 +831,7 @@ main = do
|
||||||
, optEpubMetadata = epubMetadata
|
, optEpubMetadata = epubMetadata
|
||||||
, optEpubFonts = epubFonts
|
, optEpubFonts = epubFonts
|
||||||
, optEpubChapterLevel = epubChapterLevel
|
, optEpubChapterLevel = epubChapterLevel
|
||||||
, optEpubTOCLevel = epubTOCLevel
|
, optTOCLevel = epubTOCLevel
|
||||||
, optDumpArgs = dumpArgs
|
, optDumpArgs = dumpArgs
|
||||||
, optIgnoreArgs = ignoreArgs
|
, optIgnoreArgs = ignoreArgs
|
||||||
, optReferenceLinks = referenceLinks
|
, optReferenceLinks = referenceLinks
|
||||||
|
@ -1021,7 +1022,7 @@ main = do
|
||||||
writerEpubStylesheet = epubStylesheet,
|
writerEpubStylesheet = epubStylesheet,
|
||||||
writerEpubFonts = epubFonts,
|
writerEpubFonts = epubFonts,
|
||||||
writerEpubChapterLevel = epubChapterLevel,
|
writerEpubChapterLevel = epubChapterLevel,
|
||||||
writerEpubTOCLevel = epubTOCLevel,
|
writerTOCLevel = epubTOCLevel,
|
||||||
writerReferenceODT = referenceODT,
|
writerReferenceODT = referenceODT,
|
||||||
writerReferenceDocx = referenceDocx
|
writerReferenceDocx = referenceDocx
|
||||||
}
|
}
|
||||||
|
|
|
@ -238,7 +238,7 @@ data WriterOptions = WriterOptions
|
||||||
, writerEpubStylesheet :: Maybe String -- ^ EPUB stylesheet specified at command line
|
, writerEpubStylesheet :: Maybe String -- ^ EPUB stylesheet specified at command line
|
||||||
, writerEpubFonts :: [FilePath] -- ^ Paths to fonts to embed
|
, writerEpubFonts :: [FilePath] -- ^ Paths to fonts to embed
|
||||||
, writerEpubChapterLevel :: Int -- ^ Header level for chapters (separate files)
|
, 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
|
, writerReferenceODT :: Maybe FilePath -- ^ Path to reference ODT if specified
|
||||||
, writerReferenceDocx :: Maybe FilePath -- ^ Ptah to reference DOCX if specified
|
, writerReferenceDocx :: Maybe FilePath -- ^ Ptah to reference DOCX if specified
|
||||||
} deriving Show
|
} deriving Show
|
||||||
|
@ -278,7 +278,7 @@ instance Default WriterOptions where
|
||||||
, writerEpubStylesheet = Nothing
|
, writerEpubStylesheet = Nothing
|
||||||
, writerEpubFonts = []
|
, writerEpubFonts = []
|
||||||
, writerEpubChapterLevel = 1
|
, writerEpubChapterLevel = 1
|
||||||
, writerEpubTOCLevel = 3
|
, writerTOCLevel = 3
|
||||||
, writerReferenceODT = Nothing
|
, writerReferenceODT = Nothing
|
||||||
, writerReferenceDocx = Nothing
|
, writerReferenceDocx = Nothing
|
||||||
}
|
}
|
||||||
|
|
|
@ -229,7 +229,7 @@ writeEPUB version opts doc@(Pandoc meta _) = do
|
||||||
-- toc.ncx
|
-- toc.ncx
|
||||||
let secs = hierarchicalize blocks''
|
let secs = hierarchicalize blocks''
|
||||||
|
|
||||||
let tocLevel = writerEpubTOCLevel opts
|
let tocLevel = writerTOCLevel opts
|
||||||
|
|
||||||
let navPointNode :: (Int -> String -> String -> [Element] -> Element)
|
let navPointNode :: (Int -> String -> String -> [Element] -> Element)
|
||||||
-> Shared.Element -> State Int Element
|
-> Shared.Element -> State Int Element
|
||||||
|
|
Loading…
Add table
Reference in a new issue