Recent Topics

1 Oct 18, 2011 16:58    

I am trying to find a problem with rendering in a 2.x plugin that doesn't work in 4.0 (creativecommons.) The plugin puts some XML into HTML comments, and the XML gets corrupted, affecting the overall HTML output.
Parts of the added stuff:


<!--
<rdf:RDF xmlns="http://creativecommons.org/ns#"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<work rdf:about="http://localhost/~joe/blogs/index.php/2011/10/12/test-post">
  <dc:title>test-post</dc:title>
  <dc:creator><agent>
    <dc:title>Joe (User ID#4 at http://localhost/~joe/blogs/)</dc:title>
  </agent></dc:creator>
</work>
</rdf:RDF>
-->


Since this is in HTML comments, it should not be touched by any HTML renderer.
However, the output gets corrupted.
It shows up as


<!--
<rdf :RDF xmlns="http://creativecommons.org/ns#"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<work rdf:about="http://localhost/~joe/blogs/index.php/2011/10/12/test-post">
  <dc :title>test-post</dc>
  <dc :creator><agent>
    <dc :title>Joe (User ID#4 at http://localhost/~joe/blogs/)</dc>
  </agent></dc>
</work>
</rdf>


In other words, the output
1. has a space between namespace and tag, e.g., <dc :title> instead of <dc:title>
2. removes the name from the closing tags, e.g., </dc> instead of </dc:title>,
3. removes the closing comment, -->
As for #3, if I move the closing comment before the final </rdf:RDF>, it shows up.

I have not been able to find out where this mis-handling of the HTML comment happens. I disabled all other plugins in an effort to eliminate other RenderItemAsHtml function calls.
Can anybody give me a hint?

2 Oct 18, 2011 19:48

We added tag balancer since 2.x. It breaks the code because technically <xx:yy> is not a invalid XHTML tag.
There are two ways to fix this
- do not balance/clean-up HTML comments
- allow xx:yy structure since it's widely used by Facebook and some other apps

3 Oct 18, 2011 20:10

Thank you.
On my test server, I quickly disabled tag balancing by just returning immediately from the balance_tags function, and that works.
It's only a quick hack, of course. If I find time, I'll try improving the function to allow xx:yy and not touching HTML comments.

4 Oct 18, 2011 20:25

Note that you absolutely need tag balancing if you use <more> divider in TinyMCE mode.


Form is loading...