Added --number-from option and writerNumberFrom.

These still aren't hooked up to anything in the writers.
This commit is contained in:
John MacFarlane
2013-02-21 21:40:06 -08:00
parent 07e8cedf2b
commit 8df380486c
2 changed files with 15 additions and 0 deletions
+13
View File
@@ -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,
+2
View File
@@ -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