Revision: 4e8d677f7ac1
Author:   Janne Härkönen <[email protected]>
Date:     Thu Feb 16 21:02:06 2012
Log:      htmlformatter: support multiple preformatted blocks
http://code.google.com/p/robotframework/source/detail?r=4e8d677f7ac1

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

=======================================
--- /src/robot/utils/htmlformatters.py  Thu Feb 16 20:50:19 2012
+++ /src/robot/utils/htmlformatters.py  Thu Feb 16 21:02:06 2012
@@ -178,4 +178,9 @@
         return False

     def end(self):
- return '\n'.join(['<pre class="robotdoc">'] + self._rows + ['</pre>']) + '\n'
+        ret = self._format_block()
+        self._rows = []
+        return ret
+
+    def _format_block(self):
+ return '\n'.join(['<pre class="robotdoc">'] + self._rows + ['</pre>\n'])
=======================================
--- /utest/utils/test_htmlutils.py      Thu Feb 16 20:50:19 2012
+++ /utest/utils/test_htmlutils.py      Thu Feb 16 21:02:06 2012
@@ -421,6 +421,20 @@
     def test_spaces_before_leading_pipe_cause_no_formatting(self):
         assert_equals(html_format(' | some'), ' | some')

+    def test_multiple_blocks(self):
+ assert_equals(html_format('| some\n| quote\nbetween\n| other block\n\nafter'),
+                '''\
+<pre class="robotdoc">
+some
+quote
+</pre>
+between
+<pre class="robotdoc">
+other block
+</pre>
+
+after''')
+
     def test_block_mixed_with_other_content(self):
assert_equals(html_format('before block:\n| some\n| quote\nafter block'), 'before block:\n<pre class="robotdoc">\nsome\nquote\n</pre>\nafter block')

Reply via email to