[version 0.8.0 ediware**20070427170009] { hunk ./CHANGELOG 1 +Version 0.8.0 +2007-04-27 +Added *HTML-EMPTY-TAG-AWARE-P* (patch by Mac Chan) +A bit of refactoring + hunk ./cl-who.asd 1 - hunk ./cl-who.asd 2 -;;; $Header: /usr/local/cvsrep/cl-who/cl-who.asd,v 1.12 2007/04/05 06:58:20 edi Exp $ +;;; $Header: /usr/local/cvsrep/cl-who/cl-who.asd,v 1.13 2007/04/27 09:33:42 edi Exp $ hunk ./cl-who.asd 31 - :version "0.7.1" + :version "0.8.0" hunk ./cl-who.asd 34 + (:file "specials") hunk ./doc/index.html 96 +
  • *html-empty-tag-aware-p* +
  • *html-empty-tags* hunk ./doc/index.html 254 -current version is 0.7.1. +current version is 0.8.0. hunk ./doc/index.html 315 +

    +If you want to send patches, please read this first. hunk ./doc/index.html 555 +
    *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 <tag/> (XHTML mode) or <tag> (SGML mode). For +all other tags, it will always generate <tag></tag>. The initial value of this variable is T. +
    + +


    [Special variable] +
    *html-empty-tags* + +


    +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)
    +
    +
    + +


    [Special variable] hunk ./doc/index.html 801 -attribute values. Thanks to Kevin Rosenberg for the LHTML patch. Thanks to Stefan Scholl for the 'old school' patch. +attribute values. Thanks to Kevin Rosenberg for the LHTML patch. +Thanks to Stefan Scholl for the 'old school' patch. Thanks to Mac +Chan for several useful additions. hunk ./doc/index.html 806 -$Header: /usr/local/cvsrep/cl-who/doc/index.html,v 1.49 2007/04/05 06:58:22 edi Exp $ +$Header: /usr/local/cvsrep/cl-who/doc/index.html,v 1.51 2007/04/27 09:33:44 edi Exp $ hunk ./packages.lisp 2 -;;; $Header: /usr/local/cvsrep/cl-who/packages.lisp,v 1.14 2007/03/23 14:51:42 edi Exp $ +;;; $Header: /usr/local/cvsrep/cl-who/packages.lisp,v 1.15 2007/04/27 09:33:42 edi Exp $ hunk ./packages.lisp 30 -(in-package #:cl-user) +(in-package :cl-user) hunk ./packages.lisp 32 -#-:cormanlisp -(defpackage #:cl-who - (:use #:cl) - (:nicknames #:who) - (:export #:*attribute-quote-char* - #:*escape-char-p* - #:*prologue* - #:*downcase-tags-p* - #:conc - #:convert-attributes - #:convert-tag-to-string-list - #:esc - #:escape-string - #:escape-string-all - #:escape-string-iso-8859 - #:escape-string-iso-8859-1 - #:escape-string-minimal - #:escape-string-minimal-plus-quotes - #:fmt - #:htm - #:html-mode - #:show-html-expansion - #:str - #:with-html-output - #:with-html-output-to-string)) - -#+:cormanlisp -(defpackage "CL-WHO" - (:use "CL") - (:nicknames "WHO") - (:export "*ATTRIBUTE-QUOTE-CHAR*" - "*ESCAPE-CHAR-P*" - "*PROLOGUE*" - "*DOWNCASE-TAGS-P*" - "CONC" - "ESC" - "ESCAPE-STRING" - "ESCAPE-STRING-ALL" - "ESCAPE-STRING-ISO-8859" - "ESCAPE-STRING-ISO-8859-1" - "ESCAPE-STRING-MINIMAL" - "ESCAPE-STRING-MINIMAL-PLUS-QUOTES" - "FMT" - "HTM" - "HTML-MODE" - "SHOW-HTML-EXPANSION" - "STR" - "WITH-HTML-OUTPUT" - "WITH-HTML-OUTPUT-TO-STRING")) +(defpackage :cl-who + (:use :cl) + (:nicknames :who) + #+:sbcl (:shadow :defconstant) + (:export :*attribute-quote-char* + :*escape-char-p* + :*prologue* + :*downcase-tags-p* + :*html-empty-tags* + :*html-empty-tag-aware-p* + :conc + :convert-attributes + :convert-tag-to-string-list + :esc + :escape-string + :escape-string-all + :escape-string-iso-8859 + :escape-string-iso-8859-1 + :escape-string-minimal + :escape-string-minimal-plus-quotes + :fmt + :htm + :html-mode + :show-html-expansion + :str + :with-html-output + :with-html-output-to-string)) addfile ./specials.lisp hunk ./specials.lisp 1 +;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package:CL-WHO; Base: 10 -*- +;;; $Header: /usr/local/cvsrep/cl-who/specials.lisp,v 1.1 2007/04/27 09:33:42 edi Exp $ + +;;; Copyright (c) 2003-2007, Dr. Edmund Weitz. All rights reserved. + +;;; Redistribution and use in source and binary forms, with or without +;;; modification, are permitted provided that the following conditions +;;; are met: + +;;; * Redistributions of source code must retain the above copyright +;;; notice, this list of conditions and the following disclaimer. + +;;; * Redistributions in binary form must reproduce the above +;;; copyright notice, this list of conditions and the following +;;; disclaimer in the documentation and/or other materials +;;; provided with the distribution. + +;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED +;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +;;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +(in-package :cl-who) + +#+:sbcl +(defmacro defconstant (name value &optional doc) + "Make sure VALUE is evaluated only once \(to appease SBCL)." + `(cl:defconstant ,name (if (boundp ',name) (symbol-value ',name) ,value) + ,@(when doc (list doc)))) + +(defvar *prologue* + "" + "This is the first line that'll be printed if the :PROLOGUE keyword +argument is T") + +(defparameter *escape-char-p* + #'(lambda (char) + (or (find char "<>&'\"") + (> (char-code char) 127))) + "Used by ESCAPE-STRING to test whether a character should be escaped.") + +(defparameter *indent* nil + "Whether to insert line breaks and indent. Also controls amount of +indentation dynamically.") + +(defvar *html-mode* :xml + ":SGML for \(SGML-)HTML, :XML \(default) for XHTML.") + +(defvar *downcase-tags-p* t + "If NIL, a keyword symbol representing a tag name will not be +automatically converted to lowercase. This is useful when one needs +to output case sensitive XML tags.") + +(defparameter *attribute-quote-char* #\' + "Quote character for attributes.") + +(defparameter *empty-tag-end* " />" + "End of an empty tag. Default is XML style.") + +(defparameter *html-empty-tags* + '(: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) + "The list of HTML tags that should be output as empty tags. +See *HTML-EMPTY-TAG-AWARE-P*.") + +(defvar *html-empty-tag-aware-p* T + "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 +.") + +(defconstant +newline+ (make-string 1 :initial-element #\Newline) + "Used for indentation.") + +(defconstant +spaces+ (make-string 2000 + :initial-element #\Space + :element-type 'base-char) + "Used for indentation.") + hunk ./who.lisp 2 -;;; $Header: /usr/local/cvsrep/cl-who/who.lisp,v 1.30 2007/04/05 06:58:20 edi Exp $ +;;; $Header: /usr/local/cvsrep/cl-who/who.lisp,v 1.31 2007/04/27 09:33:42 edi Exp $ hunk ./who.lisp 30 -(in-package #:cl-who) - -(defvar *prologue* - "" - "This is the first line that'll be printed if the :PROLOGUE keyword -argument is T") - -(defparameter *escape-char-p* - #'(lambda (char) - (or (find char "<>&'\"") - (> (char-code char) 127))) - "Used by ESCAPE-STRING to test whether a character should be escaped.") - -(defparameter *indent* nil - "Whether to insert line breaks and indent. Also controls amount of -indentation dynamically.") - -(defvar *html-mode* :xml - ":SGML for \(SGML-)HTML, :XML \(default) for XHTML.") - -(defvar *downcase-tags-p* t - "If NIL, a keyword symbol representing a tag name will not be -automatically converted to lowercase. This is useful when one needs -to output case sensitive XML tags.") - -(defparameter *attribute-quote-char* #\' - "Quote character for attributes.") - -(defparameter *empty-tag-end* " />" - "End of an empty tag. Default is XML style.") - -(eval-when (:compile-toplevel :load-toplevel :execute) - (unless (boundp '+newline+) - (defconstant +newline+ (make-string 1 :initial-element #\Newline) - "Used for indentation.")) - - (unless (boundp '+spaces+) - (defconstant +spaces+ (make-string 2000 - :initial-element #\Space - :element-type 'base-char) - "Used for indentation."))) +(in-package :cl-who) hunk ./who.lisp 220 - ;; indent by *INDENT* spaces - (list +newline+ (n-spaces *indent*))) + ;; indent by *INDENT* spaces + (list +newline+ (n-spaces *indent*))) hunk ./who.lisp 228 - (append - (list ">") - ;; now hand over the tag's body to TREE-TO-TEMPLATE, increase - ;; *INDENT* by 2 if necessary - (if *indent* - (let ((*indent* (+ 2 *indent*))) - (funcall body-fn body)) - (funcall body-fn body)) - (if *indent* - ;; indentation - (list +newline+ (n-spaces *indent*))) - ;; closing tag - (list "")) - ;; no body, so no closing tag - (list *empty-tag-end*))))) + (append + (list ">") + ;; now hand over the tag's body to TREE-TO-TEMPLATE, increase + ;; *INDENT* by 2 if necessary + (if *indent* + (let ((*indent* (+ 2 *indent*))) + (funcall body-fn body)) + (funcall body-fn body)) + (if *indent* + ;; indentation + (list +newline+ (n-spaces *indent*))) + ;; closing tag + (list "")) + ;; no body, so no closing tag unless defined in *HTML-EMPTY-TAGS* + (if (or (not *html-empty-tag-aware-p*) + (member tag *html-empty-tags*)) + (list *empty-tag-end*) + (list ">" "")))))) }