don't use prism for big binaries when rendering library
This commit is contained in:
parent
2c22d8fa23
commit
49cf605b06
|
@ -401,7 +401,7 @@ public class LibraryRenderer extends ResourceRenderer {
|
||||||
p.code().tx(att.getContentType()+lang(att));
|
p.code().tx(att.getContentType()+lang(att));
|
||||||
}
|
}
|
||||||
String prismCode = determinePrismCode(att);
|
String prismCode = determinePrismCode(att);
|
||||||
if (prismCode != null) {
|
if (prismCode != null && !tooBig(txt)) {
|
||||||
x.pre().code().setAttribute("class", "language-"+prismCode).tx(txt);
|
x.pre().code().setAttribute("class", "language-"+prismCode).tx(txt);
|
||||||
} else {
|
} else {
|
||||||
x.pre().code().tx(txt);
|
x.pre().code().tx(txt);
|
||||||
|
@ -420,6 +420,10 @@ public class LibraryRenderer extends ResourceRenderer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean tooBig(String txt) {
|
||||||
|
return txt.length() > 16384;
|
||||||
|
}
|
||||||
|
|
||||||
private String imgExtension(String contentType) {
|
private String imgExtension(String contentType) {
|
||||||
if (contentType != null && contentType.startsWith("image/")) {
|
if (contentType != null && contentType.startsWith("image/")) {
|
||||||
if (contentType.startsWith("image/png")) {
|
if (contentType.startsWith("image/png")) {
|
||||||
|
|
Loading…
Reference in New Issue