5 new revisions:

Revision: 900464d7a329
Author:   Robot Framework Developers (robotframew...@gmail.com)
Date:     Mon May 28 06:39:24 2012
Log:      shebang
http://code.google.com/p/robotframework/source/detail?r=900464d7a329

Revision: 3018c5de2548
Author:   Robot Framework Developers (robotframew...@gmail.com)
Date:     Tue May 29 00:40:45 2012
Log: script for generating libdoc data for templates. also regenerated the ...
http://code.google.com/p/robotframework/source/detail?r=3018c5de2548

Revision: eba739ffe4df
Author:   Robot Framework Developers (robotframew...@gmail.com)
Date:     Tue May 29 01:06:59 2012
Log:      html_format: combine lines to paragraphs...
http://code.google.com/p/robotframework/source/detail?r=eba739ffe4df

Revision: 74c1411bfa0d
Author:   Robot Framework Developers (robotframew...@gmail.com)
Date:     Tue May 29 01:08:08 2012
Log:      libdoc.css: fix styles after recent html_format changes...
http://code.google.com/p/robotframework/source/detail?r=74c1411bfa0d

Revision: 42e210aefd0f
Author:   Robot Framework Developers (robotframew...@gmail.com)
Date:     Tue May 29 01:08:25 2012
Log:      merge
http://code.google.com/p/robotframework/source/detail?r=42e210aefd0f

==============================================================================
Revision: 900464d7a329
Author:   Robot Framework Developers (robotframew...@gmail.com)
Date:     Mon May 28 06:39:24 2012
Log:      shebang
http://code.google.com/p/robotframework/source/detail?r=900464d7a329

Modified:
 /src/robot/htmldata/testdata/create_testdoc_data.py

=======================================
--- /src/robot/htmldata/testdata/create_testdoc_data.py Tue Mar 6 01:30:27 2012 +++ /src/robot/htmldata/testdata/create_testdoc_data.py Mon May 28 06:39:24 2012
@@ -1,8 +1,9 @@
+#!/usr/bin/env python
+
 import sys
 from os.path import abspath, dirname, join, normpath
 import shutil

-
 BASE = dirname(abspath(__file__))
 ROOT = normpath(join(BASE, '..', '..', '..', '..'))
 DATADIR = join(ROOT, 'atest', 'testdata', 'misc')
@@ -12,6 +13,7 @@
 REAL_OUTPUT =  join(BASE, 'testdoc.js')

 sys.path.insert(0, SRC)
+
 from robot.testdoc import TestSuiteFactory, TestdocModelWriter

 with open(OUTPUT, 'w') as output:

==============================================================================
Revision: 3018c5de2548
Author:   Robot Framework Developers (robotframew...@gmail.com)
Date:     Tue May 29 00:40:45 2012
Log: script for generating libdoc data for templates. also regenerated the data.
http://code.google.com/p/robotframework/source/detail?r=3018c5de2548

Added:
 /src/robot/htmldata/testdata/create_libdoc_data.py
 /src/robot/htmldata/testdata/libdoc.js
 /src/robot/htmldata/testdata/libdoc.txt
Deleted:
 /src/robot/htmldata/testdata/libdocdata.js
Modified:
 /src/robot/htmldata/libdoc/libdoc.html
 /src/robot/libdocpkg/htmlwriter.py

