How include::sample Work

In the multi-language sample declaration,we can write the code:

.Customizing what Gradle logs
====
include::sample[dir="snippets/initScripts/customLogger/groovy",files="init.gradle[]"]

include::sample[dir="snippets/initScripts/customLogger/kotlin",files="customLogger.init.gradle.kts[]"]
====

how is it parsed into html?

this is the official explanation:

include::sample: invokes the SampleIncludeProcessor asciidoctor extension, with a dir relative to src/snippets/, and a list of files separated by ; (only 1 in this example), each with optional tags=... (like Asciidoctor’s tags mechanism). We write this once for each DSL dialect. This notes to our front-end code to group these 2 samples and show them with selector tabs.

but i didn’t find SampleIncludeProcessor in the project and dependency library。

What is his parsing mechanism?

That’s some closed source thing they use to generate the docs.
In Make AsciidoctorTask cacheable again by blindpirate · Pull Request #8148 · gradle/gradle · GitHub you can find a link to https://github.com/gradle/dotorg-docs/blob/5898ed8f1aadf4793cac6fe934548d73d37e62b7/docs-asciidoctor-extensions/src/main/java/org/gradle/docs/asciidoctor/SampleIncludeProcessor.java and also the mention that it is a private repo.

1 Like