Skip to content

Commit 3214786

Browse files
committed
Define global Asciidoc attributes once
This commit defines the doc-root and api-spring-framework attributes once in docs.gradle instead of duplicating them in each *.adoc file. This commit also introduces a new docs-spring-framework global attribute.
1 parent f69152c commit 3214786

13 files changed

+18
-35
lines changed

gradle/docs.gradle

+6-1
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ task extractDocResources(type: Copy, dependsOn: downloadResources) {
127127
}
128128

129129
asciidoctorj {
130+
def docRoot = 'https://docs.spring.io'
131+
def docsSpringFramework = "${docRoot}/spring-framework/docs/${project.version}"
130132
version = '2.4.1'
131133
fatalWarnings ".*"
132134
options doctype: 'book', eruby: 'erubis'
@@ -144,7 +146,10 @@ asciidoctorj {
144146
stylesdir: 'css/',
145147
stylesheet: 'stylesheet.css',
146148
'spring-version': project.version,
147-
'spring-framework-main-code': 'https://github.com/spring-projects/spring-framework/tree/main'
149+
'spring-framework-main-code': 'https://github.com/spring-projects/spring-framework/tree/main',
150+
'doc-root': docRoot,
151+
'docs-spring-framework': docsSpringFramework,
152+
'api-spring-framework': "${docsSpringFramework}/javadoc-api/org/springframework"
148153
])
149154
}
150155

src/docs/asciidoc/appendix.adoc

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
[[appendix]]
22
= Appendix
3-
:doc-root: https://docs.spring.io
4-
:api-spring-framework: {doc-root}/spring-framework/docs/{spring-version}/javadoc-api/org/springframework
53
:toc: left
64
:toclevels: 4
75
:tabsize: 4

src/docs/asciidoc/core.adoc

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
[[spring-core]]
22
= Core Technologies
3-
:doc-root: https://docs.spring.io
4-
:api-spring-framework: {doc-root}/spring-framework/docs/{spring-version}/javadoc-api/org/springframework
53
:toc: left
64
:toclevels: 4
75
:tabsize: 4

src/docs/asciidoc/core/core-appendix.adoc

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
:doc-root: https://docs.spring.io
2-
:api-spring-framework: {doc-root}/spring-framework/docs/{spring-version}/javadoc-api/org/springframework
3-
41
= Appendix
52

63

src/docs/asciidoc/data-access.adoc

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
[[spring-data-tier]]
22
= Data Access
3-
:doc-root: https://docs.spring.io
4-
:api-spring-framework: {doc-root}/spring-framework/docs/{spring-version}/javadoc-api/org/springframework
53
:toc: left
64
:toclevels: 4
75
:tabsize: 4

src/docs/asciidoc/index.adoc

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
= Spring Framework Documentation
2-
:doc-root: https://docs.spring.io
32

43
[horizontal]
54
<<overview.adoc#overview, Overview>> :: history, design philosophy, feedback,
@@ -22,11 +21,11 @@ https://github.com/spring-projects/spring-framework/wiki[*Wiki*] :: What's New,
2221
and other cross-version information.
2322

2423
ifdef::backend-html5[]
25-
NOTE: This documentation is also available as {doc-root}/spring-framework/docs/{spring-version}/reference/pdf/index.pdf[PDF].
24+
NOTE: This documentation is also available as {docs-spring-framework}/reference/pdf/index.pdf[PDF].
2625
endif::[]
2726

2827
ifdef::backend-pdf[]
29-
NOTE: This documentation is also available as {doc-root}/spring-framework/docs/{spring-version}/reference/html/index.html[HTML].
28+
NOTE: This documentation is also available as {docs-spring-framework}/reference/html/index.html[HTML].
3029
endif::[]
3130

3231
Rod Johnson, Juergen Hoeller, Keith Donald, Colin Sampaleanu, Rob Harrop, Thomas Risberg,

