aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pandoc.hs13
-rw-r--r--src/Text/Pandoc/Options.hs2
2 files changed, 15 insertions, 0 deletions
diff --git a/pandoc.hs b/pandoc.hs
index 203dcf882..1c984f681 100644
--- a/pandoc.hs
+++ b/pandoc.hs
@@ -100,6 +100,7 @@ data Opt = Opt
, optVariables :: [(String,String)] -- ^ Template variables to set
, optOutputFile :: String -- ^ Name of output file
, optNumberSections :: Bool -- ^ Number sections in LaTeX
+ , optNumberFrom :: Int -- ^ Starting number for sections
, optSectionDivs :: Bool -- ^ Put sections in div tags in HTML
, optIncremental :: Bool -- ^ Use incremental lists in Slidy/Slideous/S5
, optSelfContained :: Bool -- ^ Make HTML accessible offline
@@ -156,6 +157,7 @@ defaultOpts = Opt
, optVariables = []
, optOutputFile = "-" -- "-" means stdout
, optNumberSections = False
+ , optNumberFrom = 1
, optSectionDivs = False
, optIncremental = False
, optSelfContained = False
@@ -467,6 +469,15 @@ options =
(\opt -> return opt { optNumberSections = True }))
"" -- "Number sections in LaTeX"
+ , Option "" ["number-from"]
+ (ReqArg
+ (\arg opt ->
+ case safeRead arg of
+ Just n -> return opt { optNumberFrom = n }
+ _ -> err 57 "could not parse number-from")
+ "NUMBER")
+ "" -- "Starting number for sections"
+
, Option "" ["no-tex-ligatures"]
(NoArg
(\opt -> return opt { optTeXLigatures = False }))
@@ -829,6 +840,7 @@ main = do
, optTemplate = templatePath
, optOutputFile = outputFile
, optNumberSections = numberSections
+ , optNumberFrom = numberFrom
, optSectionDivs = sectionDivs
, optIncremental = incremental
, optSelfContained = selfContained
@@ -1022,6 +1034,7 @@ main = do
writerBiblioFiles = reffiles,
writerIgnoreNotes = False,
writerNumberSections = numberSections,
+ writerNumberFrom = numberFrom,
writerSectionDivs = sectionDivs,
writerReferenceLinks = referenceLinks,
writerWrapText = wrap,
diff --git a/src/Text/Pandoc/Options.hs b/src/Text/Pandoc/Options.hs
index 1ba8a6dd6..ab5cf4c43 100644
--- a/src/Text/Pandoc/Options.hs
+++ b/src/Text/Pandoc/Options.hs
@@ -270,6 +270,7 @@ data WriterOptions = WriterOptions
, writerHTMLMathMethod :: HTMLMathMethod -- ^ How to print math in HTML
, writerIgnoreNotes :: Bool -- ^ Ignore footnotes (used in making toc)
, writerNumberSections :: Bool -- ^ Number sections in LaTeX
+ , writerNumberFrom :: Int -- ^ Starting section number
, writerSectionDivs :: Bool -- ^ Put sections in div tags in HTML
, writerExtensions :: Set Extension -- ^ Markdown extensions that can be used
, writerReferenceLinks :: Bool -- ^ Use reference links in writing markdown, rst
@@ -313,6 +314,7 @@ instance Default WriterOptions where
, writerHTMLMathMethod = PlainMath
, writerIgnoreNotes = False
, writerNumberSections = False
+ , writerNumberFrom = 1
, writerSectionDivs = False
, writerExtensions = pandocExtensions
, writerReferenceLinks = False