Counters with Zero Padding

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Counters with Zero Padding

vepo
How I do counters with zero padding.

Imagine that I want this kind of headers

# XXX-{counter:header} HEADER 1
# XXX-{counter:header} HEADER 2
# XXX-{counter:header} HEADER 3
# XXX-{counter:header} HEADER 4
# XXX-{counter:header} HEADER 5
# XXX-{counter:header} HEADER 6
# XXX-{counter:header} HEADER 7
# XXX-{counter:header} HEADER 8
# XXX-{counter:header} HEADER 9
# XXX-{counter:header} HEADER 10

This should be shown as

XXX-01 HEADER 1
XXX-02 HEADER 2
XXX-03 HEADER 3
XXX-04 HEADER 4
XXX-05 HEADER 5
XXX-06 HEADER 6
XXX-07 HEADER 7
XXX-08 HEADER 8
XXX-09 HEADER 9
XXX-10 HEADER 10

It is possible to do this?
Reply | Threaded
Open this post in threaded view
|

Re: Counters with Zero Padding

mojavelinux
Administrator
That's outside the scope of the built-in counter system. Counters are intentionally primitive (primarily used for built-in functionality like block numbering).

Instead, you should create a custom inline macro. Something like counter:name[pad=0].


On Fri, Apr 20, 2018 at 1:16 PM, vepo [via Asciidoctor :: Discussion] <[hidden email]> wrote:
How I do counters with zero padding.

Imagine that I want this kind of headers

# XXX-{counter:header} HEADER 1
# XXX-{counter:header} HEADER 2
# XXX-{counter:header} HEADER 3
# XXX-{counter:header} HEADER 4
# XXX-{counter:header} HEADER 5
# XXX-{counter:header} HEADER 6
# XXX-{counter:header} HEADER 7
# XXX-{counter:header} HEADER 8
# XXX-{counter:header} HEADER 9
# XXX-{counter:header} HEADER 10

This should be shown as

XXX-01 HEADER 1
XXX-02 HEADER 2
XXX-03 HEADER 3
XXX-04 HEADER 4
XXX-05 HEADER 5
XXX-06 HEADER 6
XXX-07 HEADER 7
XXX-08 HEADER 8
XXX-09 HEADER 9
XXX-10 HEADER 10

It is possible to do this?


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Counters-with-Zero-Padding-tp6267.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Dan Allen | @mojavelinux | https://twitter.com/mojavelinux