]> git.notmuchmail.org Git - notmuch/commitdiff
cli: notmuch show support for --include-html with --format=text
authorMaxime Coste <mawww@kakoune.org>
Tue, 30 Oct 2018 23:54:32 +0000 (10:54 +1100)
committerDavid Bremner <david@tethera.net>
Sat, 24 Nov 2018 13:12:30 +0000 (09:12 -0400)
NEWS
doc/man1/notmuch-show.rst
notmuch-show.c
test/T190-multipart.sh

diff --git a/NEWS b/NEWS
index 64de999938f733e43311a5386ce8ec045d46580d..434f920a42f639e3165e9da348b71271837aa010 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -4,7 +4,8 @@ Notmuch 0.29 (UNRELEASED)
 Command Line Interface
 ----------------------
 
-`notmuch show` now supports --body=false with --format=text
+`notmuch show` now supports --body=false and --include-html with
+--format=text
 
 Notmuch 0.28 (2018-10-12)
 =========================
index f3c32fd27c40d9808160a4f9ae95f8d2bfa7ab93..a2708a04d6894898509b28a8a95d1c31df6e1e87 100644 (file)
@@ -183,11 +183,12 @@ Supported options for **show** include
     output is much faster and substantially smaller.
 
 ``--include-html``
-    Include "text/html" parts as part of the output (currently only
-    supported with ``--format=json`` and ``--format=sexp``). By default,
-    unless ``--part=N`` is used to select a specific part or
-    ``--include-html`` is used to include all "text/html" parts, no
-    part with content type "text/html" is included in the output.
+    Include "text/html" parts as part of the output (currently
+    only supported with ``--format=text``, ``--format=json`` and
+    ``--format=sexp``). By default, unless ``--part=N`` is used to
+    select a specific part or ``--include-html`` is used to include all
+    "text/html" parts, no part with content type "text/html" is included
+    in the output.
 
 A common use of **notmuch show** is to display a single thread of email
 messages. For this, use a search term of "thread:<thread-id>" as can be
index 42fe27cc99fca564f237f550c60db01d17408794..07e9a5dbc8169e3618cea09bc1a7da8389b0040f 100644 (file)
@@ -584,7 +584,8 @@ format_part_text (const void *ctx, sprinter_t *sp, mime_node_t *node,
 
     if (leaf) {
        if (g_mime_content_type_is_type (content_type, "text", "*") &&
-           !g_mime_content_type_is_type (content_type, "text", "html"))
+           (params->include_html ||
+            ! g_mime_content_type_is_type (content_type, "text", "html")))
        {
            show_text_part_content (node->part, stream, 0);
        } else {
@@ -1218,8 +1219,10 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[])
     }
 
     if (params.include_html &&
-        (format != NOTMUCH_FORMAT_JSON && format != NOTMUCH_FORMAT_SEXP)) {
-       fprintf (stderr, "Warning: --include-html only implemented for format=json and format=sexp\n");
+        (format != NOTMUCH_FORMAT_TEXT &&
+        format != NOTMUCH_FORMAT_JSON &&
+        format != NOTMUCH_FORMAT_SEXP)) {
+       fprintf (stderr, "Warning: --include-html only implemented for format=text, format=json and format=sexp\n");
     }
 
     query_string = query_string_from_args (config, argc-opt_index, argv+opt_index);
index 81c4d772a843771107940a598ab28722a4d6a332..9ad141cb5ace12793a477a152dbf271958d2672d 100755 (executable)
@@ -325,6 +325,15 @@ Non-text part: text/html
 EOF
 test_expect_equal_file EXPECTED OUTPUT
 
+test_begin_subtest "--format=text --include-html --part=5, rfc822's html part"
+notmuch show --format=text --include-html --part=5 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
+cat <<EOF >EXPECTED
+\fpart{ ID: 5, Content-type: text/html
+<p>This is an embedded message, with a multipart/alternative part.</p>
+\fpart}
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
 test_begin_subtest "--format=text --part=6, rfc822's text part"
 notmuch show --format=text --part=6 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
 cat <<EOF >EXPECTED