Skip to content

Commit

Permalink
Added new example: ascii-multiple-inputs-example
Browse files Browse the repository at this point in the history
Shows how to output multiple documentation files starting from different input files. The example here is having an end-user manual and technical documentation.
  • Loading branch information
Deblauwe, Wim authored and Deblauwe, Wim committed Jan 11, 2015
1 parent 291bd87 commit af86224
Show file tree
Hide file tree
Showing 12 changed files with 188 additions and 0 deletions.
13 changes: 13 additions & 0 deletions asciidoc-multiple-inputs-example/README.adoc
@@ -0,0 +1,13 @@
= Asciidoctor Maven Plugin: AsciiDoc Multiple Input Documents Maven Example

An example project that demonstrates how to convert multiple input AsciiDoc documents to HTML5 using the
Asciidoctor Maven plugin.

== Usage

Convert the AsciiDoc to HTML5 by invoking the `process-resources` goal (configured as the default goal):

$ mvn

Open the files _target/generated-docs/example-manual.html_ and _target/generated-docs/example-technical-doc.html_ in
your browser to see the generated HTML file.
92 changes: 92 additions & 0 deletions asciidoc-multiple-inputs-example/pom.xml
@@ -0,0 +1,92 @@
<?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>asciidoc-multiple-inputs-example</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>AsciiDoc Multiple Input Documents Maven Example</name>
<description>An example project that demonstrates how to convert multiple input AsciiDoc documents to HTML5 using the Asciidoctor Maven plugin.</description>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<asciidoctor.maven.plugin.version>1.5.2</asciidoctor.maven.plugin.version>
<jruby.version>1.7.17</jruby.version>
</properties>

<build>
<defaultGoal>process-resources</defaultGoal>
<plugins>
<plugin>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctor-maven-plugin</artifactId>
<version>${asciidoctor.maven.plugin.version}</version>
<!-- Uncomment the following element to override the version of AsciidoctorJ -->
<!--
<dependencies>
<dependency>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctorj</artifactId>
<version>1.5.2-SNAPSHOT</version>
</dependency>
</dependencies>
-->
<configuration>
<sourceDirectory>src/docs/asciidoc</sourceDirectory>
<!-- 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>
</attributes>
</configuration>
<executions>
<execution>
<id>asciidoc-usermanual-to-html</id>
<phase>generate-resources</phase>
<goals>
<goal>process-asciidoc</goal>
</goals>
<configuration>
<sourceDirectory>src/docs/asciidoc/user-manual</sourceDirectory>
<backend>html5</backend>
<sourceHighlighter>coderay</sourceHighlighter>
<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>asciidoc-techdocs-to-html</id>
<phase>generate-resources</phase>
<goals>
<goal>process-asciidoc</goal>
</goals>
<configuration>
<sourceDirectory>src/docs/asciidoc/technical-docs</sourceDirectory>
<backend>html5</backend>
<sourceHighlighter>coderay</sourceHighlighter>
<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>
</executions>
</plugin>
</plugins>
</build>
</project>
@@ -0,0 +1,9 @@
= Example Technical Documentation
Doc Writer <doc.writer@example.org>
2014-09-09
:revnumber: {project-version}
:example-caption!:
ifndef::imagesdir[:imagesdir: images]
ifndef::sourcedir[:sourcedir: ../java]

This is the technical documentation for an example project.
@@ -0,0 +1 @@
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.js"></script>
@@ -0,0 +1,54 @@
= Example Manual
Doc Writer <doc.writer@example.org>
2014-09-09
:revnumber: {project-version}
:example-caption!:
ifndef::imagesdir[:imagesdir: images]
ifndef::sourcedir[:sourcedir: ../java]

This is a user manual for an example project.

== Introduction

This project does something.
We just haven't decided what that is yet.

== Source Code

[source,java]
.Java code from project
----
include::{sourcedir}/example/StringUtils.java[tags=contains,indent=0]
----

This page was built by the following command:

$ mvn

== Images

[.thumb]
image::sunset.jpg[scaledwidth=75%]

== Attributes

.Built-in
asciidoctor-version:: {asciidoctor-version}
safe-mode-name:: {safe-mode-name}
docdir:: {docdir}
docfile:: {docfile}
imagesdir:: {imagesdir}

.Custom
project-version:: {project-version}
sourcedir:: {sourcedir}
endpoint-url:: {endpoint-url}

== Includes

.include::subdir/_b.adoc[]
====
include::subdir/_b.adoc[]
====

WARNING: Includes can be tricky!
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,7 @@
content from _src/docs/asciidoc/subdir/_b.adoc_.

.include::_c.adoc[]
[example]
--
include::_c.adoc[]
--
@@ -0,0 +1 @@
content from _src/docs/asciidoc/subdir/c.adoc_.
@@ -0,0 +1,9 @@
package example;

public class StringUtils {
// tag::contains[]
public boolean contains(String haystack, String needle) {
return haystack.contains(needle);
}
// end::contains[]
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1 @@
{"checksum":"b5a864e58455504e8ce386cae8490a92","width":540,"height":280}
1 change: 1 addition & 0 deletions pom.xml
Expand Up @@ -18,6 +18,7 @@
</properties>

<modules>
<module>asciidoc-multiple-inputs-example</module>
<module>asciidoc-site-example</module>
<module>asciidoc-to-html-example</module>
<module>asciidoc-to-pdf-example</module>
Expand Down

0 comments on commit af86224

Please sign in to comment.