=======================================
--- /dev/null
+++ /src/robot/htmldata/testdata/create_libdoc_data.py Tue May 29 00:40:45 2012
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+
+import sys
+from os.path import abspath, dirname, join, normpath
+
+BASE = dirname(abspath(__file__))
+SRC = normpath(join(BASE, '..', '..', '..', '..', 'src'))
+# must generate data next to testdoc.html to get relative sources correct
+INPUT = join(BASE, 'libdoc.txt')
+OUTPUT = join(BASE, 'libdoc.js')
+
+sys.path.insert(0, SRC)
+
+from robot.libdoc import LibraryDocumentation
+from robot.libdocpkg.htmlwriter import LibdocModelWriter
+
+with open(OUTPUT, 'w') as output:
+    libdoc = LibraryDocumentation(INPUT)
+    LibdocModelWriter(output, libdoc).write_data()
+
+print OUTPUT
+
=======================================
--- /dev/null
+++ /src/robot/htmldata/testdata/libdoc.js      Tue May 29 00:40:45 2012
@@ -0,0 +1,1 @@
+libdoc = {"doc":"<p><b>URL:</b> <a href=\"http://robotframework.org\";>http://robotframework.org</a></p><p><i>Image:</i> <img src=\"http://code.google.com/p/robotframework/logo?ext.png\"; title=\"http://code.google.com/p/robotframework/logo?ext.png\";></p><hr><table>\n<tr>\n<td><b>My</b></td>\n<td><b>Table</b></td>\n</tr>\n<tr>\n<td>1</td>\n<td>2</td>\n</tr>\n<tr>\n<td>foo</td>\n<td></td>\n</tr>\n</table><p>regular line</p><pre>\nblock formatted\n content\t\tand whitespaces\n</pre>","generated":"2012-05-28 17:27:14","inits":[],"keywords":[{"args":"","doc":"<hr><hr>","name":"HR","shortdoc":"---"},{"args":"","doc":"<p><img src=\"http://code.google.com/p/robotframework/logo?ext.png\"; title=\"http://code.google.com/p/robotframework/logo?ext.png\";></p><p>Images are <img src=\"http://code.google.com/p/robotframework/logo?ext.png\"; title=\"title\"> inside paragraphs. This one is also a link: <a href=\"http://code.google.com/p/robotframework/logo?ext.png\";><img src=\"http://code.google.com/p/robotframework/logo?ext.png\"; title=\"http://code.google.com/p/robotframework/logo?ext.png\";></a></p>","name":"Images","shortdoc":"http://code.google.com/p/robotframework/logo?ext.png"},{"args":"","doc":";<p>Hell, world!</p><p>Second paragraph <b>has formatting</b> and <a href=\"http://example.com\";>link</a>. This is still part of second paragraph.</p><p>Third paragraph is <i>short</i>.</p>","name":"Multiple paragraps","shortdoc":"Hell, world!"},{"args":"","doc":"<p>Hello, world!</p>","name":"One paragraph","shortdoc":"Hello, world!"},{"args":"","doc":"<pre>\nFirst block\nhas two lines\n</pre><pre>\nSecond has only one\n</pre>","name":"Preformatted","shortdoc":"| First block"},{"args":"","doc":"<table>\n<tr>\n<td><b>a</b></td>\n<td><b>b</b></td>\n<td><b>c</b></td>\n</tr>\n<tr>\n<td>1st</td>\n<td>table</td>\n<td>here</td>\n</tr>\n</table><table>\n<tr>\n<td>2nd</td>\n<td>table</td>\n<td>has</td>\n<td>only</td>\n<td>one</td>\n<td>row</td>\n</tr>\n</table>","name":"Tables alone","shortdoc":"| *a* | *b* | *c* |"}],"name":"libdoc","named_args":true,"scope":"","version":""};
=======================================
--- /dev/null
+++ /src/robot/htmldata/testdata/libdoc.txt     Tue May 29 00:40:45 2012
@@ -0,0 +1,54 @@
+*** Settings ***
+Documentation  *URL:*    http://robotframework.org
+...
+... _Image:_ http://code.google.com/p/robotframework/logo?ext.png
+...
+...            ----------------------------
+...
+...            | *My* | *Table* |
+...            | 1    | 2       |
+...            | foo  |
+...            regular line
+...            | block formatted
+...            | \ \ content\t\tand whitespaces
+
+
+*** Keywords ***
+One paragraph
+    [Documentation]    Hello, world!
+
+Multiple paragraps
+    [Documentation]    Hell, world!
+    ...
+    ...    Second paragraph *has formatting* and [http://example.com|link].
+    ...    This is still part of second paragraph.
+    ...
+    ...    Third paragraph is _short_.
+
+Tables alone
+    [Documentation]
+    ...    | *a* | *b*   | *c*  |
+    ...    | 1st | table | here |
+    ...
+    ...    | 2nd | table | has | only | one | row |
+
+Preformatted
+    [Documentation]
+    ...    | First block
+    ...    | has two lines
+    ...
+    ...    | Second has only one
+
+HR
+    [Documentation]
+    ...    ---
+    ...
+    ...    ---------------
+
+Images
+    [Documentation]
+    ...    http://code.google.com/p/robotframework/logo?ext.png
+    ...
+ ... Images are [http://code.google.com/p/robotframework/logo?ext.png|title]
+    ...    inside paragraphs. This one is also a link:
+ ... [http://code.google.com/p/robotframework/logo?ext.png| http://code.google.com/p/robotframework/logo?ext.png]
=======================================
--- /src/robot/htmldata/testdata/libdocdata.js  Tue Mar  6 01:30:27 2012
+++ /dev/null
@@ -1,15 +0,0 @@
-libdoc = {
-    name: 'Test Library',
-    doc: 'This is library doc with <i>some </i>formatting <b>Kekkonen</b>',
-    version: '1.0',
-    scope: 'global',
-    named_args: true,
-    generated: 'some time',
-    inits:  [{args: 'arg, default=value', doc:'<b>A doc</b>'}],
- keywords: [{name: 'My kw', args:'arg, default=value', shortdoc:'A doc', doc:'<b>A doc</b>'}, - {name: 'Your kw', args:'*args', shortdoc:'*B doc trthiohiofdg* gdhfsioghsdifo', doc:'<b>B doc trthiohiofdg</b> gdhfsioghsdifo<br> fdasfasd'}]
-
-}
-
-
-
=======================================
--- /src/robot/htmldata/libdoc/libdoc.html      Fri May 25 04:04:45 2012
+++ /src/robot/htmldata/libdoc/libdoc.html      Tue May 29 00:40:45 2012
@@ -11,7 +11,7 @@
 <link rel="stylesheet" type="text/css" href="print.css" media="print">
 <script type="text/javascript" src="../lib/jquery.min.js"></script>
 <script type="text/javascript" src="../lib/jquery.tmpl.min.js"></script>
-<!-- JS MODEL --><script type="text/javascript" src="../testdata/libdocdata.js"></script> +<!-- JS MODEL --><script type="text/javascript" src="../testdata/libdoc.js"></script>
 <title></title>
 </head>
 <body>
=======================================
--- /src/robot/libdocpkg/htmlwriter.py  Tue Mar  6 03:20:24 2012
+++ /src/robot/libdocpkg/htmlwriter.py  Tue May 29 00:40:45 2012
@@ -34,10 +34,10 @@

     def write(self, line):
         self._output.write('<script type="text/javascript">' + os.linesep)
-        self._write_data()
+        self.write_data()
         self._output.write('</script>' + os.linesep)

-    def _write_data(self):
+    def write_data(self):
         formatter = DocFormatter(self._libdoc.keywords)
         libdoc = JsonConverter(formatter).convert(self._libdoc)
         JsonWriter(self._output).write_json('libdoc = ', libdoc)

==============================================================================
Revision: eba739ffe4df
Author:   Robot Framework Developers (robotframew...@gmail.com)
Date:     Tue May 29 01:06:59 2012
Log:      html_format: combine lines to paragraphs

Update issue 1135
Status: Started
Owner: janne.t.harkonen
Cc: pekka.klarck
Lines are now combined to paragraphs.

TODO:
- handle lists and footnotes separately
- clean-up code
- fix libdoc and log/report styles
- documentation
http://code.google.com/p/robotframework/source/detail?r=eba739ffe4df

Modified:
 /src/robot/utils/htmlformatters.py
 /utest/reporting/test_jsmodelbuilders.py
 /utest/testdoc/test_jsonconverter.py
 /utest/utils/test_htmlutils.py

=======================================
--- /src/robot/utils/htmlformatters.py  Fri May 25 03:58:41 2012
+++ /src/robot/utils/htmlformatters.py  Tue May 29 01:06:59 2012
@@ -76,7 +76,7 @@
         self._collectors = (BlockCollector(self._rows, TableFormatter()),
BlockCollector(self._rows, PreformattedFormatter()),
                             LineCollector(self._rows, RulerFormatter()),
-                            LineCollector(self._rows, LineFormatter()))
+ ParagraphCollector(self._rows, ParagraphFormatter()))
         self._current_block = None

     def format(self, text):
@@ -90,13 +90,17 @@
             self._current_block.add(line)
             return
         self._end_current_block()
+        if not line:
+            return
         collector = self._find_collector(line)
         collector.add(line)
-        self._current_block = collector if collector.is_block else None
+        if collector.is_block:
+            self._current_block = collector

     def _end_current_block(self):
         if self._current_block:
             self._current_block.end()
+            self._current_block = None

     def _find_collector(self, line):
         for collector in self._collectors:
@@ -109,7 +113,9 @@
     def __init__(self, result, formatter):
         self._result = result
         self._formatter = formatter
-        self.handles = formatter.handles
+
+    def handles(self, line):
+        return self._formatter.handles(line)


 class LineCollector(_Collector):
@@ -135,6 +141,18 @@
         self._lines = []


+class ParagraphCollector(BlockCollector):
+
+    def handles(self, line):
+        # TODO: Should get list of possible formatters dynamically
+ formatters = RulerFormatter(), TableFormatter(), PreformattedFormatter()
+        if any(formatter.handles(line) for formatter in formatters):
+            return False
+        if line:
+            return True
+        return not self._lines
+
+
 class LineFormatter(object):
     handles = lambda self, line: True
     newline = '\n'
@@ -180,6 +198,17 @@
         return '<hr>'


+class ParagraphFormatter(object):
+    _format_line = LineFormatter().format
+
+    def pre_format(self, line):
+        return line
+
+    def format(self, lines):
+        # TODO: Join before or after format?
+ return '<p>%s</p>' % ' '.join(self._format_line(l).strip() for l in lines)
+
+
 class TableFormatter(object):
     handles = re.compile('^\s*\| (.* |)\|\s*$').match
     _line_splitter = re.compile(' \|(?= )')
=======================================
--- /utest/reporting/test_jsmodelbuilders.py    Sun May 13 23:37:55 2012
+++ /utest/reporting/test_jsmodelbuilders.py    Tue May 29 01:06:59 2012
@@ -33,7 +33,7 @@
     def test_suite_with_values(self):
suite = TestSuite('', 'Name', 'Doc', {'m1': 'v1', 'M2': 'V2'}, 'Message',
                           '20111204 19:00:00.000', '20111204 19:00:42.001')
-        self._verify_suite(suite, 'Name', 'Doc', ('m1', 'v1', 'M2', 'V2'),
+ self._verify_suite(suite, 'Name', 'Doc', ('m1', '<p>v1</p>', 'M2', '<p>V2</p>'),
                            message='Message', start=0, elapsed=42001)

     def test_relative_source(self):
@@ -46,7 +46,7 @@
         self._verify_suite(TestSuite(name='*xxx*', doc='*bold* <&>',
                                      metadata={'*x*': '*b*', '<': '>'}),
                            name='*xxx*', doc='<b>bold</b> &lt;&amp;&gt;',
-                           metadata=('*x*', '<b>b</b>', '<', '&gt;'))
+ metadata=('*x*', '<p><b>b</b></p>', '<', '<p>&gt;</p>'))

     def test_default_test(self):
         self._verify_test(TestCase())
@@ -139,6 +139,7 @@
suites=(), tests=(), keywords=(), stats=(0, 0, 0, 0)):
         status = (status, start, elapsed, message) \
                 if message else (status, start, elapsed)
+        doc = '<p>%s</p>' % doc if doc else ''
         return self._build_and_verify(SuiteBuilder, suite, name, source,
                                       relsource, doc, metadata, status,
                                       suites, tests, keywords, stats)
@@ -150,12 +151,14 @@
status=0, message='', start=None, elapsed=0, keywords=()):
         status = (status, start, elapsed, message) \
                 if message else (status, start, elapsed)
