Re: PHP support

In <3BE2C3FB.6CCB79BE@caldera.com>, Allan Clark <allanc@caldera.com> writes:

Allan,

> There's a certain desire to have code inline with the document cleaned
> up.  My desire, for example, would be to have javascript code cleaned up
> for me; this request seems to be a request to "code beautify" some PHP.

beautifying external code references could be done fairly easily by invoking 
external beautifiers, for example cb does a fairly good job at beautifying 
Javascript already.

But, what you would really want is to also beautify the code generated by these
scripts, e.g. change

        <? echo "<TABLE><TR><TD>This is incomplete</TABLE>"; ?>

to

        <? echo "<table summary=\"\"><tr><td>This is complete</tr></td></table>"; ?>

which cannot be done (at least not reliably).

The other problem of course is now to recognize the format of an extension, 
while there are a few established conventions for popular formats the actual 
semantics are defined by the server configuration, and the same <? ?> syntax 
can denote PIs for an editor, or PHP code, or some other code.

> I think if this was done, we would want Tidy to recognize "hey this is
> PHP code" and look at a list of "beautifiers" based on language or tag
> type.  This way, the development of beautifiers isn't tied very tightly
> with tidy, tidy can some execute child or co-processes to clean the
> non-HTML non-XML code.

Probably better handled by HTML/XML aware beautifiers, so if your code includes
<? ?> PHP fragments you could run phptidy and it would pretty-print the PHP 
code and not touch anything else.

-- 
Klaus Johannes Rusch
KlausRusch@atmedia.net
http://www.atmedia.net/KlausRusch/

Received on Friday, 2 November 2001 12:05:40 UTC