git.iko.soy/typeable/pandoc
on master help sign in
Added `--number-from` option and `writerNumberFrom`.

These still aren't hooked up to anything in the writers.

commit8df380486c986141ea448e74cdd37e4faae773a1 authorJohn MacFarlane <fiddlosopher@gmail.com> dateThu 21 Feb 2013, 21:40 (14 years ago) parent07e8ced
2 files changed+15
pandoc.hs+13 src/Text/Pandoc/Options.hs+2
pandoc.hs+13
@@ -100,6 +100,7 @@ data Opt = Opt
100100 , optVariables :: [(String,String)] -- ^ Template variables to set
101101 , optOutputFile :: String -- ^ Name of output file
102102 , optNumberSections :: Bool -- ^ Number sections in LaTeX
103+ , optNumberFrom :: Int -- ^ Starting number for sections
103104 , optSectionDivs :: Bool -- ^ Put sections in div tags in HTML
104105 , optIncremental :: Bool -- ^ Use incremental lists in Slidy/Slideous/S5
105106 , optSelfContained :: Bool -- ^ Make HTML accessible offline
@@ -156,6 +157,7 @@ defaultOpts = Opt
156157 , optVariables = []
157158 , optOutputFile = "-" -- "-" means stdout
158159 , optNumberSections = False
160+ , optNumberFrom = 1
159161 , optSectionDivs = False
160162 , optIncremental = False
161163 , optSelfContained = False
@@ -467,6 +469,15 @@ options =
467469 (\opt -> return opt { optNumberSections = True }))
468470 "" -- "Number sections in LaTeX"
469471
472+ , Option "" ["number-from"]
473+ (ReqArg
474+ (\arg opt ->
475+ case safeRead arg of
476+ Just n -> return opt { optNumberFrom = n }
477+ _ -> err 57 "could not parse number-from")
478+ "NUMBER")
479+ "" -- "Starting number for sections"
480+
470481 , Option "" ["no-tex-ligatures"]
471482 (NoArg
472483 (\opt -> return opt { optTeXLigatures = False }))
@@ -829,6 +840,7 @@ main = do
829840 , optTemplate = templatePath
830841 , optOutputFile = outputFile
831842 , optNumberSections = numberSections
843+ , optNumberFrom = numberFrom
832844 , optSectionDivs = sectionDivs
833845 , optIncremental = incremental
834846 , optSelfContained = selfContained
@@ -1022,6 +1034,7 @@ main = do
10221034 writerBiblioFiles = reffiles,
10231035 writerIgnoreNotes = False,
10241036 writerNumberSections = numberSections,
1037+ writerNumberFrom = numberFrom,
10251038 writerSectionDivs = sectionDivs,
10261039 writerReferenceLinks = referenceLinks,
10271040 writerWrapText = wrap,
src/Text/Pandoc/Options.hs+2
@@ -270,6 +270,7 @@ data WriterOptions = WriterOptions
270270 , writerHTMLMathMethod :: HTMLMathMethod -- ^ How to print math in HTML
271271 , writerIgnoreNotes :: Bool -- ^ Ignore footnotes (used in making toc)
272272 , writerNumberSections :: Bool -- ^ Number sections in LaTeX
273+ , writerNumberFrom :: Int -- ^ Starting section number
273274 , writerSectionDivs :: Bool -- ^ Put sections in div tags in HTML
274275 , writerExtensions :: Set Extension -- ^ Markdown extensions that can be used
275276 , writerReferenceLinks :: Bool -- ^ Use reference links in writing markdown, rst
@@ -313,6 +314,7 @@ instance Default WriterOptions where
313314 , writerHTMLMathMethod = PlainMath
314315 , writerIgnoreNotes = False
315316 , writerNumberSections = False
317+ , writerNumberFrom = 1
316318 , writerSectionDivs = False
317319 , writerExtensions = pandocExtensions
318320 , writerReferenceLinks = False