]> snippets.scripts.mit.edu Git - Scripts/git/.git/blobdiff - TracZephyrPlugin/ZephyrPlugin.py
TracZephyrPlugin: Smarter quoted text regex.
[Scripts/git/.git] / TracZephyrPlugin / ZephyrPlugin.py
index 45584ae80bda02ead02c4e558a8a877b46eb34c2..679d019f962274877cc4bfb63e32cd3a905b6be8 100644 (file)
@@ -7,6 +7,8 @@ import re
 import textwrap
 import shlex
 
+quoted_re = re.compile('^(?:> ?\n)*> .+\n(?:>(?: .*)?\n)*', re.MULTILINE)
+
 class ZephyrPlugin(Component):
     implements(ITicketChangeListener)
     
@@ -26,7 +28,7 @@ class ZephyrPlugin(Component):
         p.wait()
 
     def format_text(self, text):
-        text = re.sub(re.compile('^(?:> .*\n)+', re.MULTILINE), u'> […]\n', text)
+        text = re.sub(quoted_re, u'> […]\n', text)
         lines = textwrap.fill(text).split('\n')
         if len(lines) > 5:
             lines = lines[:5] + [u'[…]']