Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
60 lines (54 sloc) 2.43 KB
#| HTML Generation takes place ... |#
(in-package :common-lisp-user)
(defpackage :easyweb.html
(:use #:cl #:dsgner))
(in-package :easyweb.html)
(defmacro :doctype ((&key (type :xhtml1.0\:strict)) &body body)
`(format nil "~A~A"
,(case type
`"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"\">")
`"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"\">")
`"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\" \"\">")
`"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"\">")
`"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\" \"\">")
`"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"\">")
`"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"\">"))
(defmacro :<!-- ((&key (type :regular)) &body body)
(let ((opentag "")
(closetag "")
(stream (gensym))
(output (gensym)))
(case type
(setf opentag "<![CDATA[")
(setf closetag "]]>"))
(setf opentag "<!-- ")
(setf closetag " -->")))
`(let ((,output (dsgner::empty-string)))
(with-output-to-string (,stream ,output)
(format ,stream "~A" ,opentag)
,@(mapcar #'(lambda(e)
`(format ,stream "~A" ,e))
(format ,stream "~A" ,closetag))
;;define tags of HTML 4.01 / XHTML 1.0
(deftags :a :abbr :acronym :address :applet :b :base :basefont
:bdo :big :blockquote :body :br :button :caption :center :cite
:code :col :colgroup :dd :del :dfn :dir :div :dl :dt :em :fieldset
:font :form :frame :frameset :h1 :h2 :h3 :h4 :h5 :h6 :head :hr
:html :i :iframe :img :input :ins :isindex :kbd :label :legend :li
:link :map :menu :meta :noframes :noscript :object :ol :optgroup
:option :p :param :pre :q :s :samp :script :select :small :span
:strike :strong :style :sub :sup :table :tbody :td :textarea :tfoot
:th :thead :title :tr :tt :u :ul :var :xmp)
Jump to Line
Something went wrong with that request. Please try again.