Skip to content

Commit 1134584

Browse files
BananeweizenCalixte
authored andcommitted
Fix rendering of inline code tags
Rule descriptions with inline code tags (from Javadoc) rendered those tags verbatim. Replace them by HTML code tags for correct rendering.
1 parent d4fffe4 commit 1134584

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

net.sf.eclipsecs.ui/src/net/sf/eclipsecs/ui/config/CheckConfigurationConfigureDialog.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@
104104
*/
105105
public class CheckConfigurationConfigureDialog extends TitleAreaDialog {
106106

107+
private static final Pattern PATTERN_INLINE_CODE = Pattern.compile(Pattern.quote("{@code ") + "([^}]*?)" + Pattern.quote("}"));
108+
107109
/** The current check configuration. */
108110
private final CheckConfigurationWorkingCopy mConfiguration;
109111

@@ -483,12 +485,16 @@ public static String getDescriptionHtml(String description) {
483485
StringBuilder buf = new StringBuilder();
484486
buf.append("<html><body style=\"margin: 3px; font-size: 11px; ");
485487
buf.append("font-family: verdana, 'trebuchet MS', helvetica, sans-serif;\">");
486-
buf.append(description != null ? description
488+
buf.append(description != null ? convertInlineCodeTags(description)
487489
: Messages.CheckConfigurationConfigureDialog_txtNoDescription);
488490
buf.append("</body></html>");
489491
return buf.toString();
490492
}
491493

494+
private static String convertInlineCodeTags(String html) {
495+
return PATTERN_INLINE_CODE.matcher(html).replaceAll("<code>$1</code>");
496+
}
497+
492498
/**
493499
* Controller for this page.
494500
*

0 commit comments

Comments
 (0)