<?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>

  <parent>
    <groupId>org.jboss.byteman</groupId>
    <artifactId>byteman-docs</artifactId>
    <version>4.0.13</version>
  </parent>
    
  <artifactId>byteman-asciidoc</artifactId>
  <name>Byteman AsciiDoc Documentation</name>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <asciidoctor.maven.plugin.version>1.5.6</asciidoctor.maven.plugin.version>
    <asciidoctorj.version>1.5.6</asciidoctorj.version>
    <asciidoctorj-pdf.version>1.5.0-alpha.16</asciidoctorj-pdf.version>
    <jruby.version>9.1.15.0</jruby.version>

    <maven.build.timestamp.format>MMM dd, yyyy</maven.build.timestamp.format>
  </properties>

  <build>
    <defaultGoal>process-resources</defaultGoal>
    <plugins>
      <plugin>
        <groupId>org.asciidoctor</groupId>
        <artifactId>asciidoctor-maven-plugin</artifactId>
        <version>${asciidoctor.maven.plugin.version}</version>
        <dependencies>
          <dependency>
            <groupId>org.jruby</groupId>
            <artifactId>jruby-complete</artifactId>
            <version>${jruby.version}</version>
          </dependency>
          <dependency>
            <groupId>org.asciidoctor</groupId>
            <artifactId>asciidoctorj</artifactId>
            <version>${asciidoctorj.version}</version>
          </dependency>
          <dependency>
            <groupId>org.asciidoctor</groupId>
            <artifactId>asciidoctorj-pdf</artifactId>
            <version>${asciidoctorj-pdf.version}</version>
          </dependency>
        </dependencies>
        <configuration>
          <sourceDirectory>src/main/asciidoc</sourceDirectory>
          <!-- If you set baseDir to ${project.basedir}, top-level includes are resolved relative to the project root -->
          <!-- <baseDir>${project.basedir}</baseDir> -->
          <!-- Attributes common to all output formats -->
          <attributes>
            <endpoint-url>http://example.org</endpoint-url>
            <sourcedir>${project.build.sourceDirectory}</sourcedir>
            <project-version>${project.version}</project-version>
            <doc-date>${maven.build.timestamp}</doc-date>
            <sourcedir>${project.build.sourceDirectory}</sourcedir>
          </attributes>
        </configuration>
        <executions>
          <execution>
            <id>asciidoc-to-html</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>process-asciidoc</goal>
            </goals>
            <configuration>
            <backend>html5</backend>
              <sourceHighlighter>rouge</sourceHighlighter>
              <!--
              Scenarios for linking vs embedding assets:

              Link to both stylesheets and images::

                - don't set embedAssets option
                - set linkcss attribute to true
                - set imagesdir attribute to path relative to AsciiDoc source file

                <attributes>
                    <linkcss>true</linkcss>
                    <imagesdir>./images</imagesdir>
                </attributes>

              Embed stylesheets and images::
              
                - set embedAssets option to true
                - don't set linkcss attribute
                - set imagesdir attribute to path relative to project root

                <embedAssets>true</embedAssets>
                <attributes>
                    <imagesdir>src/main/asciidoc/images</imagesdir>
                </attributes>

              Link to stylesheets but embed images::
              
                - set embedAssets option to true
                - set linkcss attribute to true
                - set imagesdir attribute to path relative to project root

                <embedAssets>true</embedAssets>
                <attributes>
                    <linkcss>true</linkcss>
                    <imagesdir>src/main/asciidoc/images</imagesdir>
                </attributes>

              Embed stylesheets but link images (default)::
              
                - don't set embedAssets option
                - don't set linkcss attribute
                - set imagesdir attribute to path relative to AsciiDoc source file

                <attributes>
                    <imagesdir>./images</imagesdir>
                </attributes>

              IMPORTANT: When you enable image embedding, you must qualify the path the the imagesdir, as shown above.
              -->
              <attributes>
                <imagesdir>./images</imagesdir>
                <toc>left</toc>
                <icons>font</icons>
                <sectanchors>true</sectanchors>
                <!-- set the idprefix to blank -->
                <idprefix />
                <idseparator>-</idseparator>
                <docinfo1>true</docinfo1>
              </attributes>
            </configuration>
          </execution>
          <execution>
            <id>generate-pdf-doc</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>process-asciidoc</goal>
            </goals>
            <configuration>
              <backend>pdf</backend>
              <!-- WARNING callout bullets don't yet work with CodeRay -->
              <sourceHighlighter>coderay</sourceHighlighter>
              <sourceDirectory>src/main/asciidoc</sourceDirectory>
              <attributes>
                <pagenums />
                <toc />
                <idprefix />
                <idseparator>-</idseparator>
              </attributes>
            </configuration>
          </execution>
        </executions>
      </plugin>

    </plugins>
  </build>
</project>
