You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rivet-dev@tcl.apache.org by "David N. Welton" <da...@dedasys.com> on 2001/09/19 15:28:47 UTC

Ok folks, it's in CVS

First, who's here so far?  Damon?

Anyway, I finally managed to get the damn thing committed.  I'm having
some weird problems with the NAT at the place I'm staying... CVS
diffs, commits and such don't work.  Anyway, the code is out there,
now.

-- 
David N. Welton
   Consulting: http://www.dedasys.com/
Free Software: http://people.debian.org/~davidw/
   Apache Tcl: http://tcl.apache.org/
     Personal: http://www.efn.org/~davidw/

Re: "escaping" start/close tags in Tcl sections of tcl/html pages

Posted by "David N. Welton" <da...@dedasys.com>.
Damon Courtney <da...@your.unreality.com> writes:

> > I'm thinking about redoing the parser to take into account
> > situations like this:

> > ----
> > <some html>

> > <?
> > puts {<? blah blah blah?>}
> > ?>
> > ----

> > Which currently cause problems with the parser.  Thoughts?  Maybe at
> > the same time, I can make it accept <?dtcl as well as <?, also...

>     Hrmmm...  Couldn't we just check to see if we're already in a
> block of code?  I like the idea of specifying some kind of specific
> rivet tag, but I think doing <?rivet is a bad idea.  I mean, I guess
> it works.

The reason that it came up was that someone asked me about doing XML
documents, which start with <?...?>.  I can see how it would be a pain
in the neck to have to escape that:

puts "<? .....\?\>"

> NWS had its own tag which looked more like a real HTML
> tag.  They were just:

> <nws>

<? is compliant XML, but adding random tags is not.  If you use an
HTML editing mode like psgml in emacs, which keeps track of context
and what tags can be inserted, adding spurious markup is bad.

>     BTW, I'm back from honeymoon, recovered from the wedding and now
> recovering from Christmas, which means I'll be back on some code
> very shortly.

Cool:-)

-- 
David N. Welton
   Consulting: http://www.dedasys.com/
Free Software: http://people.debian.org/~davidw/
   Apache Tcl: http://tcl.apache.org/
     Personal: http://www.efn.org/~davidw/

Re: "escaping" start/close tags in Tcl sections of tcl/html pages

Posted by "David N. Welton" <da...@dedasys.com>.
Wojciech Kocjan <wo...@kocjan.org> writes:

> >>I'm thinking about redoing the parser to take into account situations
> >>like this:

> However, I suppose a problem would be with XML stuff like this:

> ...

> It will work with the above example. However, the following is a big
> problem:

I did some timing on it, and found it slowed things down.  That,
combined with the fact that it should be escaped in any case because
of all the possible special cases, leads me to thing that it's just
not worth it.

-- 
David N. Welton
   Consulting: http://www.dedasys.com/
Free Software: http://people.debian.org/~davidw/
   Apache Tcl: http://tcl.apache.org/
     Personal: http://www.efn.org/~davidw/

Re: "escaping" start/close tags in Tcl sections of tcl/html pages

Posted by "David N. Welton" <da...@dedasys.com>.
Wojciech Kocjan <wo...@kocjan.org> writes:

> >>I'm thinking about redoing the parser to take into account situations
> >>like this:

> However, I suppose a problem would be with XML stuff like this:

> ...

> It will work with the above example. However, the following is a big
> problem:

I did some timing on it, and found it slowed things down.  That,
combined with the fact that it should be escaped in any case because
of all the possible special cases, leads me to thing that it's just
not worth it.

-- 
David N. Welton
   Consulting: http://www.dedasys.com/
Free Software: http://people.debian.org/~davidw/
   Apache Tcl: http://tcl.apache.org/
     Personal: http://www.efn.org/~davidw/

Re: "escaping" start/close tags in Tcl sections of tcl/html pages

Posted by "David N. Welton" <da...@dedasys.com>.
Damon Courtney <da...@your.unreality.com> writes:

