Menu

#555 html: suggestion for a convenience "tag wrapping" proc

open
html (18)
5
2004-12-01
2004-12-01
No

In the current version of html, wrapping text with html
tags is a bit cumbersome in a lot of cases:

Example:

puts "[::html::openTag p]"
puts "This is my paragraph"
puts "[::html::closeTag]"

As a convenience for wrapping text or other data inside
of tags, I would like to suggest the addition of a
general ::html::wrapTag command that would work as
follows:

puts [::hml::wrapTag p "This is my paragraph"]

which would output the following:

<p>This is my paragraph</p>

puts [::html::wrapTag p "foo=bar" "This is my
paragraph"]

would output:

<p foo=bar>This is my paragraph</p>

and so on.

There are some specialized commands for wrapping
specific tags around data, such as ::html::cell
or ::html:row, but the above is a suggestion for a more
general command that would wrap data in with a
specified arbitrary tag.

Discussion