Mercurial > genshi > mirror
comparison genshi/input.py @ 997:9e30a7234290 stable-0.7.x
Merge r1219 from trunk (fix for PIs without data, fixes #368).
author | hodgestar |
---|---|
date | Sat, 26 Jan 2013 17:28:46 +0000 |
parents | 2bfd8f8d241c |
children | 44fb098722ac |
comparison
equal
deleted
inserted
replaced
995:59a4949b4a39 | 997:9e30a7234290 |
---|---|
403 except KeyError: | 403 except KeyError: |
404 text = '&%s;' % name | 404 text = '&%s;' % name |
405 self._enqueue(TEXT, text) | 405 self._enqueue(TEXT, text) |
406 | 406 |
407 def handle_pi(self, data): | 407 def handle_pi(self, data): |
408 target, data = data.split(None, 1) | |
409 if data.endswith('?'): | 408 if data.endswith('?'): |
410 data = data[:-1] | 409 data = data[:-1] |
410 try: | |
411 target, data = data.split(None, 1) | |
412 except ValueError: | |
413 # PI with no data | |
414 target = data | |
415 data = '' | |
411 self._enqueue(PI, (target.strip(), data.strip())) | 416 self._enqueue(PI, (target.strip(), data.strip())) |
412 | 417 |
413 def handle_comment(self, text): | 418 def handle_comment(self, text): |
414 self._enqueue(COMMENT, text) | 419 self._enqueue(COMMENT, text) |
415 | 420 |