Re: PHP support

Klaus;

Yeah, I understand what you're really thinking of here, but that sounds
very difficult to recognize... I currently do this by:

1) make a "debug" path that uses the same "print" commands
(language-specific print, write, writeln, echo) but wiht dummy data
2) run the self-test, output to a file
3) validator.w3.org on this file
4) modify code and repeat teat until it passes.

Now, I know this isn't the best way, I'd love a better way, but how can
we reliably pick up these code fragments and intelligently re-format the
output?  

The better solution here might be to have the "echo" or print be a
"wwwecho" or "wwwprint" that escape-encodes the output, but you'd still
have issues such as correcting poorly placed BR or P tags, or TABLE
without /TABLE.  I still don't see that as a feasible solution.

Allan


Klaus Johannes Rusch wrote:
> 
> 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 13:10:08 UTC