Skip to content
This repository has been archived by the owner on Aug 9, 2022. It is now read-only.

Commit

Permalink
change the format of xref strings format in description and summary (#55
Browse files Browse the repository at this point in the history
)
  • Loading branch information
anmeng10101 authored Nov 5, 2020
1 parent abd6f32 commit c77c23a
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/microsoft/lookup/BaseLookup.java
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ String buildXrefTag(LinkTree linkTree) {
if (StringUtils.isEmpty(label)) {
label = signature;
}
return String.format("<xref uid=\"%s\" data-throw-if-not-resolved=\"false\">%s</xref>", signature, label);
return String.format("<xref uid=\"%s\" data-throw-if-not-resolved=\"false\" data-raw-source=\"%s\"></xref>", signature, label);
}

String buildCodeTag(LiteralTree literalTree) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/microsoft/util/YamlUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class YamlUtil {
protected Remark initialValue() {
Options options = Options.github();
options.fencedCodeBlocksWidth = 3;
options.ignoredHtmlElements.add(IgnoredHtmlElement.create("xref", "uid", "data-throw-if-not-resolved"));
options.ignoredHtmlElements.add(IgnoredHtmlElement.create("xref", "uid", "data-throw-if-not-resolved", "data-raw-source"));
return new Remark(options);
}
};
Expand Down
10 changes: 5 additions & 5 deletions src/test/java/com/microsoft/lookup/BaseLookupTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public void determineComment() {
verify(linkTree).getReference();
verify(linkTree).getLabel();
assertThat("Wrong result", result,
is("Some text 1<xref uid=\"Some#signature\" data-throw-if-not-resolved=\"false\">Some#signature</xref>"));
is("Some text 1<xref uid=\"Some#signature\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Some#signature\"></xref>"));
}

@Test
Expand Down Expand Up @@ -121,7 +121,7 @@ public void buildXrefTag() {
String result = baseLookup.buildXrefTag(linkTree);

assertThat("Wrong result", result,
is("<xref uid=\"Some#signature\" data-throw-if-not-resolved=\"false\">Some#signature</xref>"));
is("<xref uid=\"Some#signature\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Some#signature\"></xref>"));
}

@Test
Expand All @@ -135,7 +135,7 @@ public void buildXrefTagWhenLabelPresents() {
String result = baseLookup.buildXrefTag(linkTree);

assertThat("Wrong result", result,
is("<xref uid=\"Some#signature\" data-throw-if-not-resolved=\"false\">" + labelValue + "</xref>"));
is("<xref uid=\"Some#signature\" data-throw-if-not-resolved=\"false\" data-raw-source=\"" + labelValue + "\"></xref>"));
}

