No need to escape strings
This commit is contained in:
parent
99b20eda7f
commit
3bcf2047c7
1 changed files with 6 additions and 6 deletions
|
@ -4,17 +4,17 @@
|
|||
|
||||
(in-package :ml-sbt/tbl)
|
||||
|
||||
(defun escape-cell-content (content)
|
||||
(cond ((numberp content) (format nil "~,9f" content))
|
||||
((stringp content) (spinneret:escape-string content))
|
||||
(t (spinneret:escape-string (princ-to-string content)))))
|
||||
(defun format-cell-content (content)
|
||||
(if (numberp content)
|
||||
(format nil "~,9f" content)
|
||||
content))
|
||||
|
||||
(defun render-table-header (headers)
|
||||
(spinneret:with-html
|
||||
(:thead
|
||||
(:tr
|
||||
(loop for header in headers
|
||||
do (:th :scope "col" (:raw (escape-cell-content header))))))))
|
||||
do (:th :scope "col" (format-cell-content header)))))))
|
||||
|
||||
(defun render-table-body (rows)
|
||||
(spinneret:with-html
|
||||
|
@ -22,7 +22,7 @@
|
|||
(loop for row in rows
|
||||
do (:tr
|
||||
(loop for cell in row
|
||||
do (:td (:raw (escape-cell-content cell)))))))))
|
||||
do (:td (escape-cell-content cell))))))))
|
||||
|
||||
(defun render-table (headers rows &key (class "table"))
|
||||
(spinneret:with-html
|
||||
|
|
Loading…
Add table
Reference in a new issue