2 new revisions:
Revision: f147174c3de8
Author: Janne Härkönen <[email protected]>
Date: Thu Feb 16 21:13:40 2012
Log: htmlformatter: support leading white space before |
http://code.google.com/p/robotframework/source/detail?r=f147174c3de8
Revision: 04ee153f7c95
Author: Janne Härkönen <[email protected]>
Date: Thu Feb 16 21:25:14 2012
Log: htmlutils: no newlines after pre blocks
http://code.google.com/p/robotframework/source/detail?r=04ee153f7c95
==============================================================================
Revision: f147174c3de8
Author: Janne Härkönen <[email protected]>
Date: Thu Feb 16 21:13:40 2012
Log: htmlformatter: support leading white space before |
http://code.google.com/p/robotframework/source/detail?r=f147174c3de8
Modified:
/src/robot/utils/htmlformatters.py
/utest/utils/test_htmlutils.py
=======================================
--- /src/robot/utils/htmlformatters.py Thu Feb 16 21:02:06 2012
+++ /src/robot/utils/htmlformatters.py Thu Feb 16 21:13:40 2012
@@ -165,7 +165,7 @@
class _PreformattedBlockFormatter(object):
- matcher = re.compile('\| .*').match
+ matcher = re.compile('\s*\| (.*)').match
def __init__(self):
self._rows = []
@@ -173,7 +173,8 @@
def add(self, line):
if self.matcher(line):
- self._rows.append(self._line_formatter.format(line[2:]))
+ text = self.matcher(line).group(1)
+ self._rows.append(self._line_formatter.format(text))
return True
return False
=======================================
--- /utest/utils/test_htmlutils.py Thu Feb 16 21:02:06 2012
+++ /utest/utils/test_htmlutils.py Thu Feb 16 21:13:40 2012
@@ -418,8 +418,8 @@
def test_additional_whitespace_is_preserved(self):
self._assert_preformatted('| some\t ', ' some\t ')
- def test_spaces_before_leading_pipe_cause_no_formatting(self):
- assert_equals(html_format(' | some'), ' | some')
+ def test_spaces_before_leading_pipe_are_ignored(self):
+ self._assert_preformatted(' | some', 'some')
def test_multiple_blocks(self):
assert_equals(html_format('| some\n| quote\nbetween\n| other
block\n\nafter'),
==============================================================================
Revision: 04ee153f7c95
Author: Janne Härkönen <[email protected]>
Date: Thu Feb 16 21:25:14 2012
Log: htmlutils: no newlines after pre blocks
http://code.google.com/p/robotframework/source/detail?r=04ee153f7c95
Modified:
/src/robot/utils/htmlformatters.py
/utest/utils/test_htmlutils.py
=======================================
--- /src/robot/utils/htmlformatters.py Thu Feb 16 21:13:40 2012
+++ /src/robot/utils/htmlformatters.py Thu Feb 16 21:25:14 2012
@@ -184,4 +184,4 @@
return ret
def _format_block(self):
- return '\n'.join(['<pre class="robotdoc">'] + self._rows +
['</pre>\n'])
+ return '\n'.join(['<pre class="robotdoc">'] + self._rows +
['</pre>'])
=======================================
--- /utest/utils/test_htmlutils.py Thu Feb 16 21:13:40 2012
+++ /utest/utils/test_htmlutils.py Thu Feb 16 21:25:14 2012
@@ -421,24 +421,22 @@
def test_spaces_before_leading_pipe_are_ignored(self):
self._assert_preformatted(' | some', 'some')
+
+ 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>after block')
+
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>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')
-
def test_block_line_with_other_formatting(self):
self._assert_preformatted('| _some_', '<i>some</i>')