Custom Extension with external data (or page variables)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Custom Extension with external data (or page variables)

bexelbie
I am writing a custom extension.  Can it access either the doc.catalog or the attributes passed in for processing? I need access to that information to do the resolution.

Thanks,

bex
Reply | Threaded
Open this post in threaded view
|

Re: Custom Extension with external data (or page variables)

bexelbie
For those who come after me, it appears this is what you need to walk up the tree:

parent.document.options[:attributes]["bob"]

Will get you to the bob value passed in ala

doc = Asciidoctor.load_file "foo.adoc", :header_footer => false, :safe => :unsafe, :attributes => {"bob" => "bar" }

regards,

bex
Reply | Threaded
Open this post in threaded view
|

Re: Custom Extension with external data (or page variables)

mojavelinux
Administrator
That's correct. If you want the original (unprocessed) attributes passed to the API, it's Document#options[:attributes]. Of course, you can access the resolved attributes via Document#attributes.

-Dan

On Thu, Nov 23, 2017 at 1:46 AM, bexelbie [via Asciidoctor :: Discussion] <[hidden email]> wrote:
For those who come after me, it appears this is what you need to walk up the tree:

parent.document.options[:attributes]["bob"]

Will get you to the bob value passed in ala

doc = Asciidoctor.load_file "foo.adoc", :header_footer => false, :safe => :unsafe, :attributes => {"bob" => "bar" }

regards,

bex


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Custom-Extension-with-external-data-or-page-variables-tp6032p6033.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



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