@Test
Expand Down Expand Up @@ -174,8 +174,8 @@ public void replaceLinksAndCodes() {

String result = baseLookup.replaceLinksAndCodes(Arrays.asList(linkTree, literalTree, textTree));

assertThat("Wrong result", result, is("<xref uid=\"Some#signature\" data-throw-if-not-resolved=\"false\">"
+ "Some#signature</xref><code>Some text content</code>" + textTreeContent));
assertThat("Wrong result", result, is("<xref uid=\"Some#signature\" data-throw-if-not-resolved=\"false\""
+ " data-raw-source=\"Some#signature\"></xref><code>Some text content</code>" + textTreeContent));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ members:
fullName: "com.microsoft.samples.SuperHero.<V>ReturnNull(Class<V> aClass)"
name: "<V>ReturnNull(Class<V> aClass)"
nameWithType: "SuperHero.<V>ReturnNull(Class<V> aClass)"
summary: "Returns a FileStoreAttributeView of the given type.\n\nThis method always returns null as no <xref uid=\"\" data-throw-if-not-resolved=\"false\">FileStoreAttributeView</xref> is currently supported."
summary: "Returns a FileStoreAttributeView of the given type.\n\nThis method always returns null as no <xref uid=\"\" data-throw-if-not-resolved=\"false\" data-raw-source=\"FileStoreAttributeView\"></xref> is currently supported."
parameters:
- description: "a class"
name: "aClass"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ members:
nameWithType: "SuperHero.successfullyAttacked(int incomingDamage, String damageType)"
summary: "This is a simple description of the method. . . [Superman!][Superman]\n\n\n[Superman]: http://www.supermanisthegreatest.com"
parameters:
- description: "the amount of incoming damage for <xref uid=\"com.microsoft.samples.SuperHero\" data-throw-if-not-resolved=\"false\">SuperHero</xref>"
- description: "the amount of incoming damage for <xref uid=\"com.microsoft.samples.SuperHero\" data-throw-if-not-resolved=\"false\" data-raw-source=\"SuperHero\"></xref>"
name: "incomingDamage"
type: "<xref href=\"int?alt=int&text=int\" data-throw-if-not-resolved=\"False\" />"
- description: "type of damage with similar word damageTypeLong, sure"
name: "damageType"
type: "<xref href=\"java.lang.String?alt=java.lang.String&text=String\" data-throw-if-not-resolved=\"False\" />"
syntax: "public int successfullyAttacked(int incomingDamage, String damageType)"
exceptions:
- description: "when incomingDamage is negative and thanks for <xref uid=\"Exception\" data-throw-if-not-resolved=\"false\">Exception</xref>"
- description: "when incomingDamage is negative and thanks for <xref uid=\"Exception\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Exception\"></xref>"
type: "<xref href=\"java.lang.IllegalArgumentException?alt=java.lang.IllegalArgumentException&text=IllegalArgumentException\" data-throw-if-not-resolved=\"False\" />"
returns:
description: "the amount of health hero has after attack"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ members:
fullName: "com.microsoft.samples.subpackage.Person<T>.buildPerson(Person seed)"
name: "buildPerson(Person seed)"
nameWithType: "Person<T>.buildPerson(Person seed)"
summary: "We need to have this method that takes parameter and return types declared in the current class Test link <xref uid=\"java.lang.String\" data-throw-if-not-resolved=\"false\">String</xref> A person maybe a <xref uid=\"com.microsoft.samples.SuperHero\" data-throw-if-not-resolved=\"false\">SuperHero</xref>"
summary: "We need to have this method that takes parameter and return types declared in the current class Test link <xref uid=\"java.lang.String\" data-throw-if-not-resolved=\"false\" data-raw-source=\"String\"></xref> A person maybe a <xref uid=\"com.microsoft.samples.SuperHero\" data-throw-if-not-resolved=\"false\" data-raw-source=\"SuperHero\"></xref>"
parameters:
- name: "seed"
type: "<xref href=\"com.microsoft.samples.subpackage.Person?alt=com.microsoft.samples.subpackage.Person&text=Person\" data-throw-if-not-resolved=\"False\" />"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ uid: "com.microsoft.samples.subpackage.Person"
fullName: "com.microsoft.samples.subpackage.Person<T>"
name: "Person<T>"
nameWithType: "Person<T>"
summary: "Class that describes some person This comment has links to:\n\n * Owner class <xref uid=\"com.microsoft.samples.subpackage.Person\" data-throw-if-not-resolved=\"false\">Person</xref>\n * Its inner class <xref uid=\"com.microsoft.samples.subpackage.Person.IdentificationInfo\" data-throw-if-not-resolved=\"false\">Person.IdentificationInfo</xref>\n * Its method <xref uid=\"com.microsoft.samples.subpackage.Person.setLastName(java.lang.String)\" data-throw-if-not-resolved=\"false\">Person#setLastName(String lastName)</xref>\n * Its method without params <xref uid=\"com.microsoft.samples.subpackage.Person.setLastName()\" data-throw-if-not-resolved=\"false\">Person#setLastName()</xref>\n * Its public field <xref uid=\"com.microsoft.samples.subpackage.Person.age\" data-throw-if-not-resolved=\"false\">Person#age</xref>\n * Another class which used here <xref uid=\"java.util.Set\" data-throw-if-not-resolved=\"false\">Set</xref>\n * Another class which not used here <xref uid=\"java.util.List\" data-throw-if-not-resolved=\"false\">List</xref>\n * Broken link <xref uid=\"\" data-throw-if-not-resolved=\"false\">sdfdsagdsfghfgh</xref>\n * Plain link <xref uid=\"\" data-throw-if-not-resolved=\"false\">someContent</xref>\n * Link that starts from '\\#' <xref uid=\"com.microsoft.samples.subpackage.Person.setLastName()\" data-throw-if-not-resolved=\"false\">#setLastName()</xref>\n * Link with label <xref uid=\"java.util.Set\" data-throw-if-not-resolved=\"false\">WordOne</xref>\n\nThis is an \"at\" symbol: @"
summary: "Class that describes some person This comment has links to:\n\n * Owner class <xref uid=\"com.microsoft.samples.subpackage.Person\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Person\"></xref>\n * Its inner class <xref uid=\"com.microsoft.samples.subpackage.Person.IdentificationInfo\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Person.IdentificationInfo\"></xref>\n * Its method <xref uid=\"com.microsoft.samples.subpackage.Person.setLastName(java.lang.String)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Person#setLastName(String lastName)\"></xref>\n * Its method without params <xref uid=\"com.microsoft.samples.subpackage.Person.setLastName()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Person#setLastName()\"></xref>\n * Its public field <xref uid=\"com.microsoft.samples.subpackage.Person.age\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Person#age\"></xref>\n * Another class which used here <xref uid=\"java.util.Set\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Set\"></xref>\n * Another class which not used here <xref uid=\"java.util.List\" data-throw-if-not-resolved=\"false\" data-raw-source=\"List\"></xref>\n * Broken link <xref uid=\"\" data-throw-if-not-resolved=\"false\" data-raw-source=\"sdfdsagdsfghfgh\"></xref>\n * Plain link <xref uid=\"\" data-throw-if-not-resolved=\"false\" data-raw-source=\"someContent\"></xref>\n * Link that starts from '\\#' <xref uid=\"com.microsoft.samples.subpackage.Person.setLastName()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#setLastName()\"></xref>\n * Link with label <xref uid=\"java.util.Set\" data-throw-if-not-resolved=\"false\" data-raw-source=\"WordOne\"></xref>\n\nThis is an \"at\" symbol: @"
inheritances:
- "<xref href=\"java.lang.Object\" data-throw-if-not-resolved=\"False\" />"
inheritedMembers:
Expand Down

0 comments on commit c77c23a

Please sign in to comment.