Commit 9203ea76 authored by Stefan H. Holek's avatar Stefan H. Holek

Merged 2.8 branch r30721:30722 into the trunk.

(Fix for collector #1770 that never made it.)
parent 986119c2
......@@ -141,16 +141,25 @@ def HTML(src,
'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)
if output_encoding != 'unicode':
......
......@@ -65,7 +65,22 @@ class TestReST(unittest.TestCase):
expected = '<h%d><a id="von-v-geln-und-fen" name="von-v-geln-und-fen">Von Vgeln und fen</a></h%d>' %\
(level+1, level+1)
self.assertEqual(expected in html, True)
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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment