-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split plugin and site in sub-modules (#595)
* Create parent module: asciidoctor-maven-tools * Create new dedicated modules: asciidoctor-maven-plugin, asciidoctor-doxia-module, asciidoctor-maven-commons * Remove unused gmaven-plugin eclipse condiguration * Remove use of commons-lang3 for StringUtils.isBlank * Remove use of deprecated constructor in AsciidoctorDoxiaParserModule * Add 'asciidoc' as valid file extension in AsciidoctorDoxiaParserModule * Update docs
- Loading branch information
1 parent
cfc72af
commit 4b0e609
Showing
207 changed files
with
1,150 additions
and
839 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
<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.asciidoctor</groupId> | ||
<artifactId>asciidoctor-maven-tools</artifactId> | ||
<version>3.0.0-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
|
||
<groupId>org.asciidoctor</groupId> | ||
<artifactId>asciidoctor-doxia-module</artifactId> | ||
<packaging>jar</packaging> | ||
|
||
<name>Asciidoctor Doxia Parser</name> | ||
<description>Asciidoctor Doxia Parser (for Maven Site integration)</description> | ||
<url>https://github.com/asciidoctor/asciidoctor-maven-plugin</url> | ||
|
||
<properties> | ||
<doxia.version>1.11.1</doxia.version> | ||
<maven.coveralls.plugin.version>4.3.0</maven.coveralls.plugin.version> | ||
<plexus.component.metadata.version>1.7</plexus.component.metadata.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.asciidoctor</groupId> | ||
<artifactId>asciidoctor-maven-commons</artifactId> | ||
<version>3.0.0-SNAPSHOT</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.asciidoctor</groupId> | ||
<artifactId>asciidoctorj</artifactId> | ||
<version>${asciidoctorj.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jruby</groupId> | ||
<artifactId>jruby</artifactId> | ||
<version>${jruby.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.maven.doxia</groupId> | ||
<artifactId>doxia-core</artifactId> | ||
<version>${doxia.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.maven</groupId> | ||
<artifactId>maven-core</artifactId> | ||
<version>${maven.project.version}</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.codehaus.plexus</groupId> | ||
<artifactId>plexus-component-metadata</artifactId> | ||
<version>${plexus.component.metadata.version}</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>generate-metadata</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.eluder.coveralls</groupId> | ||
<artifactId>coveralls-maven-plugin</artifactId> | ||
<version>${maven.coveralls.plugin.version}</version> | ||
<dependencies> | ||
<dependency> | ||
<groupId>jakarta.xml.bind</groupId> | ||
<artifactId>jakarta.xml.bind-api</artifactId> | ||
<version>2.3.3</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.glassfish.jaxb</groupId> | ||
<artifactId>jaxb-runtime</artifactId> | ||
<version>2.3.3</version> | ||
</dependency> | ||
</dependencies> | ||
</plugin> | ||
</plugins> | ||
|
||
<pluginManagement> | ||
<plugins> | ||
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.--> | ||
<plugin> | ||
<groupId>org.eclipse.m2e</groupId> | ||
<artifactId>lifecycle-mapping</artifactId> | ||
<version>1.0.0</version> | ||
<configuration> | ||
<lifecycleMappingMetadata> | ||
<pluginExecutions> | ||
<pluginExecution> | ||
<pluginExecutionFilter> | ||
<groupId>org.codehaus.plexus</groupId> | ||
<artifactId>plexus-component-metadata</artifactId> | ||
<versionRange>[${plexus.component.metadata.version},)</versionRange> | ||
<goals> | ||
<goal>generate-metadata</goal> | ||
</goals> | ||
</pluginExecutionFilter> | ||
<action> | ||
<execute/> | ||
</action> | ||
</pluginExecution> | ||
</pluginExecutions> | ||
</lifecycleMappingMetadata> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</pluginManagement> | ||
</build> | ||
|
||
</project> |
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
96 changes: 96 additions & 0 deletions
96
asciidoctor-doxia-module/src/it/maven-site-plugin/validate.bsh
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,96 @@ | ||
import java.nio.file.Files; | ||
import java.util.regex.Matcher; | ||
import java.util.regex.Pattern; | ||
|
||
File outputDir = new File(basedir, "target/site"); | ||
|
||
final String[] expectedFiles = { | ||
"file-with-toc.html", | ||
"sample.html" | ||
}; | ||
|
||
final String[] unexpectedFiles = { | ||
"_include.html" | ||
}; | ||
|
||
final Pattern tocEntry = Pattern.compile("<li><a href=\"#(.*?)\">.*"); | ||
final Pattern elementIdPattern = Pattern.compile(".* id=\"(.*?)\".*"); | ||
|
||
for (String expectedFile : expectedFiles) { | ||
final File file = new File(outputDir, expectedFile); | ||
System.out.println("Checking for presence of " + file); | ||
|
||
if (!file.isFile()) { | ||
throw new Exception("Missing file " + file); | ||
} | ||
if (file.length() == 0) { | ||
throw new Exception("Empty file " + file); | ||
} | ||
|
||
if (expectedFile.equals("file-with-toc.html")) { | ||
List lines = Files.readAllLines(file.toPath()); | ||
System.out.println("Ensuring IDs match TOC links"); | ||
|
||
List tocEntries = new ArrayList(); | ||
for (String line : lines) { | ||
Matcher matcher = tocEntry.matcher(line); | ||
if (matcher.matches()) { | ||
tocEntries.add(matcher.group(1)); | ||
} | ||
|
||
matcher = elementIdPattern.matcher(line); | ||
if (matcher.matches()) { | ||
String elementId = matcher.group(1); | ||
if (tocEntries.contains(elementId)) { | ||
tocEntries.remove(tocEntries.indexOf(elementId)); | ||
} | ||
} | ||
} | ||
|
||
if (tocEntries.size() != 0) { | ||
throw new Exception("Couldn't find matching IDs for the following TOC entries: " + tocEntries); | ||
} | ||
|
||
boolean includeResolved = false; | ||
boolean sourceHighlighted = false; | ||
|
||
for (String line : lines) { | ||
if (!includeResolved && line.contains("Content included from the file ")) { | ||
includeResolved = true; | ||
} | ||
else if (!sourceHighlighted && line.contains("<span style=\"color:#070;font-weight:bold\"><plugin></span>")) { | ||
sourceHighlighted = true; | ||
} | ||
} | ||
|
||
if (!includeResolved) { | ||
throw new Exception("Include file was not resolved."); | ||
} | ||
|
||
if (!sourceHighlighted) { | ||
throw new Exception("Source code was not highlighted."); | ||
} | ||
|
||
// validate that maven properties are replaced same as attributes | ||
boolean foundReplacement = false; | ||
for (String line : lines) { | ||
if (line.contains("v1.2.3")) { | ||
foundReplacement = true; | ||
break; | ||
} | ||
} | ||
if (!foundReplacement) { | ||
throw new Exception("Maven properties not replaced."); | ||
} | ||
} | ||
} | ||
|
||
for (String unexpectedFile : unexpectedFiles) { | ||
File file = new File(outputDir, unexpectedFile); | ||
System.out.println("Checking for absence of " + file); | ||
if (file.isFile()) { | ||
throw new Exception("Unexpected file " + file); | ||
} | ||
} | ||
|
||
return true; |
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
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
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
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
4 changes: 2 additions & 2 deletions
4
...sciidoctor/includes/groovy-include.groovy → .../resources/includes/groovy-include.groovy
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
|
||
println "HelloWorld from Groovy on ${new Date()}" | ||
|
||
println "HelloWorld from Groovy on ${new Date()}" |
File renamed without changes.
File renamed without changes.
28 changes: 28 additions & 0 deletions
28
asciidoctor-doxia-module/src/test/resources/sample.asciidoc
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,28 @@ | ||
Document Title | ||
============== | ||
Doc Writer <thedoc@asciidoctor.org> | ||
:idprefix: id_ | ||
|
||
Preamble paragraph. | ||
|
||
NOTE: This is a test, only a test. | ||
|
||
== Section A | ||
|
||
*Section A* paragraph. | ||
|
||
=== Section A Subsection | ||
|
||
*Section A* 'subsection' paragraph. | ||
|
||
== Section B | ||
|
||
*Section B* paragraph. | ||
|
||
.Section B list | ||
* Item 1 | ||
* Item 2 | ||
* Item 3 | ||
|
||
[source,ruby] | ||
require 'asciidoctor' |
File renamed without changes.
Oops, something went wrong.