Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
1a87da63
Commit
1a87da63
authored
Jun 09, 2005
by
Godefroid Chapelle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Collector #1770: Fixed RestructuredText subtitle
parent
c895a9ab
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
6 deletions
+29
-6
doc/CHANGES.txt
doc/CHANGES.txt
+2
-0
lib/python/reStructuredText/__init__.py
lib/python/reStructuredText/__init__.py
+12
-3
lib/python/reStructuredText/tests/testReST.py
lib/python/reStructuredText/tests/testReST.py
+15
-3
No files found.
doc/CHANGES.txt
View file @
1a87da63
...
...
@@ -26,6 +26,8 @@ Zope Changes
Bugs Fixed
- Collector #1770: Fixed RestructuredText subtitle
- Collector #1803: Fixed InitializeClass for some corner case.
- Collector #1798, issue 1: ZopeTestCase no longer tries to
...
...
lib/python/reStructuredText/__init__.py
View file @
1a87da63
...
...
@@ -139,16 +139,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
)
return
output
.
encode
(
output_encoding
)
...
...
lib/python/reStructuredText/tests/testReST.py
View file @
1a87da63
import
unittest
from
reStructuredText
import
HTML
class
TestReST
(
unittest
.
TestCase
):
...
...
@@ -8,8 +7,21 @@ class TestReST(unittest.TestCase):
# 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
),))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment