A simpler syntax for counters?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

A simpler syntax for counters?

rockyallen
Counters (http://asciidoctor.org/docs/user-manual/#counters) cause unnecessary confusion through not being fully fledged attributes. They look like attributes, but they have more restrictive names, cannot be accessed reliably, and have a different syntax for setting.

It would be cleaner to do away with counters and replace them with an operation that worked on any attribute:

{increment:part_number}

which means increment then display the attribute "part_number".

Users already know how to name, set, and access attributes so this would be much easier to remember.

If there was a demand for an equivalent to counter2: it could be {increment_noshow:part_number} although I don't think it is needed.

At the same time,  the definition of "increment" could be made more intelligent by detecting and incrementing a terminal sequence of digits instead of just the last character, ie

  :part_number: PX-021
  {increment:part_number}

returns PX-022