Raise the minimum supported version of AsciidoctorJ to 2.5
Closes gh-751
This commit is contained in:
@@ -106,7 +106,7 @@ the configuration are described in the following listings:
|
||||
<plugin> <2>
|
||||
<groupId>org.asciidoctor</groupId>
|
||||
<artifactId>asciidoctor-maven-plugin</artifactId>
|
||||
<version>1.5.8</version>
|
||||
<version>2.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>generate-docs</id>
|
||||
|
||||
@@ -13,4 +13,5 @@ asciidoctorj24Version=2.4.3
|
||||
asciidoctorj25Version=2.5.1
|
||||
|
||||
javaFormatVersion=0.0.27
|
||||
|
||||
jmustacheVersion=1.12
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
<plugin>
|
||||
<groupId>org.asciidoctor</groupId>
|
||||
<artifactId>asciidoctor-maven-plugin</artifactId>
|
||||
<version>1.5.8</version>
|
||||
<version>2.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>generate-docs</id>
|
||||
@@ -96,9 +96,6 @@
|
||||
<doctype>book</doctype>
|
||||
<logHandler>
|
||||
<outputToConsole>true</outputToConsole>
|
||||
<failIf>
|
||||
<severity>DEBUG</severity>
|
||||
</failIf>
|
||||
</logHandler>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
||||
@@ -36,10 +36,6 @@ settings.gradle.projectsLoaded {
|
||||
|
||||
include "docs"
|
||||
include "spring-restdocs-asciidoctor"
|
||||
include "spring-restdocs-asciidoctor-1.5"
|
||||
include "spring-restdocs-asciidoctor-1.6"
|
||||
include "spring-restdocs-asciidoctor-2.x"
|
||||
include "spring-restdocs-asciidoctor-support"
|
||||
include "spring-restdocs-core"
|
||||
include "spring-restdocs-mockmvc"
|
||||
include "spring-restdocs-platform"
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
plugins {
|
||||
id "java"
|
||||
}
|
||||
|
||||
description = "AsciidoctorJ 1.5 extensions for Spring REST Docs"
|
||||
|
||||
dependencies {
|
||||
compileOnly("org.asciidoctor:asciidoctorj:$asciidoctorj15Version")
|
||||
|
||||
implementation(project(":spring-restdocs-asciidoctor-support"))
|
||||
|
||||
internal(platform(project(":spring-restdocs-platform")))
|
||||
|
||||
testImplementation("junit:junit")
|
||||
testImplementation("org.asciidoctor:asciidoctorj:$asciidoctorj15Version")
|
||||
testImplementation("org.assertj:assertj-core")
|
||||
|
||||
testRuntimeOnly(project(":spring-restdocs-asciidoctor-support"))
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.restdocs.asciidoctor;
|
||||
|
||||
import org.asciidoctor.ast.Document;
|
||||
import org.asciidoctor.extension.Preprocessor;
|
||||
import org.asciidoctor.extension.PreprocessorReader;
|
||||
|
||||
/**
|
||||
* {@link Preprocessor} that sets defaults for REST Docs-related {@link Document}
|
||||
* attributes.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
final class DefaultAttributesAsciidoctorJ15Preprocessor extends Preprocessor {
|
||||
|
||||
private final SnippetsDirectoryResolver snippetsDirectoryResolver = new SnippetsDirectoryResolver();
|
||||
|
||||
@Override
|
||||
public PreprocessorReader process(Document document, PreprocessorReader reader) {
|
||||
document.setAttr("snippets", this.snippetsDirectoryResolver.getSnippetsDirectory(document.getAttributes()),
|
||||
false);
|
||||
return reader;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.restdocs.asciidoctor;
|
||||
|
||||
import org.asciidoctor.Asciidoctor;
|
||||
import org.asciidoctor.extension.spi.ExtensionRegistry;
|
||||
|
||||
/**
|
||||
* AsciidoctorJ 1.5 {@link ExtensionRegistry} for Spring REST Docs.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
public final class RestDocsAsciidoctorJ15ExtensionRegistry implements ExtensionRegistry {
|
||||
|
||||
@Override
|
||||
public void register(Asciidoctor asciidoctor) {
|
||||
if (!asciidoctorJ15()) {
|
||||
return;
|
||||
}
|
||||
asciidoctor.javaExtensionRegistry().preprocessor(new DefaultAttributesAsciidoctorJ15Preprocessor());
|
||||
asciidoctor.rubyExtensionRegistry()
|
||||
.loadClass(RestDocsAsciidoctorJ15ExtensionRegistry.class
|
||||
.getResourceAsStream("/extensions/operation_block_macro.rb"))
|
||||
.blockMacro("operation", "OperationBlockMacro");
|
||||
}
|
||||
|
||||
private boolean asciidoctorJ15() {
|
||||
try {
|
||||
return !Class.forName("org.asciidoctor.extension.JavaExtensionRegistry").isInterface();
|
||||
}
|
||||
catch (Throwable ex) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.restdocs.asciidoctor;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.asciidoctor.Asciidoctor;
|
||||
import org.asciidoctor.Attributes;
|
||||
import org.asciidoctor.Options;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Tests for {@link DefaultAttributesAsciidoctorJ15Preprocessor}.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
public class DefaultAttributesAsciidoctorJ15PreprocessorTests {
|
||||
|
||||
@Test
|
||||
public void snippetsAttributeIsSet() {
|
||||
String converted = createAsciidoctor().convert("{snippets}", createOptions("projectdir=../../.."));
|
||||
assertThat(converted).contains("build" + File.separatorChar + "generated-snippets");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void snippetsAttributeFromConvertArgumentIsNotOverridden() {
|
||||
String converted = createAsciidoctor().convert("{snippets}",
|
||||
createOptions("snippets=custom projectdir=../../.."));
|
||||
assertThat(converted).contains("custom");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void snippetsAttributeFromDocumentPreambleIsNotOverridden() {
|
||||
String converted = createAsciidoctor().convert(":snippets: custom\n{snippets}",
|
||||
createOptions("projectdir=../../.."));
|
||||
assertThat(converted).contains("custom");
|
||||
}
|
||||
|
||||
private Options createOptions(String attributes) {
|
||||
Options options = new Options();
|
||||
options.setAttributes(new Attributes(attributes));
|
||||
return options;
|
||||
}
|
||||
|
||||
private Asciidoctor createAsciidoctor() {
|
||||
Asciidoctor asciidoctor = Asciidoctor.Factory.create();
|
||||
asciidoctor.javaExtensionRegistry().preprocessor(new DefaultAttributesAsciidoctorJ15Preprocessor());
|
||||
return asciidoctor;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
plugins {
|
||||
id "java"
|
||||
}
|
||||
|
||||
description = "AsciidoctorJ 1.6 extensions for Spring REST Docs"
|
||||
|
||||
dependencies {
|
||||
compileOnly("org.asciidoctor:asciidoctorj:$asciidoctorj16Version")
|
||||
|
||||
implementation(project(":spring-restdocs-asciidoctor-support"))
|
||||
|
||||
internal(platform(project(":spring-restdocs-platform")))
|
||||
|
||||
testImplementation("junit:junit")
|
||||
testImplementation("org.asciidoctor:asciidoctorj:$asciidoctorj16Version")
|
||||
testImplementation("org.assertj:assertj-core")
|
||||
|
||||
testRuntimeOnly(project(":spring-restdocs-asciidoctor-support"))
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.restdocs.asciidoctor;
|
||||
|
||||
import org.asciidoctor.Asciidoctor;
|
||||
import org.asciidoctor.extension.spi.ExtensionRegistry;
|
||||
|
||||
/**
|
||||
* AsciidoctorJ 1.6 {@link ExtensionRegistry} for Spring REST Docs.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
public final class RestDocsAsciidoctorJ16ExtensionRegistry implements ExtensionRegistry {
|
||||
|
||||
@Override
|
||||
public void register(Asciidoctor asciidoctor) {
|
||||
if (!asciidoctorJ16()) {
|
||||
return;
|
||||
}
|
||||
asciidoctor.javaExtensionRegistry().preprocessor(new DefaultAttributesAsciidoctorJ16Preprocessor());
|
||||
asciidoctor.rubyExtensionRegistry()
|
||||
.loadClass(RestDocsAsciidoctorJ16ExtensionRegistry.class
|
||||
.getResourceAsStream("/extensions/operation_block_macro.rb"))
|
||||
.blockMacro("operation", "OperationBlockMacro");
|
||||
}
|
||||
|
||||
private boolean asciidoctorJ16() {
|
||||
try {
|
||||
return Class.forName("org.asciidoctor.extension.JavaExtensionRegistry").isInterface();
|
||||
}
|
||||
catch (Throwable ex) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.restdocs.asciidoctor;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.asciidoctor.Asciidoctor;
|
||||
import org.asciidoctor.Attributes;
|
||||
import org.asciidoctor.Options;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Tests for {@link DefaultAttributesAsciidoctorJ16Preprocessor}.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
public class DefaultAttributesAsciidoctorJ16PreprocessorTests {
|
||||
|
||||
@Test
|
||||
public void snippetsAttributeIsSet() {
|
||||
String converted = createAsciidoctor().convert("{snippets}", createOptions("projectdir=../../.."));
|
||||
assertThat(converted).contains("build" + File.separatorChar + "generated-snippets");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void snippetsAttributeFromConvertArgumentIsNotOverridden() {
|
||||
String converted = createAsciidoctor().convert("{snippets}",
|
||||
createOptions("snippets=custom projectdir=../../.."));
|
||||
assertThat(converted).contains("custom");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void snippetsAttributeFromDocumentPreambleIsNotOverridden() {
|
||||
String converted = createAsciidoctor().convert(":snippets: custom\n{snippets}",
|
||||
createOptions("projectdir=../../.."));
|
||||
assertThat(converted).contains("custom");
|
||||
}
|
||||
|
||||
private Options createOptions(String attributes) {
|
||||
Options options = new Options();
|
||||
options.setAttributes(new Attributes(attributes));
|
||||
return options;
|
||||
}
|
||||
|
||||
private Asciidoctor createAsciidoctor() {
|
||||
Asciidoctor asciidoctor = Asciidoctor.Factory.create();
|
||||
asciidoctor.javaExtensionRegistry().preprocessor(new DefaultAttributesAsciidoctorJ16Preprocessor());
|
||||
return asciidoctor;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
plugins {
|
||||
id "java"
|
||||
}
|
||||
description = "AsciidoctorJ 2.x extensions for Spring REST Docs"
|
||||
|
||||
dependencies {
|
||||
compileOnly("org.asciidoctor:asciidoctorj:$asciidoctorj20Version")
|
||||
|
||||
implementation(project(":spring-restdocs-asciidoctor-support"))
|
||||
|
||||
internal(platform(project(":spring-restdocs-platform")))
|
||||
|
||||
testImplementation("junit:junit")
|
||||
testImplementation("org.asciidoctor:asciidoctorj:$asciidoctorj20Version")
|
||||
testImplementation("org.assertj:assertj-core")
|
||||
|
||||
testRuntimeOnly(project(":spring-restdocs-asciidoctor-support"))
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.restdocs.asciidoctor;
|
||||
|
||||
import org.asciidoctor.ast.Document;
|
||||
import org.asciidoctor.extension.Preprocessor;
|
||||
import org.asciidoctor.extension.PreprocessorReader;
|
||||
|
||||
/**
|
||||
* {@link Preprocessor} that sets defaults for REST Docs-related {@link Document}
|
||||
* attributes.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
final class DefaultAttributesAsciidoctorJ2xPreprocessor extends Preprocessor {
|
||||
|
||||
private final SnippetsDirectoryResolver snippetsDirectoryResolver = new SnippetsDirectoryResolver();
|
||||
|
||||
@Override
|
||||
public void process(Document document, PreprocessorReader reader) {
|
||||
document.setAttribute("snippets", this.snippetsDirectoryResolver.getSnippetsDirectory(document.getAttributes()),
|
||||
false);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
plugins {
|
||||
id "java"
|
||||
}
|
||||
|
||||
description = "Support code for AsciidoctorJ extensions for Spring REST Docs"
|
||||
|
||||
dependencies {
|
||||
internal(platform(project(":spring-restdocs-platform")))
|
||||
|
||||
testImplementation("junit:junit")
|
||||
testImplementation("org.assertj:assertj-core")
|
||||
}
|
||||
@@ -1,51 +1,19 @@
|
||||
plugins {
|
||||
id "io.spring.compatibility-test" version "0.0.1"
|
||||
id "java-library"
|
||||
id "maven-publish"
|
||||
}
|
||||
|
||||
description = "Spring REST Docs Asciidoctor Extension"
|
||||
|
||||
configurations {
|
||||
merge
|
||||
testRuntimeOnly { extendsFrom merge }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
internal(platform(project(":spring-restdocs-platform")))
|
||||
implementation("org.asciidoctor:asciidoctorj")
|
||||
|
||||
merge project(":spring-restdocs-asciidoctor-1.5")
|
||||
merge project(":spring-restdocs-asciidoctor-1.6")
|
||||
merge project(":spring-restdocs-asciidoctor-2.x")
|
||||
internal(platform(project(":spring-restdocs-platform")))
|
||||
|
||||
testImplementation("junit:junit")
|
||||
testImplementation("org.apache.pdfbox:pdfbox")
|
||||
testImplementation("org.asciidoctor:asciidoctorj:1.5.8.1")
|
||||
testImplementation("org.assertj:assertj-core")
|
||||
testImplementation("org.springframework:spring-core")
|
||||
|
||||
testRuntimeOnly("org.asciidoctor:asciidoctorj-pdf")
|
||||
}
|
||||
|
||||
jar {
|
||||
dependsOn(":spring-restdocs-asciidoctor-1.5:jar")
|
||||
dependsOn(":spring-restdocs-asciidoctor-1.6:jar")
|
||||
dependsOn(":spring-restdocs-asciidoctor-2.x:jar")
|
||||
from configurations.merge.collect { file -> zipTree(file) }
|
||||
}
|
||||
|
||||
compatibilityTest {
|
||||
dependency('AsciidoctorJ') { asciidoctorJ ->
|
||||
asciidoctorJ.groupId = "org.asciidoctor"
|
||||
asciidoctorJ.artifactId = "asciidoctorj"
|
||||
asciidoctorJ.versions = [
|
||||
asciidoctorj16Version,
|
||||
asciidoctorj20Version,
|
||||
asciidoctorj21Version,
|
||||
asciidoctorj22Version,
|
||||
asciidoctorj23Version,
|
||||
asciidoctorj24Version,
|
||||
asciidoctorj25Version,
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -26,7 +26,7 @@ import org.asciidoctor.extension.PreprocessorReader;
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
final class DefaultAttributesAsciidoctorJ16Preprocessor extends Preprocessor {
|
||||
final class DefaultAttributesPreprocessor extends Preprocessor {
|
||||
|
||||
private final SnippetsDirectoryResolver snippetsDirectoryResolver = new SnippetsDirectoryResolver();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,18 +20,17 @@ import org.asciidoctor.Asciidoctor;
|
||||
import org.asciidoctor.jruby.extension.spi.ExtensionRegistry;
|
||||
|
||||
/**
|
||||
* AsciidoctorJ 2.x {@link ExtensionRegistry} for Spring REST Docs.
|
||||
* {@link ExtensionRegistry} for Spring REST Docs.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
public final class RestDocsAsciidoctorJ2xExtensionRegistry implements ExtensionRegistry {
|
||||
public final class RestDocsExtensionRegistry implements ExtensionRegistry {
|
||||
|
||||
@Override
|
||||
public void register(Asciidoctor asciidoctor) {
|
||||
asciidoctor.javaExtensionRegistry().preprocessor(new DefaultAttributesAsciidoctorJ2xPreprocessor());
|
||||
asciidoctor.javaExtensionRegistry().preprocessor(new DefaultAttributesPreprocessor());
|
||||
asciidoctor.rubyExtensionRegistry()
|
||||
.loadClass(RestDocsAsciidoctorJ2xExtensionRegistry.class
|
||||
.getResourceAsStream("/extensions/operation_block_macro.rb"))
|
||||
.loadClass(RestDocsExtensionRegistry.class.getResourceAsStream("/extensions/operation_block_macro.rb"))
|
||||
.blockMacro("operation", "OperationBlockMacro");
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -1,2 +0,0 @@
|
||||
org.springframework.restdocs.asciidoctor.RestDocsAsciidoctorJ15ExtensionRegistry
|
||||
org.springframework.restdocs.asciidoctor.RestDocsAsciidoctorJ16ExtensionRegistry
|
||||
@@ -1 +1 @@
|
||||
org.springframework.restdocs.asciidoctor.RestDocsAsciidoctorJ2xExtensionRegistry
|
||||
org.springframework.restdocs.asciidoctor.RestDocsExtensionRegistry
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -34,7 +34,6 @@ import org.apache.pdfbox.pdmodel.PDDocument;
|
||||
import org.asciidoctor.Asciidoctor;
|
||||
import org.asciidoctor.Attributes;
|
||||
import org.asciidoctor.Options;
|
||||
import org.asciidoctor.OptionsBuilder;
|
||||
import org.asciidoctor.SafeMode;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
@@ -64,7 +63,7 @@ public abstract class AbstractOperationBlockMacroTests {
|
||||
@Before
|
||||
public void setUp() throws IOException {
|
||||
prepareOperationSnippets(getBuildOutputLocation());
|
||||
this.options = OptionsBuilder.options().safe(SafeMode.UNSAFE).baseDir(getSourceLocation()).get();
|
||||
this.options = Options.builder().safe(SafeMode.UNSAFE).baseDir(getSourceLocation()).build();
|
||||
this.options.setAttributes(getAttributes());
|
||||
CapturingLogHandler.clear();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -26,11 +26,11 @@ import org.junit.Test;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Tests for {@link DefaultAttributesAsciidoctorJ2xPreprocessor}.
|
||||
* Tests for {@link DefaultAttributesPreprocessor}.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
public class DefaultAttributesAsciidoctorJ2xPreprocessorTests {
|
||||
public class DefaultAttributesPreprocessorTests {
|
||||
|
||||
@Test
|
||||
public void snippetsAttributeIsSet() {
|
||||
@@ -53,14 +53,14 @@ public class DefaultAttributesAsciidoctorJ2xPreprocessorTests {
|
||||
}
|
||||
|
||||
private Options createOptions(String attributes) {
|
||||
Options options = new Options();
|
||||
options.setAttributes(new Attributes(attributes));
|
||||
Options options = Options.builder().build();
|
||||
options.setAttributes(Attributes.builder().arguments(attributes).build());
|
||||
return options;
|
||||
}
|
||||
|
||||
private Asciidoctor createAsciidoctor() {
|
||||
Asciidoctor asciidoctor = Asciidoctor.Factory.create();
|
||||
asciidoctor.javaExtensionRegistry().preprocessor(new DefaultAttributesAsciidoctorJ2xPreprocessor());
|
||||
asciidoctor.javaExtensionRegistry().preprocessor(new DefaultAttributesPreprocessor());
|
||||
return asciidoctor;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -42,22 +42,24 @@ public class GradleOperationBlockMacroTests extends AbstractOperationBlockMacroT
|
||||
return new Object[] { "projectdir", "gradle-projectdir" };
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Attributes getAttributes() {
|
||||
Attributes attributes = new Attributes();
|
||||
attributes.setAttribute(this.attributeName, new File(temp.getRoot(), "gradle-project").getAbsolutePath());
|
||||
Attributes attributes = Attributes.builder()
|
||||
.attribute(this.attributeName, new File(this.temp.getRoot(), "gradle-project").getAbsolutePath())
|
||||
.build();
|
||||
return attributes;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected File getBuildOutputLocation() {
|
||||
File outputLocation = new File(temp.getRoot(), "gradle-project/build");
|
||||
File outputLocation = new File(this.temp.getRoot(), "gradle-project/build");
|
||||
outputLocation.mkdirs();
|
||||
return outputLocation;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected File getSourceLocation() {
|
||||
File sourceLocation = new File(temp.getRoot(), "gradle-project/src/docs/asciidoc");
|
||||
File sourceLocation = new File(this.temp.getRoot(), "gradle-project/src/docs/asciidoc");
|
||||
if (!sourceLocation.exists()) {
|
||||
sourceLocation.mkdirs();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -40,12 +40,12 @@ public class MavenOperationBlockMacroTests extends AbstractOperationBlockMacroTe
|
||||
System.clearProperty("maven.home");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Attributes getAttributes() {
|
||||
try {
|
||||
File sourceLocation = getSourceLocation();
|
||||
new File(sourceLocation.getParentFile().getParentFile().getParentFile(), "pom.xml").createNewFile();
|
||||
Attributes attributes = new Attributes();
|
||||
attributes.setAttribute("docdir", sourceLocation.getAbsolutePath());
|
||||
Attributes attributes = Attributes.builder().attribute("docdir", sourceLocation.getAbsolutePath()).build();
|
||||
return attributes;
|
||||
}
|
||||
catch (IOException ex) {
|
||||
@@ -55,14 +55,14 @@ public class MavenOperationBlockMacroTests extends AbstractOperationBlockMacroTe
|
||||
|
||||
@Override
|
||||
protected File getBuildOutputLocation() {
|
||||
File outputLocation = new File(temp.getRoot(), "maven-project/target");
|
||||
File outputLocation = new File(this.temp.getRoot(), "maven-project/target");
|
||||
outputLocation.mkdirs();
|
||||
return outputLocation;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected File getSourceLocation() {
|
||||
File sourceLocation = new File(temp.getRoot(), "maven-project/src/main/asciidoc");
|
||||
File sourceLocation = new File(this.temp.getRoot(), "maven-project/src/main/asciidoc");
|
||||
if (!sourceLocation.exists()) {
|
||||
sourceLocation.mkdirs();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,8 +16,9 @@ dependencies {
|
||||
api("junit:junit:4.12")
|
||||
api("io.rest-assured:rest-assured:4.4.0")
|
||||
api("org.apache.pdfbox:pdfbox:2.0.7")
|
||||
api("org.asciidoctor:asciidoctorj:2.5.2")
|
||||
api("org.asciidoctor:asciidoctorj-pdf:1.6.0")
|
||||
api("org.assertj:assertj-core:3.11.1")
|
||||
api("org.asciidoctor:asciidoctorj-pdf:1.5.0-alpha.18")
|
||||
api("org.hamcrest:hamcrest-core:1.3")
|
||||
api("org.hamcrest:hamcrest-library:1.3")
|
||||
api("org.hibernate.validator:hibernate-validator:6.0.9.Final")
|
||||
|
||||
Reference in New Issue
Block a user