Forum OpenACS Q&A: ADP Processing Error?

Collapse
Posted by Simon at TCB on
Hi,

There's a 'feature' thats been around for a while that I feel ought to be changed. Does everyone agree its a problem before I proceeed?

Problem is that when ADP pages are parsed they ignore the HTML Comment directives. Although not life-threatening, it very convenient to be able to comment out sections, and not have things fall over.

Should this be fixed? i.e. is there any negative effect of doing do? It may also be something I can allocate resources to fix within reason. If anyone in the know can give me an estimate for ma hours I'll consider it.

Collapse
2: Re: ADP Processing Error? (response to 1)
Posted by Tom Jackson on

Simon, I think all HTML is ignored by the adp parser. If you want to comment out code using the templating system, try using:

<if 0 eq 1>
unprocessed code, will not appear on user page
</if>

OTOH, I have previously proposed creating a comment tag for the templaiting system, for comments that should not be shown to the end user even in the source. You could do this in either tcl, with a new template tag, or with the built in tag proc.


proc comment_proc {string tagset} {

    return

}
ns_register_adptag comment /comment comment_proc

# example:

<comment>This is a comment</comment>
Collapse
3: Re: ADP Processing Error? (response to 1)
Posted by Dan Wickstrom on
I don't see the problem.  I tried commenting out a few items in an adp template, and it seemed to work fine.  The adp parser is happy to pass html comments through, and the templating code doesn't strip them out, so I don't see why there would be a problem.
Collapse
4: Re: ADP Processing Error? (response to 3)
Posted by Tilmann Singer on
Simon - do you mean this:

< % process this tcl code % >

< ! -- 

< % but don't process this tcl code % >

-- >

? (spaces added to avoid the forums filter)

If yes then I am strongly against this change - commmenting tcl code with Tom's trick or by prepending #'s is sufficient in my opinion (although a <comment> tag sounds useful).

Collapse
5: Re: ADP Processing Error? (response to 1)
Posted by Simon at TCB on
People have suggested suitable alternatives I guess. Any reason why you're strongly against it though, or are you just being enigmatic today? ;o)
Collapse
6: Re: ADP Processing Error? (response to 5)
Posted by Jeff Davis on
There is a good reason to process code in html comments and that is that you sometimes put javascript or css inside comments to hide the code from old browsers and if you turn off adp parsing then things like
<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">
<!-- 
<include src="javascript_include_foo">
// -->
</SCRIPT>
will not work right.

I find the <comment> tag to be the most palatable solution (since I also think removing the code from what you send to the client is a good practice).