Skip to content

Commit 2d9b1ad

Browse files
committed
Use xref for documentation links
Closes gh-33745
1 parent 9c87d71 commit 2d9b1ad

File tree

11 files changed

+31
-155
lines changed

11 files changed

+31
-155
lines changed

buildSrc/src/main/java/org/springframework/boot/build/context/properties/CompoundRow.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2021 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -24,6 +24,7 @@
2424
*
2525
* @author Brian Clozel
2626
* @author Phillip Webb
27+
* @author Moritz Halbritter
2728
*/
2829
class CompoundRow extends Row {
2930

@@ -45,9 +46,9 @@ void addProperty(ConfigurationProperty property) {
4546
void write(Asciidoc asciidoc) {
4647
asciidoc.append("|");
4748
asciidoc.append("[[" + getAnchor() + "]]");
48-
asciidoc.append("<<" + getAnchor() + ",");
49+
asciidoc.append("xref:#" + getAnchor() + "[");
4950
this.propertyNames.forEach(asciidoc::appendWithHardLineBreaks);
50-
asciidoc.appendln(">>");
51+
asciidoc.appendln("]");
5152
asciidoc.appendln("|+++", this.description, "+++");
5253
asciidoc.appendln("|");
5354
}

buildSrc/src/main/java/org/springframework/boot/build/context/properties/SingleRow.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -24,6 +24,7 @@
2424
*
2525
* @author Brian Clozel
2626
* @author Phillip Webb
27+
* @author Moritz Halbritter
2728
*/
2829
class SingleRow extends Row {
2930

@@ -56,7 +57,7 @@ private String getDefaultValue(Object defaultValue) {
5657
void write(Asciidoc asciidoc) {
5758
asciidoc.append("|");
5859
asciidoc.append("[[" + getAnchor() + "]]");
59-
asciidoc.appendln("<<" + getAnchor() + ",`+", this.displayName, "+`>>");
60+
asciidoc.appendln("xref:#" + getAnchor() + "[`+", this.displayName, "+`]");
6061
writeDescription(asciidoc);
6162
writeDefaultValue(asciidoc);
6263
}

buildSrc/src/main/java/org/springframework/boot/build/mavenplugin/DocumentPluginGoals.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ private void writeParametersTable(PrintWriter writer, String detailsSectionId, L
158158
writer.println();
159159
for (Parameter parameter : parameters) {
160160
String name = parameter.getName();
161-
writer.printf("| <<%s.%s,%s>>%n", detailsSectionId, parameterId(name), name);
161+
writer.printf("| xref:#%s.%s[%s]%n", detailsSectionId, parameterId(name), name);
162162
writer.printf("| `%s`%n", typeNameToJavadocLink(shortTypeName(parameter.getType()), parameter.getType()));
163163
String defaultValue = parameter.getDefaultValue();
164164
if (defaultValue != null) {

buildSrc/src/main/java/org/springframework/boot/build/starters/DocumentStarters.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -128,7 +128,7 @@ private String postProcessDescription(String description) {
128128
}
129129

130130
private String addStarterCrossLinks(String input) {
131-
return input.replaceAll("(spring-boot-starter[A-Za-z-]*)", "<<$1,`$1`>>");
131+
return input.replaceAll("(spring-boot-starter[A-Za-z-]*)", "xref:#$1[`$1`]");
132132
}
133133

134134
private static final class Starter implements Comparable<Starter> {

buildSrc/src/test/java/org/springframework/boot/build/context/properties/CompoundRowTests.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -24,6 +24,7 @@
2424
* Tests for {@link CompoundRow}.
2525
*
2626
* @author Brian Clozel
27+
* @author Moritz Halbritter
2728
*/
2829
class CompoundRowTests {
2930

@@ -39,8 +40,8 @@ void simpleProperty() {
3940
row.addProperty(new ConfigurationProperty("spring.test.third", "java.lang.String"));
4041
Asciidoc asciidoc = new Asciidoc();
4142
row.write(asciidoc);
42-
assertThat(asciidoc).hasToString("|[[my.spring.test]]<<my.spring.test,`+spring.test.first+` +" + NEWLINE
43-
+ "`+spring.test.second+` +" + NEWLINE + "`+spring.test.third+` +" + NEWLINE + ">>" + NEWLINE
43+
assertThat(asciidoc).hasToString("|[[my.spring.test]]xref:#my.spring.test[`+spring.test.first+` +" + NEWLINE
44+
+ "`+spring.test.second+` +" + NEWLINE + "`+spring.test.third+` +" + NEWLINE + "]" + NEWLINE
4445
+ "|+++This is a description.+++" + NEWLINE + "|" + NEWLINE);
4546
}
4647

buildSrc/src/test/java/org/springframework/boot/build/context/properties/SingleRowTests.java

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -24,6 +24,7 @@
2424
* Tests for {@link SingleRow}.
2525
*
2626
* @author Brian Clozel
27+
* @author Moritz Halbritter
2728
*/
2829
class SingleRowTests {
2930

@@ -38,7 +39,7 @@ void simpleProperty() {
3839
SingleRow row = new SingleRow(SNIPPET, property);
3940
Asciidoc asciidoc = new Asciidoc();
4041
row.write(asciidoc);
41-
assertThat(asciidoc).hasToString("|[[my.spring.test.prop]]<<my.spring.test.prop,`+spring.test.prop+`>>"
42+
assertThat(asciidoc).hasToString("|[[my.spring.test.prop]]xref:#my.spring.test.prop[`+spring.test.prop+`]"
4243
+ NEWLINE + "|+++This is a description.+++" + NEWLINE + "|`+something+`" + NEWLINE);
4344
}
4445

@@ -49,7 +50,7 @@ void noDefaultValue() {
4950
SingleRow row = new SingleRow(SNIPPET, property);
5051
Asciidoc asciidoc = new Asciidoc();
5152
row.write(asciidoc);
52-
assertThat(asciidoc).hasToString("|[[my.spring.test.prop]]<<my.spring.test.prop,`+spring.test.prop+`>>"
53+
assertThat(asciidoc).hasToString("|[[my.spring.test.prop]]xref:#my.spring.test.prop[`+spring.test.prop+`]"
5354
+ NEWLINE + "|+++This is a description.+++" + NEWLINE + "|" + NEWLINE);
5455
}
5556

@@ -60,7 +61,7 @@ void defaultValueWithPipes() {
6061
SingleRow row = new SingleRow(SNIPPET, property);
6162
Asciidoc asciidoc = new Asciidoc();
6263
row.write(asciidoc);
63-
assertThat(asciidoc).hasToString("|[[my.spring.test.prop]]<<my.spring.test.prop,`+spring.test.prop+`>>"
64+
assertThat(asciidoc).hasToString("|[[my.spring.test.prop]]xref:#my.spring.test.prop[`+spring.test.prop+`]"
6465
+ NEWLINE + "|+++This is a description.+++" + NEWLINE + "|`+first\\|second+`" + NEWLINE);
6566
}
6667

@@ -71,7 +72,7 @@ void defaultValueWithBackslash() {
7172
SingleRow row = new SingleRow(SNIPPET, property);
7273
Asciidoc asciidoc = new Asciidoc();
7374
row.write(asciidoc);
74-
assertThat(asciidoc).hasToString("|[[my.spring.test.prop]]<<my.spring.test.prop,`+spring.test.prop+`>>"
75+
assertThat(asciidoc).hasToString("|[[my.spring.test.prop]]xref:#my.spring.test.prop[`+spring.test.prop+`]"
7576
+ NEWLINE + "|+++This is a description.+++" + NEWLINE + "|`+first\\\\second+`" + NEWLINE);
7677
}
7778

@@ -82,7 +83,7 @@ void descriptionWithPipe() {
8283
SingleRow row = new SingleRow(SNIPPET, property);
8384
Asciidoc asciidoc = new Asciidoc();
8485
row.write(asciidoc);
85-
assertThat(asciidoc).hasToString("|[[my.spring.test.prop]]<<my.spring.test.prop,`+spring.test.prop+`>>"
86+
assertThat(asciidoc).hasToString("|[[my.spring.test.prop]]xref:#my.spring.test.prop[`+spring.test.prop+`]"
8687
+ NEWLINE + "|+++This is a description with a \\| pipe.+++" + NEWLINE + "|" + NEWLINE);
8788
}
8889

@@ -93,7 +94,7 @@ void mapProperty() {
9394
SingleRow row = new SingleRow(SNIPPET, property);
9495
Asciidoc asciidoc = new Asciidoc();
9596
row.write(asciidoc);
96-
assertThat(asciidoc).hasToString("|[[my.spring.test.prop]]<<my.spring.test.prop,`+spring.test.prop.*+`>>"
97+
assertThat(asciidoc).hasToString("|[[my.spring.test.prop]]xref:#my.spring.test.prop[`+spring.test.prop.*+`]"
9798
+ NEWLINE + "|+++This is a description.+++" + NEWLINE + "|" + NEWLINE);
9899
}
99100

@@ -105,7 +106,7 @@ void listProperty() {
105106
SingleRow row = new SingleRow(SNIPPET, property);
106107
Asciidoc asciidoc = new Asciidoc();
107108
row.write(asciidoc);
108-
assertThat(asciidoc).hasToString("|[[my.spring.test.prop]]<<my.spring.test.prop,`+spring.test.prop+`>>"
109+
assertThat(asciidoc).hasToString("|[[my.spring.test.prop]]xref:#my.spring.test.prop[`+spring.test.prop+`]"
109110
+ NEWLINE + "|+++This is a description.+++" + NEWLINE + "|`+first," + NEWLINE + "second," + NEWLINE
110111
+ "third+`" + NEWLINE);
111112
}

buildSrc/src/test/java/org/springframework/boot/build/context/properties/TableTests.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -24,6 +24,7 @@
2424
* Tests for {@link Table}.
2525
*
2626
* @author Brian Clozel
27+
* @author Moritz Halbritter
2728
*/
2829
class TableTests {
2930

@@ -44,10 +45,10 @@ void simpleTable() {
4445
assertThat(asciidoc).hasToString("[cols=\"4,3,3\", options=\"header\"]" + NEWLINE +
4546
"|===" + NEWLINE +
4647
"|Name|Description|Default Value" + NEWLINE + NEWLINE +
47-
"|[[my.spring.test.other]]<<my.spring.test.other,`+spring.test.other+`>>" + NEWLINE +
48+
"|[[my.spring.test.other]]xref:#my.spring.test.other[`+spring.test.other+`]" + NEWLINE +
4849
"|+++This is another description.+++" + NEWLINE +
4950
"|`+other value+`" + NEWLINE + NEWLINE +
50-
"|[[my.spring.test.prop]]<<my.spring.test.prop,`+spring.test.prop+`>>" + NEWLINE +
51+
"|[[my.spring.test.prop]]xref:#my.spring.test.prop[`+spring.test.prop+`]" + NEWLINE +
5152
"|+++This is a description.+++" + NEWLINE +
5253
"|`+something+`" + NEWLINE + NEWLINE +
5354
"|===" + NEWLINE);

spring-boot-project/spring-boot-actuator-autoconfigure/src/docs/antora/modules/api/pages/rest/actuator/index.adoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ This API documentation describes Spring Boot Actuators web endpoints.
66

77
Before you proceed, you should read the following topics:
88

9-
* <<overview.endpoint-urls>>
10-
* <<overview.timestamps>>
9+
* xref:#overview.endpoint-urls[]
10+
* xref:#overview.timestamps[]
1111
1212
NOTE: In order to get the correct JSON responses documented below, Jackson must be available.
1313

spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/antora/modules/maven-plugin/pages/packaging.adoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ include::example$packaging/custom-layout-pom.xml[tags=custom-layout]
217217
The layout factory is provided as an implementation of `LayoutFactory` (from `spring-boot-loader-tools`) explicitly specified in the pom.
218218
If there is only one custom `LayoutFactory` on the plugin classpath and it is listed in `META-INF/spring.factories` then it is unnecessary to explicitly set it in the plugin configuration.
219219

220-
Layout factories are always ignored if an explicit <<packaging.repackage-goal.parameter-details.layout-factory,layout>> is set.
220+
Layout factories are always ignored if an explicit xref:#packaging.repackage-goal.parameter-details.layout-factory[layout] is set.
221221

222222

223223

spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/antora/modules/maven-plugin/pages/using.adoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ The parent project provides the following features:
99
* Compilation with `-parameters`.
1010
* A dependency management section, inherited from the `spring-boot-dependencies` POM, that manages the versions of common dependencies.
1111
This dependency management lets you omit `<version>` tags for those dependencies when used in your own POM.
12-
* An execution of the <<goals.adoc#packaging.repackage-goal, `repackage` goal>> with a `repackage` execution id.
12+
* An execution of the xref:maven-plugin:packaging.adoc#packaging.repackage-goal[`repackage` goal] with a `repackage` execution id.
1313
* A `native` profile that configures the build to be able to generate a Native image.
1414
* Sensible https://maven.apache.org/plugins/maven-resources-plugin/examples/filter.html[resource filtering].
1515
* Sensible plugin configuration (https://github.com/ktoso/maven-git-commit-id-plugin[Git commit ID], and https://maven.apache.org/plugins/maven-shade-plugin/[shade]).

spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/groovy/generateGoalsDocumentation.groovy

-129
This file was deleted.

0 commit comments

Comments
 (0)