Skip to content
Permalink
Browse files
Fixed JENKINS-17759
Turned off pretty printing in the CssInliner.
  • Loading branch information
slide committed Apr 28, 2013
1 parent 27ef815 commit fd016daf6695875f03320474848000201a4409c8
Showing with 22 additions and 2 deletions.
  1. +3 −2 src/main/java/hudson/plugins/emailext/plugins/CssInliner.java
  2. +19 −0 src/test/java/hudson/plugins/emailext/plugins/CssInlinerTest.java
@@ -69,12 +69,13 @@ private String fetchStyles(Document doc) {
public String process(String input) {

Document doc = Jsoup.parse(input);

extractStyles(doc);
applyStyles(doc);
inlineImages(doc);

String output = doc.toString();
doc.outputSettings(doc.outputSettings().prettyPrint(false));
String output = doc.outerHtml();
return output;
}

@@ -106,6 +106,25 @@ public void testImageInliningOn() {
"\" data-inline=\"true\" /></body></html>", output.replaceAll("\r", "\n"));

}

@Test
public void testNoPrettify() {
String input = "<html><head></head>\n" +
"<body>\n" +
"<table border=\"1\">\n" +
"<tbody>\n" +
"<tr>\n" +
"<td> <b>TEXT</b> </td>\n" +
"<td> <b>TEXT</b><pre>\n" +
"line\n" +
"line<v1 />line\n" +
"line<v1 />line\n" +
"</pre>\n" +
"</td>\n" +
"</tr></tbody></table></body></html>";
String output = new CssInliner().process(input);
assertEquals(input, output);
}

private String process(String input) {
return new CssInliner().process(input).replaceAll(" +", " ").replaceAll("\n", "").replaceAll("> *<", "><");

0 comments on commit fd016da

Please sign in to comment.