Awesome Asciidoctor: Auto Number Callouts

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

Awesome Asciidoctor: Auto Number Callouts

mariocup
In Asciidoctor it is possible to auto number callouts (see blog post https://mrhaki.blogspot.com). This information should be integrated in the Asciidoctor user manual.

= Callout sample
:source-highlighter: prettify
:icons: font
 
[source,groovy]
----
package com.mrhaki.adoc
 
class Sample {
    String username // <.>
 
    String toString() {
        "${username?.toUpperCase() ?: 'not-defined'}" // <.>
    }
}
----
<.> Simple property definition where Groovy will generate the `setUsername` and `getUsername` methods.
<.> Return username in upper case if set, otherwise return `not-defined`.
When we convert this markup to HTML we get the following result:

This makes it very easy to add new callouts without having to change all numbers we first typed by hand.
Reply | Threaded
Open this post in threaded view
|

Re: Awesome Asciidoctor: Auto Number Callouts

mojavelinux
Administrator
I agree. Please file an issue in asciidoctor/asciidoctor so we can track it. And if you'd like, you can submit a PR with the proposed documentation update.

Best Regards,

-Dan

On Sun, Jan 12, 2020 at 5:22 AM mariocup [via Asciidoctor :: Discussion] <[hidden email]> wrote:
In Asciidoctor it is possible to auto number callouts (see blog post https://mrhaki.blogspot.com). This information should be integrated in the Asciidoctor user manual.

= Callout sample
:source-highlighter: prettify
:icons: font
 
[source,groovy]
----
package com.mrhaki.adoc
 
class Sample {
    String username // <.>
 
    String toString() {
        "${username?.toUpperCase() ?: 'not-defined'}" // <.>
    }
}
----
<.> Simple property definition where Groovy will generate the `setUsername` and `getUsername` methods.
<.> Return username in upper case if set, otherwise return `not-defined`.
When we convert this markup to HTML we get the following result:

This makes it very easy to add new callouts without having to change all numbers we first typed by hand.


If you reply to this email, your message will be added to the discussion below:
https://discuss.asciidoctor.org/Awesome-Asciidoctor-Auto-Number-Callouts-tp7488.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
Reply | Threaded
Open this post in threaded view
|

Re: Awesome Asciidoctor: Auto Number Callouts

habamax
Done :)