two captions for a image block

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

two captions for a image block

al-asciidoctor
Hi.

Is it possible to use two captions for a imageblock like the following

[#myimage_02]
.Caption above image
image::myImage[align=center,title-align=center]
..Caption below image

Reply | Threaded
Open this post in threaded view
|

Re: two captions for a image block

mojavelinux
Administrator
That's not something that's supported out of the box. It would require using a custom attribute and using a custom template (e.g., image.html.slim) to place the two captions.

Cheers,

-Dan

On Tue, Dec 11, 2018 at 1:37 PM al-asciidoctor [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Hi.

Is it possible to use two captions for a imageblock like the following

[#myimage_02]
.Caption above image
image::myImage[align=center,title-align=center]
..Caption below image




If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/two-captions-for-a-image-block-tp6638.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
Reply | Threaded
Open this post in threaded view
|

Re: two captions for a image block

al-asciidoctor
Reply | Threaded
Open this post in threaded view
|

Re: two captions for a image block

mojavelinux
Administrator
I don't think you need a custom block. Just something like:

[#myimage_02]
.Caption above image
image::myImage[align=center,title-align=center,lower-caption="Caption below image"]

But you need the custom template to take the lower-caption attribute and place it in the HTML. (See https://github.com/asciidoctor/asciidoctor.org/issues/80)

-Dan


On Tue, Dec 11, 2018 at 2:31 PM al-asciidoctor [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Something like this right?

https://asciidoctor.org/docs/user-manual/#block-macro-processor-example



If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/two-captions-for-a-image-block-tp6638p6640.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
Reply | Threaded
Open this post in threaded view
|

Re: two captions for a image block

mojavelinux
Administrator
In reply to this post by al-asciidoctor
> I don't think you need a custom block.

I meant to say custom block macro.

On Tue, Dec 11, 2018 at 2:57 PM Dan Allen <[hidden email]> wrote:
I don't think you need a custom block. Just something like:

[#myimage_02]
.Caption above image
image::myImage[align=center,title-align=center,lower-caption="Caption below image"]

But you need the custom template to take the lower-caption attribute and place it in the HTML. (See https://github.com/asciidoctor/asciidoctor.org/issues/80)

-Dan


On Tue, Dec 11, 2018 at 2:31 PM al-asciidoctor [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Something like this right?

https://asciidoctor.org/docs/user-manual/#block-macro-processor-example



If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/two-captions-for-a-image-block-tp6638p6640.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


--
Dan Allen | @mojavelinux | https://twitter.com/mojavelinux
Reply | Threaded
Open this post in threaded view
|

Re: two captions for a image block

al-asciidoctor
In reply to this post by mojavelinux
Thanks I will try it.
After I found a solution I will post it here
Reply | Threaded
Open this post in threaded view
|

Re: two captions for a image block

al-asciidoctor
As I'm new to this asciidoctor and slim stuff I hope you are not to  angry for my dump questions.

Now I have tried the following.

* create a directory `templates`
* create a file `upper-caption.html.slim` as the default caption is below the image and I need one above.
* content of `upper-caption.html.slim`

.imageblock
  upper-caption=testi

Now when I run the asciidoctor command I get the follwing output.

asciidoctor -a attribute-missing=warn -v --trace -T ../templates/upper-caption.html.slim Kopie.adoc
D:/APPS/msys64/mingw64/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require': cannot load such file -- tilt (LoadError)
...

What's my mistake?

> answer my self.
install tilt : gem install tilt
Reply | Threaded
Open this post in threaded view
|

Re: two captions for a image block

mojavelinux
Administrator
In order to use slim templates, you need to add the following two gems:

* slim
* tilt

Install them in the same way that you installed the asciidoctor gem.

I also noticed that your template doesn't quite have the right syntax. I would advise consulting this documentation: http://slim-lang.com/

It's good that you are venturing into custom templates because they give you soooooooo much control over what Asciidoctor outputs.

Cheers,

-Dan

On Tue, Dec 11, 2018 at 3:35 PM al-asciidoctor [via Asciidoctor :: Discussion] <[hidden email]> wrote:
As I'm new to this asciidoctor and slim stuff I hope you are not to  angry for my dump questions.

Now I have tried the following.

* create a directory `templates`
* create a file `upper-caption.html.slim` as the default caption is below the image and I need one above.
* content of `upper-caption.html.slim`

.imageblock
  upper-caption=testi

Now when I run the asciidoctor command I get the follwing output.

asciidoctor -a attribute-missing=warn -v --trace -T ../templates/upper-caption.html.slim Kopie.adoc
D:/APPS/msys64/mingw64/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require': cannot load such file -- tilt (LoadError)
        from D:/APPS/msys64/mingw64/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
        from D:/APPS/msys64/mingw64/lib/ruby/gems/2.5.0/gems/asciidoctor-1.5.8/lib/asciidoctor/cli/options.rb:243:in `parse!'
        from D:/APPS/msys64/mingw64/lib/ruby/gems/2.5.0/gems/asciidoctor-1.5.8/lib/asciidoctor/cli/options.rb:37:in `parse!'
        from D:/APPS/msys64/mingw64/lib/ruby/gems/2.5.0/gems/asciidoctor-1.5.8/lib/asciidoctor/cli/invoker.rb:23:in `initialize'
        from D:/APPS/msys64/mingw64/lib/ruby/gems/2.5.0/gems/asciidoctor-1.5.8/bin/asciidoctor:12:in `new'
        from D:/APPS/msys64/mingw64/lib/ruby/gems/2.5.0/gems/asciidoctor-1.5.8/bin/asciidoctor:12:in `<top (required)>'
        from D:/APPS/msys64/mingw64/bin/asciidoctor:23:in `load'
        from D:/APPS/msys64/mingw64/bin/asciidoctor:23:in `<main>'

What's my mistake?


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/two-captions-for-a-image-block-tp6638p6644.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
Reply | Threaded
Open this post in threaded view
|

Re: two captions for a image block

al-asciidoctor
Thanks I have now installed both.

I have copied the content from https://github.com/asciidoctor/asciidoctor-backends/blob/master/slim/html5/block_image.html.slim to my template and adopted it with `upper-caption: (attr :upper-caption)`

The block looks like this

[[abbildung_01]]
.lower text
image::KOPIE-extracted-media/media/image1.png[align=center,title-align=center,upper-caption="upper-text"]

= block_with_title({class: 'imageblock', style: (style_value text_align: (attr :align), float: (attr :float), upper-caption: (attr :upper-caption))}, :bottom)

I have also copied the asciidoctor-1.5.8\data\stylesheets\asciidoctor-default.css and added the follwing line but I'm sure that's wrong.

.imageblock>.upper-caption{margin-bottom:0}

As I don't know what's the syntax to tell slim/html to put the upper-caption before the .content.
Reply | Threaded
Open this post in threaded view
|

Re: two captions for a image block

mojavelinux
Administrator
You won't be able to use that template as a base since it relies on a helper. It's probably best to start from scratch using the slim reference I sent.

You probably want something like:

.imageblock
  .content
    .upper-title = attr('upper-caption')
    img src=image_uri(attr 'target')
    .title = captioned_title

You can build from there.

Cheers,

-Dan

On Tue, Dec 11, 2018 at 4:19 PM al-asciidoctor [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Thanks I have now installed both.

I have copied the content from https://github.com/asciidoctor/asciidoctor-backends/blob/master/slim/html5/block_image.html.slim to my template and adopted it with `upper-caption: (attr :upper-caption)`

The block looks like this

[[abbildung_01]]
.lower text
image::KOPIE-extracted-media/media/image1.png[align=center,title-align=center,upper-caption="upper-text"]

= block_with_title({class: 'imageblock', style: (style_value text_align: (attr :align), float: (attr :float), upper-caption: (attr :upper-caption))}, :bottom)

I have also copied the asciidoctor-1.5.8\data\stylesheets\asciidoctor-default.css and added the follwing line but I'm sure that's wrong.

.imageblock>.upper-caption{margin-bottom:0}

As I don't know what's the syntax to tell slim/html to put the upper-caption before the .content.


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/two-captions-for-a-image-block-tp6638p6646.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