1
0
mirror of https://codeberg.org/cage/tinmop/ synced 2025-01-19 03:00:08 +01:00

- added 'iri:iri=';

- jumping to the corresponding feature when typing in the adderss bar a special iri (e.g. 'about:bookmark').
This commit is contained in:
cage 2023-05-08 20:34:39 +02:00
parent 5629c25ba6
commit 786775f106
3 changed files with 46 additions and 1 deletions

View File

@ -576,7 +576,11 @@
(handler-case (handler-case
(let ((parsed-iri (iri:iri-parse iri))) (let ((parsed-iri (iri:iri-parse iri)))
(cond (cond
((gemini-parser:gemini-iri-p iri) ((iri:iri= iri (internal-iri-bookmark))
(funcall (menu:show-bookmarks-clsr main-window)))
((iri:iri= iri (internal-iri-gemlogs))
(menu:manage-gemlogs))
((gemini-parser:gemini-iri-p iri)
(start-stream-iri iri main-window use-cache status)) (start-stream-iri iri main-window use-cache status))
((or (null (uri:scheme parsed-iri)) ((or (null (uri:scheme parsed-iri))
(string= (uri:scheme parsed-iri) (string= (uri:scheme parsed-iri)

View File

@ -378,3 +378,43 @@
:port (uri:port parsed-iri) :port (uri:port parsed-iri)
:path parent-path)))) :path parent-path))))
new-iri)) new-iri))
(defgeneric iri= (a b))
(defmethod iri= ((a iri) (b iri))
(let ((scheme-a (uri:scheme a))
(user-info-a (uri:user-info a))
(host-a (uri:host a))
(port-a (uri:port a))
(path-a (uri:path a))
(query-a (uri:query a))
(fragment-a (uri:fragment a))
(scheme-b (uri:scheme b))
(user-info-b (uri:user-info b))
(host-b (uri:host b))
(port-b (uri:port b))
(path-b (uri:path b))
(query-b (uri:query b))
(fragment-b (uri:fragment b)))
(and (string= scheme-a scheme-b)
(string= user-info-a user-info-b)
(string= host-a host-b)
(string= port-a port-b)
(string= path-a path-b)
(string= query-a query-b)
(string= fragment-a fragment-b))))
(defmethod iri= ((a iri) (b string))
(when-let ((parsed (iri-parse b :null-on-error t)))
(iri= a parsed)))
(defmethod iri= ((a string) (b iri))
(when-let ((parsed (iri-parse a :null-on-error t)))
(iri= b parsed)))
(defmethod iri= ((a string) (b string))
(let ((parsed-a (iri-parse a :null-on-error t))
(parsed-b (iri-parse b :null-on-error t)))
(and parsed-a
parsed-b
(iri= parsed-a parsed-b))))

View File

@ -756,6 +756,7 @@
:render-iri :render-iri
:make-iri :make-iri
:iri-parse :iri-parse
:iri=
:normalize-path :normalize-path
:absolute-url-p :absolute-url-p
:ipv4-address-p :ipv4-address-p