+        doc = '<p>%s</p>' % doc if doc else ''
         return self._build_and_verify(TestBuilder, test, name, timeout,
critical, doc, tags, status, keywords)

def _verify_keyword(self, keyword, type=0, name='', doc='', args='', timeout='', status=0, start=None, elapsed=0, keywords=(), messages=()):
         status = (status, start, elapsed)
+        doc = '<p>%s</p>' % doc if doc else ''
return self._build_and_verify(KeywordBuilder, keyword, type, name, timeout, doc, args, status, keywords, messages)

=======================================
--- /utest/testdoc/test_jsonconverter.py        Fri May 25 03:58:41 2012
+++ /utest/testdoc/test_jsonconverter.py        Tue May 29 01:06:59 2012
@@ -1,5 +1,4 @@
 import unittest
-import os
 from os.path import abspath, dirname, join, normpath

 from robot.utils.asserts import assert_equals
@@ -29,8 +28,8 @@
                      id='s1',
                      name='Misc',
                      fullName='Misc',
-                     doc='My doc',
-                     metadata=[('1', '2'), ('abc', '123')],
+                     doc='<p>My doc</p>',
+                     metadata=[('1', '<p>2</p>'), ('abc', '<p>123</p>')],
                      numberOfTests=163,
                      tests=[],
                      keywords=[])
