<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>io.quarkiverse.githubapi</groupId>
        <artifactId>quarkus-github-api-parent</artifactId>
        <version>1.316.0</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <artifactId>quarkus-github-api-docs</artifactId>
    <name>Quarkus - GitHub API - Documentation</name>
    
    <properties>
        <asciidoctorj.version>2.5.10</asciidoctorj.version>
        <asciidoctor-maven-plugin.version>2.2.4</asciidoctor-maven-plugin.version>
    </properties>

    <dependencies>
        <!-- Make sure the doc is built after the other artifacts -->
        <dependency>
            <groupId>io.quarkiverse.githubapi</groupId>
            <artifactId>quarkus-github-api-deployment</artifactId>
            <version>${project.version}</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-resources</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.basedir}/modules/ROOT/pages/includes/</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>${project.basedir}/../target/asciidoc/generated/config/</directory>
                                    <include>quarkus-github-api.adoc</include>
                                    <filtering>false</filtering>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.asciidoctor</groupId>
                <artifactId>asciidoctor-maven-plugin</artifactId>
                <version>${asciidoctor-maven-plugin.version}</version>
                <configuration>
                    <skip>${skipDocs}</skip>
                    <enableVerbose>true</enableVerbose>
                    <logHandler>
                        <failIf>
                          <severity>WARN</severity>
                        </failIf>
                    </logHandler>
                    <sourceDirectory>${project.basedir}/modules/ROOT/pages/</sourceDirectory>
                    <preserveDirectories>true</preserveDirectories>
                    <attributes>
                        <icons>font</icons>
                        <sectanchors>true</sectanchors>
                        <!-- set the idprefix to blank -->
                        <idprefix />
                        <idseparator>-</idseparator>
                        <docinfo1>true</docinfo1>
                        <!-- avoid content security policy violations -->
                        <skip-front-matter>true</skip-front-matter>
                    </attributes>
                </configuration>
                <executions>
                    <execution>
                        <id>output-html</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>process-asciidoc</goal>
                        </goals>
                        <configuration>
                            <skip>${skipDocs}</skip>
                            <backend>html5</backend>
                            <attributes>
                                <source-highlighter>coderay</source-highlighter>
                                <!-- avoid content security policy violations -->
                                <linkcss>true</linkcss>
                                <copycss>true</copycss>
                            </attributes>
                        </configuration>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.asciidoctor</groupId>
                        <artifactId>asciidoctorj</artifactId>
                        <version>${asciidoctorj.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>
</project>
