Skip to content

Commit c9d19f9

Browse files
committed
Small improvment in xml escaping.
Since we have 'char' variable here, there's no reason to use function requiring a string and iterating over it's chars.
1 parent 7c81893 commit c9d19f9

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

scalac-scoverage-plugin/src/main/scala/scoverage/report/CodeGrid.scala

+8-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,14 @@ class CodeGrid(mFile: MeasuredFile, sourceEncoding: Option[String]) {
5757
sb append spanStart(cell.status)
5858
style = style2
5959
}
60-
xml.Utility.escape(cell.char.toString, sb)
60+
// escape xml characters
61+
cell.char match {
62+
case '<' => sb.append("&lt;")
63+
case '>' => sb.append("&gt;")
64+
case '&' => sb.append("&amp;")
65+
case '"' => sb.append("&quot;")
66+
case c => sb.append(c)
67+
}
6168
})
6269
sb append "</span>"
6370
sb.toString

0 commit comments

Comments
 (0)