Amaya corrupts HTML containing PHP code

I have found that Amaya corrupts HTML documents containing embedded PHP 
code. For example, if I have a document containing the following:

<p>this is a <a
href="#L128<?php more here ?>" <?php still more here ?>>LINK</a> to
the target.</p>

If I open the document with Amaya, and then save it (without making any 
changes to the paragraph above), I find Amaya will change the code to 
the following:

<p>this is a <a
href="#L128&lt;?php more here ?&gt;"><?php still more here ?>&gt;LINK</a> to
the target.</p>

Note that one "<" has been changed to "&lt;", and several ">" have been 
changed to "&gt;". This only seems to happen when the PHP tags (<?php 
some php code goes here ?>) are embedded inside HTML tags. However, 
unlike other tags (including HTML comments), it is perfectly acceptable 
for PHP tags to be included ABSOLUTELY ANYWHERE in the HTML document. 
They can be inside other HTML tags, and even inside quoted strings.

I can usually repair the corrupted file by replacing all "&lt;" with 
"<", and all "&gt;" with ">", but I cannot simply do a global search and 
replace. It is possible that my document could have contained "&lt;" and 
"&gt;" to represent the "<" and ">" characters in the text. So I must 
carefully evaluate each replacement to make sure I don't break something 

Is it possible to change Amaya so that it completely ignores any PHP 
tags, and preserves them unchanged when the document is saved? Of course 
some PHP tags would have to be destroyed when certain editing operations 
are performed, such as changing an attribute that contained embedded PHP.

Keith Rubow

Received on Wednesday, 13 June 2007 17:10:37 UTC