Skip to content

Instantly share code, notes, and snippets.

@rmpestano
Last active August 18, 2017 13:11
Show Gist options
  • Select an option

  • Save rmpestano/b063c759036b09d6446b to your computer and use it in GitHub Desktop.

Select an option

Save rmpestano/b063c759036b09d6446b to your computer and use it in GitHub Desktop.
Asciidoctor documentation inside war
<properties>
    <asciidoctorj.pdf.version>1.5.0-alpha.16</asciidoctorj.pdf.version>
    <asciidoctorj.version>1.5.6</asciidoctorj.version>
    <jruby.version>9.1.12.0</jruby.version>
</properties>
<plugin>
    <groupId>org.asciidoctor</groupId>
    <artifactId>asciidoctor-maven-plugin</artifactId>
    <version>1.5.5</version>
    <configuration>
        <sourceDirectory>src/docs</sourceDirectory>
        <sourceDocumentName>arqjava.adoc</sourceDocumentName>
        <outputDirectory>${project.build.directory}/${project.build.finalName}/docs</outputDirectory>
        <headerFooter>true</headerFooter>
        <doctype>book</doctype>
        <attributes>
            <apmUrl>${apm.url}</apmUrl>
            <imagesdir>./images</imagesdir>
            <docVersion>${project.version}</docVersion>
            <hardbreaks/>
            <numbered/>
            <idprefix/>
            <revnumber>${project.version}</revnumber>
        </attributes>
    </configuration>
    <executions>
        <execution>
            <id>output-html5</id>
            <phase>generate-resources</phase>
            <goals>
                <goal>process-asciidoc</goal>
            </goals>
            <configuration>
                <sourceHighlighter>coderay</sourceHighlighter>
                <backend>html5</backend>
                <attributes>
                    <linkcss>true</linkcss>
                    <linkattrs>true</linkattrs>
                    <sectnums/>
                    <toc>right</toc>
                    <tocLevels>3</tocLevels>
                    <icons>font</icons>
                    <sectanchors>true</sectanchors>
                </attributes>
            </configuration>
        </execution>
        <execution>
            <id>output-pdf</id>
            <phase>generate-resources</phase>
            <goals>
                <goal>process-asciidoc</goal>
            </goals>
            <configuration>
                <backend>pdf</backend>
                <sourceHighlighter>coderay</sourceHighlighter>
                <attributes>
                    <pdf-stylesdir>${project.basedir}/src/docs/styles/pdf</pdf-stylesdir>
                    <pdf-style>arqjava</pdf-style>
                    <chapter-label></chapter-label>
                    <icons>font</icons>
                    <pagenums/>
                    <toc/>
                    <idseparator>-</idseparator>
                </attributes>
            </configuration>
        </execution>
    </executions>
    <dependencies>
        <dependency>
            <groupId>org.asciidoctor</groupId>
            <artifactId>asciidoctorj-pdf</artifactId>
            <version>${asciidoctorj.pdf.version}</version>
        </dependency>
        <!-- Comment this section to use the default jruby artifact provided
            by the plugin -->
        <dependency>
            <groupId>org.jruby</groupId>
            <artifactId>jruby-complete</artifactId>
            <version>${jruby.version}</version>
        </dependency>
        <!-- Comment this section to use the default AsciidoctorJ artifact
            provided by the plugin -->
        <dependency>
            <groupId>org.asciidoctor</groupId>
            <artifactId>asciidoctorj</artifactId>
            <version>${asciidoctorj.version}</version>
        </dependency>
    </dependencies>
</plugin>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment