Login  Register

Re: Pass parameter from AsciiDoc CLI to HAML template

Posted by mojavelinux on May 21, 2020; 7:28pm
URL: https://discuss.asciidoctor.org/Pass-parameter-from-AsciiDoc-CLI-to-HAML-template-tp8023p8033.html

> (@document.attr? :env) == 'localwebassets'}

This is not a valid use of the attr? method. The attr? method combines the attr method (without ?) with a comparison operation. So you either write:

(@document.attr :env) == 'localwebassets'

or

@document.attr? :env, 'localwebassets

See the difference in the two methods?

The docs for these methods can be found here: https://rubydoc.info/github/asciidoctor/asciidoctor/Asciidoctor/AbstractNode#attr-instance_method



If there's interest in porting the the templating syntax to something like nunjucks, mustache, or some other template language that has a more docs
 
It has nothing to do with the template language (and Asciidoctor supports every template language supported by Tilt). This is about the Asciidoctor model to which the template has access. The template has access to the model for the node being converted (which I linked to above).

-Dan

--
Dan Allen | @mojavelinux | https://twitter.com/mojavelinux