From 3cf315cb790655d8f79582f6ad643425d43faa46 Mon Sep 17 00:00:00 2001 From: Edi Weitz Date: Tue, 12 Oct 2010 21:43:51 +0000 Subject: HTML5 support git-svn-id: svn://bknr.net/svn/trunk/thirdparty/cl-who@4618 4281704c-cde7-0310-8518-8e2dc76b1ff0 --- CHANGELOG | 5 +++-- doc/index.html | 15 +++++++++------ specials.lisp | 8 ++++++-- who.lisp | 12 ++++++++---- 4 files changed, 26 insertions(+), 14 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 12c368a..9783498 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,11 +1,12 @@ Version 1.0.0 -2009-0x-xx +2010-0x-xx Refactored internals and made STR etc. local macros Added test suite todo: repla s-h-texp with walk in docs Removed deprecated ESCAPE-STRING-ISO-8859 function Removed SHOW-HTML-EXPANSION -Bugfixes (thanks to Slawek Zak) +Bugfixes (thanks to Slawek Zak) +Added support for HTML5 (Chaitanya Gupta) Version 0.11.1 2008-03-28 diff --git a/doc/index.html b/doc/index.html index eebf123..4b94c8e 100644 --- a/doc/index.html +++ b/doc/index.html @@ -61,7 +61,7 @@ forms for constant parts of the output interspersed with arbitrary code inserted by the user of the macro. CL-WHO will make sure that there aren't two adjacent WRITE-STRING forms with constant strings. CL-WHO's output is -either XHTML (default) or 'plain' (SGML) HTML — depending on +either XHTML (default), 'plain' (SGML) HTML or HTML5 (using HTML syntax) — depending on what you've set HTML-MODE to.

CL-WHO is intended to be portable and should work with all @@ -541,7 +541,7 @@ This is the prologue string which will be printed if the prologue
Set this to NIL to if you want to use CL-WHO as a strict XML generator. Otherwise, CL-WHO will only write empty tags listed in -*HTML-EMPTY-TAGS* as <tag/> (XHTML mode) or <tag> (SGML mode). For +*HTML-EMPTY-TAGS* as <tag/> (XHTML mode) or <tag> (SGML mode or HTML mode). For all other tags, it will always generate <tag></tag>. The initial value of this variable is T. @@ -553,9 +553,9 @@ The list of HTML tags that should be output as empty tags. See *HTML-EMPTY-TAG-AWARE-P*. The initial value is the list

-(:area :atop :audioscope :base :basefont :br :choose :col :frame
- :hr :img :input :isindex :keygen :left :limittext :link :meta
- :nextid :of :over :param :range :right :spacer :spot :tab :wbr)
+(:area :atop :audioscope :base :basefont :br :choose :col :command :embed
+ :frame :hr :img :input :isindex :keygen :left :limittext :link :meta :nextid
+ :of :over :param :range :right :source :spacer :spot :tab :track :wbr)
 
@@ -585,11 +585,14 @@ These are just symbols with no bindings associated with them. The only reason th
html-mode => mode
(setf (html-mode) mode)

-The function HTML-MODE returns the current mode for generating HTML. The default is :XML for XHTML. You can change this by setting it with (SETF (HTML-MODE) :SGML) to pre-XML HTML mode. +The function HTML-MODE returns the current mode for generating HTML. The default is :XML for XHTML. You can change this by setting it with (SETF (HTML-MODE) :SGML) to pre-XML HTML mode or (SETF (HTML-MODE) :HTML5) to HTML5 mode (using HTML syntax).

Setting it to SGML HTML sets the *prologue* to the doctype string for HTML 4.01 transitional:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
Code generation in SGML HTML is slightly different from XHTML - there's no need to end empty elements with /> and empty attributes are allowed. +

+Setting it to HTML5 sets the *prologue* to the following doctype string: +

<!DOCTYPE html>


[Function] diff --git a/specials.lisp b/specials.lisp index 71aad3c..8808f2f 100755 --- a/specials.lisp +++ b/specials.lisp @@ -51,7 +51,7 @@ argument is T") indentation dynamically.") (defvar *html-mode* :xml - ":SGML for \(SGML-)HTML, :XML \(default) for XHTML.") + ":SGML for \(SGML-)HTML, :XML \(default) for XHTML, :HTML5 for HTML5.") (defvar *downcase-tokens-p* t "If NIL, a keyword symbol representing a tag or attribute name will @@ -73,6 +73,8 @@ needs to output case sensitive XML.") :br :choose :col + :command + :embed :frame :hr :img @@ -89,9 +91,11 @@ needs to output case sensitive XML.") :param :range :right + :source :spacer :spot :tab + :track :wbr) "The list of HTML tags that should be output as empty tags. See *HTML-EMPTY-TAG-AWARE-P*.") @@ -100,7 +104,7 @@ See *HTML-EMPTY-TAG-AWARE-P*.") "Set this to NIL to if you want to use CL-WHO as a strict XML generator. Otherwise, CL-WHO will only write empty tags listed in *HTML-EMPTY-TAGS* as \(XHTML mode) or \(SGML -mode). For all other tags, it will always generate +mode and HTML5 mode). For all other tags, it will always generate .") (defconstant +newline+ (make-string 1 :initial-element #\Newline) diff --git a/who.lisp b/who.lisp index 42579b4..823ea46 100644 --- a/who.lisp +++ b/who.lisp @@ -30,13 +30,13 @@ (in-package :cl-who) (defun html-mode () - "Returns the current HTML mode. :SGML for \(SGML-)HTML and -:XML for XHTML." + "Returns the current HTML mode. :SGML for \(SGML-)HTML, :XML for +XHTML and :HTML5 for HTML5 (HTML syntax)." *html-mode*) (defun (setf html-mode) (mode) "Sets the output mode to XHTML or \(SGML-)HTML. MODE can be -:SGML for HTML or :XML for XHTML." +:SGML for HTML, :XML for XHTML or :HTML5 for HTML5 (HTML syntax)." (ecase mode ((:sgml) (setf *html-mode* :sgml @@ -45,7 +45,11 @@ ((:xml) (setf *html-mode* :xml *empty-tag-end* " />" - *prologue* "")))) + *prologue* "")) + ((:html5) + (setf *html-mode* :html5 + *empty-tag-end* ">" + *prologue* "")))) (defun process-tag (sexp body-fn) (declare (optimize speed space)) -- cgit v1.2.3