You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, attributes must be passed as a Hash to the render and load APIs. There are times when this makes the argument list feel too heavy. As an alternative, these APIs should accept the attributes as a string or array.
For instance, consider a user of the API wants to pass the attribute that enables the table of contents (toc) and auto-numbering (numbered).
The toc attribute does not require a value. An empty string value is the convention in AsciiDoc/Asciidoctor to enable an attribute of this type (a flag attribute).
This invocation could be simplified if the API accepted the attribute keys as an array.
Currently, attributes must be passed as a Hash to the render and load APIs. There are times when this makes the argument list feel too heavy. As an alternative, these APIs should accept the attributes as a string or array.
For instance, consider a user of the API wants to pass the attribute that enables the table of contents (
toc
) and auto-numbering (numbered
).The
toc
attribute does not require a value. An empty string value is the convention in AsciiDoc/Asciidoctor to enable an attribute of this type (a flag attribute).This invocation could be simplified if the API accepted the attribute keys as an array.
It can be further simplified using the array-from-string shorthand in Ruby:
That leads us into attributes specified as a string:
That's quite an improvement over the original call.
To handle attributes that accept values, we can recognize the key=value form:
This parallels the commandline argument form, encouraging consistency:
I think this enhancement will be particularly useful in the integrations, such as the Gradle plugin.
The text was updated successfully, but these errors were encountered: