| Bruce Hartweg 2006-05-24, 10:04 pm |
| Robert Hicks wrote:
> I am woking on adding ::html::doctype to the html tcllib package. I
> have a working snippet (not complete):
>
> proc ::html::doctype {arg} {
> switch -- $arg {
> html401 { append html \
> {<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
> "http://www.w3.org/TR/html4/strict.dtd">}
> }
> html401t { append html \
> {<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
> Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">}
> }
> }
> return $html
> }
>
> I like the switch because it makes it easier to add more doctypes as
> they come along. What I want to do it make it *not* case sensitive. So
> the arg can be HTML401T or html401t or any combo as long as they are
> the correct letter/number combos.
>
> I am sure I have to pass that through a regex or something to achieve
> that.
don;t need a regexp - just do :
switch -- [string tolower $arg] {
...
}
Bruce
|