aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2013-01-05 11:34:23 -0800
committerJohn MacFarlane <fiddlosopher@gmail.com>2013-01-05 11:36:55 -0800
commit7c10e579976a3016d86b613cf4f8b25e3c01a7da (patch)
tree0883efa6d3ddc4b1a53070166cd9a5da31badb97
parent91e8d80eee405e4bbb40bf247724b453187619f9 (diff)
downloadpandoc-7c10e579976a3016d86b613cf4f8b25e3c01a7da.tar.gz
Changed `--epub-toc-level` to `--toc-level`.
Also writerEpubTOCLevel -> writerTOCLevel. So far this is only implemented in the EPUB writer.
-rw-r--r--README10
-rw-r--r--pandoc.hs31
-rw-r--r--src/Text/Pandoc/Options.hs4
-rw-r--r--src/Text/Pandoc/Writers/EPUB.hs2
4 files changed, 24 insertions, 23 deletions
diff --git a/README b/README
index b7bb05ebe..d29112099 100644
--- a/README
+++ b/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,
diff --git a/pandoc.hs b/pandoc.hs
index 718c5cd45..9fca0414b 100644
--- a/pandoc.hs
+++ b/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
}
diff --git a/src/Text/Pandoc/Options.hs b/src/Text/Pandoc/Options.hs
index ef8350840..e51d7d3f6 100644
--- a/src/Text/Pandoc/Options.hs
+++ b/src/Text/Pandoc/Options.hs
@@ -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
}
diff --git a/src/Text/Pandoc/Writers/EPUB.hs b/src/Text/Pandoc/Writers/EPUB.hs
index a33428c71..9e97effeb 100644
--- a/src/Text/Pandoc/Writers/EPUB.hs
+++ b/src/Text/Pandoc/Writers/EPUB.hs
@@ -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