fix 314 correct rendering of comments with internal markup and mixed emphasis/strong markup
1.1 --- a/MoinMoin/converter/_tests/test_moinwiki_in.py Thu Jan 31 07:25:12 2013 -0700
1.2 +++ b/MoinMoin/converter/_tests/test_moinwiki_in.py Thu Jan 31 07:28:39 2013 -0700
1.3 @@ -81,6 +81,10 @@
1.4 '<page><body><p>Text <emphasis>Emphasis</emphasis></p><p>Text</p></body></page>'),
1.5 ("Text''''''Text''''",
1.6 '<page><body><p>TextText</p></body></page>'),
1.7 + ("''italic '''strongitalic ''''' normal",
1.8 + '<page><body><p><emphasis>italic <strong>strongitalic </strong></emphasis> normal</p></body></page>'),
1.9 + ("'''strong '''''italic '''strongitalic''''' normal",
1.10 + '<page><body><p><strong>strong </strong><emphasis>italic <strong>strongitalic</strong></emphasis> normal</p></body></page>'),
1.11 ]
1.12 for i in data:
1.13 yield (self.do, ) + i
1.14 @@ -119,6 +123,10 @@
1.15 '<page><body><p><span font-size="120%">larger</span></p></body></page>'),
1.16 ("--(strike through)--",
1.17 '<page><body><p><span text-decoration="line-through">strike through</span></p></body></page>'),
1.18 + ("normal ~+big __underline__ big+~ normal",
1.19 + '<page><body><p>normal <span font-size="120%">big <span text-decoration="underline">underline</span> big</span> normal</p></body></page>'),
1.20 + ("/* normal __underline__ normal */",
1.21 + '<page><body><p><span class="comment">normal <span text-decoration="underline">underline</span> normal</span></p></body></page>'),
1.22 (u'"',
1.23 '<page><body><p>"</p></body></page>'),
1.24 (u'"',
2.1 --- a/MoinMoin/converter/_util.py Thu Jan 31 07:25:12 2013 -0700
2.2 +++ b/MoinMoin/converter/_util.py Thu Jan 31 07:28:39 2013 -0700
2.3 @@ -155,8 +155,9 @@
2.4 if elem:
2.5 self.top_append(elem)
2.6
2.7 - def top_check(self, *names):
2.8 + def top_check(self, *names, **kwargs):
2.9 """
2.10 - Checks if the name of the top of the stack matches the parameters.
2.11 + Check if the top of the stack name and attrib matches the parameters.
2.12 """
2.13 - return self._list[-1].name in names
2.14 + attrib = kwargs.get('attrib', {})
2.15 + return self._list[-1].name in names and set(attrib.items()).issubset(self._list[-1].elem.attrib.items())
3.1 --- a/MoinMoin/converter/moinwiki_in.py Thu Jan 31 07:25:12 2013 -0700
3.2 +++ b/MoinMoin/converter/moinwiki_in.py Thu Jan 31 07:28:39 2013 -0700
3.3 @@ -533,10 +533,11 @@
3.4 else:
3.5 stack.push(moin_page.strong())
3.6 elif stack.top_check('strong'):
3.7 - if stack.top_check('strong'):
3.8 + stack.pop()
3.9 + if stack.top_check('emphasis'):
3.10 stack.pop()
3.11 else:
3.12 - stack.push(moin_page.strong())
3.13 + stack.push(moin_page.emphasis())
3.14 else:
3.15 if len(emphstrong_follow) == 3:
3.16 stack.push(moin_page.emphasis())
3.17 @@ -654,11 +655,11 @@
3.18 """
3.19
3.20 def inline_underline_repl(self, stack, underline):
3.21 - if not stack.top_check('span'):
3.22 - attrib = {moin_page.text_decoration: 'underline'}
3.23 + attrib = {moin_page.text_decoration: 'underline'}
3.24 + if stack.top_check('span', attrib=attrib):
3.25 + stack.pop()
3.26 + else:
3.27 stack.push(moin_page.span(attrib=attrib))
3.28 - else:
3.29 - stack.pop()
3.30
3.31 inline_link = r"""
3.32 (?P<link>