Traverse subfolders to find files that can be converted

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Traverse subfolders to find files that can be converted

SigmaSquared
With my .pom configuration below, I can run a 'mvn clean install' within my [root project folder] and it will pick up any .adoc format files that Asciidoctor can converted (i.e. .adoc >> .html).  Is there a way by configuring the pom file below in such a way, that it will not only only look into the root folder, but also the sub folders and push those converted files into the target folder?  Is there a wildcard (*) command of sorts that I can configure the .pom file with, to say, 'Hey, not only go into this rootfolder, but also go into all subfolders and see if there are any other files that needs to be converted.'

Thanks,
Sigma


<?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>com.test.spike</groupId>
  <artifactId>test-documentation-spike</artifactId>
  <version>1.0.0-SNAPSHOT</version>
  <packaging>pom</packaging>

  <name>${project.artifactId}</name>

  <build>
    <plugins>
      <plugin>
        <groupId>org.asciidoctor</groupId>
        <artifactId>asciidoctor-maven-plugin</artifactId>
        <version>1.5.2.1</version>
        <dependencies>
          <dependency>
            <groupId>org.asciidoctor</groupId>
            <artifactId>asciidoctorj-pdf</artifactId>
            <version>1.5.0-alpha.9</version>
          </dependency>
        </dependencies>
        <executions>
          <execution>
            <id>output-pdf</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>process-asciidoc</goal>
            </goals>
            <configuration>
              <backend>pdf</backend>
              <doctype>book</doctype>
            </configuration>
          </execution>
          <execution>
            <id>output-html</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>process-asciidoc</goal>
            </goals>
            <configuration>
              <backend>html</backend>
              <doctype>book</doctype>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
Reply | Threaded
Open this post in threaded view
|

Re: Traverse subfolders to find files that can be converted

mojavelinux
Administrator
My understanding was that this is how the plugin works. It should descend into all folders in the source directory (e.g., src/docs/asciidoc) and convert all the files unless the file or folder begins with an underscore.

-Dan

On Mon, Sep 21, 2015 at 12:09 PM, SigmaSquared [via Asciidoctor :: Discussion] <[hidden email]> wrote:
With my .pom configuration below, I can run a 'mvn clean install' within my [root project folder] and it will pick up any .adoc format files that Asciidoctor can converted (i.e. .adoc >> .html).  Is there a way by configuring the pom file below in such a way, that it will not only only look into the root folder, but also the sub folders and push those converted files into the target folder?  Is there a wildcard (*) command of sorts that I can configure the .pom file with, to say, 'Hey, not only go into this rootfolder, but also go into all subfolders and see if there are any other files that needs to be converted.'

Thanks,
Sigma


<?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>com.test.spike</groupId>
  <artifactId>test-documentation-spike</artifactId>
  <version>1.0.0-SNAPSHOT</version>
  <packaging>pom</packaging>

  <name>${project.artifactId}</name>

  <build>
    <plugins>
      <plugin>
        <groupId>org.asciidoctor</groupId>
        <artifactId>asciidoctor-maven-plugin</artifactId>
        <version>1.5.2.1</version>
        <dependencies>
          <dependency>
            <groupId>org.asciidoctor</groupId>
            <artifactId>asciidoctorj-pdf</artifactId>
            <version>1.5.0-alpha.9</version>
          </dependency>
        </dependencies>
        <executions>
          <execution>
            <id>output-pdf</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>process-asciidoc</goal>
            </goals>
            <configuration>
              <backend>pdf</backend>
              <doctype>book</doctype>
            </configuration>
          </execution>
          <execution>
            <id>output-html</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>process-asciidoc</goal>
            </goals>
            <configuration>
              <backend>html</backend>
              <doctype>book</doctype>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Traverse-subfolders-to-find-files-that-can-be-converted-tp3743.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Dan Allen | @mojavelinux | http://google.com/profiles/dan.j.allen
Reply | Threaded
Open this post in threaded view
|

Re: Traverse subfolders to find files that can be converted

SigmaSquared
Hi Dan,

You are right.  However, I was looking in the same director in which the .adoc file was located, so I missed it.  I was expecting the plugin to respect the location in which the file was located and not set it in the root folder.  Is there a way to keep the file/folder infrastructure intact that that when i drop my .adoc file in  [src/docs/asciidoc/subfolder/file1.adoc], it will stay inside of [src/docs/asciidoc/subfolder] instead of [src/docs/asciidoc]?

Regards,
Fred
Reply | Threaded
Open this post in threaded view
|

Re: Traverse subfolders to find files that can be converted

abelsromero
Hi,

To mantain the same folder structure you must set preserveDirectories to true in the configuration section like this:
<preserveDirectories>true</preserveDirectories>
On the readme you'll find some more information: https://github.com/asciidoctor/asciidoctor-maven-plugin#configuration-options
Reply | Threaded
Open this post in threaded view
|

Re: Traverse subfolders to find files that can be converted

SigmaSquared
Abelsromero,

Thank you so very much.

Regards,
Fred