# HG changeset patch # User RogerHaase # Date 1434575528 25200 # Node ID c246300616f17fde51b769dcc19d346895a1202f # Parent 395ac7691975b55b12a1c7887e2ed5f4058d554f html content before div is not rendered, fixes #157 diff -r 395ac7691975 -r c246300616f1 MoinMoin/converter/_tests/test_html_in.py --- a/MoinMoin/converter/_tests/test_html_in.py Wed Jun 17 13:51:48 2015 -0700 +++ b/MoinMoin/converter/_tests/test_html_in.py Wed Jun 17 14:12:08 2015 -0700 @@ -69,16 +69,24 @@ #

First Paragraph


Second Paragraph

'/page/body/div/separator'), ('

Test

', - #

Test

- '/page/body[p="Test"]'), + #

Test

+ '/page/body/div[p="Test"]'), # Test attributes conversion ('

Test

', - #

Test

- '/page/body/p[@html:class="class text"][@html:style="style text"][@html:title="title text"][text()="Test"]'), + #

Test

+ '/page/body/div/p[@html:class="class text"][@html:style="style text"][@html:title="title text"][text()="Test"]'), # Test id ('

Textstrong

', - #

Textstrong

- '/page/body/p[@xml:id="first"][text()="Text"]/strong[@xml:id="second"][text()="strong"]'), + #

Textstrong

+ '/page/body/div/p[@xml:id="first"][text()="Text"]/strong[@xml:id="second"][text()="strong"]'), + # test trailing div part 1 + ('

Paragraph

Div
', + #

paragraph

div
+ '/page/body[p="Paragraph"]'), + # test trailing div part 2 + ('

Paragraph

Div
', + #

paragraph

div
+ '/page/body/div/text()="Div"'), ] for i in data: yield (self.do, ) + i @@ -240,7 +248,7 @@ '/page/body/div/list[@item-label-generate="unordered"]/list-item[list-item-body="Item"]'), ('
  • Item 1
  • Item 2
  • Item 3
', #
Item 1Item 2Item 3
- '/page/body/list[@item-label-generate="unordered"][list-item[1]/list-item-body[text()="Item 1"]][list-item[2]/list-item-body[text()="Item 2"]][list-item[3]/list-item-body[text()="Item 3"]]'), + '/page/body/div/list[@item-label-generate="unordered"][list-item[1]/list-item-body[text()="Item 1"]][list-item[2]/list-item-body[text()="Item 2"]][list-item[3]/list-item-body[text()="Item 3"]]'), ] for i in data: yield (self.do, ) + i diff -r 395ac7691975 -r c246300616f1 MoinMoin/converter/_tests/test_html_in_out.py --- a/MoinMoin/converter/_tests/test_html_in_out.py Wed Jun 17 13:51:48 2015 -0700 +++ b/MoinMoin/converter/_tests/test_html_in_out.py Wed Jun 17 14:12:08 2015 -0700 @@ -65,9 +65,9 @@ ('

First Line
Second line

', '/div/div/p[1]/br'), ('

Test

', - '/div[p="Test"]'), + '/div/div[p="Test"]'), ('

Test

', - '/div/p[@class="class"][@title="title"][text()="Test"]'), + '/div/div/p[@class="class"][@title="title"][text()="Test"]'), ] for i in data: yield(self.do, ) + i @@ -177,12 +177,12 @@ ('
  • Item
  • ', '/div/div/ul[li="Item"]'), ('
    • Item 1
    • Pouet

    • Item 2
    • Item 3
    ', - '/div/ul[li[1]="Item 1"][li[2]="Item 2"][li[3]="Item 3"]'), + '/div/div/ul[li[1]="Item 1"][li[2]="Item 2"][li[3]="Item 3"]'), # Test for bug with line return and spaces ('
    • \n Item 1
    • \n
    • \n Item 2
    • \n
    • \n Item 3
    • \n
    ', - '/div/ul[li[1]="\n Item 1"][li[2]="\n Item 2"][li[3]="\n Item 3"]'), + '/div/div/ul[li[1]="\n Item 1"][li[2]="\n Item 2"][li[3]="\n Item 3"]'), ('
    1. \n Item 1
    2. \n
    3. \n Item 2
    4. \n
    5. \n Item 3
    6. \n
    ', - '/div/ol[li[1]="\n Item 1"][li[2]="\n Item 2"][li[3]="\n Item 3"]'), + '/div/div/ol[li[1]="\n Item 1"][li[2]="\n Item 2"][li[3]="\n Item 3"]'), ] for i in data: yield (self.do, ) + i @@ -207,7 +207,7 @@ '/div/div/table/tbody/tr/td[text()="Cell"][@rowspan="2"]'), # Test for bug with newline between cell ('
    \n\n\n\n\n\n\n\n\n\n\n
    \n Cell 1:1\n Cell 1:2
    \n Cell 2:1\n Cell 2:2
    ', - '/div/table/tbody[tr[1][td[1]="\n Cell 1:1"][td[2]="\n Cell 1:2"]][tr[2][td[1]="\n Cell 2:1"][td[2]="\n Cell 2:2"]]'), + '/div/div/table/tbody[tr[1][td[1]="\n Cell 1:1"][td[2]="\n Cell 1:2"]][tr[2][td[1]="\n Cell 2:1"][td[2]="\n Cell 2:2"]]'), ] for i in data: yield (self.do, ) + i diff -r 395ac7691975 -r c246300616f1 MoinMoin/converter/html_in.py --- a/MoinMoin/converter/html_in.py Wed Jun 17 13:51:48 2015 -0700 +++ b/MoinMoin/converter/html_in.py Wed Jun 17 14:12:08 2015 -0700 @@ -100,10 +100,10 @@ html_tree = HTML(html_str) # We should have a root element, which will be converted as - # for the DOM Tree. It can be or
    . + # for the DOM Tree. # NB : If used, it will be converted back to
    after # one roundtrip - if html_tree.tag.name != 'html' and html_tree.tag.name != 'div': + if html_tree.tag.name != 'html': html_str = ''.join(['
    ', html_str, '
    ']) html_tree = HTML(html_str)