Skip to content

Latest commit

 

History

History
93 lines (77 loc) · 2.17 KB

README.adoc

File metadata and controls

93 lines (77 loc) · 2.17 KB

asciidoc-dsl

asciidoc dsl asciidoc dsl asciidoc dsl asciidoc dsl badge

A yet very shallow AsciiDoc DSL for Kotlin.

For a different project I need something simple to write an .adoc programatically, so I ended up writing this.

Installation

Gradle (short) implementation("io.github.sschrass:asciidoc-dsl:$version")

Usage

article {
    header {
        documentTitle { "AsciiDoc DSL for Kotlin" }
        author {
            fullName { "Stefan Schrass" }
            eMail { "stefan.schrass@gmail.com" }
        }
        revision {
            number { "v0.1.1" }
            date { "2021-11-27" }
            remark { "5" }
        }
        description { "A yet very shallow AsciiDoc DSL for Kotlin." }
        keywords { listOf("AsciiDoc", "DSL", "Kotlin") }
        metadata { "status" to "incubating" }
        flag { "hide-uri-scheme" }
    }

    paragraph { +"first Paragraph" }
    paragraph { +"second Paragraph" }

    sectionNumbers { true }
    section {
        title { "A numbered Section" }
        paragraph { +"Some Text" }
        subSection {
            title { "SubSection title" }
            list {
                +"A thing"
                +"Another thing"
                +listOf("first thing", "second thing")
            }
        }
    }
    sectionNumbers { false }
    section {
        title { "Unnumbered Section" }
        paragraph { +"Some Text" }
    }
}
    .render()

will produce

= AsciiDoc DSL for Kotlin
Stefan Schrass <stefan.schrass@gmail.com>
v0.1.1, 2021-11-27:5
:description: A yet very shallow AsciiDoc DSL for Kotlin.
:keywords: AsciiDoc, DSL, Kotlin
:status: incubating
:hide-uri-scheme:

first Paragraph

second Paragraph

:sectnums:
== A numbered Section
Some Text

=== SubSection title
* A thing
* Another thing
* first thing
* second thing

:sectnums!:
== Unnumbered Section
Some Text