Author: shane.bryzak(a)jboss.com
Date: 2009-03-18 06:28:42 -0400 (Wed, 18 Mar 2009)
New Revision: 16178
Modified:
validator/trunk/tck-utils/impl/src/main/java/org/hibernate/tck/report/CoverageReport.java
Log:
support for literals
Modified:
validator/trunk/tck-utils/impl/src/main/java/org/hibernate/tck/report/CoverageReport.java
===================================================================
---
validator/trunk/tck-utils/impl/src/main/java/org/hibernate/tck/report/CoverageReport.java 2009-03-17
23:49:59 UTC (rev 16177)
+++
validator/trunk/tck-utils/impl/src/main/java/org/hibernate/tck/report/CoverageReport.java 2009-03-18
10:28:42 UTC (rev 16178)
@@ -34,7 +34,8 @@
public static final String SVN_BASE_URL_PROPERTY = "svn_base_url";
private static final Pattern PATTERN_BOLD =
Pattern.compile("([_][^_]*[_])");
- private static final Pattern PATTERN_STRIKETHROUGH =
Pattern.compile("([~][^~]*[~])");
+ private static final Pattern PATTERN_STRIKETHROUGH =
Pattern.compile("([~][^~]*[~])");
+ private static final Pattern PATTERN_LITERAL =
Pattern.compile("([|][^|]*[|])");
private static final String REPORT_FILE_NAME = "coverage.html";
private static final String COLOUR_SHADE_GREEN = "#ddffdd";
@@ -212,6 +213,8 @@
sb.append(" font-style: italic; }\n");
sb.append(" .highlight {\n");
sb.append(" background-color: #ffff00; }\n");
+ sb.append(" .literal {\n");
+ sb.append(" font-family: courier new; }\n");
sb.append(" .implied {\n");
sb.append(" color: #fff;\n");
sb.append(" font-weight: bold;\n");
@@ -643,7 +646,7 @@
copyFile(imageFile, new File(imageTargetDir, imageFilename));
}
- String assertionText =
parseStrikethrough(parseBold(assertion.getText()));
+ String assertionText =
parseStrikethrough(parseBold(parseLiteral(assertion.getText())));
if (!Strings.isEmpty(assertion.getNote()))
{
@@ -767,6 +770,20 @@
}
return result;
}
+
+ private String parseLiteral(String text)
+ {
+ Matcher m = PATTERN_LITERAL.matcher(text);
+
+ String result = text;
+ while (m.find())
+ {
+ String replacement = "<span class=\"literal\">" +
m.group().substring(1, m.group().length() - 1) + "</span>";
+ result = m.replaceFirst(replacement);
+ m.reset(result);
+ }
+ return result;
+ }
private void writeUnmatched(OutputStream out) throws IOException {
if (unmatched.isEmpty()) return;
Show replies by date