Login  Register

Example block numbering relative to sections

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options Options
Embed post
Permalink
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Example block numbering relative to sections

vlad_mihalcea
Is it possible to number the example blocks relative to the section numbers as well?

For example, when the third section starts, all the examples should be numbered as 3.1, 3.2, 3.3.

I am generating a single html document from a bunch of asciidoctor files and the examples start from 1 and go to 50, by the end of the html document.

Thanks,
Vlad
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: Example block numbering relative to sections

mojavelinux
Administrator
Not currently. There is an open issue that covers this requirement.


Of course, it is possible to renumber blocks using a Treeprocessor extension. You walk the AST and change all the captions. In the process, we may discover other caveats, though.

Cheers,

-Dan

On Fri, Dec 4, 2015 at 9:09 AM, vlad_mihalcea [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Is it possible to number the example blocks relative to the section numbers as well.
For example, when the third section starts, all the examples should be numbered as 3.1, 3.2, 3.3.

I am generating a single html document from a bunch of asciidoctor files and the examples start from 1 and go to 50, by the end of the html document.

Thanks,
Vlad


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Example-block-numbering-relative-to-sections-tp4016.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Dan Allen | @mojavelinux | http://google.com/profiles/dan.j.allen
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: Example block numbering relative to sections

vlad_mihalcea
Thanks for the heads up.  We'll stick to the current numbering scheme for the moment and watch the progress of this issue.
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: Example block numbering relative to sections

mark@manngo.net
I’m new to this, so I may be way off.

Why not set up a counter for your sections and example? The following appears to work:

[counter:section]
:!part: {counter:part}

Section {counter:section}

Part {section}.{counter:part}

Part {section}.{counter:part}

Part {section}.{counter:part}

Section {counter:section}

:!part: [counter:part]

Part {section}.{counter:part}

Part {section}.{counter:part}

Part {section}.{counter:part}
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: Example block numbering relative to sections

mojavelinux
Administrator
Mark,

That's certainly possible. However, the aim of AsciiDoc is to keep the content free of any non-essential information and rely on the computer to handle tasks such as numbering. It's very reasonable to expect that the processor to number using different strategies, either as a built-in feature or through an extension.

In general, whenever we see markup being repeated a lot in a document, we always want to try to find a way to factor it out. The goal is to encode the information as efficiently as possible.

-Dan

On Thu, Jul 7, 2016 at 2:21 AM, [hidden email] [via Asciidoctor :: Discussion] <[hidden email]> wrote:
I’m new to this, so I may be way off.

Why not set up a counter for your sections and example? The following appears to work:

[counter:section]
:!part: {counter:part}

Section {counter:section}

Part {section}.{counter:part}

Part {section}.{counter:part}

Part {section}.{counter:part}

Section {counter:section}

:!part: [counter:part]

Part {section}.{counter:part}

Part {section}.{counter:part}

Part {section}.{counter:part}



If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Example-block-numbering-relative-to-sections-tp4016p4819.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