annotate MoinMoin/converter/_tests/test_include.py @ 1947:bc07c47e1aa8

fix 275 Cannot insert images into paragraphs
author Roger Haase <crosseyedpenguin@yahoo.com>
date Sun, 03 Feb 2013 10:49:45 -0700
parents 7f938234a924
children 286e315935ae
rev   line source
26
4cd8edde9e94 automatically transform module docstrings, moving legal stuff to comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 24
diff changeset
1 # Copyright: 2008 MoinMoin:BastianBlank
4cd8edde9e94 automatically transform module docstrings, moving legal stuff to comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 24
diff changeset
2 # License: GNU GPL v2 (or any later version), see LICENSE.txt for details.
4cd8edde9e94 automatically transform module docstrings, moving legal stuff to comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 24
diff changeset
3
0
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
4 """
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
5 MoinMoin - Tests for MoinMoin.converter.include
26
4cd8edde9e94 automatically transform module docstrings, moving legal stuff to comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 24
diff changeset
6 """
0
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
7
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
8
562
17931e46e2df py.test changed to pytest in conftest.py and all the tests of converter module.
pkumar <contactprashantat@gmail.com>
parents: 26
diff changeset
9 import pytest
0
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
10
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
11 from MoinMoin.converter.include import *
1451
c32ff2e07e7a Introduce itemtype.
Cheer Xiao <xiaqqaix@gmail.com>
parents: 1397
diff changeset
12 from MoinMoin.items import Item
1014
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
13 from MoinMoin.config import CONTENTTYPE
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
14 from MoinMoin._tests import wikiconfig, update_item
0
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
15
1014
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
16 class TestInclude(object):
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
17 class Config(wikiconfig.Config):
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
18 """
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
19 we just have this so the test framework creates a new app with empty backends for us.
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
20 """
0
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
21
1014
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
22 def test_XPointer(self):
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
23 x = XPointer('a')
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
24 assert len(x) == 1
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
25 e = x[0]
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
26 assert e.name == 'a'
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
27 assert e.data is None
644
beabd93b3904 removed extra whitespaces form codes, added my name to the tests I wrote
pkumar <contactprashantat@gmail.com>
parents: 624
diff changeset
28
1014
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
29 x = XPointer('a(b)')
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
30 assert len(x) == 1
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
31 e = x[0]
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
32 assert e.name == 'a'
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
33 assert e.data == 'b'
0
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
34
1014
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
35 x = XPointer('a(^(b^)^^)')
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
36 assert len(x) == 1
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
37 e = x[0]
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
38 assert e.name == 'a'
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
39 assert e.data == '^(b^)^^'
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
40 assert e.data_unescape == '(b)^'
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
41
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
42 x = XPointer('a(b)c(d)')
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
43 assert len(x) == 2
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
44 e = x[0]
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
45 assert e.name == 'a'
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
46 assert e.data == 'b'
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
47 e = x[1]
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
48 assert e.name == 'c'
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
49 assert e.data == 'd'
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
50
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
51 x = XPointer('a(b) c(d)')
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
52 assert len(x) == 2
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
53 e = x[0]
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
54 assert e.name == 'a'
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
55 assert e.data == 'b'
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
56 e = x[1]
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
57 assert e.name == 'c'
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
58 assert e.data == 'd'
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
59
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
60 x = XPointer('a(a(b))')
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
61 assert len(x) == 1
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
62 e = x[0]
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
63 assert e.name == 'a'
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
64 assert e.data == 'a(b)'
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
65
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
66 def test_IncludeHandlesCircularRecursion(self):
1947
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
67 # detect circular recursion and create error message
1014
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
68 update_item(u'page1', {CONTENTTYPE: u'text/x.moin.wiki'}, u'{{page2}}')
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
69 update_item(u'page2', {CONTENTTYPE: u'text/x.moin.wiki'}, u'{{page3}}')
1264
7275fd6533b2 fix internal server error on circular transclusion loop, enhance error message, fixes issue #80
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1019
diff changeset
70 update_item(u'page3', {CONTENTTYPE: u'text/x.moin.wiki'}, u'{{page4}}')
7275fd6533b2 fix internal server error on circular transclusion loop, enhance error message, fixes issue #80
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1019
diff changeset
71 update_item(u'page4', {CONTENTTYPE: u'text/x.moin.wiki'}, u'{{page2}}')
1451
c32ff2e07e7a Introduce itemtype.
Cheer Xiao <xiaqqaix@gmail.com>
parents: 1397
diff changeset
72 page1 = Item.create(u'page1')
c32ff2e07e7a Introduce itemtype.
Cheer Xiao <xiaqqaix@gmail.com>
parents: 1397
diff changeset
73 rendered = page1.content._render_data()
1295
4237934df124 rework transclusion overlay patch - improve transcluded item visibility, fix HTML validation errors, fixes #132 and #164
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1264
diff changeset
74 # an error message will follow strong tag
4237934df124 rework transclusion overlay patch - improve transcluded item visibility, fix HTML validation errors, fixes #132 and #164
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1264
diff changeset
75 assert '<strong class="moin-error">' in rendered
1014
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
76
1295
4237934df124 rework transclusion overlay patch - improve transcluded item visibility, fix HTML validation errors, fixes #132 and #164
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1264
diff changeset
77 def test_ExternalInclude(self):
1947
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
78 # external include
1295
4237934df124 rework transclusion overlay patch - improve transcluded item visibility, fix HTML validation errors, fixes #132 and #164
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1264
diff changeset
79 update_item(u'page1', {CONTENTTYPE: u'text/x.moin.wiki'}, u'{{http://moinmo.in}}')
1451
c32ff2e07e7a Introduce itemtype.
Cheer Xiao <xiaqqaix@gmail.com>
parents: 1397
diff changeset
80 rendered = Item.create(u'page1').content._render_data()
1295
4237934df124 rework transclusion overlay patch - improve transcluded item visibility, fix HTML validation errors, fixes #132 and #164
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1264
diff changeset
81 assert '<object class="moin-http moin-transclusion" data="http://moinmo.in" data-href="http://moinmo.in">http://moinmo.in</object>' in rendered
1947
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
82 # external include embedded within text (object is an inline tag)
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
83 update_item(u'page1', {CONTENTTYPE: u'text/x.moin.wiki'}, u'before {{http://moinmo.in}} after')
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
84 rendered = Item.create(u'page1').content._render_data()
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
85 assert '<p>before <object class="moin-http moin-transclusion" data="http://moinmo.in" data-href="http://moinmo.in">http://moinmo.in</object> after</p>' in rendered
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
86 # external include embedded within text italic and bold markup (object is an inline tag)
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
87 update_item(u'page1', {CONTENTTYPE: u'text/x.moin.wiki'}, u"before ''italic '''bold {{http://moinmo.in}} bold''' italic'' normal")
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
88 rendered = Item.create(u'page1').content._render_data()
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
89 assert '<p>before <em>italic <strong>bold <object class="moin-http moin-transclusion" data="http://moinmo.in" data-href="http://moinmo.in">http://moinmo.in</object> bold</strong> italic</em> normal</p>' in rendered
1018
dfbe65482a03 inserting {{MyWikiPage}} in middle of paragraph now makes valid html. inclusion of one-line page is shown inline. fixes #28
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 1014
diff changeset
90
1019
afe0afe4e1a6 recursive rename
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 1018
diff changeset
91 def test_InlineInclude(self):
1018
dfbe65482a03 inserting {{MyWikiPage}} in middle of paragraph now makes valid html. inclusion of one-line page is shown inline. fixes #28
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 1014
diff changeset
92
1947
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
93 update_item(u'page1', {CONTENTTYPE: u'text/x.moin.wiki'}, u'before {{page2}} after')
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
94 # transclude single paragraph as inline
1018
dfbe65482a03 inserting {{MyWikiPage}} in middle of paragraph now makes valid html. inclusion of one-line page is shown inline. fixes #28
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 1014
diff changeset
95 update_item(u'page2', {CONTENTTYPE: u'text/x.moin.wiki'}, u'Single line')
1451
c32ff2e07e7a Introduce itemtype.
Cheer Xiao <xiaqqaix@gmail.com>
parents: 1397
diff changeset
96 rendered = Item.create(u'page1').content._render_data()
1947
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
97 assert '<p>before <span class="moin-transclusion" data-href="/page2">Single line</span> after</p>' in rendered
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
98 # transclude multiple paragraphs as block
1018
dfbe65482a03 inserting {{MyWikiPage}} in middle of paragraph now makes valid html. inclusion of one-line page is shown inline. fixes #28
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 1014
diff changeset
99 update_item(u'page2', {CONTENTTYPE: u'text/x.moin.wiki'}, u'Two\n\nParagraphs')
1451
c32ff2e07e7a Introduce itemtype.
Cheer Xiao <xiaqqaix@gmail.com>
parents: 1397
diff changeset
100 rendered = Item.create(u'page1').content._render_data()
1947
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
101 assert '<p>before </p><div class="moin-transclusion" data-href="/page2"><p>Two</p><p>Paragraphs</p></div><p> after</p></div>' in rendered
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
102 # transclude single paragraph with internal markup as inline
1018
dfbe65482a03 inserting {{MyWikiPage}} in middle of paragraph now makes valid html. inclusion of one-line page is shown inline. fixes #28
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 1014
diff changeset
103 update_item(u'page2', {CONTENTTYPE: u'text/x.moin.wiki'}, u"this text contains ''italic'' string")
1451
c32ff2e07e7a Introduce itemtype.
Cheer Xiao <xiaqqaix@gmail.com>
parents: 1397
diff changeset
104 rendered = Item.create(u'page1').content._render_data()
1947
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
105 assert 'before <span class="moin-transclusion" data-href="/page2">this text contains <em>italic</em>' in rendered
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
106 # transclude single paragraph as only content within a paragraph
1018
dfbe65482a03 inserting {{MyWikiPage}} in middle of paragraph now makes valid html. inclusion of one-line page is shown inline. fixes #28
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 1014
diff changeset
107 update_item(u'page1', {CONTENTTYPE: u'text/x.moin.wiki'}, u'Content of page2 is\n\n{{page2}}')
dfbe65482a03 inserting {{MyWikiPage}} in middle of paragraph now makes valid html. inclusion of one-line page is shown inline. fixes #28
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 1014
diff changeset
108 update_item(u'page2', {CONTENTTYPE: u'text/x.moin.wiki'}, u"Single Line")
1451
c32ff2e07e7a Introduce itemtype.
Cheer Xiao <xiaqqaix@gmail.com>
parents: 1397
diff changeset
109 rendered = Item.create(u'page1').content._render_data()
1295
4237934df124 rework transclusion overlay patch - improve transcluded item visibility, fix HTML validation errors, fixes #132 and #164
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1264
diff changeset
110 assert '<p>Content of page2 is</p><p><span class="moin-transclusion" data-href="/page2">Single Line</span></p>' in rendered
1947
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
111 # transclude single row table within a paragraph, block element forces paragraph to be split into 2 parts
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
112 update_item(u'page1', {CONTENTTYPE: u'text/x.moin.wiki'}, u'before {{page2}} after')
1018
dfbe65482a03 inserting {{MyWikiPage}} in middle of paragraph now makes valid html. inclusion of one-line page is shown inline. fixes #28
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 1014
diff changeset
113 update_item(u'page2', {CONTENTTYPE: u'text/x.moin.wiki'}, u"|| table || cell ||")
1451
c32ff2e07e7a Introduce itemtype.
Cheer Xiao <xiaqqaix@gmail.com>
parents: 1397
diff changeset
114 rendered = Item.create(u'page1').content._render_data()
1947
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
115 assert '<p>before </p><div class="moin-transclusion" data-href="/page2"><table' in rendered
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
116 assert '</table></div><p> after</p>' in rendered
1018
dfbe65482a03 inserting {{MyWikiPage}} in middle of paragraph now makes valid html. inclusion of one-line page is shown inline. fixes #28
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 1014
diff changeset
117 assert rendered.count('<table>') == 1
1947
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
118 # transclude two row table within a paragraph, block element forces paragraph to be split into 2 parts
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
119 update_item(u'page1', {CONTENTTYPE: u'text/x.moin.wiki'}, u'before {{page2}} after')
1018
dfbe65482a03 inserting {{MyWikiPage}} in middle of paragraph now makes valid html. inclusion of one-line page is shown inline. fixes #28
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 1014
diff changeset
120 update_item(u'page2', {CONTENTTYPE: u'text/x.moin.wiki'}, u"|| this || has ||\n|| two || rows ||")
1451
c32ff2e07e7a Introduce itemtype.
Cheer Xiao <xiaqqaix@gmail.com>
parents: 1397
diff changeset
121 rendered = Item.create(u'page1').content._render_data()
1947
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
122 # inclusion of block item within a paragraph results in a before and after p
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
123 assert '<p>before </p><div class="moin-transclusion" data-href="/page2"><table' in rendered
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
124 assert '</table></div><p> after</p>' in rendered
1018
dfbe65482a03 inserting {{MyWikiPage}} in middle of paragraph now makes valid html. inclusion of one-line page is shown inline. fixes #28
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 1014
diff changeset
125 assert rendered.count('<table>') == 1
1947
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
126 # transclude nonexistent item
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
127 update_item(u'page1', {CONTENTTYPE: u'text/x.moin.wiki'}, u'before {{nonexistent}} after')
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
128 rendered = Item.create(u'page1').content._render_data()
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
129 assert '<p>before <span class="moin-transclusion" data-href="/nonexistent"><a href="/+modify/nonexistent">' in rendered
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
130 assert '</a></span> after</p>' in rendered
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
131 # transclude empty item
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
132 update_item(u'page1', {CONTENTTYPE: u'text/x.moin.wiki'}, u'text {{page2}} text')
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
133 update_item(u'page2', {CONTENTTYPE: u'text/x.moin.wiki'}, u"")
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
134 rendered = Item.create(u'page1').content._render_data()
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
135 assert '<p>text <span class="moin-transclusion" data-href="/page2"></span> text</p>' in rendered
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
136 def test_InlineIncludeCreole(self):
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
137 # transclude single paragraph as inline using creole parser
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
138 update_item(u'creole', {CONTENTTYPE: u'text/x.moin.creole;charset=utf-8'}, u'creole item')
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
139 update_item(u'page1', {CONTENTTYPE: u'text/x.moin.creole;charset=utf-8'}, u'before {{creole}} after')
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
140 rendered = Item.create(u'page1').content._render_data()
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
141 assert '<p>before <span class="moin-transclusion" data-href="/creole">creole item</span> after</p>' in rendered
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
142 def test_InlineIncludeWithinMarkup(self):
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
143 # transclude single line item within italic and bold markup
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
144 update_item(u'page1', {CONTENTTYPE: u'text/x.moin.wiki'}, u"Normal ''italic '''bold {{page2}} bold''' italic'' normal")
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
145 update_item(u'page2', {CONTENTTYPE: u'text/x.moin.wiki'}, u"Single Line")
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
146 rendered = Item.create(u'page1').content._render_data()
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
147 assert '<p>Normal <em>italic <strong>bold <span class="moin-transclusion" data-href="/page2">Single Line</span> bold</strong> italic</em> normal</p>' in rendered
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
148 # transclude double line item within italic and bold markup
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
149 update_item(u'page1', {CONTENTTYPE: u'text/x.moin.wiki'}, u"Normal ''italic '''bold {{page2}} bold''' italic'' normal")
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
150 update_item(u'page2', {CONTENTTYPE: u'text/x.moin.wiki'}, u"Double\n\nLine")
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
151 rendered = Item.create(u'page1').content._render_data()
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
152 assert '<p>Normal <em>italic <strong>bold </strong></em></p><div class="moin-transclusion" data-href="/page2"><p>Double</p><p>Line</p></div><p><em><strong> bold</strong> italic</em> normal</p>' in rendered
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
153 # transclude single line item within comment
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
154 update_item(u'page1', {CONTENTTYPE: u'text/x.moin.wiki'}, u"comment /* before {{page2}} after */")
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
155 update_item(u'page2', {CONTENTTYPE: u'text/x.moin.wiki'}, u"Single Line")
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
156 rendered = Item.create(u'page1').content._render_data()
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
157 assert '<p>comment <span class="comment">before <span class="moin-transclusion" data-href="/page2">Single Line</span> after</span></p>' in rendered
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
158 # transclude double line item within comment
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
159 update_item(u'page1', {CONTENTTYPE: u'text/x.moin.wiki'}, u"comment /* before {{page2}} after */")
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
160 update_item(u'page2', {CONTENTTYPE: u'text/x.moin.wiki'}, u"Double\n\nLine")
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
161 rendered = Item.create(u'page1').content._render_data()
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
162 assert '<p>comment <span class="comment">before </span></p><div class="comment moin-transclusion" data-href="/page2"><p>Double</p><p>Line</p></div><p><span class="comment"> after</span></p>' in rendered
1295
4237934df124 rework transclusion overlay patch - improve transcluded item visibility, fix HTML validation errors, fixes #132 and #164
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1264
diff changeset
163
1947
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
164 def test_InlineIncludeImage(self):
1295
4237934df124 rework transclusion overlay patch - improve transcluded item visibility, fix HTML validation errors, fixes #132 and #164
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1264
diff changeset
165 # the 3rd parameter, u'', should be a binary string defining a png image, but it is not needed for this simple test
1947
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
166 update_item(u'logo.png', {CONTENTTYPE: u'image/png'}, u'')
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
167 # simple transclusion
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
168 update_item(u'page1', {CONTENTTYPE: u'text/x.moin.wiki'}, u'{{logo.png}}')
1451
c32ff2e07e7a Introduce itemtype.
Cheer Xiao <xiaqqaix@gmail.com>
parents: 1397
diff changeset
169 rendered = Item.create(u'page1').content._render_data()
1947
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
170 assert '<p><span class="moin-transclusion" data-href="/logo.png"><img alt="logo.png" src=' in rendered
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
171 assert '/logo.png" /></span></p>' in rendered
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
172 # within paragraph
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
173 update_item(u'page1', {CONTENTTYPE: u'text/x.moin.wiki'}, u'text {{logo.png}} text')
1451
c32ff2e07e7a Introduce itemtype.
Cheer Xiao <xiaqqaix@gmail.com>
parents: 1397
diff changeset
174 rendered = Item.create(u'page1').content._render_data()
1947
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
175 assert '<p>text <span class="moin-transclusion" data-href="/logo.png"><img alt="logo.png" src=' in rendered
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
176 assert '/logo.png" /></span> text</p>' in rendered
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
177 # within markup
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
178 update_item(u'page1', {CONTENTTYPE: u'text/x.moin.wiki'}, u"Normal ''italic '''bold {{logo.png}} bold''' italic'' normal")
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
179 rendered = Item.create(u'page1').content._render_data()
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
180 assert '<p>Normal <em>italic <strong>bold <span class="moin-transclusion" data-href="/logo.png"><img alt="logo.png" src=' in rendered
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
181 assert '/logo.png" /></span> bold</strong> italic</em> normal</p>' in rendered
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
182 # multiple transclusions
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
183 update_item(u'page1', {CONTENTTYPE: u'text/x.moin.wiki'}, u'{{logo.png}}{{logo.png}}')
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
184 rendered = Item.create(u'page1').content._render_data()
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
185 assert '<p><span class="moin-transclusion" data-href="/logo.png"><img alt="logo.png" src=' in rendered
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
186 assert '/logo.png" /></span><span class="moin-transclusion" data-href="/logo.png"><img alt="logo.png" src=' in rendered
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
187 # check for old bug
1295
4237934df124 rework transclusion overlay patch - improve transcluded item visibility, fix HTML validation errors, fixes #132 and #164
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1264
diff changeset
188 assert '<p />' not in rendered
4237934df124 rework transclusion overlay patch - improve transcluded item visibility, fix HTML validation errors, fixes #132 and #164
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1264
diff changeset
189 assert '<p></p>' not in rendered
1947
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
190
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
191 def test_IncludeAsLinkAlternate(self):
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
192 # image as link alternate
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
193 update_item(u'page1', {CONTENTTYPE: u'text/x.moin.wiki'}, u"text [[page2|{{logo.png}}]] text")
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
194 rendered = Item.create(u'page1').content._render_data()
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
195 assert '<p>text <a href="/page2"><span class="moin-transclusion" data-href="/logo.png"><img alt="logo.png" src="' in rendered
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
196 assert '/logo.png" /></span></a> text</p>' in rendered
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
197 # link alternate with image embedded in markup
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
198 update_item(u'page1', {CONTENTTYPE: u'text/x.moin.wiki'}, u"text [[page2|plain '''bold {{logo.png}} bold''' plain]] text")
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
199 rendered = Item.create(u'page1').content._render_data()
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
200 assert '<p>text <a href="/page2">plain <strong>bold <span class="moin-transclusion" data-href="/logo.png"><img alt="logo.png" src="' in rendered
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
201 assert '/logo.png" /></span> bold</strong> plain</a> text</p>' in rendered
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
202 # nonexistent image used in link alternate
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
203 # XXX html validation errora: A inside A - the image alternate turns into an A-tag to create the non-existant image. Error is easily seen.
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
204 # IE9, Firefox, Chrome, Safari, and Opera display this OK; the only usable hyperlink is to create the missing image.
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
205 update_item(u'page1', {CONTENTTYPE: u'text/x.moin.wiki'}, u"text [[page2|{{logoxxx.png}}]] text")
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
206 rendered = Item.create(u'page1').content._render_data()
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
207 assert '<p>text <a href="/page2"><span class="moin-transclusion" data-href="/logoxxx.png"><a href="/+modify/logoxxx.png">' in rendered
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
208 assert '</a></span></a> text</p>' in rendered
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
209 # image used as alternate to nonexistent page
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
210 update_item(u'page1', {CONTENTTYPE: u'text/x.moin.wiki'}, u"text [[page2xxx|{{logo.png}}]] text")
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
211 rendered = Item.create(u'page1').content._render_data()
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
212 assert '<p>text <a class="moin-nonexistent" href="/page2xxx"><span class="moin-transclusion" data-href="/logo.png"><img alt="logo.png" src="' in rendered
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
213 assert '/logo.png" /></span></a> text</p>' in rendered
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
214 # transclude block elem as link alternate to nonexistent page
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
215 # XXX html validation errors, block element inside A.
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
216 # IE9, Firefox, Chrome, Safari, and Opera display this OK; the hyperlink is the entire div enclosing the block elem
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
217 update_item(u'page1', {CONTENTTYPE: u'text/x.moin.wiki'}, u'text [[MyPage|{{page2}}]] text')
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
218 update_item(u'page2', {CONTENTTYPE: u'text/x.moin.wiki'}, u"Double\n\nLine")
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
219 rendered = Item.create(u'page1').content._render_data()
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
220 assert '<p>text <a class="moin-nonexistent" href="/MyPage"><div class="moin-transclusion" data-href="/page2"><p>Double</p><p>Line</p></div></a> text</p>' in rendered
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
221 # transclude empty item as link alternate to nonexistent page
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
222 # hyperlink will be empty span and invisible
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
223 update_item(u'page1', {CONTENTTYPE: u'text/x.moin.wiki'}, u'text [[MyPage|{{page2}}]] text')
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
224 update_item(u'page2', {CONTENTTYPE: u'text/x.moin.wiki'}, u"")
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
225 rendered = Item.create(u'page1').content._render_data()
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
226 assert '<p>text <a class="moin-nonexistent" href="/MyPage"><span class="moin-transclusion" data-href="/page2"></span></a> text</p>' in rendered
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
227 # transclude external page as link alternate to nonexistent page
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
228 update_item(u'page1', {CONTENTTYPE: u'text/x.moin.wiki'}, u'text [[MyPage|{{http://moinmo.in}}]] text')
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
229 rendered = Item.create(u'page1').content._render_data()
bc07c47e1aa8 fix 275 Cannot insert images into paragraphs
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1836
diff changeset
230 assert '<p>text <a class="moin-nonexistent" href="/MyPage"><object class="moin-http moin-transclusion" data="http://moinmo.in" data-href="http://moinmo.in">http://moinmo.in</object></a> text</p>' in rendered