corrigé le mauvais comportement du parser spip face à des lignes blanches
This commit is contained in:
parent
3b738ac7c9
commit
3026cd8380
|
@ -74,7 +74,7 @@ def parseGlasnostLink(link):
|
|||
r'(?P<role>alias|art(icle)?|atom|book|card|election|file|'\
|
||||
'grade|group|heading|im(g|age)?|person(ne)?|rubri(c|que)|'\
|
||||
'short|system|vote|%s) *(?P<localId>\S+) *(?P<option>\S+)?' % \
|
||||
'|'.join(context.getVar('knownRoles')), link)
|
||||
'|'.join(context.getVar('knownRoles') or ['zzz']), link)
|
||||
|
||||
if matchObject is None:
|
||||
name = link
|
||||
|
@ -1548,7 +1548,7 @@ class SpipParser:
|
|||
isLastParagraph = 0):
|
||||
if self.getVar('state') != 'paragraph':
|
||||
return None
|
||||
formattedText = self.getVar('formattedText')
|
||||
formattedText = self.getVar('formattedText').strip()
|
||||
ignoreEmptyParagraph = ignoreEmptyParagraph \
|
||||
or self.getVar('ignoreEmptyParagraph')
|
||||
self.pullState()
|
||||
|
|
|
@ -93,8 +93,14 @@ class SpipParserTestCase(unittest.TestCase):
|
|||
result = makeHtmlFromSpip('''begin\n\n{{strong}}\n\nend''')
|
||||
self.failUnless(result == '<p>begin</p>\n<h3 id="strong">strong</h3>\n<p>end</p>')
|
||||
|
||||
def test16_strongSecondLine(self):
|
||||
'''Render strong with and without empty lines'''
|
||||
result1 = makeHtmlFromSpip('''{{test}}\n''')
|
||||
result2 = makeHtmlFromSpip('''\n{{test}}\n''')
|
||||
self.failUnless(result1 == '<h3 id="test">test</h3>' and \
|
||||
result1 == result2)
|
||||
|
||||
def test16_tableWithHeader(self):
|
||||
def test17_tableWithHeader(self):
|
||||
'''Render a table with header'''
|
||||
result = makeHtmlFromSpip("""
|
||||
| {{0,0}} | {{0,1}} |
|
||||
|
@ -111,7 +117,7 @@ class SpipParserTestCase(unittest.TestCase):
|
|||
</tr>
|
||||
</table>""")
|
||||
|
||||
def test17_tableWithoutHeader(self):
|
||||
def test18_tableWithoutHeader(self):
|
||||
'''Render a table without header'''
|
||||
result = makeHtmlFromSpip("""
|
||||
| 0,0 | 0,1 |
|
||||
|
@ -128,7 +134,7 @@ class SpipParserTestCase(unittest.TestCase):
|
|||
</tr>
|
||||
</table>""")
|
||||
|
||||
def test18_tableWithStrongCell(self):
|
||||
def test19_tableWithStrongCell(self):
|
||||
'''Render a table with a strong cell'''
|
||||
result = makeHtmlFromSpip("""
|
||||
| 0,0 | 0,1 |
|
||||
|
@ -145,7 +151,7 @@ class SpipParserTestCase(unittest.TestCase):
|
|||
</tr>
|
||||
</table>""")
|
||||
|
||||
def test19_tableWithStrongCellOnFirstLine(self):
|
||||
def test20_tableWithStrongCellOnFirstLine(self):
|
||||
'''Render a table with a strong cell on first line'''
|
||||
result = makeHtmlFromSpip("""
|
||||
| {{0,0}} | 0,1 |
|
||||
|
@ -162,7 +168,6 @@ class SpipParserTestCase(unittest.TestCase):
|
|||
</tr>
|
||||
</table>""")
|
||||
|
||||
|
||||
suite1 = unittest.makeSuite(SpipParserTestCase, 'test')
|
||||
|
||||
allTests = unittest.TestSuite((suite1, ))
|
||||
|
|
Reference in New Issue