Edgewall Software

Changeset 184 for trunk/markup/input.py


Ignore:
Timestamp:
Aug 11, 2006, 4:08:13 PM (17 years ago)
Author:
cmlenz
Message:

CDATA sections in XML input now appear as CDATA sections in the output. This should address the problem with escaping the contents of <style> and <script> elements, which would only get interpreted correctly if the output was served as application/xhtml+xml. Closes #24.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/markup/input.py

    r180 r184  
    7070        parser.StartNamespaceDeclHandler = self._handle_start_ns
    7171        parser.EndNamespaceDeclHandler = self._handle_end_ns
     72        parser.StartCdataSectionHandler = self._handle_start_cdata
     73        parser.EndCdataSectionHandler = self._handle_end_cdata
    7274        parser.ProcessingInstructionHandler = self._handle_pi
    7375        parser.CommentHandler = self._handle_comment
     
    106108            raise ParseError(msg, self.filename, e.lineno, e.offset)
    107109
    108     def _enqueue(self, kind, data, pos=None):
     110    def _enqueue(self, kind, data=None, pos=None):
    109111        if pos is None:
    110112            pos = self._getpos()
     
    149151    def _handle_end_ns(self, prefix):
    150152        self._enqueue(Stream.END_NS, prefix or '')
     153
     154    def _handle_start_cdata(self):
     155        self._enqueue(Stream.START_CDATA)
     156
     157    def _handle_end_cdata(self):
     158        self._enqueue(Stream.END_CDATA)
    151159
    152160    def _handle_pi(self, target, data):
Note: See TracChangeset for help on using the changeset viewer.