diff options
author | John MacFarlane <fiddlosopher@gmail.com> | 2012-03-09 10:45:01 -0800 |
---|---|---|
committer | John MacFarlane <fiddlosopher@gmail.com> | 2012-03-09 10:45:01 -0800 |
commit | d4d9504950c71fdc4992a9597d2ec06adb8150db (patch) | |
tree | b6d568545b41906397866bc0163d319703848ec6 /src | |
parent | 9766b532f38266d0606520fcbfb0c13fd5b09a2f (diff) | |
download | pandoc-d4d9504950c71fdc4992a9597d2ec06adb8150db.tar.gz |
Changed -V so that you can specify a key without a value.
Such keys get the value `true`.
Diffstat (limited to 'src')
-rw-r--r-- | src/pandoc.hs | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/pandoc.hs b/src/pandoc.hs index be65c8856..dab7b4161 100644 --- a/src/pandoc.hs +++ b/src/pandoc.hs @@ -295,14 +295,13 @@ options = , 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") + (\arg opt -> do + let (key,val) = case break (`elem` ":=") arg of + (k,_:v) -> (k,v) + (k,_) -> (k,"true") + let newvars = optVariables opt ++ [(key,val)] + return opt{ optVariables = newvars }) + "KEY[:VALUE]") "" -- "Use custom template" , Option "D" ["print-default-template"] |