add support for specifying encoding for std xhtml sites v1.6.4
authorKevin Rosenberg <kevin@rosenberg.net>
Sun, 9 Sep 2007 23:55:51 +0000 (17:55 -0600)
committerKevin Rosenberg <kevin@rosenberg.net>
Sun, 9 Sep 2007 23:55:51 +0000 (17:55 -0600)
base.lisp
data.lisp
debian/changelog
stdsite.lisp

index 208e1a7a9b78655815bed49f7cfd6ac03d2e4af1..407429f6a244ef863f8defc5f7f1ed0067874f99 100644 (file)
--- a/base.lisp
+++ b/base.lisp
               ""
               (format nil " encoding=\"~A\"" encoding))))
 
               ""
               (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)
     ((: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)
      (lml-write-char #\newline)
      (case format
        ((:xhtml11 :xhtml)
index 58cd22d5b8e2eba20bc4cb62576b05ec95b39a81..f8ca267d5665c0310cdc3fbc148e8caa41c23f10 100644 (file)
--- a/data.lisp
+++ b/data.lisp
 (defvar +xml-prologue-string+
   "<?xml version=\"1.0\" encoding=\"iso-8859-1\" standalone=\"yes\"?>")
 
 (defvar +xml-prologue-string+
   "<?xml version=\"1.0\" encoding=\"iso-8859-1\" standalone=\"yes\"?>")
 
+(defvar +xml-prologue-begin+
+  "<?xml version=\"1.0\" encoding=\"")
+
+(defvar +xml-prologue-end+
+  "\" standalone=\"yes\"?>")
+
 (defvar +html4-dtd-string+
   "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">")
 
 (defvar +html4-dtd-string+
   "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">")
 
index a9267ec62071e8f5be4742cca86c208e7068eba3..9b5993c004600b6a2bb2965d2702a705ba4569a5 100644 (file)
@@ -1,3 +1,9 @@
+cl-lml2 (1.6.4-1) unstable; urgency=low
+
+  * Support modifying encoding for std sites
+
+ -- Kevin M. Rosenberg <kmr@debian.org>  Sun,  9 Sep 2007 17:53:14 -0600
+
 cl-lml2 (1.6.3-1) unstable; urgency=low
 
   * New upstream
 cl-lml2 (1.6.3-1) unstable; urgency=low
 
   * New upstream
index ac3ee634cf005741b2384785877b53f7855cc18d..bc8fd1f86c017e8774803ee48b6e64b70b71db30 100644 (file)
      (lml-load "final.lml_" :optional t))))
 
 
      (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
   `(progn
-     (dtd-prologue ,format)
+     (dtd-prologue ,format ,encoding)
      (html
       ((:html :xmlns "http://www.w3.org/1999/xhtml")
        (std-head ,title)
        (std-body ,file ,@body)))))
 
      (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)
                     &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
 
 (defmacro titled-pre-section (title &body body)
   `(progn
@@ -89,6 +89,3 @@
      (:h1 ,title)
      ((:pre "style" "padding-left:30pt;")
       ,@body))))
      (:h1 ,title)
      ((:pre "style" "padding-left:30pt;")
       ,@body))))
-
-
-