Revision: 66d81b9c77d2
Author:   Janne Härkönen <[email protected]>
Date:     Fri Feb 17 04:38:41 2012
Log:      htmlformatter: precompile matcher regexps
http://code.google.com/p/robotframework/source/detail?r=66d81b9c77d2

Modified:
 /src/robot/utils/htmlformatters.py

=======================================
--- /src/robot/utils/htmlformatters.py  Fri Feb 17 04:18:48 2012
+++ /src/robot/utils/htmlformatters.py  Fri Feb 17 04:38:41 2012
@@ -82,7 +82,7 @@
     def __init__(self, result, formatter):
         self._result = result
         self._formatter = formatter
-        self.handles = re.compile(formatter.pattern).match
+        self.handles = formatter.handles


 class LineCollector(_Collector):
@@ -109,7 +109,7 @@


 class LineFormatter(object):
-    pattern = '.*'
+    handles = lambda self, line: True
     newline = '\n'
     _bold = re.compile('''
 (                         # prefix (group 1)
@@ -146,7 +146,7 @@


 class RulerFormatter(object):
-    pattern = '^-{3,} *$'
+    handles = re.compile('^-{3,} *$').match
     newline = ''

     def format(self, line):
@@ -154,7 +154,7 @@


 class TableFormatter(object):
-    pattern = '^\s*\| (.* |)\|\s*$'
+    handles = re.compile('^\s*\| (.* |)\|\s*$').match
     _line_splitter = re.compile(' \|(?= )')
     _format_cell = LineFormatter().format

@@ -176,7 +176,7 @@


 class PreformattedFormatter(object):
-    pattern = '\s*\|( |$)'
+    handles = re.compile('\s*\|( |$)').match
     _format_line = LineFormatter().format

     def pre_format(self, line):

Reply via email to