Formatting tweaks (no functional changes)

This commit is contained in:
Jaidyn Ann 2024-05-27 23:14:33 -05:00
parent aa9261ce63
commit b53376d1d2

View File

@ -1,3 +1,5 @@
;;;; mirror-img: Mirror an HTML pages remote images, CSS, etc.
;; Copyright © 2024 Jaidyn Ann <jadedctrl@posteo.at> ;; Copyright © 2024 Jaidyn Ann <jadedctrl@posteo.at>
;; ;;
;; This program is free software: you can redistribute it and/or ;; This program is free software: you can redistribute it and/or
@ -42,7 +44,6 @@ Returns a string of the modified pages HTML."
(append *src-tags* *href-tags*)) (append *src-tags* *href-tags*))
(aref (lquery:$ dom (serialize)) 0))) (aref (lquery:$ dom (serialize)) 0)))
;; lquery-dom list pathname → alist ;; lquery-dom list pathname → alist
(defun mirror-linked-urls (dom &optional (tags '("link" "img" "script")) base-dir) (defun mirror-linked-urls (dom &optional (tags '("link" "img" "script")) base-dir)
"Mirror all URLs in the HREF/SRC attributes of the given tags in an LQuery "Mirror all URLs in the HREF/SRC attributes of the given tags in an LQuery
@ -61,7 +62,6 @@ For example:
(cons url download-path)))) (cons url download-path))))
(linked-urls dom tags)))) (linked-urls dom tags))))
;; lquery-dom alist list → nil ;; lquery-dom alist list → nil
(defun substitute-urls (dom substitution-alist &optional (tags '("img"))) (defun substitute-urls (dom substitution-alist &optional (tags '("img")))
"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
@ -83,7 +83,6 @@ among the given tags."
tags) tags)
dom) dom)
;; string pathname → pathname ;; string pathname → pathname
(defun mirrored-pathname (url &optional base-dir) (defun mirrored-pathname (url &optional base-dir)
"Given a URL, return the corresponding path we would download it to, were we "Given a URL, return the corresponding path we would download it to, were we
@ -114,7 +113,6 @@ HREF and SRC attributes."
(loop for tag in tags (loop for tag in tags
append (url-list-of-tag tag)))) append (url-list-of-tag tag))))
;; lquery-node → string ;; lquery-node → string
(defun node-url (node) (defun node-url (node)
"Return the SRC or HREF attribute of an LQuery node, if such a thing exists." "Return the SRC or HREF attribute of an LQuery node, if such a thing exists."
@ -122,7 +120,6 @@ HREF and SRC attributes."
(or (lquery-funcs:attr node "src") (or (lquery-funcs:attr node "src")
(lquery-funcs:attr node "href")))) (lquery-funcs:attr node "href"))))
;; lquery-node → nil ;; lquery-node → nil
(defun set-node-url (node url) (defun set-node-url (node url)
"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
@ -147,7 +144,6 @@ already set)."
path) path)
(error nil))) (error nil)))
;; string → string ;; string → string
(defun url-encode-uri (uri) (defun url-encode-uri (uri)
"URL-encode the path component of a URI. For example, "URL-encode the path component of a URI. For example,
@ -159,7 +155,6 @@ already set)."
(quri:uri-port uri) (quri:uri-port uri)
(url-encode-path (quri:uri-path uri))))) (url-encode-path (quri:uri-path uri)))))
;; string → string ;; string → string
(defun url-encode-path (path) (defun url-encode-path (path)
"URL-encode a pathnames components (directory and filenames). For example, "URL-encode a pathnames components (directory and filenames). For example,