diff --git a/third_party/docfx-doclet-143274/pom.xml b/third_party/docfx-doclet-143274/pom.xml
index 5aff67b1..938f9057 100644
--- a/third_party/docfx-doclet-143274/pom.xml
+++ b/third_party/docfx-doclet-143274/pom.xml
@@ -17,6 +17,7 @@
3.12.0
4.4
2.11.0
+ 1.10.0
1.1.0
@@ -111,6 +112,11 @@
commons-io
${apache.commons-io.version}
+
+ org.apache.commons
+ commons-text
+ ${apache.commons-text.version}
+
com.fasterxml.jackson.core
jackson-databind
diff --git a/third_party/docfx-doclet-143274/src/main/java/com/microsoft/lookup/BaseLookup.java b/third_party/docfx-doclet-143274/src/main/java/com/microsoft/lookup/BaseLookup.java
index d4f04d14..ba6b808b 100644
--- a/third_party/docfx-doclet-143274/src/main/java/com/microsoft/lookup/BaseLookup.java
+++ b/third_party/docfx-doclet-143274/src/main/java/com/microsoft/lookup/BaseLookup.java
@@ -13,14 +13,13 @@
import com.sun.source.doctree.LinkTree;
import com.sun.source.doctree.LiteralTree;
import com.sun.source.doctree.SeeTree;
-import java.util.concurrent.ConcurrentHashMap;
import jdk.javadoc.doclet.DocletEnvironment;
import org.apache.commons.lang3.RegExUtils;
import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.text.StringEscapeUtils;
import javax.lang.model.element.Element;
import javax.lang.model.element.ElementKind;
-import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
@@ -242,7 +241,7 @@ String replaceLinksAndCodes(List extends DocTree> items) {
case LITERAL:
return expandLiteralBody((LiteralTree) bodyItem);
default:
- return String.valueOf(bodyItem);
+ return String.valueOf(StringEscapeUtils.unescapeJava(bodyItem.toString()));
}
}
).collect(Collectors.joining()));
@@ -261,11 +260,11 @@ String buildXrefTag(LinkTree linkTree) {
}
String buildCodeTag(LiteralTree literalTree) {
- return String.format("%s", literalTree.getBody());
+ return String.format("%s", StringEscapeUtils.unescapeJava(literalTree.getBody().toString()));
}
String expandLiteralBody(LiteralTree bodyItem) {
- return String.valueOf(bodyItem.getBody());
+ return String.valueOf(StringEscapeUtils.unescapeJava(bodyItem.getBody().toString()));
}
protected Optional getDocCommentTree(T element) {
diff --git a/third_party/docfx-doclet-143274/src/test/java/com/microsoft/lookup/BaseLookupTest.java b/third_party/docfx-doclet-143274/src/test/java/com/microsoft/lookup/BaseLookupTest.java
index c978e643..4078facd 100644
--- a/third_party/docfx-doclet-143274/src/test/java/com/microsoft/lookup/BaseLookupTest.java
+++ b/third_party/docfx-doclet-143274/src/test/java/com/microsoft/lookup/BaseLookupTest.java
@@ -134,7 +134,7 @@ public void buildXrefTagWhenLabelPresents() {
@Test
public void buildCodeTag() {
- String tagContent = "Some text";
+ String tagContent = "Some text ≤";
when(literalTree.getBody()).thenReturn(textTree);
when(textTree.toString()).thenReturn(tagContent);
@@ -145,13 +145,14 @@ public void buildCodeTag() {
@Test
public void expandLiteralBody() {
- String tagContent = "Some text";
+ String tagContent = "Some text ≤ \u2264";
when(literalTree.getBody()).thenReturn(textTree);
when(textTree.toString()).thenReturn(tagContent);
String result = baseLookup.expandLiteralBody(literalTree);
+ String expected = "Some text ≤ ≤";
- assertEquals("Wrong result", result, tagContent);
+ assertEquals("Wrong result", result, expected);
}
@Test
@@ -159,7 +160,7 @@ public void replaceLinksAndCodes() {
when(linkTree.getReference()).thenReturn(referenceTree);
when(referenceTree.getSignature()).thenReturn("Some#signature");
when(linkTree.getLabel()).thenReturn(Collections.emptyList());
- String textTreeContent = "Some text content";
+ String textTreeContent = "Some text content ≤ \u2264";
when(literalTree.getBody()).thenReturn(textTree);
when(textTree.toString()).thenReturn(textTreeContent);
when(linkTree.getKind()).thenReturn(Kind.LINK);
@@ -169,7 +170,7 @@ public void replaceLinksAndCodes() {
String result = baseLookup.replaceLinksAndCodes(Arrays.asList(linkTree, literalTree, textTree));
assertEquals("Wrong result", result, ""
- + "Some#signatureSome text content" + textTreeContent);
+ + "Some#signatureSome text content ≤ ≤" + textTreeContent);
}
@Test