Generic quote style

pull/199/head
M66B 4 years ago
parent 2cb7edcf32
commit 96f0a50cd6

@ -646,7 +646,14 @@ public class EntityRule {
div.appendChild(p); div.appendChild(p);
Document answering = JsoupEx.parse(message.getFile(context)); Document answering = JsoupEx.parse(message.getFile(context));
div.appendChild(answering.body().tagName(quote ? "blockquote" : "p")); Element e = answering.body();
if (quote) {
String style = e.attr("style");
style = HtmlHelper.mergeStyles(style, HtmlHelper.QUOTE_STYLE);
e.tagName("blockquote").attr("style", style);
} else
e.tagName("p");
div.appendChild(e);
msg.body().appendChild(div); msg.body().appendChild(div);

@ -4360,7 +4360,12 @@ public class FragmentCompose extends FragmentBase {
boolean quote = (quote_reply && boolean quote = (quote_reply &&
("reply".equals(action) || "reply_all".equals(action) || "list".equals(action))); ("reply".equals(action) || "reply_all".equals(action) || "list".equals(action)));
e.tagName(quote ? "blockquote" : "p"); if (quote) {
String style = e.attr("style");
style = HtmlHelper.mergeStyles(style, HtmlHelper.QUOTE_STYLE);
e.tagName("blockquote").attr("style", style);
} else
e.tagName("p");
reply.appendChild(e); reply.appendChild(e);
if (write_below) if (write_below)

@ -144,7 +144,7 @@ public class HtmlEx {
for (Object quote : quotes) { for (Object quote : quotes) {
if (quote instanceof QuoteSpan) if (quote instanceof QuoteSpan)
out.append("<blockquote style=\"border:3px solid #ccc; padding-left: 3px;\">"); out.append("<blockquote style=\"" + eu.faircode.email.HtmlHelper.QUOTE_STYLE +"\">");
else else
out.append("<blockquote>"); out.append("<blockquote>");
} }

@ -126,6 +126,8 @@ public class HtmlHelper {
static final float FONT_SMALL = 0.8f; static final float FONT_SMALL = 0.8f;
static final float FONT_LARGE = 1.25f; static final float FONT_LARGE = 1.25f;
static final String QUOTE_STYLE = "border-left:3px solid #ccc; padding-left:3px;";
private static final int DEFAULT_FONT_SIZE = 16; // pixels private static final int DEFAULT_FONT_SIZE = 16; // pixels
private static final int DEFAULT_FONT_SIZE_PT = 12; // points private static final int DEFAULT_FONT_SIZE_PT = 12; // points
private static final int GRAY_THRESHOLD = Math.round(255 * 0.2f); private static final int GRAY_THRESHOLD = Math.round(255 * 0.2f);
@ -140,6 +142,7 @@ public class HtmlHelper {
private static final int TRACKING_PIXEL_SURFACE = 25; // pixels private static final int TRACKING_PIXEL_SURFACE = 25; // pixels
private static final float[] HEADING_SIZES = {1.5f, 1.4f, 1.3f, 1.2f, 1.1f, 1f}; private static final float[] HEADING_SIZES = {1.5f, 1.4f, 1.3f, 1.2f, 1.1f, 1f};
private static final String LINE = "----------------------------------------"; private static final String LINE = "----------------------------------------";
private static final HashMap<String, Integer> x11ColorMap = new HashMap<>(); private static final HashMap<String, Integer> x11ColorMap = new HashMap<>();
static { static {
@ -808,7 +811,6 @@ public class HtmlHelper {
} }
break; break;
case "border":
case "border-left": case "border-left":
case "border-right": case "border-right":
if (value != null) { if (value != null) {
@ -2031,9 +2033,13 @@ public class HtmlHelper {
if (prev != null && if (prev != null &&
"blockquote".equals(prev.tagName()) && hasBorder(prev)) "blockquote".equals(prev.tagName()) && hasBorder(prev))
return FilterResult.REMOVE; return FilterResult.REMOVE;
level++; else {
level++;
element.html("&#8230;");
}
} }
} }
return FilterResult.CONTINUE; return FilterResult.CONTINUE;
} }
@ -2041,11 +2047,10 @@ public class HtmlHelper {
public FilterResult tail(Node node, int depth) { public FilterResult tail(Node node, int depth) {
if ("blockquote".equals(node.nodeName())) if ("blockquote".equals(node.nodeName()))
level--; level--;
return FilterResult.CONTINUE; return FilterResult.CONTINUE;
} }
}); });
document.select("blockquote").html("&#8230;");
} }
static String truncate(String text, int at) { static String truncate(String text, int at) {

Loading…
Cancel
Save