diff genshi/filters/i18n.py @ 1016:38565f2ab970 trunk

Fix handling of case where a translation has text after a closing tag (fixes #566, thanks to jomae for the patch).
author hodgestar
date Thu, 09 Jan 2014 21:23:41 +0000
parents 7f8b4df4f862
children 744a33f78ccc
line wrap: on
line diff
--- a/genshi/filters/i18n.py
+++ b/genshi/filters/i18n.py
@@ -1048,7 +1048,13 @@
 
         while parts:
             order, string = parts.pop(0)
-            events = self.events[order].pop(0)
+            events = self.events[order]
+            if events:
+                events = events.pop(0)
+            else:
+                # create a dummy empty text event so any remaining
+                # part of the translation can be processed.
+                events = [(TEXT, "", (None, -1, -1))]
             parts_counter[order].pop()
 
             for event in events:
Copyright (C) 2012-2017 Edgewall Software