diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2009-12-31 01:10:26 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2009-12-31 01:10:26 +0000 |
commit | b771051432be70015079ad7e5cb36afa6b6939bf (patch) | |
tree | d0a086c8d93d7466ce68784a684fd1938211521d /src | |
parent | 9f126c15cf4d0f6c2ab14167e11336d4f5f8783e (diff) | |
download | pandoc-b771051432be70015079ad7e5cb36afa6b6939bf.tar.gz |
Added -V/--variable option to set custom template variables.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1685 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'src')
-rw-r--r-- | src/markdown2pdf.hs | 5 | ||||
-rw-r--r-- | src/pandoc.hs | 13 |
2 files changed, 16 insertions, 2 deletions
diff --git a/src/markdown2pdf.hs b/src/markdown2pdf.hs index 7bcbf4a82..ea580da98 100644 --- a/src/markdown2pdf.hs +++ b/src/markdown2pdf.hs @@ -152,13 +152,14 @@ main = bracket unless (null miss) $ exit $! "Could not find " ++ intercalate ", " miss args <- getArgs -- check for invalid arguments and print help message if needed - let goodopts = ["-f","-r","-N", "-p","-R","-H","-B","-A", "-C","-o"] + let goodopts = ["-f","-r","-N", "-p","-R","-H","-B","-A", "-C","-o","-V"] let goodoptslong = ["--from","--read","--strict", "--preserve-tabs","--tab-stop","--parse-raw", "--toc","--table-of-contents", "--number-sections","--include-in-header", "--include-before-body","--include-after-body", - "--custom-header","--output"] + "--custom-header","--output", + "--template", "--variable"] let isOpt ('-':_) = True isOpt _ = False let opts = filter isOpt args diff --git a/src/pandoc.hs b/src/pandoc.hs index b595f7e50..3e9964130 100644 --- a/src/pandoc.hs +++ b/src/pandoc.hs @@ -339,6 +339,19 @@ options = "FILENAME") "" -- "Use custom template" + , Option "V" ["variable"] + (ReqArg + (\arg opt -> + case break (`elem` ":=") arg of + (k,_:v) -> do + let newvars = (k, v) : optVariables opt + return opt{ optVariables = newvars } + _ -> do + hPutStrLn stderr $ "Could not parse `" ++ arg ++ "' as a key/value pair (k=v or k:v)" + exitWith $ ExitFailure 17) + "FILENAME") + "" -- "Use custom template" + , Option "c" ["css"] (ReqArg (\arg opt -> do |