X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/e983096bb6a50fdae6625cb363642bcd74ec39c5..95a2cb24b0697558e6629460d8bc693b394f0138:/lisp/nxml/rng-uri.el diff --git a/lisp/nxml/rng-uri.el b/lisp/nxml/rng-uri.el index 8f454213c1..e95ad08d1b 100644 --- a/lisp/nxml/rng-uri.el +++ b/lisp/nxml/rng-uri.el @@ -1,16 +1,16 @@ ;;; rng-uri.el --- URI parsing and manipulation -;; Copyright (C) 2003, 2007, 2008 Free Software Foundation, Inc. +;; Copyright (C) 2003, 2007-2015 Free Software Foundation, Inc. ;; Author: James Clark -;; Keywords: XML +;; Keywords: wp, hypermedia, languages, XML ;; This file is part of GNU Emacs. -;; GNU Emacs is free software; you can redistribute it and/or modify +;; GNU Emacs is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. ;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -18,9 +18,7 @@ ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -;; Boston, MA 02110-1301, USA. +;; along with GNU Emacs. If not, see . ;;; Commentary: @@ -28,7 +26,7 @@ (defun rng-file-name-uri (f) "Return a URI for the filename F. -Multibyte characters are left as is. Use `rng-uri-escape-multibyte' to +Multibyte characters are left as is. Use `rng-uri-escape-multibyte' to escape them using %HH." (setq f (expand-file-name f)) (let ((url @@ -87,7 +85,7 @@ Signal an error if URI is not a valid file URL." ((not (string= (downcase scheme) "file")) (rng-uri-error "URI `%s' does not use the `file:' scheme" uri))) (when (not (member authority - (cons system-name '(nil "" "localhost")))) + (cons (system-name) '(nil "" "localhost")))) (rng-uri-error "URI `%s' does not start with `file:///' or `file://localhost/'" uri)) (when query @@ -104,7 +102,7 @@ Signal an error if URI is not a valid file URL." (setq path (substring path 1))) (when (and pattern (string-match "\\`\\./" path)) (setq path (substring path 2))) - (setq path + (setq path (cond ((eq pattern 'match) (rng-uri-unescape-unibyte-match path)) ((eq pattern 'replace) @@ -129,8 +127,7 @@ Signal an error if URI is not a valid file URL." (defun rng-uri-error (&rest args) (signal 'rng-uri-error (list (apply 'format args)))) -(put 'rng-uri-error 'error-conditions '(error rng-uri-error)) -(put 'rng-uri-error 'error-message "Invalid URI") +(define-error 'rng-uri-error "Invalid URI") (defun rng-uri-split (str) (and (string-match "\\`\\(?:\\([^:/?#]+\\):\\)?\ @@ -164,7 +161,7 @@ Signal an error if URI is not a valid file URL." (cons scheme (cons ":" parts)))) (apply 'concat parts)))) - + (defun rng-uri-resolve (uri-ref base-uri) "Resolve a possibly relative URI reference into absolute form. URI-REF is the URI reference to be resolved. @@ -310,7 +307,7 @@ Both FULL and BASE must be absolute URIs." (mapcar (lambda (h) (string-to-number h 16)) (split-string str "%"))) 'utf-8)) - + (defun rng-uri-unescape-unibyte (str) (replace-regexp-in-string "%[0-7][0-9a-fA-F]" (lambda (h) @@ -354,5 +351,4 @@ Both FULL and BASE must be absolute URIs." (provide 'rng-uri) -;; arch-tag: c7b7b8b8-61d1-48ec-82bc-7001c70b2e9d ;;; rng-uri.el ends here