例如我目前有些feeds里面图片连接是这种写法,导致newsticker渲染不出
<img
src="//cdn.journals.aps.org/journals/PRL/key_images/10.1103/PhysRevLett.133.141801.png" width="200" height=\"100\"><br/>
似乎是缺少了https:
,但是应该修改哪个shr.el里面的函数呢 ?
例如我目前有些feeds里面图片连接是这种写法,导致newsticker渲染不出
<img
src="//cdn.journals.aps.org/journals/PRL/key_images/10.1103/PhysRevLett.133.141801.png" width="200" height=\"100\"><br/>
似乎是缺少了https:
,但是应该修改哪个shr.el里面的函数呢 ?
改 shr-expand-url
,加个 :before
advice 改写 url
参数。
感谢,顺便贴下解决方案:
(defun shr-broken-url (url &optional base)
(let* ((url-data (url-generic-parse-url (car url)))
(url-base (url-filename url-data))
(url-host (url-host url-data))
(url-port (url-portspec url-data))
(url-target (url-target url-data))
(url-header (url-type url-data)))
(unless url-header (setq url-header "https"))
(when url-header (setq url-header (concat url-header "://")))
(when url-port (setq url-port (concat ":" url-port)))
(when url-target (setq url-port (concat "#" url-port)))
(list (concat url-header url-host url-port url-base url-target) base)))
(advice-add 'shr-expand-url :filter-args 'shr-broken-url)