
			      Announcing
				xmlgen
			     version 1.3

for easy and dynamic creation of HTML/XML with Tcl.

===== WHAT's NEW?

o Output can be redirected to a channel other than stdout by wrapping
the markup commands into a channel command, like

  package require htmlgen
  namespace import ::htmlgen::*

  channel stderr {
    html ! {
      body ! p - Some text here
    }
  }

o Previously, in the context of [buffer], [puts] was tweaked to behave
different from the standard behaviour. This is no longer so. The
command [puts] is unchanged and will not be captured in the context of
[buffer] or [channel]. Use [::xmlgen::put] or the markup commands
instead. 


===== WHERE TO GET?

Xmlgen was integrated as a package into the TclXML repository on
sourceforge. Look at 

  http://sourceforge.net/projects/tclxml/

and follow the links.

===== WHAT IS IT?

Inspired by discussions about namespacing cgi.tcl and the difference
between cgi.tcl and several packages in tcllib, I prepared xmlgen and,
on top of it htmlgen.

Similar to cgi.tcl, an XML tag is defined as a Tcl command. It prints
the opening tag, then executes its body argument and then prints the
closing tag. The body argument, being a script, will again contain
markup commands which behaves in the same way. In short, you write

  set text "some prepared text"
  ul color=red ! {
    li - one 
    li - two can have some [b bold]
    li - $text
  }
  p + {
    When you use the "!", the body of the markup command is evaluated,
    with "+" like here, it is passed through [em subst]. With the "-"
    it is taken as is. In all three cases the result is printed. Only
    if none of them is given, the result is taken as is and simply
    returned.
  }   

to get

  <ul color="red">
   <li>one
   </li>
   <li>two can have some <b>bold</b>
   </li>
   <li>some prepared text
   </li>
  </ul>
  <p>When you use the "!", the body of the markup command is evaluated,
    with "+" like here, it is passed through <em>subst</em>. With the "-"
    it is taken as is. In all three cases the result is printed. Only
    if non of them is given, the result is taken as is and simply
    returned.
  </p>


Currently, xmlgen contains just two important commands, namely
[declartag], which creates a proc for a tag, and [buffer], which
collects the output of all the markup commands in a variable for later
reuse.

Package htmlgen builts on that and declares all HTML tags as commands.


===== WHAT IT IS NOT!

In contrast to cgi.tcl, htmlgen does not contain any special knowledge
about individual HTML tags. In addition, it does not have CGI parsing,
because there is already package ::ncgi in tcllib.


Comments welcome,
  Harald Kirsch