src/docs/asciidoc/integration.adoc

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
[[spring-integration]]
22
= Integration
3-
:doc-root: https://docs.spring.io
4-
:api-spring-framework: {doc-root}/spring-framework/docs/{spring-version}/javadoc-api/org/springframework
53
:doc-spring-amqp: {doc-root}/spring-amqp/docs/current/reference
64
:doc-spring-gemfire: {doc-root}/spring-gemfire/docs/current/reference
75
:toc: left

src/docs/asciidoc/languages.adoc

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
[[languages]]
22
= Language Support
3-
:doc-root: https://docs.spring.io
4-
:api-spring-framework: {doc-root}/spring-framework/docs/{spring-version}/javadoc-api/org/springframework
53
:toc: left
64
:toclevels: 4
75
:tabsize: 4

src/docs/asciidoc/languages/kotlin.adoc

+10-10
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ Kotlin https://kotlinlang.org/docs/reference/extensions.html[extensions] provide
4242
to extend existing classes with additional functionality. The Spring Framework Kotlin APIs
4343
use these extensions to add new Kotlin-specific conveniences to existing Spring APIs.
4444

45-
The {doc-root}/spring-framework/docs/{spring-version}/kdoc-api/spring-framework/[Spring Framework KDoc API] lists
46-
and documents all available the Kotlin extensions and DSLs.
45+
The {docs-spring-framework}/kdoc-api/spring-framework/[Spring Framework KDoc API] lists
46+
and documents all available Kotlin extensions and DSLs.
4747

4848
NOTE: Keep in mind that Kotlin extensions need to be imported to be used. This means,
4949
for example, that the `GenericApplicationContext.registerBean` Kotlin extension
@@ -209,7 +209,7 @@ the constructor parameters will be autowired by type:
209209
----
210210

211211
In order to allow a more declarative approach and cleaner syntax, Spring Framework provides
212-
a {doc-root}/spring-framework/docs/{spring-version}/kdoc-api/spring-framework/org.springframework.context.support/-bean-definition-dsl/[Kotlin bean definition DSL]
212+
a {docs-spring-framework}/kdoc-api/spring-framework/org.springframework.context.support/-bean-definition-dsl/[Kotlin bean definition DSL]
213213
It declares an `ApplicationContextInitializer` through a clean declarative API,
214214
which lets you deal with profiles and `Environment` for customizing
215215
how beans are registered.
@@ -275,9 +275,9 @@ for more details and up-to-date information. See also the experimental Kofu DSL
275275

276276
Spring Framework comes with a Kotlin router DSL available in 3 flavors:
277277

278-
* WebMvc.fn DSL with {doc-root}/spring-framework/docs/{spring-version}/kdoc-api/spring-framework/org.springframework.web.servlet.function/router.html[router { }]
279-
* WebFlux.fn <<web-reactive#webflux-fn, Reactive>> DSL with {doc-root}/spring-framework/docs/{spring-version}/kdoc-api/spring-framework/org.springframework.web.reactive.function.server/router.html[router { }]
280-
* WebFlux.fn <<Coroutines>> DSL with {doc-root}/spring-framework/docs/{spring-version}/kdoc-api/spring-framework/org.springframework.web.reactive.function.server/co-router.html[coRouter { }]
278+
* WebMvc.fn DSL with {docs-spring-framework}/kdoc-api/spring-framework/org.springframework.web.servlet.function/router.html[router { }]
279+
* WebFlux.fn <<web-reactive#webflux-fn, Reactive>> DSL with {docs-spring-framework}/kdoc-api/spring-framework/org.springframework.web.reactive.function.server/router.html[router { }]
280+
* WebFlux.fn <<Coroutines>> DSL with {docs-spring-framework}/kdoc-api/spring-framework/org.springframework.web.reactive.function.server/co-router.html[coRouter { }]
281281

282282
These DSL let you write clean and idiomatic Kotlin code to build a `RouterFunction` instance as the following example shows:
283283

@@ -408,10 +408,10 @@ Spring Framework provides support for Coroutines on the following scope:
408408

