Browse Source

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
pull/16419/head
Hendrig Sellik 7 years ago committed by Stephane Nicoll
parent
commit
466b57cd44
  1. 70
      spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/pom.xml
  2. 20
      spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/asciidoc/css/style.css
  3. 3
      spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/asciidoc/index.adoc

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

@ -16,6 +16,7 @@ @@ -16,6 +16,7 @@
<gradle.executable>./gradlew</gradle.executable>
<gradle.task>build</gradle.task>
<skip.gradle.build>false</skip.gradle.build>
<refdocs.build.directory>${project.build.directory}/refdocs/</refdocs.build.directory>
</properties>
<dependencies>
<dependency>
@ -39,6 +40,24 @@ @@ -39,6 +40,24 @@
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.googlecode.maven-download-plugin</groupId>
<artifactId>download-maven-plugin</artifactId>
<executions>
<execution>
<id>unpack-doc-resources</id>
<phase>generate-resources</phase>
<goals>
<goal>wget</goal>
</goals>
<configuration>
<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>
<unpack>true</unpack>
<outputDirectory>${refdocs.build.directory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
@ -69,6 +88,28 @@ @@ -69,6 +88,28 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-asciidoc-resources</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${refdocs.build.directory}</outputDirectory>
<resources>
<resource>
<directory>src/main/asciidoc</directory>
<filtering>false</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
@ -233,17 +274,7 @@ @@ -233,17 +274,7 @@
<target>
<zip
destfile="${project.build.directory}/${project.artifactId}-${project.version}-docs.zip">
<zipfileset
src="build/libs/${project.artifactId}-${project.version}-javadoc.jar"
prefix="api" />
<zipfileset dir="${project.build.directory}/generated-docs"
includes="index.html" prefix="reference/html" />
<mappedresources>
<fileset dir="${project.build.directory}/generated-docs"
includes="index.pdf" />
<globmapper from="index.pdf"
to="reference/pdf/spring-boot-gradle-plugin-reference.pdf" />
</mappedresources>
<fileset dir="${project.build.directory}/generated-docs" />
</zip>
</target>
</configuration>
@ -261,7 +292,19 @@ @@ -261,7 +292,19 @@
<goal>process-asciidoc</goal>
</goals>
<configuration>
<backend>html</backend>
<backend>html5</backend>
<outputDirectory>${project.build.directory}/generated-docs/reference/html</outputDirectory>
<sourceHighlighter>highlight.js</sourceHighlighter>
<doctype>book</doctype>
<attributes>
<highlightjsdir>js/highlight</highlightjsdir>
<highlightjs-theme>atom-one-dark-reasonable</highlightjs-theme>
<linkcss>true</linkcss>
<imagesdir>./images</imagesdir>
<icons>font</icons>
<stylesdir>css/</stylesdir>
<stylesheet>style.css</stylesheet>
</attributes>
</configuration>
</execution>
<execution>
@ -272,11 +315,12 @@ @@ -272,11 +315,12 @@
</goals>
<configuration>
<backend>pdf</backend>
<outputDirectory>${project.build.directory}/generated-docs/reference/pdf</outputDirectory>
</configuration>
</execution>
</executions>
<configuration>
<sourceDocumentName>index.adoc</sourceDocumentName>
<sourceDirectory>${refdocs.build.directory}</sourceDirectory>
<attributes>
<github-tag>${github-tag}</github-tag>
<version-type>${version-type}</version-type>

20
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/asciidoc/css/style.css

@ -0,0 +1,20 @@ @@ -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;
}

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

@ -7,6 +7,8 @@ Andy Wilkinson @@ -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 @@ -30,7 +32,6 @@ Andy Wilkinson
:github-code: https://github.com/spring-projects/spring-boot/tree/{github-tag}
[[introduction]]
== Introduction

Loading…
Cancel
Save