How to define a "section-label"?

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

How to define a "section-label"?

dschneiter
I learned that for books there is a "chapter-label" that can be set to prefix the chapter numbers with a corresponding label, such as "Chapter".

How can I achieve something similar when writing a book, using sections? (e.g. Lab <section_number> <section_title>)?
Reply | Threaded
Open this post in threaded view
|

Re: How to define a "section-label"?

mojavelinux
Administrator
That's not something that AsciiDoc / the AsciiDoc processor supports.

You could use document attributes in the section title:

:section-label: Lab

ifeval::[{counter:lab-number} > 0]
== {section-label} {lab-number}. Title of Lab
endif::[]

ifeval::[{counter:lab-number} > 0]
== {section-label} {lab-number}. Title of Another Lab
endif::[]

The ifeval is a hack to trigger the counter without leaving behind any lines.

Best,

-Dan

On Thu, Aug 29, 2019 at 6:42 AM dschneiter [via Asciidoctor :: Discussion] <[hidden email]> wrote:
I learned that for books there is a "chapter-label" that can be set to prefix the chapter numbers with a corresponding label, such as "Chapter".

How can I achieve something similar when writing a book, using sections? (e.g. Lab <section_number> <section_title>)?


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/How-to-define-a-section-label-tp7129.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