git.iko.soy/typeable/pandoc
on master help sign in
Changed -V so that you can specify a key without a value.

Such keys get the value `true`.

commitd4d9504950c71fdc4992a9597d2ec06adb8150db authorJohn MacFarlane <fiddlosopher@gmail.com> dateFri 9 Mar 2012, 10:45 (15 years ago) parent9766b53
2 files changed+10−10
README+3−2 src/pandoc.hs+7−8
README+3−2
@@ -256,12 +256,13 @@ General writer options
256256 template appropriate for the output format will be used (see
257257 `-D/--print-default-template`).
258258
259−`-V` *KEY=VAL*, `--variable=`*KEY:VAL*
259+`-V` *KEY[=VAL]*, `--variable=`*KEY[:VAL]*
260260: Set the template variable *KEY* to the value *VAL* when rendering the
261261 document in standalone mode. This is generally only useful when the
262262 `--template` option is used to specify a custom template, since
263263 pandoc automatically sets the variables used in the default
264− templates.
264+ templates. If no *VAL* is specified, the key will be given the
265+ value `true`.
265266
266267`-D` *FORMAT*, `--print-default-template=`*FORMAT*
267268: Print the default template for an output *FORMAT*. (See `-t`
src/pandoc.hs+7−8
@@ -295,14 +295,13 @@ options =
295295
296296 , Option "V" ["variable"]
297297 (ReqArg
298− (\arg opt ->
299− case break (`elem` ":=") arg of
300− (k,_:v) -> do
301− let newvars = optVariables opt ++ [(k,v)]
302− return opt{ optVariables = newvars }
303− _ -> err 17 $
304− "Could not parse `" ++ arg ++ "' as a key/value pair (k=v or k:v)")
305− "KEY:VALUE")
298+ (\arg opt -> do
299+ let (key,val) = case break (`elem` ":=") arg of
300+ (k,_:v) -> (k,v)
301+ (k,_) -> (k,"true")
302+ let newvars = optVariables opt ++ [(key,val)]
303+ return opt{ optVariables = newvars })
304+ "KEY[:VALUE]")
306305 "" -- "Use custom template"
307306
308307 , Option "D" ["print-default-template"]