diff 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
line wrap: on
line diff
--- a/genshi/input.py
+++ b/genshi/input.py
@@ -405,9 +405,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