Re: content reuse and manipulation
Posted by
mojavelinux on
Feb 28, 2019; 12:42pm
URL: https://discuss.asciidoctor.org/content-reuse-and-manipulation-tp6766p6768.html
kev,
I'd recommend using attribute references (which can hold up to a single paragraph of content).
:q-1: What are the possible types of products in a neutralization reaction?
:q-2: What are the different types of bases?
Questions:
{q-1}
{q-2}
Answers:
{q-1} (salt, water, CO~2~, hydrogen)
{q-2} (metal hydroxides, metal oxides, metal carbonates, metals)
If the questions have a natural key (like an ID), then you can base the attribute names on the key instead of using numbers.
Cheers,
-Dan
On Thu, Feb 28, 2019 at 2:33 AM kev [via Asciidoctor :: Discussion] <
[hidden email]> wrote:
Given the following Asciidoctor snippet
Questions:
. What are the possible types of products in a neutralization reaction?
. What are the different types of bases?
Answers:
. What are the possible types of products in a neutralization reaction? (salt, water, CO~2~, hydrogen)
. What are the different types of bases? (metal hydroxides, metal oxides, metal carbonates, metals)
What is the best way in Asciidoctor so that the questions are not repeated in the answers in the Asciidoctor source? Block content can only be reused via including an external file AFAIK but that still leaves the problem of adding the answers depending on the context. I could use hacky preprocessor directives and attributes or pre-process the text via a script but I hoped for a cleaner method.
--