Skip to content

Commit 23073d9

Browse files
committed
Make block switches work on every page of multi-page docs
There's a bug in some versions of AsciidoctorJ where extensions are only called on this first conversion performed by a given Asciidoctor instance. This affects the multi-page documentation where there are multiple conversions performed – one for each page in the documentation. This commit upgrades the version of AsciidoctorJ used by the Asciidoctor Gradle plugin to 2.4.1, which contains fix for the problem. Closes gh-23709
1 parent 2916bb4 commit 23073d9

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

buildSrc/src/main/java/org/springframework/boot/build/AsciidoctorConventions.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
*
4747
* <ul>
4848
* <li>All warnings are made fatal.
49+
* <li>The version of AsciidoctorJ is upgraded to 2.4.1.
4950
* <li>A task is created to resolve and unzip our documentation resources (CSS and
5051
* Javascript).
5152
* <li>For each {@link AsciidoctorTask} (HTML only):
@@ -69,10 +70,13 @@
6970
*/
7071
class AsciidoctorConventions {
7172

73+
private static final String ASCIIDOCTORJ_VERSION = "2.4.1";
74+
7275
void apply(Project project) {
7376
project.getPlugins().withType(AsciidoctorJPlugin.class, (asciidoctorPlugin) -> {
7477
configureDocResourcesRepository(project);
7578
makeAllWarningsFatal(project);
79+
upgradeAsciidoctorJVersion(project);
7680
UnzipDocumentationResources unzipResources = createUnzipDocumentationResourcesTask(project);
7781
project.getTasks().withType(AbstractAsciidoctorTask.class, (asciidoctorTask) -> {
7882
configureCommonAttributes(project, asciidoctorTask);
@@ -110,6 +114,10 @@ private void makeAllWarningsFatal(Project project) {
110114
project.getExtensions().getByType(AsciidoctorJExtension.class).fatalWarnings(".*");
111115
}
112116

117+
private void upgradeAsciidoctorJVersion(Project project) {
118+
project.getExtensions().getByType(AsciidoctorJExtension.class).setVersion(ASCIIDOCTORJ_VERSION);
119+
}
120+
113121
private UnzipDocumentationResources createUnzipDocumentationResourcesTask(Project project) {
114122
Configuration documentationResources = project.getConfigurations().maybeCreate("documentationResources");
115123
documentationResources.getDependencies()

0 commit comments

Comments
 (0)