-
Notifications
You must be signed in to change notification settings - Fork 243
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new asciidoc-maven-site-parser-example example (#254)
* Rename asciidoc-maven-site-example to asciidoc-maven-site-converter-example * Add new asciidoc-maven-site-parser-example
- Loading branch information
1 parent
feee067
commit 5294452
Showing
22 changed files
with
267 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
= Asciidoctor Maven Plugin (Converter Module): AsciiDoc Site Example | ||
|
||
An example project that demonstrates how to process AsciiDoc in a Maven site using the Asciidoctor Converter Doxia Module. | ||
|
||
== Usage | ||
|
||
Build the site by invoking the `site:site` goal: | ||
|
||
$ mvn site:site | ||
|
||
Open the file _target/site/hello.html_ to see the output generated from the AsciiDoc source _src/site/asciidoc/hello.adoc_. | ||
|
||
Open the file _target/site/index.html_ to see the output generated for the entire site including the link to the `hello` document. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
asciidoc-maven-site-example/README.adoc → ...doc-maven-site-parser-example/README.adoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<?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-maven-site-parser-example</artifactId> | ||
<version>1.0.0-SNAPSHOT</version> | ||
<name>AsciiDoc Maven Site Example</name> | ||
<description>An example project that demonstrates how to process AsciiDoc in a Maven site using the Asciidoctor Maven plugin.</description> | ||
|
||
<!-- All Maven properties are injected as Asciidoctor attributes. | ||
Reference them with the same name replacing dots by dashes (e.g. {jruby-version}). --> | ||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | ||
<asciidoctor.maven.plugin.version>3.0.0</asciidoctor.maven.plugin.version> | ||
<asciidoctorj.version>2.5.11</asciidoctorj.version> | ||
<jruby.version>9.4.5.0</jruby.version> | ||
</properties> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-site-plugin</artifactId> | ||
<version>3.12.1</version> | ||
<configuration> | ||
<!-- Disable generateReports if you don't want to include the built-in reports --> | ||
<generateReports>true</generateReports> | ||
<generateSitemap>true</generateSitemap> | ||
<relativizeDecorationLinks>false</relativizeDecorationLinks> | ||
<locales>en</locales> | ||
<inputEncoding>UTF-8</inputEncoding> | ||
<outputEncoding>UTF-8</outputEncoding> | ||
<asciidoc> | ||
<!-- Optional site-wide AsciiDoc attributes --> | ||
<attributes> | ||
<icons>font</icons> | ||
<!-- Add required rouge styles in '/css/site.css' --> | ||
<source-highlighter>rouge</source-highlighter> | ||
<toclevels>2</toclevels> | ||
</attributes> | ||
</asciidoc> | ||
</configuration> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.asciidoctor</groupId> | ||
<artifactId>asciidoctor-parser-doxia-module</artifactId> | ||
<version>${asciidoctor.maven.plugin.version}</version> | ||
</dependency> | ||
<!-- Comment this section to use the default jruby artifact provided by the plugin --> | ||
<dependency> | ||
<groupId>org.jruby</groupId> | ||
<artifactId>jruby</artifactId> | ||
<version>${jruby.version}</version> | ||
</dependency> | ||
<!-- Comment this section to use the default AsciidoctorJ artifact provided by the plugin --> | ||
<dependency> | ||
<groupId>org.asciidoctor</groupId> | ||
<artifactId>asciidoctorj</artifactId> | ||
<version>${asciidoctorj.version}</version> | ||
</dependency> | ||
</dependencies> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<reporting> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-project-info-reports-plugin</artifactId> | ||
<version>3.5.0</version> | ||
</plugin> | ||
</plugins> | ||
</reporting> | ||
|
||
</project> |
11 changes: 11 additions & 0 deletions
11
asciidoc-maven-site-parser-example/src/site/asciidoc/_attributes.adoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
== Attributes | ||
|
||
.Built-in | ||
asciidoctor-version:: {asciidoctor-version} | ||
safe-mode-name:: {safe-mode-name} | ||
docdir:: {docdir} | ||
|
||
.Maven properties | ||
asciidoctor.maven.plugin.version:: {asciidoctor-maven-plugin-version} | ||
asciidoctorj.version:: {asciidoctorj-version} | ||
jruby.version:: {jruby-version} |
1 change: 1 addition & 0 deletions
1
asciidoc-maven-site-parser-example/src/site/asciidoc/_include.adoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
included content |
60 changes: 60 additions & 0 deletions
60
asciidoc-maven-site-parser-example/src/site/asciidoc/article.adoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
= AsciiDoc is Writing Zen | ||
Doc Writer <doc[email protected]> | ||
//Junior Writer <junior[email protected]> | ||
v1.0, 2014-08-08 | ||
//:toc: | ||
:icons: font | ||
:source-highlighter: rouge | ||
:sectanchors: | ||
//:compat-mode: | ||
|
||
_Zen_ in the *art* of writing `plain text` with https://asciidoc.org[AsciiDoc]. | ||
|
||
[TIP] | ||
Use https://asciidoctor.org[Asciidoctor] for the best AsciiDoc experience.footnote:[Not to mention the best looking output!] | ||
Then icon:twitter[role=aqua] about it! | ||
|
||
toc::[] | ||
|
||
== Sample Section | ||
|
||
=== Unordered list | ||
|
||
* item 1 | ||
* item 2 | ||
|
||
=== Ordered list | ||
|
||
. item 1 | ||
. item 2 | ||
|
||
=== Table | ||
|
||
[caption=] | ||
.Ruby platforms | ||
|=== | ||
|Name |Language | ||
|
||
|MRI |C | ||
|JRuby |Java | ||
|Opal |JavaScript | ||
|Rubinius |Ruby | ||
|=== | ||
|
||
=== Code blocks | ||
|
||
[source,ruby] | ||
---- | ||
puts "Hello, World!" | ||
---- | ||
|
||
[source,java] | ||
---- | ||
class HelloWorld { | ||
public static void main(String[] args) { | ||
System.out.println("Hello, World!"); | ||
} | ||
} | ||
---- | ||
|
||
include::_attributes.adoc[] |
16 changes: 16 additions & 0 deletions
16
asciidoc-maven-site-parser-example/src/site/asciidoc/hello.adoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
= Hello, AsciiDoc! | ||
//:icons: font | ||
|
||
This file was converted from AsciiDoc to HTML by the Maven Site module of the Asciidoctor Maven Plugin. | ||
|
||
image::images/tiger.png[Ghostscript Tiger] | ||
_By Ghostscript authors (GPL Ghostscript SVN: tiger.eps) [GPL (https://www.gnu.org/licenses/gpl.html)], via Wikimedia Commons_ | ||
|
||
[TIP] | ||
==== | ||
Use the include directive to keep your content DRY! | ||
include::_include.adoc[] | ||
==== | ||
|
||
include::_attributes.adoc[] |
Binary file added
BIN
+64.5 KB
asciidoc-maven-site-parser-example/src/site/resources/images/tiger.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<project> | ||
<body> | ||
<menu ref="reports" inherit="top"/> | ||
<menu ref="modules"/> | ||
<menu name="Asciidoctor Example"> | ||
<item href="hello.html" name="Hello"/> | ||
<item href="article.html" name="Article"/> | ||
</menu> | ||
</body> | ||
<skin> | ||
<groupId>org.apache.maven.skins</groupId> | ||
<artifactId>maven-fluido-skin</artifactId> | ||
<version>1.12.0</version> | ||
</skin> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
tests/src/test/java/org/asciidoctor/maven/examples/AsciidocMavenSiteParserTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package org.asciidoctor.maven.examples; | ||
|
||
import org.asciidoctor.maven.examples.tests.MavenProject; | ||
import org.asciidoctor.maven.examples.tests.MavenTest; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.io.File; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
@MavenTest(projectPath = "../asciidoc-maven-site-parser-example", goal = "site:site") | ||
class AsciidocMavenSiteParserTest { | ||
|
||
private MavenProject mavenProject; | ||
|
||
@Test | ||
void shouldGenerateSitePages() { | ||
File index = mavenProject.getTarget(sitePage("index.html")); | ||
assertThat(index) | ||
.isNotEmpty() | ||
.content() | ||
.contains("<h1>AsciiDoc Maven Site Example</h1>") | ||
.contains("<li class=\"nav-header\">Asciidoctor Example</li>") | ||
.contains("<a href=\"hello.html\" title=\"Hello\"><span class=\"none\"></span>Hello</a>") | ||
.contains("<a href=\"article.html\" title=\"Article\"><span class=\"none\"></span>Article</a>"); | ||
|
||
File hello = mavenProject.getTarget(sitePage("hello.html")); | ||
assertThat(hello) | ||
.isNotEmpty() | ||
.content() | ||
.contains("<h1>Hello, AsciiDoc!</h1>") | ||
.contains("<img src=\"images/tiger.png\" alt=\"Ghostscript Tiger\">") | ||
.contains("<h2><a name=\"Attributes\"></a>Attributes</h2>"); | ||
|
||
File article = mavenProject.getTarget(sitePage("article.html")); | ||
assertThat(article) | ||
.isNotEmpty() | ||
.content() | ||
.contains("<h1>AsciiDoc is Writing Zen</h1>") | ||
.contains("<h3><a name=\"Unordered_list\"></a>Unordered list</h3>") | ||
.contains("<h3><a name=\"Ordered_list\"></a>Ordered list</h3>") | ||
.contains("<h3><a name=\"Table\"></a>Table</h3>") | ||
.contains("<h3><a name=\"Code_blocks\"></a>Code blocks</h3>") | ||
.contains("<h2><a name=\"Attributes\"></a>Attributes</h2>"); | ||
} | ||
|
||
private String sitePage(String filename) { | ||
return "site/" + filename; | ||
} | ||
} |