1 # Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
2 # License: AGPLv3 or later (https://www.gnu.org/licenses/agpl-3.0.txt)
17 > Long and wordy reply goes here and it is split across multiple lines.
18 > We generate links to a separate full page where quoted-text is inline.
22 > See MAX_INLINE_QUOTED
23 > See MAX_INLINE_QUOTED
24 > See MAX_INLINE_QUOTED
25 > See MAX_INLINE_QUOTED
26 > See MAX_INLINE_QUOTED
27 > See MAX_INLINE_QUOTED
28 > See MAX_INLINE_QUOTED
29 > See MAX_INLINE_QUOTED
33 my $s = Email::Simple->create(
35 From => 'a@example.com',
36 To => 'b@example.com',
37 'Content-Type' => 'text/plain',
38 'Message-ID' => '<hello@example.com>',
39 Subject => 'this is a subject',
43 $s = Email::MIME->new($s->as_string);
44 my $html = PublicInbox::View->msg_html($s);
47 like($html, qr!<a\nhref="\.\./m/hello%40!s, "MID link present");
48 like($html, qr/hello world\b/, "body present");
49 like($html, qr/> keep this inline/, "short quoted text is inline");
50 like($html, qr/<a\nid=[^>]+>> Long and wordy/,
51 "long quoted text is anchored");
54 my $pfx = "http://example.com/test/f";
55 my $short = PublicInbox::View->msg_html($s, $pfx);
56 like($short, qr!<a\nhref="hello%40!s, "MID link present");
57 like($short, qr/\n> keep this inline/,
58 "short quoted text is inline");
59 like($short, qr/<a\nhref="\Q$pfx\E#[^>]+>Long and wordy/,
60 "long quoted text is made into a link");
61 ok(length($short) < length($html), "short page is shorter");
68 attributes => { content_type => 'text/plain', },
72 attributes => { content_type => 'text/plain', },
76 my $mime = Email::MIME->create(
78 From => 'a@example.com',
80 'Message-ID' => '<blah@example.com>',
81 'In-Reply-To' => '<irp@example.com>',
86 my $html = PublicInbox::View->msg_html($mime);
87 like($html, qr/hi\n-+ part #2 -+\nbye\n/, "multipart split");
90 # multipart email with attached patch
94 attributes => { content_type => 'text/plain', },
95 body => 'hi, see attached patch',
99 content_type => 'text/plain',
100 filename => "foo.patch",
102 body => "--- a/file\n+++ b/file\n" .
103 "@@ -49, 7 +49,34 @@\n",
106 my $mime = Email::MIME->create(
108 From => 'a@example.com',
109 Subject => '[PATCH] asdf',
110 'Message-ID' => '<patch@example.com>',
115 my $html = PublicInbox::View->msg_html($mime);
116 like($html, qr!see attached patch\n-+ foo\.patch -+\n--- a/file\n!,
117 "parts split with filename");
120 # multipart collapsed to single quoted-printable text/plain
125 content_type => 'text/plain',
126 encoding => 'quoted-printable',
131 my $mime = Email::MIME->create(
133 From => 'qp@example.com',
135 'Message-ID' => '<qp@example.com>',
140 my $html = PublicInbox::View->msg_html($mime);
141 like($mime->body_raw, qr/hi =3D bye=/, "our test used QP correctly");
142 like($html, qr/\bhi = bye\b/, "HTML output decoded QP");