Commit ca1bd56c authored by Katsumi Yamaoka's avatar Katsumi Yamaoka
Browse files

shr.el (shr-encode-url-chars): New function.

parent 71e691a5
2010-10-05 Katsumi Yamaoka <>
* shr.el (shr-encode-url-chars): New function, that's an alias to
browse-url-url-encode-chars or a copy of it.
(shr-tag-img): Use it.
2010-10-04 Lars Magne Ingebrigtsen <>
* shr.el (shr-tag-blockquote): Ensure paragraph after quote, too.
......@@ -191,6 +191,25 @@ redirects somewhere else."
(copy-region-as-kill (point-min) (point-max))
(message "Copied %s" url))))))
(defalias 'shr-encode-url-chars
;; Neither Emacs 22 nor XEmacs provides this function.
(if (fboundp 'browse-url-url-encode-chars)
(lambda (text chars)
"URL-encode the chars in TEXT that match CHARS.
CHARS is a regexp-like character alternative (e.g., \"[)$]\")."
(let ((encoded-text (copy-sequence text))
(s 0))
(while (setq s (string-match chars encoded-text s))
(setq encoded-text
(replace-match (format "%%%x"
(match-string 0 encoded-text)))
t t encoded-text)
s (1+ s)))
(defun shr-tag-img (cont)
(when (and (> (current-column) 0)
(not (eq shr-state 'image)))
......@@ -204,7 +223,7 @@ redirects somewhere else."
((and shr-blocked-images
(string-match shr-blocked-images url))
(insert alt))
((url-is-cached (browse-url-url-encode-chars url "[&)$ ]"))
((url-is-cached (shr-encode-url-chars url "[&)$ ]"))
(shr-put-image (shr-get-image-data url) (point) alt))
(insert alt)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment