Skip to content

Commit 4b649d2

Browse files
committed
Add Spring-specific styling to Gradle Plugin's documentation
This commit replaces the default Asciidoctor styling with Spring specific styling. First, we need to unzip the contents of the Spring Asciidoctor documentation resources provided by the `io.spring.docsresources:spring-docs-resources` distribution zip. This is done in a `/target/refdocs` folder. We then copy all files from `src/main/asciidoc` to the same location, and then launch the generation process. Closes gh-15990
1 parent a2d37dc commit 4b649d2

File tree

4 files changed

+106
-31
lines changed

4 files changed

+106
-31
lines changed

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/pom.xml

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<gradle.executable>./gradlew</gradle.executable>
1717
<gradle.task>build</gradle.task>
1818
<skip.gradle.build>false</skip.gradle.build>
19+
<refdocs.build.directory>${project.build.directory}/refdocs/</refdocs.build.directory>
1920
</properties>
2021
<dependencies>
2122
<dependency>
@@ -39,6 +40,24 @@
3940
</dependencies>
4041
<build>
4142
<plugins>
43+
<plugin>
44+
<groupId>com.googlecode.maven-download-plugin</groupId>
45+
<artifactId>download-maven-plugin</artifactId>
46+
<executions>
47+
<execution>
48+
<id>unpack-doc-resources</id>
49+
<phase>generate-resources</phase>
50+
<goals>
51+
<goal>wget</goal>
52+
</goals>
53+
<configuration>
54+
<url>https://repo.spring.io/release/io/spring/docresources/spring-doc-resources/${spring-doc-resources.version}/spring-doc-resources-${spring-doc-resources.version}.zip</url>
55+
<unpack>true</unpack>
56+
<outputDirectory>${refdocs.build.directory}</outputDirectory>
57+
</configuration>
58+
</execution>
59+
</executions>
60+
</plugin>
4261
<plugin>
4362
<groupId>org.apache.maven.plugins</groupId>
4463
<artifactId>maven-dependency-plugin</artifactId>
@@ -69,6 +88,28 @@
6988
</execution>
7089
</executions>
7190
</plugin>
91+
<plugin>
92+
<groupId>org.apache.maven.plugins</groupId>
93+
<artifactId>maven-resources-plugin</artifactId>
94+
<executions>
95+
<execution>
96+
<id>copy-asciidoc-resources</id>
97+
<phase>generate-resources</phase>
98+
<goals>
99+
<goal>copy-resources</goal>
100+
</goals>
101+
<configuration>
102+
<outputDirectory>${refdocs.build.directory}</outputDirectory>
103+
<resources>
104+
<resource>
105+
<directory>src/main/asciidoc</directory>
106+
<filtering>false</filtering>
107+
</resource>
108+
</resources>
109+
</configuration>
110+
</execution>
111+
</executions>
112+
</plugin>
72113
<plugin>
73114
<groupId>org.codehaus.mojo</groupId>
74115
<artifactId>exec-maven-plugin</artifactId>
@@ -261,7 +302,18 @@
261302
<goal>process-asciidoc</goal>
262303
</goals>
263304
<configuration>
264-
<backend>html</backend>
305+
<backend>html5</backend>
306+
<sourceHighlighter>highlight.js</sourceHighlighter>
307+
<doctype>book</doctype>
308+
<attributes>
309+
<highlightjsdir>js/highlight</highlightjsdir>
310+
<highlightjs-theme>atom-one-dark-reasonable</highlightjs-theme>
311+
<linkcss>true</linkcss>
312+
<imagesdir>./images</imagesdir>
313+
<icons>font</icons>
314+
<stylesdir>css/</stylesdir>
315+
<stylesheet>style.css</stylesheet>
316+
</attributes>
265317
</configuration>
266318
</execution>
267319
<execution>
@@ -276,7 +328,8 @@
276328
</execution>
277329
</executions>
278330
<configuration>
279-
<sourceDocumentName>index.adoc</sourceDocumentName>
331+
<sourceDirectory>${refdocs.build.directory}</sourceDirectory>
332+
<outputDirectory>${project.build.directory}/generated-docs/reference/html</outputDirectory>
280333
<attributes>
281334
<github-tag>${github-tag}</github-tag>
282335
<version-type>${version-type}</version-type>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
:doctype: book
2+
:toc: left
3+
:toclevels: 4
4+
:source-highlighter: prettify
5+
:numbered:
6+
:icons: font
7+
:hide-uri-scheme:
8+
:docinfo: shared
9+
10+
:dependency-management-plugin: https://github.com/spring-gradle-plugins/dependency-management-plugin
11+
:dependency-management-plugin-documentation: {dependency-management-plugin}/blob/master/README.md
12+
:gradle-userguide: https://docs.gradle.org/current/userguide
13+
:gradle-dsl: https://docs.gradle.org/current/dsl
14+
:gradle-api: https://docs.gradle.org/current/javadoc
15+
:application-plugin: {gradle-userguide}/application_plugin.html
16+
:groovy-plugin: {gradle-userguide}/groovy_plugin.html
17+
:java-plugin: {gradle-userguide}/java_plugin.html
18+
:war-plugin: {gradle-userguide}/war_plugin.html
19+
:maven-plugin: {gradle-userguide}/maven_plugin.html
20+
:maven-publish-plugin: {gradle-userguide}/maven_publish_plugin.html
21+
:software-component: {gradle-userguide}/software_model_extend.html
22+
:kotlin-plugin: https://kotlinlang.org/docs/reference/using-gradle.html
23+
:spring-boot-docs: https://docs.spring.io/spring-boot/docs/{version}
24+
:api-documentation: {spring-boot-docs}/gradle-plugin/api
25+
:spring-boot-reference: {spring-boot-docs}/reference/htmlsingle
26+
:build-info-javadoc: {api-documentation}/org/springframework/boot/gradle/tasks/buildinfo/BuildInfo.html
27+
:boot-jar-javadoc: {api-documentation}/org/springframework/boot/gradle/tasks/bundling/BootJar.html
28+
:boot-war-javadoc: {api-documentation}/org/springframework/boot/gradle/tasks/bundling/BootWar.html
29+
:boot-run-javadoc: {api-documentation}/org/springframework/boot/gradle/tasks/run/BootRun.html
30+
:github-code: https://github.com/spring-projects/spring-boot/tree/{github-tag}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
@import url("spring.css");
2+
3+
div .switch {
4+
margin-left: 8px;
5+
border-color: #406A2A;
6+
border-radius: 4px 4px 0 0;
7+
}
8+
9+
div .switch--item {
10+
color: #406A2A;
11+
background-color: transparent;
12+
}
13+
14+
div .switch--item.selected {
15+
background-color: #406A2A;
16+
}
17+
18+
div .switch--item:not(:first-child) {
19+
border-color: #406A2A;
20+
}

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/asciidoc/index.adoc

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,6 @@
11
= Spring Boot Gradle Plugin Reference Guide
22
Andy Wilkinson
3-
:doctype: book
4-
:toc: left
5-
:toclevels: 4
6-
:source-highlighter: prettify
7-
:numbered:
8-
:icons: font
9-
:hide-uri-scheme:
10-
:dependency-management-plugin: https://github.com/spring-gradle-plugins/dependency-management-plugin
11-
:dependency-management-plugin-documentation: {dependency-management-plugin}/blob/master/README.md
12-
:gradle-userguide: https://docs.gradle.org/current/userguide
13-
:gradle-dsl: https://docs.gradle.org/current/dsl
14-
:gradle-api: https://docs.gradle.org/current/javadoc
15-
:application-plugin: {gradle-userguide}/application_plugin.html
16-
:groovy-plugin: {gradle-userguide}/groovy_plugin.html
17-
:java-plugin: {gradle-userguide}/java_plugin.html
18-
:war-plugin: {gradle-userguide}/war_plugin.html
19-
:maven-plugin: {gradle-userguide}/maven_plugin.html
20-
:maven-publish-plugin: {gradle-userguide}/maven_publish_plugin.html
21-
:software-component: {gradle-userguide}/software_model_extend.html
22-
:kotlin-plugin: https://kotlinlang.org/docs/reference/using-gradle.html
23-
:spring-boot-docs: https://docs.spring.io/spring-boot/docs/{version}
24-
:api-documentation: {spring-boot-docs}/gradle-plugin/api
25-
:spring-boot-reference: {spring-boot-docs}/reference/htmlsingle
26-
:build-info-javadoc: {api-documentation}/org/springframework/boot/gradle/tasks/buildinfo/BuildInfo.html
27-
:boot-jar-javadoc: {api-documentation}/org/springframework/boot/gradle/tasks/bundling/BootJar.html
28-
:boot-war-javadoc: {api-documentation}/org/springframework/boot/gradle/tasks/bundling/BootWar.html
29-
:boot-run-javadoc: {api-documentation}/org/springframework/boot/gradle/tasks/run/BootRun.html
30-
:github-code: https://github.com/spring-projects/spring-boot/tree/{github-tag}
31-
3+
include::attributes.adoc[]
324

335

346
[[introduction]]

0 commit comments

Comments
 (0)