[ for rivet - don't worry, mod_dtcl folks:-) ]

>     So, I'm about to remove all of the upload stuff that has to do
> with the ::request::UPLOAD array.  Any objections?  We want the
> upload command to be the in-point for all of this information
> anyway, right?  Or, do we want to fold it into the var command
> somehow and even get rid of upload?

I would opt for keeping the upload command, as there are a few things
to be configured, and it has a reasonable set of sub-commands, so
keeping it would avoid choking up the 'var' command namespace.

-- 
David N. Welton
   Consulting: http://www.dedasys.com/
Free Software: http://people.debian.org/~davidw/
   Apache Tcl: http://tcl.apache.org/
     Personal: http://www.efn.org/~davidw/

Re: "escaping" start/close tags in Tcl sections of tcl/html pages

Posted by "David N. Welton" <da...@dedasys.com>.
Damon Courtney <da...@your.unreality.com> writes:

[ for rivet - don't worry, mod_dtcl folks:-) ]

>     So, I'm about to remove all of the upload stuff that has to do
> with the ::request::UPLOAD array.  Any objections?  We want the
> upload command to be the in-point for all of this information
> anyway, right?  Or, do we want to fold it into the var command
> somehow and even get rid of upload?

I would opt for keeping the upload command, as there are a few things
to be configured, and it has a reasonable set of sub-commands, so
keeping it would avoid choking up the 'var' command namespace.

-- 
David N. Welton
   Consulting: http://www.dedasys.com/
Free Software: http://people.debian.org/~davidw/
   Apache Tcl: http://tcl.apache.org/
     Personal: http://www.efn.org/~davidw/

Re: "escaping" start/close tags in Tcl sections of tcl/html pages

Posted by Damon Courtney <da...@your.unreality.com>.
Ok,

    So, I'm about to remove all of the upload stuff that has to do with
the ::request::UPLOAD array.  Any objections?  We want the upload command
to be the in-point for all of this information anyway, right?  Or, do we
want to fold it into the var command somehow and even get rid of upload?

D


Re: "escaping" start/close tags in Tcl sections of tcl/html pages

Posted by Damon Courtney <da...@your.unreality.com>.
Ok,

    So, I'm about to remove all of the upload stuff that has to do with
the ::request::UPLOAD array.  Any objections?  We want the upload command
to be the in-point for all of this information anyway, right?  Or, do we
want to fold it into the var command somehow and even get rid of upload?

D


Re: "escaping" start/close tags in Tcl sections of tcl/html pages

Posted by "David N. Welton" <da...@dedasys.com>.
Wojciech Kocjan <wo...@kocjan.org> writes:

> >>Which currently cause problems with the parser.  Thoughts?  Maybe
> >>at the same time, I can make it accept <?dtcl as well as <?,
> >>also...

> >     Hrmmm...  Couldn't we just check to see if we're already in a
> > block of code?

> I suppose a counter would be the easiest way to do it - when started
> it is 0, on evert "<?rivet" it is incremented by 1, on every "?>" it
> is decremented if the counter is >0.

Yes, that's how my new parser works.
 
> However, I suppose a problem would be with XML stuff like this:
> <?rivet
> puts "<?xml version=\"1.0\" encoding=\"$encoding\"?>"
> ?>

Right..hrm...

> It will work with the above example. However, the following is a big
> problem:
> 
> <?rivet
> proc php_end {} {
>      puts "?>"
> }
> proc php_begin {} {
>      puts "<?php "
> }
> 
> php_begin
> puts "echo('test')"
> php_end
> ?>

Yuck, I think we are just going to have to tell people to escape it.
There are too many sneaky things like that.
 
-- 
David N. Welton
   Consulting: http://www.dedasys.com/
Free Software: http://people.debian.org/~davidw/
   Apache Tcl: http://tcl.apache.org/
     Personal: http://www.efn.org/~davidw/

Re: "escaping" start/close tags in Tcl sections of tcl/html pages

Posted by "David N. Welton" <da...@dedasys.com>.
Wojciech Kocjan <wo...@kocjan.org> writes:

> >>Which currently cause problems with the parser.  Thoughts?  Maybe
> >>at the same time, I can make it accept <?dtcl as well as <?,
> >>also...

> >     Hrmmm...  Couldn't we just check to see if we're already in a
> > block of code?

> I suppose a counter would be the easiest way to do it - when started
> it is 0, on evert "<?rivet" it is incremented by 1, on every "?>" it
> is decremented if the counter is >0.

Yes, that's how my new parser works.
 
> However, I suppose a problem would be with XML stuff like this:
> <?rivet
> puts "<?xml version=\"1.0\" encoding=\"$encoding\"?>"
> ?>

Right..hrm...

> It will work with the above example. However, the following is a big
> problem:
> 
> <?rivet
> proc php_end {} {
>      puts "?>"
> }
> proc php_begin {} {
>      puts "<?php "
> }
> 
> php_begin
> puts "echo('test')"
> php_end
> ?>

Yuck, I think we are just going to have to tell people to escape it.
There are too many sneaky things like that.
 
-- 
David N. Welton
   Consulting: http://www.dedasys.com/
Free Software: http://people.debian.org/~davidw/
   Apache Tcl: http://tcl.apache.org/
     Personal: http://www.efn.org/~davidw/

Re: "escaping" start/close tags in Tcl sections of tcl/html pages

Posted by Wojciech Kocjan <wo...@kocjan.org>.

Damon Courtney wrote:

>>I'm thinking about redoing the parser to take into account situations
>>like this:
>>
>>----
>><some html>
>>
>><?
>>puts {<? blah blah blah?>}
>>?>
>>----
>>
>>Which currently cause problems with the parser.  Thoughts?  Maybe at
>>the same time, I can make it accept <?dtcl as well as <?, also...
>     Hrmmm...  Couldn't we just check to see if we're already in a block
> of code?  


I suppose a counter would be the easiest way to do it - when started it 
is 0, on evert "<?rivet" it is incremented by 1, on every "?>" it is 
decremented if the counter is >0.

However, I suppose a problem would be with XML stuff like this:
<?rivet
puts "<?xml version=\"1.0\" encoding=\"$encoding\"?>"
?>

The only way around this would be to:
1/ learn to write ?\> - which could be a PITA
2/ write the <? stack and trace which <? were connected with rivet and 
which were not. In this case the stack would be {1 0} - which means that 
the first <? started a script, however the second one didn't.

It will work with the above example. However, the following is a big 
problem:

<?rivet
proc php_end {} {
     puts "?>"
}
proc php_begin {} {
     puts "<?php "
}

php_begin
puts "echo('test')"
php_end
?>

> I like the idea of specifying some kind of specific rivet tag,
> but I think doing <?rivet is a bad idea.  I mean, I guess it works.  NWS
> had its own tag which looked more like a real HTML tag.  They were just:
> 
> <nws>

 > [...]

> Etc...


I don't like the idea of using tags - the same reason David mentioned.

--
WK



Re: "escaping" start/close tags in Tcl sections of tcl/html pages

Posted by "David N. Welton" <da...@dedasys.com>.
Damon Courtney <da...@your.unreality.com> writes:

> > I'm thinking about redoing the parser to take into account
> > situations like this:

> > ----
> > <some html>

> > <?
> > puts {<? blah blah blah?>}
> > ?>
> > ----

> > Which currently cause problems with the parser.  Thoughts?  Maybe at
> > the same time, I can make it accept <?dtcl as well as <?, also...

>     Hrmmm...  Couldn't we just check to see if we're already in a
> block of code?  I like the idea of specifying some kind of specific
> rivet tag, but I think doing <?rivet is a bad idea.  I mean, I guess
> it works.

The reason that it came up was that someone asked me about doing XML
documents, which start with <?...?>.  I can see how it would be a pain
in the neck to have to escape that:

puts "<? .....\?\>"

> NWS had its own tag which looked more like a real HTML
> tag.  They were just:

> <nws>

<? is compliant XML, but adding random tags is not.  If you use an
HTML editing mode like psgml in emacs, which keeps track of context
and what tags can be inserted, adding spurious markup is bad.

>     BTW, I'm back from honeymoon, recovered from the wedding and now
> recovering from Christmas, which means I'll be back on some code
> very shortly.

Cool:-)

-- 
David N. Welton
   Consulting: http://www.dedasys.com/
Free Software: http://people.debian.org/~davidw/
   Apache Tcl: http://tcl.apache.org/
     Personal: http://www.efn.org/~davidw/

Re: "escaping" start/close tags in Tcl sections of tcl/html pages

Posted by Wojciech Kocjan <wo...@kocjan.org>.

Damon Courtney wrote:

>>I'm thinking about redoing the parser to take into account situations
>>like this:
>>
>>----
>><some html>
>>
>><?
>>puts {<? blah blah blah?>}
>>?>
>>----
>>
>>Which currently cause problems with the parser.  Thoughts?  Maybe at
>>the same time, I can make it accept <?dtcl as well as <?, also...
>     Hrmmm...  Couldn't we just check to see if we're already in a block
> of code?  


I suppose a counter would be the easiest way to do it - when started it 
is 0, on evert "<?rivet" it is incremented by 1, on every "?>" it is 
decremented if the counter is >0.

However, I suppose a problem would be with XML stuff like this:
<?rivet
puts "<?xml version=\"1.0\" encoding=\"$encoding\"?>"
?>

The only way around this would be to:
1/ learn to write ?\> - which could be a PITA
2/ write the <? stack and trace which <? were connected with rivet and 
which were not. In this case the stack would be {1 0} - which means that 
the first <? started a script, however the second one didn't.

It will work with the above example. However, the following is a big 
problem:

<?rivet
proc php_end {} {
     puts "?>"
}
proc php_begin {} {
     puts "<?php "
}

php_begin
puts "echo('test')"
php_end
?>

> I like the idea of specifying some kind of specific rivet tag,
> but I think doing <?rivet is a bad idea.  I mean, I guess it works.  NWS
> had its own tag which looked more like a real HTML tag.  They were just:
> 
> <nws>

 > [...]

> Etc...


I don't like the idea of using tags - the same reason David mentioned.

--
WK



Re: "escaping" start/close tags in Tcl sections of tcl/html pages

Posted by Damon Courtney <da...@your.unreality.com>.
> I'm thinking about redoing the parser to take into account situations
> like this:
> 
> ----
> <some html>
> 
> <?
> puts {<? blah blah blah?>}
> ?>
> ----
> 
> Which currently cause problems with the parser.  Thoughts?  Maybe at
> the same time, I can make it accept <?dtcl as well as <?, also...

    Hrmmm...  Couldn't we just check to see if we're already in a block
of code?  I like the idea of specifying some kind of specific rivet tag,
but I think doing <?rivet is a bad idea.  I mean, I guess it works.  NWS
had its own tag which looked more like a real HTML tag.  They were just:

<nws>

puts FOO

</nws>

OR

<nws>incr_page_counter</nws>

Etc...

    BTW, I'm back from honeymoon, recovered from the wedding and now
recovering from Christmas, which means I'll be back on some code very
shortly.

Damon


Re: "escaping" start/close tags in Tcl sections of tcl/html pages

Posted by Damon Courtney <da...@your.unreality.com>.
> I'm thinking about redoing the parser to take into account situations
> like this:
> 
> ----
> <some html>
> 
> <?
> puts {<? blah blah blah?>}
> ?>
> ----
> 
> Which currently cause problems with the parser.  Thoughts?  Maybe at
> the same time, I can make it accept <?dtcl as well as <?, also...

    Hrmmm...  Couldn't we just check to see if we're already in a block
of code?  I like the idea of specifying some kind of specific rivet tag,
but I think doing <?rivet is a bad idea.  I mean, I guess it works.  NWS
had its own tag which looked more like a real HTML tag.  They were just:

<nws>

puts FOO

</nws>

OR

<nws>incr_page_counter</nws>

Etc...

    BTW, I'm back from honeymoon, recovered from the wedding and now
recovering from Christmas, which means I'll be back on some code very
shortly.

Damon


"escaping" start/close tags in Tcl sections of tcl/html pages

Posted by "David N. Welton" <da...@dedasys.com>.
I'm thinking about redoing the parser to take into account situations
like this:

----
<some html>

<?
puts {<? blah blah blah?>}
?>
----

Which currently cause problems with the parser.  Thoughts?  Maybe at
the same time, I can make it accept <?dtcl as well as <?, also...

-- 
David N. Welton
   Consulting: http://www.dedasys.com/
Free Software: http://people.debian.org/~davidw/
   Apache Tcl: http://tcl.apache.org/
     Personal: http://www.efn.org/~davidw/

"escaping" start/close tags in Tcl sections of tcl/html pages

Posted by "David N. Welton" <da...@dedasys.com>.
I'm thinking about redoing the parser to take into account situations
like this:

----
<some html>

<?
puts {<? blah blah blah?>}
?>
----

Which currently cause problems with the parser.  Thoughts?  Maybe at
the same time, I can make it accept <?dtcl as well as <?, also...

-- 
David N. Welton
   Consulting: http://www.dedasys.com/
Free Software: http://people.debian.org/~davidw/
   Apache Tcl: http://tcl.apache.org/
     Personal: http://www.efn.org/~davidw/