[Zope-Checkins] SVN: Zope/branches/2.9/lib/python/reStructuredText/
Merged 2.8 branch r30721:30722 into 2.9 branch.
Stefan H. Holek
stefan at epy.co.at
Sun Apr 9 11:37:25 EDT 2006
Log message for revision 66730:
Merged 2.8 branch r30721:30722 into 2.9 branch.
(Fix for collector #1770 that never made it.)
Changed:
U Zope/branches/2.9/lib/python/reStructuredText/__init__.py
U Zope/branches/2.9/lib/python/reStructuredText/tests/testReST.py
-=-
Modified: Zope/branches/2.9/lib/python/reStructuredText/__init__.py
===================================================================
--- Zope/branches/2.9/lib/python/reStructuredText/__init__.py 2006-04-09 15:12:30 UTC (rev 66729)
+++ Zope/branches/2.9/lib/python/reStructuredText/__init__.py 2006-04-09 15:37:24 UTC (rev 66730)
@@ -140,16 +140,25 @@
'title': parts['title'],
}
+ subheader = '<h%(level)s class="subtitle">%(subtitle)s</h%(level)s>\n' % {
+ 'level': initial_header_level+1,
+ 'subtitle': parts['subtitle'],
+ }
+
body = '%(docinfo)s%(body)s' % {
'docinfo': parts['docinfo'],
'body': parts['body'],
}
+
+ output = ''
if parts['title']:
- output = header + body
- else:
- output = body
+ output = output + header
+ if parts['subtitle']:
+ output = output + subheader
+ output = output + body
+
warnings = ''.join(warning_stream.messages)
return output.encode(output_encoding)
Modified: Zope/branches/2.9/lib/python/reStructuredText/tests/testReST.py
===================================================================
--- Zope/branches/2.9/lib/python/reStructuredText/tests/testReST.py 2006-04-09 15:12:30 UTC (rev 66729)
+++ Zope/branches/2.9/lib/python/reStructuredText/tests/testReST.py 2006-04-09 15:37:24 UTC (rev 66730)
@@ -1,15 +1,31 @@
import unittest
+from reStructuredText import HTML
+
class TestReST(unittest.TestCase):
def testRoman(self):
# Make sure we can import the rst parser
from docutils.parsers import rst
+ def testWithSingleSubtitle(self):
+ input = '''
+title
+-----
+subtitle
+++++++++
+text
+'''
+ expected='''<h3 class="title">title</h3>
+<h4 class="subtitle">subtitle</h4>
+<p>text</p>
+'''
+ output = HTML(input)
+ self.assertEquals(output, expected)
+
def test_suite():
from unittest import TestSuite, makeSuite
return TestSuite((makeSuite(TestReST),))
-
More information about the Zope-Checkins
mailing list