aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2012-03-09 10:45:01 -0800
committerJohn MacFarlane <fiddlosopher@gmail.com>2012-03-09 10:45:01 -0800
commitd4d9504950c71fdc4992a9597d2ec06adb8150db (patch)
treeb6d568545b41906397866bc0163d319703848ec6 /src
parent9766b532f38266d0606520fcbfb0c13fd5b09a2f (diff)
downloadpandoc-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.hs15
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"]