I'm using HAML to generate a XML output. Inside one of the element I'm using the :markdown filter to generate a small block of HTML code (for example, an unordered list of items).
!!! XML
%root
%child
:markdown
* item 1
* item 2
* item 3
Is it possible to wrap this generated HTML with a CDATA so that the XML file is valid?
<root>
<child><![CDATA[
<ul>
<li>item 1</li>
<li>item 2</li>
&开发者_如何学JAVAlt;li>item 3</li>
</ul>
]]></child>
</root>
Thanks!
From other source that currently it's not possible to chain filters together so there's no ready-made solution.
What I've done is create a custom filter that's similar to the build-in :markdown one and wrap the output with the CDATA tag. Works like a charm.
精彩评论