Skip to content

Commit f3c5a40

Browse files
authored
chore: fix see also (#99)
1 parent 15f4265 commit f3c5a40

File tree

5 files changed

+11
-8
lines changed

5 files changed

+11
-8
lines changed

third_party/docfx-doclet-143274/src/main/java/com/microsoft/lookup/BaseLookup.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import java.util.ArrayList;
2323
import java.util.Collections;
2424
import java.util.HashMap;
25+
import java.util.HashSet;
2526
import java.util.List;
2627
import java.util.Map;
2728
import java.util.Optional;
@@ -205,7 +206,7 @@ protected String determineComment(T element) {
205206
* Provides support for deprecated and see tags
206207
*/
207208
String replaceBlockTags(DocCommentTree docCommentTree, String comment) {
208-
List<String> seeItems = new ArrayList<>();
209+
Set<String> seeItems = new HashSet<>();
209210
String commentWithBlockTags = comment;
210211
for (DocTree blockTag : docCommentTree.getBlockTags()) {
211212
switch (blockTag.getKind()) {
@@ -284,8 +285,8 @@ public String makeTypeShort(String value) {
284285
.collect(Collectors.joining("<"));
285286
}
286287

287-
private String getSeeAlsoSummary(List<String> seeItems) {
288-
return String.format("\n<b>See Also:</b> %s\n", String.join(", ", seeItems));
288+
private String getSeeAlsoSummary(Set<String> seeItems) {
289+
return String.format("\nSee Also: %s\n", String.join(", ", seeItems));
289290
}
290291

291292
private String getDeprecatedSummary(DeprecatedTree deprecatedTree) {
@@ -297,8 +298,8 @@ private String getSeeTagRef(SeeTree seeTree) {
297298
String ref = seeTree.getReference().stream()
298299
.map(r -> String.valueOf(r)).collect(Collectors.joining(""));
299300
// if it's already a tag, use that otherwise build xref tag
300-
if (ref.matches("^<.+>.*")) {
301-
return ref;
301+
if (ref.matches("^<.+>(.|\n)*")) {
302+
return ref.replaceAll("\n", "").replaceAll("( )+", " ");
302303
}
303304
return String.format("<xref uid=\"%1$s\" data-throw-if-not-resolved=\"false\">%1$s</xref>", ref);
304305
}

third_party/docfx-doclet-143274/src/test/java/com/microsoft/samples/google/ValidationException.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
* Exception thrown if there is a validation problem with a path template, http config, or related
3838
* framework methods. Comes as an illegal argument exception subclass. Allows to globally set a
3939
* thread-local validation context description which each exception inherits.
40+
* @see <a href="https://cloud.google.com/storage/docs/json_api/v1/status-codes">Google Cloud
41+
* Storage error codes</a>
4042
*/
4143
public class ValidationException extends IllegalArgumentException {
4244

third_party/docfx-doclet-143274/src/test/resources/expected-generated-files/com.microsoft.samples.SuperHero.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ items:
254254
overload: "com.microsoft.samples.SuperHero.successfullyAttacked*"
255255
type: "Method"
256256
package: "com.microsoft.samples"
257-
summary: "\n<strong>Deprecated.</strong> <em>As of version 1.1, use . . . instead</em>\n\n<p>This is a simple description of the method. . .\n <a href=\"http://www.supermanisthegreatest.com\">Superman!</a>\n </p>\n<b>See Also:</b> <a href=\"http://www.link_to_jira/HERO-402\">HERO-402</a>\n"
257+
summary: "\n<strong>Deprecated.</strong> <em>As of version 1.1, use . . . instead</em>\n\n<p>This is a simple description of the method. . .\n <a href=\"http://www.supermanisthegreatest.com\">Superman!</a>\n </p>\nSee Also: <a href=\"http://www.link_to_jira/HERO-402\">HERO-402</a>\n"
258258
syntax:
259259
content: "public int successfullyAttacked(int incomingDamage, String damageType)"
260260
parameters:

third_party/docfx-doclet-143274/src/test/resources/expected-generated-files/com.microsoft.samples.google.ValidationException.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ items:
1616
fullName: "com.microsoft.samples.google.ValidationException"
1717
type: "Class"
1818
package: "com.microsoft.samples.google"
19-
summary: "Exception thrown if there is a validation problem with a path template, http config, or related\n framework methods. Comes as an illegal argument exception subclass. Allows to globally set a\n thread-local validation context description which each exception inherits."
19+
summary: "Exception thrown if there is a validation problem with a path template, http config, or related\n framework methods. Comes as an illegal argument exception subclass. Allows to globally set a\n thread-local validation context description which each exception inherits.\nSee Also: <a href=\"https://cloud.google.com/storage/docs/json_api/v1/status-codes\">Google Cloud Storage error codes</a>\n"
2020
syntax:
2121
content: "public class ValidationException extends IllegalArgumentException"
2222
inheritance:

third_party/docfx-doclet-143274/src/test/resources/expected-generated-files/com.microsoft.samples.subpackage.Person.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ items:
2121
fullName: "com.microsoft.samples.subpackage.Person<T>"
2222
type: "Class"
2323
package: "com.microsoft.samples.subpackage"
24-
summary: "Class that describes some person\n\n This comment has links to:\n <ul>\n <li>Owner class <xref uid=\"com.microsoft.samples.subpackage.Person\" data-throw-if-not-resolved=\"false\">Person</xref></li>\n <li>Its inner class <xref uid=\"com.microsoft.samples.subpackage.Person.IdentificationInfo\" data-throw-if-not-resolved=\"false\">Person.IdentificationInfo</xref></li>\n <li>Its method <xref uid=\"com.microsoft.samples.subpackage.Person.setLastName(java.lang.String)\" data-throw-if-not-resolved=\"false\">Person#setLastName(String lastName)</xref></li>\n <li>Its method without params <xref uid=\"com.microsoft.samples.subpackage.Person.setLastName()\" data-throw-if-not-resolved=\"false\">Person#setLastName()</xref></li>\n <li>Its public field <xref uid=\"com.microsoft.samples.subpackage.Person.age\" data-throw-if-not-resolved=\"false\">Person#age</xref></li>\n <li>Another class which used here <xref uid=\"java.util.Set\" data-throw-if-not-resolved=\"false\">Set</xref></li>\n <li>Another class which not used here <xref uid=\"java.util.List\" data-throw-if-not-resolved=\"false\">List</xref></li>\n <li>Broken link <xref uid=\"\" data-throw-if-not-resolved=\"false\">sdfdsagdsfghfgh</xref></li>\n <li>Plain link <xref uid=\"\" data-throw-if-not-resolved=\"false\">someContent</xref></li>\n <li>Link that starts from '#' <xref uid=\"com.microsoft.samples.subpackage.Person.setLastName()\" data-throw-if-not-resolved=\"false\">#setLastName()</xref></li>\n <li>Link with label <xref uid=\"java.util.Set\" data-throw-if-not-resolved=\"false\">WordOne</xref></li>\n </ul>\n\n This is an \"at\" symbol: @\n<b>See Also:</b> <xref uid=\"com.microsoft.samples.subpackage.Display\" data-throw-if-not-resolved=\"false\">Display</xref>\n"
24+
summary: "Class that describes some person\n\n This comment has links to:\n <ul>\n <li>Owner class <xref uid=\"com.microsoft.samples.subpackage.Person\" data-throw-if-not-resolved=\"false\">Person</xref></li>\n <li>Its inner class <xref uid=\"com.microsoft.samples.subpackage.Person.IdentificationInfo\" data-throw-if-not-resolved=\"false\">Person.IdentificationInfo</xref></li>\n <li>Its method <xref uid=\"com.microsoft.samples.subpackage.Person.setLastName(java.lang.String)\" data-throw-if-not-resolved=\"false\">Person#setLastName(String lastName)</xref></li>\n <li>Its method without params <xref uid=\"com.microsoft.samples.subpackage.Person.setLastName()\" data-throw-if-not-resolved=\"false\">Person#setLastName()</xref></li>\n <li>Its public field <xref uid=\"com.microsoft.samples.subpackage.Person.age\" data-throw-if-not-resolved=\"false\">Person#age</xref></li>\n <li>Another class which used here <xref uid=\"java.util.Set\" data-throw-if-not-resolved=\"false\">Set</xref></li>\n <li>Another class which not used here <xref uid=\"java.util.List\" data-throw-if-not-resolved=\"false\">List</xref></li>\n <li>Broken link <xref uid=\"\" data-throw-if-not-resolved=\"false\">sdfdsagdsfghfgh</xref></li>\n <li>Plain link <xref uid=\"\" data-throw-if-not-resolved=\"false\">someContent</xref></li>\n <li>Link that starts from '#' <xref uid=\"com.microsoft.samples.subpackage.Person.setLastName()\" data-throw-if-not-resolved=\"false\">#setLastName()</xref></li>\n <li>Link with label <xref uid=\"java.util.Set\" data-throw-if-not-resolved=\"false\">WordOne</xref></li>\n </ul>\n\n This is an \"at\" symbol: @\nSee Also: <xref uid=\"com.microsoft.samples.subpackage.Display\" data-throw-if-not-resolved=\"false\">Display</xref>\n"
2525
syntax:
2626
content: "public class Person<T>"
2727
typeParameters:

0 commit comments

Comments
 (0)