asciidoctor / asciidoctor-maven-plugin

A Maven plugin that uses Asciidoctor via JRuby to process AsciiDoc source files within the project.
http://asciidoctor.org
Apache License 2.0
318 stars 122 forks source link

Documentation on how to convert adoc to adoc #952

Open dsyer opened 6 days ago

dsyer commented 6 days ago

https://github.com/asciidoctor/asciidoctor/issues/1793 was closed when asciidoctor-reducer was released. The examples in the README help me to make progress on the command line with the gem, but I still don't know what to do with it as part of a Maven build. I want to merge some files into a README as part of the Maven build.

None of the https://github.com/asciidoctor/asciidoctor-maven-examples/ seem to help.

abelsromero commented 6 days ago

asciidoctor-reducer does not include an Asciidoctor converter (for context: https://github.com/asciidoctor/asciidoctor-maven-plugin/issues/618#issuecomment-1468992041), which is the API that the asciidoctor-maven-plugin consumes. You can get this in maven with the exec goal of the gem-maven-plugin.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.asciidoctor.maven</groupId>
    <artifactId>asciidoctor-reducer-as-cli</artifactId>
    <version>1.0.0-SNAPSHOT</version>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <jruby.version>9.4.6.0</jruby.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>rubygems</groupId>
            <artifactId>asciidoctor-reducer</artifactId>
            <version>1.0.6</version>
            <type>gem</type>
        </dependency>
    </dependencies>

    <build>
        <extensions>
            <extension>
                <groupId>org.jruby.maven</groupId>
                <artifactId>mavengem-wagon</artifactId>
                <version>2.0.2</version>
            </extension>
        </extensions>
        <plugins>
            <plugin>
                <groupId>org.jruby.maven</groupId>
                <artifactId>gem-maven-plugin</artifactId>
                <version>3.0.3</version>
                <configuration>
                    <jrubyVersion>${jruby.version}</jrubyVersion>
                    <gemHome>${project.build.directory}/gems</gemHome>
                    <gemPath>${project.build.directory}/gems</gemPath>
                </configuration>
                <executions>
                    <execution>
                        <id>install-gems</id>
                        <goals>
                            <goal>initialize</goal>
                            <goal>exec</goal>
                        </goals>
                        <phase>compile</phase>
                        <configuration>
                            <execArgs>${project.build.directory}/gems/bin/asciidoctor-reducer -o output.adoc ${basedir}/README.adoc</execArgs>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <repositories>
        <repository>
            <id>mavengems</id>
            <url>mavengem:https://rubygems.org</url>
        </repository>
    </repositories>

</project>