Function: Info-split-parameter-string

Info-split-parameter-string is a byte-compiled function defined in info.el.gz.

Signature

(Info-split-parameter-string PARAMETER-STRING)

Documentation

Return alist of ("KEY" . "VALUE") from PARAMETER-STRING.

PARAMETER-STRING is a whitespace separated list of KEY=VALUE pairs. If VALUE contains whitespace or double quotes, it must be quoted in double quotes and any double quotes or backslashes must be escaped (\",\\).

Source Code

;; Defined in /usr/src/emacs/lisp/info.el.gz
;; As of Texinfo 4.6, makeinfo writes constructs like
;;   \0\h[image param=value ...\h\0]
;; into the Info file for handling images.
(defun Info-split-parameter-string (parameter-string)
  "Return alist of (\"KEY\" . \"VALUE\") from PARAMETER-STRING.
PARAMETER-STRING is a whitespace separated list of KEY=VALUE pairs.
If VALUE contains whitespace or double quotes, it must be quoted
in double quotes and any double quotes or backslashes must be
escaped (\\\",\\\\)."
  (let ((start 0)
	(parameter-alist))
    (while (string-match
	    "\\s *\\([^=]+\\)=\\(?:\\([^\\s \"]+\\)\\|\\(?:\"\\(\\(?:[^\\\"]\\|\\\\[\\\"]\\)*\\)\"\\)\\)"
	    parameter-string start)
      (setq start (match-end 0))
      (push (cons (match-string 1 parameter-string)
		  (or (match-string 2 parameter-string)
		      (Info-unescape-quotes
		       (match-string 3 parameter-string))))
	    parameter-alist))
    parameter-alist))