Geary previously wrapped plain text sigs (i.e. those that did not contain
any HTML elements) in a DIV styled to preserve whitespace. This is all
perfectly fine, except that certain Microsoft products munged the email
for presentation and destroy the whitespace present in the message body,
causing the sig to be mis-rendered.
This works around their shitty software by using BRs instead of the DIV,
also escapes other control chars and sequential whitespace as well when
using a plain text sig. It also stops trying to smart-escape quoted reply
text, since we know it's going to be HTML from the conversation viewer,
meaning smart escaping only needs to be used for sigs.
See issue #29
* test/api/*.vala: Renamed files that contained mock objects to *-mock.vala,
not *-test.vala.
* test/testcase.vala: Renamed to test-case.vala for consistency, remove
TestCase class from Gee package since that's really not true. Clean up
code for consistency.
* test/meson.build, test/CMakeLists.txt: Split TestCase compilation out
into a separate test lib.
* src/engine/util/util-html.vala (smart_escape): Don't bother attempting
to match a pair of tags, just something that looks like an opening tag,
since IMG is an empty element and it is valid to not have a closing
slash in HTML. Also, closing tags in HTML are optional anwyay. Add some
unit tests.
When generating the preview, only the first 128 bytes of the first MIME
part is fetched and used. If this part is text/html with a significant
amount of embedded CSS, then there is a good chance the string passed to
Geary.HTML::remove_html_tags() will be invalid, or be missing closing
elements. Since that function uses regexes that require balanced tags to
remove script and style blocks, then it was very possible that in these
cases this method will miss removing these blocks.
To solve this, remove_html_tags() is removed and its call sites are
replaced by calls to Geary.HTML::html_to_text(), which has been tidyied
up to produce more human-readable result.
Add unit tests to cover new html_to_text functionality and its call
sites.
* src/engine/util/util-html.vala: Remove remove_html_tags(). Update
html_to_text() to not just insert line breaks, but also insert spaces
and alt text, and ignore tags like HEAD, SCRIPT and STYLE, as
appropriate. Add an optional param to also allow skipping BLOCKQUOTE
elements, which we don't want in the preview.