vertical-align:top;\r
}\r
\r
+/* CSS trick to workaround #link topOfWindow offset problem */\r
+#lines .line {\r
+ border-top: 160px solid transparent;\r
+ margin-top: -160px;\r
+ -webkit-background-clip: padding-box;\r
+ -moz-background-clip: padding;\r
+ background-clip: padding-box;\r
+}\r
+\r
+#lines span:target {\r
+ background-color: #ffffbf;\r
+}\r
+\r
#nums pre {\r
white-space: pre;\r
}\r
sb.append("<!-- start nums column -->");\r
sb.append("<td id=\"nums\">");\r
sb.append("<pre>");\r
- String numPattern = "<a id=\"L{0}\" href=\"#L{0}\">{0}</a>\n";\r
+ String numPattern = "<a href=\"#L{0}\">{0}</a>\n";\r
for (int i = 0; i < lines.length; i++) {\r
sb.append(MessageFormat.format(numPattern, "" + (i + 1)));\r
}\r
} else {\r
sb.append("<pre class=\"plainprint\">");\r
}\r
- sb.append(StringUtils.escapeForHtml(source, true));\r
+ lines = StringUtils.escapeForHtml(source, true).split("\n");\r
+ for (int i = 0; i < lines.length; i++) {\r
+ sb.append(MessageFormat.format("<span id=\"L{0}\" class=\"line\">", "" + (i + 1)));\r
+ sb.append(lines[i]);\r
+ sb.append("</span>");\r
+ }\r
sb.append("</pre>");\r
sb.append("</div>");\r
sb.append("</td>");\r