From 466b57cd449d311ce356434fe5ef34ec2b985d52 Mon Sep 17 00:00:00 2001 From: Hendrig Sellik Date: Mon, 25 Mar 2019 14:46:22 +0100 Subject: [PATCH] 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. See gh-16327 --- .../spring-boot-gradle-plugin/pom.xml | 70 +++++++++++++++---- .../src/main/asciidoc/css/style.css | 20 ++++++ .../src/main/asciidoc/index.adoc | 3 +- 3 files changed, 79 insertions(+), 14 deletions(-) create mode 100644 spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/asciidoc/css/style.css diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/pom.xml b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/pom.xml index 92e1b49ecc4..0ad50a1a794 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/pom.xml +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/pom.xml @@ -16,6 +16,7 @@ ./gradlew build false + ${project.build.directory}/refdocs/ @@ -39,6 +40,24 @@ + + com.googlecode.maven-download-plugin + download-maven-plugin + + + unpack-doc-resources + generate-resources + + wget + + + https://repo.spring.io/release/io/spring/docresources/spring-doc-resources/${spring-doc-resources.version}/spring-doc-resources-${spring-doc-resources.version}.zip + true + ${refdocs.build.directory} + + + + org.apache.maven.plugins maven-dependency-plugin @@ -69,6 +88,28 @@ + + org.apache.maven.plugins + maven-resources-plugin + + + copy-asciidoc-resources + generate-resources + + copy-resources + + + ${refdocs.build.directory} + + + src/main/asciidoc + false + + + + + + org.codehaus.mojo exec-maven-plugin @@ -233,17 +274,7 @@ - - - - - - + @@ -261,7 +292,19 @@ process-asciidoc - html + html5 + ${project.build.directory}/generated-docs/reference/html + highlight.js + book + + js/highlight + atom-one-dark-reasonable + true + ./images + font + css/ + style.css + @@ -272,11 +315,12 @@ pdf + ${project.build.directory}/generated-docs/reference/pdf - index.adoc + ${refdocs.build.directory} ${github-tag} ${version-type} diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/asciidoc/css/style.css b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/asciidoc/css/style.css new file mode 100644 index 00000000000..edaad0a410a --- /dev/null +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/asciidoc/css/style.css @@ -0,0 +1,20 @@ +@import url("spring.css"); + +div .switch { + margin-left: 8px; + border-color: #406A2A; + border-radius: 4px 4px 0 0; +} + +div .switch--item { + color: #406A2A; + background-color: transparent; +} + +div .switch--item.selected { + background-color: #406A2A; +} + +div .switch--item:not(:first-child) { + border-color: #406A2A; +} \ No newline at end of file diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/asciidoc/index.adoc b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/asciidoc/index.adoc index c1c8bba267c..f43fc0c673f 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/asciidoc/index.adoc +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/asciidoc/index.adoc @@ -7,6 +7,8 @@ Andy Wilkinson :numbered: :icons: font :hide-uri-scheme: +:docinfo: shared,private + :dependency-management-plugin: https://github.com/spring-gradle-plugins/dependency-management-plugin :dependency-management-plugin-documentation: {dependency-management-plugin}/blob/master/README.md :gradle-userguide: https://docs.gradle.org/current/userguide @@ -30,7 +32,6 @@ Andy Wilkinson :github-code: https://github.com/spring-projects/spring-boot/tree/{github-tag} - [[introduction]] == Introduction