diff options
author | John MacFarlane <fiddlosopher@gmail.com> | 2012-01-25 22:45:49 -0800 |
---|---|---|
committer | John MacFarlane <fiddlosopher@gmail.com> | 2012-01-25 22:45:49 -0800 |
commit | 1470aad04b61ffdcb17c34aa68541ba79043b5e6 (patch) | |
tree | d436d851c4c86c8acd3239cee7f6e9627f1e0f6b | |
parent | 47bb165a657884d98aceb071d163cf1fc513405a (diff) |
Reorganized --help output to match order of options in man page.
-rw-r--r-- | src/pandoc.hs | 417 |
1 files changed, 209 insertions, 208 deletions
diff --git a/src/pandoc.hs b/src/pandoc.hs index 08b5dec57..a8f134e44 100644 --- a/src/pandoc.hs +++ b/src/pandoc.hs @@ -200,48 +200,23 @@ options = "FORMAT") "" - , Option "s" ["standalone"] - (NoArg - (\opt -> return opt { optStandalone = True })) - "" -- "Include needed header and footer on output" - , Option "o" ["output"] (ReqArg (\arg opt -> return opt { optOutputFile = arg }) "FILENAME") "" -- "Name of output file" - , Option "p" ["preserve-tabs"] - (NoArg - (\opt -> return opt { optPreserveTabs = True })) - "" -- "Preserve tabs instead of converting to spaces" - - , Option "" ["tab-stop"] + , Option "" ["data-dir"] (ReqArg - (\arg opt -> - case reads arg of - [(t,"")] | t > 0 -> return opt { optTabStop = t } - _ -> err 31 - "tab-stop must be a number greater than 0") - "NUMBER") - "" -- "Tab stop (default 4)" + (\arg opt -> return opt { optDataDir = Just arg }) + "DIRECTORY") -- "Directory containing pandoc data files." + "" , Option "" ["strict"] (NoArg (\opt -> return opt { optStrict = True } )) "" -- "Disable markdown syntax extensions" - , Option "" ["normalize"] - (NoArg - (\opt -> return opt { optTransforms = - normalize : optTransforms opt } )) - "" -- "Normalize the Pandoc AST" - - , Option "" ["reference-links"] - (NoArg - (\opt -> return opt { optReferenceLinks = True } )) - "" -- "Use reference links in parsing HTML" - , Option "R" ["parse-raw"] (NoArg (\opt -> return opt { optParseRaw = True })) @@ -258,13 +233,103 @@ options = , optOldDashes = True })) "" -- "Use smart quotes, dashes, and ellipses" - , Option "5" ["html5"] + , Option "" ["base-header-level"] + (ReqArg + (\arg opt -> + case reads arg of + [(t,"")] | t > 0 -> do + let oldTransforms = optTransforms opt + let shift = t - 1 + return opt{ optTransforms = + headerShift shift : oldTransforms } + _ -> err 19 + "base-header-level must be a number > 0") + "NUMBER") + "" -- "Headers base level" + + , Option "" ["indented-code-classes"] + (ReqArg + (\arg opt -> return opt { optIndentedCodeClasses = words $ + map (\c -> if c == ',' then ' ' else c) arg }) + "STRING") + "" -- "Classes (whitespace- or comma-separated) to use for indented code-blocks" + + , Option "" ["normalize"] (NoArg - (\opt -> do - warn $ "--html5 is deprecated. " - ++ "Use the html5 output format instead." - return opt { optHtml5 = True })) - "" -- "Produce HTML5 in HTML output" + (\opt -> return opt { optTransforms = + normalize : optTransforms opt } )) + "" -- "Normalize the Pandoc AST" + + , Option "p" ["preserve-tabs"] + (NoArg + (\opt -> return opt { optPreserveTabs = True })) + "" -- "Preserve tabs instead of converting to spaces" + + , Option "" ["tab-stop"] + (ReqArg + (\arg opt -> + case reads arg of + [(t,"")] | t > 0 -> return opt { optTabStop = t } + _ -> err 31 + "tab-stop must be a number greater than 0") + "NUMBER") + "" -- "Tab stop (default 4)" + + , Option "s" ["standalone"] + (NoArg + (\opt -> return opt { optStandalone = True })) + "" -- "Include needed header and footer on output" + + , Option "" ["template"] + (ReqArg + (\arg opt -> do + return opt{ optTemplate = Just arg, + optStandalone = True }) + "FILENAME") + "" -- "Use custom template" + + , Option "V" ["variable"] + (ReqArg + (\arg opt -> + case break (`elem` ":=") arg of + (k,_:v) -> do + let newvars = optVariables opt ++ [(k,v)] + return opt{ optVariables = newvars } + _ -> err 17 $ + "Could not parse `" ++ arg ++ "' as a key/value pair (k=v or k:v)") + "KEY:VALUE") + "" -- "Use custom template" + + , Option "D" ["print-default-template"] + (ReqArg + (\arg _ -> do + templ <- getDefaultTemplate Nothing arg + case templ of + Right t -> UTF8.hPutStr stdout t + Left e -> error $ show e + exitWith ExitSuccess) + "FORMAT") + "" -- "Print default template for FORMAT" + + , Option "" ["no-wrap"] + (NoArg + (\opt -> return opt { optWrapText = False })) + "" -- "Do not wrap text in output" + + , Option "" ["columns"] + (ReqArg + (\arg opt -> + case reads arg of + [(t,"")] | t > 0 -> return opt { optColumns = t } + _ -> err 33 $ + "columns must be a number greater than 0") + "NUMBER") + "" -- "Length of line in characters" + + , Option "" ["toc", "table-of-contents"] + (NoArg + (\opt -> return opt { optTableOfContents = True })) + "" -- "Include table of contents" , Option "" ["no-highlight"] (NoArg @@ -287,65 +352,46 @@ options = "STYLE") "" -- "Style for highlighted code" - , Option "m" ["latexmathml", "asciimathml"] - (OptArg - (\arg opt -> - return opt { optHTMLMathMethod = LaTeXMathML arg }) - "URL") - "" -- "Use LaTeXMathML script in html output" - - , Option "" ["mathml"] - (OptArg - (\arg opt -> - return opt { optHTMLMathMethod = MathML arg }) - "URL") - "" -- "Use mathml for HTML math" - - , Option "" ["mimetex"] - (OptArg + , Option "H" ["include-in-header"] + (ReqArg (\arg opt -> do - let url' = case arg of - Just u -> u ++ "?" - Nothing -> "/cgi-bin/mimetex.cgi?" - return opt { optHTMLMathMethod = WebTeX url' }) - "URL") - "" -- "Use mimetex for HTML math" + text <- UTF8.readFile arg + -- add new ones to end, so they're included in order specified + let newvars = optVariables opt ++ [("header-includes",text)] + return opt { optVariables = newvars, + optStandalone = True }) + "FILENAME") + "" -- "File to include at end of header (implies -s)" - , Option "" ["webtex"] - (OptArg + , Option "B" ["include-before-body"] + (ReqArg (\arg opt -> do - let url' = case arg of - Just u -> u - Nothing -> "http://chart.apis.google.com/chart?cht=tx&chl=" - return opt { optHTMLMathMethod = WebTeX url' }) - "URL") - "" -- "Use web service for HTML math" - - , Option "" ["jsmath"] - (OptArg - (\arg opt -> return opt { optHTMLMathMethod = JsMath arg}) - "URL") - "" -- "Use jsMath for HTML math" + text <- UTF8.readFile arg + -- add new ones to end, so they're included in order specified + let newvars = optVariables opt ++ [("include-before",text)] + return opt { optVariables = newvars, + optStandalone = True }) + "FILENAME") + "" -- "File to include before document body" - , Option "" ["mathjax"] - (OptArg + , Option "A" ["include-after-body"] + (ReqArg (\arg opt -> do - let url' = case arg of - Just u -> u - Nothing -> "https://d3eoax9i5htok0.cloudfront.net/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" - return opt { optHTMLMathMethod = MathJax url'}) - "URL") - "" -- "Use MathJax for HTML math" - - , Option "" ["gladtex"] - (NoArg - (\opt -> return opt { optHTMLMathMethod = GladTeX })) - "" -- "Use gladtex for HTML math" + text <- UTF8.readFile arg + -- add new ones to end, so they're included in order specified + let newvars = optVariables opt ++ [("include-after",text)] + return opt { optVariables = newvars, + optStandalone = True }) + "FILENAME") + "" -- "File to include after document body" - , Option "i" ["incremental"] + , Option "" ["self-contained"] (NoArg - (\opt -> return opt { optIncremental = True })) - "" -- "Make list items display incrementally in Slidy/S5" + (\opt -> return opt { optSelfContained = True, + optVariables = ("slidy-url","slidy") : + optVariables opt, + optStandalone = True })) + "" -- "Make slide shows include all the needed js and css" , Option "" ["offline"] (NoArg @@ -355,13 +401,18 @@ options = "" -- "Make slide shows include all the needed js and css" -- deprecated synonym for --self-contained - , Option "" ["self-contained"] + , Option "5" ["html5"] (NoArg - (\opt -> return opt { optSelfContained = True, - optVariables = ("slidy-url","slidy") : - optVariables opt, - optStandalone = True })) - "" -- "Make slide shows include all the needed js and css" + (\opt -> do + warn $ "--html5 is deprecated. " + ++ "Use the html5 output format instead." + return opt { optHtml5 = True })) + "" -- "Produce HTML5 in HTML output" + + , Option "" ["reference-links"] + (NoArg + (\opt -> return opt { optReferenceLinks = True } )) + "" -- "Use reference links in parsing HTML" , Option "" ["chapters"] (NoArg @@ -383,6 +434,11 @@ options = (\opt -> return opt { optBeamer = True })) "" -- "Produce latex output for beamer class" + , Option "i" ["incremental"] + (NoArg + (\opt -> return opt { optIncremental = True })) + "" -- "Make list items display incrementally in Slidy/S5" + , Option "" ["slide-level"] (ReqArg (\arg opt -> do @@ -399,21 +455,6 @@ options = (\opt -> return opt { optSectionDivs = True })) "" -- "Put sections in div tags in HTML" - , Option "" ["no-wrap"] - (NoArg - (\opt -> return opt { optWrapText = False })) - "" -- "Do not wrap text in output" - - , Option "" ["columns"] - (ReqArg - (\arg opt -> - case reads arg of - [(t,"")] | t > 0 -> return opt { optColumns = t } - _ -> err 33 $ - "columns must be a number greater than 0") - "NUMBER") - "" -- "Length of line in characters" - , Option "" ["email-obfuscation"] (ReqArg (\arg opt -> do @@ -433,51 +474,14 @@ options = "STRING") "" -- "Prefix to add to automatically generated HTML identifiers" - , Option "" ["indented-code-classes"] - (ReqArg - (\arg opt -> return opt { optIndentedCodeClasses = words $ - map (\c -> if c == ',' then ' ' else c) arg }) - "STRING") - "" -- "Classes (whitespace- or comma-separated) to use for indented code-blocks" - - , Option "" ["toc", "table-of-contents"] - (NoArg - (\opt -> return opt { optTableOfContents = True })) - "" -- "Include table of contents" - - , Option "" ["base-header-level"] - (ReqArg - (\arg opt -> - case reads arg of - [(t,"")] | t > 0 -> do - let oldTransforms = optTransforms opt - let shift = t - 1 - return opt{ optTransforms = - headerShift shift : oldTransforms } - _ -> err 19 - "base-header-level must be a number > 0") - "NUMBER") - "" -- "Headers base level" - - , Option "" ["template"] + , Option "T" ["title-prefix"] (ReqArg (\arg opt -> do - return opt{ optTemplate = Just arg, + let newvars = ("title-prefix", arg) : optVariables opt + return opt { optVariables = newvars, optStandalone = True }) - "FILENAME") - "" -- "Use custom template" - - , Option "V" ["variable"] - (ReqArg - (\arg opt -> - case break (`elem` ":=") arg of - (k,_:v) -> do - let newvars = optVariables opt ++ [(k,v)] - return opt{ optVariables = newvars } - _ -> err 17 $ - "Could not parse `" ++ arg ++ "' as a key/value pair (k=v or k:v)") - "KEY:VALUE") - "" -- "Use custom template" + "STRING") + "" -- "String to prefix to HTML window title" , Option "c" ["css"] (ReqArg @@ -489,48 +493,6 @@ options = "URL") "" -- "Link to CSS style sheet" - , Option "H" ["include-in-header"] - (ReqArg - (\arg opt -> do - text <- UTF8.readFile arg - -- add new ones to end, so they're included in order specified - let newvars = optVariables opt ++ [("header-includes",text)] - return opt { optVariables = newvars, - optStandalone = True }) - "FILENAME") - "" -- "File to include at end of header (implies -s)" - - , Option "B" ["include-before-body"] - (ReqArg - (\arg opt -> do - text <- UTF8.readFile arg - -- add new ones to end, so they're included in order specified - let newvars = optVariables opt ++ [("include-before",text)] - return opt { optVariables = newvars, - optStandalone = True }) - "FILENAME") - "" -- "File to include before document body" - - , Option "A" ["include-after-body"] - (ReqArg - (\arg opt -> do - text <- UTF8.readFile arg - -- add new ones to end, so they're included in order specified - let newvars = optVariables opt ++ [("include-after",text)] - return opt { optVariables = newvars, - optStandalone = True }) - "FILENAME") - "" -- "File to include after document body" - - , Option "T" ["title-prefix"] - (ReqArg - (\arg opt -> do - let newvars = ("title-prefix", arg) : optVariables opt - return opt { optVariables = newvars, - optStandalone = True }) - "STRING") - "" -- "String to prefix to HTML window title" - , Option "" ["reference-odt"] (ReqArg (\arg opt -> do @@ -579,17 +541,6 @@ options = "PROGRAM") "" -- "Name of latex program to use in generating PDF" - , Option "D" ["print-default-template"] - (ReqArg - (\arg _ -> do - templ <- getDefaultTemplate Nothing arg - case templ of - Right t -> UTF8.hPutStr stdout t - Left e -> error $ show e - exitWith ExitSuccess) - "FORMAT") - "" -- "Print default template for FORMAT" - , Option "" ["bibliography"] (ReqArg (\arg opt -> return opt { optBibliography = (optBibliography opt) ++ [arg] }) @@ -618,11 +569,60 @@ options = (\opt -> return opt { optCiteMethod = Biblatex })) "" -- "Use biblatex cite commands in LaTeX output" - , Option "" ["data-dir"] - (ReqArg - (\arg opt -> return opt { optDataDir = Just arg }) - "DIRECTORY") -- "Directory containing pandoc data files." - "" + , Option "m" ["latexmathml", "asciimathml"] + (OptArg + (\arg opt -> + return opt { optHTMLMathMethod = LaTeXMathML arg }) + "URL") + "" -- "Use LaTeXMathML script in html output" + + , Option "" ["mathml"] + (OptArg + (\arg opt -> + return opt { optHTMLMathMethod = MathML arg }) + "URL") + "" -- "Use mathml for HTML math" + + , Option "" ["mimetex"] + (OptArg + (\arg opt -> do + let url' = case arg of + Just u -> u ++ "?" + Nothing -> "/cgi-bin/mimetex.cgi?" + return opt { optHTMLMathMethod = WebTeX url' }) + "URL") + "" -- "Use mimetex for HTML math" + + , Option "" ["webtex"] + (OptArg + (\arg opt -> do + let url' = case arg of + Just u -> u + Nothing -> "http://chart.apis.google.com/chart?cht=tx&chl=" + return opt { optHTMLMathMethod = WebTeX url' }) + "URL") + "" -- "Use web service for HTML math" + + , Option "" ["jsmath"] + (OptArg + (\arg opt -> return opt { optHTMLMathMethod = JsMath arg}) + "URL") + "" -- "Use jsMath for HTML math" + + , Option "" ["mathjax"] + (OptArg + (\arg opt -> do + let url' = case arg of + Just u -> u + Nothing -> "https://d3eoax9i5htok0.cloudfront.net/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" + return opt { optHTMLMathMethod = MathJax url'}) + "URL") + "" -- "Use MathJax for HTML math" + + , Option "" ["gladtex"] + (NoArg + (\opt -> return opt { optHTMLMathMethod = GladTeX })) + "" -- "Use gladtex for HTML math" , Option "" ["dump-args"] (NoArg @@ -650,6 +650,7 @@ options = UTF8.hPutStr stdout (usageMessage prg options) exitWith ExitSuccess )) "" -- "Show help" + ] -- Unescapes XML entities |