Skip to content

Instantly share code, notes, and snippets.

@pamolloy
Created September 19, 2014 00:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pamolloy/b147f0c05321c6bf0ffc to your computer and use it in GitHub Desktop.
Save pamolloy/b147f0c05321c6bf0ffc to your computer and use it in GitHub Desktop.
, Option "V" ["variable"]
(ReqArg
(\arg opt -> do
let (key,val) = case break (`elem` ":=") arg of
(k,_:v) -> (k,v)
(k,_) -> (k,"true")
return opt{ optVariables = (key,val) : optVariables opt })
"KEY[:VALUE]")
""
@pamolloy
Copy link
Author

I want to pass this a key with multiple variables. How can I do that? I can see that if no value is provided it defaults to true, but what does the line above that do?

@pamolloy
Copy link
Author

-V KEY[=VAL], --variable=KEY[:VAL]
    Set the template variable KEY to the value VAL when rendering the document in standalone mode. 
This is generally only useful when the --template option is used to specify a custom template, since 
pandoc automatically sets the variables used in the default templates. If no VAL is specified, the key will 
be given the value true.

See http://johnmacfarlane.net/pandoc/README.html

@pamolloy
Copy link
Author

Their templates look like this:

$for(author)$
<h2 class="author">$author$</h2>
$endfor$

@pamolloy
Copy link
Author

Custom delimiters can be defined as follows:

$for(tags)$tags$$sep$, $endfor$

See http://stackoverflow.com/questions/25559469

@pamolloy
Copy link
Author

There's currently no way to set complex values like this from the
command line.  You'd have to embed them in the source file as YAML, or
in a separate file that you include on the command line. 

See https://groups.google.com/d/topic/pandoc-discuss/r-t0hXKSMTM/discussion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment