Custom subsitutions in delimited blocks

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

Custom subsitutions in delimited blocks

xcoulon
Hello,

I have the following document with an example block:
:github-url: https://github.com
			
[subs="quotes"]
====
a link to https://example.com[] <1>
and <more text> on the +
*next* lines with a link to {github-url}[]
====

and with Asciidoctor 2.0.10, I get the following output:

<div class="exampleblock">
<div class="content">
<div class="paragraph">
<p>a link to <a href="https://example.com" class="bare">https://example.com</a> &lt;1&gt;
and &lt;more text&gt; on the<br>
<strong>next</strong> lines with a link to <a href="https://github.com" class="bare">https://github.com</a></p>
</div>
</div>
</div>


however, I did not expect that the other substitutions (attributes, macros, specialchars, post_replacements) would also be executed.
My understanding is that with `subs="quotes"`, only the "quotes" substitution would be executed, since I'm not prepending or appending an extra substitution here. Also, the same substitution works as expected if the delimited block is a "listing" block, or if it's a paragraph.

Am I missing something, or is there a different treatment of substitutions for normal content blocks (example, quotes, sidebar) vs verbatim content blocks (fenced, listing, etc.) ?


Best regards,
Reply | Threaded
Open this post in threaded view
|

Re: Custom subsitutions in delimited blocks

abelsromero
xcoulon wrote
Am I missing something, or is there a different treatment of substitutions for normal content blocks (example, quotes, sidebar) vs verbatim content blocks (fenced, listing, etc.) ?
You are right, the treatment is different.

In the block summary you can see substitution group applied (https://asciidoctor.org/docs/user-manual/#built-in-blocks-summary), and in the substitutions section, what group means (https://asciidoctor.org/docs/user-manual/#subs).
Reply | Threaded
Open this post in threaded view
|

Re: Custom subsitutions in delimited blocks

xcoulon
Thanks for your response, @abelsromero!

Yes, I'm aware of these groups and what they mean, so maybe my question was not properly formulated.
I was expecting that `subs="quotes"` would override the default substitutions and that only the `quotes` one would be applied, but it's apparently not the case for the example block. Which is why I was asking if there is a reason for that?

Best regards
Reply | Threaded
Open this post in threaded view
|

Re: Custom subsitutions in delimited blocks

xcoulon
also, as mentioned in https://asciidoctor.org/docs/user-manual/#incremental-substitutions:

> When you set the subs attribute on a block, you automatically remove all of its default substitutions. For example, if you set subs on a literal block, and assign it a value of attributes, only attributes are substituted.

This is what I'm trying to use in the example block, but without any luck :(

Best regards,