[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/org-mime b47811562b 099/118: Merge pull request #52 from t
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/org-mime b47811562b 099/118: Merge pull request #52 from tomheon/fix-gmail-quoting |
Date: |
Wed, 5 Jan 2022 07:58:50 -0500 (EST) |
branch: elpa/org-mime
commit b47811562ba5c0882e9bacf9124b18fb5d0f4a61
Merge: 73fdd3f40d d71f57dc0d
Author: Chen Bin <chenbin.sh@gmail.com>
Commit: GitHub <noreply@github.com>
Merge pull request #52 from tomheon/fix-gmail-quoting
Show individual paragraphs in gmail reply quotes
---
org-mime.el | 14 +++++++++++---
test/org-mime-tests.el | 31 +++++++++++++++++++++++++++++++
2 files changed, 42 insertions(+), 3 deletions(-)
diff --git a/org-mime.el b/org-mime.el
index 45c3404a02..02273877b7 100644
--- a/org-mime.el
+++ b/org-mime.el
@@ -294,8 +294,9 @@ OPTS is export options."
HTML is the body of the message."
(let ((quote-depth 0)
(line-depth 0)
- (quote-opening "<blockquote class=\"gmail_quote\" style=\"margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex\">\n<p>\n")
- (quote-closing "</p>\n</blockquote>\n"))
+ (in-quote-p nil)
+ (quote-opening "<blockquote class=\"gmail_quote\" style=\"margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex\">\n\n<div>")
+ (quote-closing "\n</div></blockquote>\n"))
(with-temp-buffer
;; clean title of quoted
(insert (replace-regexp-in-string
@@ -305,7 +306,9 @@ HTML is the body of the message."
(goto-char (point-min))
(while (not (eobp))
(setq line-depth 0)
+ (setq in-quote-p nil)
(while (looking-at ">[ \t]*")
+ (setq in-quote-p t)
(replace-match "")
(cl-incf line-depth))
(cond
@@ -317,7 +320,12 @@ HTML is the body of the message."
(while (> quote-depth line-depth)
(insert quote-closing)
(cl-decf quote-depth))))
- (forward-line))
+ (if (and in-quote-p (looking-at "^[ \t]*$"))
+ (progn
+ (insert "</div>\n<div>")
+ (forward-line)
+ (insert "<br /></div>\n<div>"))
+ (forward-line)))
(buffer-substring (point-min) (point-max)))))
(defun org-mime-multipart (plain html &optional images)
diff --git a/test/org-mime-tests.el b/test/org-mime-tests.el
index f4e19c0c8f..25f366267a 100644
--- a/test/org-mime-tests.el
+++ b/test/org-mime-tests.el
@@ -245,4 +245,35 @@
(should-not (string-match "SECTION_ONE" str)))
(kill-buffer orgBuf)))
+(ert-deftest test-org-mime-beautify-quoted-para-breaks ()
+ (setq html (concat "<p>\n"
+ "Hello there\n"
+ "</p>\n"
+ "\n"
+ "<p>\n"
+ "> this is a long-ish para that is broken\n"
+ "> on two lines\n"
+ ">\n"
+ "> followed by a single-line para\n"
+ "</p>\n"))
+ (setq expected (concat "<p>\n"
+ "Hello there\n"
+ "</p>\n"
+ "\n"
+ "<p>\n"
+ "<blockquote class=\"gmail_quote\" style=\"margin:0
0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex\">\n"
+ "\n"
+ "<div>this is a long-ish para that is broken\n"
+ "on two lines\n"
+ "</div>\n"
+ "<div>\n"
+ "<br /></div>\n"
+ "<div>followed by a single-line para\n"
+ "\n"
+ "</div></blockquote>\n"
+ "</p>\n"))
+ (setq beautified (org-mime-beautify-quoted html))
+ (should (equal beautified expected))
+)
+
(ert-run-tests-batch-and-exit)
- [nongnu] elpa/org-mime cf7dbea171 054/118: rename cleanup function to match beautify user option, (continued)
- [nongnu] elpa/org-mime cf7dbea171 054/118: rename cleanup function to match beautify user option, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime 53e0c8141b 058/118: one-line fix for klipse errors in org-mime, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime baa6cde22f 057/118: Merge pull request #25 from tmurph/blockquote-parser, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime 1b516d604a 056/118: remove unnecessary dependency, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime 817744f3b1 062/118: remove plain text body, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime 4bd5d55ba9 071/118: fixed logic, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime dd9dac74cc 073/118: doc on html export, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime d827dbfb97 077/118: Add option to export ASCII for text/plain section, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime 3596bbfe10 079/118: Fix: #36 Add ASCII export for org-mime-htmlize, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime 3974bd4190 093/118: make checkdoc happy, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime b47811562b 099/118: Merge pull request #52 from tomheon/fix-gmail-quoting,
ELPA Syncer <=
- [nongnu] elpa/org-mime 4580e345cb 102/118: add emacs 27 ci, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime 0caaf273e7 011/118: Use a plain ASCII export for the text part, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime 62791db188 033/118: beautify quoted mail properly, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime 7a6dae2494 039/118: Lisp error: (error "Too many arguments") – should be defcustom, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime b9def25bf4 043/118: Edit docstrings for checkdoc compatibility., ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime 6593522166 051/118: Fix: #22, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime ea7a470872 061/118: add badge, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime 8de4bb693d 064/118: image could be nil, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime f8eac8ccde 066/118: restore plain text mail, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime 95c33ec353 067/118: add screenshot, ELPA Syncer, 2022/01/05