litorgy-parse-header-arguments can now handle complex arguments

specifically arguments which contain spaces or even " :" substrings
This commit is contained in:
Eric Schulte 2009-05-09 09:11:14 -07:00
parent 8072d2c7d6
commit c85ec77932
1 changed files with 13 additions and 2 deletions

View File

@ -165,9 +165,20 @@ of the following form. (language body header-arguments-alist)"
"Parse a string of header arguments returning an alist."
(delq nil
(mapcar
(lambda (arg) (if (string-match "\\([^ \f\t\n\r\v]+\\)[ \f\t\n\r\v]*\\([^ \f\t\n\r\v]*\\)" arg)
(lambda (arg) (if (string-match "\\([^ \f\t\n\r\v]+\\)[ \f\t\n\r\v]*\\([^ \f\t\n\r\v]+.*\\)" arg)
(cons (intern (concat ":" (match-string 1 arg))) (match-string 2 arg))))
(split-string (concat " " arg-string) "[ \f\t\n\r\v]+:"))))
(let (matches holder)
(mapcar (lambda (part)
(if (string= (substring part -1) "(")
(setq holder part)
(if holder
(progn
(setq matches (cons (concat holder " :" part) matches))
(setq holder nil))
(setq matches (cons part matches)))))
(split-string (concat " " arg-string) "[ \f\t\n\r\v]+:" t))
(message (format "%S" matches))
matches))))
(defun litorgy-insert-result (result &optional insert)
"Insert RESULT into the current buffer after the end of the