144 |
"Get value of ATTRIBUTE from LIST." |
"Get value of ATTRIBUTE from LIST." |
145 |
(nth 1 (assoc attribute list))) |
(nth 1 (assoc attribute list))) |
146 |
|
|
147 |
(defun html2text-get-attr (p1 p2 tag) |
(defun html2text-get-attr (p1 p2) |
148 |
(goto-char p1) |
(goto-char p1) |
149 |
(re-search-forward " +[^ ]" p2 t) |
(re-search-forward " +[^ ]" p2 t) |
150 |
(let* ((attr-string (buffer-substring-no-properties (1- (point)) (1- p2))) |
(let* ((attr-string (buffer-substring-no-properties (1- (point)) (1- p2))) |
320 |
;; If someone can explain how to make the URL clickable I will surely |
;; If someone can explain how to make the URL clickable I will surely |
321 |
;; improve upon this. |
;; improve upon this. |
322 |
;; Maybe `goto-addr.el' can be used here. |
;; Maybe `goto-addr.el' can be used here. |
323 |
(let* ((attr-list (html2text-get-attr p1 p2 "a")) |
(let* ((attr-list (html2text-get-attr p1 p2)) |
324 |
(href (html2text-attr-value attr-list "href"))) |
(href (html2text-attr-value attr-list "href"))) |
325 |
(delete-region p1 p4) |
(delete-region p1 p4) |
326 |
(when href |
(when href |
418 |
(point-max) t) |
(point-max) t) |
419 |
(let ((p1) |
(let ((p1) |
420 |
(p2 (point)) |
(p2 (point)) |
421 |
(p3) (p4) |
(p3) (p4)) |
|
(attr (match-string 1))) |
|
422 |
(search-backward "<" (point-min) t) |
(search-backward "<" (point-min) t) |
423 |
(setq p1 (point)) |
(setq p1 (point)) |
424 |
(re-search-forward (format "</%s>" tag) (point-max) t) |
(re-search-forward (format "</%s>" tag) (point-max) t) |