feat: html rendering
This commit is contained in:
21
src/sh/preview.sh
Normal file
21
src/sh/preview.sh
Normal file
@@ -0,0 +1,21 @@
|
||||
# Preview functions
|
||||
|
||||
# Preview email
|
||||
# If a thread identifier is given, then the last message in the thread is
|
||||
# shown. If the HTML flag is set, then the HTML message is parsed using pandoc.
|
||||
# This functions reverts to the HTML method if no HTML flag is set yet no
|
||||
# text/plain part is found.
|
||||
#
|
||||
# @argument $1: "id" or "thread"
|
||||
# @argument $2: message id or thread id
|
||||
# @argument #3: if set, then the HTML messages will be taken
|
||||
preview_message() {
|
||||
[ "$1" = "id" ] && messageid="$2" || messageid="$(nm_last_message_in_thread "$2")"
|
||||
parts="$(nm_message_parts "$messageid")"
|
||||
html="${3:-}"
|
||||
nr="$(nm_message_part_nr "$messageid" "$html")"
|
||||
[ ! "$nr" ] && [ ! "$html" ] && html="html" && nr="$(nm_message_part_nr "$messageid" "html")"
|
||||
[ "$html" ] && parser="$PANDOC" || parser="cat"
|
||||
nm_message_header "$messageid" | $CATEMAIL
|
||||
nm_message_get_part "$messageid" "$nr" | $parser | $CATMD
|
||||
}
|
||||
Reference in New Issue
Block a user