[TYPO3-core] Gremlin #1292: xhtml_cleaning cleans HTML commentswhich is not wanted in any case

Martin Kutschker Martin.Kutschker at blackbox.net
Mon Nov 7 10:24:52 CET 2005


Sebastian Kurfuerst <sebastian at garbage-group.de> writes on 
Mon, 07 Nov 2005 06:45:38 +0100 (MET):

> User writes:
> 
> This problem regards Trackback [1] functionality of
> weblogs/EXT:timtab.
> To enable trackback autodiscovery for blog tools a peace of rdf code
> is
> place in a HTML comment. This way the page still validates and the
> trackback URL can be found by other sites automaticly. The rdf code
> looks like this:
> 
> <!--
> <rdf:RDF ... >
> <rdf:Description ... />
> </rdf:RDF>
> -->
> 
> when activating xhtml_cleaning this is transformed to 
> 
> <!--
> <rdf:rdf ...>
> <rdf:description ... />
> </rdf:rdf>
> -->
> 
> which can not be discovered by other sites automaticly. Therfore it
> is necessary to leave HTML comments untouched.
> 
> 
> Solution:
> 
> - leave comments untouched in xhtml_cleaning by replacing them with a
> special marker and substituting them back afterwards.


First of all, is there a reason to remove the comments? If yes, we need an option to do so.

Secondly, can't this be done by changing the way the cleaning code works? I think that processTags is the key for the solution. Adding an additional regexp plus string replace doesn't speed up an already costly page generation. 

Anyway, if you cannot get rid of the replacemnt stuff you can do it like that (mind the curly brackets within the ###'s):

preg_replace('/<!--(.*?)-->/','###{\\1}###',$content);"

and back again:

preg_replace('/###{(.*?)}###-->/','<!--\\1-->',$content);"

Masi

PS: I really wonder who uses this stuff. The generated Code should be alerady valid XHTML. If not, fix the generator, donÄt write a workaround. 



More information about the TYPO3-team-core mailing list