Broaden compatibility testing for Asciidoctor 2.x
Closes gh-630
This commit is contained in:
@@ -3,4 +3,5 @@ javaFormatVersion=0.0.15
|
||||
org.gradle.daemon=false
|
||||
asciidoctorj15Version=1.5.8.1
|
||||
asciidoctorj16Version=1.6.2
|
||||
asciidoctorj20Version=2.0.0-RC.3
|
||||
asciidoctorj20Version=2.0.0
|
||||
asciidoctorj21Version=2.1.0
|
||||
|
||||
@@ -4,7 +4,7 @@ include 'docs'
|
||||
include 'spring-restdocs-asciidoctor'
|
||||
include 'spring-restdocs-asciidoctor-1.5'
|
||||
include 'spring-restdocs-asciidoctor-1.6'
|
||||
include 'spring-restdocs-asciidoctor-2.0'
|
||||
include 'spring-restdocs-asciidoctor-2.x'
|
||||
include 'spring-restdocs-asciidoctor-support'
|
||||
include 'spring-restdocs-core'
|
||||
include 'spring-restdocs-mockmvc'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
description = 'AsciidoctorJ 2.0 extensions for Spring REST Docs'
|
||||
description = 'AsciidoctorJ 2.x extensions for Spring REST Docs'
|
||||
|
||||
dependencies {
|
||||
compileOnly "org.asciidoctor:asciidoctorj:$asciidoctorj20Version"
|
||||
@@ -26,7 +26,7 @@ import org.asciidoctor.extension.PreprocessorReader;
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
final class DefaultAttributesAsciidoctorJ20Preprocessor extends Preprocessor {
|
||||
final class DefaultAttributesAsciidoctorJ2xPreprocessor extends Preprocessor {
|
||||
|
||||
private final SnippetsDirectoryResolver snippetsDirectoryResolver = new SnippetsDirectoryResolver();
|
||||
|
||||
@@ -20,17 +20,17 @@ import org.asciidoctor.Asciidoctor;
|
||||
import org.asciidoctor.jruby.extension.spi.ExtensionRegistry;
|
||||
|
||||
/**
|
||||
* AsciidoctorJ 2.0 {@link ExtensionRegistry} for Spring REST Docs.
|
||||
* AsciidoctorJ 2.x {@link ExtensionRegistry} for Spring REST Docs.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
public final class RestDocsAsciidoctorJ20ExtensionRegistry implements ExtensionRegistry {
|
||||
public final class RestDocsAsciidoctorJ2xExtensionRegistry implements ExtensionRegistry {
|
||||
|
||||
@Override
|
||||
public void register(Asciidoctor asciidoctor) {
|
||||
asciidoctor.javaExtensionRegistry().preprocessor(new DefaultAttributesAsciidoctorJ20Preprocessor());
|
||||
asciidoctor.javaExtensionRegistry().preprocessor(new DefaultAttributesAsciidoctorJ2xPreprocessor());
|
||||
asciidoctor.rubyExtensionRegistry()
|
||||
.loadClass(RestDocsAsciidoctorJ20ExtensionRegistry.class
|
||||
.loadClass(RestDocsAsciidoctorJ2xExtensionRegistry.class
|
||||
.getResourceAsStream("/extensions/operation_block_macro.rb"))
|
||||
.blockMacro("operation", "OperationBlockMacro");
|
||||
}
|
||||
@@ -26,11 +26,11 @@ import org.junit.Test;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Tests for {@link DefaultAttributesAsciidoctorJ20Preprocessor}.
|
||||
* Tests for {@link DefaultAttributesAsciidoctorJ2xPreprocessor}.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
public class DefaultAttributesAsciidoctorJ20PreprocessorTests {
|
||||
public class DefaultAttributesAsciidoctorJ2xPreprocessorTests {
|
||||
|
||||
@Test
|
||||
public void snippetsAttributeIsSet() {
|
||||
@@ -60,7 +60,7 @@ public class DefaultAttributesAsciidoctorJ20PreprocessorTests {
|
||||
|
||||
private Asciidoctor createAsciidoctor() {
|
||||
Asciidoctor asciidoctor = Asciidoctor.Factory.create();
|
||||
asciidoctor.javaExtensionRegistry().preprocessor(new DefaultAttributesAsciidoctorJ20Preprocessor());
|
||||
asciidoctor.javaExtensionRegistry().preprocessor(new DefaultAttributesAsciidoctorJ2xPreprocessor());
|
||||
return asciidoctor;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ configurations {
|
||||
dependencies {
|
||||
merge project(':spring-restdocs-asciidoctor-1.5')
|
||||
merge project(':spring-restdocs-asciidoctor-1.6')
|
||||
merge project(':spring-restdocs-asciidoctor-2.0')
|
||||
merge project(':spring-restdocs-asciidoctor-2.x')
|
||||
testCompile 'org.apache.pdfbox:pdfbox'
|
||||
testCompile 'org.asciidoctor:asciidoctorj:1.5.8.1'
|
||||
testCompile 'org.assertj:assertj-core'
|
||||
@@ -18,7 +18,7 @@ dependencies {
|
||||
jar {
|
||||
dependsOn ':spring-restdocs-asciidoctor-1.5:jar'
|
||||
dependsOn ':spring-restdocs-asciidoctor-1.6:jar'
|
||||
dependsOn ':spring-restdocs-asciidoctor-2.0:jar'
|
||||
dependsOn ':spring-restdocs-asciidoctor-2.x:jar'
|
||||
from configurations.merge.collect { file -> zipTree(file) }
|
||||
}
|
||||
|
||||
@@ -26,6 +26,6 @@ matrixTest {
|
||||
asciidoctorj {
|
||||
group = 'org.asciidoctor'
|
||||
artifact = 'asciidoctorj'
|
||||
versions = [ asciidoctorj16Version, asciidoctorj20Version ]
|
||||
versions = [ asciidoctorj16Version, asciidoctorj20Version, asciidoctorj21Version ]
|
||||
}
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
org.springframework.restdocs.asciidoctor.RestDocsAsciidoctorJ20ExtensionRegistry
|
||||
org.springframework.restdocs.asciidoctor.RestDocsAsciidoctorJ2xExtensionRegistry
|
||||
|
||||
Reference in New Issue
Block a user