From c0abc807d1bd018a66726a187518b3151fd5906a Mon Sep 17 00:00:00 2001 From: cage Date: Sun, 13 Dec 2020 16:27:22 +0100 Subject: [PATCH] - specialize 'normalize-path' on iri; - changed package name: uri-parser -> uri. --- src/iri-parser.lisp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/iri-parser.lisp b/src/iri-parser.lisp index cc81bf7..c5c65ea 100644 --- a/src/iri-parser.lisp +++ b/src/iri-parser.lisp @@ -213,9 +213,9 @@ (defrule iri-reference (or iri irelative-ref)) -(defclass iri (uri-parser:uri) ()) +(defclass iri (uri:uri) ()) -(defmethod uri-parser:host ((object iri)) +(defmethod uri:host ((object iri)) (let ((host (slot-value object 'host))) (if (text-utils:string-starts-with-p "[" host) (subseq host 1 (1- (length host))) @@ -265,6 +265,13 @@ query fragment))) +(defmethod uri:normalize-path ((object iri)) + (let ((clean-path (uri:normalize-path (uri:path object))) + (copy (copy-iri object))) + (when clean-path + (setf (uri:path copy) clean-path)) + copy)) + (defun render-iri (iri &optional (stream *standard-output*)) (flet ((render () (with-output-to-string (string-stream)