409409
* https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-deferred/index.html[Deferred] and https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html[Flow] return values support in Spring MVC and WebFlux annotated `@Controller`
410410
* Suspending function support in Spring MVC and WebFlux annotated `@Controller`
411-
* Extensions for WebFlux {doc-root}/spring-framework/docs/{spring-version}/kdoc-api/spring-framework/org.springframework.web.reactive.function.client/index.html[client] and {doc-root}/spring-framework/docs/{spring-version}/kdoc-api/spring-framework/org.springframework.web.reactive.function.server/index.html[server] functional API.
412-
* WebFlux.fn {doc-root}/spring-framework/docs/{spring-version}/kdoc-api/spring-framework/org.springframework.web.reactive.function.server/co-router.html[coRouter { }] DSL
411+
* Extensions for WebFlux {docs-spring-framework}/kdoc-api/spring-framework/org.springframework.web.reactive.function.client/index.html[client] and {docs-spring-framework}/kdoc-api/spring-framework/org.springframework.web.reactive.function.server/index.html[server] functional API.
412+
* WebFlux.fn {docs-spring-framework}/kdoc-api/spring-framework/org.springframework.web.reactive.function.server/co-router.html[coRouter { }] DSL
413413
* Suspending function and `Flow` support in RSocket `@MessageMapping` annotated methods
414-
* Extensions for {doc-root}/spring-framework/docs/{spring-version}/kdoc-api/spring-framework/org.springframework.messaging.rsocket/index.html[`RSocketRequester`]
414+
* Extensions for {docs-spring-framework}/kdoc-api/spring-framework/org.springframework.messaging.rsocket/index.html[`RSocketRequester`]
415415

416416
=== Dependencies
417417

@@ -554,7 +554,7 @@ class CoroutinesViewController(banner: Banner) {
554554

555555
=== WebFlux.fn
556556

557-
Here is an example of Coroutines router defined via the {doc-root}/spring-framework/docs/{spring-version}/kdoc-api/spring-framework/org.springframework.web.reactive.function.server/co-router.html[coRouter { }] DSL and related handlers.
557+
Here is an example of Coroutines router defined via the {docs-spring-framework}/kdoc-api/spring-framework/org.springframework.web.reactive.function.server/co-router.html[coRouter { }] DSL and related handlers.
558558

559559
[source,kotlin,indent=0]
560560
----

src/docs/asciidoc/testing.adoc

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
[[testing]]
22
= Testing
3-
:doc-root: https://docs.spring.io
4-
:api-spring-framework: {doc-root}/spring-framework/docs/{spring-version}/javadoc-api/org/springframework
53
:doc-spring-boot: {doc-root}/spring-boot/docs/current/reference
64
:toc: left
75
:toclevels: 4

src/docs/asciidoc/testing/testing-webtestclient.adoc

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
[[webtestclient]]
22
= WebTestClient
3-
:doc-root: https://docs.spring.io
4-
:api-spring-framework: {doc-root}/spring-framework/docs/{spring-version}/javadoc-api/org/springframework
53

64
`WebTestClient` is an HTTP client designed for testing server applications. It wraps
75
Spring's <<web-reactive.adoc#webflux-client, WebClient>> and uses it to perform requests

src/docs/asciidoc/web-reactive.adoc

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
[[spring-web-reactive]]
22
= Web on Reactive Stack
3-
:doc-root: https://docs.spring.io
4-
:api-spring-framework: {doc-root}/spring-framework/docs/{spring-version}/javadoc-api/org/springframework
53
:toc: left
64
:toclevels: 4
75
:tabsize: 4

src/docs/asciidoc/web.adoc

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
[[spring-web]]
22
= Web on Servlet Stack
3-
:doc-root: https://docs.spring.io
4-
:api-spring-framework: {doc-root}/spring-framework/docs/{spring-version}/javadoc-api/org/springframework
53
:toc: left
64
:toclevels: 4
75
:tabsize: 4

0 commit comments

Comments
 (0)