diff 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
line wrap: on
line diff
--- a/genshi/input.py
+++ b/genshi/input.py
@@ -401,9 +401,14 @@
         self._enqueue(TEXT, text)
 
     def handle_pi(self, data):
-        target, data = data.split(None, 1)
         if data.endswith('?'):
             data = data[:-1]
+        try:
+            target, data = data.split(None, 1)
+        except ValueError:
+            # PI with no data
+            target = data
+            data = ''
         self._enqueue(PI, (target.strip(), data.strip()))
 
     def handle_comment(self, text):
Copyright (C) 2012-2017 Edgewall Software