RE: TIDY for PHP3

On Thu, 2 Sep 1999, Richard Allsebrook wrote:

> I've been using TIDY (as a plug-in for HTML Kit
> http://www.chami.com/html-kit/ ) to tidy up my PHP3 scripts for
> some time now.  I've found that you get less managing if you use
> a
> 
> <script language="php">
> </script>
> 
> tag for php elements that span more than one line
> 
> <? ?> can be used OK for simple element substitutions.
> 
> You're right though, it's still not perfect :-(
> 
> TIDY incorrectly mangles the following:
> 
> <A href="<? echo myUrl ?>Click Me</A>
> 
> to
> 
> <A href="&lt;? echo myUrl ?&gt;Click Me</A>
> 
> which breaks the PHP.

I assume your example was supposed to have been:

  <a href="<? echo myUrl ?>">Click Me</a>

Which indeed is currently tidied to:

  <a href="&lt;? echo myURL ?&gt;">Click Me</a>

I think the solution for PHP3 hackers is to add a new config option
to control whether < and > are mapped to &lt; and &gt; respectively
within attribute values or not. This would be in analogy to the
existing options for dealing with & etc.

Note; your example lacked a trailing quote mark and as written
should cause Tidy to complain.
 
> I also find it particularly annoying that TIDY re-indents <? ?>
> tags each time you tidy a document, but leaves <script></script>
> blocks alone.

I don't understand this very well. Sometimes as in your example
it's better for the <? ?> to be formatted inline, while in others
something similar to script and style elements would make sense.
How would Tidy be expected to know which processing instruction
should be printed inline and which outdented?

Regards,

-- Dave Raggett <dsr@w3.org> http://www.w3.org/People/Raggett
phone: +44 122 578 2984 (or 2521) +44 385 320 444 (gsm mobile)
World Wide Web Consortium (on assignment from HP Labs)

Received on Monday, 6 September 1999 12:31:24 UTC