1 # Copyright (C) 2013-2015 all contributors <meta@public-inbox.org>
2 # License: AGPLv3 or later (https://www.gnu.org/licenses/agpl-3.0.txt)
12 PublicInbox::View::msg_html(undef, $mime);
23 > Long and wordy reply goes here and it is split across multiple lines.
24 > We generate links to a separate full page where quoted-text is inline.
28 > See MAX_INLINE_QUOTED
29 > See MAX_INLINE_QUOTED
30 > See MAX_INLINE_QUOTED
31 > See MAX_INLINE_QUOTED
32 > See MAX_INLINE_QUOTED
33 > See MAX_INLINE_QUOTED
34 > See MAX_INLINE_QUOTED
35 > See MAX_INLINE_QUOTED
39 my $s = Email::Simple->create(
41 From => 'a@example.com',
42 To => 'b@example.com',
43 'Content-Type' => 'text/plain',
44 'Message-ID' => '<hello@example.com>',
45 Subject => 'this is a subject',
49 my $mime = Email::MIME->new($s);
50 my $html = msg_html($mime);
53 like($html, qr!<a\nhref="raw"!s, "raw link present");
54 like($html, qr/hello world\b/, "body present");
55 like($html, qr/> keep this inline/, "short quoted text is inline");
62 attributes => { content_type => 'text/plain', },
66 attributes => { content_type => 'text/plain', },
70 my $mime = Email::MIME->create(
72 From => 'a@example.com',
74 'Message-ID' => '<blah@example.com>',
75 'In-Reply-To' => '<irp@example.com>',
80 my $html = msg_html($mime);
81 like($html, qr/hi\n.*-- Attachment #2.*\nbye\n/s, "multipart split");
84 # multipart email with attached patch
88 attributes => { content_type => 'text/plain', },
89 body => 'hi, see attached patch',
93 content_type => 'text/plain',
94 filename => "foo.patch",
96 body => "--- a/file\n+++ b/file\n" .
97 "@@ -49, 7 +49,34 @@\n",
100 my $mime = Email::MIME->create(
102 From => 'a@example.com',
103 Subject => '[PATCH] asdf',
104 'Message-ID' => '<patch@example.com>',
109 my $html = msg_html($mime);
110 like($html, qr!.*Attachment #2: foo\.patch --!,
111 "parts split with filename");
114 # multipart collapsed to single quoted-printable text/plain
119 content_type => 'text/plain',
120 encoding => 'quoted-printable',
125 my $mime = Email::MIME->create(
127 From => 'qp@example.com',
129 'Message-ID' => '<qp@example.com>',
134 my $orig = $mime->body_raw;
135 my $html = msg_html($mime);
136 like($orig, qr/hi =3D bye=/, "our test used QP correctly");
137 like($html, qr/\bhi = bye\b/, "HTML output decoded QP");
141 use PublicInbox::MID qw/id_compress/;
143 # n.b: this is probably invalid since we dropped CGI for PSGI:
144 like(id_compress('foo%bar@wtf'), qr/\A[a-f0-9]{40}\z/,
145 "percent always converted to sha1 to workaround buggy httpds");
147 is(id_compress('foobar-wtf'), 'foobar-wtf',
148 'regular ID not compressed');