mirror of
https://github.com/rabbibotton/clog.git
synced 2025-12-06 02:30:42 -08:00
added escape-for-html
This commit is contained in:
parent
a34e516325
commit
04031f2520
4 changed files with 74 additions and 73 deletions
|
|
@ -58,6 +58,19 @@ package."
|
|||
;; Implementation - JS Utilities
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;
|
||||
;; escape-for-html ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defun escape-for-html (value)
|
||||
"Returns a string where < and > are replaced with html entities. This is
|
||||
particularly useful as #<> is used for unprintable objects in Lisp. Value is
|
||||
converted with format to a string first."
|
||||
(setf value (format nil "~A" value))
|
||||
(setf value (ppcre:regex-replace-all "<" value "<"))
|
||||
(setf value (ppcre:regex-replace-all ">" value ">"))
|
||||
value)
|
||||
|
||||
;;;;;;;;;;;;;;;
|
||||
;; js-true-p ;;
|
||||
;;;;;;;;;;;;;;;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue