Re: Awesome Asciidoctor: Auto Number Callouts
Posted by
mojavelinux on
URL: https://discuss.asciidoctor.org/Awesome-Asciidoctor-Auto-Number-Callouts-tp7488p7492.html
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.
--