Re: How to exploit ContentPart attributes (RubyHash) from Java
Posted by Michaël Melchiore on Apr 04, 2019; 4:49pm
URL: https://discuss.asciidoctor.org/How-to-exploit-ContentPart-attributes-RubyHash-from-Java-tp6827p6832.html
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 let 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. For instance, I could enforce one top level Asciidoc document referencing sub documents each containing a single requirement. This would work since I can already define and access document attributes.
Still, I find the current API surprising. Clarifications are welcomed :)
Michaël