mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
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
This commit is contained in:
parent
2916bb4c10
commit
23073d9e76
@ -46,6 +46,7 @@ import org.springframework.util.StringUtils;
|
|||||||
*
|
*
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>All warnings are made fatal.
|
* <li>All warnings are made fatal.
|
||||||
|
* <li>The version of AsciidoctorJ is upgraded to 2.4.1.
|
||||||
* <li>A task is created to resolve and unzip our documentation resources (CSS and
|
* <li>A task is created to resolve and unzip our documentation resources (CSS and
|
||||||
* Javascript).
|
* Javascript).
|
||||||
* <li>For each {@link AsciidoctorTask} (HTML only):
|
* <li>For each {@link AsciidoctorTask} (HTML only):
|
||||||
@ -69,10 +70,13 @@ import org.springframework.util.StringUtils;
|
|||||||
*/
|
*/
|
||||||
class AsciidoctorConventions {
|
class AsciidoctorConventions {
|
||||||
|
|
||||||
|
private static final String ASCIIDOCTORJ_VERSION = "2.4.1";
|
||||||
|
|
||||||
void apply(Project project) {
|
void apply(Project project) {
|
||||||
project.getPlugins().withType(AsciidoctorJPlugin.class, (asciidoctorPlugin) -> {
|
project.getPlugins().withType(AsciidoctorJPlugin.class, (asciidoctorPlugin) -> {
|
||||||
configureDocResourcesRepository(project);
|
configureDocResourcesRepository(project);
|
||||||
makeAllWarningsFatal(project);
|
makeAllWarningsFatal(project);
|
||||||
|
upgradeAsciidoctorJVersion(project);
|
||||||
UnzipDocumentationResources unzipResources = createUnzipDocumentationResourcesTask(project);
|
UnzipDocumentationResources unzipResources = createUnzipDocumentationResourcesTask(project);
|
||||||
project.getTasks().withType(AbstractAsciidoctorTask.class, (asciidoctorTask) -> {
|
project.getTasks().withType(AbstractAsciidoctorTask.class, (asciidoctorTask) -> {
|
||||||
configureCommonAttributes(project, asciidoctorTask);
|
configureCommonAttributes(project, asciidoctorTask);
|
||||||
@ -110,6 +114,10 @@ class AsciidoctorConventions {
|
|||||||
project.getExtensions().getByType(AsciidoctorJExtension.class).fatalWarnings(".*");
|
project.getExtensions().getByType(AsciidoctorJExtension.class).fatalWarnings(".*");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void upgradeAsciidoctorJVersion(Project project) {
|
||||||
|
project.getExtensions().getByType(AsciidoctorJExtension.class).setVersion(ASCIIDOCTORJ_VERSION);
|
||||||
|
}
|
||||||
|
|
||||||
private UnzipDocumentationResources createUnzipDocumentationResourcesTask(Project project) {
|
private UnzipDocumentationResources createUnzipDocumentationResourcesTask(Project project) {
|
||||||
Configuration documentationResources = project.getConfigurations().maybeCreate("documentationResources");
|
Configuration documentationResources = project.getConfigurations().maybeCreate("documentationResources");
|
||||||
documentationResources.getDependencies()
|
documentationResources.getDependencies()
|
||||||
|
Loading…
Reference in New Issue
Block a user