summaryrefslogtreecommitdiff
path: root/docutils/test
diff options
context:
space:
mode:
authorgoodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2005-04-07 19:36:11 +0000
committergoodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2005-04-07 19:36:11 +0000
commit8629fbb1833f995d3089433a8753c263128c1783 (patch)
tree73dfca75b0bfd571b16e2fa51b4637375f28c420 /docutils/test
parent63f1cb4caa845e95db270d5d4cfb5f456085fde3 (diff)
downloaddocutils-8629fbb1833f995d3089433a8753c263128c1783.tar.gz
added "header" & "footer" directives, tests, docs, support, and some tweaks
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@3184 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'docutils/test')
-rw-r--r--docutils/test/functional/expected/standalone_rst_html4css1.html8
-rw-r--r--docutils/test/functional/input/data/header_footer.txt2
-rw-r--r--docutils/test/functional/input/standalone_rst_html4css1.txt1
-rwxr-xr-xdocutils/test/test_parsers/test_rst/test_directives/test_decorations.py93
4 files changed, 104 insertions, 0 deletions
diff --git a/docutils/test/functional/expected/standalone_rst_html4css1.html b/docutils/test/functional/expected/standalone_rst_html4css1.html
index be1c9816e..78605137a 100644
--- a/docutils/test/functional/expected/standalone_rst_html4css1.html
+++ b/docutils/test/functional/expected/standalone_rst_html4css1.html
@@ -17,6 +17,10 @@
<link rel="stylesheet" href="../../../tools/stylesheets/default.css" type="text/css" />
</head>
<body>
+<div class="header">
+Document header
+</div>
+<hr class="docutils header"/>
<span id="doctitle"></span><div class="document" id="restructuredtext-test-document">
<h1 class="title">reStructuredText Test Document</h1>
<span id="subtitle"></span><h2 class="subtitle" id="examples-of-syntax-constructs">Examples of Syntax Constructs</h2>
@@ -918,5 +922,9 @@ Unknown target name: &quot;hyperlink reference without a target&quot;.</div>
Duplicate target name, cannot be used as a unique reference: &quot;duplicate target names&quot;.</div>
</div>
</div>
+<hr class="docutils footer" />
+<div class="footer">
+Document footer
+</div>
</body>
</html>
diff --git a/docutils/test/functional/input/data/header_footer.txt b/docutils/test/functional/input/data/header_footer.txt
new file mode 100644
index 000000000..875c9fac0
--- /dev/null
+++ b/docutils/test/functional/input/data/header_footer.txt
@@ -0,0 +1,2 @@
+.. header:: Document header
+.. footer:: Document footer
diff --git a/docutils/test/functional/input/standalone_rst_html4css1.txt b/docutils/test/functional/input/standalone_rst_html4css1.txt
index 3847a089e..05f0287d0 100644
--- a/docutils/test/functional/input/standalone_rst_html4css1.txt
+++ b/docutils/test/functional/input/standalone_rst_html4css1.txt
@@ -1,4 +1,5 @@
.. include:: data/standard.txt
+.. include:: data/header_footer.txt
.. include:: data/table_colspan.txt
.. include:: data/table_rowspan.txt
.. include:: data/table_complex.txt
diff --git a/docutils/test/test_parsers/test_rst/test_directives/test_decorations.py b/docutils/test/test_parsers/test_rst/test_directives/test_decorations.py
new file mode 100755
index 000000000..c770c6a49
--- /dev/null
+++ b/docutils/test/test_parsers/test_rst/test_directives/test_decorations.py
@@ -0,0 +1,93 @@
+#! /usr/bin/env python
+
+# Author: David Goodger
+# Contact: goodger@python.org
+# Revision: $Revision$
+# Date: $Date$
+# Copyright: This module has been placed in the public domain.
+
+"""
+Tests for the "header" & "footer" directives.
+"""
+
+from __init__ import DocutilsTestSupport
+
+def suite():
+ s = DocutilsTestSupport.ParserTestSuite()
+ s.generateTests(totest)
+ return s
+
+totest = {}
+
+totest['headers'] = [
+["""\
+.. header:: a paragraph for the header
+""",
+"""\
+<document source="test data">
+ <decoration>
+ <header>
+ <paragraph>
+ a paragraph for the header
+"""],
+["""\
+.. header::
+""",
+"""\
+<document source="test data">
+ <decoration>
+ <header>
+ <paragraph>
+ Problem with the "header" directive: no content supplied.
+ <system_message level="2" line="1" source="test data" type="WARNING">
+ <paragraph>
+ Content block expected for the "header" directive; none found.
+ <literal_block xml:space="preserve">
+ .. header::
+"""],
+["""\
+.. header:: first part of the header
+.. header:: second part of the header
+""",
+"""\
+<document source="test data">
+ <decoration>
+ <header>
+ <paragraph>
+ first part of the header
+ <paragraph>
+ second part of the header
+"""],
+]
+
+totest['footers'] = [
+["""\
+.. footer:: a paragraph for the footer
+""",
+"""\
+<document source="test data">
+ <decoration>
+ <footer>
+ <paragraph>
+ a paragraph for the footer
+"""],
+["""\
+.. footer:: even if a footer is declared first
+.. header:: the header appears first
+""",
+"""\
+<document source="test data">
+ <decoration>
+ <header>
+ <paragraph>
+ the header appears first
+ <footer>
+ <paragraph>
+ even if a footer is declared first
+"""],
+]
+
+
+if __name__ == '__main__':
+ import unittest
+ unittest.main(defaultTest='suite')