Login  Register

Re: setting imagesdir for asciidoc articles baked with awestruct

Posted by LightGuardjp on Nov 21, 2013; 7:16pm
URL: https://discuss.asciidoctor.org/setting-imagesdir-for-asciidoc-articles-baked-with-awestruct-tp528p1042.html

There's the base_url in config.yml you could set per environment and use that in the src for the image. Interpolation in asciidoctor files doesn't work in 0.5.3, but does in 0.5.4.rc or higher.

I think you should be able to get what you need with those things and with what you've already tried. If not, please follow-up.


On Thu, Nov 21, 2013 at 3:36 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



--
Jason Porter
http://en.gravatar.com/lightguardjp