Ticket #104 (new enhancement)
Emitting CDATA sections
| Reported by: | doug@… | Owned by: | cmlenz |
|---|---|---|---|
| Priority: | minor | Milestone: | |
| Component: | Template processing | Version: | 0.3.6 |
| Keywords: | CDATA | Cc: |
Description
I'm producing some XML using Genshi, and I need to be able to emit CDATA sections. Using CDATA input means that the py: tags are not processed inside the CDATA sections (which makes perfect sense), but I needed this to work.
I couldn't find anything in Genshi to support doing this, so I hacked up this horrible kludge:
from genshi.builder import Fragment
from genshi.core import START_CDATA, END_CDATA
class CDataStart(Fragment):
def _generate(self):
yield START_CDATA, None, None
class CDataEnd(Fragment):
def _generate(self):
yield END_CDATA, None, None
I used instances of these in the template, and it seemed to work ok.
I don't necessarily want you to include this gruesome functionality, but I think the use case is valid at least. I imagine you might have a less horrible solution.
