1
0
Fork 0

- specialize 'normalize-path' on iri;

- changed package name: uri-parser -> uri.
This commit is contained in:
cage 2020-12-13 16:27:22 +01:00
parent 62394d319a
commit c0abc807d1
1 changed files with 9 additions and 2 deletions

View File

@ -213,9 +213,9 @@
(defrule iri-reference (or iri irelative-ref)) (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))) (let ((host (slot-value object 'host)))
(if (text-utils:string-starts-with-p "[" host) (if (text-utils:string-starts-with-p "[" host)
(subseq host 1 (1- (length host))) (subseq host 1 (1- (length host)))
@ -265,6 +265,13 @@
query query
fragment))) 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*)) (defun render-iri (iri &optional (stream *standard-output*))
(flet ((render () (flet ((render ()
(with-output-to-string (string-stream) (with-output-to-string (string-stream)