mirror of https://codeberg.org/cage/tinmop/
- fixed 'absolute-url-p'.
This commit is contained in:
parent
93dd9b1c11
commit
e070f89b05
|
@ -405,7 +405,8 @@
|
|||
(null (iri:host iri)))))
|
||||
|
||||
(defun absolute-url-p (url)
|
||||
(not (relative-url-p url)))
|
||||
(and (not (relative-url-p url))
|
||||
(iri:iri-parse url :null-on-error t)))
|
||||
|
||||
(defun absolute-url-scheme-p (url expected-scheme)
|
||||
(when-let ((parsed-iri (iri:iri-parse url :null-on-error t)))
|
||||
|
|
|
@ -749,15 +749,15 @@ printed in the box column by column; in the example above the results are:
|
|||
constants:+internal-scheme-local-posts+)))
|
||||
"Collect all hyperlinks in a text marked from a list of valid `schemes'"
|
||||
(flet ((build-re-scheme ()
|
||||
(let ((res ""))
|
||||
(let ((res "^"))
|
||||
(loop for (scheme . rest) on schemes do
|
||||
(if rest
|
||||
(setf res (strcat res "(" scheme ")|"))
|
||||
(setf res (strcat res "(" scheme ")://"))))
|
||||
(if rest
|
||||
(setf res (strcat res "(" scheme ")|"))
|
||||
(setf res (strcat res "(" scheme ")://"))))
|
||||
(strcat "(" res ")"))))
|
||||
(a:when-let* ((all-uris (lines->uri text))
|
||||
(re (strcat (build-re-scheme) "\\P{White_Space}+"))
|
||||
(scanner (cl-ppcre:create-scanner re)))
|
||||
(scanner (cl-ppcre:create-scanner re)))
|
||||
(let ((results '()))
|
||||
(loop for uri in all-uris when (cl-ppcre:scan scanner uri) do
|
||||
(pushnew uri results :test #'string=))
|
||||
|
|
Loading…
Reference in New Issue