diff genshi/input.py @ 999:f2d1f04b0959 stable-0.6.x

Merge r1219 from trunk (fix for PIs without data, fixes #368).
author hodgestar
date Sat, 26 Jan 2013 17:37:46 +0000
parents f3d998cc941e
children
line wrap: on
line diff
--- a/genshi/input.py
+++ b/genshi/input.py
@@ -394,9 +394,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