Fix URL-substitions with some tags (<link>)

This commit is contained in:
Jaidyn Ann 2024-05-29 21:55:59 -05:00
parent 93022814fd
commit 43cc123057

View File

@ -64,7 +64,7 @@ For example:
(linked-urls dom :tags tags)))) (linked-urls dom :tags tags))))
;; lquery-dom alist list → nil ;; lquery-dom alist list → nil
(defun substitute-urls (dom substitution-alist &key (tags '("img"))) (defun substitute-urls (dom substitution-alist &key (tags *default-tags*))
"Replace SRC or HREF attributes of certain tags in an LQuery DOM, based on a "Replace SRC or HREF attributes of certain tags in an LQuery DOM, based on a
substitution associative list. The substitution alist is made up of cons-cells substitution associative list. The substitution alist is made up of cons-cells
mapping replacee URLs to substition URLs. mapping replacee URLs to substition URLs.
@ -125,10 +125,11 @@ HREF and SRC attributes."
"Set the SRC or HREF attribute of an LQuery node (based on which attribute is "Set the SRC or HREF attribute of an LQuery node (based on which attribute is
already set)." already set)."
(and node (and node
(if (lquery-funcs:attr node "src") (cond ((lquery-funcs:attr node "src")
(lquery-funcs:attr node "src" url)) (lquery-funcs:attr node "src" url))
(if (lquery-funcs:attr node "href") ((lquery-funcs:attr node "href")
(lquery-funcs:attr node "href" url)))) (lquery-funcs:attr node "href" url))
('T node))))