Auto Increment Label
Posted by asotobu on Jul 25, 2013; 3:47pm
URL: https://discuss.asciidoctor.org/Auto-Increment-Label-tp393.html
Today has come an idea which I think that it is supported yet by Asciidoctor, and moreover it is not in AsciiDoc standard, but I think can be useful in some circumstances. I am thinking in next scenario:
Let's suppose we are writing SRS of a product, and probably I want to give them a number, for example SRS-1, SRS-2, ....
how about creating an auto increment label so for example we can create an attribute which must ends with counter:
:srs-identification-counter: 1
and then each time this attribute is used, value is incremented by one, so for example:
== Fluidic System
[cols="1,2" options="header"]
.Fluidic SRS
|===
|SRS
|Description
|SRS-{srs-identification-counter}
|bla bla bla
|SRS-{srs-identification-counter}
|bla bla bla
|===
which will be equivalent to:
[cols="1,2" options="header"]
.Fluidic SRS
|===
|SRS
|Description
|SRS-1
|bla bla bla
|SRS-2
|bla bla bla
|===
Of course there are some problems to resolve, for example what's happen when you include another AsciiDoc file that are already using the same counter, but I think can simplify of having to maintain manually incremental values, or for example defining twice.
WDYT?