mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-27 11:42:16 -05:00
Fixed code style
This commit is contained in:
parent
464a5d54e3
commit
2c8ae0644b
@ -192,7 +192,7 @@ public class HtmlConverter {
|
|||||||
|
|
||||||
private static final String HTML_BLOCKQUOTE_COLOR_TOKEN = "$$COLOR$$";
|
private static final String HTML_BLOCKQUOTE_COLOR_TOKEN = "$$COLOR$$";
|
||||||
private static final String HTML_BLOCKQUOTE_START = "<blockquote class=\"gmail_quote\" " +
|
private static final String HTML_BLOCKQUOTE_START = "<blockquote class=\"gmail_quote\" " +
|
||||||
"style=\"margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid $$COLOR$$; padding-left: 1ex;\">";
|
"style=\"margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid $$COLOR$$; padding-left: 1ex;\">";
|
||||||
private static final String HTML_BLOCKQUOTE_END = "</blockquote>";
|
private static final String HTML_BLOCKQUOTE_END = "</blockquote>";
|
||||||
private static final String HTML_NEWLINE = "<br />";
|
private static final String HTML_NEWLINE = "<br />";
|
||||||
|
|
||||||
@ -244,7 +244,7 @@ public class HtmlConverter {
|
|||||||
buff.append("<");
|
buff.append("<");
|
||||||
break;
|
break;
|
||||||
case '>':
|
case '>':
|
||||||
if(isStartOfLine) {
|
if (isStartOfLine) {
|
||||||
quotesThisLine++;
|
quotesThisLine++;
|
||||||
} else {
|
} else {
|
||||||
buff.append(">");
|
buff.append(">");
|
||||||
@ -253,25 +253,25 @@ public class HtmlConverter {
|
|||||||
case '\r':
|
case '\r':
|
||||||
break;
|
break;
|
||||||
case ' ':
|
case ' ':
|
||||||
if(isStartOfLine) {
|
if (isStartOfLine) {
|
||||||
// If we're still in the start of the line and we have spaces, don't output them, since they
|
// If we're still in the start of the line and we have spaces, don't output them, since they
|
||||||
// may be collapsed by our div-converting magic.
|
// may be collapsed by our div-converting magic.
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
if(isStartOfLine) {
|
if (isStartOfLine) {
|
||||||
// Not a quote character and not a space. Content is starting now.
|
// Not a quote character and not a space. Content is starting now.
|
||||||
isStartOfLine = false;
|
isStartOfLine = false;
|
||||||
if(K9.DEBUG) {
|
if (K9.DEBUG) {
|
||||||
Log.d(K9.LOG_TAG, "currentQuoteDepth: " + quoteDepth + " quotesThisLine: " + quotesThisLine);
|
Log.d(K9.LOG_TAG, "currentQuoteDepth: " + quoteDepth + " quotesThisLine: " + quotesThisLine);
|
||||||
}
|
}
|
||||||
// Add/remove blockquotes by comparing this line's quotes to the previous line's quotes.
|
// Add/remove blockquotes by comparing this line's quotes to the previous line's quotes.
|
||||||
if(quotesThisLine > quoteDepth) {
|
if (quotesThisLine > quoteDepth) {
|
||||||
for(int i = quoteDepth; i < quotesThisLine; i++) {
|
for (int i = quoteDepth; i < quotesThisLine; i++) {
|
||||||
buff.append(HTML_BLOCKQUOTE_START.replace(HTML_BLOCKQUOTE_COLOR_TOKEN, getQuoteColor(i + 1)));
|
buff.append(HTML_BLOCKQUOTE_START.replace(HTML_BLOCKQUOTE_COLOR_TOKEN, getQuoteColor(i + 1)));
|
||||||
}
|
}
|
||||||
} else if(quotesThisLine < quoteDepth) {
|
} else if (quotesThisLine < quoteDepth) {
|
||||||
for(int i = quoteDepth; i > quotesThisLine; i--) {
|
for (int i = quoteDepth; i > quotesThisLine; i--) {
|
||||||
buff.append(HTML_BLOCKQUOTE_END);
|
buff.append(HTML_BLOCKQUOTE_END);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -295,9 +295,9 @@ public class HtmlConverter {
|
|||||||
// Make newlines at the end of blockquotes nicer by putting newlines beyond the first one outside of the
|
// Make newlines at the end of blockquotes nicer by putting newlines beyond the first one outside of the
|
||||||
// blockquote.
|
// blockquote.
|
||||||
text = text.replaceAll(
|
text = text.replaceAll(
|
||||||
"\\Q" + HTML_NEWLINE + "\\E((\\Q" + HTML_NEWLINE + "\\E)+?)\\Q" + HTML_BLOCKQUOTE_END + "\\E",
|
"\\Q" + HTML_NEWLINE + "\\E((\\Q" + HTML_NEWLINE + "\\E)+?)\\Q" + HTML_BLOCKQUOTE_END + "\\E",
|
||||||
HTML_BLOCKQUOTE_END + "$1"
|
HTML_BLOCKQUOTE_END + "$1"
|
||||||
);
|
);
|
||||||
|
|
||||||
// Replace lines of -,= or _ with horizontal rules
|
// Replace lines of -,= or _ with horizontal rules
|
||||||
text = text.replaceAll("\\s*([-=_]{30,}+)\\s*", "<hr />");
|
text = text.replaceAll("\\s*([-=_]{30,}+)\\s*", "<hr />");
|
||||||
|
@ -66,7 +66,7 @@ public class HtmlConverterTest extends TestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void writeToFile(final String content) {
|
private void writeToFile(final String content) {
|
||||||
if(!WRITE_TO_FILE) {
|
if (!WRITE_TO_FILE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user