From: Kevin Rosenberg Date: Sun, 9 Sep 2007 23:55:51 +0000 (-0600) Subject: add support for specifying encoding for std xhtml sites X-Git-Tag: v1.6.4^0 X-Git-Url: http://git.kpe.io/?p=lml2.git;a=commitdiff_plain;h=cfdabc1cd9728054e3a0267e4b59d8b1bfa28a81 add support for specifying encoding for std xhtml sites --- diff --git a/base.lisp b/base.lisp index 208e1a7..407429f 100644 --- a/base.lisp +++ b/base.lisp @@ -49,10 +49,16 @@ "" (format nil " encoding=\"~A\"" encoding)))) -(defun dtd-prologue (&optional (format :xhtml11) &key entities) - (case format +(defun dtd-prologue (&optional (format :xhtml11) (encoding :iso-8859-1) &key entities) + (ecase format ((:xhtml :xhtml11 :xhtml10-strict :xhtml10-transitional :xhtml10-frameset :xml) - (lml-write-string +xml-prologue-string+) + (lml-write-string +xml-prologue-begin+) + (ecase encoding + (:iso-8859-1 + (lml-write-string "iso-8859-1")) + (:utf-8 + (lml-write-string "UTF-8"))) + (lml-write-string +xml-prologue-end+) (lml-write-char #\newline) (case format ((:xhtml11 :xhtml) diff --git a/data.lisp b/data.lisp index 58cd22d..f8ca267 100644 --- a/data.lisp +++ b/data.lisp @@ -24,6 +24,12 @@ (defvar +xml-prologue-string+ "") +(defvar +xml-prologue-begin+ + "") + (defvar +html4-dtd-string+ "") diff --git a/debian/changelog b/debian/changelog index a9267ec..9b5993c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +cl-lml2 (1.6.4-1) unstable; urgency=low + + * Support modifying encoding for std sites + + -- Kevin M. Rosenberg Sun, 9 Sep 2007 17:53:14 -0600 + cl-lml2 (1.6.3-1) unstable; urgency=low * New upstream diff --git a/stdsite.lisp b/stdsite.lisp index ac3ee63..bc8fd1f 100644 --- a/stdsite.lisp +++ b/stdsite.lisp @@ -67,21 +67,21 @@ (lml-load "final.lml_" :optional t)))) -(defmacro print-std-page (file title format &body body) +(defmacro print-std-page (file title format encoding &body body) `(progn - (dtd-prologue ,format) + (dtd-prologue ,format ,encoding) (html ((:html :xmlns "http://www.w3.org/1999/xhtml") (std-head ,title) (std-body ,file ,@body))))) -(defmacro std-page ((out-file title &key (format :xhtml11)) +(defmacro std-page ((out-file title &key (format :xhtml10-strict) (encoding :utf-8)) &body body) `(let ((*indent* 0)) (with-open-file (*html-stream* (lml-file-name ',out-file :output) :direction :output :if-exists :supersede) - (print-std-page (lml-file-name ',out-file :source) ,title ,format ,@body)))) + (print-std-page (lml-file-name ',out-file :source) ,title ,format ,encoding ,@body)))) (defmacro titled-pre-section (title &body body) `(progn @@ -89,6 +89,3 @@ (:h1 ,title) ((:pre "style" "padding-left:30pt;") ,@body)))) - - -