Login  Register

Re: setting imagesdir for asciidoc articles baked with awestruct

Posted by mojavelinux on Nov 23, 2013; 3:06am
URL: https://discuss.asciidoctor.org/setting-imagesdir-for-asciidoc-articles-baked-with-awestruct-tp528p1060.html

Xavier,

You almost have it right. The problem is that you aren't using the correct attribute name in your AsciiDoc file. Instead of:

[source,asciidoc]
--
:awestruct-imagesdir: /features
--

you should have:

[source,asciidoc]
--
:imagesdir: /features
--

The imagesdir attribute is a native AsciiDoc attribute, not a special Awestruct attribute. The only time you prefix the attribute name with "awestruct-" (or "page-") is when you need to set a property on the Awestruct Page object.

See if that works for you. Then we can go from there.

-Dan



On Thu, Nov 21, 2013 at 3:35 AM, xcoulon [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Hi Dan !

Sorry, I'm a bit late on this thread.
Thanks for the long explanation, but I can't get it working with awestruct-0.5.4.rc2 with asciidoctor-0.1.4.

No matter what I put in the document header or in a custom extension, the value defined in _config/site.yml is still used, even though I suffixed it with '@' as you suggested.

Here's what I have now:
- in _site/config.yml:
---
asciidoctor:
  :safe: safe
  :attributes:
    imagesdir: /images@
    icons: font
---

- in my adoc file:
---
:awestruct-imagesdir: /features
...
image::images/features-openshift-applicationwizard-reduced.png[OpenShift Application Wizard]
---

in a custom awestruct extension, I specify the 'page.imagesdir' value by setting something like 'http://localhost:4242/features'

At the end of the build, the generated HTML for the images is something like:
<img src="/images/images/features-openshift-applicationwizard-reduced.png" alt="OpenShift Application Wizard">

The generated path starts with '/images/images/..', which means that the default imagesdir value from _config/site.yml was used.
Ideally, I would like to have an absolute path because the site currently deployed on github, so I need to preprend the site context (which is configured in my staging profile). This is why I was hoping to have the custom extension working.
Note: this works fine with awestruct-0.5.3 but we need to migrate to a more recent version because some users run it on MacOSX Mavericks.

I like very much the idea that a relative path should be used with awestruct while still letting github render the page and display the images, which is why I'm trying to find the right configuration.

Thanks.
Xavier




If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/setting-imagesdir-for-asciidoc-articles-baked-with-awestruct-tp528p1035.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Dan Allen | http://google.com/profiles/dan.j.allen