How do I render a Document back to Asciidoctor

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

How do I render a Document back to Asciidoctor

Hi all,

I'm trying to process an Asciidoctor file and then emit Asciidoctor markup.

I loaded the document and i can see that my custom IncludeProcessors are being activated. I want to render the input asciidoctor out as asciidoctor, but retain the resolved includes from my IncludeProcessor. My AsciidoctorJ program is a build phase bridge between the input artifacts and a downstream processing pipeline.

My code, in Kotlin, is as follows:

        val asciidoctor: Asciidoctor = Asciidoctor.Factory.create()
                                .apply {
                val document: Document = asciidoctor.load(this.input, mapOf("safe" to "unsafe", "parse" to "false"))

Let's say that the SimpleIncludeProcessor just returns "HELLO" for every 'target'. What I want to do now is render the document backk out to another asciidoctor file, preserving 'HELLO' for the code listing (where it was an include before).

Thanks in advance.

PS: why can't I use Asciidoctor for these messages? :D