Skip to content

Commit

Permalink
[JENKINS-33105] Refactor and simplify a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
Vlatombe committed Aug 28, 2017
1 parent 6daedb0 commit 8953d29
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
Expand Up @@ -58,17 +58,13 @@ public ConsoleAnnotator annotate(Object context, MarkupText text) {
if (start <= 0) { // only annotate if we are handling the full log
calls++;
int end = text.length() - 1;

String cssClasses = "line";
if (text.getText().matches("^\\s$")) {
// Trick to make sure we wrap everything including the Timestamp from Timestamper plugin
text.addMarkup(0, 0, "",
MessageFormat.format("<p class=\"empty\"><a class=\"linenumber\" id=\"L{0}\" href=\"#L{0}\"></a><span>", calls));
text.addMarkup(end, end, "", "</span></p>");
} else {
text.addMarkup(0, 0, "",
MessageFormat.format("<p class=\"line\"><a class=\"linenumber\" id=\"L{0}\" href=\"#L{0}\"></a><span>", calls));
text.addMarkup(end, end, "", "</span></p>");
cssClasses = cssClasses + " empty";
}
text.addMarkup(0, 0, "", MessageFormat.format("<p class=\"{1}\"><a class=\"linenumber\" id=\"L{0}\" href=\"#L{0}\"></a><span>", calls, cssClasses));
text.addMarkup(end, end, "", "</span></p>");
}
return this;
}
Expand Down
Expand Up @@ -42,10 +42,8 @@ p.line {
font-family:monospace;
}

p.empty {
p.line.empty {
display:block;
white-space:nowrap;
font-family:monospace;
}

pre p,pre span {
Expand Down

0 comments on commit 8953d29

Please sign in to comment.