annotate MoinMoin/converter/_tests/test_include.py @ 1451:c32ff2e07e7a

Introduce itemtype. itemtype is used to affect the overall frontend view of an item, and to affect the indexer by offering a set of metadata keys. The original items.Item hierarchy was mosted turned into the new Content hierarchy, leaving code affecting the overview in the new Item and Default (which is an Item descent) classes. Item instances now have a `content` property which is what used to be an Item instance (now a Content instance). This is the first itemtype changeset which just moves codes around ensure they are not broken. More changesets follow soon.
author Cheer Xiao <xiaqqaix@gmail.com>
date Sat, 28 Jul 2012 01:22:44 +0800
parents 4ac437141bbe
children 7f938234a924
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):
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
67 # issue #80
1451
c32ff2e07e7a Introduce itemtype.
Cheer Xiao <xiaqqaix@gmail.com>
parents: 1397
diff changeset
68 # we use text/x.moin.wiki markup to make tests simple
1014
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
69 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
70 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
71 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
72 update_item(u'page4', {CONTENTTYPE: u'text/x.moin.wiki'}, u'{{page2}}')
1014
d966ee4fba91 test for issue #80 (circular transclusion)
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 644
diff changeset
73
1451
c32ff2e07e7a Introduce itemtype.
Cheer Xiao <xiaqqaix@gmail.com>
parents: 1397
diff changeset
74 page1 = Item.create(u'page1')
c32ff2e07e7a Introduce itemtype.
Cheer Xiao <xiaqqaix@gmail.com>
parents: 1397
diff changeset
75 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
76 # 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
77 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
78
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 def test_ExternalInclude(self):
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
80 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
81 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
82 assert '<object class="moin-http moin-transclusion" data="http://moinmo.in" data-href="http://moinmo.in">http://moinmo.in</object>' 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
83
1019
afe0afe4e1a6 recursive rename
"Luis Henrique Fagundes <lhfagundes@gmail.com>"
parents: 1018
diff changeset
84 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
85 # issue #28
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
86 update_item(u'page1', {CONTENTTYPE: u'text/x.moin.wiki'}, u'Content of page2 is "{{page2}}".')
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
87
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
88 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
89 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
90 assert '<p>Content of page2 is "<span class="moin-transclusion" data-href="/page2">Single line</span>".</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
91
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 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
93 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
94 assert '<p>Content of page2 is "</p><div class="moin-transclusion" data-href="/page2"><p>Two</p><p>Paragraphs</p></div><p>".</p></div>' 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
95
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
96 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
97 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
98 assert 'Content of page2 is "<span class="moin-transclusion" data-href="/page2">this text contains <em>italic</em>' 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
99
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
100 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
101 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
102 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
103 assert '<p>Content of page2 is</p><p><span class="moin-transclusion" data-href="/page2">Single Line</span></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
104
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
105 update_item(u'page1', {CONTENTTYPE: u'text/x.moin.wiki'}, u'Content of page2 is "{{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
106 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
107 rendered = Item.create(u'page1').content._render_data()
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
108 assert 'Content of page2 is "</p>' in rendered
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
109 assert '<table>' in rendered
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
110 assert rendered.count('<table>') == 1
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
111
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
112 update_item(u'page1', {CONTENTTYPE: u'text/x.moin.wiki'}, u'Content of page2 is "{{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
113 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
114 rendered = Item.create(u'page1').content._render_data()
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
115 assert 'Content of page2 is "</p>' in rendered
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
116 assert '<table>' in rendered
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
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
118
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
119 def test_InlineIncludeLogo(self):
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
120 # the 3rd parameter, u'', should be a binary string defining a png image, but it is not needed for this simple test
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
121 update_item(u'logo', {CONTENTTYPE: u'image/png'}, u'')
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
122
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
123 update_item(u'page1', {CONTENTTYPE: u'text/x.moin.wiki'}, u'{{logo}}')
1451
c32ff2e07e7a Introduce itemtype.
Cheer Xiao <xiaqqaix@gmail.com>
parents: 1397
diff changeset
124 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
125 assert '<img alt="logo" class="moin-transclusion"' 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
126
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
127 # <p /> is not valid html5; should be <p></p>. to be valid. Even better, there should be no empty p's.
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
128 update_item(u'page1', {CONTENTTYPE: u'text/x.moin.wiki'}, u'{{logo}}{{logo}}')
1451
c32ff2e07e7a Introduce itemtype.
Cheer Xiao <xiaqqaix@gmail.com>
parents: 1397
diff changeset
129 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
130 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
131 assert '<p></p>' not in rendered