mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-06 05:10:22 +07:00
IDEA-164610 Quick documentation should escape angle brackets at the value of a String field referred via @value (javadoc tag)
also add quotes to string value, and convert value into a link to corresponding field's javadoc, like javadoc tool does
This commit is contained in:
@@ -1463,7 +1463,10 @@ public class JavaDocInfoGenerator {
|
||||
}
|
||||
|
||||
if (value != null) {
|
||||
buffer.append(value);
|
||||
String valueText = StringUtil.escapeXml(value.toString());
|
||||
if (value instanceof String) valueText = '"' + valueText + '"';
|
||||
if (valueField.equals(myElement)) buffer.append(valueText); // don't generate link to itself
|
||||
else generateLink(buffer, valueField, valueText, true);
|
||||
}
|
||||
else {
|
||||
buffer.append(element.getText());
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<html><head><base href="placeholder"> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://A"><code>A</code></a></b></small><PRE>public static void <b>JAVADOC_ME</b>()</PRE> The value of B is <a href="psi_element://A#B">"a<b"</a>.</body></html>
|
||||
@@ -0,0 +1,6 @@
|
||||
class A {
|
||||
public static String B = "a<b";
|
||||
|
||||
/** The value of B is {@value #B}. */
|
||||
public static void JAVADOC_ME() { }
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
<html><head><base href="placeholder"> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://A"><code>A</code></a></b></small><PRE>public static void <b>JAVADOC_ME</b>()</PRE> The value of A is 23.</body></html>
|
||||
<html><head><base href="placeholder"> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://A"><code>A</code></a></b></small><PRE>public static void <b>JAVADOC_ME</b>()</PRE> The value of A is <a href="psi_element://A#A">23</a>.</body></html>
|
||||
@@ -1 +1 @@
|
||||
<html><head><base href="placeholder"> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://A"><code>A</code></a></b></small><PRE>public static void <b>JAVADOC_ME</b>()</PRE> The value of A is 23.</body></html>
|
||||
<html><head><base href="placeholder"> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://A"><code>A</code></a></b></small><PRE>public static void <b>JAVADOC_ME</b>()</PRE> The value of A is <a href="psi_element://A#A">23</a>.</body></html>
|
||||
@@ -65,6 +65,10 @@ public class JavaDocInfoGeneratorTest extends CodeInsightTestCase {
|
||||
doTestMethod();
|
||||
}
|
||||
|
||||
public void testEscapingStringValue() throws Exception {
|
||||
doTestMethod();
|
||||
}
|
||||
|
||||
public void testIdeadev2326() throws Exception {
|
||||
doTestMethod();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user