Login  Register

Re: Maven plugin and extensions

Posted by mojavelinux on May 15, 2015; 2:10am
URL: https://discuss.asciidoctor.org/Maven-plugin-and-extensions-tp3149p3211.html

On Thu, May 14, 2015 at 6:31 PM, torngat [via Asciidoctor :: Discussion] <[hidden email]> wrote:

I found that I can use an "asciidoc:" directive in a Slim template to have some Asciidoc text interpreted

Yep, that's one way to do it. You can also just use the Asciidoctor API directly (for more control)

= Asciidoctor.convert("content", base_dir: @document.base_dir, safe: @document.safe)

You can pass whatever other options or attribute you need to make it work.
 
but I keep getting this error when trying to use an include:: directive:

  (ArgumentError) wrong number of arguments calling `initialize` (1 for 5)
when trying
----
asciidoc: include::{generated}/error-example/http-request.adoc[]
----

I've tried with a simple statement like
----
asciidoc: I'm writing some *Asciidoc*!
----

which renders in italics without the 'I':  'm writing some *Asciidoc*!

You are once again dealing with a Slim 2.0.x limitation. You need to put the AsciiDoc source on it's own line, indented.

asciidoc:
   I'm writing some *Asciidoc* using Asciidoctor {asciidoctor-version}!



I read in Slim documentation that one has to configure the embedded engines.  The presence of "asciidoc:" doesn't make it balk, so I'm guessing the engine is already configured and I'm just not using it correctly.

Yep, it's activated by default.
 


I wonder, too, if I'll be able to refer to both Slim and Asciidoc variables within that statement.  Something like
----
include::{asciidoc_var}/somefile-#{slim_var}.adoc[]
----

Yep, both variables are available.

However, you are going to have a problem with safe mode, which is set to secure by default in the slim asciidoc context. I'd have to dig in further to see if there's a way to globally change the value (you need to somehow git to the options that Tilt is going to pass to Asciidoctor). I can't remember how at the moment. Though, you can always just use the Asciidoctor API.

-Dan

--