X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=lisp%2Fhtml2text.el;h=79c10085eb744351b9cda8bb454d541dff8e22f3;hb=26c1b062894eb187922a9cd6890a7cc5c2927c01;hp=8822ea901d73691855e617a0dce6dd995c136edc;hpb=a28946c5feb1330711b4916b8d1b943c627dce9f;p=elisp%2Fgnus.git- diff --git a/lisp/html2text.el b/lisp/html2text.el index 8822ea9..79c1008 100644 --- a/lisp/html2text.el +++ b/lisp/html2text.el @@ -212,41 +212,26 @@ formatting, and then moved afterward.") (setq next (nth 2 tmp-list)) (setq index 1) - (if (not (string-match "=" prev)) - (progn - (if (not (string= (substring this 0 1) "=")) - (setq attr-list (cons (list prev nil) attr-list)) - ) - ) - ) + (unless (string-match "=" prev) + (unless (string= (substring this 0 1) "=") + (setq attr-list (cons (list prev nil) attr-list)))) (while (< index (1- (length tmp-list))) (if (not (string-match "=" this)) (if (not (or (string= (substring next 0 1) "=") (string= (substring prev -1) "="))) - (setq attr-list (cons (list this nil) attr-list)) - ) - ) + (setq attr-list (cons (list this nil) attr-list)))) (setq index (1+ index)) (setq prev this) (setq this next) - (setq next (nth (1+ index) tmp-list)) - ) + (setq next (nth (1+ index) tmp-list))) - (if this - (progn - (if (not (string-match "=" this)) - (progn - (if (not (string= (substring prev -1) "=")) - (setq attr-list (cons (list this nil) attr-list)) - ) - ) - ) - ) - ) - attr-list ;; return - value - ) - ) + (when this + (unless (string-match "=" this) + (unless (string= (substring prev -1) "=") + (setq attr-list (cons (list this nil) attr-list))))) + attr-list)) ;; return - value + ;; ;; @@ -391,38 +376,29 @@ formatting, and then moved afterward.") (let ((has-br-line) (refill-start) (refill-stop)) - (if (re-search-forward "
$" p2 t) - (setq has-br-line t) - ) - (if has-br-line - (progn - (goto-char p1) - (if (re-search-forward ".+[^<][^b][^r][^>]$" p2 t) - (progn - (beginning-of-line) - (setq refill-start (point)) - (goto-char p2) - (re-search-backward ".+[^<][^b][^r][^>]$" refill-start t) - (next-line 1) - (end-of-line) - ;; refill-stop should ideally be adjusted to - ;; accomodate the "
" strings which are removed - ;; between refill-start and refill-stop. Can simply - ;; be returned from my-replace-string - (setq refill-stop (+ (point) - (html2text-replace-string - "
" "" - refill-start (point)))) - ;; (message "Point = %s refill-stop = %s" (point) refill-stop) - ;; (sleep-for 4) - (fill-region refill-start refill-stop) - ) - ) - ) - ) - ) - (html2text-replace-string "
" "" p1 p2) - ) + (when (re-search-forward "
$" p2 t) + (setq has-br-line t)) + (when has-br-line + (goto-char p1) + (when (re-search-forward ".+[^<][^b][^r][^>]$" p2 t) + (beginning-of-line) + (setq refill-start (point)) + (goto-char p2) + (re-search-backward ".+[^<][^b][^r][^>]$" refill-start t) + (next-line 1) + (end-of-line) + ;; refill-stop should ideally be adjusted to + ;; accomodate the "
" strings which are removed + ;; between refill-start and refill-stop. Can simply + ;; be returned from my-replace-string + (setq refill-stop (+ (point) + (html2text-replace-string + "
" "" + refill-start (point)))) + ;; (message "Point = %s refill-stop = %s" (point) refill-stop) + ;; (sleep-for 4) + (fill-region refill-start refill-stop)))) + (html2text-replace-string "
" "" p1 p2)) ;; ;; This one is interactive ...