bin/mutt-md2multipart

Mon, 06 Jan 2020 15:34:34 -0600

author
Meredith Howard <mhoward@roomag.org>
date
Mon, 06 Jan 2020 15:34:34 -0600
changeset 846
2786ee9990c6
permissions
-rwxr-xr-x

proper multipart!

846
2786ee9990c6 proper multipart!
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
1 #!/bin/sh
2786ee9990c6 proper multipart!
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
2 set -eu
2786ee9990c6 proper multipart!
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
3
2786ee9990c6 proper multipart!
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
4 output=$1
2786ee9990c6 proper multipart!
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
5
2786ee9990c6 proper multipart!
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
6 # Output directory is going to be one-per-process. I'd like to have a fully
2786ee9990c6 proper multipart!
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
7 # random tmpdir but doing that and having it mutt clean up is "hard". Note
2786ee9990c6 proper multipart!
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
8 # that when these two parts get attached, we can't just clean files inside the
2786ee9990c6 proper multipart!
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
9 # macro, because they aren't read into memory until send/save.
2786ee9990c6 proper multipart!
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
10
2786ee9990c6 proper multipart!
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
11 mkdir -p $output
2786ee9990c6 proper multipart!
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
12
2786ee9990c6 proper multipart!
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
13 # Store stdin because we're using it twice.
2786ee9990c6 proper multipart!
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
14 cat - > $output/msg.orig
2786ee9990c6 proper multipart!
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
15
2786ee9990c6 proper multipart!
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
16 # Noting the above, there may be old output here. pandoc likes to confirm
2786ee9990c6 proper multipart!
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
17 # overwrites so we handle it.
2786ee9990c6 proper multipart!
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
18 rm -f $output/msg.{txt,html}
2786ee9990c6 proper multipart!
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
19
2786ee9990c6 proper multipart!
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
20 pandoc \
2786ee9990c6 proper multipart!
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
21 --quiet \
2786ee9990c6 proper multipart!
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
22 -f markdown-blank_before_blockquote+smart \
2786ee9990c6 proper multipart!
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
23 -t plain \
2786ee9990c6 proper multipart!
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
24 -o $output/msg.txt \
2786ee9990c6 proper multipart!
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
25 $output/msg.orig
2786ee9990c6 proper multipart!
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
26
2786ee9990c6 proper multipart!
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
27 pandoc \
2786ee9990c6 proper multipart!
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
28 --quiet \
2786ee9990c6 proper multipart!
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
29 --standalone \
2786ee9990c6 proper multipart!
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
30 -f markdown-blank_before_blockquote+smart \
2786ee9990c6 proper multipart!
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
31 -t html5 \
2786ee9990c6 proper multipart!
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
32 --self-contained \
2786ee9990c6 proper multipart!
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
33 --template=mail \
2786ee9990c6 proper multipart!
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
34 --highlight-style=monochrome \
2786ee9990c6 proper multipart!
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
35 --email-obfuscation=none \
2786ee9990c6 proper multipart!
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
36 -o $output/msg.html \
2786ee9990c6 proper multipart!
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
37 $output/msg.orig

mercurial