mu4e-view: tweak html generation
Use the message plist.
This commit is contained in:
@ -31,6 +31,8 @@
|
|||||||
;;; Code:
|
;;; Code:
|
||||||
(require 'mu4e-vars)
|
(require 'mu4e-vars)
|
||||||
(require 'mu4e-folders)
|
(require 'mu4e-folders)
|
||||||
|
(require 'mu4e-message)
|
||||||
|
(require 'mu4e-contacts)
|
||||||
(require 'gnus-art)
|
(require 'gnus-art)
|
||||||
(require 'crm)
|
(require 'crm)
|
||||||
|
|
||||||
@ -665,18 +667,23 @@ full-stop after the URL is not included.")
|
|||||||
"</div>\n<p style=\"margin:0\"></p>\n"
|
"</div>\n<p style=\"margin:0\"></p>\n"
|
||||||
"HTML fragment that closes the message-headers block.")
|
"HTML fragment that closes the message-headers block.")
|
||||||
|
|
||||||
(defun mu4e--view-html-headers ()
|
(defun mu4e--view-html-headers (msg)
|
||||||
"Create an HTML block for the message headers in the current buffer.
|
"Create an HTML block for the headers of message MSG."
|
||||||
The current buffer is expected to contain the raw message."
|
|
||||||
(concat
|
(concat
|
||||||
mu4e--view-html-headers-html-pre
|
mu4e--view-html-headers-html-pre
|
||||||
(mapconcat
|
(mapconcat
|
||||||
(lambda (field)
|
(lambda (field)
|
||||||
(if-let* ((val (message-field-value field)))
|
(if-let* ((val (mu4e-message-field-raw msg field))
|
||||||
(format "<b>%s:</b> %s<br>\n" (capitalize field)
|
(val (pcase field
|
||||||
|
((or :from :to :cc)
|
||||||
|
(mapconcat #'mu4e-contact-full val ", "))
|
||||||
|
(:date (message-make-date val))
|
||||||
|
(_ val))))
|
||||||
|
(format "<b>%s:</b> %s<br>\n"
|
||||||
|
(capitalize (substring (symbol-name field) 1))
|
||||||
(mu4e--view-html-escape val))
|
(mu4e--view-html-escape val))
|
||||||
""))
|
""))
|
||||||
'("from" "to" "cc" "date" "subject") "")
|
'(:from :to :cc :date :subject) "")
|
||||||
mu4e--view-html-headers-html-post))
|
mu4e--view-html-headers-html-post))
|
||||||
|
|
||||||
(defun mu4e--view-html-prepend-headers (html headers)
|
(defun mu4e--view-html-prepend-headers (html headers)
|
||||||
|
|||||||
@ -441,7 +441,7 @@ Prompting the user with PROMPT for the number."
|
|||||||
Prompting the user with PROMPT for the numbers.
|
Prompting the user with PROMPT for the numbers.
|
||||||
|
|
||||||
Default is to apply it to all URLs, [1..n], where n is the number
|
Default is to apply it to all URLs, [1..n], where n is the number
|
||||||
of urls. You can type multiple values separated by space, e.g. 1
|
of urls. You can type multiple values separated by space, e.g., 1
|
||||||
3-6 8 will visit urls 1,3,4,5,6 and 8.
|
3-6 8 will visit urls 1,3,4,5,6 and 8.
|
||||||
|
|
||||||
Furthermore, there is a shortcut \"a\" which means all urls, but as
|
Furthermore, there is a shortcut \"a\" which means all urls, but as
|
||||||
@ -613,7 +613,7 @@ part."
|
|||||||
;; just continue if some of the decoding fails.
|
;; just continue if some of the decoding fails.
|
||||||
(ignore-errors (run-hooks 'gnus-article-decode-hook))
|
(ignore-errors (run-hooks 'gnus-article-decode-hook))
|
||||||
(let ((handles (mm-dissect-buffer t t))
|
(let ((handles (mm-dissect-buffer t t))
|
||||||
(headers (unless skip-headers (mu4e--view-html-headers))))
|
(headers (unless skip-headers (mu4e--view-html-headers msg))))
|
||||||
(unwind-protect
|
(unwind-protect
|
||||||
(when-let* ((html (mu4e--view-extract-html handles)))
|
(when-let* ((html (mu4e--view-extract-html handles)))
|
||||||
(when-let* ((cid-parts (mu4e--view-cid-parts handles)))
|
(when-let* ((cid-parts (mu4e--view-cid-parts handles)))
|
||||||
@ -1193,8 +1193,13 @@ multipart/alternative part to toggle; toggle again (or use
|
|||||||
"Toggle between the HTML and plain-text alternatives.
|
"Toggle between the HTML and plain-text alternatives.
|
||||||
Works for `multipart/alternative' messages by pressing the
|
Works for `multipart/alternative' messages by pressing the
|
||||||
corresponding Gnus selector button in the buffer. For other
|
corresponding Gnus selector button in the buffer. For other
|
||||||
messages, toggle between the normal rendering and an
|
messages, toggle between the normal rendering and an shr-rendered
|
||||||
shr-rendered html version of the message."
|
html version of the message.
|
||||||
|
|
||||||
|
If the message does not its own HTML version, a version is
|
||||||
|
concocted from the the text-version. This version is similar to
|
||||||
|
the version for external web-browsers, i.e., with a reduced,
|
||||||
|
fixed set of message headers."
|
||||||
(interactive)
|
(interactive)
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(let ((inhibit-read-only t))
|
(let ((inhibit-read-only t))
|
||||||
|
|||||||
Reference in New Issue
Block a user