Re: How to exploit ContentPart attributes (RubyHash) from Java
Posted by
mojavelinux on
Apr 05, 2019; 8:54am
URL: https://discuss.asciidoctor.org/How-to-exploit-ContentPart-attributes-RubyHash-from-Java-tp6827p6839.html
That's not a hack. That's the way it's designed. But you don't need to use single quotes for the block attribute because attributes are replaced by default. (You can just use double quotes or no quotes).
Cheers,
-Dan
On Fri, Apr 5, 2019 at 2:52 AM Michaël Melchiore [via Asciidoctor :: Discussion] <
[hidden email]> wrote:
Currently, I use this hack
:subsystem: NewValue
[subsystem='{subsystem}']
== {subsystem} requirements
This section describes the requirements allocated to {subsystem}
If you know of a better way, I am interested.
Kind regards,
Michaël
Le ven. 5 avr. 2019 à 10:47, Michaël Melchiore [via Asciidoctor :: Discussion] <
[hidden email]> a écrit :
Dear Dan,
Thanks for your inputs.
How can I reference the block attributes ?
For example,
[subsystem=NewValue]
== {subsystem} requirements
This section describes the requirements allocated to {subsystem}
Kind regards,
Michaël
Le jeu. 4 avr. 2019 à 23:25, mojavelinux [via Asciidoctor :: Discussion] <
[hidden email]> a écrit :
Michaël,
I think what you're looking for are block attributes instead of document attributes. These are specified differently.
[subsystem=NewValue]
== Sample Section
Now, when you look for the attributes on a node, you will find "subsystem" among them.
Cheers,
-Dan
On Thu, Apr 4, 2019 at 10:49 AM Michaël Melchiore [via Asciidoctor :: Discussion] <
[hidden email]> wrote:
To give a bit of context, I intended to use attributes to tag special values for easy programmatic access when parsing the document.
For example, I was thinking on writing software requirement documents with AsciiDoc and use AsciidoctorJ to implement some tooling.
Each top level section of the document would be dedicated to a software requirement. I thought section attributes would be useful to capture some metadata about each requirement (allocated subsystem, target version...).
I could use the attribute in two interesting ways:
* reference in the requirement text to avoid duplicating information
* from the Java API to efficiently access the metadata value without complex and fragile requirement text parsing logic
So my use case is that one section has a set of fixed attributes each with a single value. My previous example could have lead you to believe I want to detect attribute value changes in arbitray places of the document. This is not the case, my need is much simpler and I control the layout of the document.
Michaël
--
To unsubscribe from How to exploit ContentPart attributes (RubyHash) from Java,
click here.
NAML
To unsubscribe from How to exploit ContentPart attributes (RubyHash) from Java,
click here.
NAML
--