@@ -79,8 +78,8 @@
                      id='s1-s1',
                      name='Normal',
                      fullName='Normal & Pass And Fail.Normal',
-                     doc='Normal test cases',
-                     metadata=[('Something', 'My Value')],
+                     doc='<p>Normal test cases</p>',
+                     metadata=[('Something', '<p>My Value</p>')],
                      numberOfTests=2)
         test_convert(suite['suites'][1],
                      source=normpath(join(DATADIR, 'pass_and_fail.html')),
@@ -88,7 +87,7 @@
                      id='s1-s2',
                      name='Pass And Fail',
                      fullName='Normal & Pass And Fail.Pass And Fail',
-                     doc='Some tests here',
+                     doc='<p>Some tests here</p>',
                      metadata=[],
                      numberOfTests=2)

@@ -111,7 +110,7 @@
                      id='s1-s10-t1',
                      name='Default Test Timeout',
                      fullName='Misc.Timeouts.Default Test Timeout',
-                     doc='I have a timeout',
+                     doc='<p>I have a timeout</p>',
                      tags=[],
                      timeout='1 minute 42 seconds')

@@ -185,9 +184,7 @@
     def test_suite_documentation(self):
         test_convert(self.suite,
                      doc='''\
-We have <i>formatting</i> and &lt;escaping&gt;.
-
-<table>
+<p>We have <i>formatting</i> and &lt;escaping&gt;.</p><table>
 <tr>
 <td><b>Name</b></td>
 <td><b>URL</b></td>
@@ -204,13 +201,13 @@

     def test_suite_metadata(self):
         test_convert(self.suite,
-                     metadata=[('CLI', '<b>bold</b>'),
- ('Escape', 'this is &lt;b&gt;not bold&lt;/b&gt;'),
-                               ('Format', 'this is <b>bold</b>')])
+                     metadata=[('CLI', '<p><b>bold</b></p>'),
+ ('Escape', '<p>this is &lt;b&gt;not bold&lt;/b&gt;</p>'),
+                               ('Format', '<p>this is <b>bold</b></p>')])

     def test_test_documentation(self):
         test_convert(self.suite['tests'][0],
- doc='<b>I</b> can haz <i>formatting</i> &amp; &lt;escaping&gt;!!') + doc='<p><b>I</b> can haz <i>formatting</i> &amp; &lt;escaping&gt;!!</p>')

     def test_no_extra_escaping(self):
         # jQuery handles escaping by default so we should not do it
=======================================
--- /utest/utils/test_htmlutils.py      Fri May 25 03:58:41 2012
+++ /utest/utils/test_htmlutils.py      Tue May 29 01:06:59 2012
@@ -13,6 +13,7 @@
         exp_escape = str(inp)
     if exp_format is None:
         exp_format = exp_escape
+    exp_format = '<p>%s</p>' % exp_format.replace('\n', ' ')
     escape = html_escape(inp)
     format = html_format(inp)
     assert_equals(escape, exp_escape,
@@ -20,26 +21,32 @@
     assert_equals(format, exp_format,
'FORMAT:\n%r =!\n%r' % (format, exp_format), values=False)

-def assert_escape(inp, exp):
-    assert_equals(html_escape(inp), exp)
-
-def assert_format(inp, exp=None):
+def assert_format(inp, exp=None, p=False):
     exp = exp if exp is not None else inp
+    if p:
+        exp = '<p>%s</p>' % exp
     assert_equals(html_format(inp), exp)

-
-class TestHtmlEscapeAndFormat(unittest.TestCase):
+def assert_escape(inp, exp=None):
+    exp = exp if exp is not None else inp
+    assert_equals(html_escape(inp), exp)
+
+
+class TestHtmlEscape(unittest.TestCase):

     def test_no_changes(self):
         for inp in ['', 'nothing to change']:
-            assert_escape_and_format(inp)
+            assert_escape(inp)

     def test_newlines_and_paragraphs(self):
         for inp in ['Text on first line.\nText on second line.',
                     '1 line\n2 line\n3 line\n4 line\n5 line\n',
                     'Para 1 line 1\nP1 L2\n\nP2 L1\nP2 L1\n\nP3 L1\nP3 L2',
                      'Multiple empty lines\n\n\n\n\nbetween these lines']:
-            assert_escape_and_format(inp, inp, inp.rstrip())
+            assert_escape(inp)
+
+
+class TestEntities(unittest.TestCase):

     def test_entities(self):
         for char, entity in [('<','&lt;'), ('>','&gt;'), ('&','&amp;')]:
@@ -112,20 +119,49 @@
             assert_escape_and_format(*items)


+class TestFormatParagraph(unittest.TestCase):
+
+    def test_empty(self):
+        assert_format('', '')
+
+    def test_single_line(self):
+        assert_format('foo', '<p>foo</p>')
+
+    def test_multi_line(self):
+        assert_format('foo\nbar', '<p>foo bar</p>')
+
+    def test_leading_and_trailing_spaces(self):
+        assert_format('  foo  \n  bar', '<p>foo bar</p>')
+
+    def test_multiple_paragraphs(self):
+        assert_format('P\n1\n\nP 2', '<p>P 1</p><p>P 2</p>')
+
+    def test_leading_empty_line(self):
+        assert_format('\nP', '<p>P</p>')
+
+    def test_other_formatted_content_before_paragraph(self):
+        assert_format('---\nP', '<hr><p>P</p>')
+        assert_format('| PRE \nP', '<pre>\nPRE\n</pre><p>P</p>')
+
+    def test_other_formatted_content_after_paragraph(self):
+        assert_format('P\n---', '<p>P</p><hr>')
+        assert_format('P\n| PRE \n', '<p>P</p><pre>\nPRE\n</pre>')
+
+
 class TestHtmlFormatBoldAndItalic(unittest.TestCase):

     def test_one_word_bold(self):
         for inp, exp in [('*bold*', '<b>bold</b>'),
                          ('*b*', '<b>b</b>'),
                          ('*many bold words*', '<b>many bold words</b>'),
-                         (' *bold*', ' <b>bold</b>'),
-                         ('*bold* ', '<b>bold</b> '),
+                         (' *bold*', '<b>bold</b>'),
+                         ('*bold* ', '<b>bold</b>'),
                          ('xx *bold*', 'xx <b>bold</b>'),
                          ('*bold* xx', '<b>bold</b> xx'),
                          ('***', '<b>*</b>'),
                          ('****', '<b>**</b>'),
                          ('*****', '<b>***</b>')]:
-            assert_format(inp, exp)
+            assert_format(inp, exp, p=True)

     def test_multiple_word_bold(self):
         for inp, exp in [('*bold* *b* not bold *b3* not',
@@ -134,84 +170,84 @@
'not b <b>this is b</b> <b>more b words here</b>'),
                          ('*** not *b* ***',
                           '<b>*</b> not <b>b</b> <b>*</b>')]:
-            assert_format(inp, exp)
+            assert_format(inp, exp, p=True)

     def test_bold_on_multiple_lines(self):
         inp = 'this is *bold*\nand *this*\nand *that*'
-        exp = 'this is <b>bold</b>\nand <b>this</b>\nand <b>that</b>'
-        assert_format(inp, exp)
-        assert_format('this *does not\nwork*')
+        exp = 'this is <b>bold</b> and <b>this</b> and <b>that</b>'
+        assert_format(inp, exp, p=True)
+        assert_format('this *works\ntoo!*', 'this *works too!*', p=True)

     def test_not_bolded_if_no_content(self):
-        assert_format('**')
+        assert_format('**', p=True)

     def test_asterisk_in_the_middle_of_word_is_ignored(self):
         for inp, exp in [('aa*notbold*bbb', None),
                          ('*bold*still bold*', '<b>bold*still bold</b>'),
                          ('a*not*b c*still not*d', None),
('*b*b2* -*n*- *b3*', '<b>b*b2</b> -*n*- <b>b3</b>')]:
-            assert_format(inp, exp)
+            assert_format(inp, exp, p=True)

     def test_asterisk_alone_does_not_start_bolding(self):
         for inp, exp in [('*', None),
-                         (' * ', None),
+                         (' * ', '*'),
                          ('* not *', None),
-                         (' * not * ', None),
+                         (' * not * ', '* not *'),
                          ('* not*', None),
                          ('*bold *', '<b>bold </b>'),
                          ('* *b* *', '* <b>b</b> *'),
                          ('*bold * not*', '<b>bold </b> not*'),
                          ('*bold * not*not* *b*',
                           '<b>bold </b> not*not* <b>b</b>')]:
-            assert_format(inp, exp)
+            assert_format(inp, exp, p=True)

     def test_one_word_italic(self):
         for inp, exp in [('_italic_', '<i>italic</i>'),
                          ('_i_', '<i>i</i>'),
('_many italic words_', '<i>many italic words</i>'),
-                         (' _italic_', ' <i>italic</i>'),
-                         ('_italic_ ', '<i>italic</i> '),
+                         (' _italic_', '<i>italic</i>'),
+                         ('_italic_ ', '<i>italic</i>'),
                          ('xx _italic_', 'xx <i>italic</i>'),
                          ('_italic_ xx', '<i>italic</i> xx')]:
-            assert_format(inp, exp)
+            assert_format(inp, exp, p=True)

     def test_multiple_word_italic(self):
         for inp, exp in [('_italic_ _i_ not italic _i3_ not',
'<i>italic</i> <i>i</i> not italic <i>i3</i> not'),
                          ('not i _this is i_ _more i words here_',
'not i <i>this is i</i> <i>more i words here</i>')]:
-            assert_format(inp, exp)
+            assert_format(inp, exp, p=True)

     def test_not_italiced_if_no_content(self):
-        assert_format('__')
+        assert_format('__', p=True)

     def test_not_italiced_many_underlines(self):
         for inp in ['___', '____', '_________', '__len__']:
-            assert_format(inp)
+            assert_format(inp, p=True)

     def test_underscore_in_the_middle_of_word_is_ignored(self):
         for inp, exp in [('aa_notitalic_bbb', None),
                          ('_ital_still ital_', '<i>ital_still ital</i>'),
                          ('a_not_b c_still not_d', None),
('_b_b2_ -_n_- _b3_', '<i>b_b2</i> -_n_- <i>b3</i>')]:
-            assert_format(inp, exp)
+            assert_format(inp, exp, p=True)

     def test_underscore_alone_does_not_start_italicing(self):
         for inp, exp in [('_', None),
-                         (' _ ', None),
+                         (' _ ', '_'),
                          ('_ not _', None),
-                         (' _ not _ ', None),
+                         (' _ not _ ', '_ not _'),
                          ('_ not_', None),
                          ('_italic _', '<i>italic </i>'),
                          ('_ _b_ _', '_ <i>b</i> _'),
                          ('_italic _ not_', '<i>italic </i> not_'),
                          ('_italic _ not_not_ _b_',
                           '<i>italic </i> not_not_ <i>b</i>')]:
-            assert_format(inp, exp)
+            assert_format(inp, exp, p=True)

     def test_bold_and_italic(self):
         for inp, exp in [('*b* _i_', '<b>b</b> <i>i</i>')]:
-            assert_format(inp, exp)
+            assert_format(inp, exp, p=True)

     def test_bold_and_italic_works_with_punctuation_marks(self):
         for bef, aft in [('(',''), ('"',''), ("'",''), ('(\'"(',''),
@@ -220,7 +256,7 @@
             for inp, exp in [('*bold*','<b>bold</b>'),
                              ('_ital_','<i>ital</i>'),
                              ('*b* _i_','<b>b</b> <i>i</i>')]:
-                assert_format(bef + inp + aft, bef + exp + aft)
+                assert_format(bef + inp + aft, bef + exp + aft, p=True)

     def test_bold_italic(self):
         for inp, exp in [('_*bi*_', '<i><b>bi</b></i>'),
@@ -229,55 +265,60 @@
                          ('_*bi_ b*', '<i><b>bi</i> b</b>'),
                          ('_i *bi*_', '<i>i <b>bi</b></i>'),
                          ('*b _bi*_', '<b>b <i>bi</b></i>')]:
-            assert_format(inp, exp)
+            assert_format(inp, exp, p=True)


 class TestHtmlFormatCustomLinks(unittest.TestCase):

     def test_text_with_text(self):
-        assert_format('[link.html|title]', '<a href="link.html">title</a>')
-        assert_format('[link|t|i|t|l|e]', '<a href="link">t|i|t|l|e</a>')
+ assert_format('[link.html|title]', '<a href="link.html">title</a>', p=True) + assert_format('[link|t|i|t|l|e]', '<a href="link">t|i|t|l|e</a>', p=True)

     def test_text_with_image(self):
         assert_format('[link|img.png]',
- '<a href="link"><img src="img.png" title="link"></a>') + '<a href="link"><img src="img.png" title="link"></a>',
+                      p=True)

     def test_image_with_text(self):
- assert_format('[img.png|title]', '<img src="img.png" title="title">')
-        assert_format('[img.png|]', '<img src="img.png" title="img.png">')
+ assert_format('[img.png|title]', '<img src="img.png" title="title">', p=True) + assert_format('[img.png|]', '<img src="img.png" title="img.png">', p=True)

     def test_image_with_image(self):
         assert_format('[x.png|thumb.png]',
- '<a href="x.png"><img src="thumb.png" title="x.png"></a>') + '<a href="x.png"><img src="thumb.png" title="x.png"></a>',
+                      p=True)

     def test_link_is_required(self):
-        assert_format('[|]', '[|]')
+        assert_format('[|]', '[|]', p=True)

     def test_whitespace_is_strip(self):
- assert_format('[ link.html | title words ]', '<a href="link.html">title words</a>')
+        assert_format('[ link.html  | title words  ]',
+                      '<a href="link.html">title words</a>', p=True)

     def test_url_and_link(self):
         assert_format('http://url [link|title]',
- '<a href="http://url";>http://url</a> <a href="link">title</a>') + '<a href="http://url";>http://url</a> <a href="link">title</a>',
+                      p=True)

     def test_link_as_url(self):
- assert_format('[http://url|title]', '<a href="http://url";>title</a>') + assert_format('[http://url|title]', '<a href="http://url";>title</a>', p=True)

     def test_multiple_links(self):
         assert_format('start [link|img.png] middle [link.html|title] end',
'start <a href="link"><img src="img.png" title="link"></a> '
-                      'middle <a href="link.html">title</a> end')
+                      'middle <a href="link.html">title</a> end', p=True)

     def test_multiple_links_and_urls(self):
         assert_format('[L|T]ftp://u[X|Y][http://u]',
- '<a href="L">T</a><a href="ftp://u";>ftp://u</a><a href="X">Y</a>[<a href="http://u";>http://u</a>]')
+                      '<a href="L">T</a><a href="ftp://u";>ftp://u</a>'
+ '<a href="X">Y</a>[<a href="http://u";>http://u</a>]', p=True)

     def test_escaping(self):
-        assert_format('["|<&>]', '<a href="&quot;">&lt;&amp;&gt;</a>')
- assert_format('[<".jpg|">]', '<img src="&lt;&quot;.jpg" title="&quot;&gt;">') + assert_format('["|<&>]', '<a href="&quot;">&lt;&amp;&gt;</a>', p=True) + assert_format('[<".jpg|">]', '<img src="&lt;&quot;.jpg" title="&quot;&gt;">', p=True)

     def test_formatted_link(self):
- assert_format('*[link.html|title]*', '<b><a href="link.html">title</a></b>') + assert_format('*[link.html|title]*', '<b><a href="link.html">title</a></b>', p=True)

     def test_link_in_table(self):
         assert_format('| [link.html|title] |', '''\
@@ -338,9 +379,9 @@

  after table
 '''
-        exp = 'before table\n' \
+        exp = '<p>before table</p>' \
             + _format_table([['in','table'],['still','in']]) \
-            + '\n after table'
+            + '<p>after table</p>'
         assert_format(inp, exp)

     def test_multiple_tables(self):
@@ -361,17 +402,16 @@

 after
 '''
-        exp = 'before tables\n' \
+        exp = '<p>before tables</p>' \
             + _format_table([['table','1'],['still','1']]) \
-            + '\nbetween\n\n' \
+            + '<p>between</p>' \
             + _format_table([['table','2']]) \
-            + 'between\n' \
+            + '<p>between</p>' \
             + _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' \
             + _format_table([['t','4'],['','']]) \
-            + '\nafter'
+            + '<p>after</p>'
         assert_format(inp, exp)

     def test_ragged_table(self):
@@ -380,8 +420,7 @@
 | 2.1 |
 | 3.1 | 3.2 |
 '''
-        exp = '\n' \
-            + _format_table([['1.1','1.2','1.3'],
+        exp = _format_table([['1.1','1.2','1.3'],
                              ['2.1','',''],
                              ['3.1','3.2','']])
         assert_format(inp, exp)
@@ -395,11 +434,9 @@
 | a   | x *b* y | *b* *c* |
 | *a  | b*      |         |
 '''
-        exp = '\n' \
-            + _format_table([['<b>a</b>','<b>b</b>','<b>c</b>'],
+        exp = _format_table([['<b>a</b>','<b>b</b>','<b>c</b>'],
                              ['<b>b</b>','x','y'],
                              ['<b>c</b>','z','']]) \
-            + '\n' \
             + _format_table([['a','x <b>b</b> y','<b>b</b> <b>c</b>'],
                              ['*a','b*','']])
         assert_format(inp, exp)
@@ -413,11 +450,9 @@
 | a   | x _b_ y | _b_ _c_ |
 | _a  | b_      |         |
 '''
-        exp = '\n' \
-            + _format_table([['<i>a</i>','<i>b</i>','<i>c</i>'],
+        exp = _format_table([['<i>a</i>','<i>b</i>','<i>c</i>'],
                              ['<i>b</i>','x','y'],
                              ['<i>c</i>','z','']]) \
-            + '\n' \
             +  _format_table([['a','x <i>b</i> y','<i>b</i> <i>c</i>'],
                               ['_a','b_','']])
         assert_format(inp, exp)
@@ -428,8 +463,7 @@
 | _b_ |  x  |  y  |
 | _c_ |  z  | *b* _i_ |
 '''
-        exp = '\n' \
-            + _format_table([['<b>a</b>','<b>b</b>','<b>c</b>'],
+        exp = _format_table([['<b>a</b>','<b>b</b>','<b>c</b>'],
                              ['<i>b</i>','x','y'],
                              ['<i>c</i>','z','<b>b</b> <i>i</i>']])
         assert_format(inp, exp)
@@ -439,8 +473,7 @@
 | 1 | http://one |
 | 2 | ftp://two/ |
 '''
-        exp = '\n' \
-            + _format_table([['1','<a href="http://one";>http://one</a>'],
+        exp = _format_table([['1','<a href="http://one";>http://one</a>'],
                              ['2','<a href="ftp://two/";>ftp://two/</a>']])
         assert_format(inp, exp)

@@ -454,14 +487,14 @@
             assert_format(hr + '  ', '<hr>')

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

     def test_not_hr(self):
-        for inp in ['-', '--', ' ---', ' --- ', '...---...', '===']:
-            assert_format(inp)
+        for inp in ['-', '--', ' --- ', '...---...', '===']:
+            assert_format(inp, inp.strip(), p=True)

     def test_hr_before_and_after_table(self):
         inp = '''
@@ -494,18 +527,16 @@

     def test_block_mixed_with_other_content(self):
         assert_format('before block:\n| some\n| quote\nafter block',
- 'before block:\n<pre>\nsome\nquote\n</pre>after block') + '<p>before block:</p><pre>\nsome\nquote\n</pre><p>after block</p>')

     def test_multiple_blocks(self):
assert_format('| some\n| quote\nbetween\n| other block\n\nafter', '''\
 <pre>
 some
 quote
-</pre>between
-<pre>
+</pre><p>between</p><pre>
 other block
-</pre>
-after''')
+</pre><p>after</p>''')

     def test_block_line_with_other_formatting(self):
         self._assert_preformatted('| _some_', '<i>some</i>')

==============================================================================
Revision: 74c1411bfa0d
Author:   Robot Framework Developers (robotframew...@gmail.com)
Date:     Tue May 29 01:08:08 2012
Log:      libdoc.css: fix styles after recent html_format changes

Update issue 1135
libdoc.css updated. Need to still update log/report styles.
http://code.google.com/p/robotframework/source/detail?r=74c1411bfa0d

Modified:
 /src/robot/htmldata/libdoc/libdoc.css

=======================================
--- /src/robot/htmldata/libdoc/libdoc.css       Fri May 25 04:04:45 2012
+++ /src/robot/htmldata/libdoc/libdoc.css       Tue May 29 01:08:08 2012
@@ -20,7 +20,7 @@
     color: black;
 }
 div.shortcuts {
-    margin: 1em 0em;
+    margin: 1em 0;
     font-size: 0.9em;
 }
 div.shortcuts a {
@@ -80,11 +80,14 @@
     font-style: italic;
 }
 /* Documentation formatting */
-.doc {
-    white-space: pre-wrap;
-}
-.doc table, .doc pre, .doc hr {
-    margin: 0.5em 1em;
+.doc > * {
+    margin: 1em 1em 0 1em;
+}
+.doc > p {
+    margin: 1em 0 0 0;
+}
+.doc > *:first-child {
+    margin-top: 0;
 }
 .doc table {
     border: 1px solid gray;
@@ -93,7 +96,7 @@
     empty-cells: show;
     font-size: 0.85em;
 }
-.doc td {
+.doc table td {
     border: 1px solid gray;
     padding: 0.1em 0.3em;
     height: 1.2em;
@@ -105,6 +108,9 @@
 .doc img {
     border: 1px solid gray;
 }
+.doc a img {
+    border: 1px solid #c30;
+}
 .doc hr {
     background: gray;
     height: 1px;

==============================================================================
Revision: 42e210aefd0f
Author:   Robot Framework Developers (robotframew...@gmail.com)
Date:     Tue May 29 01:08:25 2012
Log:      merge
http://code.google.com/p/robotframework/source/detail?r=42e210aefd0f


Reply via email to