[FIXED JENKINS-17030] Enable word breaking for job names

This commit is contained in:
Oliver Gondža committed 2013-05-01 18:32:13 +02:00
1 parent d391bbee07
commit 2c240bdc87
10 files changed
+64 -8

No files matched your search

+16
View File
@@ -1716,4 +1716,20 @@ public class Functions {
DecimalFormat format = new DecimalFormat("#0.00");
return format.format(number) + " " + measure;
}
/**
* Get a string that can be safely broken to several lines when necessary.
*
* This implementation inserts <wbr> tags into string. It allows browsers
* to wrap line before any sequence of punctuation characters or anywhere
* in the middle of prolonged sequences of word characters.
*
* @since 1.516
*/
public static String breakableString(final String plain) {
return plain.replaceAll("(\\p{Punct}+\\w)", "<wbr>$1")
.replaceAll("(\\w{10})(?=\\w{3})", "$1<wbr>")
;
}
}