Re: Hi all
[notmuch-archives.git] / 5d / aab456a07fbbe93e2f1ccd215c622593fd70f2
1 Return-Path: <wuzzeb@wuzzeb.org>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 9B905431FBC\r
6         for <notmuch@notmuchmail.org>; Wed, 24 Jul 2013 19:36:17 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_NONE=-0.0001] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id c3Rwa-DJySoA for <notmuch@notmuchmail.org>;\r
16         Wed, 24 Jul 2013 19:36:13 -0700 (PDT)\r
17 Received: from smtp.rcn.com (smtp.rcn.com [69.168.97.78])\r
18         by olra.theworths.org (Postfix) with ESMTP id 7D74E431FB6\r
19         for <notmuch@notmuchmail.org>; Wed, 24 Jul 2013 19:36:13 -0700 (PDT)\r
20 X_CMAE_Category: 0,0 Undefined,Undefined\r
21 X-CNFS-Analysis: v=2.1 cv=G7glTbU5 c=1 sm=0 tr=0\r
22         a=C2bPeGdon5f+QfTtoGFpIg==:117 a=C2bPeGdon5f+QfTtoGFpIg==:17\r
23         a=K-v-2zaBAAAA:8 a=gxDP-SbUGcMA:10 a=97V-WqMTq8EA:10\r
24         a=IkcTkHD0fZMA:10 a=3wHbS4G-AAAA:8 a=Qdy8_LB6nwUA:10\r
25         a=A1X0JdhQAAAA:8 a=Nn0Esa4SKUPhQueadGoA:9 a=0z3RHW59VqRJKvoH:21\r
26         a=LRJ8JICpaW-XGMMz:21 a=QEXdDO2ut3YA:10 a=Y6qChIQXU1wA:10\r
27 X-CM-Score: 0\r
28 X-Scanned-by: Cloudmark Authority Engine\r
29 Authentication-Results: smtp01.rcn.cmh.synacor.com\r
30         header.from=wuzzeb@wuzzeb.org; sender-id=pass\r
31 Authentication-Results: smtp01.rcn.cmh.synacor.com\r
32  smtp.mail=wuzzeb@wuzzeb.org; spf=pass; sender-id=pass\r
33 Received-SPF: pass (smtp01.rcn.cmh.synacor.com: domain wuzzeb.org designates\r
34         205.178.10.182 as permitted sender)\r
35 Received: from [205.178.10.182] ([205.178.10.182:44046] helo=wuzzeb.org)\r
36         by smtp.rcn.com (envelope-from <wuzzeb@wuzzeb.org>)\r
37         (ecelerity 2.2.3.49 r(42060/42061)) with ESMTP\r
38         id 12/15-21927-C1F80F15; Wed, 24 Jul 2013 22:36:12 -0400\r
39 Received: from wuzzeb by wuzzeb.org with local (Exim 4.80.1)\r
40         (envelope-from <wuzzeb@wuzzeb.org>)\r
41         id 1V2BPX-0007vw-Op; Wed, 24 Jul 2013 21:36:11 -0500\r
42 From: =?utf-8?Q?John_Lenz?= <lenz@math.uic.edu>\r
43 To: =?utf-8?Q?Tomi_Ollila?= <tomi.ollila@iki.fi>, <notmuch@notmuchmail.org>\r
44 Subject: Re: cli: add --include-html option to notmuch show\r
45 Message-ID: <notmuch-web-1374719771.1588310986@www.wuzzeb.org>\r
46 In-reply-to: <m27ggj1x29.fsf@guru.guru-group.fi>\r
47 References: <notmuch-web-1372724382.450184839@www.wuzzeb.org>\r
48         <m27ggj1x29.fsf@guru.guru-group.fi>\r
49 MIME-Version: 1.0\r
50 Content-Type: text/plain; charset=UTF-8\r
51 Sender: <wuzzeb@wuzzeb.org>\r
52 Date: Wed, 24 Jul 2013 21:36:11 -0500\r
53 X-BeenThere: notmuch@notmuchmail.org\r
54 X-Mailman-Version: 2.1.13\r
55 Precedence: list\r
56 List-Id: "Use and development of the notmuch mail system."\r
57         <notmuch.notmuchmail.org>\r
58 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
59         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
60 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
61 List-Post: <mailto:notmuch@notmuchmail.org>\r
62 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
63 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
64         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
65 X-List-Received-Date: Thu, 25 Jul 2013 02:36:17 -0000\r
66 \r
67 On Sun Jul 21 15:23 -0500 2013, Tomi Ollila <tomi.ollila@iki.fi> wrote:\r
68 > On Tue, Jul 02 2013, John Lenz <lenz@math.uic.edu> wrote:\r
69\r
70 > > For my client, the largest bottleneck for displaying large threads is\r
71 > > exporting each html part individually since by default notmuch will not\r
72 > > show the json parts.  For large threads there can be quite a few parts and\r
73 > > each must be exported and decoded one by one.  Also, I then have to deal\r
74 > > with all the crazy charsets which I can do through a library but is a\r
75 > > pain.\r
76\r
77 > This looks like a useful option. I just wonder what effect does different\r
78 > charsets do to the output (is text/html content output verbatim (with just\r
79 > json/sexp escaping of '"' -characters). \r
80\r
81 > If you added test(s) showing what happens with different charsets\r
82 > (like one message having 3 text/html parts, one us-ascii, one iso-8859-1\r
83 > and one utf-8) that would make things clearer and (also) protect us from \r
84 > regressions.\r
85\r
86 \r
87 \r
88 Here is a test I wrote.  I tried to follow the other tests in formatting.\r
89 Let me know if you want this as a single patch combined with the code\r
90 to enable the option, I can resend it.\r
91 \r
92 \r
93 \r
94 #!/usr/bin/env bash\r
95 test_description="include html parts when showing message"\r
96 . ./test-lib.sh\r
97 \r
98 cat <<EOF > ${MAIL_DIR}/msg\r
99 From: A <a@example.com>\r
100 To: B <b@example.com>\r
101 Subject: html message\r
102 Date: Sat, 01 January 2000 00:00:00 +0000\r
103 Message-ID: <htmlmessage>\r
104 MIME-Version: 1.0\r
105 Content-Type: multipart/alternative; boundary="==-=="\r
106 \r
107 --==-==\r
108 Content-Type: text/html; charset=UTF-8\r
109 \r
110 EOF\r
111 # The Unicode fraction symbol 1/2 is U+00BD and is encoded\r
112 # in UTF-8 as two bytes: octal 302 275\r
113 echo $'<p>0.5 equals \302\275</p>' >> ${MAIL_DIR}/msg\r
114 cat <<EOF >> ${MAIL_DIR}/msg\r
115 \r
116 --==-==\r
117 Content-Type: text/html; charset=ISO-8859-1\r
118 \r
119 EOF\r
120 # The ISO-8859-1 encoding of U+00BD is a single byte: octal 275\r
121 echo $'<p>0.5 equals \275</p>' >> ${MAIL_DIR}/msg\r
122 cat <<EOF >> ${MAIL_DIR}/msg\r
123 \r
124 --==-==\r
125 Content-Type: text/plain; charset=UTF-8\r
126 \r
127 0.5 equals 1/2\r
128 \r
129 --==-==--\r
130 EOF\r
131 \r
132 notmuch new > /dev/null\r
133 \r
134 \r
135 cat <<EOF > EXPECTED.head\r
136 [[[{"id": "htmlmessage", "match":true, "excluded": false, "date_relative":"2000-01-01",\r
137    "timestamp": 946684800,\r
138    "filename": "${MAIL_DIR}/msg",\r
139    "tags": ["inbox", "unread"],\r
140    "headers": { "Date": "Sat, 01 Jan 2000 00:00:00 +0000", "From": "A <a@example.com>",\r
141                 "Subject": "html message", "To": "B <b@example.com>"},\r
142    "body": [{\r
143      "content-type": "multipart/alternative", "id": 1,\r
144 EOF\r
145 \r
146 cat EXPECTED.head > EXPECTED.nohtml\r
147 cat <<EOF >> EXPECTED.nohtml\r
148 "content": [\r
149   { "id": 2, "content-charset": "UTF-8", "content-length": 21, "content-type": "text/html"},\r
150   { "id": 3, "content-charset": "ISO-8859-1", "content-length": 20, "content-type": "text/html"},\r
151   { "id": 4, "content-type": "text/plain", "content": "0.5 equals 1/2\\n"}\r
152 ]}]},[]]]]\r
153 EOF\r
154 \r
155 # Both the UTF-8 and ISO-8859-1 part should have U+00BD\r
156 cat EXPECTED.head > EXPECTED.withhtml\r
157 cat <<EOF >> EXPECTED.withhtml\r
158 "content": [\r
159   { "id": 2, "content-type": "text/html", "content": "<p>0.5 equals \\u00bd</p>\\n"},\r
160   { "id": 3, "content-type": "text/html", "content": "<p>0.5 equals \\u00bd</p>\\n"},\r
161   { "id": 4, "content-type": "text/plain", "content": "0.5 equals 1/2\\n"}\r
162 ]}]},[]]]]\r
163 EOF\r
164 \r
165 test_begin_subtest "html parts excluded by default"\r
166 notmuch show --format=json id:htmlmessage >OUTPUT\r
167 test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED.nohtml)"\r
168 \r
169 test_begin_subtest "html parts included"\r
170 notmuch show --format=json --include-html id:htmlmessage > OUTPUT\r
171 test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED.withhtml)"\r
172 \r
173 test_done\r