comparison genshi/input.py @ 996:0f4b2e892a48 trunk

Fix handling of processing instructions that don't have data attached (patch from Neil Muller, fixes #368).
author hodgestar
date Sat, 26 Jan 2013 17:26:47 +0000
parents 2d9346a99352
children
comparison
equal deleted inserted replaced
994:16ccaf7389d5 996:0f4b2e892a48
399 except KeyError: 399 except KeyError:
400 text = '&%s;' % name 400 text = '&%s;' % name
401 self._enqueue(TEXT, text) 401 self._enqueue(TEXT, text)
402 402
403 def handle_pi(self, data): 403 def handle_pi(self, data):
404 target, data = data.split(None, 1)
405 if data.endswith('?'): 404 if data.endswith('?'):
406 data = data[:-1] 405 data = data[:-1]
406 try:
407 target, data = data.split(None, 1)
408 except ValueError:
409 # PI with no data
410 target = data
411 data = ''
407 self._enqueue(PI, (target.strip(), data.strip())) 412 self._enqueue(PI, (target.strip(), data.strip()))
408 413
409 def handle_comment(self, text): 414 def handle_comment(self, text):
410 self._enqueue(COMMENT, text) 415 self._enqueue(COMMENT, text)
411 416
Copyright (C) 2012-2017 Edgewall Software