Commit 466b57cd authored by Hendrig Sellik's avatar Hendrig Sellik Committed by Stephane Nicoll

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
parent 8c8a088c
......@@ -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 @@
</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 @@
</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 @@
<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 @@
<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 @@
</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>
......
@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
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment