mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-07-15 01:07:30 +08:00
Use spring-pdf backend for PDF generation
Update `asciidoctorPdf` tasks to use the `spring-pdf` backend so that chomped elements and @fold:on/@fold:off comments are hidden. Closes gh-26373
This commit is contained in:
parent
65db4411ae
commit
87d8aedd3c
@ -18,8 +18,7 @@ dependencies {
|
||||
implementation("com.fasterxml.jackson.core:jackson-databind:2.11.4")
|
||||
implementation("commons-codec:commons-codec:1.13")
|
||||
implementation("org.apache.maven:maven-embedder:3.6.2")
|
||||
implementation("org.asciidoctor:asciidoctor-gradle-jvm:3.1.0")
|
||||
implementation("org.asciidoctor:asciidoctor-gradle-jvm-pdf:3.1.0")
|
||||
implementation("org.asciidoctor:asciidoctor-gradle-jvm:3.3.2")
|
||||
implementation("org.gradle:test-retry-gradle-plugin:1.1.9")
|
||||
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.0-RC")
|
||||
implementation("org.jetbrains.kotlin:kotlin-compiler-embeddable:1.5.0-RC")
|
||||
|
@ -98,6 +98,8 @@ class AsciidoctorConventions {
|
||||
Configuration asciidoctorExtensions = configurations.maybeCreate(EXTENSIONS_CONFIGURATION);
|
||||
asciidoctorExtensions.getDependencies().add(project.getDependencies()
|
||||
.create("io.spring.asciidoctor.backends:spring-asciidoctor-backends:0.0.1-SNAPSHOT"));
|
||||
asciidoctorExtensions.getDependencies()
|
||||
.add(project.getDependencies().create("org.asciidoctor:asciidoctorj-pdf:1.5.3"));
|
||||
Configuration dependencyManagement = configurations.findByName("dependencyManagement");
|
||||
if (dependencyManagement != null) {
|
||||
asciidoctorExtensions.extendsFrom(dependencyManagement);
|
||||
@ -111,7 +113,9 @@ class AsciidoctorConventions {
|
||||
asciidoctorTask.baseDirFollowsSourceDir();
|
||||
createSyncDocumentationSourceTask(project, asciidoctorTask);
|
||||
if (asciidoctorTask instanceof AsciidoctorTask) {
|
||||
configureAsciidoctorHtmlTask((AsciidoctorTask) asciidoctorTask);
|
||||
boolean pdf = asciidoctorTask.getName().toLowerCase().contains("pdf");
|
||||
String backend = (!pdf) ? "spring-html" : "spring-pdf";
|
||||
((AsciidoctorTask) asciidoctorTask).outputOptions((outputOptions) -> outputOptions.backends(backend));
|
||||
}
|
||||
}
|
||||
|
||||
@ -146,8 +150,4 @@ class AsciidoctorConventions {
|
||||
return syncDocumentationSource;
|
||||
}
|
||||
|
||||
private void configureAsciidoctorHtmlTask(AsciidoctorTask asciidoctorTask) {
|
||||
asciidoctorTask.outputOptions((outputOptions) -> outputOptions.backends("spring-html"));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
plugins {
|
||||
id "java-library"
|
||||
id "org.asciidoctor.jvm.convert"
|
||||
id "org.asciidoctor.jvm.pdf"
|
||||
id "org.springframework.boot.auto-configuration"
|
||||
id "org.springframework.boot.conventions"
|
||||
id "org.springframework.boot.deployed"
|
||||
@ -175,7 +174,7 @@ asciidoctor {
|
||||
}
|
||||
}
|
||||
|
||||
asciidoctorPdf {
|
||||
task asciidoctorPdf(type: org.asciidoctor.gradle.jvm.AsciidoctorTask) {
|
||||
sources {
|
||||
include "index.adoc"
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ plugins {
|
||||
id "java"
|
||||
id "groovy"
|
||||
id "org.asciidoctor.jvm.convert"
|
||||
id "org.asciidoctor.jvm.pdf"
|
||||
id "org.springframework.boot.conventions"
|
||||
id "org.springframework.boot.deployed"
|
||||
}
|
||||
@ -257,7 +256,7 @@ asciidoctor {
|
||||
}
|
||||
}
|
||||
|
||||
asciidoctorPdf {
|
||||
task asciidoctorPdf(type: org.asciidoctor.gradle.jvm.AsciidoctorTask) {
|
||||
sources {
|
||||
include "*.singleadoc"
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ plugins {
|
||||
id "java-gradle-plugin"
|
||||
id "maven-publish"
|
||||
id "org.asciidoctor.jvm.convert"
|
||||
id "org.asciidoctor.jvm.pdf"
|
||||
id "org.springframework.boot.conventions"
|
||||
id "org.springframework.boot.maven-repository"
|
||||
id "org.springframework.boot.optional-dependencies"
|
||||
@ -82,7 +81,7 @@ asciidoctor {
|
||||
attributes "stylesheet": "css/style.css"
|
||||
}
|
||||
|
||||
asciidoctorPdf {
|
||||
task asciidoctorPdf(type: org.asciidoctor.gradle.jvm.AsciidoctorTask) {
|
||||
sources {
|
||||
include "index.adoc"
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
plugins {
|
||||
id "org.asciidoctor.jvm.convert"
|
||||
id "org.asciidoctor.jvm.pdf"
|
||||
id "org.springframework.boot.conventions"
|
||||
id "org.springframework.boot.maven-plugin"
|
||||
id "org.springframework.boot.optional-dependencies"
|
||||
@ -74,15 +73,15 @@ asciidoctor {
|
||||
}
|
||||
}
|
||||
|
||||
syncDocumentationSourceForAsciidoctorPdf {
|
||||
from(documentPluginGoals) {
|
||||
into "asciidoc/goals"
|
||||
task asciidoctorPdf(type: org.asciidoctor.gradle.jvm.AsciidoctorTask) {
|
||||
sources {
|
||||
include "index.adoc"
|
||||
}
|
||||
}
|
||||
|
||||
asciidoctorPdf {
|
||||
sources {
|
||||
include "index.adoc"
|
||||
syncDocumentationSourceForAsciidoctorPdf {
|
||||
from(documentPluginGoals) {
|
||||
into "asciidoc/goals"
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user