Commit 2b5539a9 authored by Michael's avatar Michael

Syncing from Monotone at 20131105230456

parent 03840582
...@@ -150,7 +150,8 @@ indicates an expression.") ...@@ -150,7 +150,8 @@ indicates an expression.")
(defparameter *set-special-list* (defparameter *set-special-list*
'(("escape" . "cl-emb:*escape-type*"))) '(("escape" . "cl-emb:*escape-type*")
("case-sensitivity" . "cl-emb:*case-sensitivity*")))
(defparameter *set-parameter-list* (defparameter *set-parameter-list*
'(("xml" . ":xml") '(("xml" . ":xml")
...@@ -160,7 +161,8 @@ indicates an expression.") ...@@ -160,7 +161,8 @@ indicates an expression.")
("url-encode" . ":url-encode") ("url-encode" . ":url-encode")
("raw" . ":raw") ("raw" . ":raw")
("latex" . ":latex") ("latex" . ":latex")
)) ("t" . "t")
("nil" . "nil")))
;; TODO: Refactor! Looks a bit clumsy. ;; TODO: Refactor! Looks a bit clumsy.
(defun set-specials (match &rest registers) (defun set-specials (match &rest registers)
...@@ -293,9 +295,23 @@ Functions get called with two parameters: match and list of registers.") ...@@ -293,9 +295,23 @@ Functions get called with two parameters: match and list of registers.")
do (format out "%~2,'0x" (char-code char)))))) do (format out "%~2,'0x" (char-code char))))))
(defvar *case-sensitivity* t
"Whether use case-sensitive mode (the default) or case-insensitive mode. If this is set NIL, the case of keys in ENV will be ignored.")
(defun string-to-keyword (string) (defun string-to-keyword (string)
"Interns a given STRING uppercased in the keyword package." "Interns a given STRING uppercased in the keyword package."
(nth-value 0 (intern (string-upcase string) :keyword))) (nth-value 0 (intern
(if *case-sensitivity*
(symbol-name (read-from-string string))
(string-upcase (read-from-string string))) :keyword)))
(defun getf* (plist key &optional default)
(if *case-sensitivity*
(getf plist key default)
(loop for (k v) on plist by #'cddr
when (string-equal k key)
do (return v)
finally (return default))))
(defmacro getf-emb (key) (defmacro getf-emb (key)
"Search either plist TOPENV or ENV according to the search path in KEY. KEY "Search either plist TOPENV or ENV according to the search path in KEY. KEY
...@@ -310,11 +326,10 @@ is a string." ...@@ -310,11 +326,10 @@ is a string."
(dig-plist (dig-plist
(if (zerop (length (first keys))) (if (zerop (length (first keys)))
plist plist
`(getf ,plist ,(string-to-keyword (first keys)))) `(getf* ,plist ,(string-to-keyword (first keys))))
(rest keys))))) (rest keys)))))
(dig-plist plist path-parts)))) (dig-plist plist path-parts))))
(defvar *escape-type* :raw (defvar *escape-type* :raw
"Default value for escaping @var output.") "Default value for escaping @var output.")
......
...@@ -24,5 +24,6 @@ ...@@ -24,5 +24,6 @@
#:*emb-start-marker* #:*emb-start-marker*
#:*emb-end-marker* #:*emb-end-marker*
#:*escape-type* #:*escape-type*
#:*case-sensitivity*
#:*locking-function* #:*locking-function*
#:*function-package*)) #:*function-package*))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment