Revision: 5414b32dada0
Author:   Janne Härkönen <[email protected]>
Date:     Thu Feb 16 20:50:19 2012
Log: htmlutils: revert erroneous changes that added newlines after tables and hrs
http://code.google.com/p/robotframework/source/detail?r=5414b32dada0

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

=======================================
--- /src/robot/utils/htmlformatters.py  Thu Feb 16 03:53:08 2012
+++ /src/robot/utils/htmlformatters.py  Thu Feb 16 20:50:19 2012
@@ -64,7 +64,7 @@

     def _end_current(self):
         if self._current:
-            self._rows.append(self._current.end() + '\n')
+            self._rows.append(self._current.end())

     def _get_next(self, line):
         for formatter in self._formatters:
@@ -114,6 +114,8 @@
     def end(self):
         result = self._result
         self._result = None
+        if result != '<hr>':
+            result += '\n'
         return result

     def format(self, line):
@@ -176,4 +178,4 @@
         return False

     def end(self):
- return '\n'.join(['<pre class="robotdoc">'] + self._rows + ['</pre>']) + return '\n'.join(['<pre class="robotdoc">'] + self._rows + ['</pre>']) + '\n'
=======================================
--- /utest/utils/test_htmlutils.py      Thu Feb 16 05:17:00 2012
+++ /utest/utils/test_htmlutils.py      Thu Feb 16 20:50:19 2012
@@ -275,7 +275,7 @@
 '''
         exp = 'before table\n' \
             + _format_table([['in','table'],['still','in']]) \
-            + '\n\n after table'
+            + '\n after table'
         assert_equals(html_format(inp), exp)

     def test_multiple_tables(self):
@@ -298,15 +298,15 @@
 '''
         exp = 'before tables\n' \
             + _format_table([['table','1'],['still','1']]) \
-            + '\n\nbetween\n\n' \
+            + '\nbetween\n\n' \
             + _format_table([['table','2']]) \
-            + '\nbetween\n' \
+            + 'between\n' \
             + _format_table([['3.1.1','3.1.2','3.1.3'],
                              ['3.2.1','3.2.2','3.2.3'],
                              ['3.3.1','3.3.2','3.3.3']]) \
-            + '\n\n' \
+            + '\n' \
             + _format_table([['t','4'],['','']]) \
-            + '\n\nafter'
+            + '\nafter'
         assert_equals(html_format(inp), exp)

     def test_ragged_table(self):
@@ -334,7 +334,7 @@
             + _format_table([['<b>a</b>','<b>b</b>','<b>c</b>'],
                              ['<b>b</b>','x','y'],
                              ['<b>c</b>','z','']]) \
-            + '\n\n' \
+            + '\n' \
             + _format_table([['a','x <b>b</b> y','<b>b</b> <b>c</b>'],
                              ['*a','b*','']])
         assert_equals(html_format(inp), exp)
@@ -352,7 +352,7 @@
             + _format_table([['<i>a</i>','<i>b</i>','<i>c</i>'],
                              ['<i>b</i>','x','y'],
                              ['<i>c</i>','z','']]) \
-            + '\n\n' \
+            + '\n' \
             +  _format_table([['a','x <i>b</i> y','<i>b</i> <i>c</i>'],
                               ['_a','b_','']])
         assert_equals(html_format(inp), exp)
@@ -386,9 +386,9 @@
             assert_equals(html_format(hr + '  '), '<hr>')

     def test_hr_with_other_stuff_around(self):
-        for inp, exp in [('---\n-', '<hr>\n-'),
-                         ('xx\n---\nxx', 'xx\n<hr>\nxx'),
-                         ('xx\n\n------\n\nxx', 'xx\n\n<hr>\n\nxx')]:
+        for inp, exp in [('---\n-', '<hr>-'),
+                         ('xx\n---\nxx', 'xx\n<hr>xx'),
+                         ('xx\n\n------\n\nxx', 'xx\n\n<hr>\nxx')]:
             assert_equals(html_format(inp), exp)

     def test_not_hr(self):
@@ -401,9 +401,9 @@
 | t | a | b | l | e |
 ---
 '''[1:-1]
-        exp = '<hr>\n' \
+        exp = '<hr>' \
             + _format_table([['t','a','b','l','e']]) \
-            + '\n<hr>'
+            + '<hr>'
         assert_equals(html_format(inp), exp)


Reply via email to