How do I render a Document back to Asciidoctor

Previous Topic Next Topic
 
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

starbuxman
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:

<code>
        val asciidoctor: Asciidoctor = Asciidoctor.Factory.create()
                                .apply {
                                        this.javaExtensionRegistry().includeProcessor(SimpleIncludeProcessor())
                                }
                val document: Document = asciidoctor.load(this.input, mapOf("safe" to "unsafe", "parse" to "false"))
</code>

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