From 101671ae44e1686680c80cd07b452aabeb88fb63 Mon Sep 17 00:00:00 2001 From: goodger Date: Sat, 20 Apr 2002 03:01:52 +0000 Subject: Initial revision git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@18 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/DocutilsTestSupport.py | 379 +++++++ test/UnitTestFolder.py | 135 +++ test/alltests.py | 41 + test/difflib.py | 1089 ++++++++++++++++++++ test/test_nodes.py | 83 ++ test/test_parsers/test_rst/test_TableParser.py | 197 ++++ test/test_parsers/test_rst/test_block_quotes.py | 124 +++ test/test_parsers/test_rst/test_bullet_lists.py | 181 ++++ test/test_parsers/test_rst/test_citations.py | 139 +++ test/test_parsers/test_rst/test_comments.py | 238 +++++ .../test_parsers/test_rst/test_definition_lists.py | 317 ++++++ .../test_rst/test_directives/test_admonitions.py | 117 +++ .../test_rst/test_directives/test_contents.py | 166 +++ .../test_rst/test_directives/test_figures.py | 286 +++++ .../test_rst/test_directives/test_images.py | 233 +++++ .../test_rst/test_directives/test_meta.py | 141 +++ .../test_directives/test_test_directives.py | 109 ++ .../test_rst/test_directives/test_unknown.py | 55 + test/test_parsers/test_rst/test_doctest_blocks.py | 74 ++ .../test_parsers/test_rst/test_enumerated_lists.py | 662 ++++++++++++ test/test_parsers/test_rst/test_field_lists.py | 491 +++++++++ test/test_parsers/test_rst/test_footnotes.py | 332 ++++++ test/test_parsers/test_rst/test_functions.py | 37 + test/test_parsers/test_rst/test_inline_markup.py | 659 ++++++++++++ test/test_parsers/test_rst/test_literal_blocks.py | 190 ++++ test/test_parsers/test_rst/test_option_lists.py | 684 ++++++++++++ test/test_parsers/test_rst/test_outdenting.py | 90 ++ test/test_parsers/test_rst/test_paragraphs.py | 79 ++ test/test_parsers/test_rst/test_section_headers.py | 555 ++++++++++ test/test_parsers/test_rst/test_substitutions.py | 192 ++++ test/test_parsers/test_rst/test_tables.py | 564 ++++++++++ test/test_parsers/test_rst/test_targets.py | 429 ++++++++ test/test_parsers/test_rst/test_transitions.py | 144 +++ test/test_statemachine.py | 296 ++++++ test/test_transforms/test_contents2.py | 262 +++++ test/test_transforms/test_docinfo.py | 327 ++++++ test/test_transforms/test_doctitle.py | 175 ++++ test/test_transforms/test_final_checks.py | 47 + test/test_transforms/test_footnotes2.py | 521 ++++++++++ test/test_transforms/test_hyperlinks.py | 441 ++++++++ test/test_transforms/test_messages.py | 67 ++ test/test_transforms/test_substitutions.py | 61 ++ test/test_utils.py | 324 ++++++ 43 files changed, 11733 insertions(+) create mode 100644 test/DocutilsTestSupport.py create mode 100644 test/UnitTestFolder.py create mode 100755 test/alltests.py create mode 100644 test/difflib.py create mode 100755 test/test_nodes.py create mode 100755 test/test_parsers/test_rst/test_TableParser.py create mode 100755 test/test_parsers/test_rst/test_block_quotes.py create mode 100755 test/test_parsers/test_rst/test_bullet_lists.py create mode 100755 test/test_parsers/test_rst/test_citations.py create mode 100755 test/test_parsers/test_rst/test_comments.py create mode 100755 test/test_parsers/test_rst/test_definition_lists.py create mode 100755 test/test_parsers/test_rst/test_directives/test_admonitions.py create mode 100755 test/test_parsers/test_rst/test_directives/test_contents.py create mode 100755 test/test_parsers/test_rst/test_directives/test_figures.py create mode 100755 test/test_parsers/test_rst/test_directives/test_images.py create mode 100755 test/test_parsers/test_rst/test_directives/test_meta.py create mode 100755 test/test_parsers/test_rst/test_directives/test_test_directives.py create mode 100755 test/test_parsers/test_rst/test_directives/test_unknown.py create mode 100755 test/test_parsers/test_rst/test_doctest_blocks.py create mode 100755 test/test_parsers/test_rst/test_enumerated_lists.py create mode 100755 test/test_parsers/test_rst/test_field_lists.py create mode 100755 test/test_parsers/test_rst/test_footnotes.py create mode 100755 test/test_parsers/test_rst/test_functions.py create mode 100755 test/test_parsers/test_rst/test_inline_markup.py create mode 100755 test/test_parsers/test_rst/test_literal_blocks.py create mode 100755 test/test_parsers/test_rst/test_option_lists.py create mode 100755 test/test_parsers/test_rst/test_outdenting.py create mode 100755 test/test_parsers/test_rst/test_paragraphs.py create mode 100755 test/test_parsers/test_rst/test_section_headers.py create mode 100755 test/test_parsers/test_rst/test_substitutions.py create mode 100755 test/test_parsers/test_rst/test_tables.py create mode 100755 test/test_parsers/test_rst/test_targets.py create mode 100755 test/test_parsers/test_rst/test_transitions.py create mode 100755 test/test_statemachine.py create mode 100755 test/test_transforms/test_contents2.py create mode 100755 test/test_transforms/test_docinfo.py create mode 100755 test/test_transforms/test_doctitle.py create mode 100755 test/test_transforms/test_final_checks.py create mode 100755 test/test_transforms/test_footnotes2.py create mode 100755 test/test_transforms/test_hyperlinks.py create mode 100755 test/test_transforms/test_messages.py create mode 100755 test/test_transforms/test_substitutions.py create mode 100755 test/test_utils.py (limited to 'test') diff --git a/test/DocutilsTestSupport.py b/test/DocutilsTestSupport.py new file mode 100644 index 000000000..766eafde6 --- /dev/null +++ b/test/DocutilsTestSupport.py @@ -0,0 +1,379 @@ +#! /usr/bin/env python + +""" +:Authors: David Goodger; Garth Kidd +:Contact: goodger@users.sourceforge.net +:Revision: $Revision$ +:Date: $Date$ +:Copyright: This module has been placed in the public domain. + +Exports the following: + +:Modules: + - `statemachine` is 'docutils.statemachine' + - `nodes` is 'docutils.nodes' + - `urischemes` is 'docutils.urischemes' + - `utils` is 'docutils.utils' + - `transforms` is 'docutils.transforms' + - `states` is 'docutils.parsers.rst.states' + - `tableparser` is 'docutils.parsers.rst.tableparser' + +:Classes: + - `CustomTestSuite` + - `CustomTestCase` + - `ParserTestSuite` + - `ParserTestCase` + - `TableParserTestSuite` + - `TableParserTestCase` +""" +__docformat__ = 'reStructuredText' + +import UnitTestFolder +import sys, os, unittest, difflib, inspect, os, sys +from pprint import pformat +import docutils +from docutils import statemachine, nodes, urischemes, utils, transforms +from docutils.transforms import universal +from docutils.parsers import rst +from docutils.parsers.rst import states, tableparser, directives, languages +from docutils.statemachine import string2lines + +try: + import mypdb as pdb +except: + import pdb + + +class CustomTestSuite(unittest.TestSuite): + + """ + A collection of custom TestCases. + + """ + + id = '' + """Identifier for the TestSuite. Prepended to the + TestCase identifiers to make identification easier.""" + + nextTestCaseId = 0 + """The next identifier to use for non-identified test cases.""" + + def __init__(self, tests=(), id=None): + """ + Initialize the CustomTestSuite. + + Arguments: + + id -- identifier for the suite, prepended to test cases. + """ + unittest.TestSuite.__init__(self, tests) + if id is None: + outerframes = inspect.getouterframes(inspect.currentframe()) + mypath = outerframes[0][1] + for outerframe in outerframes[1:]: + if outerframe[3] != '__init__': + callerpath = outerframe[1] + break + mydir, myname = os.path.split(mypath) + if not mydir: + mydir = os.curdir + if callerpath.startswith(mydir): + self.id = callerpath[len(mydir) + 1:] # caller's module + else: + self.id = callerpath + else: + self.id = id + + def addTestCase(self, testCaseClass, methodName, input, expected, + id=None, runInDebugger=0, shortDescription=None, + **kwargs): + """ + Create a custom TestCase in the CustomTestSuite. + Also return it, just in case. + + Arguments: + + testCaseClass -- + methodName -- + input -- input to the parser. + expected -- expected output from the parser. + id -- unique test identifier, used by the test framework. + runInDebugger -- if true, run this test under the pdb debugger. + shortDescription -- override to default test description. + """ + if id is None: # generate id if required + id = self.nextTestCaseId + self.nextTestCaseId += 1 + # test identifier will become suiteid.testid + tcid = '%s: %s' % (self.id, id) + # generate and add test case + tc = testCaseClass(methodName, input, expected, tcid, + runInDebugger=runInDebugger, + shortDescription=shortDescription, + **kwargs) + self.addTest(tc) + return tc + + +class CustomTestCase(unittest.TestCase): + + compare = difflib.Differ().compare + """Comparison method shared by all subclasses.""" + + def __init__(self, methodName, input, expected, id, + runInDebugger=0, shortDescription=None): + """ + Initialise the CustomTestCase. + + Arguments: + + methodName -- name of test method to run. + input -- input to the parser. + expected -- expected output from the parser. + id -- unique test identifier, used by the test framework. + runInDebugger -- if true, run this test under the pdb debugger. + shortDescription -- override to default test description. + """ + self.id = id + self.input = input + self.expected = expected + self.runInDebugger = runInDebugger + # Ring your mother. + unittest.TestCase.__init__(self, methodName) + + def __str__(self): + """ + Return string conversion. Overridden to give test id, in addition to + method name. + """ + return '%s; %s' % (self.id, unittest.TestCase.__str__(self)) + + def compareOutput(self, input, output, expected): + """`input`, `output`, and `expected` should all be strings.""" + try: + self.assertEquals('\n' + output, '\n' + expected) + except AssertionError: + print >>sys.stderr, '\n%s\ninput:' % (self,) + print >>sys.stderr, input + print >>sys.stderr, '-: expected\n+: output' + print >>sys.stderr, ''.join(self.compare(expected.splitlines(1), + output.splitlines(1))) + raise + + +class TransformTestSuite(CustomTestSuite): + + """ + A collection of TransformTestCases. + + A TransformTestSuite instance manufactures TransformTestCases, + keeps track of them, and provides a shared test fixture (a-la + setUp and tearDown). + """ + + def __init__(self, parser): + self.parser = parser + """Parser shared by all test cases.""" + + CustomTestSuite.__init__(self) + + def generateTests(self, dict, dictname='totest', + testmethod='test_transforms'): + """ + Stock the suite with test cases generated from a test data dictionary. + + Each dictionary key (test type's name) maps to a list of transform + classes and list of tests. Each test is a list: input, expected + output, optional modifier. The optional third entry, a behavior + modifier, can be 0 (temporarily disable this test) or 1 (run this test + under the pdb debugger). Tests should be self-documenting and not + require external comments. + """ + for name, (transforms, cases) in dict.items(): + for casenum in range(len(cases)): + case = cases[casenum] + runInDebugger = 0 + if len(case)==3: + if case[2]: + runInDebugger = 1 + else: + continue + self.addTestCase( + TransformTestCase, testmethod, + transforms=transforms, parser=self.parser, + input=case[0], expected=case[1], + id='%s[%r][%s]' % (dictname, name, casenum), + runInDebugger=runInDebugger) + + +class TransformTestCase(CustomTestCase): + + """ + Output checker for the transform. + + Should probably be called TransformOutputChecker, but I can deal with + that later when/if someone comes up with a category of transform test + cases that have nothing to do with the input and output of the transform. + """ + + def __init__(self, *args, **kwargs): + self.transforms = kwargs['transforms'] + """List of transforms to perform for this test case.""" + + self.parser = kwargs['parser'] + """Input parser for this test case.""" + + del kwargs['transforms'], kwargs['parser'] # only wanted here + CustomTestCase.__init__(self, *args, **kwargs) + + def test_transforms(self): + if self.runInDebugger: + pdb.set_trace() + doctree = utils.newdocument(warninglevel=5, errorlevel=5, + debug=UnitTestFolder.debug) + self.parser.parse(self.input, doctree) + for transformClass in (self.transforms + universal.test_transforms): + transformClass(doctree).transform() + output = doctree.pformat() + self.compareOutput(self.input, output, self.expected) + + def test_transforms_verbosely(self): + if self.runInDebugger: + pdb.set_trace() + print '\n', self.id + print '-' * 70 + print self.input + doctree = utils.newdocument(warninglevel=5, errorlevel=5, + debug=UnitTestFolder.debug) + self.parser.parse(self.input, doctree) + print '-' * 70 + print doctree.pformat() + for transformClass in self.transforms: + transformClass(doctree).transform() + output = doctree.pformat() + print '-' * 70 + print output + self.compareOutput(self.input, output, self.expected) + + +class ParserTestSuite(CustomTestSuite): + + """ + A collection of ParserTestCases. + + A ParserTestSuite instance manufactures ParserTestCases, + keeps track of them, and provides a shared test fixture (a-la + setUp and tearDown). + """ + + def generateTests(self, dict, dictname='totest'): + """ + Stock the suite with test cases generated from a test data dictionary. + + Each dictionary key (test type name) maps to a list of tests. Each + test is a list: input, expected output, optional modifier. The + optional third entry, a behavior modifier, can be 0 (temporarily + disable this test) or 1 (run this test under the pdb debugger). Tests + should be self-documenting and not require external comments. + """ + for name, cases in dict.items(): + for casenum in range(len(cases)): + case = cases[casenum] + runInDebugger = 0 + if len(case)==3: + if case[2]: + runInDebugger = 1 + else: + continue + self.addTestCase( + ParserTestCase, 'test_parser', + input=case[0], expected=case[1], + id='%s[%r][%s]' % (dictname, name, casenum), + runInDebugger=runInDebugger) + + +class ParserTestCase(CustomTestCase): + + """ + Output checker for the parser. + + Should probably be called ParserOutputChecker, but I can deal with + that later when/if someone comes up with a category of parser test + cases that have nothing to do with the input and output of the parser. + """ + + parser = rst.Parser() + """Parser shared by all ParserTestCases.""" + + def test_parser(self): + if self.runInDebugger: + pdb.set_trace() + document = utils.newdocument(warninglevel=5, errorlevel=5, + debug=UnitTestFolder.debug) + self.parser.parse(self.input, document) + output = document.pformat() + self.compareOutput(self.input, output, self.expected) + + +class TableParserTestSuite(CustomTestSuite): + + """ + A collection of TableParserTestCases. + + A TableParserTestSuite instance manufactures TableParserTestCases, + keeps track of them, and provides a shared test fixture (a-la + setUp and tearDown). + """ + + def generateTests(self, dict, dictname='totest'): + """ + Stock the suite with test cases generated from a test data dictionary. + + Each dictionary key (test type name) maps to a list of tests. Each + test is a list: an input table, expected output from parsegrid(), + expected output from parse(), optional modifier. The optional fourth + entry, a behavior modifier, can be 0 (temporarily disable this test) + or 1 (run this test under the pdb debugger). Tests should be + self-documenting and not require external comments. + """ + for name, cases in dict.items(): + for casenum in range(len(cases)): + case = cases[casenum] + runInDebugger = 0 + if len(case) == 4: + if case[3]: + runInDebugger = 1 + else: + continue + self.addTestCase(TableParserTestCase, 'test_parsegrid', + input=case[0], expected=case[1], + id='%s[%r][%s]' % (dictname, name, casenum), + runInDebugger=runInDebugger) + self.addTestCase(TableParserTestCase, 'test_parse', + input=case[0], expected=case[2], + id='%s[%r][%s]' % (dictname, name, casenum), + runInDebugger=runInDebugger) + + +class TableParserTestCase(CustomTestCase): + + parser = tableparser.TableParser() + + def test_parsegrid(self): + self.parser.setup(string2lines(self.input)) + try: + self.parser.findheadbodysep() + self.parser.parsegrid() + output = self.parser.cells + except Exception, details: + output = '%s: %s' % (details.__class__.__name__, details) + self.compareOutput(self.input, pformat(output) + '\n', + pformat(self.expected) + '\n') + + def test_parse(self): + try: + output = self.parser.parse(string2lines(self.input)) + except Exception, details: + output = '%s: %s' % (details.__class__.__name__, details) + self.compareOutput(self.input, pformat(output) + '\n', + pformat(self.expected) + '\n') diff --git a/test/UnitTestFolder.py b/test/UnitTestFolder.py new file mode 100644 index 000000000..529d8c7e8 --- /dev/null +++ b/test/UnitTestFolder.py @@ -0,0 +1,135 @@ +#! /usr/bin/env python + +""" +:Author: Garth Kidd +:Contact: garth@deadlybloodyserious.com +:Revision: $Revision$ +:Date: $Date$ +:Copyright: This module has been placed in the public domain. +""" + +import sys, os, getopt, types, unittest, re + + +# So that individual test modules can share a bit of state, +# `UnitTestFolder` acts as an intermediary for the following +# variables: +debug = 0 +verbosity = 1 + +USAGE = """\ +Usage: test_whatever [options] + +Options: + -h, --help Show this message + -v, --verbose Verbose output + -q, --quiet Minimal output + -d, --debug Debug mode +""" + +def usageExit(msg=None): + """Print usage and exit.""" + if msg: + print msg + print USAGE + sys.exit(2) + +def parseArgs(argv=sys.argv): + """Parse command line arguments and set TestFramework state. + + State is to be acquired by test_* modules by a grotty hack: + ``from TestFramework import *``. For this stylistic + transgression, I expect to be first up against the wall + when the revolution comes. --Garth""" + global verbosity, debug + try: + options, args = getopt.getopt(argv[1:], 'hHvqd', + ['help', 'verbose', 'quiet', 'debug']) + for opt, value in options: + if opt in ('-h', '-H', '--help'): + usageExit() + if opt in ('-q', '--quiet'): + verbosity = 0 + if opt in ('-v', '--verbose'): + verbosity = 2 + if opt in ('-d', '--debug'): + debug =1 + if len(args) != 0: + usageExit("No command-line arguments supported yet.") + except getopt.error, msg: + self.usageExit(msg) + +def loadModulesFromFolder(path, name='', subfolders=None): + """ + Return a test suite composed of all the tests from modules in a folder. + + Search for modules in directory `path`, beginning with `name`. If + `subfolders` is true, search subdirectories (also beginning with `name`) + recursively. + """ + testLoader = unittest.defaultTestLoader + testSuite = unittest.TestSuite() + testModules = [] + paths = [path] + while paths: + p = paths.pop(0) + if not p: + p = os.curdir + files = os.listdir(p) + for filename in files: + if filename.startswith(name): + fullpath = os.path.join(p, filename) + if filename.endswith('.py'): + testModules.append(fullpath) + elif subfolders and os.path.isdir(fullpath): + paths.append(fullpath) + sys.path.insert(0, '') + # Import modules and add their tests to the suite. + for modpath in testModules: + if debug: + print >>sys.stderr, "importing %s" % modpath + sys.path[0], filename = os.path.split(modpath) + modname = filename[:-3] # strip off the '.py' + module = __import__(modname) + # if there's a suite defined, incorporate its contents + try: + suite = getattr(module, 'suite') + except AttributeError: + # Look for individual tests + moduleTests = testLoader.loadTestsFromModule(module) + # unittest.TestSuite.addTests() doesn't work as advertised, + # as it can't load tests from another TestSuite, so we have + # to cheat: + testSuite.addTest(moduleTests) + continue + if type(suite) == types.FunctionType: + testSuite.addTest(suite()) + elif type(suite) == types.InstanceType \ + and isinstance(suite, unittest.TestSuite): + testSuite.addTest(suite) + else: + raise AssertionError, "don't understand suite (%s)" % modpath + return testSuite + + +def main(suite=None): + """ + Shared `main` for any individual test_* file. + + suite -- TestSuite to run. If not specified, look for any globally defined + tests and run them. + """ + parseArgs() + if suite is None: + # Load any globally defined tests. + suite = unittest.defaultTestLoader.loadTestsFromModule( + __import__('__main__')) + if debug: + print >>sys.stderr, "Debug: Suite=%s" % suite + testRunner = unittest.TextTestRunner(verbosity=verbosity) + # run suites (if we were called from test_all) or suite... + if type(suite) == type([]): + for s in suite: + testRunner.run(s) + else: + testRunner.run(suite) diff --git a/test/alltests.py b/test/alltests.py new file mode 100755 index 000000000..930cbdc1b --- /dev/null +++ b/test/alltests.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python + +""" +:Author: David Goodger +:Contact: goodger@users.sourceforge.net +:Revision: $Revision$ +:Date: $Date$ +:Copyright: This module has been placed in the public domain. +""" + +import time +start = time.time() + +import sys, os + + +class Tee: + + """Write to a file and a stream (default: stdout) simultaneously.""" + + def __init__(self, filename, stream=sys.__stdout__): + self.file = open(filename, 'w') + self.stream = stream + + def write(self, string): + string = string.encode('raw-unicode-escape') + self.stream.write(string) + self.file.write(string) + +# must redirect stderr *before* first import of unittest +sys.stdout = sys.stderr = Tee('alltests.out') + +import UnitTestFolder + + +if __name__ == '__main__': + path, script = os.path.split(sys.argv[0]) + suite = UnitTestFolder.loadModulesFromFolder(path, 'test_', subfolders=1) + UnitTestFolder.main(suite) + finish = time.time() + print 'Elapsed time: %.3f seconds' % (finish - start) diff --git a/test/difflib.py b/test/difflib.py new file mode 100644 index 000000000..a41d4d5ba --- /dev/null +++ b/test/difflib.py @@ -0,0 +1,1089 @@ +#! /usr/bin/env python + +""" +Module difflib -- helpers for computing deltas between objects. + +Function get_close_matches(word, possibilities, n=3, cutoff=0.6): + Use SequenceMatcher to return list of the best "good enough" matches. + +Function ndiff(a, b): + Return a delta: the difference between `a` and `b` (lists of strings). + +Function restore(delta, which): + Return one of the two sequences that generated an ndiff delta. + +Class SequenceMatcher: + A flexible class for comparing pairs of sequences of any type. + +Class Differ: + For producing human-readable deltas from sequences of lines of text. +""" + +__all__ = ['get_close_matches', 'ndiff', 'restore', 'SequenceMatcher', + 'Differ'] + +TRACE = 0 + +class SequenceMatcher: + + """ + SequenceMatcher is a flexible class for comparing pairs of sequences of + any type, so long as the sequence elements are hashable. The basic + algorithm predates, and is a little fancier than, an algorithm + published in the late 1980's by Ratcliff and Obershelp under the + hyperbolic name "gestalt pattern matching". The basic idea is to find + the longest contiguous matching subsequence that contains no "junk" + elements (R-O doesn't address junk). The same idea is then applied + recursively to the pieces of the sequences to the left and to the right + of the matching subsequence. This does not yield minimal edit + sequences, but does tend to yield matches that "look right" to people. + + SequenceMatcher tries to compute a "human-friendly diff" between two + sequences. Unlike e.g. UNIX(tm) diff, the fundamental notion is the + longest *contiguous* & junk-free matching subsequence. That's what + catches peoples' eyes. The Windows(tm) windiff has another interesting + notion, pairing up elements that appear uniquely in each sequence. + That, and the method here, appear to yield more intuitive difference + reports than does diff. This method appears to be the least vulnerable + to synching up on blocks of "junk lines", though (like blank lines in + ordinary text files, or maybe "

" lines in HTML files). That may be + because this is the only method of the 3 that has a *concept* of + "junk" . + + Example, comparing two strings, and considering blanks to be "junk": + + >>> s = SequenceMatcher(lambda x: x == " ", + ... "private Thread currentThread;", + ... "private volatile Thread currentThread;") + >>> + + .ratio() returns a float in [0, 1], measuring the "similarity" of the + sequences. As a rule of thumb, a .ratio() value over 0.6 means the + sequences are close matches: + + >>> print round(s.ratio(), 3) + 0.866 + >>> + + If you're only interested in where the sequences match, + .get_matching_blocks() is handy: + + >>> for block in s.get_matching_blocks(): + ... print "a[%d] and b[%d] match for %d elements" % block + a[0] and b[0] match for 8 elements + a[8] and b[17] match for 6 elements + a[14] and b[23] match for 15 elements + a[29] and b[38] match for 0 elements + + Note that the last tuple returned by .get_matching_blocks() is always a + dummy, (len(a), len(b), 0), and this is the only case in which the last + tuple element (number of elements matched) is 0. + + If you want to know how to change the first sequence into the second, + use .get_opcodes(): + + >>> for opcode in s.get_opcodes(): + ... print "%6s a[%d:%d] b[%d:%d]" % opcode + equal a[0:8] b[0:8] + insert a[8:8] b[8:17] + equal a[8:14] b[17:23] + equal a[14:29] b[23:38] + + See the Differ class for a fancy human-friendly file differencer, which + uses SequenceMatcher both to compare sequences of lines, and to compare + sequences of characters within similar (near-matching) lines. + + See also function get_close_matches() in this module, which shows how + simple code building on SequenceMatcher can be used to do useful work. + + Timing: Basic R-O is cubic time worst case and quadratic time expected + case. SequenceMatcher is quadratic time for the worst case and has + expected-case behavior dependent in a complicated way on how many + elements the sequences have in common; best case time is linear. + + Methods: + + __init__(isjunk=None, a='', b='') + Construct a SequenceMatcher. + + set_seqs(a, b) + Set the two sequences to be compared. + + set_seq1(a) + Set the first sequence to be compared. + + set_seq2(b) + Set the second sequence to be compared. + + find_longest_match(alo, ahi, blo, bhi) + Find longest matching block in a[alo:ahi] and b[blo:bhi]. + + get_matching_blocks() + Return list of triples describing matching subsequences. + + get_opcodes() + Return list of 5-tuples describing how to turn a into b. + + ratio() + Return a measure of the sequences' similarity (float in [0,1]). + + quick_ratio() + Return an upper bound on .ratio() relatively quickly. + + real_quick_ratio() + Return an upper bound on ratio() very quickly. + """ + + def __init__(self, isjunk=None, a='', b=''): + """Construct a SequenceMatcher. + + Optional arg isjunk is None (the default), or a one-argument + function that takes a sequence element and returns true iff the + element is junk. None is equivalent to passing "lambda x: 0", i.e. + no elements are considered to be junk. For example, pass + lambda x: x in " \\t" + if you're comparing lines as sequences of characters, and don't + want to synch up on blanks or hard tabs. + + Optional arg a is the first of two sequences to be compared. By + default, an empty string. The elements of a must be hashable. See + also .set_seqs() and .set_seq1(). + + Optional arg b is the second of two sequences to be compared. By + default, an empty string. The elements of b must be hashable. See + also .set_seqs() and .set_seq2(). + """ + + # Members: + # a + # first sequence + # b + # second sequence; differences are computed as "what do + # we need to do to 'a' to change it into 'b'?" + # b2j + # for x in b, b2j[x] is a list of the indices (into b) + # at which x appears; junk elements do not appear + # b2jhas + # b2j.has_key + # fullbcount + # for x in b, fullbcount[x] == the number of times x + # appears in b; only materialized if really needed (used + # only for computing quick_ratio()) + # matching_blocks + # a list of (i, j, k) triples, where a[i:i+k] == b[j:j+k]; + # ascending & non-overlapping in i and in j; terminated by + # a dummy (len(a), len(b), 0) sentinel + # opcodes + # a list of (tag, i1, i2, j1, j2) tuples, where tag is + # one of + # 'replace' a[i1:i2] should be replaced by b[j1:j2] + # 'delete' a[i1:i2] should be deleted + # 'insert' b[j1:j2] should be inserted + # 'equal' a[i1:i2] == b[j1:j2] + # isjunk + # a user-supplied function taking a sequence element and + # returning true iff the element is "junk" -- this has + # subtle but helpful effects on the algorithm, which I'll + # get around to writing up someday <0.9 wink>. + # DON'T USE! Only __chain_b uses this. Use isbjunk. + # isbjunk + # for x in b, isbjunk(x) == isjunk(x) but much faster; + # it's really the has_key method of a hidden dict. + # DOES NOT WORK for x in a! + + self.isjunk = isjunk + self.a = self.b = None + self.set_seqs(a, b) + + def set_seqs(self, a, b): + """Set the two sequences to be compared. + + >>> s = SequenceMatcher() + >>> s.set_seqs("abcd", "bcde") + >>> s.ratio() + 0.75 + """ + + self.set_seq1(a) + self.set_seq2(b) + + def set_seq1(self, a): + """Set the first sequence to be compared. + + The second sequence to be compared is not changed. + + >>> s = SequenceMatcher(None, "abcd", "bcde") + >>> s.ratio() + 0.75 + >>> s.set_seq1("bcde") + >>> s.ratio() + 1.0 + >>> + + SequenceMatcher computes and caches detailed information about the + second sequence, so if you want to compare one sequence S against + many sequences, use .set_seq2(S) once and call .set_seq1(x) + repeatedly for each of the other sequences. + + See also set_seqs() and set_seq2(). + """ + + if a is self.a: + return + self.a = a + self.matching_blocks = self.opcodes = None + + def set_seq2(self, b): + """Set the second sequence to be compared. + + The first sequence to be compared is not changed. + + >>> s = SequenceMatcher(None, "abcd", "bcde") + >>> s.ratio() + 0.75 + >>> s.set_seq2("abcd") + >>> s.ratio() + 1.0 + >>> + + SequenceMatcher computes and caches detailed information about the + second sequence, so if you want to compare one sequence S against + many sequences, use .set_seq2(S) once and call .set_seq1(x) + repeatedly for each of the other sequences. + + See also set_seqs() and set_seq1(). + """ + + if b is self.b: + return + self.b = b + self.matching_blocks = self.opcodes = None + self.fullbcount = None + self.__chain_b() + + # For each element x in b, set b2j[x] to a list of the indices in + # b where x appears; the indices are in increasing order; note that + # the number of times x appears in b is len(b2j[x]) ... + # when self.isjunk is defined, junk elements don't show up in this + # map at all, which stops the central find_longest_match method + # from starting any matching block at a junk element ... + # also creates the fast isbjunk function ... + # note that this is only called when b changes; so for cross-product + # kinds of matches, it's best to call set_seq2 once, then set_seq1 + # repeatedly + + def __chain_b(self): + # Because isjunk is a user-defined (not C) function, and we test + # for junk a LOT, it's important to minimize the number of calls. + # Before the tricks described here, __chain_b was by far the most + # time-consuming routine in the whole module! If anyone sees + # Jim Roskind, thank him again for profile.py -- I never would + # have guessed that. + # The first trick is to build b2j ignoring the possibility + # of junk. I.e., we don't call isjunk at all yet. Throwing + # out the junk later is much cheaper than building b2j "right" + # from the start. + b = self.b + self.b2j = b2j = {} + self.b2jhas = b2jhas = b2j.has_key + for i in xrange(len(b)): + elt = b[i] + if b2jhas(elt): + b2j[elt].append(i) + else: + b2j[elt] = [i] + + # Now b2j.keys() contains elements uniquely, and especially when + # the sequence is a string, that's usually a good deal smaller + # than len(string). The difference is the number of isjunk calls + # saved. + isjunk, junkdict = self.isjunk, {} + if isjunk: + for elt in b2j.keys(): + if isjunk(elt): + junkdict[elt] = 1 # value irrelevant; it's a set + del b2j[elt] + + # Now for x in b, isjunk(x) == junkdict.has_key(x), but the + # latter is much faster. Note too that while there may be a + # lot of junk in the sequence, the number of *unique* junk + # elements is probably small. So the memory burden of keeping + # this dict alive is likely trivial compared to the size of b2j. + self.isbjunk = junkdict.has_key + + def find_longest_match(self, alo, ahi, blo, bhi): + """Find longest matching block in a[alo:ahi] and b[blo:bhi]. + + If isjunk is not defined: + + Return (i,j,k) such that a[i:i+k] is equal to b[j:j+k], where + alo <= i <= i+k <= ahi + blo <= j <= j+k <= bhi + and for all (i',j',k') meeting those conditions, + k >= k' + i <= i' + and if i == i', j <= j' + + In other words, of all maximal matching blocks, return one that + starts earliest in a, and of all those maximal matching blocks that + start earliest in a, return the one that starts earliest in b. + + >>> s = SequenceMatcher(None, " abcd", "abcd abcd") + >>> s.find_longest_match(0, 5, 0, 9) + (0, 4, 5) + + If isjunk is defined, first the longest matching block is + determined as above, but with the additional restriction that no + junk element appears in the block. Then that block is extended as + far as possible by matching (only) junk elements on both sides. So + the resulting block never matches on junk except as identical junk + happens to be adjacent to an "interesting" match. + + Here's the same example as before, but considering blanks to be + junk. That prevents " abcd" from matching the " abcd" at the tail + end of the second sequence directly. Instead only the "abcd" can + match, and matches the leftmost "abcd" in the second sequence: + + >>> s = SequenceMatcher(lambda x: x==" ", " abcd", "abcd abcd") + >>> s.find_longest_match(0, 5, 0, 9) + (1, 0, 4) + + If no blocks match, return (alo, blo, 0). + + >>> s = SequenceMatcher(None, "ab", "c") + >>> s.find_longest_match(0, 2, 0, 1) + (0, 0, 0) + """ + + # CAUTION: stripping common prefix or suffix would be incorrect. + # E.g., + # ab + # acab + # Longest matching block is "ab", but if common prefix is + # stripped, it's "a" (tied with "b"). UNIX(tm) diff does so + # strip, so ends up claiming that ab is changed to acab by + # inserting "ca" in the middle. That's minimal but unintuitive: + # "it's obvious" that someone inserted "ac" at the front. + # Windiff ends up at the same place as diff, but by pairing up + # the unique 'b's and then matching the first two 'a's. + + a, b, b2j, isbjunk = self.a, self.b, self.b2j, self.isbjunk + besti, bestj, bestsize = alo, blo, 0 + # find longest junk-free match + # during an iteration of the loop, j2len[j] = length of longest + # junk-free match ending with a[i-1] and b[j] + j2len = {} + nothing = [] + for i in xrange(alo, ahi): + # look at all instances of a[i] in b; note that because + # b2j has no junk keys, the loop is skipped if a[i] is junk + j2lenget = j2len.get + newj2len = {} + for j in b2j.get(a[i], nothing): + # a[i] matches b[j] + if j < blo: + continue + if j >= bhi: + break + k = newj2len[j] = j2lenget(j-1, 0) + 1 + if k > bestsize: + besti, bestj, bestsize = i-k+1, j-k+1, k + j2len = newj2len + + # Now that we have a wholly interesting match (albeit possibly + # empty!), we may as well suck up the matching junk on each + # side of it too. Can't think of a good reason not to, and it + # saves post-processing the (possibly considerable) expense of + # figuring out what to do with it. In the case of an empty + # interesting match, this is clearly the right thing to do, + # because no other kind of match is possible in the regions. + while besti > alo and bestj > blo and \ + isbjunk(b[bestj-1]) and \ + a[besti-1] == b[bestj-1]: + besti, bestj, bestsize = besti-1, bestj-1, bestsize+1 + while besti+bestsize < ahi and bestj+bestsize < bhi and \ + isbjunk(b[bestj+bestsize]) and \ + a[besti+bestsize] == b[bestj+bestsize]: + bestsize = bestsize + 1 + + if TRACE: + print "get_matching_blocks", alo, ahi, blo, bhi + print " returns", besti, bestj, bestsize + return besti, bestj, bestsize + + def get_matching_blocks(self): + """Return list of triples describing matching subsequences. + + Each triple is of the form (i, j, n), and means that + a[i:i+n] == b[j:j+n]. The triples are monotonically increasing in + i and in j. + + The last triple is a dummy, (len(a), len(b), 0), and is the only + triple with n==0. + + >>> s = SequenceMatcher(None, "abxcd", "abcd") + >>> s.get_matching_blocks() + [(0, 0, 2), (3, 2, 2), (5, 4, 0)] + """ + + if self.matching_blocks is not None: + return self.matching_blocks + self.matching_blocks = [] + la, lb = len(self.a), len(self.b) + self.__helper(0, la, 0, lb, self.matching_blocks) + self.matching_blocks.append( (la, lb, 0) ) + if TRACE: + print '*** matching blocks', self.matching_blocks + return self.matching_blocks + + # builds list of matching blocks covering a[alo:ahi] and + # b[blo:bhi], appending them in increasing order to answer + + def __helper(self, alo, ahi, blo, bhi, answer): + i, j, k = x = self.find_longest_match(alo, ahi, blo, bhi) + # a[alo:i] vs b[blo:j] unknown + # a[i:i+k] same as b[j:j+k] + # a[i+k:ahi] vs b[j+k:bhi] unknown + if k: + if alo < i and blo < j: + self.__helper(alo, i, blo, j, answer) + answer.append(x) + if i+k < ahi and j+k < bhi: + self.__helper(i+k, ahi, j+k, bhi, answer) + + def get_opcodes(self): + """Return list of 5-tuples describing how to turn a into b. + + Each tuple is of the form (tag, i1, i2, j1, j2). The first tuple + has i1 == j1 == 0, and remaining tuples have i1 == the i2 from the + tuple preceding it, and likewise for j1 == the previous j2. + + The tags are strings, with these meanings: + + 'replace': a[i1:i2] should be replaced by b[j1:j2] + 'delete': a[i1:i2] should be deleted. + Note that j1==j2 in this case. + 'insert': b[j1:j2] should be inserted at a[i1:i1]. + Note that i1==i2 in this case. + 'equal': a[i1:i2] == b[j1:j2] + + >>> a = "qabxcd" + >>> b = "abycdf" + >>> s = SequenceMatcher(None, a, b) + >>> for tag, i1, i2, j1, j2 in s.get_opcodes(): + ... print ("%7s a[%d:%d] (%s) b[%d:%d] (%s)" % + ... (tag, i1, i2, a[i1:i2], j1, j2, b[j1:j2])) + delete a[0:1] (q) b[0:0] () + equal a[1:3] (ab) b[0:2] (ab) + replace a[3:4] (x) b[2:3] (y) + equal a[4:6] (cd) b[3:5] (cd) + insert a[6:6] () b[5:6] (f) + """ + + if self.opcodes is not None: + return self.opcodes + i = j = 0 + self.opcodes = answer = [] + for ai, bj, size in self.get_matching_blocks(): + # invariant: we've pumped out correct diffs to change + # a[:i] into b[:j], and the next matching block is + # a[ai:ai+size] == b[bj:bj+size]. So we need to pump + # out a diff to change a[i:ai] into b[j:bj], pump out + # the matching block, and move (i,j) beyond the match + tag = '' + if i < ai and j < bj: + tag = 'replace' + elif i < ai: + tag = 'delete' + elif j < bj: + tag = 'insert' + if tag: + answer.append( (tag, i, ai, j, bj) ) + i, j = ai+size, bj+size + # the list of matching blocks is terminated by a + # sentinel with size 0 + if size: + answer.append( ('equal', ai, i, bj, j) ) + return answer + + def ratio(self): + """Return a measure of the sequences' similarity (float in [0,1]). + + Where T is the total number of elements in both sequences, and + M is the number of matches, this is 2,0*M / T. + Note that this is 1 if the sequences are identical, and 0 if + they have nothing in common. + + .ratio() is expensive to compute if you haven't already computed + .get_matching_blocks() or .get_opcodes(), in which case you may + want to try .quick_ratio() or .real_quick_ratio() first to get an + upper bound. + + >>> s = SequenceMatcher(None, "abcd", "bcde") + >>> s.ratio() + 0.75 + >>> s.quick_ratio() + 0.75 + >>> s.real_quick_ratio() + 1.0 + """ + + matches = reduce(lambda sum, triple: sum + triple[-1], + self.get_matching_blocks(), 0) + return 2.0 * matches / (len(self.a) + len(self.b)) + + def quick_ratio(self): + """Return an upper bound on ratio() relatively quickly. + + This isn't defined beyond that it is an upper bound on .ratio(), and + is faster to compute. + """ + + # viewing a and b as multisets, set matches to the cardinality + # of their intersection; this counts the number of matches + # without regard to order, so is clearly an upper bound + if self.fullbcount is None: + self.fullbcount = fullbcount = {} + for elt in self.b: + fullbcount[elt] = fullbcount.get(elt, 0) + 1 + fullbcount = self.fullbcount + # avail[x] is the number of times x appears in 'b' less the + # number of times we've seen it in 'a' so far ... kinda + avail = {} + availhas, matches = avail.has_key, 0 + for elt in self.a: + if availhas(elt): + numb = avail[elt] + else: + numb = fullbcount.get(elt, 0) + avail[elt] = numb - 1 + if numb > 0: + matches = matches + 1 + return 2.0 * matches / (len(self.a) + len(self.b)) + + def real_quick_ratio(self): + """Return an upper bound on ratio() very quickly. + + This isn't defined beyond that it is an upper bound on .ratio(), and + is faster to compute than either .ratio() or .quick_ratio(). + """ + + la, lb = len(self.a), len(self.b) + # can't have more matches than the number of elements in the + # shorter sequence + return 2.0 * min(la, lb) / (la + lb) + +def get_close_matches(word, possibilities, n=3, cutoff=0.6): + """Use SequenceMatcher to return list of the best "good enough" matches. + + word is a sequence for which close matches are desired (typically a + string). + + possibilities is a list of sequences against which to match word + (typically a list of strings). + + Optional arg n (default 3) is the maximum number of close matches to + return. n must be > 0. + + Optional arg cutoff (default 0.6) is a float in [0, 1]. Possibilities + that don't score at least that similar to word are ignored. + + The best (no more than n) matches among the possibilities are returned + in a list, sorted by similarity score, most similar first. + + >>> get_close_matches("appel", ["ape", "apple", "peach", "puppy"]) + ['apple', 'ape'] + >>> import keyword as _keyword + >>> get_close_matches("wheel", _keyword.kwlist) + ['while'] + >>> get_close_matches("apple", _keyword.kwlist) + [] + >>> get_close_matches("accept", _keyword.kwlist) + ['except'] + """ + + if not n > 0: + raise ValueError("n must be > 0: " + `n`) + if not 0.0 <= cutoff <= 1.0: + raise ValueError("cutoff must be in [0.0, 1.0]: " + `cutoff`) + result = [] + s = SequenceMatcher() + s.set_seq2(word) + for x in possibilities: + s.set_seq1(x) + if s.real_quick_ratio() >= cutoff and \ + s.quick_ratio() >= cutoff and \ + s.ratio() >= cutoff: + result.append((s.ratio(), x)) + # Sort by score. + result.sort() + # Retain only the best n. + result = result[-n:] + # Move best-scorer to head of list. + result.reverse() + # Strip scores. + return [x for score, x in result] + + +def _count_leading(line, ch): + """ + Return number of `ch` characters at the start of `line`. + + Example: + + >>> _count_leading(' abc', ' ') + 3 + """ + + i, n = 0, len(line) + while i < n and line[i] == ch: + i += 1 + return i + +class Differ: + r""" + Differ is a class for comparing sequences of lines of text, and + producing human-readable differences or deltas. Differ uses + SequenceMatcher both to compare sequences of lines, and to compare + sequences of characters within similar (near-matching) lines. + + Each line of a Differ delta begins with a two-letter code: + + '- ' line unique to sequence 1 + '+ ' line unique to sequence 2 + ' ' line common to both sequences + '? ' line not present in either input sequence + + Lines beginning with '? ' attempt to guide the eye to intraline + differences, and were not present in either input sequence. These lines + can be confusing if the sequences contain tab characters. + + Note that Differ makes no claim to produce a *minimal* diff. To the + contrary, minimal diffs are often counter-intuitive, because they synch + up anywhere possible, sometimes accidental matches 100 pages apart. + Restricting synch points to contiguous matches preserves some notion of + locality, at the occasional cost of producing a longer diff. + + Example: Comparing two texts. + + First we set up the texts, sequences of individual single-line strings + ending with newlines (such sequences can also be obtained from the + `readlines()` method of file-like objects): + + >>> text1 = ''' 1. Beautiful is better than ugly. + ... 2. Explicit is better than implicit. + ... 3. Simple is better than complex. + ... 4. Complex is better than complicated. + ... '''.splitlines(1) + >>> len(text1) + 4 + >>> text1[0][-1] + '\n' + >>> text2 = ''' 1. Beautiful is better than ugly. + ... 3. Simple is better than complex. + ... 4. Complicated is better than complex. + ... 5. Flat is better than nested. + ... '''.splitlines(1) + + Next we instantiate a Differ object: + + >>> d = Differ() + + Note that when instantiating a Differ object we may pass functions to + filter out line and character 'junk'. See Differ.__init__ for details. + + Finally, we compare the two: + + >>> result = d.compare(text1, text2) + + 'result' is a list of strings, so let's pretty-print it: + + >>> from pprint import pprint as _pprint + >>> _pprint(result) + [' 1. Beautiful is better than ugly.\n', + '- 2. Explicit is better than implicit.\n', + '- 3. Simple is better than complex.\n', + '+ 3. Simple is better than complex.\n', + '? ++\n', + '- 4. Complex is better than complicated.\n', + '? ^ ---- ^\n', + '+ 4. Complicated is better than complex.\n', + '? ++++ ^ ^\n', + '+ 5. Flat is better than nested.\n'] + + As a single multi-line string it looks like this: + + >>> print ''.join(result), + 1. Beautiful is better than ugly. + - 2. Explicit is better than implicit. + - 3. Simple is better than complex. + + 3. Simple is better than complex. + ? ++ + - 4. Complex is better than complicated. + ? ^ ---- ^ + + 4. Complicated is better than complex. + ? ++++ ^ ^ + + 5. Flat is better than nested. + + Methods: + + __init__(linejunk=None, charjunk=None) + Construct a text differencer, with optional filters. + + compare(a, b) + Compare two sequences of lines; return the resulting delta (list). + """ + + def __init__(self, linejunk=None, charjunk=None): + """ + Construct a text differencer, with optional filters. + + The two optional keyword parameters are for filter functions: + + - `linejunk`: A function that should accept a single string argument, + and return true iff the string is junk. The module-level function + `IS_LINE_JUNK` may be used to filter out lines without visible + characters, except for at most one splat ('#'). + + - `charjunk`: A function that should accept a string of length 1. The + module-level function `IS_CHARACTER_JUNK` may be used to filter out + whitespace characters (a blank or tab; **note**: bad idea to include + newline in this!). + """ + + self.linejunk = linejunk + self.charjunk = charjunk + self.results = [] + + def compare(self, a, b): + r""" + Compare two sequences of lines; return the resulting delta (list). + + Each sequence must contain individual single-line strings ending with + newlines. Such sequences can be obtained from the `readlines()` method + of file-like objects. The list returned is also made up of + newline-terminated strings, ready to be used with the `writelines()` + method of a file-like object. + + Example: + + >>> print ''.join(Differ().compare('one\ntwo\nthree\n'.splitlines(1), + ... 'ore\ntree\nemu\n'.splitlines(1))), + - one + ? ^ + + ore + ? ^ + - two + - three + ? - + + tree + + emu + """ + + cruncher = SequenceMatcher(self.linejunk, a, b) + for tag, alo, ahi, blo, bhi in cruncher.get_opcodes(): + if tag == 'replace': + self._fancy_replace(a, alo, ahi, b, blo, bhi) + elif tag == 'delete': + self._dump('-', a, alo, ahi) + elif tag == 'insert': + self._dump('+', b, blo, bhi) + elif tag == 'equal': + self._dump(' ', a, alo, ahi) + else: + raise ValueError, 'unknown tag ' + `tag` + results = self.results + self.results = [] + return results + + def _dump(self, tag, x, lo, hi): + """Store comparison results for a same-tagged range.""" + for i in xrange(lo, hi): + self.results.append('%s %s' % (tag, x[i])) + + def _plain_replace(self, a, alo, ahi, b, blo, bhi): + assert alo < ahi and blo < bhi + # dump the shorter block first -- reduces the burden on short-term + # memory if the blocks are of very different sizes + if bhi - blo < ahi - alo: + self._dump('+', b, blo, bhi) + self._dump('-', a, alo, ahi) + else: + self._dump('-', a, alo, ahi) + self._dump('+', b, blo, bhi) + + def _fancy_replace(self, a, alo, ahi, b, blo, bhi): + r""" + When replacing one block of lines with another, search the blocks + for *similar* lines; the best-matching pair (if any) is used as a + synch point, and intraline difference marking is done on the + similar pair. Lots of work, but often worth it. + + Example: + + >>> d = Differ() + >>> d._fancy_replace(['abcDefghiJkl\n'], 0, 1, ['abcdefGhijkl\n'], 0, 1) + >>> print ''.join(d.results), + - abcDefghiJkl + ? ^ ^ ^ + + abcdefGhijkl + ? ^ ^ ^ + """ + + if TRACE: + self.results.append('*** _fancy_replace %s %s %s %s\n' + % (alo, ahi, blo, bhi)) + self._dump('>', a, alo, ahi) + self._dump('<', b, blo, bhi) + + # don't synch up unless the lines have a similarity score of at + # least cutoff; best_ratio tracks the best score seen so far + best_ratio, cutoff = 0.74, 0.75 + cruncher = SequenceMatcher(self.charjunk) + eqi, eqj = None, None # 1st indices of equal lines (if any) + + # search for the pair that matches best without being identical + # (identical lines must be junk lines, & we don't want to synch up + # on junk -- unless we have to) + for j in xrange(blo, bhi): + bj = b[j] + cruncher.set_seq2(bj) + for i in xrange(alo, ahi): + ai = a[i] + if ai == bj: + if eqi is None: + eqi, eqj = i, j + continue + cruncher.set_seq1(ai) + # computing similarity is expensive, so use the quick + # upper bounds first -- have seen this speed up messy + # compares by a factor of 3. + # note that ratio() is only expensive to compute the first + # time it's called on a sequence pair; the expensive part + # of the computation is cached by cruncher + if cruncher.real_quick_ratio() > best_ratio and \ + cruncher.quick_ratio() > best_ratio and \ + cruncher.ratio() > best_ratio: + best_ratio, best_i, best_j = cruncher.ratio(), i, j + if best_ratio < cutoff: + # no non-identical "pretty close" pair + if eqi is None: + # no identical pair either -- treat it as a straight replace + self._plain_replace(a, alo, ahi, b, blo, bhi) + return + # no close pair, but an identical pair -- synch up on that + best_i, best_j, best_ratio = eqi, eqj, 1.0 + else: + # there's a close pair, so forget the identical pair (if any) + eqi = None + + # a[best_i] very similar to b[best_j]; eqi is None iff they're not + # identical + if TRACE: + self.results.append('*** best_ratio %s %s %s %s\n' + % (best_ratio, best_i, best_j)) + self._dump('>', a, best_i, best_i+1) + self._dump('<', b, best_j, best_j+1) + + # pump out diffs from before the synch point + self._fancy_helper(a, alo, best_i, b, blo, best_j) + + # do intraline marking on the synch pair + aelt, belt = a[best_i], b[best_j] + if eqi is None: + # pump out a '-', '?', '+', '?' quad for the synched lines + atags = btags = "" + cruncher.set_seqs(aelt, belt) + for tag, ai1, ai2, bj1, bj2 in cruncher.get_opcodes(): + la, lb = ai2 - ai1, bj2 - bj1 + if tag == 'replace': + atags += '^' * la + btags += '^' * lb + elif tag == 'delete': + atags += '-' * la + elif tag == 'insert': + btags += '+' * lb + elif tag == 'equal': + atags += ' ' * la + btags += ' ' * lb + else: + raise ValueError, 'unknown tag ' + `tag` + self._qformat(aelt, belt, atags, btags) + else: + # the synch pair is identical + self.results.append(' ' + aelt) + + # pump out diffs from after the synch point + self._fancy_helper(a, best_i+1, ahi, b, best_j+1, bhi) + + def _fancy_helper(self, a, alo, ahi, b, blo, bhi): + if alo < ahi: + if blo < bhi: + self._fancy_replace(a, alo, ahi, b, blo, bhi) + else: + self._dump('-', a, alo, ahi) + elif blo < bhi: + self._dump('+', b, blo, bhi) + + def _qformat(self, aline, bline, atags, btags): + r""" + Format "?" output and deal with leading tabs. + + Example: + + >>> d = Differ() + >>> d._qformat('\tabcDefghiJkl\n', '\t\tabcdefGhijkl\n', + ... ' ^ ^ ^ ', '+ ^ ^ ^ ') + >>> for line in d.results: print repr(line) + ... + '- \tabcDefghiJkl\n' + '? \t ^ ^ ^\n' + '+ \t\tabcdefGhijkl\n' + '? \t ^ ^ ^\n' + """ + + # Can hurt, but will probably help most of the time. + common = min(_count_leading(aline, "\t"), + _count_leading(bline, "\t")) + common = min(common, _count_leading(atags[:common], " ")) + atags = atags[common:].rstrip() + btags = btags[common:].rstrip() + + self.results.append("- " + aline) + if atags: + self.results.append("? %s%s\n" % ("\t" * common, atags)) + + self.results.append("+ " + bline) + if btags: + self.results.append("? %s%s\n" % ("\t" * common, btags)) + +# With respect to junk, an earlier version of ndiff simply refused to +# *start* a match with a junk element. The result was cases like this: +# before: private Thread currentThread; +# after: private volatile Thread currentThread; +# If you consider whitespace to be junk, the longest contiguous match +# not starting with junk is "e Thread currentThread". So ndiff reported +# that "e volatil" was inserted between the 't' and the 'e' in "private". +# While an accurate view, to people that's absurd. The current version +# looks for matching blocks that are entirely junk-free, then extends the +# longest one of those as far as possible but only with matching junk. +# So now "currentThread" is matched, then extended to suck up the +# preceding blank; then "private" is matched, and extended to suck up the +# following blank; then "Thread" is matched; and finally ndiff reports +# that "volatile " was inserted before "Thread". The only quibble +# remaining is that perhaps it was really the case that " volatile" +# was inserted after "private". I can live with that . + +import re + +def IS_LINE_JUNK(line, pat=re.compile(r"\s*#?\s*$").match): + r""" + Return 1 for ignorable line: iff `line` is blank or contains a single '#'. + + Examples: + + >>> IS_LINE_JUNK('\n') + 1 + >>> IS_LINE_JUNK(' # \n') + 1 + >>> IS_LINE_JUNK('hello\n') + 0 + """ + + return pat(line) is not None + +def IS_CHARACTER_JUNK(ch, ws=" \t"): + r""" + Return 1 for ignorable character: iff `ch` is a space or tab. + + Examples: + + >>> IS_CHARACTER_JUNK(' ') + 1 + >>> IS_CHARACTER_JUNK('\t') + 1 + >>> IS_CHARACTER_JUNK('\n') + 0 + >>> IS_CHARACTER_JUNK('x') + 0 + """ + + return ch in ws + +del re + +def ndiff(a, b, linejunk=IS_LINE_JUNK, charjunk=IS_CHARACTER_JUNK): + r""" + Compare `a` and `b` (lists of strings); return a `Differ`-style delta. + + Optional keyword parameters `linejunk` and `charjunk` are for filter + functions (or None): + + - linejunk: A function that should accept a single string argument, and + return true iff the string is junk. The default is module-level function + IS_LINE_JUNK, which filters out lines without visible characters, except + for at most one splat ('#'). + + - charjunk: A function that should accept a string of length 1. The + default is module-level function IS_CHARACTER_JUNK, which filters out + whitespace characters (a blank or tab; note: bad idea to include newline + in this!). + + Tools/scripts/ndiff.py is a command-line front-end to this function. + + Example: + + >>> diff = ndiff('one\ntwo\nthree\n'.splitlines(1), + ... 'ore\ntree\nemu\n'.splitlines(1)) + >>> print ''.join(diff), + - one + ? ^ + + ore + ? ^ + - two + - three + ? - + + tree + + emu + """ + return Differ(linejunk, charjunk).compare(a, b) + +def restore(delta, which): + r""" + Return one of the two sequences that generated a delta. + + Given a `delta` produced by `Differ.compare()` or `ndiff()`, extract + lines originating from file 1 or 2 (parameter `which`), stripping off line + prefixes. + + Examples: + + >>> diff = ndiff('one\ntwo\nthree\n'.splitlines(1), + ... 'ore\ntree\nemu\n'.splitlines(1)) + >>> print ''.join(restore(diff, 1)), + one + two + three + >>> print ''.join(restore(diff, 2)), + ore + tree + emu + """ + try: + tag = {1: "- ", 2: "+ "}[int(which)] + except KeyError: + raise ValueError, ('unknown delta choice (must be 1 or 2): %r' + % which) + prefixes = (" ", tag) + results = [] + for line in delta: + if line[:2] in prefixes: + results.append(line[2:]) + return results + +def _test(): + import doctest, difflib + return doctest.testmod(difflib) + +if __name__ == "__main__": + _test() diff --git a/test/test_nodes.py b/test/test_nodes.py new file mode 100755 index 000000000..15e633357 --- /dev/null +++ b/test/test_nodes.py @@ -0,0 +1,83 @@ +#! /usr/bin/env python + +""" +:Author: David Goodger +:Contact: goodger@users.sourceforge.net +:Revision: $Revision$ +:Date: $Date$ +:Copyright: This module has been placed in the public domain. + +Test module for nodes.py. +""" + +import unittest +from DocutilsTestSupport import nodes + +debug = 0 + + +class TextTests(unittest.TestCase): + + def setUp(self): + self.text = nodes.Text('Line 1.\nLine 2.') + + def test_repr(self): + self.assertEquals(repr(self.text), r"<#text: 'Line 1.\nLine 2.'>") + + def test_str(self): + self.assertEquals(str(self.text), 'Line 1.\nLine 2.') + + def test_asdom(self): + dom = self.text.asdom() + self.assertEquals(dom.toxml(), 'Line 1.\nLine 2.') + dom.unlink() + + def test_astext(self): + self.assertEquals(self.text.astext(), 'Line 1.\nLine 2.') + + def test_pformat(self): + self.assertEquals(self.text.pformat(), 'Line 1.\nLine 2.\n') + + +class ElementTests(unittest.TestCase): + + def test_empty(self): + element = nodes.Element() + self.assertEquals(repr(element), '') + self.assertEquals(str(element), '') + dom = element.asdom() + self.assertEquals(dom.toxml(), '') + dom.unlink() + element['attr'] = '1' + self.assertEquals(repr(element), '') + self.assertEquals(str(element), '') + dom = element.asdom() + self.assertEquals(dom.toxml(), '') + dom.unlink() + self.assertEquals(element.pformat(), '\n') + + def test_withtext(self): + element = nodes.Element('text\nmore', nodes.Text('text\nmore')) + self.assertEquals(repr(element), r">") + self.assertEquals(str(element), 'text\nmore') + dom = element.asdom() + self.assertEquals(dom.toxml(), 'text\nmore') + dom.unlink() + element['attr'] = '1' + self.assertEquals(repr(element), r">") + self.assertEquals(str(element), + 'text\nmore') + dom = element.asdom() + self.assertEquals(dom.toxml(), + 'text\nmore') + dom.unlink() + self.assertEquals(element.pformat(), +"""\ + + text + more +""") + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_parsers/test_rst/test_TableParser.py b/test/test_parsers/test_rst/test_TableParser.py new file mode 100755 index 000000000..ed6083d50 --- /dev/null +++ b/test/test_parsers/test_rst/test_TableParser.py @@ -0,0 +1,197 @@ +#! /usr/bin/env python + +""" +:Author: David Goodger +:Contact: goodger@users.sourceforge.net +:Revision: $Revision$ +:Date: $Date$ +:Copyright: This module has been placed in the public domain. + +Tests for states.py. +""" + +import DocutilsTestSupport + +def suite(): + s = DocutilsTestSupport.TableParserTestSuite() + s.generateTests(totest) + return s + +totest = {} + +totest['tables'] = [ +["""\ ++-------------------------------------+ +| A table with one cell and one line. | ++-------------------------------------+ +""", +[(0, 0, 2, 38, ['A table with one cell and one line.'])], +([37], + [], + [[(0, 0, 1, ['A table with one cell and one line.'])]])], +["""\ ++--------------+--------------+ +| A table with | two columns. | ++--------------+--------------+ +""", +[(0, 0, 2, 15, ['A table with']), + (0, 15, 2, 30, ['two columns.'])], +([14, 14], + [], + [[(0, 0, 1, ['A table with']), + (0, 0, 1, ['two columns.'])]])], +["""\ ++--------------+-------------+ +| A table with | two columns | ++--------------+-------------+ +| and | two rows. | ++--------------+-------------+ +""", +[(0, 0, 2, 15, ['A table with']), + (0, 15, 2, 29, ['two columns']), + (2, 0, 4, 15, ['and']), + (2, 15, 4, 29, ['two rows.'])], +([14, 13], + [], + [[(0, 0, 1, ['A table with']), + (0, 0, 1, ['two columns'])], + [(0, 0, 3, ['and']), + (0, 0, 3, ['two rows.'])]])], +["""\ ++--------------------------+ +| A table with three rows, | ++------------+-------------+ +| and two | columns. | ++------------+-------------+ +| First and last rows | +| contain column spans. | ++--------------------------+ +""", +[(0, 0, 2, 27, ['A table with three rows,']), + (2, 0, 4, 13, ['and two']), + (2, 13, 4, 27, ['columns.']), + (4, 0, 7, 27, ['First and last rows', 'contain column spans.'])], +([12, 13], + [], + [[(0, 1, 1, ['A table with three rows,']), + None], + [(0, 0, 3, ['and two']), + (0, 0, 3, ['columns.'])], + [(0, 1, 5, ['First and last rows', 'contain column spans.']), + None]])], +["""\ ++------------+-------------+---------------+ +| A table | two rows in | and row spans | +| with three +-------------+ to left and | +| columns, | the middle, | right. | ++------------+-------------+---------------+ +""", +[(0, 0, 4, 13, ['A table', 'with three', 'columns,']), + (0, 13, 2, 27, ['two rows in']), + (0, 27, 4, 43, ['and row spans', 'to left and', 'right.']), + (2, 13, 4, 27, ['the middle,'])], +([12, 13, 15], + [], + [[(1, 0, 1, ['A table', 'with three', 'columns,']), + (0, 0, 1, ['two rows in']), + (1, 0, 1, ['and row spans', 'to left and', 'right.'])], + [None, + (0, 0, 3, ['the middle,']), + None]])], +["""\ ++------------+-------------+---------------+ +| A table | | two rows in | and funny | +| with 3 +--+-------------+-+ stuff. | +| columns, | the middle, | | | ++------------+-------------+---------------+ +""", +[(0, 0, 4, 13, ['A table |', 'with 3 +--', 'columns,']), + (0, 13, 2, 27, ['two rows in']), + (0, 27, 4, 43, [' and funny', '-+ stuff.', ' |']), + (2, 13, 4, 27, ['the middle,'])], +([12, 13, 15], + [], + [[(1, 0, 1, ['A table |', 'with 3 +--', 'columns,']), + (0, 0, 1, ['two rows in']), + (1, 0, 1, [' and funny', '-+ stuff.', ' |'])], + [None, + (0, 0, 3, ['the middle,']), + None]])], +["""\ ++-----------+-------------------------+ +| W/NW cell | N/NE cell | +| +-------------+-----------+ +| | Middle cell | E/SE cell | ++-----------+-------------+ | +| S/SE cell | | ++-------------------------+-----------+ +""", +[(0, 0, 4, 12, ['W/NW cell', '', '']), + (0, 12, 2, 38, ['N/NE cell']), + (2, 12, 4, 26, ['Middle cell']), + (2, 26, 6, 38, ['E/SE cell', '', '']), + (4, 0, 6, 26, ['S/SE cell'])], +([11, 13, 11], + [], + [[(1, 0, 1, ['W/NW cell', '', '']), + (0, 1, 1, ['N/NE cell']), + None], + [None, + (0, 0, 3, ['Middle cell']), + (1, 0, 3, ['E/SE cell', '', ''])], + [(0, 1, 5, ['S/SE cell']), + None, + None]])], +["""\ ++--------------+-------------+ +| A bad table. | | ++--------------+ | +| Cells must be rectangles. | ++----------------------------+ +""", +'TableMarkupError: Malformed table; parse incomplete.', +'TableMarkupError: Malformed table; parse incomplete.'], +["""\ ++-------------------------------+ +| A table with two header rows, | ++------------+------------------+ +| the first | with a span. | ++============+==================+ +| Two body | rows, | ++------------+------------------+ +| the second with a span. | ++-------------------------------+ +""", +[(0, 0, 2, 32, ['A table with two header rows,']), + (2, 0, 4, 13, ['the first']), + (2, 13, 4, 32, ['with a span.']), + (4, 0, 6, 13, ['Two body']), + (4, 13, 6, 32, ['rows,']), + (6, 0, 8, 32, ['the second with a span.'])], +([12, 18], + [[(0, 1, 1, ['A table with two header rows,']), + None], + [(0, 0, 3, ['the first']), + (0, 0, 3, ['with a span.'])]], + [[(0, 0, 5, ['Two body']), + (0, 0, 5, ['rows,'])], + [(0, 1, 7, ['the second with a span.']), + None]])], +["""\ ++-------------------------------+ +| A table with two head/body | ++=============+=================+ +| row | separators. | ++=============+=================+ +| That's bad. | | ++-------------+-----------------+ +""", +'TableMarkupError: Multiple head/body row separators in table ' +'(at line offset 2 and 4); only one allowed.', +'TableMarkupError: Multiple head/body row separators in table ' +'(at line offset 2 and 4); only one allowed.'], +] + +if __name__ == '__main__': + import unittest + unittest.main(defaultTest='suite') diff --git a/test/test_parsers/test_rst/test_block_quotes.py b/test/test_parsers/test_rst/test_block_quotes.py new file mode 100755 index 000000000..e047d0e92 --- /dev/null +++ b/test/test_parsers/test_rst/test_block_quotes.py @@ -0,0 +1,124 @@ +#! /usr/bin/env python + +""" +:Author: David Goodger +:Contact: goodger@users.sourceforge.net +:Revision: $Revision$ +:Date: $Date$ +:Copyright: This module has been placed in the public domain. + +Tests for states.py. +""" + +import DocutilsTestSupport + +def suite(): + s = DocutilsTestSupport.ParserTestSuite() + s.generateTests(totest) + return s + +totest = {} + +totest['block_quotes'] = [ +["""\ +Line 1. +Line 2. + + Indented. +""", +"""\ + + + Line 1. + Line 2. + + + Indented. +"""], +["""\ +Line 1. +Line 2. + + Indented 1. + + Indented 2. +""", +"""\ + + + Line 1. + Line 2. + + + Indented 1. + + + Indented 2. +"""], +["""\ +Line 1. +Line 2. + Unexpectedly indented. +""", +"""\ + + + Line 1. + Line 2. + + + Unexpected indentation at line 3. + + + Unexpectedly indented. +"""], +["""\ +Line 1. +Line 2. + + Indented. +no blank line +""", +"""\ + + + Line 1. + Line 2. + + + Indented. + + + Unindent without blank line at line 5. + + no blank line +"""], +["""\ +Here is a paragraph. + + Indent 8 spaces. + + Indent 4 spaces. + +Is this correct? Should it generate a warning? +Yes, it is correct, no warning necessary. +""", +"""\ + + + Here is a paragraph. + + + + Indent 8 spaces. + + Indent 4 spaces. + + Is this correct? Should it generate a warning? + Yes, it is correct, no warning necessary. +"""], +] + +if __name__ == '__main__': + import unittest + unittest.main(defaultTest='suite') diff --git a/test/test_parsers/test_rst/test_bullet_lists.py b/test/test_parsers/test_rst/test_bullet_lists.py new file mode 100755 index 000000000..b9552042e --- /dev/null +++ b/test/test_parsers/test_rst/test_bullet_lists.py @@ -0,0 +1,181 @@ +#! /usr/bin/env python + +""" +:Author: David Goodger +:Contact: goodger@users.sourceforge.net +:Revision: $Revision$ +:Date: $Date$ +:Copyright: This module has been placed in the public domain. + +Tests for states.py. +""" + +import DocutilsTestSupport + +def suite(): + s = DocutilsTestSupport.ParserTestSuite() + s.generateTests(totest) + return s + +totest = {} + +totest['bullet_lists'] = [ +["""\ +- item +""", +"""\ + + + + + item +"""], +["""\ +* item 1 + +* item 2 +""", +"""\ + + + + + item 1 + + + item 2 +"""], +["""\ +No blank line between: + ++ item 1 ++ item 2 +""", +"""\ + + + No blank line between: + + + + item 1 + + + item 2 +"""], +["""\ +- item 1, para 1. + + item 1, para 2. + +- item 2 +""", +"""\ + + + + + item 1, para 1. + + item 1, para 2. + + + item 2 +"""], +["""\ +- item 1, line 1 + item 1, line 2 +- item 2 +""", +"""\ + + + + + item 1, line 1 + item 1, line 2 + + + item 2 +"""], +["""\ +Different bullets: + +- item 1 + ++ item 2 + +* item 3 +- item 4 +""", +"""\ + + + Different bullets: + + + + item 1 + + + + item 2 + + + + item 3 + + + Unindent without blank line at line 8. + + + + item 4 +"""], +["""\ +- item +no blank line +""", +"""\ + + + + + item + + + Unindent without blank line at line 2. + + no blank line +"""], +["""\ +- + +empty item above +""", +"""\ + + + + + empty item above +"""], +["""\ +- +empty item above, no blank line +""", +"""\ + + + + + + Unindent without blank line at line 2. + + empty item above, no blank line +"""], +] + +if __name__ == '__main__': + import unittest + unittest.main(defaultTest='suite') diff --git a/test/test_parsers/test_rst/test_citations.py b/test/test_parsers/test_rst/test_citations.py new file mode 100755 index 000000000..15568c1fd --- /dev/null +++ b/test/test_parsers/test_rst/test_citations.py @@ -0,0 +1,139 @@ +#! /usr/bin/env python + +""" +:Author: David Goodger +:Contact: goodger@users.sourceforge.net +:Revision: $Revision$ +:Date: $Date$ +:Copyright: This module has been placed in the public domain. + +Tests for states.py. +""" + +import DocutilsTestSupport + +def suite(): + s = DocutilsTestSupport.ParserTestSuite() + s.generateTests(totest) + return s + +totest = {} + +totest['citations'] = [ +["""\ +.. [citation] This is a citation. +""", +"""\ + + +

Title

+"""\

Some stuff

Subtitle

@@ -85,8 +84,20 @@ And even more stuff

And even more stuff

+"""], +["""\ ++++++ +Title ++++++ + +:author: me + +Some stuff +""", +"""\ +

Some stuff

"""] - ]) +]) totest['No title promotion'] = ({'doctitle_xform' : 0}, [ ["""\ -- cgit v1.2.1 From efa3b5a365e2d0e616d77447c17a2c415aaa3546 Mon Sep 17 00:00:00 2001 From: goodger Date: Sun, 9 May 2004 02:06:45 +0000 Subject: Added support for publish_parts interface for HTML git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2055 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/DocutilsTestSupport.py | 93 +++++++---- test/test_writers/test_html4css1/__init__.py | 14 ++ test/test_writers/test_html4css1/test_parts.py | 208 +++++++++++++++++++++++++ 3 files changed, 282 insertions(+), 33 deletions(-) create mode 100644 test/test_writers/test_html4css1/__init__.py create mode 100755 test/test_writers/test_html4css1/test_parts.py (limited to 'test') diff --git a/test/DocutilsTestSupport.py b/test/DocutilsTestSupport.py index 872175cc2..e1f4369ba 100644 --- a/test/DocutilsTestSupport.py +++ b/test/DocutilsTestSupport.py @@ -619,34 +619,6 @@ class PseudoXMLWriterPublishTestCase(WriterPublishTestCase): writer_name = 'pseudoxml' -class HtmlWriterPublishTestCase(WriterPublishTestCase): - - """ - Test case for fragment code in HTML writer. - """ - - writer_name = 'html' - - def __init__(self, *args, **kwargs): - self.settings_overrides = kwargs['settings_overrides'] - """Settings overrides to use for this test case.""" - - del kwargs['settings_overrides'] # only wanted here - CustomTestCase.__init__(self, *args, **kwargs) - - def test_publish(self): - if self.run_in_debugger: - pdb.set_trace() - output = docutils.core.publish_parts( - source=self.input, - reader_name='standalone', - parser_name='restructuredtext', - writer_name=self.writer_name, - settings_spec=self, - settings_overrides=self.settings_overrides) - self.compare_output(self.input, output['fragment'], self.expected) - - class PublishTestSuite(CustomTestSuite): TEST_CLASSES = { @@ -679,10 +651,7 @@ class PublishTestSuite(CustomTestSuite): run_in_debugger=run_in_debugger) -class HtmlFragmentTestSuite(CustomTestSuite): - def __init__(self): - CustomTestSuite.__init__(self) - self.test_class = HtmlWriterPublishTestCase +class HtmlPublishPartsTestSuite(CustomTestSuite): def generateTests(self, dict, dictname='totest'): for name, (settings_overrides, cases) in dict.items(): @@ -695,12 +664,70 @@ class HtmlFragmentTestSuite(CustomTestSuite): else: continue self.addTestCase( - self.test_class, 'test_publish', + HtmlWriterPublishPartsTestCase, 'test_publish', settings_overrides=settings_overrides, input=case[0], expected=case[1], id='%s[%r][%s]' % (dictname, name, casenum), run_in_debugger=run_in_debugger) + +class HtmlWriterPublishPartsTestCase(WriterPublishTestCase): + + """ + Test case for HTML writer via the publish_parts interface. + """ + + writer_name = 'html' + + def __init__(self, *args, **kwargs): + self.settings_overrides = kwargs['settings_overrides'] + """Settings overrides to use for this test case.""" + + del kwargs['settings_overrides'] # only wanted here + CustomTestCase.__init__(self, *args, **kwargs) + + def test_publish(self): + if self.run_in_debugger: + pdb.set_trace() + parts = docutils.core.publish_parts( + source=self.input, + reader_name='standalone', + parser_name='restructuredtext', + writer_name=self.writer_name, + settings_spec=self, + settings_overrides=self.settings_overrides) + output = self.format_output(parts) + # interpolate standard variables: + expected = self.expected % {'version': docutils.__version__} + self.compare_output(self.input, output, expected) + + standard_meta_value = """\ + + +""" % docutils.__version__ + + def format_output(self, parts): + """Minimize & standardize the output.""" + # remove redundant bits: + del parts['whole'] + del parts['body'] + parts['meta'] = parts['meta'].replace(self.standard_meta_value, '') + # remove empty values: + for key in parts.keys(): + if not parts[key]: + del parts[key] + # standard output format: + keys = parts.keys() + keys.sort() + output = [] + for key in keys: + output.append("%r: '''%s'''" + % (key, parts[key].encode('raw_unicode_escape'))) + if output[-1].endswith("\n'''"): + output[-1] = output[-1][:-4] + "\\n'''" + return '{' + ',\n '.join(output) + '}\n' + + def exception_data(code): """ Execute `code` and return the resulting exception, the exception arguments, diff --git a/test/test_writers/test_html4css1/__init__.py b/test/test_writers/test_html4css1/__init__.py new file mode 100644 index 000000000..2fe79c55c --- /dev/null +++ b/test/test_writers/test_html4css1/__init__.py @@ -0,0 +1,14 @@ +import os +import os.path +import sys + +sys.path.insert(0, os.path.abspath(os.curdir)) +prev = '' +while sys.path[0] != prev: + try: + import DocutilsTestSupport + break + except ImportError: + prev = sys.path[0] + sys.path[0] = os.path.dirname(prev) +sys.path.pop(0) diff --git a/test/test_writers/test_html4css1/test_parts.py b/test/test_writers/test_html4css1/test_parts.py new file mode 100755 index 000000000..05af5ffe5 --- /dev/null +++ b/test/test_writers/test_html4css1/test_parts.py @@ -0,0 +1,208 @@ +#! /usr/bin/env python + +# Author: reggie dugard +# Contact: reggie@users.sourceforge.net +# Revision: $Revision$ +# Date: $Date$ +# Copyright: This module has been placed in the public domain. + +""" +Test for fragment code in HTML writer. + +Note: the 'body' and 'whole' entries have been removed from the parts +dictionaries (redundant), along with any entries with empty values. +""" + +from __init__ import DocutilsTestSupport + +def suite(): + s = DocutilsTestSupport.HtmlPublishPartsTestSuite() + s.generateTests(totest) + return s + + +totest = {} + +totest['Title promotion'] = ({}, [ +["""\ +Simple String +""", +"""\ +{'fragment': '''Simple String''', + 'stylesheet': '''\\n'''} +""" +], +["""\ +Simple String with *markup* +""", +"""\ +{'fragment': '''Simple String with markup''', + 'stylesheet': '''\\n'''} +""" +], +["""\ +Simple String with an even simpler ``inline literal`` +""", +"""\ +{'fragment': '''Simple String with an even simpler inline literal''', + 'stylesheet': '''\\n'''} +""" +], +["""\ +A simple `anonymous reference`__ + +__ http://www.test.com/test_url +""", +"""\ +{'fragment': '''

A simple anonymous reference

\\n''', + 'stylesheet': '''\\n'''} +"""], +["""\ +A simple `named reference`_ with stuff in between the +reference and the target. + +.. _`named reference`: http://www.test.com/test_url +""", +"""\ +{'fragment': '''

A simple named reference with stuff in between the +reference and the target.

\\n''', + 'stylesheet': '''\\n'''} +"""], +["""\ ++++++ +Title ++++++ + +Some stuff + +Subtitle +-------- + +Some more stuff + +Another Section +............... + +And even more stuff +""", +"""\ +{'fragment': '''

Some stuff

+
+

Subtitle

+

Some more stuff

+
+

Another Section

+

And even more stuff

+
+
\\n''', + 'stylesheet': '''\\n''', + 'title': '''Title'''} +"""], +["""\ ++++++ +Title ++++++ + +:author: me + +Some stuff +""", +"""\ +{'docinfo': ''' +++ + + + +
Author:me
\\n''', + 'fragment': '''

Some stuff

\\n''', + 'meta': '''\\n''', + 'stylesheet': '''\\n''', + 'title': '''Title'''} +"""] +]) + +totest['No title promotion'] = ({'doctitle_xform' : 0}, [ +["""\ +Simple String +""", +"""\ +{'fragment': '''Simple String''', + 'stylesheet': '''\\n'''} +""" +], +["""\ +Simple String with *markup* +""", +"""\ +{'fragment': '''Simple String with markup''', + 'stylesheet': '''\\n'''} +""" +], +["""\ +Simple String with an even simpler ``inline literal`` +""", +"""\ +{'fragment': '''Simple String with an even simpler inline literal''', + 'stylesheet': '''\\n'''} +""" +], +["""\ +A simple `anonymous reference`__ + +__ http://www.test.com/test_url +""", +"""\ +{'fragment': '''

A simple anonymous reference

\\n''', + 'stylesheet': '''\\n'''} +"""], +["""\ +A simple `named reference`_ with stuff in between the +reference and the target. + +.. _`named reference`: http://www.test.com/test_url +""", +"""\ +{'fragment': '''

A simple named reference with stuff in between the +reference and the target.

\\n''', + 'stylesheet': '''\\n'''} +"""], +["""\ ++++++ +Title ++++++ + +Some stuff + +Subtitle +-------- + +Some more stuff + +Another Section +............... + +And even more stuff +""", +"""\ +{'fragment': '''
+

Title

+

Some stuff

+
+

Subtitle

+

Some more stuff

+
+

Another Section

+

And even more stuff

+
+
+
\\n''', + 'stylesheet': '''\\n'''} +"""] +]) + + +if __name__ == '__main__': + import unittest + unittest.main(defaultTest='suite') -- cgit v1.2.1 From f703a37e3713639451793c6f2269789beb8d2682 Mon Sep 17 00:00:00 2001 From: goodger Date: Sun, 9 May 2004 02:08:01 +0000 Subject: moved to test_html4css1/test_parts.py git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2056 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_writers/test_htmlfragment.py | 174 --------------------------------- 1 file changed, 174 deletions(-) delete mode 100755 test/test_writers/test_htmlfragment.py (limited to 'test') diff --git a/test/test_writers/test_htmlfragment.py b/test/test_writers/test_htmlfragment.py deleted file mode 100755 index a77fb1435..000000000 --- a/test/test_writers/test_htmlfragment.py +++ /dev/null @@ -1,174 +0,0 @@ -#! /usr/bin/env python - -# Author: reggie dugard -# Contact: reggie@users.sourceforge.net -# Revision: $Revision$ -# Date: $Date$ -# Copyright: This module has been placed in the public domain. - -""" -Test for fragment code in HTML writer. -""" - -from __init__ import DocutilsTestSupport - -def suite(): - s = DocutilsTestSupport.HtmlFragmentTestSuite() - s.generateTests(totest) - return s - - -totest = {} - -totest['Title promotion'] = ({}, [ - ["""\ -Simple String -""", - """\ -Simple String""" - ], - ["""\ -Simple String with *markup* -""", - """\ -Simple String with markup""" - ], - ["""\ -Simple String with an even simpler ``inline literal`` -""", - """\ -Simple String with an even simpler inline literal""" - ], - ["""\ -A simple `anonymous reference`__ - -__ http://www.test.com/test_url -""", - """\ -

A simple anonymous reference

-"""], - ["""\ -A simple `named reference`_ with stuff in between the -reference and the target. - -.. _`named reference`: http://www.test.com/test_url -""", - """\ -

A simple named reference with stuff in between the -reference and the target.

-"""], - ["""\ -+++++ -Title -+++++ - -Some stuff - -Subtitle --------- - -Some more stuff - -Another Section -............... - -And even more stuff -""", -"""\ -

Some stuff

-
-

Subtitle

-

Some more stuff

-
-

Another Section

-

And even more stuff

-
-
-"""], -["""\ -+++++ -Title -+++++ - -:author: me - -Some stuff -""", -"""\ -

Some stuff

-"""] -]) - -totest['No title promotion'] = ({'doctitle_xform' : 0}, [ - ["""\ -Simple String -""", - """\ -Simple String""" - ], - ["""\ -Simple String with *markup* -""", - """\ -Simple String with markup""" - ], - ["""\ -Simple String with an even simpler ``inline literal`` -""", - """\ -Simple String with an even simpler inline literal""" - ], - ["""\ -A simple `anonymous reference`__ - -__ http://www.test.com/test_url -""", - """\ -

A simple anonymous reference

-"""], - ["""\ -A simple `named reference`_ with stuff in between the -reference and the target. - -.. _`named reference`: http://www.test.com/test_url -""", - """\ -

A simple named reference with stuff in between the -reference and the target.

-"""], - ["""\ -+++++ -Title -+++++ - -Some stuff - -Subtitle --------- - -Some more stuff - -Another Section -............... - -And even more stuff -""", - """\ -
-

Title

-

Some stuff

-
-

Subtitle

-

Some more stuff

-
-

Another Section

-

And even more stuff

-
-
-
-"""] - ]) - -if __name__ == '__main__': - import unittest - unittest.main(defaultTest='suite') -- cgit v1.2.1 From 8151d561018865c3501894539bc144ffc4f150d0 Mon Sep 17 00:00:00 2001 From: goodger Date: Sun, 9 May 2004 02:14:33 +0000 Subject: further minimization git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2057 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/DocutilsTestSupport.py | 5 ++++ test/test_writers/test_html4css1/test_parts.py | 35 ++++++++------------------ 2 files changed, 16 insertions(+), 24 deletions(-) (limited to 'test') diff --git a/test/DocutilsTestSupport.py b/test/DocutilsTestSupport.py index e1f4369ba..5c5c49d42 100644 --- a/test/DocutilsTestSupport.py +++ b/test/DocutilsTestSupport.py @@ -705,13 +705,18 @@ class HtmlWriterPublishPartsTestCase(WriterPublishTestCase): """ % docutils.__version__ + standard_stylesheet_value = ('\n') def format_output(self, parts): """Minimize & standardize the output.""" # remove redundant bits: del parts['whole'] del parts['body'] + # remove standard bits: parts['meta'] = parts['meta'].replace(self.standard_meta_value, '') + if parts['stylesheet'] == self.standard_stylesheet_value: + del parts['stylesheet'] # remove empty values: for key in parts.keys(): if not parts[key]: diff --git a/test/test_writers/test_html4css1/test_parts.py b/test/test_writers/test_html4css1/test_parts.py index 05af5ffe5..d1570dee7 100755 --- a/test/test_writers/test_html4css1/test_parts.py +++ b/test/test_writers/test_html4css1/test_parts.py @@ -28,24 +28,21 @@ totest['Title promotion'] = ({}, [ Simple String """, """\ -{'fragment': '''Simple String''', - 'stylesheet': '''\\n'''} +{'fragment': '''Simple String'''} """ ], ["""\ Simple String with *markup* """, """\ -{'fragment': '''Simple String with markup''', - 'stylesheet': '''\\n'''} +{'fragment': '''Simple String with markup'''} """ ], ["""\ Simple String with an even simpler ``inline literal`` """, """\ -{'fragment': '''Simple String with an even simpler inline literal''', - 'stylesheet': '''\\n'''} +{'fragment': '''Simple String with an even simpler inline literal'''} """ ], ["""\ @@ -54,8 +51,7 @@ A simple `anonymous reference`__ __ http://www.test.com/test_url """, """\ -{'fragment': '''

A simple anonymous reference

\\n''', - 'stylesheet': '''\\n'''} +{'fragment': '''

A simple anonymous reference

\\n'''} """], ["""\ A simple `named reference`_ with stuff in between the @@ -65,8 +61,7 @@ reference and the target. """, """\ {'fragment': '''

A simple named reference with stuff in between the -reference and the target.

\\n''', - 'stylesheet': '''\\n'''} +reference and the target.

\\n'''} """], ["""\ +++++ @@ -95,7 +90,6 @@ And even more stuff

And even more stuff

\\n''', - 'stylesheet': '''\\n''', 'title': '''Title'''} """], ["""\ @@ -118,7 +112,6 @@ Some stuff \\n''', 'fragment': '''

Some stuff

\\n''', 'meta': '''\\n''', - 'stylesheet': '''\\n''', 'title': '''Title'''} """] ]) @@ -128,24 +121,21 @@ totest['No title promotion'] = ({'doctitle_xform' : 0}, [ Simple String """, """\ -{'fragment': '''Simple String''', - 'stylesheet': '''\\n'''} +{'fragment': '''Simple String'''} """ ], ["""\ Simple String with *markup* """, """\ -{'fragment': '''Simple String with markup''', - 'stylesheet': '''\\n'''} +{'fragment': '''Simple String with markup'''} """ ], ["""\ Simple String with an even simpler ``inline literal`` """, """\ -{'fragment': '''Simple String with an even simpler inline literal''', - 'stylesheet': '''\\n'''} +{'fragment': '''Simple String with an even simpler inline literal'''} """ ], ["""\ @@ -154,8 +144,7 @@ A simple `anonymous reference`__ __ http://www.test.com/test_url """, """\ -{'fragment': '''

A simple anonymous reference

\\n''', - 'stylesheet': '''\\n'''} +{'fragment': '''

A simple anonymous reference

\\n'''} """], ["""\ A simple `named reference`_ with stuff in between the @@ -165,8 +154,7 @@ reference and the target. """, """\ {'fragment': '''

A simple named reference with stuff in between the -reference and the target.

\\n''', - 'stylesheet': '''\\n'''} +reference and the target.

\\n'''} """], ["""\ +++++ @@ -197,8 +185,7 @@ And even more stuff

And even more stuff

-\\n''', - 'stylesheet': '''\\n'''} +\\n'''} """] ]) -- cgit v1.2.1 From 87e7d1e5e563b4a02861c8cf23d4a95b89284078 Mon Sep 17 00:00:00 2001 From: goodger Date: Sun, 9 May 2004 02:31:07 +0000 Subject: fix git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2058 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_writers/test_html4css1/test_parts.py | 28 +++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) (limited to 'test') diff --git a/test/test_writers/test_html4css1/test_parts.py b/test/test_writers/test_html4css1/test_parts.py index d1570dee7..92f959e7f 100755 --- a/test/test_writers/test_html4css1/test_parts.py +++ b/test/test_writers/test_html4css1/test_parts.py @@ -68,10 +68,13 @@ reference and the target.

\\n'''} Title +++++ +Subtitle +======== + Some stuff -Subtitle --------- +Section +------- Some more stuff @@ -82,14 +85,15 @@ And even more stuff """, """\ {'fragment': '''

Some stuff

-
-

Subtitle

+
+

Section

Some more stuff

Another Section

And even more stuff

\\n''', + 'subtitle': '''Subtitle''', 'title': '''Title'''} """], ["""\ @@ -161,10 +165,13 @@ reference and the target.

\\n'''} Title +++++ +Not A Subtitle +============== + Some stuff -Subtitle --------- +Section +------- Some more stuff @@ -176,15 +183,18 @@ And even more stuff """\ {'fragment': '''

Title

+
+

Not A Subtitle

Some stuff

-
-

Subtitle

+
+

Section

Some more stuff

-

Another Section

+

Another Section

And even more stuff

+
\\n'''} """] ]) -- cgit v1.2.1 From 2465f4e8e271fc5182247453d7aadf71064ae997 Mon Sep 17 00:00:00 2001 From: goodger Date: Sun, 9 May 2004 02:35:15 +0000 Subject: docstrings git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2059 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_writers/test_html4css1/test_parts.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/test_writers/test_html4css1/test_parts.py b/test/test_writers/test_html4css1/test_parts.py index 92f959e7f..2b6c0ee35 100755 --- a/test/test_writers/test_html4css1/test_parts.py +++ b/test/test_writers/test_html4css1/test_parts.py @@ -10,7 +10,8 @@ Test for fragment code in HTML writer. Note: the 'body' and 'whole' entries have been removed from the parts -dictionaries (redundant), along with any entries with empty values. +dictionaries (redundant), along with 'meta' and 'stylesheet' entries with +standard values, and any entries with empty values. """ from __init__ import DocutilsTestSupport -- cgit v1.2.1 From 9288852b41c1556ed1ab3505acfe1d3535f54233 Mon Sep 17 00:00:00 2001 From: goodger Date: Sun, 9 May 2004 02:38:47 +0000 Subject: updated git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2060 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_writers/test_html4css1/test_parts.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test') diff --git a/test/test_writers/test_html4css1/test_parts.py b/test/test_writers/test_html4css1/test_parts.py index 2b6c0ee35..30493f74f 100755 --- a/test/test_writers/test_html4css1/test_parts.py +++ b/test/test_writers/test_html4css1/test_parts.py @@ -55,6 +55,15 @@ __ http://www.test.com/test_url {'fragment': '''

A simple anonymous reference

\\n'''} """], ["""\ +One paragraph. + +Two paragraphs. +""", +"""\ +{'fragment': '''

One paragraph.

+

Two paragraphs.

\\n'''} +"""], +["""\ A simple `named reference`_ with stuff in between the reference and the target. -- cgit v1.2.1 From 7368e7764782c50cbb58122dfa2ea59313393900 Mon Sep 17 00:00:00 2001 From: grubert Date: Wed, 12 May 2004 19:22:58 +0000 Subject: Add option --table-style=(standard|booktabs|nolines). Move most table handling into class Table. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2085 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_writers/test_latex2e.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/test_writers/test_latex2e.py b/test/test_writers/test_latex2e.py index d57e46467..673361130 100644 --- a/test/test_writers/test_latex2e.py +++ b/test/test_writers/test_latex2e.py @@ -292,11 +292,10 @@ latex_head + """\ \\begin{longtable}[c]{|p{0.07\locallinewidth}|p{0.07\locallinewidth}|} \\caption{Foo}\\\\ \\hline -\\endhead -%[visit_tbody] - & \\\\ \hline - & \\\\ \hline -%[depart_tbody] + & \\\\ +\hline + & \\\\ +\hline \\end{longtable} \\end{document} -- cgit v1.2.1 From 16cb718b14bbf360c87e14f5c46ed8f53a755faf Mon Sep 17 00:00:00 2001 From: grubert Date: Sun, 30 May 2004 17:09:02 +0000 Subject: Chg: literal_block with fluxhleft outside of tables. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2140 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_writers/test_latex2e.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/test_writers/test_latex2e.py b/test/test_writers/test_latex2e.py index 673361130..70acf3343 100644 --- a/test/test_writers/test_latex2e.py +++ b/test/test_writers/test_latex2e.py @@ -253,12 +253,12 @@ Inside literal blocks quotes should be left untouched (use only two quotes in test code makes life easier for the python interpreter running the test): \\begin{ttfamily}\\begin{flushleft} -\\mbox{""}\\\\ -\\mbox{This~is~left~"untouched"~also~*this*.}\\\\ -\\mbox{""} +""~\\\\ +This~is~left~"untouched"~also~*this*.~\\\\ +"" \\end{flushleft}\\end{ttfamily} \\begin{ttfamily}\\begin{flushleft} -\\mbox{should~get~"quotes"~and~\\emph{italics}.} +should~get~"quotes"~and~\\emph{italics}. \\end{flushleft}\\end{ttfamily} Inline \\texttt{literal "quotes"} should be kept. -- cgit v1.2.1 From 81d1c1687d6c237496d39373b8eb2c9be8e2e9ba Mon Sep 17 00:00:00 2001 From: grubert Date: Tue, 1 Jun 2004 14:01:06 +0000 Subject: Add: [ in literal test. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2158 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_writers/test_latex2e.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'test') diff --git a/test/test_writers/test_latex2e.py b/test/test_writers/test_latex2e.py index 70acf3343..2640f55f1 100644 --- a/test/test_writers/test_latex2e.py +++ b/test/test_writers/test_latex2e.py @@ -302,6 +302,40 @@ latex_head + """\ """], ] +# In "\\\n[" the "[" needs to be protected (otherwise it will be seen as an option to "\\"). +totest['brackett_protection'] = [ +# input +["""\ +:: + + something before to get a end of line. + [ + + the empty line gets tested too + ] +""", +latex_head + """\ +\\title{} +\\author{} +\\date{} +\\raggedbottom +\\begin{document} +\\maketitle + + +\\setlength{\\locallinewidth}{\\linewidth} +\\begin{ttfamily}\\begin{flushleft} +something~before~to~get~a~end~of~line.~\\\\ +{[}~\\\\ +~\\\\ +the~empty~line~gets~tested~too~\\\\ +] +\\end{flushleft}\\end{ttfamily} + +\\end{document} +"""], +] + if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') -- cgit v1.2.1 From b4e3b9bac42e6cbdac6424270227fe0df15a8dfc Mon Sep 17 00:00:00 2001 From: goodger Date: Tue, 1 Jun 2004 21:38:13 +0000 Subject: tests for "table" directive git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2164 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../test_rst/test_directives/test_tables.py | 71 ++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100755 test/test_parsers/test_rst/test_directives/test_tables.py (limited to 'test') diff --git a/test/test_parsers/test_rst/test_directives/test_tables.py b/test/test_parsers/test_rst/test_directives/test_tables.py new file mode 100755 index 000000000..b5b017d38 --- /dev/null +++ b/test/test_parsers/test_rst/test_directives/test_tables.py @@ -0,0 +1,71 @@ +#! /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 body.py table directives. +""" + +from __init__ import DocutilsTestSupport + +def suite(): + s = DocutilsTestSupport.ParserTestSuite() + s.generateTests(totest) + return s + +totest = {} + +totest['tables'] = [ +["""\ +.. table:: Truth table for "not" + :class: custom + + ===== ===== + A not A + ===== ===== + False True + True False + ===== ===== +""", +"""\ + + + + Truth table for "not" + <tgroup cols="2"> + <colspec colwidth="5"> + <colspec colwidth="5"> + <thead> + <row> + <entry> + <paragraph> + A + <entry> + <paragraph> + not A + <tbody> + <row> + <entry> + <paragraph> + False + <entry> + <paragraph> + True + <row> + <entry> + <paragraph> + True + <entry> + <paragraph> + False +"""], +] + + +if __name__ == '__main__': + import unittest + unittest.main(defaultTest='suite') -- cgit v1.2.1 From 6c18a0548558d3eefb532ef613a49533328dd357 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sat, 5 Jun 2004 19:32:15 +0000 Subject: updated git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2223 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_readers/test_pep/test_inline_markup.py | 6 +++--- test/test_writers/test_docutils_xml.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/test_readers/test_pep/test_inline_markup.py b/test/test_readers/test_pep/test_inline_markup.py index eb18ebe8b..f38193c10 100644 --- a/test/test_readers/test_pep/test_inline_markup.py +++ b/test/test_readers/test_pep/test_inline_markup.py @@ -96,7 +96,7 @@ totest['miscellaneous'] = [ For *completeness*, _`let's` ``test`` **other** forms_ |of| `inline markup` [*]_. -.. [*] See http://docutils.sf.net/spec/rst/reStructuredText.html. +.. [*] See http://docutils.sf.net/docs/ref/rst/restructuredtext.html. """, """\ <document source="test data"> @@ -128,8 +128,8 @@ For *completeness*, _`let's` ``test`` **other** forms_ <footnote auto="*" id="id2"> <paragraph> See \n\ - <reference refuri="http://docutils.sf.net/spec/rst/reStructuredText.html"> - http://docutils.sf.net/spec/rst/reStructuredText.html + <reference refuri="http://docutils.sf.net/docs/ref/rst/restructuredtext.html"> + http://docutils.sf.net/docs/ref/rst/restructuredtext.html . """], ] diff --git a/test/test_writers/test_docutils_xml.py b/test/test_writers/test_docutils_xml.py index 277ceaccc..08219dc05 100644 --- a/test/test_writers/test_docutils_xml.py +++ b/test/test_writers/test_docutils_xml.py @@ -20,7 +20,7 @@ class DocutilsXMLTestCase(unittest.TestCase, docutils.SettingsSpec): input = 'Test\n====\n\nSubsection\n----------\n\nTest\n\n----------\n\nTest.' xmldecl = '<?xml version="1.0" encoding="iso-8859-1"?>\n' - doctypedecl = '<!DOCTYPE document PUBLIC "+//IDN docutils.sourceforge.net//DTD Docutils Generic//EN//XML" "http://docutils.sourceforge.net/spec/docutils.dtd">\n' + doctypedecl = '<!DOCTYPE document PUBLIC "+//IDN docutils.sourceforge.net//DTD Docutils Generic//EN//XML" "http://docutils.sourceforge.net/docs/ref/docutils.dtd">\n' generatedby = '<!-- Generated by Docutils %s -->\n' % docutils.__version__ bodynormal = '<document id="test" name="test" source="<string>"><title>TestSubsectionTestTest.' bodynormal = 'TestSubsectionTestTest.' -- cgit v1.2.1 From 34a92129993494ee286047194275d048d279db6e Mon Sep 17 00:00:00 2001 From: goodger Date: Wed, 16 Jun 2004 17:22:29 +0000 Subject: updated git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2288 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/DocutilsTestSupport.py | 2 +- test/test_readers/test_pep/test_inline_markup.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/DocutilsTestSupport.py b/test/DocutilsTestSupport.py index 5c5c49d42..1545db42d 100644 --- a/test/DocutilsTestSupport.py +++ b/test/DocutilsTestSupport.py @@ -396,7 +396,7 @@ class PEPParserTestCase(ParserTestCase): """PEP-specific parser test case.""" - parser = rst.Parser(rfc2822=1, inliner=pep.Inliner()) + parser = rst.Parser(rfc2822=1, inliner=rst.states.Inliner()) """Parser shared by all PEPParserTestCases.""" option_parser = frontend.OptionParser(components=(rst.Parser, pep.Reader)) diff --git a/test/test_readers/test_pep/test_inline_markup.py b/test/test_readers/test_pep/test_inline_markup.py index f38193c10..d2fc97321 100644 --- a/test/test_readers/test_pep/test_inline_markup.py +++ b/test/test_readers/test_pep/test_inline_markup.py @@ -30,10 +30,10 @@ and RFC 2822 (which obsoletes RFC822 and RFC-733). See \n\ - + PEP 287 ( - + pep-0287.txt ), and \n\ @@ -61,7 +61,7 @@ RFC References split across lines: - + PEP 287 @@ -79,7 +79,7 @@ PEP 287 (http://www.python.org/peps/pep-0287.html), RFC 2822. Test PEP-specific implicit references before a URL: - + PEP 287 ( -- cgit v1.2.1 From 40b86271c0659f96c7bbd76317d8cf6b3c96c5b4 Mon Sep 17 00:00:00 2001 From: goodger Date: Thu, 17 Jun 2004 02:53:17 +0000 Subject: updated git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2293 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_parsers/test_rst/test_directives/test_unicode.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_directives/test_unicode.py b/test/test_parsers/test_rst/test_directives/test_unicode.py index 20d0db61a..875efe811 100755 --- a/test/test_parsers/test_rst/test_directives/test_unicode.py +++ b/test/test_parsers/test_rst/test_directives/test_unicode.py @@ -138,7 +138,7 @@ u"""\ Invalid character code: 0x111111111111111111 - %s + ValueError: code too large (%s) unicode:: 0x111111111111111111 @@ -158,7 +158,7 @@ u"""\ .. |too big for unicode| unicode:: 0x11111111 """ % (DocutilsTestSupport.exception_data( - 'unichr(int("111111111111111111", 16))')[2], + 'unichr(int("111111111111111111", 16))')[0], DocutilsTestSupport.exception_data('unichr(int("11111111", 16))')[2])] ] -- cgit v1.2.1 From d2efa0442ee4ca7ecc5b6e68d209434eae946f74 Mon Sep 17 00:00:00 2001 From: goodger Date: Fri, 18 Jun 2004 21:36:55 +0000 Subject: added "csv-table" directive git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2308 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../test_rst/test_directives/test_tables.py | 590 ++++++++++++++++++++- 1 file changed, 588 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_directives/test_tables.py b/test/test_parsers/test_rst/test_directives/test_tables.py index b5b017d38..d93a6f299 100755 --- a/test/test_parsers/test_rst/test_directives/test_tables.py +++ b/test/test_parsers/test_rst/test_directives/test_tables.py @@ -7,7 +7,7 @@ # Copyright: This module has been placed in the public domain. """ -Tests for body.py table directives. +Tests for tables.py directives. """ from __init__ import DocutilsTestSupport @@ -19,7 +19,7 @@ def suite(): totest = {} -totest['tables'] = [ +totest['table'] = [ ["""\ .. table:: Truth table for "not" :class: custom @@ -63,6 +63,592 @@ totest['tables'] = [ False """], +["""\ +.. table:: title with an *error + + ====== ===== + Simple table + ====== ===== +""", +"""\ + +
+ + title with an \n\ + <problematic id="id2" refid="id1"> + * + error + <tgroup cols="2"> + <colspec colwidth="6"> + <colspec colwidth="5"> + <tbody> + <row> + <entry> + <paragraph> + Simple + <entry> + <paragraph> + table + <system_message backrefs="id2" id="id1" level="2" line="1" source="test data" type="WARNING"> + <paragraph> + Inline emphasis start-string without end-string. +"""], +] + +#xtotest = {} ; x +totest['csv-table'] = [ +["""\ +.. csv-table:: inline with integral header + :widths: 10,20,30 + :header-rows: 1 + + "Treat", "Quantity", "Description" + "Albatross", 2.99, "On a stick!" + "Crunchy Frog", 1.49, "If we took the bones out, it wouldn\'t be + crunchy, now would it?" + "Gannet Ripple", 1.99, "On a stick!" +""", +"""\ +<document source="test data"> + <table> + <title> + inline with integral header + <tgroup cols="3"> + <colspec colwidth="10"> + <colspec colwidth="20"> + <colspec colwidth="30"> + <thead> + <row> + <entry> + <paragraph> + Treat + <entry> + <paragraph> + Quantity + <entry> + <paragraph> + Description + <tbody> + <row> + <entry> + <paragraph> + Albatross + <entry> + <paragraph> + 2.99 + <entry> + <paragraph> + On a stick! + <row> + <entry> + <paragraph> + Crunchy Frog + <entry> + <paragraph> + 1.49 + <entry> + <paragraph> + If we took the bones out, it wouldn't be + crunchy, now would it? + <row> + <entry> + <paragraph> + Gannet Ripple + <entry> + <paragraph> + 1.99 + <entry> + <paragraph> + On a stick! +"""], +["""\ +.. csv-table:: inline with separate header + :header: "Treat", Quantity, "Description" + :widths: 10,20,30 + + "Albatross", 2.99, "On a stick!" +""", +"""\ +<document source="test data"> + <table> + <title> + inline with separate header + <tgroup cols="3"> + <colspec colwidth="10"> + <colspec colwidth="20"> + <colspec colwidth="30"> + <thead> + <row> + <entry> + <paragraph> + Treat + <entry> + <paragraph> + Quantity + <entry> + <paragraph> + Description + <tbody> + <row> + <entry> + <paragraph> + Albatross + <entry> + <paragraph> + 2.99 + <entry> + <paragraph> + On a stick! +"""], +["""\ +.. csv-table:: complex internal structure + :header: "Treat", Quantity, " + * Description, + * Definition, or + * Narrative" + + " + * Ice cream + * Sorbet + * Albatross", 2.99, "On a stick!" +""", +"""\ +<document source="test data"> + <table> + <title> + complex internal structure + <tgroup cols="3"> + <colspec colwidth="33"> + <colspec colwidth="33"> + <colspec colwidth="33"> + <thead> + <row> + <entry> + <paragraph> + Treat + <entry> + <paragraph> + Quantity + <entry> + <bullet_list bullet="*"> + <list_item> + <paragraph> + Description, + <list_item> + <paragraph> + Definition, or + <list_item> + <paragraph> + Narrative + <tbody> + <row> + <entry> + <bullet_list bullet="*"> + <list_item> + <paragraph> + Ice cream + <list_item> + <paragraph> + Sorbet + <list_item> + <paragraph> + Albatross + <entry> + <paragraph> + 2.99 + <entry> + <paragraph> + On a stick! +"""], +["""\ +.. csv-table:: short rows + + one, 2, three + 4, five +""", +"""\ +<document source="test data"> + <table> + <title> + short rows + <tgroup cols="3"> + <colspec colwidth="33"> + <colspec colwidth="33"> + <colspec colwidth="33"> + <tbody> + <row> + <entry> + <paragraph> + one + <entry> + <paragraph> + 2 + <entry> + <paragraph> + three + <row> + <entry> + <paragraph> + 4 + <entry> + <paragraph> + five + <entry> +"""], +["""\ +.. csv-table:: short rows + :header-rows: 1 + + header col 1, header col 2 + one, 2, three + 4 +""", +"""\ +<document source="test data"> + <table> + <title> + short rows + <tgroup cols="3"> + <colspec colwidth="33"> + <colspec colwidth="33"> + <colspec colwidth="33"> + <thead> + <row> + <entry> + <paragraph> + header col 1 + <entry> + <paragraph> + header col 2 + <entry> + <tbody> + <row> + <entry> + <paragraph> + one + <entry> + <paragraph> + 2 + <entry> + <paragraph> + three + <row> + <entry> + <paragraph> + 4 + <entry> + <entry> +"""], +["""\ +.. csv-table:: empty +""", +"""\ +<document source="test data"> + <system_message level="2" line="1" source="test data" type="WARNING"> + <paragraph> + The "csv-table" directive requires content; none supplied. + <literal_block xml:space="preserve"> + .. csv-table:: empty +"""], +["""\ +.. csv-table:: content and external + :file: bogus.csv + + some, csv, data +""", +"""\ +<document source="test data"> + <system_message level="3" line="1" source="test data" type="ERROR"> + <paragraph> + "csv-table" directive may not both specify an external file and have content. + <literal_block xml:space="preserve"> + .. csv-table:: content and external + :file: bogus.csv + + some, csv, data +"""], +["""\ +.. csv-table:: external file and url + :file: bogus.csv + :url: http://example.org/bogus.csv +""", +"""\ +<document source="test data"> + <system_message level="3" line="1" source="test data" type="ERROR"> + <paragraph> + The "file" and "url" options may not be simultaneously specified for the "csv-table" directive. + <literal_block xml:space="preserve"> + .. csv-table:: external file and url + :file: bogus.csv + :url: http://example.org/bogus.csv +"""], +["""\ +.. csv-table:: error in the *title + + some, csv, data +""", +"""\ +<document source="test data"> + <table> + <title> + error in the + <problematic id="id2" refid="id1"> + * + title + <tgroup cols="3"> + <colspec colwidth="33"> + <colspec colwidth="33"> + <colspec colwidth="33"> + <tbody> + <row> + <entry> + <paragraph> + some + <entry> + <paragraph> + csv + <entry> + <paragraph> + data + <system_message backrefs="id2" id="id1" level="2" line="1" source="test data" type="WARNING"> + <paragraph> + Inline emphasis start-string without end-string. +"""], +["""\ +.. csv-table:: no such file + :file: bogus.csv +""", +"""\ +<document source="test data"> + <system_message level="4" line="1" source="test data" type="SEVERE"> + <paragraph> + Problems with "csv-table" directive path: + [Errno 2] No such file or directory: 'bogus.csv'. + <literal_block xml:space="preserve"> + .. csv-table:: no such file + :file: bogus.csv +"""], +["""\ +.. csv-table:: bad URL + :url: bogus.csv +""", +"""\ +<document source="test data"> + <system_message level="4" line="1" source="test data" type="SEVERE"> + <paragraph> + Problems with "csv-table" directive URL "bogus.csv": + unknown url type: bogus.csv. + <literal_block xml:space="preserve"> + .. csv-table:: bad URL + :url: bogus.csv +"""], +["""\ +.. csv-table:: column mismatch + :widths: 10,20 + + some, csv, data +""", +"""\ +<document source="test data"> + <system_message level="3" line="1" source="test data" type="ERROR"> + <paragraph> + "csv-table" widths do not match the number of columns in table (3). + <literal_block xml:space="preserve"> + .. csv-table:: column mismatch + :widths: 10,20 + + some, csv, data +"""], +["""\ +.. csv-table:: bad column widths + :widths: 10,y,z + + some, csv, data + +.. csv-table:: bad column widths + :widths: 0 0 0 + + some, csv, data +""", +"""\ +<document source="test data"> + <system_message level="3" line="1" source="test data" type="ERROR"> + <paragraph> + Error in "csv-table" directive: + invalid option value: (option: "widths"; value: '10,y,z') + invalid literal for int(): y. + <literal_block xml:space="preserve"> + .. csv-table:: bad column widths + :widths: 10,y,z + + some, csv, data + <system_message level="3" line="6" source="test data" type="ERROR"> + <paragraph> + Error in "csv-table" directive: + invalid option value: (option: "widths"; value: '0 0 0') + negative or zero value; must be positive. + <literal_block xml:space="preserve"> + .. csv-table:: bad column widths + :widths: 0 0 0 + + some, csv, data +"""], +["""\ +.. csv-table:: good delimiter + :delim: / + + some/csv/data + +.. csv-table:: good delimiter + :delim: \\ + + some\\csv\\data + +.. csv-table:: good delimiter + :delim: 0x5c + + some\\csv\\data + +.. csv-table:: good delimiter + :delim: space + + some csv data +""", +"""\ +<document source="test data"> + <table> + <title> + good delimiter + <tgroup cols="3"> + <colspec colwidth="33"> + <colspec colwidth="33"> + <colspec colwidth="33"> + <tbody> + <row> + <entry> + <paragraph> + some + <entry> + <paragraph> + csv + <entry> + <paragraph> + data + <table> + <title> + good delimiter + <tgroup cols="3"> + <colspec colwidth="33"> + <colspec colwidth="33"> + <colspec colwidth="33"> + <tbody> + <row> + <entry> + <paragraph> + some + <entry> + <paragraph> + csv + <entry> + <paragraph> + data + <table> + <title> + good delimiter + <tgroup cols="3"> + <colspec colwidth="33"> + <colspec colwidth="33"> + <colspec colwidth="33"> + <tbody> + <row> + <entry> + <paragraph> + some + <entry> + <paragraph> + csv + <entry> + <paragraph> + data + <table> + <title> + good delimiter + <tgroup cols="3"> + <colspec colwidth="33"> + <colspec colwidth="33"> + <colspec colwidth="33"> + <tbody> + <row> + <entry> + <paragraph> + some + <entry> + <paragraph> + csv + <entry> + <paragraph> + data +"""], +["""\ +.. csv-table:: bad delimiter + :delim: multiple + +.. csv-table:: bad delimiter + :delim: U+9999999999999 +""", +"""\ +<document source="test data"> + <system_message level="3" line="1" source="test data" type="ERROR"> + <paragraph> + Error in "csv-table" directive: + invalid option value: (option: "delim"; value: 'multiple') + 'multiple' invalid; must be a single character or a Unicode code. + <literal_block xml:space="preserve"> + .. csv-table:: bad delimiter + :delim: multiple + <system_message level="3" line="4" source="test data" type="ERROR"> + <paragraph> + Error in "csv-table" directive: + invalid option value: (option: "delim"; value: 'U+9999999999999') + code too large (long int too large to convert to int). + <literal_block xml:space="preserve"> + .. csv-table:: bad delimiter + :delim: U+9999999999999 +"""], +["""\ +.. csv-table:: bad CSV data + + "bad", \"csv, data +""", +"""\ +<document source="test data"> + <system_message level="3" line="1" source="test data" type="ERROR"> + <paragraph> + Error with CSV data in "csv-table" directive: + newline inside string + <literal_block xml:space="preserve"> + .. csv-table:: bad CSV data + + "bad", \"csv, data +"""], +["""\ +.. csv-table:: bad CSV header data + :header: "bad", \"csv, data + + good, csv, data +""", +"""\ +<document source="test data"> + <system_message level="3" line="1" source="test data" type="ERROR"> + <paragraph> + Error with CSV data in "csv-table" directive: + newline inside string + <literal_block xml:space="preserve"> + .. csv-table:: bad CSV header data + :header: "bad", \"csv, data + + good, csv, data +"""], ] -- cgit v1.2.1 From d667bc26fbe5faf6ce0bfd50beadd93fe1b5602d Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sat, 19 Jun 2004 22:54:20 +0000 Subject: updated git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2315 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../test_rst/test_directives/test_tables.py | 44 +++++++++++++++++++++- 1 file changed, 42 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_directives/test_tables.py b/test/test_parsers/test_rst/test_directives/test_tables.py index d93a6f299..b212be8de 100755 --- a/test/test_parsers/test_rst/test_directives/test_tables.py +++ b/test/test_parsers/test_rst/test_directives/test_tables.py @@ -12,6 +12,12 @@ Tests for tables.py directives. from __init__ import DocutilsTestSupport +try: + import csv +except ImportError: + csv = None + + def suite(): s = DocutilsTestSupport.ParserTestSuite() s.generateTests(totest) @@ -95,8 +101,8 @@ totest['table'] = [ """], ] -#xtotest = {} ; x -totest['csv-table'] = [ +if csv: + totest['csv-table'] = [ ["""\ .. csv-table:: inline with integral header :widths: 10,20,30 @@ -351,6 +357,40 @@ totest['csv-table'] = [ .. csv-table:: empty """], ["""\ +.. csv-table:: insufficient header row data + :header-rows: 2 + + some, csv, data +""", +"""\ +<document source="test data"> + <system_message level="3" line="1" source="test data" type="ERROR"> + <paragraph> + 2 header row(s) specified but only 1 row(s) of data supplied ("csv-table" directive). + <literal_block xml:space="preserve"> + .. csv-table:: insufficient header row data + :header-rows: 2 + + some, csv, data +"""], +["""\ +.. csv-table:: insufficient body data + :header-rows: 1 + + some, csv, data +""", +"""\ +<document source="test data"> + <system_message level="3" line="1" source="test data" type="ERROR"> + <paragraph> + Insufficient data supplied (1 row(s)); no data remaining for table body, required by "csv-table" directive. + <literal_block xml:space="preserve"> + .. csv-table:: insufficient body data + :header-rows: 1 + + some, csv, data +"""], +["""\ .. csv-table:: content and external :file: bogus.csv -- cgit v1.2.1 From caa376ee4f862ffd62581c666f2c617ca8b6852d Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sun, 20 Jun 2004 01:58:10 +0000 Subject: update for exception class differences between Python versions git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2317 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_parsers/test_rst/test_directives/test_unicode.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_directives/test_unicode.py b/test/test_parsers/test_rst/test_directives/test_unicode.py index 875efe811..3de704233 100755 --- a/test/test_parsers/test_rst/test_directives/test_unicode.py +++ b/test/test_parsers/test_rst/test_directives/test_unicode.py @@ -138,7 +138,7 @@ u"""\ <system_message level="3" line="2" source="test data" type="ERROR"> <paragraph> Invalid character code: 0x111111111111111111 - ValueError: code too large (%s) + ValueError: %s <literal_block xml:space="preserve"> unicode:: 0x111111111111111111 <system_message level="2" line="2" source="test data" type="WARNING"> @@ -157,8 +157,12 @@ u"""\ Substitution definition "too big for unicode" empty or invalid. <literal_block xml:space="preserve"> .. |too big for unicode| unicode:: 0x11111111 -""" % (DocutilsTestSupport.exception_data( +""" % ([DocutilsTestSupport.exception_data( 'unichr(int("111111111111111111", 16))')[0], + 'code too large (%s)' % DocutilsTestSupport.exception_data( + 'unichr(int("111111111111111111", 16))')[0]] + [isinstance(DocutilsTestSupport.exception_data( + 'unichr(int("111111111111111111", 16))')[0], OverflowError)], DocutilsTestSupport.exception_data('unichr(int("11111111", 16))')[2])] ] -- cgit v1.2.1 From b44485959106064385787772a6950e0577612bb9 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Mon, 21 Jun 2004 11:52:15 +0000 Subject: updated git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2338 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_writers/test_latex2e.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/test_writers/test_latex2e.py b/test/test_writers/test_latex2e.py index 2640f55f1..4fa2472ed 100644 --- a/test/test_writers/test_latex2e.py +++ b/test/test_writers/test_latex2e.py @@ -19,7 +19,7 @@ def suite(): latex_head = """\ -\\documentclass[10pt,english]{article} +\\documentclass[10pt,a4paper,english]{article} \\usepackage{babel} \\usepackage{shortvrb} \\usepackage[latin1]{inputenc} @@ -30,8 +30,9 @@ latex_head = """\ \\usepackage{graphicx} \\usepackage{color} \\usepackage{multirow} +\\usepackage{ifthen} \\usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref} -\\usepackage[a4paper,margin=2cm,nohead]{geometry} +\\usepackage[DIV12]{typearea} %% generator Docutils: http://docutils.sourceforge.net/ \\newlength{\\admonitionwidth} \\setlength{\\admonitionwidth}{0.9\\textwidth} -- cgit v1.2.1 From 28990425747d5915945f4097ef180aa6cadddec0 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Tue, 22 Jun 2004 20:13:37 +0000 Subject: renamed difflib to docutils_difflib git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2354 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/DocutilsTestSupport.py | 4 +- test/difflib.py | 1089 ------------------------------------------- test/docutils_difflib.py | 1089 +++++++++++++++++++++++++++++++++++++++++++ test/test_settings.py | 4 +- 4 files changed, 1093 insertions(+), 1093 deletions(-) delete mode 100644 test/difflib.py create mode 100644 test/docutils_difflib.py (limited to 'test') diff --git a/test/DocutilsTestSupport.py b/test/DocutilsTestSupport.py index 1545db42d..baaf44978 100644 --- a/test/DocutilsTestSupport.py +++ b/test/DocutilsTestSupport.py @@ -42,7 +42,7 @@ __docformat__ = 'reStructuredText' import sys import os import unittest -import difflib +import docutils_difflib import inspect from pprint import pformat from types import UnicodeType @@ -160,7 +160,7 @@ class CustomTestSuite(unittest.TestSuite): class CustomTestCase(unittest.TestCase): - compare = difflib.Differ().compare + compare = docutils_difflib.Differ().compare """Comparison method shared by all subclasses.""" def __init__(self, method_name, input, expected, id, diff --git a/test/difflib.py b/test/difflib.py deleted file mode 100644 index a41d4d5ba..000000000 --- a/test/difflib.py +++ /dev/null @@ -1,1089 +0,0 @@ -#! /usr/bin/env python - -""" -Module difflib -- helpers for computing deltas between objects. - -Function get_close_matches(word, possibilities, n=3, cutoff=0.6): - Use SequenceMatcher to return list of the best "good enough" matches. - -Function ndiff(a, b): - Return a delta: the difference between `a` and `b` (lists of strings). - -Function restore(delta, which): - Return one of the two sequences that generated an ndiff delta. - -Class SequenceMatcher: - A flexible class for comparing pairs of sequences of any type. - -Class Differ: - For producing human-readable deltas from sequences of lines of text. -""" - -__all__ = ['get_close_matches', 'ndiff', 'restore', 'SequenceMatcher', - 'Differ'] - -TRACE = 0 - -class SequenceMatcher: - - """ - SequenceMatcher is a flexible class for comparing pairs of sequences of - any type, so long as the sequence elements are hashable. The basic - algorithm predates, and is a little fancier than, an algorithm - published in the late 1980's by Ratcliff and Obershelp under the - hyperbolic name "gestalt pattern matching". The basic idea is to find - the longest contiguous matching subsequence that contains no "junk" - elements (R-O doesn't address junk). The same idea is then applied - recursively to the pieces of the sequences to the left and to the right - of the matching subsequence. This does not yield minimal edit - sequences, but does tend to yield matches that "look right" to people. - - SequenceMatcher tries to compute a "human-friendly diff" between two - sequences. Unlike e.g. UNIX(tm) diff, the fundamental notion is the - longest *contiguous* & junk-free matching subsequence. That's what - catches peoples' eyes. The Windows(tm) windiff has another interesting - notion, pairing up elements that appear uniquely in each sequence. - That, and the method here, appear to yield more intuitive difference - reports than does diff. This method appears to be the least vulnerable - to synching up on blocks of "junk lines", though (like blank lines in - ordinary text files, or maybe "<P>" lines in HTML files). That may be - because this is the only method of the 3 that has a *concept* of - "junk" <wink>. - - Example, comparing two strings, and considering blanks to be "junk": - - >>> s = SequenceMatcher(lambda x: x == " ", - ... "private Thread currentThread;", - ... "private volatile Thread currentThread;") - >>> - - .ratio() returns a float in [0, 1], measuring the "similarity" of the - sequences. As a rule of thumb, a .ratio() value over 0.6 means the - sequences are close matches: - - >>> print round(s.ratio(), 3) - 0.866 - >>> - - If you're only interested in where the sequences match, - .get_matching_blocks() is handy: - - >>> for block in s.get_matching_blocks(): - ... print "a[%d] and b[%d] match for %d elements" % block - a[0] and b[0] match for 8 elements - a[8] and b[17] match for 6 elements - a[14] and b[23] match for 15 elements - a[29] and b[38] match for 0 elements - - Note that the last tuple returned by .get_matching_blocks() is always a - dummy, (len(a), len(b), 0), and this is the only case in which the last - tuple element (number of elements matched) is 0. - - If you want to know how to change the first sequence into the second, - use .get_opcodes(): - - >>> for opcode in s.get_opcodes(): - ... print "%6s a[%d:%d] b[%d:%d]" % opcode - equal a[0:8] b[0:8] - insert a[8:8] b[8:17] - equal a[8:14] b[17:23] - equal a[14:29] b[23:38] - - See the Differ class for a fancy human-friendly file differencer, which - uses SequenceMatcher both to compare sequences of lines, and to compare - sequences of characters within similar (near-matching) lines. - - See also function get_close_matches() in this module, which shows how - simple code building on SequenceMatcher can be used to do useful work. - - Timing: Basic R-O is cubic time worst case and quadratic time expected - case. SequenceMatcher is quadratic time for the worst case and has - expected-case behavior dependent in a complicated way on how many - elements the sequences have in common; best case time is linear. - - Methods: - - __init__(isjunk=None, a='', b='') - Construct a SequenceMatcher. - - set_seqs(a, b) - Set the two sequences to be compared. - - set_seq1(a) - Set the first sequence to be compared. - - set_seq2(b) - Set the second sequence to be compared. - - find_longest_match(alo, ahi, blo, bhi) - Find longest matching block in a[alo:ahi] and b[blo:bhi]. - - get_matching_blocks() - Return list of triples describing matching subsequences. - - get_opcodes() - Return list of 5-tuples describing how to turn a into b. - - ratio() - Return a measure of the sequences' similarity (float in [0,1]). - - quick_ratio() - Return an upper bound on .ratio() relatively quickly. - - real_quick_ratio() - Return an upper bound on ratio() very quickly. - """ - - def __init__(self, isjunk=None, a='', b=''): - """Construct a SequenceMatcher. - - Optional arg isjunk is None (the default), or a one-argument - function that takes a sequence element and returns true iff the - element is junk. None is equivalent to passing "lambda x: 0", i.e. - no elements are considered to be junk. For example, pass - lambda x: x in " \\t" - if you're comparing lines as sequences of characters, and don't - want to synch up on blanks or hard tabs. - - Optional arg a is the first of two sequences to be compared. By - default, an empty string. The elements of a must be hashable. See - also .set_seqs() and .set_seq1(). - - Optional arg b is the second of two sequences to be compared. By - default, an empty string. The elements of b must be hashable. See - also .set_seqs() and .set_seq2(). - """ - - # Members: - # a - # first sequence - # b - # second sequence; differences are computed as "what do - # we need to do to 'a' to change it into 'b'?" - # b2j - # for x in b, b2j[x] is a list of the indices (into b) - # at which x appears; junk elements do not appear - # b2jhas - # b2j.has_key - # fullbcount - # for x in b, fullbcount[x] == the number of times x - # appears in b; only materialized if really needed (used - # only for computing quick_ratio()) - # matching_blocks - # a list of (i, j, k) triples, where a[i:i+k] == b[j:j+k]; - # ascending & non-overlapping in i and in j; terminated by - # a dummy (len(a), len(b), 0) sentinel - # opcodes - # a list of (tag, i1, i2, j1, j2) tuples, where tag is - # one of - # 'replace' a[i1:i2] should be replaced by b[j1:j2] - # 'delete' a[i1:i2] should be deleted - # 'insert' b[j1:j2] should be inserted - # 'equal' a[i1:i2] == b[j1:j2] - # isjunk - # a user-supplied function taking a sequence element and - # returning true iff the element is "junk" -- this has - # subtle but helpful effects on the algorithm, which I'll - # get around to writing up someday <0.9 wink>. - # DON'T USE! Only __chain_b uses this. Use isbjunk. - # isbjunk - # for x in b, isbjunk(x) == isjunk(x) but much faster; - # it's really the has_key method of a hidden dict. - # DOES NOT WORK for x in a! - - self.isjunk = isjunk - self.a = self.b = None - self.set_seqs(a, b) - - def set_seqs(self, a, b): - """Set the two sequences to be compared. - - >>> s = SequenceMatcher() - >>> s.set_seqs("abcd", "bcde") - >>> s.ratio() - 0.75 - """ - - self.set_seq1(a) - self.set_seq2(b) - - def set_seq1(self, a): - """Set the first sequence to be compared. - - The second sequence to be compared is not changed. - - >>> s = SequenceMatcher(None, "abcd", "bcde") - >>> s.ratio() - 0.75 - >>> s.set_seq1("bcde") - >>> s.ratio() - 1.0 - >>> - - SequenceMatcher computes and caches detailed information about the - second sequence, so if you want to compare one sequence S against - many sequences, use .set_seq2(S) once and call .set_seq1(x) - repeatedly for each of the other sequences. - - See also set_seqs() and set_seq2(). - """ - - if a is self.a: - return - self.a = a - self.matching_blocks = self.opcodes = None - - def set_seq2(self, b): - """Set the second sequence to be compared. - - The first sequence to be compared is not changed. - - >>> s = SequenceMatcher(None, "abcd", "bcde") - >>> s.ratio() - 0.75 - >>> s.set_seq2("abcd") - >>> s.ratio() - 1.0 - >>> - - SequenceMatcher computes and caches detailed information about the - second sequence, so if you want to compare one sequence S against - many sequences, use .set_seq2(S) once and call .set_seq1(x) - repeatedly for each of the other sequences. - - See also set_seqs() and set_seq1(). - """ - - if b is self.b: - return - self.b = b - self.matching_blocks = self.opcodes = None - self.fullbcount = None - self.__chain_b() - - # For each element x in b, set b2j[x] to a list of the indices in - # b where x appears; the indices are in increasing order; note that - # the number of times x appears in b is len(b2j[x]) ... - # when self.isjunk is defined, junk elements don't show up in this - # map at all, which stops the central find_longest_match method - # from starting any matching block at a junk element ... - # also creates the fast isbjunk function ... - # note that this is only called when b changes; so for cross-product - # kinds of matches, it's best to call set_seq2 once, then set_seq1 - # repeatedly - - def __chain_b(self): - # Because isjunk is a user-defined (not C) function, and we test - # for junk a LOT, it's important to minimize the number of calls. - # Before the tricks described here, __chain_b was by far the most - # time-consuming routine in the whole module! If anyone sees - # Jim Roskind, thank him again for profile.py -- I never would - # have guessed that. - # The first trick is to build b2j ignoring the possibility - # of junk. I.e., we don't call isjunk at all yet. Throwing - # out the junk later is much cheaper than building b2j "right" - # from the start. - b = self.b - self.b2j = b2j = {} - self.b2jhas = b2jhas = b2j.has_key - for i in xrange(len(b)): - elt = b[i] - if b2jhas(elt): - b2j[elt].append(i) - else: - b2j[elt] = [i] - - # Now b2j.keys() contains elements uniquely, and especially when - # the sequence is a string, that's usually a good deal smaller - # than len(string). The difference is the number of isjunk calls - # saved. - isjunk, junkdict = self.isjunk, {} - if isjunk: - for elt in b2j.keys(): - if isjunk(elt): - junkdict[elt] = 1 # value irrelevant; it's a set - del b2j[elt] - - # Now for x in b, isjunk(x) == junkdict.has_key(x), but the - # latter is much faster. Note too that while there may be a - # lot of junk in the sequence, the number of *unique* junk - # elements is probably small. So the memory burden of keeping - # this dict alive is likely trivial compared to the size of b2j. - self.isbjunk = junkdict.has_key - - def find_longest_match(self, alo, ahi, blo, bhi): - """Find longest matching block in a[alo:ahi] and b[blo:bhi]. - - If isjunk is not defined: - - Return (i,j,k) such that a[i:i+k] is equal to b[j:j+k], where - alo <= i <= i+k <= ahi - blo <= j <= j+k <= bhi - and for all (i',j',k') meeting those conditions, - k >= k' - i <= i' - and if i == i', j <= j' - - In other words, of all maximal matching blocks, return one that - starts earliest in a, and of all those maximal matching blocks that - start earliest in a, return the one that starts earliest in b. - - >>> s = SequenceMatcher(None, " abcd", "abcd abcd") - >>> s.find_longest_match(0, 5, 0, 9) - (0, 4, 5) - - If isjunk is defined, first the longest matching block is - determined as above, but with the additional restriction that no - junk element appears in the block. Then that block is extended as - far as possible by matching (only) junk elements on both sides. So - the resulting block never matches on junk except as identical junk - happens to be adjacent to an "interesting" match. - - Here's the same example as before, but considering blanks to be - junk. That prevents " abcd" from matching the " abcd" at the tail - end of the second sequence directly. Instead only the "abcd" can - match, and matches the leftmost "abcd" in the second sequence: - - >>> s = SequenceMatcher(lambda x: x==" ", " abcd", "abcd abcd") - >>> s.find_longest_match(0, 5, 0, 9) - (1, 0, 4) - - If no blocks match, return (alo, blo, 0). - - >>> s = SequenceMatcher(None, "ab", "c") - >>> s.find_longest_match(0, 2, 0, 1) - (0, 0, 0) - """ - - # CAUTION: stripping common prefix or suffix would be incorrect. - # E.g., - # ab - # acab - # Longest matching block is "ab", but if common prefix is - # stripped, it's "a" (tied with "b"). UNIX(tm) diff does so - # strip, so ends up claiming that ab is changed to acab by - # inserting "ca" in the middle. That's minimal but unintuitive: - # "it's obvious" that someone inserted "ac" at the front. - # Windiff ends up at the same place as diff, but by pairing up - # the unique 'b's and then matching the first two 'a's. - - a, b, b2j, isbjunk = self.a, self.b, self.b2j, self.isbjunk - besti, bestj, bestsize = alo, blo, 0 - # find longest junk-free match - # during an iteration of the loop, j2len[j] = length of longest - # junk-free match ending with a[i-1] and b[j] - j2len = {} - nothing = [] - for i in xrange(alo, ahi): - # look at all instances of a[i] in b; note that because - # b2j has no junk keys, the loop is skipped if a[i] is junk - j2lenget = j2len.get - newj2len = {} - for j in b2j.get(a[i], nothing): - # a[i] matches b[j] - if j < blo: - continue - if j >= bhi: - break - k = newj2len[j] = j2lenget(j-1, 0) + 1 - if k > bestsize: - besti, bestj, bestsize = i-k+1, j-k+1, k - j2len = newj2len - - # Now that we have a wholly interesting match (albeit possibly - # empty!), we may as well suck up the matching junk on each - # side of it too. Can't think of a good reason not to, and it - # saves post-processing the (possibly considerable) expense of - # figuring out what to do with it. In the case of an empty - # interesting match, this is clearly the right thing to do, - # because no other kind of match is possible in the regions. - while besti > alo and bestj > blo and \ - isbjunk(b[bestj-1]) and \ - a[besti-1] == b[bestj-1]: - besti, bestj, bestsize = besti-1, bestj-1, bestsize+1 - while besti+bestsize < ahi and bestj+bestsize < bhi and \ - isbjunk(b[bestj+bestsize]) and \ - a[besti+bestsize] == b[bestj+bestsize]: - bestsize = bestsize + 1 - - if TRACE: - print "get_matching_blocks", alo, ahi, blo, bhi - print " returns", besti, bestj, bestsize - return besti, bestj, bestsize - - def get_matching_blocks(self): - """Return list of triples describing matching subsequences. - - Each triple is of the form (i, j, n), and means that - a[i:i+n] == b[j:j+n]. The triples are monotonically increasing in - i and in j. - - The last triple is a dummy, (len(a), len(b), 0), and is the only - triple with n==0. - - >>> s = SequenceMatcher(None, "abxcd", "abcd") - >>> s.get_matching_blocks() - [(0, 0, 2), (3, 2, 2), (5, 4, 0)] - """ - - if self.matching_blocks is not None: - return self.matching_blocks - self.matching_blocks = [] - la, lb = len(self.a), len(self.b) - self.__helper(0, la, 0, lb, self.matching_blocks) - self.matching_blocks.append( (la, lb, 0) ) - if TRACE: - print '*** matching blocks', self.matching_blocks - return self.matching_blocks - - # builds list of matching blocks covering a[alo:ahi] and - # b[blo:bhi], appending them in increasing order to answer - - def __helper(self, alo, ahi, blo, bhi, answer): - i, j, k = x = self.find_longest_match(alo, ahi, blo, bhi) - # a[alo:i] vs b[blo:j] unknown - # a[i:i+k] same as b[j:j+k] - # a[i+k:ahi] vs b[j+k:bhi] unknown - if k: - if alo < i and blo < j: - self.__helper(alo, i, blo, j, answer) - answer.append(x) - if i+k < ahi and j+k < bhi: - self.__helper(i+k, ahi, j+k, bhi, answer) - - def get_opcodes(self): - """Return list of 5-tuples describing how to turn a into b. - - Each tuple is of the form (tag, i1, i2, j1, j2). The first tuple - has i1 == j1 == 0, and remaining tuples have i1 == the i2 from the - tuple preceding it, and likewise for j1 == the previous j2. - - The tags are strings, with these meanings: - - 'replace': a[i1:i2] should be replaced by b[j1:j2] - 'delete': a[i1:i2] should be deleted. - Note that j1==j2 in this case. - 'insert': b[j1:j2] should be inserted at a[i1:i1]. - Note that i1==i2 in this case. - 'equal': a[i1:i2] == b[j1:j2] - - >>> a = "qabxcd" - >>> b = "abycdf" - >>> s = SequenceMatcher(None, a, b) - >>> for tag, i1, i2, j1, j2 in s.get_opcodes(): - ... print ("%7s a[%d:%d] (%s) b[%d:%d] (%s)" % - ... (tag, i1, i2, a[i1:i2], j1, j2, b[j1:j2])) - delete a[0:1] (q) b[0:0] () - equal a[1:3] (ab) b[0:2] (ab) - replace a[3:4] (x) b[2:3] (y) - equal a[4:6] (cd) b[3:5] (cd) - insert a[6:6] () b[5:6] (f) - """ - - if self.opcodes is not None: - return self.opcodes - i = j = 0 - self.opcodes = answer = [] - for ai, bj, size in self.get_matching_blocks(): - # invariant: we've pumped out correct diffs to change - # a[:i] into b[:j], and the next matching block is - # a[ai:ai+size] == b[bj:bj+size]. So we need to pump - # out a diff to change a[i:ai] into b[j:bj], pump out - # the matching block, and move (i,j) beyond the match - tag = '' - if i < ai and j < bj: - tag = 'replace' - elif i < ai: - tag = 'delete' - elif j < bj: - tag = 'insert' - if tag: - answer.append( (tag, i, ai, j, bj) ) - i, j = ai+size, bj+size - # the list of matching blocks is terminated by a - # sentinel with size 0 - if size: - answer.append( ('equal', ai, i, bj, j) ) - return answer - - def ratio(self): - """Return a measure of the sequences' similarity (float in [0,1]). - - Where T is the total number of elements in both sequences, and - M is the number of matches, this is 2,0*M / T. - Note that this is 1 if the sequences are identical, and 0 if - they have nothing in common. - - .ratio() is expensive to compute if you haven't already computed - .get_matching_blocks() or .get_opcodes(), in which case you may - want to try .quick_ratio() or .real_quick_ratio() first to get an - upper bound. - - >>> s = SequenceMatcher(None, "abcd", "bcde") - >>> s.ratio() - 0.75 - >>> s.quick_ratio() - 0.75 - >>> s.real_quick_ratio() - 1.0 - """ - - matches = reduce(lambda sum, triple: sum + triple[-1], - self.get_matching_blocks(), 0) - return 2.0 * matches / (len(self.a) + len(self.b)) - - def quick_ratio(self): - """Return an upper bound on ratio() relatively quickly. - - This isn't defined beyond that it is an upper bound on .ratio(), and - is faster to compute. - """ - - # viewing a and b as multisets, set matches to the cardinality - # of their intersection; this counts the number of matches - # without regard to order, so is clearly an upper bound - if self.fullbcount is None: - self.fullbcount = fullbcount = {} - for elt in self.b: - fullbcount[elt] = fullbcount.get(elt, 0) + 1 - fullbcount = self.fullbcount - # avail[x] is the number of times x appears in 'b' less the - # number of times we've seen it in 'a' so far ... kinda - avail = {} - availhas, matches = avail.has_key, 0 - for elt in self.a: - if availhas(elt): - numb = avail[elt] - else: - numb = fullbcount.get(elt, 0) - avail[elt] = numb - 1 - if numb > 0: - matches = matches + 1 - return 2.0 * matches / (len(self.a) + len(self.b)) - - def real_quick_ratio(self): - """Return an upper bound on ratio() very quickly. - - This isn't defined beyond that it is an upper bound on .ratio(), and - is faster to compute than either .ratio() or .quick_ratio(). - """ - - la, lb = len(self.a), len(self.b) - # can't have more matches than the number of elements in the - # shorter sequence - return 2.0 * min(la, lb) / (la + lb) - -def get_close_matches(word, possibilities, n=3, cutoff=0.6): - """Use SequenceMatcher to return list of the best "good enough" matches. - - word is a sequence for which close matches are desired (typically a - string). - - possibilities is a list of sequences against which to match word - (typically a list of strings). - - Optional arg n (default 3) is the maximum number of close matches to - return. n must be > 0. - - Optional arg cutoff (default 0.6) is a float in [0, 1]. Possibilities - that don't score at least that similar to word are ignored. - - The best (no more than n) matches among the possibilities are returned - in a list, sorted by similarity score, most similar first. - - >>> get_close_matches("appel", ["ape", "apple", "peach", "puppy"]) - ['apple', 'ape'] - >>> import keyword as _keyword - >>> get_close_matches("wheel", _keyword.kwlist) - ['while'] - >>> get_close_matches("apple", _keyword.kwlist) - [] - >>> get_close_matches("accept", _keyword.kwlist) - ['except'] - """ - - if not n > 0: - raise ValueError("n must be > 0: " + `n`) - if not 0.0 <= cutoff <= 1.0: - raise ValueError("cutoff must be in [0.0, 1.0]: " + `cutoff`) - result = [] - s = SequenceMatcher() - s.set_seq2(word) - for x in possibilities: - s.set_seq1(x) - if s.real_quick_ratio() >= cutoff and \ - s.quick_ratio() >= cutoff and \ - s.ratio() >= cutoff: - result.append((s.ratio(), x)) - # Sort by score. - result.sort() - # Retain only the best n. - result = result[-n:] - # Move best-scorer to head of list. - result.reverse() - # Strip scores. - return [x for score, x in result] - - -def _count_leading(line, ch): - """ - Return number of `ch` characters at the start of `line`. - - Example: - - >>> _count_leading(' abc', ' ') - 3 - """ - - i, n = 0, len(line) - while i < n and line[i] == ch: - i += 1 - return i - -class Differ: - r""" - Differ is a class for comparing sequences of lines of text, and - producing human-readable differences or deltas. Differ uses - SequenceMatcher both to compare sequences of lines, and to compare - sequences of characters within similar (near-matching) lines. - - Each line of a Differ delta begins with a two-letter code: - - '- ' line unique to sequence 1 - '+ ' line unique to sequence 2 - ' ' line common to both sequences - '? ' line not present in either input sequence - - Lines beginning with '? ' attempt to guide the eye to intraline - differences, and were not present in either input sequence. These lines - can be confusing if the sequences contain tab characters. - - Note that Differ makes no claim to produce a *minimal* diff. To the - contrary, minimal diffs are often counter-intuitive, because they synch - up anywhere possible, sometimes accidental matches 100 pages apart. - Restricting synch points to contiguous matches preserves some notion of - locality, at the occasional cost of producing a longer diff. - - Example: Comparing two texts. - - First we set up the texts, sequences of individual single-line strings - ending with newlines (such sequences can also be obtained from the - `readlines()` method of file-like objects): - - >>> text1 = ''' 1. Beautiful is better than ugly. - ... 2. Explicit is better than implicit. - ... 3. Simple is better than complex. - ... 4. Complex is better than complicated. - ... '''.splitlines(1) - >>> len(text1) - 4 - >>> text1[0][-1] - '\n' - >>> text2 = ''' 1. Beautiful is better than ugly. - ... 3. Simple is better than complex. - ... 4. Complicated is better than complex. - ... 5. Flat is better than nested. - ... '''.splitlines(1) - - Next we instantiate a Differ object: - - >>> d = Differ() - - Note that when instantiating a Differ object we may pass functions to - filter out line and character 'junk'. See Differ.__init__ for details. - - Finally, we compare the two: - - >>> result = d.compare(text1, text2) - - 'result' is a list of strings, so let's pretty-print it: - - >>> from pprint import pprint as _pprint - >>> _pprint(result) - [' 1. Beautiful is better than ugly.\n', - '- 2. Explicit is better than implicit.\n', - '- 3. Simple is better than complex.\n', - '+ 3. Simple is better than complex.\n', - '? ++\n', - '- 4. Complex is better than complicated.\n', - '? ^ ---- ^\n', - '+ 4. Complicated is better than complex.\n', - '? ++++ ^ ^\n', - '+ 5. Flat is better than nested.\n'] - - As a single multi-line string it looks like this: - - >>> print ''.join(result), - 1. Beautiful is better than ugly. - - 2. Explicit is better than implicit. - - 3. Simple is better than complex. - + 3. Simple is better than complex. - ? ++ - - 4. Complex is better than complicated. - ? ^ ---- ^ - + 4. Complicated is better than complex. - ? ++++ ^ ^ - + 5. Flat is better than nested. - - Methods: - - __init__(linejunk=None, charjunk=None) - Construct a text differencer, with optional filters. - - compare(a, b) - Compare two sequences of lines; return the resulting delta (list). - """ - - def __init__(self, linejunk=None, charjunk=None): - """ - Construct a text differencer, with optional filters. - - The two optional keyword parameters are for filter functions: - - - `linejunk`: A function that should accept a single string argument, - and return true iff the string is junk. The module-level function - `IS_LINE_JUNK` may be used to filter out lines without visible - characters, except for at most one splat ('#'). - - - `charjunk`: A function that should accept a string of length 1. The - module-level function `IS_CHARACTER_JUNK` may be used to filter out - whitespace characters (a blank or tab; **note**: bad idea to include - newline in this!). - """ - - self.linejunk = linejunk - self.charjunk = charjunk - self.results = [] - - def compare(self, a, b): - r""" - Compare two sequences of lines; return the resulting delta (list). - - Each sequence must contain individual single-line strings ending with - newlines. Such sequences can be obtained from the `readlines()` method - of file-like objects. The list returned is also made up of - newline-terminated strings, ready to be used with the `writelines()` - method of a file-like object. - - Example: - - >>> print ''.join(Differ().compare('one\ntwo\nthree\n'.splitlines(1), - ... 'ore\ntree\nemu\n'.splitlines(1))), - - one - ? ^ - + ore - ? ^ - - two - - three - ? - - + tree - + emu - """ - - cruncher = SequenceMatcher(self.linejunk, a, b) - for tag, alo, ahi, blo, bhi in cruncher.get_opcodes(): - if tag == 'replace': - self._fancy_replace(a, alo, ahi, b, blo, bhi) - elif tag == 'delete': - self._dump('-', a, alo, ahi) - elif tag == 'insert': - self._dump('+', b, blo, bhi) - elif tag == 'equal': - self._dump(' ', a, alo, ahi) - else: - raise ValueError, 'unknown tag ' + `tag` - results = self.results - self.results = [] - return results - - def _dump(self, tag, x, lo, hi): - """Store comparison results for a same-tagged range.""" - for i in xrange(lo, hi): - self.results.append('%s %s' % (tag, x[i])) - - def _plain_replace(self, a, alo, ahi, b, blo, bhi): - assert alo < ahi and blo < bhi - # dump the shorter block first -- reduces the burden on short-term - # memory if the blocks are of very different sizes - if bhi - blo < ahi - alo: - self._dump('+', b, blo, bhi) - self._dump('-', a, alo, ahi) - else: - self._dump('-', a, alo, ahi) - self._dump('+', b, blo, bhi) - - def _fancy_replace(self, a, alo, ahi, b, blo, bhi): - r""" - When replacing one block of lines with another, search the blocks - for *similar* lines; the best-matching pair (if any) is used as a - synch point, and intraline difference marking is done on the - similar pair. Lots of work, but often worth it. - - Example: - - >>> d = Differ() - >>> d._fancy_replace(['abcDefghiJkl\n'], 0, 1, ['abcdefGhijkl\n'], 0, 1) - >>> print ''.join(d.results), - - abcDefghiJkl - ? ^ ^ ^ - + abcdefGhijkl - ? ^ ^ ^ - """ - - if TRACE: - self.results.append('*** _fancy_replace %s %s %s %s\n' - % (alo, ahi, blo, bhi)) - self._dump('>', a, alo, ahi) - self._dump('<', b, blo, bhi) - - # don't synch up unless the lines have a similarity score of at - # least cutoff; best_ratio tracks the best score seen so far - best_ratio, cutoff = 0.74, 0.75 - cruncher = SequenceMatcher(self.charjunk) - eqi, eqj = None, None # 1st indices of equal lines (if any) - - # search for the pair that matches best without being identical - # (identical lines must be junk lines, & we don't want to synch up - # on junk -- unless we have to) - for j in xrange(blo, bhi): - bj = b[j] - cruncher.set_seq2(bj) - for i in xrange(alo, ahi): - ai = a[i] - if ai == bj: - if eqi is None: - eqi, eqj = i, j - continue - cruncher.set_seq1(ai) - # computing similarity is expensive, so use the quick - # upper bounds first -- have seen this speed up messy - # compares by a factor of 3. - # note that ratio() is only expensive to compute the first - # time it's called on a sequence pair; the expensive part - # of the computation is cached by cruncher - if cruncher.real_quick_ratio() > best_ratio and \ - cruncher.quick_ratio() > best_ratio and \ - cruncher.ratio() > best_ratio: - best_ratio, best_i, best_j = cruncher.ratio(), i, j - if best_ratio < cutoff: - # no non-identical "pretty close" pair - if eqi is None: - # no identical pair either -- treat it as a straight replace - self._plain_replace(a, alo, ahi, b, blo, bhi) - return - # no close pair, but an identical pair -- synch up on that - best_i, best_j, best_ratio = eqi, eqj, 1.0 - else: - # there's a close pair, so forget the identical pair (if any) - eqi = None - - # a[best_i] very similar to b[best_j]; eqi is None iff they're not - # identical - if TRACE: - self.results.append('*** best_ratio %s %s %s %s\n' - % (best_ratio, best_i, best_j)) - self._dump('>', a, best_i, best_i+1) - self._dump('<', b, best_j, best_j+1) - - # pump out diffs from before the synch point - self._fancy_helper(a, alo, best_i, b, blo, best_j) - - # do intraline marking on the synch pair - aelt, belt = a[best_i], b[best_j] - if eqi is None: - # pump out a '-', '?', '+', '?' quad for the synched lines - atags = btags = "" - cruncher.set_seqs(aelt, belt) - for tag, ai1, ai2, bj1, bj2 in cruncher.get_opcodes(): - la, lb = ai2 - ai1, bj2 - bj1 - if tag == 'replace': - atags += '^' * la - btags += '^' * lb - elif tag == 'delete': - atags += '-' * la - elif tag == 'insert': - btags += '+' * lb - elif tag == 'equal': - atags += ' ' * la - btags += ' ' * lb - else: - raise ValueError, 'unknown tag ' + `tag` - self._qformat(aelt, belt, atags, btags) - else: - # the synch pair is identical - self.results.append(' ' + aelt) - - # pump out diffs from after the synch point - self._fancy_helper(a, best_i+1, ahi, b, best_j+1, bhi) - - def _fancy_helper(self, a, alo, ahi, b, blo, bhi): - if alo < ahi: - if blo < bhi: - self._fancy_replace(a, alo, ahi, b, blo, bhi) - else: - self._dump('-', a, alo, ahi) - elif blo < bhi: - self._dump('+', b, blo, bhi) - - def _qformat(self, aline, bline, atags, btags): - r""" - Format "?" output and deal with leading tabs. - - Example: - - >>> d = Differ() - >>> d._qformat('\tabcDefghiJkl\n', '\t\tabcdefGhijkl\n', - ... ' ^ ^ ^ ', '+ ^ ^ ^ ') - >>> for line in d.results: print repr(line) - ... - '- \tabcDefghiJkl\n' - '? \t ^ ^ ^\n' - '+ \t\tabcdefGhijkl\n' - '? \t ^ ^ ^\n' - """ - - # Can hurt, but will probably help most of the time. - common = min(_count_leading(aline, "\t"), - _count_leading(bline, "\t")) - common = min(common, _count_leading(atags[:common], " ")) - atags = atags[common:].rstrip() - btags = btags[common:].rstrip() - - self.results.append("- " + aline) - if atags: - self.results.append("? %s%s\n" % ("\t" * common, atags)) - - self.results.append("+ " + bline) - if btags: - self.results.append("? %s%s\n" % ("\t" * common, btags)) - -# With respect to junk, an earlier version of ndiff simply refused to -# *start* a match with a junk element. The result was cases like this: -# before: private Thread currentThread; -# after: private volatile Thread currentThread; -# If you consider whitespace to be junk, the longest contiguous match -# not starting with junk is "e Thread currentThread". So ndiff reported -# that "e volatil" was inserted between the 't' and the 'e' in "private". -# While an accurate view, to people that's absurd. The current version -# looks for matching blocks that are entirely junk-free, then extends the -# longest one of those as far as possible but only with matching junk. -# So now "currentThread" is matched, then extended to suck up the -# preceding blank; then "private" is matched, and extended to suck up the -# following blank; then "Thread" is matched; and finally ndiff reports -# that "volatile " was inserted before "Thread". The only quibble -# remaining is that perhaps it was really the case that " volatile" -# was inserted after "private". I can live with that <wink>. - -import re - -def IS_LINE_JUNK(line, pat=re.compile(r"\s*#?\s*$").match): - r""" - Return 1 for ignorable line: iff `line` is blank or contains a single '#'. - - Examples: - - >>> IS_LINE_JUNK('\n') - 1 - >>> IS_LINE_JUNK(' # \n') - 1 - >>> IS_LINE_JUNK('hello\n') - 0 - """ - - return pat(line) is not None - -def IS_CHARACTER_JUNK(ch, ws=" \t"): - r""" - Return 1 for ignorable character: iff `ch` is a space or tab. - - Examples: - - >>> IS_CHARACTER_JUNK(' ') - 1 - >>> IS_CHARACTER_JUNK('\t') - 1 - >>> IS_CHARACTER_JUNK('\n') - 0 - >>> IS_CHARACTER_JUNK('x') - 0 - """ - - return ch in ws - -del re - -def ndiff(a, b, linejunk=IS_LINE_JUNK, charjunk=IS_CHARACTER_JUNK): - r""" - Compare `a` and `b` (lists of strings); return a `Differ`-style delta. - - Optional keyword parameters `linejunk` and `charjunk` are for filter - functions (or None): - - - linejunk: A function that should accept a single string argument, and - return true iff the string is junk. The default is module-level function - IS_LINE_JUNK, which filters out lines without visible characters, except - for at most one splat ('#'). - - - charjunk: A function that should accept a string of length 1. The - default is module-level function IS_CHARACTER_JUNK, which filters out - whitespace characters (a blank or tab; note: bad idea to include newline - in this!). - - Tools/scripts/ndiff.py is a command-line front-end to this function. - - Example: - - >>> diff = ndiff('one\ntwo\nthree\n'.splitlines(1), - ... 'ore\ntree\nemu\n'.splitlines(1)) - >>> print ''.join(diff), - - one - ? ^ - + ore - ? ^ - - two - - three - ? - - + tree - + emu - """ - return Differ(linejunk, charjunk).compare(a, b) - -def restore(delta, which): - r""" - Return one of the two sequences that generated a delta. - - Given a `delta` produced by `Differ.compare()` or `ndiff()`, extract - lines originating from file 1 or 2 (parameter `which`), stripping off line - prefixes. - - Examples: - - >>> diff = ndiff('one\ntwo\nthree\n'.splitlines(1), - ... 'ore\ntree\nemu\n'.splitlines(1)) - >>> print ''.join(restore(diff, 1)), - one - two - three - >>> print ''.join(restore(diff, 2)), - ore - tree - emu - """ - try: - tag = {1: "- ", 2: "+ "}[int(which)] - except KeyError: - raise ValueError, ('unknown delta choice (must be 1 or 2): %r' - % which) - prefixes = (" ", tag) - results = [] - for line in delta: - if line[:2] in prefixes: - results.append(line[2:]) - return results - -def _test(): - import doctest, difflib - return doctest.testmod(difflib) - -if __name__ == "__main__": - _test() diff --git a/test/docutils_difflib.py b/test/docutils_difflib.py new file mode 100644 index 000000000..a41d4d5ba --- /dev/null +++ b/test/docutils_difflib.py @@ -0,0 +1,1089 @@ +#! /usr/bin/env python + +""" +Module difflib -- helpers for computing deltas between objects. + +Function get_close_matches(word, possibilities, n=3, cutoff=0.6): + Use SequenceMatcher to return list of the best "good enough" matches. + +Function ndiff(a, b): + Return a delta: the difference between `a` and `b` (lists of strings). + +Function restore(delta, which): + Return one of the two sequences that generated an ndiff delta. + +Class SequenceMatcher: + A flexible class for comparing pairs of sequences of any type. + +Class Differ: + For producing human-readable deltas from sequences of lines of text. +""" + +__all__ = ['get_close_matches', 'ndiff', 'restore', 'SequenceMatcher', + 'Differ'] + +TRACE = 0 + +class SequenceMatcher: + + """ + SequenceMatcher is a flexible class for comparing pairs of sequences of + any type, so long as the sequence elements are hashable. The basic + algorithm predates, and is a little fancier than, an algorithm + published in the late 1980's by Ratcliff and Obershelp under the + hyperbolic name "gestalt pattern matching". The basic idea is to find + the longest contiguous matching subsequence that contains no "junk" + elements (R-O doesn't address junk). The same idea is then applied + recursively to the pieces of the sequences to the left and to the right + of the matching subsequence. This does not yield minimal edit + sequences, but does tend to yield matches that "look right" to people. + + SequenceMatcher tries to compute a "human-friendly diff" between two + sequences. Unlike e.g. UNIX(tm) diff, the fundamental notion is the + longest *contiguous* & junk-free matching subsequence. That's what + catches peoples' eyes. The Windows(tm) windiff has another interesting + notion, pairing up elements that appear uniquely in each sequence. + That, and the method here, appear to yield more intuitive difference + reports than does diff. This method appears to be the least vulnerable + to synching up on blocks of "junk lines", though (like blank lines in + ordinary text files, or maybe "<P>" lines in HTML files). That may be + because this is the only method of the 3 that has a *concept* of + "junk" <wink>. + + Example, comparing two strings, and considering blanks to be "junk": + + >>> s = SequenceMatcher(lambda x: x == " ", + ... "private Thread currentThread;", + ... "private volatile Thread currentThread;") + >>> + + .ratio() returns a float in [0, 1], measuring the "similarity" of the + sequences. As a rule of thumb, a .ratio() value over 0.6 means the + sequences are close matches: + + >>> print round(s.ratio(), 3) + 0.866 + >>> + + If you're only interested in where the sequences match, + .get_matching_blocks() is handy: + + >>> for block in s.get_matching_blocks(): + ... print "a[%d] and b[%d] match for %d elements" % block + a[0] and b[0] match for 8 elements + a[8] and b[17] match for 6 elements + a[14] and b[23] match for 15 elements + a[29] and b[38] match for 0 elements + + Note that the last tuple returned by .get_matching_blocks() is always a + dummy, (len(a), len(b), 0), and this is the only case in which the last + tuple element (number of elements matched) is 0. + + If you want to know how to change the first sequence into the second, + use .get_opcodes(): + + >>> for opcode in s.get_opcodes(): + ... print "%6s a[%d:%d] b[%d:%d]" % opcode + equal a[0:8] b[0:8] + insert a[8:8] b[8:17] + equal a[8:14] b[17:23] + equal a[14:29] b[23:38] + + See the Differ class for a fancy human-friendly file differencer, which + uses SequenceMatcher both to compare sequences of lines, and to compare + sequences of characters within similar (near-matching) lines. + + See also function get_close_matches() in this module, which shows how + simple code building on SequenceMatcher can be used to do useful work. + + Timing: Basic R-O is cubic time worst case and quadratic time expected + case. SequenceMatcher is quadratic time for the worst case and has + expected-case behavior dependent in a complicated way on how many + elements the sequences have in common; best case time is linear. + + Methods: + + __init__(isjunk=None, a='', b='') + Construct a SequenceMatcher. + + set_seqs(a, b) + Set the two sequences to be compared. + + set_seq1(a) + Set the first sequence to be compared. + + set_seq2(b) + Set the second sequence to be compared. + + find_longest_match(alo, ahi, blo, bhi) + Find longest matching block in a[alo:ahi] and b[blo:bhi]. + + get_matching_blocks() + Return list of triples describing matching subsequences. + + get_opcodes() + Return list of 5-tuples describing how to turn a into b. + + ratio() + Return a measure of the sequences' similarity (float in [0,1]). + + quick_ratio() + Return an upper bound on .ratio() relatively quickly. + + real_quick_ratio() + Return an upper bound on ratio() very quickly. + """ + + def __init__(self, isjunk=None, a='', b=''): + """Construct a SequenceMatcher. + + Optional arg isjunk is None (the default), or a one-argument + function that takes a sequence element and returns true iff the + element is junk. None is equivalent to passing "lambda x: 0", i.e. + no elements are considered to be junk. For example, pass + lambda x: x in " \\t" + if you're comparing lines as sequences of characters, and don't + want to synch up on blanks or hard tabs. + + Optional arg a is the first of two sequences to be compared. By + default, an empty string. The elements of a must be hashable. See + also .set_seqs() and .set_seq1(). + + Optional arg b is the second of two sequences to be compared. By + default, an empty string. The elements of b must be hashable. See + also .set_seqs() and .set_seq2(). + """ + + # Members: + # a + # first sequence + # b + # second sequence; differences are computed as "what do + # we need to do to 'a' to change it into 'b'?" + # b2j + # for x in b, b2j[x] is a list of the indices (into b) + # at which x appears; junk elements do not appear + # b2jhas + # b2j.has_key + # fullbcount + # for x in b, fullbcount[x] == the number of times x + # appears in b; only materialized if really needed (used + # only for computing quick_ratio()) + # matching_blocks + # a list of (i, j, k) triples, where a[i:i+k] == b[j:j+k]; + # ascending & non-overlapping in i and in j; terminated by + # a dummy (len(a), len(b), 0) sentinel + # opcodes + # a list of (tag, i1, i2, j1, j2) tuples, where tag is + # one of + # 'replace' a[i1:i2] should be replaced by b[j1:j2] + # 'delete' a[i1:i2] should be deleted + # 'insert' b[j1:j2] should be inserted + # 'equal' a[i1:i2] == b[j1:j2] + # isjunk + # a user-supplied function taking a sequence element and + # returning true iff the element is "junk" -- this has + # subtle but helpful effects on the algorithm, which I'll + # get around to writing up someday <0.9 wink>. + # DON'T USE! Only __chain_b uses this. Use isbjunk. + # isbjunk + # for x in b, isbjunk(x) == isjunk(x) but much faster; + # it's really the has_key method of a hidden dict. + # DOES NOT WORK for x in a! + + self.isjunk = isjunk + self.a = self.b = None + self.set_seqs(a, b) + + def set_seqs(self, a, b): + """Set the two sequences to be compared. + + >>> s = SequenceMatcher() + >>> s.set_seqs("abcd", "bcde") + >>> s.ratio() + 0.75 + """ + + self.set_seq1(a) + self.set_seq2(b) + + def set_seq1(self, a): + """Set the first sequence to be compared. + + The second sequence to be compared is not changed. + + >>> s = SequenceMatcher(None, "abcd", "bcde") + >>> s.ratio() + 0.75 + >>> s.set_seq1("bcde") + >>> s.ratio() + 1.0 + >>> + + SequenceMatcher computes and caches detailed information about the + second sequence, so if you want to compare one sequence S against + many sequences, use .set_seq2(S) once and call .set_seq1(x) + repeatedly for each of the other sequences. + + See also set_seqs() and set_seq2(). + """ + + if a is self.a: + return + self.a = a + self.matching_blocks = self.opcodes = None + + def set_seq2(self, b): + """Set the second sequence to be compared. + + The first sequence to be compared is not changed. + + >>> s = SequenceMatcher(None, "abcd", "bcde") + >>> s.ratio() + 0.75 + >>> s.set_seq2("abcd") + >>> s.ratio() + 1.0 + >>> + + SequenceMatcher computes and caches detailed information about the + second sequence, so if you want to compare one sequence S against + many sequences, use .set_seq2(S) once and call .set_seq1(x) + repeatedly for each of the other sequences. + + See also set_seqs() and set_seq1(). + """ + + if b is self.b: + return + self.b = b + self.matching_blocks = self.opcodes = None + self.fullbcount = None + self.__chain_b() + + # For each element x in b, set b2j[x] to a list of the indices in + # b where x appears; the indices are in increasing order; note that + # the number of times x appears in b is len(b2j[x]) ... + # when self.isjunk is defined, junk elements don't show up in this + # map at all, which stops the central find_longest_match method + # from starting any matching block at a junk element ... + # also creates the fast isbjunk function ... + # note that this is only called when b changes; so for cross-product + # kinds of matches, it's best to call set_seq2 once, then set_seq1 + # repeatedly + + def __chain_b(self): + # Because isjunk is a user-defined (not C) function, and we test + # for junk a LOT, it's important to minimize the number of calls. + # Before the tricks described here, __chain_b was by far the most + # time-consuming routine in the whole module! If anyone sees + # Jim Roskind, thank him again for profile.py -- I never would + # have guessed that. + # The first trick is to build b2j ignoring the possibility + # of junk. I.e., we don't call isjunk at all yet. Throwing + # out the junk later is much cheaper than building b2j "right" + # from the start. + b = self.b + self.b2j = b2j = {} + self.b2jhas = b2jhas = b2j.has_key + for i in xrange(len(b)): + elt = b[i] + if b2jhas(elt): + b2j[elt].append(i) + else: + b2j[elt] = [i] + + # Now b2j.keys() contains elements uniquely, and especially when + # the sequence is a string, that's usually a good deal smaller + # than len(string). The difference is the number of isjunk calls + # saved. + isjunk, junkdict = self.isjunk, {} + if isjunk: + for elt in b2j.keys(): + if isjunk(elt): + junkdict[elt] = 1 # value irrelevant; it's a set + del b2j[elt] + + # Now for x in b, isjunk(x) == junkdict.has_key(x), but the + # latter is much faster. Note too that while there may be a + # lot of junk in the sequence, the number of *unique* junk + # elements is probably small. So the memory burden of keeping + # this dict alive is likely trivial compared to the size of b2j. + self.isbjunk = junkdict.has_key + + def find_longest_match(self, alo, ahi, blo, bhi): + """Find longest matching block in a[alo:ahi] and b[blo:bhi]. + + If isjunk is not defined: + + Return (i,j,k) such that a[i:i+k] is equal to b[j:j+k], where + alo <= i <= i+k <= ahi + blo <= j <= j+k <= bhi + and for all (i',j',k') meeting those conditions, + k >= k' + i <= i' + and if i == i', j <= j' + + In other words, of all maximal matching blocks, return one that + starts earliest in a, and of all those maximal matching blocks that + start earliest in a, return the one that starts earliest in b. + + >>> s = SequenceMatcher(None, " abcd", "abcd abcd") + >>> s.find_longest_match(0, 5, 0, 9) + (0, 4, 5) + + If isjunk is defined, first the longest matching block is + determined as above, but with the additional restriction that no + junk element appears in the block. Then that block is extended as + far as possible by matching (only) junk elements on both sides. So + the resulting block never matches on junk except as identical junk + happens to be adjacent to an "interesting" match. + + Here's the same example as before, but considering blanks to be + junk. That prevents " abcd" from matching the " abcd" at the tail + end of the second sequence directly. Instead only the "abcd" can + match, and matches the leftmost "abcd" in the second sequence: + + >>> s = SequenceMatcher(lambda x: x==" ", " abcd", "abcd abcd") + >>> s.find_longest_match(0, 5, 0, 9) + (1, 0, 4) + + If no blocks match, return (alo, blo, 0). + + >>> s = SequenceMatcher(None, "ab", "c") + >>> s.find_longest_match(0, 2, 0, 1) + (0, 0, 0) + """ + + # CAUTION: stripping common prefix or suffix would be incorrect. + # E.g., + # ab + # acab + # Longest matching block is "ab", but if common prefix is + # stripped, it's "a" (tied with "b"). UNIX(tm) diff does so + # strip, so ends up claiming that ab is changed to acab by + # inserting "ca" in the middle. That's minimal but unintuitive: + # "it's obvious" that someone inserted "ac" at the front. + # Windiff ends up at the same place as diff, but by pairing up + # the unique 'b's and then matching the first two 'a's. + + a, b, b2j, isbjunk = self.a, self.b, self.b2j, self.isbjunk + besti, bestj, bestsize = alo, blo, 0 + # find longest junk-free match + # during an iteration of the loop, j2len[j] = length of longest + # junk-free match ending with a[i-1] and b[j] + j2len = {} + nothing = [] + for i in xrange(alo, ahi): + # look at all instances of a[i] in b; note that because + # b2j has no junk keys, the loop is skipped if a[i] is junk + j2lenget = j2len.get + newj2len = {} + for j in b2j.get(a[i], nothing): + # a[i] matches b[j] + if j < blo: + continue + if j >= bhi: + break + k = newj2len[j] = j2lenget(j-1, 0) + 1 + if k > bestsize: + besti, bestj, bestsize = i-k+1, j-k+1, k + j2len = newj2len + + # Now that we have a wholly interesting match (albeit possibly + # empty!), we may as well suck up the matching junk on each + # side of it too. Can't think of a good reason not to, and it + # saves post-processing the (possibly considerable) expense of + # figuring out what to do with it. In the case of an empty + # interesting match, this is clearly the right thing to do, + # because no other kind of match is possible in the regions. + while besti > alo and bestj > blo and \ + isbjunk(b[bestj-1]) and \ + a[besti-1] == b[bestj-1]: + besti, bestj, bestsize = besti-1, bestj-1, bestsize+1 + while besti+bestsize < ahi and bestj+bestsize < bhi and \ + isbjunk(b[bestj+bestsize]) and \ + a[besti+bestsize] == b[bestj+bestsize]: + bestsize = bestsize + 1 + + if TRACE: + print "get_matching_blocks", alo, ahi, blo, bhi + print " returns", besti, bestj, bestsize + return besti, bestj, bestsize + + def get_matching_blocks(self): + """Return list of triples describing matching subsequences. + + Each triple is of the form (i, j, n), and means that + a[i:i+n] == b[j:j+n]. The triples are monotonically increasing in + i and in j. + + The last triple is a dummy, (len(a), len(b), 0), and is the only + triple with n==0. + + >>> s = SequenceMatcher(None, "abxcd", "abcd") + >>> s.get_matching_blocks() + [(0, 0, 2), (3, 2, 2), (5, 4, 0)] + """ + + if self.matching_blocks is not None: + return self.matching_blocks + self.matching_blocks = [] + la, lb = len(self.a), len(self.b) + self.__helper(0, la, 0, lb, self.matching_blocks) + self.matching_blocks.append( (la, lb, 0) ) + if TRACE: + print '*** matching blocks', self.matching_blocks + return self.matching_blocks + + # builds list of matching blocks covering a[alo:ahi] and + # b[blo:bhi], appending them in increasing order to answer + + def __helper(self, alo, ahi, blo, bhi, answer): + i, j, k = x = self.find_longest_match(alo, ahi, blo, bhi) + # a[alo:i] vs b[blo:j] unknown + # a[i:i+k] same as b[j:j+k] + # a[i+k:ahi] vs b[j+k:bhi] unknown + if k: + if alo < i and blo < j: + self.__helper(alo, i, blo, j, answer) + answer.append(x) + if i+k < ahi and j+k < bhi: + self.__helper(i+k, ahi, j+k, bhi, answer) + + def get_opcodes(self): + """Return list of 5-tuples describing how to turn a into b. + + Each tuple is of the form (tag, i1, i2, j1, j2). The first tuple + has i1 == j1 == 0, and remaining tuples have i1 == the i2 from the + tuple preceding it, and likewise for j1 == the previous j2. + + The tags are strings, with these meanings: + + 'replace': a[i1:i2] should be replaced by b[j1:j2] + 'delete': a[i1:i2] should be deleted. + Note that j1==j2 in this case. + 'insert': b[j1:j2] should be inserted at a[i1:i1]. + Note that i1==i2 in this case. + 'equal': a[i1:i2] == b[j1:j2] + + >>> a = "qabxcd" + >>> b = "abycdf" + >>> s = SequenceMatcher(None, a, b) + >>> for tag, i1, i2, j1, j2 in s.get_opcodes(): + ... print ("%7s a[%d:%d] (%s) b[%d:%d] (%s)" % + ... (tag, i1, i2, a[i1:i2], j1, j2, b[j1:j2])) + delete a[0:1] (q) b[0:0] () + equal a[1:3] (ab) b[0:2] (ab) + replace a[3:4] (x) b[2:3] (y) + equal a[4:6] (cd) b[3:5] (cd) + insert a[6:6] () b[5:6] (f) + """ + + if self.opcodes is not None: + return self.opcodes + i = j = 0 + self.opcodes = answer = [] + for ai, bj, size in self.get_matching_blocks(): + # invariant: we've pumped out correct diffs to change + # a[:i] into b[:j], and the next matching block is + # a[ai:ai+size] == b[bj:bj+size]. So we need to pump + # out a diff to change a[i:ai] into b[j:bj], pump out + # the matching block, and move (i,j) beyond the match + tag = '' + if i < ai and j < bj: + tag = 'replace' + elif i < ai: + tag = 'delete' + elif j < bj: + tag = 'insert' + if tag: + answer.append( (tag, i, ai, j, bj) ) + i, j = ai+size, bj+size + # the list of matching blocks is terminated by a + # sentinel with size 0 + if size: + answer.append( ('equal', ai, i, bj, j) ) + return answer + + def ratio(self): + """Return a measure of the sequences' similarity (float in [0,1]). + + Where T is the total number of elements in both sequences, and + M is the number of matches, this is 2,0*M / T. + Note that this is 1 if the sequences are identical, and 0 if + they have nothing in common. + + .ratio() is expensive to compute if you haven't already computed + .get_matching_blocks() or .get_opcodes(), in which case you may + want to try .quick_ratio() or .real_quick_ratio() first to get an + upper bound. + + >>> s = SequenceMatcher(None, "abcd", "bcde") + >>> s.ratio() + 0.75 + >>> s.quick_ratio() + 0.75 + >>> s.real_quick_ratio() + 1.0 + """ + + matches = reduce(lambda sum, triple: sum + triple[-1], + self.get_matching_blocks(), 0) + return 2.0 * matches / (len(self.a) + len(self.b)) + + def quick_ratio(self): + """Return an upper bound on ratio() relatively quickly. + + This isn't defined beyond that it is an upper bound on .ratio(), and + is faster to compute. + """ + + # viewing a and b as multisets, set matches to the cardinality + # of their intersection; this counts the number of matches + # without regard to order, so is clearly an upper bound + if self.fullbcount is None: + self.fullbcount = fullbcount = {} + for elt in self.b: + fullbcount[elt] = fullbcount.get(elt, 0) + 1 + fullbcount = self.fullbcount + # avail[x] is the number of times x appears in 'b' less the + # number of times we've seen it in 'a' so far ... kinda + avail = {} + availhas, matches = avail.has_key, 0 + for elt in self.a: + if availhas(elt): + numb = avail[elt] + else: + numb = fullbcount.get(elt, 0) + avail[elt] = numb - 1 + if numb > 0: + matches = matches + 1 + return 2.0 * matches / (len(self.a) + len(self.b)) + + def real_quick_ratio(self): + """Return an upper bound on ratio() very quickly. + + This isn't defined beyond that it is an upper bound on .ratio(), and + is faster to compute than either .ratio() or .quick_ratio(). + """ + + la, lb = len(self.a), len(self.b) + # can't have more matches than the number of elements in the + # shorter sequence + return 2.0 * min(la, lb) / (la + lb) + +def get_close_matches(word, possibilities, n=3, cutoff=0.6): + """Use SequenceMatcher to return list of the best "good enough" matches. + + word is a sequence for which close matches are desired (typically a + string). + + possibilities is a list of sequences against which to match word + (typically a list of strings). + + Optional arg n (default 3) is the maximum number of close matches to + return. n must be > 0. + + Optional arg cutoff (default 0.6) is a float in [0, 1]. Possibilities + that don't score at least that similar to word are ignored. + + The best (no more than n) matches among the possibilities are returned + in a list, sorted by similarity score, most similar first. + + >>> get_close_matches("appel", ["ape", "apple", "peach", "puppy"]) + ['apple', 'ape'] + >>> import keyword as _keyword + >>> get_close_matches("wheel", _keyword.kwlist) + ['while'] + >>> get_close_matches("apple", _keyword.kwlist) + [] + >>> get_close_matches("accept", _keyword.kwlist) + ['except'] + """ + + if not n > 0: + raise ValueError("n must be > 0: " + `n`) + if not 0.0 <= cutoff <= 1.0: + raise ValueError("cutoff must be in [0.0, 1.0]: " + `cutoff`) + result = [] + s = SequenceMatcher() + s.set_seq2(word) + for x in possibilities: + s.set_seq1(x) + if s.real_quick_ratio() >= cutoff and \ + s.quick_ratio() >= cutoff and \ + s.ratio() >= cutoff: + result.append((s.ratio(), x)) + # Sort by score. + result.sort() + # Retain only the best n. + result = result[-n:] + # Move best-scorer to head of list. + result.reverse() + # Strip scores. + return [x for score, x in result] + + +def _count_leading(line, ch): + """ + Return number of `ch` characters at the start of `line`. + + Example: + + >>> _count_leading(' abc', ' ') + 3 + """ + + i, n = 0, len(line) + while i < n and line[i] == ch: + i += 1 + return i + +class Differ: + r""" + Differ is a class for comparing sequences of lines of text, and + producing human-readable differences or deltas. Differ uses + SequenceMatcher both to compare sequences of lines, and to compare + sequences of characters within similar (near-matching) lines. + + Each line of a Differ delta begins with a two-letter code: + + '- ' line unique to sequence 1 + '+ ' line unique to sequence 2 + ' ' line common to both sequences + '? ' line not present in either input sequence + + Lines beginning with '? ' attempt to guide the eye to intraline + differences, and were not present in either input sequence. These lines + can be confusing if the sequences contain tab characters. + + Note that Differ makes no claim to produce a *minimal* diff. To the + contrary, minimal diffs are often counter-intuitive, because they synch + up anywhere possible, sometimes accidental matches 100 pages apart. + Restricting synch points to contiguous matches preserves some notion of + locality, at the occasional cost of producing a longer diff. + + Example: Comparing two texts. + + First we set up the texts, sequences of individual single-line strings + ending with newlines (such sequences can also be obtained from the + `readlines()` method of file-like objects): + + >>> text1 = ''' 1. Beautiful is better than ugly. + ... 2. Explicit is better than implicit. + ... 3. Simple is better than complex. + ... 4. Complex is better than complicated. + ... '''.splitlines(1) + >>> len(text1) + 4 + >>> text1[0][-1] + '\n' + >>> text2 = ''' 1. Beautiful is better than ugly. + ... 3. Simple is better than complex. + ... 4. Complicated is better than complex. + ... 5. Flat is better than nested. + ... '''.splitlines(1) + + Next we instantiate a Differ object: + + >>> d = Differ() + + Note that when instantiating a Differ object we may pass functions to + filter out line and character 'junk'. See Differ.__init__ for details. + + Finally, we compare the two: + + >>> result = d.compare(text1, text2) + + 'result' is a list of strings, so let's pretty-print it: + + >>> from pprint import pprint as _pprint + >>> _pprint(result) + [' 1. Beautiful is better than ugly.\n', + '- 2. Explicit is better than implicit.\n', + '- 3. Simple is better than complex.\n', + '+ 3. Simple is better than complex.\n', + '? ++\n', + '- 4. Complex is better than complicated.\n', + '? ^ ---- ^\n', + '+ 4. Complicated is better than complex.\n', + '? ++++ ^ ^\n', + '+ 5. Flat is better than nested.\n'] + + As a single multi-line string it looks like this: + + >>> print ''.join(result), + 1. Beautiful is better than ugly. + - 2. Explicit is better than implicit. + - 3. Simple is better than complex. + + 3. Simple is better than complex. + ? ++ + - 4. Complex is better than complicated. + ? ^ ---- ^ + + 4. Complicated is better than complex. + ? ++++ ^ ^ + + 5. Flat is better than nested. + + Methods: + + __init__(linejunk=None, charjunk=None) + Construct a text differencer, with optional filters. + + compare(a, b) + Compare two sequences of lines; return the resulting delta (list). + """ + + def __init__(self, linejunk=None, charjunk=None): + """ + Construct a text differencer, with optional filters. + + The two optional keyword parameters are for filter functions: + + - `linejunk`: A function that should accept a single string argument, + and return true iff the string is junk. The module-level function + `IS_LINE_JUNK` may be used to filter out lines without visible + characters, except for at most one splat ('#'). + + - `charjunk`: A function that should accept a string of length 1. The + module-level function `IS_CHARACTER_JUNK` may be used to filter out + whitespace characters (a blank or tab; **note**: bad idea to include + newline in this!). + """ + + self.linejunk = linejunk + self.charjunk = charjunk + self.results = [] + + def compare(self, a, b): + r""" + Compare two sequences of lines; return the resulting delta (list). + + Each sequence must contain individual single-line strings ending with + newlines. Such sequences can be obtained from the `readlines()` method + of file-like objects. The list returned is also made up of + newline-terminated strings, ready to be used with the `writelines()` + method of a file-like object. + + Example: + + >>> print ''.join(Differ().compare('one\ntwo\nthree\n'.splitlines(1), + ... 'ore\ntree\nemu\n'.splitlines(1))), + - one + ? ^ + + ore + ? ^ + - two + - three + ? - + + tree + + emu + """ + + cruncher = SequenceMatcher(self.linejunk, a, b) + for tag, alo, ahi, blo, bhi in cruncher.get_opcodes(): + if tag == 'replace': + self._fancy_replace(a, alo, ahi, b, blo, bhi) + elif tag == 'delete': + self._dump('-', a, alo, ahi) + elif tag == 'insert': + self._dump('+', b, blo, bhi) + elif tag == 'equal': + self._dump(' ', a, alo, ahi) + else: + raise ValueError, 'unknown tag ' + `tag` + results = self.results + self.results = [] + return results + + def _dump(self, tag, x, lo, hi): + """Store comparison results for a same-tagged range.""" + for i in xrange(lo, hi): + self.results.append('%s %s' % (tag, x[i])) + + def _plain_replace(self, a, alo, ahi, b, blo, bhi): + assert alo < ahi and blo < bhi + # dump the shorter block first -- reduces the burden on short-term + # memory if the blocks are of very different sizes + if bhi - blo < ahi - alo: + self._dump('+', b, blo, bhi) + self._dump('-', a, alo, ahi) + else: + self._dump('-', a, alo, ahi) + self._dump('+', b, blo, bhi) + + def _fancy_replace(self, a, alo, ahi, b, blo, bhi): + r""" + When replacing one block of lines with another, search the blocks + for *similar* lines; the best-matching pair (if any) is used as a + synch point, and intraline difference marking is done on the + similar pair. Lots of work, but often worth it. + + Example: + + >>> d = Differ() + >>> d._fancy_replace(['abcDefghiJkl\n'], 0, 1, ['abcdefGhijkl\n'], 0, 1) + >>> print ''.join(d.results), + - abcDefghiJkl + ? ^ ^ ^ + + abcdefGhijkl + ? ^ ^ ^ + """ + + if TRACE: + self.results.append('*** _fancy_replace %s %s %s %s\n' + % (alo, ahi, blo, bhi)) + self._dump('>', a, alo, ahi) + self._dump('<', b, blo, bhi) + + # don't synch up unless the lines have a similarity score of at + # least cutoff; best_ratio tracks the best score seen so far + best_ratio, cutoff = 0.74, 0.75 + cruncher = SequenceMatcher(self.charjunk) + eqi, eqj = None, None # 1st indices of equal lines (if any) + + # search for the pair that matches best without being identical + # (identical lines must be junk lines, & we don't want to synch up + # on junk -- unless we have to) + for j in xrange(blo, bhi): + bj = b[j] + cruncher.set_seq2(bj) + for i in xrange(alo, ahi): + ai = a[i] + if ai == bj: + if eqi is None: + eqi, eqj = i, j + continue + cruncher.set_seq1(ai) + # computing similarity is expensive, so use the quick + # upper bounds first -- have seen this speed up messy + # compares by a factor of 3. + # note that ratio() is only expensive to compute the first + # time it's called on a sequence pair; the expensive part + # of the computation is cached by cruncher + if cruncher.real_quick_ratio() > best_ratio and \ + cruncher.quick_ratio() > best_ratio and \ + cruncher.ratio() > best_ratio: + best_ratio, best_i, best_j = cruncher.ratio(), i, j + if best_ratio < cutoff: + # no non-identical "pretty close" pair + if eqi is None: + # no identical pair either -- treat it as a straight replace + self._plain_replace(a, alo, ahi, b, blo, bhi) + return + # no close pair, but an identical pair -- synch up on that + best_i, best_j, best_ratio = eqi, eqj, 1.0 + else: + # there's a close pair, so forget the identical pair (if any) + eqi = None + + # a[best_i] very similar to b[best_j]; eqi is None iff they're not + # identical + if TRACE: + self.results.append('*** best_ratio %s %s %s %s\n' + % (best_ratio, best_i, best_j)) + self._dump('>', a, best_i, best_i+1) + self._dump('<', b, best_j, best_j+1) + + # pump out diffs from before the synch point + self._fancy_helper(a, alo, best_i, b, blo, best_j) + + # do intraline marking on the synch pair + aelt, belt = a[best_i], b[best_j] + if eqi is None: + # pump out a '-', '?', '+', '?' quad for the synched lines + atags = btags = "" + cruncher.set_seqs(aelt, belt) + for tag, ai1, ai2, bj1, bj2 in cruncher.get_opcodes(): + la, lb = ai2 - ai1, bj2 - bj1 + if tag == 'replace': + atags += '^' * la + btags += '^' * lb + elif tag == 'delete': + atags += '-' * la + elif tag == 'insert': + btags += '+' * lb + elif tag == 'equal': + atags += ' ' * la + btags += ' ' * lb + else: + raise ValueError, 'unknown tag ' + `tag` + self._qformat(aelt, belt, atags, btags) + else: + # the synch pair is identical + self.results.append(' ' + aelt) + + # pump out diffs from after the synch point + self._fancy_helper(a, best_i+1, ahi, b, best_j+1, bhi) + + def _fancy_helper(self, a, alo, ahi, b, blo, bhi): + if alo < ahi: + if blo < bhi: + self._fancy_replace(a, alo, ahi, b, blo, bhi) + else: + self._dump('-', a, alo, ahi) + elif blo < bhi: + self._dump('+', b, blo, bhi) + + def _qformat(self, aline, bline, atags, btags): + r""" + Format "?" output and deal with leading tabs. + + Example: + + >>> d = Differ() + >>> d._qformat('\tabcDefghiJkl\n', '\t\tabcdefGhijkl\n', + ... ' ^ ^ ^ ', '+ ^ ^ ^ ') + >>> for line in d.results: print repr(line) + ... + '- \tabcDefghiJkl\n' + '? \t ^ ^ ^\n' + '+ \t\tabcdefGhijkl\n' + '? \t ^ ^ ^\n' + """ + + # Can hurt, but will probably help most of the time. + common = min(_count_leading(aline, "\t"), + _count_leading(bline, "\t")) + common = min(common, _count_leading(atags[:common], " ")) + atags = atags[common:].rstrip() + btags = btags[common:].rstrip() + + self.results.append("- " + aline) + if atags: + self.results.append("? %s%s\n" % ("\t" * common, atags)) + + self.results.append("+ " + bline) + if btags: + self.results.append("? %s%s\n" % ("\t" * common, btags)) + +# With respect to junk, an earlier version of ndiff simply refused to +# *start* a match with a junk element. The result was cases like this: +# before: private Thread currentThread; +# after: private volatile Thread currentThread; +# If you consider whitespace to be junk, the longest contiguous match +# not starting with junk is "e Thread currentThread". So ndiff reported +# that "e volatil" was inserted between the 't' and the 'e' in "private". +# While an accurate view, to people that's absurd. The current version +# looks for matching blocks that are entirely junk-free, then extends the +# longest one of those as far as possible but only with matching junk. +# So now "currentThread" is matched, then extended to suck up the +# preceding blank; then "private" is matched, and extended to suck up the +# following blank; then "Thread" is matched; and finally ndiff reports +# that "volatile " was inserted before "Thread". The only quibble +# remaining is that perhaps it was really the case that " volatile" +# was inserted after "private". I can live with that <wink>. + +import re + +def IS_LINE_JUNK(line, pat=re.compile(r"\s*#?\s*$").match): + r""" + Return 1 for ignorable line: iff `line` is blank or contains a single '#'. + + Examples: + + >>> IS_LINE_JUNK('\n') + 1 + >>> IS_LINE_JUNK(' # \n') + 1 + >>> IS_LINE_JUNK('hello\n') + 0 + """ + + return pat(line) is not None + +def IS_CHARACTER_JUNK(ch, ws=" \t"): + r""" + Return 1 for ignorable character: iff `ch` is a space or tab. + + Examples: + + >>> IS_CHARACTER_JUNK(' ') + 1 + >>> IS_CHARACTER_JUNK('\t') + 1 + >>> IS_CHARACTER_JUNK('\n') + 0 + >>> IS_CHARACTER_JUNK('x') + 0 + """ + + return ch in ws + +del re + +def ndiff(a, b, linejunk=IS_LINE_JUNK, charjunk=IS_CHARACTER_JUNK): + r""" + Compare `a` and `b` (lists of strings); return a `Differ`-style delta. + + Optional keyword parameters `linejunk` and `charjunk` are for filter + functions (or None): + + - linejunk: A function that should accept a single string argument, and + return true iff the string is junk. The default is module-level function + IS_LINE_JUNK, which filters out lines without visible characters, except + for at most one splat ('#'). + + - charjunk: A function that should accept a string of length 1. The + default is module-level function IS_CHARACTER_JUNK, which filters out + whitespace characters (a blank or tab; note: bad idea to include newline + in this!). + + Tools/scripts/ndiff.py is a command-line front-end to this function. + + Example: + + >>> diff = ndiff('one\ntwo\nthree\n'.splitlines(1), + ... 'ore\ntree\nemu\n'.splitlines(1)) + >>> print ''.join(diff), + - one + ? ^ + + ore + ? ^ + - two + - three + ? - + + tree + + emu + """ + return Differ(linejunk, charjunk).compare(a, b) + +def restore(delta, which): + r""" + Return one of the two sequences that generated a delta. + + Given a `delta` produced by `Differ.compare()` or `ndiff()`, extract + lines originating from file 1 or 2 (parameter `which`), stripping off line + prefixes. + + Examples: + + >>> diff = ndiff('one\ntwo\nthree\n'.splitlines(1), + ... 'ore\ntree\nemu\n'.splitlines(1)) + >>> print ''.join(restore(diff, 1)), + one + two + three + >>> print ''.join(restore(diff, 2)), + ore + tree + emu + """ + try: + tag = {1: "- ", 2: "+ "}[int(which)] + except KeyError: + raise ValueError, ('unknown delta choice (must be 1 or 2): %r' + % which) + prefixes = (" ", tag) + results = [] + for line in delta: + if line[:2] in prefixes: + results.append(line[2:]) + return results + +def _test(): + import doctest, difflib + return doctest.testmod(difflib) + +if __name__ == "__main__": + _test() diff --git a/test/test_settings.py b/test/test_settings.py index 9b889378e..3dcbc92d8 100755 --- a/test/test_settings.py +++ b/test/test_settings.py @@ -12,7 +12,7 @@ Tests of runtime settings. import sys import os -import difflib +import docutils_difflib import pprint import warnings import unittest @@ -62,7 +62,7 @@ class ConfigFileTests(unittest.TestCase): 'error_encoding_error_handler': 'strict'}, } - compare = difflib.Differ().compare + compare = docutils_difflib.Differ().compare """Comparison method shared by all tests.""" def setUp(self): -- cgit v1.2.1 From 983913ee91e835b7708ac4672db20068ba2085d4 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Tue, 22 Jun 2004 21:24:21 +0000 Subject: moved functional tests to main tree git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2357 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/README.txt | 110 ++ .../expected/standalone_rst_html4css1.html | 748 ++++++++++++++ test/functional/expected/standalone_rst_latex.tex | 1064 ++++++++++++++++++++ test/functional/input/data/errors.txt | 9 + test/functional/input/data/standard.txt | 476 +++++++++ test/functional/input/data/table_colspan.txt | 15 + test/functional/input/data/table_complex.txt | 21 + test/functional/input/data/table_rowspan.txt | 15 + test/functional/input/standalone_rst_html4css1.txt | 5 + test/functional/input/standalone_rst_latex.txt | 3 + test/functional/output/README.txt | 3 + test/functional/tests/_default.py | 5 + test/functional/tests/standalone_rst_html4css1.py | 8 + test/functional/tests/standalone_rst_latex.py | 8 + test/test_functional.py | 129 +++ 15 files changed, 2619 insertions(+) create mode 100644 test/functional/README.txt create mode 100644 test/functional/expected/standalone_rst_html4css1.html create mode 100644 test/functional/expected/standalone_rst_latex.tex create mode 100644 test/functional/input/data/errors.txt create mode 100644 test/functional/input/data/standard.txt create mode 100644 test/functional/input/data/table_colspan.txt create mode 100644 test/functional/input/data/table_complex.txt create mode 100644 test/functional/input/data/table_rowspan.txt create mode 100644 test/functional/input/standalone_rst_html4css1.txt create mode 100644 test/functional/input/standalone_rst_latex.txt create mode 100644 test/functional/output/README.txt create mode 100644 test/functional/tests/_default.py create mode 100644 test/functional/tests/standalone_rst_html4css1.py create mode 100644 test/functional/tests/standalone_rst_latex.py create mode 100755 test/test_functional.py (limited to 'test') diff --git a/test/functional/README.txt b/test/functional/README.txt new file mode 100644 index 000000000..0a9729cee --- /dev/null +++ b/test/functional/README.txt @@ -0,0 +1,110 @@ +================ +Functional tests +================ + +:Author: Felix Wiemann +:Revision: $Revision$ +:Date: $Date$ +:Copyright: This document has been placed in the public domain. + +(This document should probably be moved to the ``docs/`` directory of +Docutils, as it is real documentation. Maybe we need a file +``docs/dev/testing.txt``?) + +This directory (``functional/``) contains data for functional tests. + +Performing functional tests means testing the Docutils system as a +whole, i.e. blackbox testing. + +.. contents:: + +Directory Structure +=================== + ++ ``functional/`` The main data directory. + + + ``input/`` The input files. + + - ``some_test.txt``, for example. + + + ``output/`` The actual output. + + - ``some_test.html``, for example. + + + ``expected/`` The expected output. + + - ``some_test.html``, for example. + + + ``tests/`` The config files for processing the input files. + + - ``some_test.py``, for example. + + - ``default.py``, the `default configuration file`_. + +The Testing Process +=================== + +When running ``test_functional.py``, all config files in +``functional/some_test.py`` are processed. + +An example of what this means: + +Provided ``functional/tests/some_test.py`` reads like this:: + + # Source and destination file names. + test_source = "some_test.txt" + test_destination = "some_test.html" + + # Keyword parameters passed to publish_file. + reader_name = "standalone" + parser_name = "rst" + writer_name = "html" + settings_overrides['output-encoding': 'utf-8'] + +The two variables ``test_source`` and ``test_destination`` contain the +input file name (relative to ``functional/input/``) and the output +file name (relative to ``functional/output/`` and +``functional/expected/``). Note that the file names can be chosen +arbitrarily. However, the file names in ``functional/output/`` *must* +match the file names in ``functional/expected/``. + +All other variables are passed as keyword arguments to +``docutils.core.publish_file``, so you can set reader, parser, +writer and anything else you want to configure. + +Note that ``settings_overrides`` is already initialized as an empty +dictionary *before* the execution of the config file. This is done in +order to allow subsequent assignments to ``settings_overrides`` in the +`default configuration file`_ and in the actual configuration file. + +Creating New Tests +================== + +In order to create a new test, put the input test file into +``functional/input/``. Then create a config file in +``functional/tests/`` which sets at least input and output file names, +reader, parser and writer. + +Now run ``test_functional.py``. The test will fail, of course, +because you do not have an expected output yet. + +However, an output file will be generated in ``functional/output/``. +Check this output file for validity and correctness. Then copy the +file to ``functional/expected/``. + +If you run ``test_functional.py`` later and the actual output doesn't +match the expected output anymore, the test will fail. + +If this is the case and you made an intentional change, check the +actual output for validity and correctness and copy it to +``functional/expected/``, overwriting the old expected output. + +.. _default configuration file: + +The Default Configuration File +============================== + +The file ``functional/tests/default.py`` contains default settings. +It is executed just before the actual configuration files, which has +the same effect as the contents of ``default.py`` were prepended to +every configuration file. diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html new file mode 100644 index 000000000..1289cb1a5 --- /dev/null +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -0,0 +1,748 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<meta name="generator" content="Docutils 0.3.4: http://docutils.sourceforge.net/" /> +<title>reStructuredText Test Document + + + + + + + + + + + + +

reStructuredText Test Document

+

Examples of Syntax Constructs

+
+++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Author:David Goodger
Address:
+123 Example Street
+Example, EX  Canada
+A1B 2C3
+
+
Contact:goodger@users.sourceforge.net
Author:Me
Author:Myself
Author:I
Organization:humankind
Date:Now, or yesterday. Or maybe even before yesterday.
Status:This is a "work in progress"
Revision:is managed by a version control system.
Version:1
Copyright:This document has been placed in the public domain. You +may do with it as you wish. You may copy, modify, +redistribute, reattribute, sell, buy, rent, lease, +destroy, or improve it, quote it at length, excerpt, +incorporate, collate, fold, staple, or mutilate it, or do +anything else to it that your or anyone else's heart +desires.
field name:This is a generic bibliographic field.
field name 2:

Generic bibliographic fields may contain multiple body elements.

+

Like this.

+
+
+
+

Dedication

+

For Docutils users & co-developers.

+
+
+

Abstract

+

This is a test document, containing at least one example of each +reStructuredText construct.

+
+ + + + +
+

1   Structural Elements

+
+

1.1   Section Title

+

That's it, the text just above this line.

+
+
+

1.2   Transitions

+

Here's a transition:

+
+

It divides the section.

+
+
+
+

2   Body Elements

+
+

2.1   Paragraphs

+

A paragraph.

+
+

2.1.1   Inline Markup

+

Paragraphs contain text and may contain inline markup: emphasis, +strong emphasis, inline literals, standalone hyperlinks +(http://www.python.org), external hyperlinks (Python 5), internal +cross-references (example), external hyperlinks with embedded URIs +(Python web site), footnote references +(manually numbered 1, anonymous auto-numbered 3, labeled +auto-numbered 2, or symbolic *), citation references +([CIT2002]), substitution references (EXAMPLE), and inline +hyperlink targets (see Targets below for a reference back to here). +Character-level inline markup is also possible (although exceedingly +ugly!) in reStructuredText. Problems are indicated by +|problematic| text (generated by processing errors; this one is +intentional).

+

The default role for interpreted text is Title Reference. Here are +some explicit interpreted text roles: a PEP reference (PEP 287); an +RFC reference (RFC 2822); a subscript; a superscript; +and explicit roles for standard inline +markup.

+ +

Let's test wrapping and whitespace significance in inline literals: +This is an example of --inline-literal --text, --including some-- +strangely--hyphenated-words.  Adjust-the-width-of-your-browser-window +to see how the text is wrapped.  -- ---- --------  Now note    the +spacing    between the    words of    this sentence    (words +should    be grouped    in pairs).

+

If the --pep-references option was supplied, there should be a +live link to PEP 258 here.

+
+
+
+

2.2   Bullet Lists

+
    +
  • A bullet list

    +
      +
    • Nested bullet list.
    • +
    • Nested item 2.
    • +
    +
  • +
  • Item 2.

    +

    Paragraph 2 of item 2.

    +
      +
    • Nested bullet list.
    • +
    • Nested item 2.
        +
      • Third level.
      • +
      • Item 2.
      • +
      +
    • +
    • Nested item 3.
    • +
    +
  • +
+
+
+

2.3   Enumerated Lists

+
    +
  1. Arabic numerals.

    +
      +
    1. lower alpha)
        +
      1. (lower roman)
          +
        1. upper alpha.
            +
          1. upper roman)
          2. +
          +
        2. +
        +
      2. +
      +
    2. +
    +
  2. +
  3. Lists that don't start at 1:

    +
      +
    1. Three
    2. +
    3. Four
    4. +
    +
      +
    1. C
    2. +
    3. D
    4. +
    +
      +
    1. iii
    2. +
    3. iv
    4. +
    +
  4. +
+
+
+

2.4   Definition Lists

+
+
Term
+
Definition
+
Term : classifier
+

Definition paragraph 1.

+

Definition paragraph 2.

+
+
Term
+
Definition
+
+
+
+

2.5   Field Lists

+ +++ + + + + + +
what:Field lists map field names to field bodies, like database +records. They are often part of an extension syntax. They are +an unambiguous variant of RFC 2822 fields.
how arg1 arg2:

The field marker is a colon, the field name, and a colon.

+

The field body may contain one or more body elements, indented +relative to the field marker.

+
+
+
+

2.6   Option Lists

+

For listing command-line options:

+ +++ + + + + + + + + + + + + + + + + + + + + + +
+-acommand-line option "a"
+-b fileoptions can have arguments +and long descriptions
+--longoptions can be long also
+--input=filelong options can also have +arguments
+--very-long-option
 

The description can also start on the next line.

+

The description may contain multiple body elements, +regardless of where it starts.

+
+-x, -y, -zMultiple options are an "option group".
+-v, --verboseCommonly-seen: short & long options.
+-1 file, --one=file, --two file
 Multiple options with arguments.
+/VDOS/VMS-style options too
+

There must be at least two spaces between the option and the +description.

+
+
+

2.7   Literal Blocks

+

Literal blocks are indicated with a double-colon ("::") at the end of +the preceding paragraph (over there -->). They can be indented:

+
+if literal_block:
+    text = 'is left as-is'
+    spaces_and_linebreaks = 'are preserved'
+    markup_processing = None
+
+

Or they can be quoted without indentation:

+
+>> Great idea!
+>
+> Why didn't I think of that?
+
+
+
+

2.8   Block Quotes

+

Block quotes consist of indented body elements:

+
+

My theory by A. Elk. Brackets Miss, brackets. This theory goes +as follows and begins now. All brontosauruses are thin at one +end, much much thicker in the middle and then thin again at the +far end. That is my theory, it is mine, and belongs to me and I +own it, and what it is too.

+

—Anne Elk (Miss)

+
+
+
+

2.9   Doctest Blocks

+
+>>> print 'Python-specific usage examples; begun with ">>>"'
+Python-specific usage examples; begun with ">>>"
+>>> print '(cut and pasted from interactive Python sessions)'
+(cut and pasted from interactive Python sessions)
+
+
+
+

2.10   Footnotes

+ + + + + +
[1](1, 2)

A footnote contains body elements, consistently indented by at +least 3 spaces.

+

This is the footnote's second paragraph.

+
+ + + + + +
[2](1, 2) Footnotes may be numbered, either manually (as in 1) or +automatically using a "#"-prefixed label. This footnote has a +label so it can be referred to from multiple places, both as a +footnote reference (2) and as a hyperlink reference +(label).
+ + + + + +
[3]This footnote is numbered automatically and anonymously using a +label of "#" only.
+ + + + + +
[*]Footnotes may also use symbols, specified with a "*" label. +Here's a reference to the next footnote: †.
+ + + + + +
[†]This footnote shows the next symbol in the sequence.
+ + + + + +
[4]Here's an unreferenced footnote, with a reference to a +nonexistent footnote: [5]_.
+
+
+

2.11   Citations

+ + + + + +
[CIT2002](1, 2) Citations are text-labeled footnotes. They may be +rendered separately and differently from footnotes.
+

Here's a reference to the above, [CIT2002], and a [nonexistent]_ +citation.

+
+
+

2.12   Targets

+

This paragraph is pointed to by the explicit "example" target. A +reference can be found under Inline Markup, above. Inline +hyperlink targets are also possible.

+

Section headers are implicit targets, referred to by name. See +Targets, which is a subsection of Body Elements.

+

Explicit external targets are interpolated into references such as +"Python 5".

+

Targets may be indirect and anonymous. Thus this phrase may also +refer to the Targets section.

+

Here's a `hyperlink reference without a target`_, which generates an +error.

+
+

2.12.1   Duplicate Target Names

+

Duplicate names in section headers or other implicit targets will +generate "info" (level-1) system messages. Duplicate names in +explicit targets will generate "warning" (level-2) system messages.

+
+
+

2.12.2   Duplicate Target Names

+

Since there are two "Duplicate Target Names" section headers, we +cannot uniquely refer to either of them by name. If we try to (like +this: `Duplicate Target Names`_), an error is generated.

+
+
+
+

2.13   Directives

+ +

These are just a sample of the many reStructuredText Directives. For +others, please see +http://docutils.sourceforge.net/docs/ref/rst/directives.html.

+
+

2.13.1   Document Parts

+

An example of the "contents" directive can be seen above this section +(a local, untitled table of contents) and at the beginning of the +document (a document-wide table of contents).

+
+
+

2.13.2   Images

+

An image directive (also clickable -- a hyperlink reference):

+

../../../docs/user/rst/images/title.png

+

A figure directive:

+
+

reStructuredText, the markup syntax

+

A figure is an image with a caption and/or a legend:

+
+ ++++ + + + + + + + + + + + +
reRevised, revisited, based on 're' module.
StructuredStructure-enhanced text, structuredtext.
TextWell it is, isn't it?
+

This paragraph is also part of the legend.

+
+
+
+
+

2.13.3   Admonitions

+
+

Attention!

+Directives at large.
+
+

Caution!

+Don't take any wooden nickels.
+
+

!DANGER!

+Mad scientist at work!
+
+

Error

+Does not compute.
+
+

Hint

+It's bigger than a bread box.
+
+

Important

+
    +
  • Wash behind your ears.
  • +
  • Clean up your room.
  • +
  • Call your mother.
  • +
  • Back up your data.
  • +
+
+
+

Note

+This is a note.
+
+

Tip

+15% if the service is good.
+
+

Warning

+Strong prose may provoke extreme mental exertion. +Reader discretion is strongly advised.
+
+

And, by the way...

+

You can make up your own admonition too.

+
+
+
+

2.13.4   Topics, Sidebars, and Rubrics

+ +
+

Topic Title

+

This is a topic.

+
+

This is a rubric

+
+ +
+

2.13.6   Line Blocks

+

Take it away, Eric the Orchestra Leader!

+
+A one, two, a one two three four
+
+Half a bee, philosophically,
+    must, ipso facto, half not be.
+But half the bee has got to be,
+    vis a vis its entity.  D'you see?
+
+But can a bee be said to be
+    or not to be an entire bee,
+        when half the bee is not a bee,
+            due to some ancient injury?
+
+Singing...
+
+
+ +
+
+

2.14   Substitution Definitions

+

An inline image (EXAMPLE) example:

+

(Substitution definitions are not visible in the HTML source.)

+
+
+

2.15   Comments

+

Here's one:

+ +

(View the HTML source to see the comment.)

+
+
+

2.16   Colspanning tables

+

This table has a cell spanning two columns:

+ +++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
InputsOutput
ABA or B
FalseFalseFalse
TrueFalseTrue
FalseTrueTrue
TrueTrueTrue
+
+
+

2.17   Rowspanning tables

+

Here's a table with cells spanning several rows:

+ +++++ + + + + + + + + + + + + + + + + + + +
Header row, column 1 +(header rows optional)Header 2Header 3
body row 1, column 1column 2column 3
body row 2Cells may +span rows.
    +
  • Table cells
  • +
  • contain
  • +
  • body elements.
  • +
+
body row 3
+
+
+

2.18   Complex tables

+

Here's a complex table, which should test all features.

+ ++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Header row, column 1 +(header rows optional)Header 2Header 3Header 4
body row 1, column 1column 2column 3column 4
body row 2Cells may span columns.
body row 3

Cells may +span rows.

+

Paragraph.

+
    +
  • Table cells
  • +
  • contain
  • +
  • body elements.
  • +
+
body row 4
body row 5Cells may also be +empty: --> 
+
+
+
+

3   Error Handling

+

Any errors caught during processing will generate system messages.

+

There should be five messages in the following, auto-generated +section, "Docutils System Messages":

+ +
+
+

Docutils System Messages

+
+

System Message: ERROR/3 (functional/input/data/standard.txt, line 89); backlink

+Undefined substitution referenced: "problematic".
+
+

System Message: ERROR/3 (functional/input/standalone_rst_html4css1.txt, line 281); backlink

+Unknown target name: "5".
+
+

System Message: ERROR/3 (functional/input/data/standard.txt, line 290); backlink

+Unknown target name: "nonexistent".
+
+

System Message: ERROR/3 (functional/input/data/standard.txt, line 315); backlink

+Unknown target name: "hyperlink reference without a target".
+
+

System Message: ERROR/3 (functional/input/data/standard.txt, line 328); backlink

+Duplicate target name, cannot be used as a unique reference: "duplicate target names".
+
+
+ + diff --git a/test/functional/expected/standalone_rst_latex.tex b/test/functional/expected/standalone_rst_latex.tex new file mode 100644 index 000000000..159ffd03f --- /dev/null +++ b/test/functional/expected/standalone_rst_latex.tex @@ -0,0 +1,1064 @@ +\documentclass[10pt,a4paper,english]{article} +\usepackage{babel} +\usepackage{shortvrb} +\usepackage[latin1]{inputenc} +\usepackage{tabularx} +\usepackage{longtable} +\setlength{\extrarowheight}{2pt} +\usepackage{amsmath} +\usepackage{graphicx} +\usepackage{color} +\usepackage{multirow} +\usepackage{ifthen} +\usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref} +\usepackage[DIV12]{typearea} +%% generator Docutils: http://docutils.sourceforge.net/ +\newlength{\admonitionwidth} +\setlength{\admonitionwidth}{0.9\textwidth} +\newlength{\docinfowidth} +\setlength{\docinfowidth}{0.9\textwidth} +\newlength{\locallinewidth} +\newcommand{\optionlistlabel}[1]{\bf #1 \hfill} +\newenvironment{optionlist}[1] +{\begin{list}{} + {\setlength{\labelwidth}{#1} + \setlength{\rightmargin}{1cm} + \setlength{\leftmargin}{\rightmargin} + \addtolength{\leftmargin}{\labelwidth} + \addtolength{\leftmargin}{\labelsep} + \renewcommand{\makelabel}{\optionlistlabel}} +}{\end{list}} +% begin: floats for footnotes tweaking. +\setlength{\floatsep}{0.5em} +\setlength{\textfloatsep}{\fill} +\addtolength{\textfloatsep}{3em} +\renewcommand{\textfraction}{0.5} +\renewcommand{\topfraction}{0.5} +\renewcommand{\bottomfraction}{0.5} +\setcounter{totalnumber}{50} +\setcounter{topnumber}{50} +\setcounter{bottomnumber}{50} +% end floats for footnotes +% some commands, that could be overwritten in the style file. +\newcommand{\rubric}[1]{\subsection*{~\hfill {\it #1} \hfill ~}} +\newcommand{\titlereference}[1]{\textsl{#1}} +% end of "some commands" +\title{reStructuredText Test Document\\ +\large{Examples of Syntax Constructs} +} +\author{} +\date{} +\hypersetup{ +pdftitle={reStructuredText Test Document}, +pdfauthor={David Goodger;Me;Myself;I} +} +\raggedbottom +\begin{document} +\maketitle + +%___________________________________________________________________________ +\begin{center} +\begin{tabularx}{\docinfowidth}{lX} +\textbf{Author}: & + David Goodger \\ +\textbf{Address}: & + {\raggedright +123 Example Street~\\ +Example, EX Canada~\\ +A1B 2C3 } \\ +\textbf{Contact}: & + \href{mailto:goodger@users.sourceforge.net}{goodger@users.sourceforge.net} \\ +\textbf{Author}: & + Me \\ +\textbf{Author}: & + Myself \\ +\textbf{Author}: & + I \\ +\textbf{Organization}: & + humankind \\ +\textbf{Date}: & + Now, or yesterday. Or maybe even \emph{before} yesterday. \\ +\textbf{Status}: & + This is a ``work in progress'' \\ +\textbf{Revision}: & + is managed by a version control system. \\ +\textbf{Version}: & + 1 \\ +\textbf{Copyright}: & + This document has been placed in the public domain. You +may do with it as you wish. You may copy, modify, +redistribute, reattribute, sell, buy, rent, lease, +destroy, or improve it, quote it at length, excerpt, +incorporate, collate, fold, staple, or mutilate it, or do +anything else to it that your or anyone else's heart +desires. \\ +\textbf{field name}: & + This is a generic bibliographic field. \\ +\textbf{field name 2}: & + Generic bibliographic fields may contain multiple body elements. + +Like this. \\ +\end{tabularx} +\end{center} + +\setlength{\locallinewidth}{\linewidth} + + +\subsection*{~\hfill Dedication\hfill ~} + +For Docutils users {\&} co-developers. + +\subsection*{~\hfill Abstract\hfill ~} + +This is a test document, containing at least one example of each +reStructuredText construct. + +% This is a comment. Note how any initial comments are moved by +% transforms to after the document title, subtitle, and docinfo. +% Above is the document title, and below is the subtitle. +% They are transformed from section titles after parsing. +% bibliographic fields (which also require a transform): +\hypertarget{table-of-contents}{} +\pdfbookmark[0]{Table of Contents}{table-of-contents} +\subsection*{~\hfill Table of Contents\hfill ~} +\begin{list}{}{} +\item {} \href{\#structural-elements}{1~~~Structural Elements} +\begin{list}{}{} +\item {} \href{\#section-title}{1.1~~~Section Title} + +\item {} \href{\#transitions}{1.2~~~Transitions} + +\end{list} + +\item {} \href{\#body-elements}{2~~~Body Elements} +\begin{list}{}{} +\item {} \href{\#paragraphs}{2.1~~~Paragraphs} +\begin{list}{}{} +\item {} \href{\#inline-markup}{2.1.1~~~Inline Markup} + +\end{list} + +\item {} \href{\#bullet-lists}{2.2~~~Bullet Lists} + +\item {} \href{\#enumerated-lists}{2.3~~~Enumerated Lists} + +\item {} \href{\#definition-lists}{2.4~~~Definition Lists} + +\item {} \href{\#field-lists}{2.5~~~Field Lists} + +\item {} \href{\#option-lists}{2.6~~~Option Lists} + +\item {} \href{\#literal-blocks}{2.7~~~Literal Blocks} + +\item {} \href{\#block-quotes}{2.8~~~Block Quotes} + +\item {} \href{\#doctest-blocks}{2.9~~~Doctest Blocks} + +\item {} \href{\#footnotes}{2.10~~~Footnotes} + +\item {} \href{\#citations}{2.11~~~Citations} + +\item {} \href{\#targets}{2.12~~~Targets} +\begin{list}{}{} +\item {} \href{\#duplicate-target-names}{2.12.1~~~Duplicate Target Names} + +\item {} \href{\#id18}{2.12.2~~~Duplicate Target Names} + +\end{list} + +\item {} \href{\#directives}{2.13~~~Directives} +\begin{list}{}{} +\item {} \href{\#document-parts}{2.13.1~~~Document Parts} + +\item {} \href{\#images}{2.13.2~~~Images} + +\item {} \href{\#admonitions}{2.13.3~~~Admonitions} + +\item {} \href{\#topics-sidebars-and-rubrics}{2.13.4~~~Topics, Sidebars, and Rubrics} + +\item {} \href{\#target-footnotes}{2.13.5~~~Target Footnotes} + +\item {} \href{\#line-blocks}{2.13.6~~~Line Blocks} + +\item {} \href{\#replacement-text}{2.13.7~~~Replacement Text} + +\end{list} + +\item {} \href{\#substitution-definitions}{2.14~~~Substitution Definitions} + +\item {} \href{\#comments}{2.15~~~Comments} + +\item {} \href{\#colspanning-tables}{2.16~~~Colspanning tables} + +\end{list} + +\item {} \href{\#error-handling}{3~~~Error Handling} + +\end{list} + + + +%___________________________________________________________________________ + +\hypertarget{structural-elements}{} +\pdfbookmark[0]{1~~~Structural Elements}{structural-elements} +\section*{1~~~Structural Elements} + + +%___________________________________________________________________________ + +\hypertarget{section-title}{} +\pdfbookmark[1]{1.1~~~Section Title}{section-title} +\subsection*{1.1~~~Section Title} + +That's it, the text just above this line. + + +%___________________________________________________________________________ + +\hypertarget{transitions}{} +\pdfbookmark[1]{1.2~~~Transitions}{transitions} +\subsection*{1.2~~~Transitions} + +Here's a transition: + + +%___________________________________________________________________________ +\hspace*{\fill}\hrulefill\hspace*{\fill} + + +It divides the section. + + +%___________________________________________________________________________ + +\hypertarget{body-elements}{} +\pdfbookmark[0]{2~~~Body Elements}{body-elements} +\section*{2~~~Body Elements} + + +%___________________________________________________________________________ + +\hypertarget{paragraphs}{} +\pdfbookmark[1]{2.1~~~Paragraphs}{paragraphs} +\subsection*{2.1~~~Paragraphs} + +A paragraph. + + +%___________________________________________________________________________ + +\hypertarget{inline-markup}{} +\pdfbookmark[2]{2.1.1~~~Inline Markup}{inline-markup} +\subsubsection*{2.1.1~~~Inline Markup} + +Paragraphs contain text and may contain inline markup: \emph{emphasis}, +\textbf{strong emphasis}, \texttt{inline literals}, standalone hyperlinks +(\href{http://www.python.org}{http://www.python.org}), external hyperlinks (\href{http://www.python.org/}{Python} [\hyperlink{id21}{5}]), internal +cross-references (\href{\#example}{example}), external hyperlinks with embedded URIs +(\href{http://www.python.org}{Python web site}), footnote references +(manually numbered [\hyperlink{id6}{1}], anonymous auto-numbered [\hyperlink{id9}{3}], labeled +auto-numbered [\hyperlink{label}{2}], or symbolic [\hyperlink{id10}{*}]), citation references +([\hyperlink{cit2002}{CIT2002}]), substitution references (\includegraphics{../../../docs/user/rst/images/biohazard.png}), and \hypertarget{inline-hyperlink-targets}{inline +hyperlink targets} (see \href{\#targets}{Targets} below for a reference back to here). +Character-level inline markup is also possible (although exceedingly +ugly!) in \emph{re}\texttt{Structured}\emph{Text}. Problems are indicated by +{\color{red}\bfseries{}{\textbar}problematic{\textbar}} text (generated by processing errors; this one is +intentional). + +The default role for interpreted text is \titlereference{Title Reference}. Here are +some explicit interpreted text roles: a PEP reference (\href{http://www.python.org/peps/pep-0287.html}{PEP 287}); an +RFC reference (\href{http://www.faqs.org/rfcs/rfc2822.html}{RFC 2822}); a $_{subscript}$; a $^{superscript}$; +and explicit roles for \emph{standard} \textbf{inline} +\texttt{markup}. +% DO NOT RE-WRAP THE FOLLOWING PARAGRAPH! + +Let's test wrapping and whitespace significance in inline literals: +\texttt{This is an example of --inline-literal --text, --including some-- +strangely--hyphenated-words. Adjust-the-width-of-your-browser-window +to see how the text is wrapped. -- ---- -------- Now note the +spacing between the words of this sentence (words +should be grouped in pairs).} + +If the \texttt{--pep-references} option was supplied, there should be a +live link to PEP 258 here. + + +%___________________________________________________________________________ + +\hypertarget{bullet-lists}{} +\pdfbookmark[1]{2.2~~~Bullet Lists}{bullet-lists} +\subsection*{2.2~~~Bullet Lists} +\begin{itemize} +\item {} +A bullet list +\begin{itemize} +\item {} +Nested bullet list. + +\item {} +Nested item 2. + +\end{itemize} + +\item {} +Item 2. + +Paragraph 2 of item 2. +\begin{itemize} +\item {} +Nested bullet list. + +\item {} +Nested item 2. +\begin{itemize} +\item {} +Third level. + +\item {} +Item 2. + +\end{itemize} + +\item {} +Nested item 3. + +\end{itemize} + +\end{itemize} + + +%___________________________________________________________________________ + +\hypertarget{enumerated-lists}{} +\pdfbookmark[1]{2.3~~~Enumerated Lists}{enumerated-lists} +\subsection*{2.3~~~Enumerated Lists} +\newcounter{listcnt1} +\begin{list}{\arabic{listcnt1}.} +{ +\usecounter{listcnt1} +\setlength{\rightmargin}{\leftmargin} +} +\item {} +Arabic numerals. +\newcounter{listcnt2} +\begin{list}{\alph{listcnt2})} +{ +\usecounter{listcnt2} +\setlength{\rightmargin}{\leftmargin} +} +\item {} +lower alpha) +\newcounter{listcnt3} +\begin{list}{(\roman{listcnt3})} +{ +\usecounter{listcnt3} +\setlength{\rightmargin}{\leftmargin} +} +\item {} +(lower roman) +\newcounter{listcnt4} +\begin{list}{\Alph{listcnt4}.} +{ +\usecounter{listcnt4} +\setlength{\rightmargin}{\leftmargin} +} +\item {} +upper alpha. +\newcounter{listcnt5} +\begin{list}{\Roman{listcnt5})} +{ +\usecounter{listcnt5} +\setlength{\rightmargin}{\leftmargin} +} +\item {} +upper roman) + +\end{list} + +\end{list} + +\end{list} + +\end{list} + +\item {} +Lists that don't start at 1: +\newcounter{listcnt6} +\begin{list}{\arabic{listcnt6}.} +{ +\usecounter{listcnt6} +\addtocounter{listcnt6}{2} +\setlength{\rightmargin}{\leftmargin} +} +\item {} +Three + +\item {} +Four + +\end{list} +\newcounter{listcnt7} +\begin{list}{\Alph{listcnt7}.} +{ +\usecounter{listcnt7} +\addtocounter{listcnt7}{2} +\setlength{\rightmargin}{\leftmargin} +} +\item {} +C + +\item {} +D + +\end{list} +\newcounter{listcnt8} +\begin{list}{\roman{listcnt8}.} +{ +\usecounter{listcnt8} +\addtocounter{listcnt8}{2} +\setlength{\rightmargin}{\leftmargin} +} +\item {} +iii + +\item {} +iv + +\end{list} + +\end{list} + + +%___________________________________________________________________________ + +\hypertarget{definition-lists}{} +\pdfbookmark[1]{2.4~~~Definition Lists}{definition-lists} +\subsection*{2.4~~~Definition Lists} +\begin{description} +%[visit_definition_list_item] +\item[Term] +%[visit_definition] + +Definition + +%[depart_definition] +%[depart_definition_list_item] +%[visit_definition_list_item] +\item[Term] +(\textbf{classifier}) +%[visit_definition] + +Definition paragraph 1. + +Definition paragraph 2. + +%[depart_definition] +%[depart_definition_list_item] +%[visit_definition_list_item] +\item[Term] +%[visit_definition] + +Definition + +%[depart_definition] +%[depart_definition_list_item] +\end{description} + + +%___________________________________________________________________________ + +\hypertarget{field-lists}{} +\pdfbookmark[1]{2.5~~~Field Lists}{field-lists} +\subsection*{2.5~~~Field Lists} +\begin{quote} +\begin{description} +\item [what:] +Field lists map field names to field bodies, like database +records. They are often part of an extension syntax. They are +an unambiguous variant of RFC 2822 fields. + + +\item [how arg1 arg2:] +The field marker is a colon, the field name, and a colon. + +The field body may contain one or more body elements, indented +relative to the field marker. + + +\end{description} +\end{quote} + + +%___________________________________________________________________________ + +\hypertarget{option-lists}{} +\pdfbookmark[1]{2.6~~~Option Lists}{option-lists} +\subsection*{2.6~~~Option Lists} + +For listing command-line options: +% [option list] +\begin{optionlist}{3cm} +\item [-a] +command-line option ``a'' +\item [-b file] +options can have arguments +and long descriptions +\item [--long] +options can be long also +\item [--input=file] +long options can also have +arguments +\item [--very-long-option] +The description can also start on the next line. + +The description may contain multiple body elements, +regardless of where it starts. +\item [-x, -y, -z] +Multiple options are an ``option group''. +\item [-v, --verbose] +Commonly-seen: short {\&} long options. +\item [-1 file, --one=file, --two file] +Multiple options with arguments. +\item [/V] +DOS/VMS-style options too +\end{optionlist} + +There must be at least two spaces between the option and the +description. + + +%___________________________________________________________________________ + +\hypertarget{literal-blocks}{} +\pdfbookmark[1]{2.7~~~Literal Blocks}{literal-blocks} +\subsection*{2.7~~~Literal Blocks} + +Literal blocks are indicated with a double-colon (``::'') at the end of +the preceding paragraph (over there \texttt{-->}). They can be indented: +\begin{ttfamily}\begin{flushleft} +if~literal{\underline{~}}block:~\\ +~~~~text~=~'is~left~as-is'~\\ +~~~~spaces{\underline{~}}and{\underline{~}}linebreaks~=~'are~preserved'~\\ +~~~~markup{\underline{~}}processing~=~None +\end{flushleft}\end{ttfamily} + +Or they can be quoted without indentation: +\begin{ttfamily}\begin{flushleft} +>>~Great~idea!~\\ +>~\\ +>~Why~didn't~I~think~of~that? +\end{flushleft}\end{ttfamily} + + +%___________________________________________________________________________ + +\hypertarget{block-quotes}{} +\pdfbookmark[1]{2.8~~~Block Quotes}{block-quotes} +\subsection*{2.8~~~Block Quotes} + +Block quotes consist of indented body elements: +\begin{quote} + +My theory by A. Elk. Brackets Miss, brackets. This theory goes +as follows and begins now. All brontosauruses are thin at one +end, much much thicker in the middle and then thin again at the +far end. That is my theory, it is mine, and belongs to me and I +own it, and what it is too. + +\begin{flushright} +---Anne Elk (Miss) +\end{flushright} +\end{quote} + + +%___________________________________________________________________________ + +\hypertarget{doctest-blocks}{} +\pdfbookmark[1]{2.9~~~Doctest Blocks}{doctest-blocks} +\subsection*{2.9~~~Doctest Blocks} +\begin{verbatim}>>> print 'Python-specific usage examples; begun with ">>>"' +Python-specific usage examples; begun with ">>>" +>>> print '(cut and pasted from interactive Python sessions)' +(cut and pasted from interactive Python sessions)\end{verbatim} + + +%___________________________________________________________________________ + +\hypertarget{footnotes}{} +\pdfbookmark[1]{2.10~~~Footnotes}{footnotes} +\subsection*{2.10~~~Footnotes} +\begin{figure}[b]\hypertarget{id6}[1] +A footnote contains body elements, consistently indented by at +least 3 spaces. + +This is the footnote's second paragraph. +\end{figure} +\begin{figure}[b]\hypertarget{label}[2] +Footnotes may be numbered, either manually (as in [\hyperlink{id6}{1}]) or +automatically using a ``{\#}''-prefixed label. This footnote has a +label so it can be referred to from multiple places, both as a +footnote reference ([\hyperlink{label}{2}]) and as a hyperlink reference +(\href{\#label}{label}). +\end{figure} +\begin{figure}[b]\hypertarget{id9}[3] +This footnote is numbered automatically and anonymously using a +label of ``{\#}'' only. +\end{figure} +\begin{figure}[b]\hypertarget{id10}[*] +Footnotes may also use symbols, specified with a ``*'' label. +Here's a reference to the next footnote: [\hyperlink{id12}{{\dag}}]. +\end{figure} +\begin{figure}[b]\hypertarget{id12}[{\dag}] +This footnote shows the next symbol in the sequence. +\end{figure} +\begin{figure}[b]\hypertarget{id13}[4] +Here's an unreferenced footnote, with a reference to a +nonexistent footnote: {\color{red}\bfseries{}{[}5]{\_}}. +\end{figure} + + +%___________________________________________________________________________ + +\hypertarget{citations}{} +\pdfbookmark[1]{2.11~~~Citations}{citations} +\subsection*{2.11~~~Citations} +\begin{figure}[b]\hypertarget{cit2002}[CIT2002] +Citations are text-labeled footnotes. They may be +rendered separately and differently from footnotes. +\end{figure} + +Here's a reference to the above, [\hyperlink{cit2002}{CIT2002}], and a {\color{red}\bfseries{}{[}nonexistent]{\_}} +citation. + + +%___________________________________________________________________________ + +\hypertarget{targets}{} +\pdfbookmark[1]{2.12~~~Targets}{targets} +\subsection*{2.12~~~Targets} +\hypertarget{example}{} +This paragraph is pointed to by the explicit ``example'' target. A +reference can be found under \href{\#inline-markup}{Inline Markup}, above. \href{\#inline-hyperlink-targets}{Inline +hyperlink targets} are also possible. + +Section headers are implicit targets, referred to by name. See +\href{\#targets}{Targets}, which is a subsection of \href{\#body-elements}{Body Elements}. + +Explicit external targets are interpolated into references such as +``\href{http://www.python.org/}{Python} [\hyperlink{id21}{5}]''. + +Targets may be indirect and anonymous. Thus \href{\#targets}{this phrase} may also +refer to the \href{\#targets}{Targets} section. + +Here's a {\color{red}\bfseries{}`hyperlink reference without a target`{\_}}, which generates an +error. + + +%___________________________________________________________________________ + +\hypertarget{duplicate-target-names}{} +\pdfbookmark[2]{2.12.1~~~Duplicate Target Names}{duplicate-target-names} +\subsubsection*{2.12.1~~~Duplicate Target Names} + +Duplicate names in section headers or other implicit targets will +generate ``info'' (level-1) system messages. Duplicate names in +explicit targets will generate ``warning'' (level-2) system messages. + + +%___________________________________________________________________________ + +\hypertarget{id18}{} +\pdfbookmark[2]{2.12.2~~~Duplicate Target Names}{id18} +\subsubsection*{2.12.2~~~Duplicate Target Names} + +Since there are two ``Duplicate Target Names'' section headers, we +cannot uniquely refer to either of them by name. If we try to (like +this: {\color{red}\bfseries{}`Duplicate Target Names`{\_}}), an error is generated. + + +%___________________________________________________________________________ + +\hypertarget{directives}{} +\pdfbookmark[1]{2.13~~~Directives}{directives} +\subsection*{2.13~~~Directives} +\begin{list}{}{} +\item {} \href{\#document-parts}{2.13.1~~~Document Parts} + +\item {} \href{\#images}{2.13.2~~~Images} + +\item {} \href{\#admonitions}{2.13.3~~~Admonitions} + +\item {} \href{\#topics-sidebars-and-rubrics}{2.13.4~~~Topics, Sidebars, and Rubrics} + +\item {} \href{\#target-footnotes}{2.13.5~~~Target Footnotes} + +\item {} \href{\#line-blocks}{2.13.6~~~Line Blocks} + +\item {} \href{\#replacement-text}{2.13.7~~~Replacement Text} + +\end{list} + + +These are just a sample of the many reStructuredText Directives. For +others, please see +\href{http://docutils.sourceforge.net/docs/ref/rst/directives.html}{http://docutils.sourceforge.net/docs/ref/rst/directives.html}. + + +%___________________________________________________________________________ + +\hypertarget{document-parts}{} +\pdfbookmark[2]{2.13.1~~~Document Parts}{document-parts} +\subsubsection*{2.13.1~~~Document Parts} + +An example of the ``contents'' directive can be seen above this section +(a local, untitled table of \href{\#contents}{contents}) and at the beginning of the +document (a document-wide \href{\#table-of-contents}{table of contents}). + + +%___________________________________________________________________________ + +\hypertarget{images}{} +\pdfbookmark[2]{2.13.2~~~Images}{images} +\subsubsection*{2.13.2~~~Images} + +An image directive (also clickable -- a hyperlink reference): +\href{\#directives}{\includegraphics{../../../docs/user/rst/images/title.png}} +A figure directive: +\begin{figure}[htbp]\begin{center} + +\includegraphics{../../../docs/user/rst/images/title.png} +\caption{A figure is an image with a caption and/or a legend:}{\small +\begin{longtable}[c]{|p{0.16\locallinewidth}|p{0.56\locallinewidth}|} +\hline + +re + & +Revised, revisited, based on 're' module. + \\ +\hline + +Structured + & +Structure-enhanced text, structuredtext. + \\ +\hline + +Text + & +Well it is, isn't it? + \\ +\hline +\end{longtable} + +This paragraph is also part of the legend. +}\end{center}\end{figure} + + +%___________________________________________________________________________ + +\hypertarget{admonitions}{} +\pdfbookmark[2]{2.13.3~~~Admonitions}{admonitions} +\subsubsection*{2.13.3~~~Admonitions} +\begin{center}\begin{sffamily} +\fbox{\parbox{\admonitionwidth}{ +\textbf{\large Attention!} +\vspace{2mm} + +Directives at large. +}} +\end{sffamily} +\end{center} +\begin{center}\begin{sffamily} +\fbox{\parbox{\admonitionwidth}{ +\textbf{\large Caution!} +\vspace{2mm} + +Don't take any wooden nickels. +}} +\end{sffamily} +\end{center} +\begin{center}\begin{sffamily} +\fbox{\parbox{\admonitionwidth}{ +\textbf{\large !DANGER!} +\vspace{2mm} + +Mad scientist at work! +}} +\end{sffamily} +\end{center} +\begin{center}\begin{sffamily} +\fbox{\parbox{\admonitionwidth}{ +\textbf{\large Error} +\vspace{2mm} + +Does not compute. +}} +\end{sffamily} +\end{center} +\begin{center}\begin{sffamily} +\fbox{\parbox{\admonitionwidth}{ +\textbf{\large Hint} +\vspace{2mm} + +It's bigger than a bread box. +}} +\end{sffamily} +\end{center} +\begin{center}\begin{sffamily} +\fbox{\parbox{\admonitionwidth}{ +\textbf{\large Important} +\vspace{2mm} +\begin{itemize} +\item {} +Wash behind your ears. + +\item {} +Clean up your room. + +\item {} +Call your mother. + +\item {} +Back up your data. + +\end{itemize} +}} +\end{sffamily} +\end{center} +\begin{center}\begin{sffamily} +\fbox{\parbox{\admonitionwidth}{ +\textbf{\large Note} +\vspace{2mm} + +This is a note. +}} +\end{sffamily} +\end{center} +\begin{center}\begin{sffamily} +\fbox{\parbox{\admonitionwidth}{ +\textbf{\large Tip} +\vspace{2mm} + +15{\%} if the service is good. +}} +\end{sffamily} +\end{center} +\begin{center}\begin{sffamily} +\fbox{\parbox{\admonitionwidth}{ +\textbf{\large Warning} +\vspace{2mm} + +Strong prose may provoke extreme mental exertion. +Reader discretion is strongly advised. +}} +\end{sffamily} +\end{center} +\begin{center}\begin{sffamily} +\fbox{\parbox{\admonitionwidth}{ +\vspace{2mm} +\textbf{\large And, by the way...} +\smallskip + +You can make up your own admonition too. +}} +\end{sffamily} +\end{center} + + +%___________________________________________________________________________ + +\hypertarget{topics-sidebars-and-rubrics}{} +\pdfbookmark[2]{2.13.4~~~Topics, Sidebars, and Rubrics}{topics-sidebars-and-rubrics} +\subsubsection*{2.13.4~~~Topics, Sidebars, and Rubrics} + +\setlength{\locallinewidth}{0.9\admonitionwidth} +\begin{center}\begin{sffamily} +\fbox{\colorbox[gray]{0.80}{\parbox{\admonitionwidth}{ +\textbf{\large Sidebar Title} +\smallskip +~\\ +\textbf{Optional Subtitle} +\smallskip + +This is a sidebar. It is for text outside the flow of the main +text. +\rubric{This is a rubric inside a sidebar} + +Sidebars often appears beside the main text with a border and +background color. +}}} +\end{sffamily} +\end{center} + +\setlength{\locallinewidth}{\linewidth} +\subsection*{~\hfill Topic Title\hfill ~} + +This is a topic. + +\rubric{This is a rubric} + + +%___________________________________________________________________________ + +\hypertarget{target-footnotes}{} +\pdfbookmark[2]{2.13.5~~~Target Footnotes}{target-footnotes} +\subsubsection*{2.13.5~~~Target Footnotes} +\begin{figure}[b]\hypertarget{id21}[5] +\href{http://www.python.org/}{http://www.python.org/} +\end{figure} + + +%___________________________________________________________________________ + +\hypertarget{line-blocks}{} +\pdfbookmark[2]{2.13.6~~~Line Blocks}{line-blocks} +\subsubsection*{2.13.6~~~Line Blocks} + +Take it away, Eric the Orchestra Leader! +\begin{flushleft} +A~one,~two,~a~one~two~three~four~\\ +~\\ +Half~a~bee,~philosophically,~\\ +~~~~must,~\emph{ipso~facto},~half~not~be.~\\ +But~half~the~bee~has~got~to~be,~\\ +~~~~\emph{vis~a~vis}~its~entity.~~D'you~see?~\\ +~\\ +But~can~a~bee~be~said~to~be~\\ +~~~~or~not~to~be~an~entire~bee,~\\ +~~~~~~~~when~half~the~bee~is~not~a~bee,~\\ +~~~~~~~~~~~~due~to~some~ancient~injury?~\\ +~\\ +Singing... +\end{flushleft} + + +%___________________________________________________________________________ + +\hypertarget{replacement-text}{} +\pdfbookmark[2]{2.13.7~~~Replacement Text}{replacement-text} +\subsubsection*{2.13.7~~~Replacement Text} + +I recommend you try \href{http://www.python.org/}{Python, \emph{the} best language around} [\hyperlink{id21}{5}]. + + +%___________________________________________________________________________ + +\hypertarget{substitution-definitions}{} +\pdfbookmark[1]{2.14~~~Substitution Definitions}{substitution-definitions} +\subsection*{2.14~~~Substitution Definitions} + +An inline image (\includegraphics{../../../docs/user/rst/images/biohazard.png}) example: + +(Substitution definitions are not visible in the HTML source.) + + +%___________________________________________________________________________ + +\hypertarget{comments}{} +\pdfbookmark[1]{2.15~~~Comments}{comments} +\subsection*{2.15~~~Comments} + +Here's one: +% Comments begin with two dots and a space. Anything may +% follow, except for the syntax of footnotes, hyperlink +% targets, directives, or substitution definitions. +% +% Double-dashes -- "--" -- must be escaped somehow in HTML output. + +(View the HTML source to see the comment.) + + +%___________________________________________________________________________ + +\hypertarget{colspanning-tables}{} +\pdfbookmark[1]{2.16~~~Colspanning tables}{colspanning-tables} +\subsection*{2.16~~~Colspanning tables} + +This table has a cell spanning two columns: + +\begin{longtable}[c]{|p{0.07\locallinewidth}|p{0.07\locallinewidth}|p{0.09\locallinewidth}|} +\hline +\multicolumn{2}{|l|}{\textbf{ +Inputs +}} & \textbf{ +Output +} \\ +\hline +\textbf{ +A +} & \textbf{ +B +} & \textbf{ +A or B +} \\ +\hline +\endhead + +False + & +False + & +False + \\ +\hline + +True + & +False + & +True + \\ +\hline + +False + & +True + & +True + \\ +\hline + +True + & +True + & +True + \\ +\hline +\end{longtable} + + +%___________________________________________________________________________ + +\hypertarget{error-handling}{} +\pdfbookmark[0]{3~~~Error Handling}{error-handling} +\section*{3~~~Error Handling} + +Any errors caught during processing will generate system messages. + +There should be five messages in the following, auto-generated +section, ``Docutils System Messages'': +% section should be added by Docutils automatically + + +%___________________________________________________________________________ + +\section*{Docutils System Messages} + +Undefined substitution referenced: ``problematic''. + + +Unknown target name: ``5''. + + +Unknown target name: ``nonexistent''. + + +Unknown target name: ``hyperlink reference without a target''. + + +Duplicate target name, cannot be used as a unique reference: ``duplicate target names''. + + +\end{document} diff --git a/test/functional/input/data/errors.txt b/test/functional/input/data/errors.txt new file mode 100644 index 000000000..557f479d3 --- /dev/null +++ b/test/functional/input/data/errors.txt @@ -0,0 +1,9 @@ +Error Handling +============== + +Any errors caught during processing will generate system messages. + +There should be five messages in the following, auto-generated +section, "Docutils System Messages": + +.. section should be added by Docutils automatically diff --git a/test/functional/input/data/standard.txt b/test/functional/input/data/standard.txt new file mode 100644 index 000000000..bf4d562f9 --- /dev/null +++ b/test/functional/input/data/standard.txt @@ -0,0 +1,476 @@ +.. This is a comment. Note how any initial comments are moved by + transforms to after the document title, subtitle, and docinfo. + +================================ + reStructuredText Test Document +================================ + +.. Above is the document title, and below is the subtitle. + They are transformed from section titles after parsing. + +-------------------------------- + Examples of Syntax Constructs +-------------------------------- + +.. bibliographic fields (which also require a transform): + +:Author: David Goodger +:Address: 123 Example Street + Example, EX Canada + A1B 2C3 +:Contact: goodger@users.sourceforge.net +:Authors: Me; Myself; I +:organization: humankind +:date: Now, or yesterday. Or maybe even *before* yesterday. +:status: This is a "work in progress" +:revision: is managed by a version control system. +:version: 1 +:copyright: This document has been placed in the public domain. You + may do with it as you wish. You may copy, modify, + redistribute, reattribute, sell, buy, rent, lease, + destroy, or improve it, quote it at length, excerpt, + incorporate, collate, fold, staple, or mutilate it, or do + anything else to it that your or anyone else's heart + desires. +:field name: This is a generic bibliographic field. +:field name 2: + Generic bibliographic fields may contain multiple body elements. + + Like this. + +:Dedication: + + For Docutils users & co-developers. + +:abstract: + + This is a test document, containing at least one example of each + reStructuredText construct. + +.. meta:: + :keywords: reStructuredText, test, parser + :description lang=en: A test document, containing at least one + example of each reStructuredText construct. + +.. contents:: Table of Contents +.. section-numbering:: + + +Structural Elements +=================== + +Section Title +------------- + +That's it, the text just above this line. + +Transitions +----------- + +Here's a transition: + +--------- + +It divides the section. + +Body Elements +============= + +Paragraphs +---------- + +A paragraph. + +Inline Markup +````````````` + +Paragraphs contain text and may contain inline markup: *emphasis*, +**strong emphasis**, ``inline literals``, standalone hyperlinks +(http://www.python.org), external hyperlinks (Python_), internal +cross-references (example_), external hyperlinks with embedded URIs +(`Python web site `__), footnote references +(manually numbered [1]_, anonymous auto-numbered [#]_, labeled +auto-numbered [#label]_, or symbolic [*]_), citation references +([CIT2002]_), substitution references (|example|), and _`inline +hyperlink targets` (see Targets_ below for a reference back to here). +Character-level inline markup is also possible (although exceedingly +ugly!) in *re*\ ``Structured``\ *Text*. Problems are indicated by +|problematic| text (generated by processing errors; this one is +intentional). + +The default role for interpreted text is `Title Reference`. Here are +some explicit interpreted text roles: a PEP reference (:PEP:`287`); an +RFC reference (:RFC:`2822`); a :sub:`subscript`; a :sup:`superscript`; +and explicit roles for :emphasis:`standard` :strong:`inline` +:literal:`markup`. + +.. DO NOT RE-WRAP THE FOLLOWING PARAGRAPH! + +Let's test wrapping and whitespace significance in inline literals: +``This is an example of --inline-literal --text, --including some-- +strangely--hyphenated-words. Adjust-the-width-of-your-browser-window +to see how the text is wrapped. -- ---- -------- Now note the +spacing between the words of this sentence (words +should be grouped in pairs).`` + +If the ``--pep-references`` option was supplied, there should be a +live link to PEP 258 here. + +Bullet Lists +------------ + +- A bullet list + + + Nested bullet list. + + Nested item 2. + +- Item 2. + + Paragraph 2 of item 2. + + * Nested bullet list. + * Nested item 2. + + - Third level. + - Item 2. + + * Nested item 3. + +Enumerated Lists +---------------- + +1. Arabic numerals. + + a) lower alpha) + + (i) (lower roman) + + A. upper alpha. + + I) upper roman) + +2. Lists that don't start at 1: + + 3. Three + + 4. Four + + C. C + + D. D + + iii. iii + + iv. iv + +Definition Lists +---------------- + +Term + Definition +Term : classifier + Definition paragraph 1. + + Definition paragraph 2. +Term + Definition + +Field Lists +----------- + +:what: Field lists map field names to field bodies, like database + records. They are often part of an extension syntax. They are + an unambiguous variant of RFC 2822 fields. + +:how arg1 arg2: + + The field marker is a colon, the field name, and a colon. + + The field body may contain one or more body elements, indented + relative to the field marker. + +Option Lists +------------ + +For listing command-line options: + +-a command-line option "a" +-b file options can have arguments + and long descriptions +--long options can be long also +--input=file long options can also have + arguments + +--very-long-option + The description can also start on the next line. + + The description may contain multiple body elements, + regardless of where it starts. + +-x, -y, -z Multiple options are an "option group". +-v, --verbose Commonly-seen: short & long options. +-1 file, --one=file, --two file + Multiple options with arguments. +/V DOS/VMS-style options too + +There must be at least two spaces between the option and the +description. + +Literal Blocks +-------------- + +Literal blocks are indicated with a double-colon ("::") at the end of +the preceding paragraph (over there ``-->``). They can be indented:: + + if literal_block: + text = 'is left as-is' + spaces_and_linebreaks = 'are preserved' + markup_processing = None + +Or they can be quoted without indentation:: + +>> Great idea! +> +> Why didn't I think of that? + +Block Quotes +------------ + +Block quotes consist of indented body elements: + + My theory by A. Elk. Brackets Miss, brackets. This theory goes + as follows and begins now. All brontosauruses are thin at one + end, much much thicker in the middle and then thin again at the + far end. That is my theory, it is mine, and belongs to me and I + own it, and what it is too. + + -- Anne Elk (Miss) + +Doctest Blocks +-------------- + +>>> print 'Python-specific usage examples; begun with ">>>"' +Python-specific usage examples; begun with ">>>" +>>> print '(cut and pasted from interactive Python sessions)' +(cut and pasted from interactive Python sessions) + +Footnotes +--------- + +.. [1] A footnote contains body elements, consistently indented by at + least 3 spaces. + + This is the footnote's second paragraph. + +.. [#label] Footnotes may be numbered, either manually (as in [1]_) or + automatically using a "#"-prefixed label. This footnote has a + label so it can be referred to from multiple places, both as a + footnote reference ([#label]_) and as a hyperlink reference + (label_). + +.. [#] This footnote is numbered automatically and anonymously using a + label of "#" only. + +.. [*] Footnotes may also use symbols, specified with a "*" label. + Here's a reference to the next footnote: [*]_. + +.. [*] This footnote shows the next symbol in the sequence. + +.. [4] Here's an unreferenced footnote, with a reference to a + nonexistent footnote: [5]_. + +Citations +--------- + +.. [CIT2002] Citations are text-labeled footnotes. They may be + rendered separately and differently from footnotes. + +Here's a reference to the above, [CIT2002]_, and a [nonexistent]_ +citation. + +Targets +------- + +.. _example: + +This paragraph is pointed to by the explicit "example" target. A +reference can be found under `Inline Markup`_, above. `Inline +hyperlink targets`_ are also possible. + +Section headers are implicit targets, referred to by name. See +Targets_, which is a subsection of `Body Elements`_. + +Explicit external targets are interpolated into references such as +"Python_". + +.. _Python: http://www.python.org/ + +Targets may be indirect and anonymous. Thus `this phrase`__ may also +refer to the Targets_ section. + +__ Targets_ + +Here's a `hyperlink reference without a target`_, which generates an +error. + +Duplicate Target Names +`````````````````````` + +Duplicate names in section headers or other implicit targets will +generate "info" (level-1) system messages. Duplicate names in +explicit targets will generate "warning" (level-2) system messages. + +Duplicate Target Names +`````````````````````` + +Since there are two "Duplicate Target Names" section headers, we +cannot uniquely refer to either of them by name. If we try to (like +this: `Duplicate Target Names`_), an error is generated. + +Directives +---------- + +.. contents:: :local: + +These are just a sample of the many reStructuredText Directives. For +others, please see +http://docutils.sourceforge.net/docs/ref/rst/directives.html. + +Document Parts +`````````````` + +An example of the "contents" directive can be seen above this section +(a local, untitled table of contents_) and at the beginning of the +document (a document-wide `table of contents`_). + +Images +`````` + +An image directive (also clickable -- a hyperlink reference): + +.. image:: ../../../docs/user/rst/images/title.png + :target: directives_ + +A figure directive: + +.. figure:: ../../../docs/user/rst/images/title.png + :alt: reStructuredText, the markup syntax + + A figure is an image with a caption and/or a legend: + + +------------+-----------------------------------------------+ + | re | Revised, revisited, based on 're' module. | + +------------+-----------------------------------------------+ + | Structured | Structure-enhanced text, structuredtext. | + +------------+-----------------------------------------------+ + | Text | Well it is, isn't it? | + +------------+-----------------------------------------------+ + + This paragraph is also part of the legend. + +Admonitions +``````````` + +.. Attention:: Directives at large. + +.. Caution:: + + Don't take any wooden nickels. + +.. DANGER:: Mad scientist at work! + +.. Error:: Does not compute. + +.. Hint:: It's bigger than a bread box. + +.. Important:: + - Wash behind your ears. + - Clean up your room. + - Call your mother. + - Back up your data. + +.. Note:: This is a note. + +.. Tip:: 15% if the service is good. + +.. WARNING:: Strong prose may provoke extreme mental exertion. + Reader discretion is strongly advised. + +.. admonition:: And, by the way... + + You can make up your own admonition too. + +Topics, Sidebars, and Rubrics +````````````````````````````` + +.. sidebar:: Sidebar Title + :subtitle: Optional Subtitle + + This is a sidebar. It is for text outside the flow of the main + text. + + .. rubric:: This is a rubric inside a sidebar + + Sidebars often appears beside the main text with a border and + background color. + +.. topic:: Topic Title + + This is a topic. + +.. rubric:: This is a rubric + +Target Footnotes +```````````````` + +.. target-notes:: + +Line Blocks +``````````` + +Take it away, Eric the Orchestra Leader! + +.. line-block:: + + A one, two, a one two three four + + Half a bee, philosophically, + must, *ipso facto*, half not be. + But half the bee has got to be, + *vis a vis* its entity. D'you see? + + But can a bee be said to be + or not to be an entire bee, + when half the bee is not a bee, + due to some ancient injury? + + Singing... + +Replacement Text +```````````````` + +I recommend you try |Python|_. + +.. |Python| replace:: Python, *the* best language around + +Substitution Definitions +------------------------ + +An inline image (|example|) example: + +.. |EXAMPLE| image:: ../../../docs/user/rst/images/biohazard.png + +(Substitution definitions are not visible in the HTML source.) + +Comments +-------- + +Here's one: + +.. Comments begin with two dots and a space. Anything may + follow, except for the syntax of footnotes, hyperlink + targets, directives, or substitution definitions. + + Double-dashes -- "--" -- must be escaped somehow in HTML output. + +(View the HTML source to see the comment.) diff --git a/test/functional/input/data/table_colspan.txt b/test/functional/input/data/table_colspan.txt new file mode 100644 index 000000000..54294fdd2 --- /dev/null +++ b/test/functional/input/data/table_colspan.txt @@ -0,0 +1,15 @@ +Colspanning tables +------------------ + +This table has a cell spanning two columns: + +===== ===== ====== + Inputs Output +------------ ------ + A B A or B +===== ===== ====== +False False False +True False True +False True True +True True True +===== ===== ====== diff --git a/test/functional/input/data/table_complex.txt b/test/functional/input/data/table_complex.txt new file mode 100644 index 000000000..8ff37180e --- /dev/null +++ b/test/functional/input/data/table_complex.txt @@ -0,0 +1,21 @@ +Complex tables +-------------- + +Here's a complex table, which should test all features. + ++------------------------+------------+----------+----------+ +| Header row, column 1 | Header 2 | Header 3 | Header 4 | +| (header rows optional) | | | | ++========================+============+==========+==========+ +| body row 1, column 1 | column 2 | column 3 | column 4 | ++------------------------+------------+----------+----------+ +| body row 2 | Cells may span columns. | ++------------------------+------------+---------------------+ +| body row 3 | Cells may | - Table cells | ++------------------------+ span rows. | - contain | +| body row 4 | | - body elements. | +| | Paragraph. | | ++------------------------+------------+----------+----------+ +| body row 5 | Cells may also be | | +| | empty: ``-->`` | | ++------------------------+-----------------------+----------+ diff --git a/test/functional/input/data/table_rowspan.txt b/test/functional/input/data/table_rowspan.txt new file mode 100644 index 000000000..0ccb0f71d --- /dev/null +++ b/test/functional/input/data/table_rowspan.txt @@ -0,0 +1,15 @@ +Rowspanning tables +------------------ + +Here's a table with cells spanning several rows: + ++------------------------+------------+------------------+ +| Header row, column 1 | Header 2 | Header 3 | +| (header rows optional) | | | ++========================+============+==================+ +| body row 1, column 1 | column 2 | column 3 | ++------------------------+------------+------------------+ +| body row 2 | Cells may | - Table cells | ++------------------------+ span rows. | - contain | +| body row 3 | | - body elements. | ++------------------------+------------+------------------+ diff --git a/test/functional/input/standalone_rst_html4css1.txt b/test/functional/input/standalone_rst_html4css1.txt new file mode 100644 index 000000000..68f9de864 --- /dev/null +++ b/test/functional/input/standalone_rst_html4css1.txt @@ -0,0 +1,5 @@ +.. include:: data/standard.txt +.. include:: data/table_colspan.txt +.. include:: data/table_rowspan.txt +.. include:: data/table_complex.txt +.. include:: data/errors.txt diff --git a/test/functional/input/standalone_rst_latex.txt b/test/functional/input/standalone_rst_latex.txt new file mode 100644 index 000000000..1d78c0b7b --- /dev/null +++ b/test/functional/input/standalone_rst_latex.txt @@ -0,0 +1,3 @@ +.. include:: data/standard.txt +.. include:: data/table_colspan.txt +.. include:: data/errors.txt diff --git a/test/functional/output/README.txt b/test/functional/output/README.txt new file mode 100644 index 000000000..ce6dc9861 --- /dev/null +++ b/test/functional/output/README.txt @@ -0,0 +1,3 @@ +This is the directory where the actual output is stored. + +This README.txt is just a placeholder to make CVS create the directory. diff --git a/test/functional/tests/_default.py b/test/functional/tests/_default.py new file mode 100644 index 000000000..151a1824c --- /dev/null +++ b/test/functional/tests/_default.py @@ -0,0 +1,5 @@ +# Default settings for all tests. + +settings_overrides['report_level'] = 2 +settings_overrides['halt_level'] = 5 +settings_overrides['warning_stream'] = '' diff --git a/test/functional/tests/standalone_rst_html4css1.py b/test/functional/tests/standalone_rst_html4css1.py new file mode 100644 index 000000000..6704df444 --- /dev/null +++ b/test/functional/tests/standalone_rst_html4css1.py @@ -0,0 +1,8 @@ +# Source and destination file names. +test_source = "standalone_rst_html4css1.txt" +test_destination = "standalone_rst_html4css1.html" + +# Keyword parameters passed to publish_file. +reader_name = "standalone" +parser_name = "rst" +writer_name = "html4css1" diff --git a/test/functional/tests/standalone_rst_latex.py b/test/functional/tests/standalone_rst_latex.py new file mode 100644 index 000000000..a39bf6df1 --- /dev/null +++ b/test/functional/tests/standalone_rst_latex.py @@ -0,0 +1,8 @@ +# Source and destination file names. +test_source = "standalone_rst_latex.txt" +test_destination = "standalone_rst_latex.tex" + +# Keyword parameters passed to publish_file. +reader_name = "standalone" +parser_name = "rst" +writer_name = "latex" diff --git a/test/test_functional.py b/test/test_functional.py new file mode 100755 index 000000000..957880bea --- /dev/null +++ b/test/test_functional.py @@ -0,0 +1,129 @@ +#!/usr/bin/env python + +# Author: Felix Wiemann +# Contact: Felix_Wiemann@ososo.de +# Revision: $Revision$ +# Date: $Date$ +# Copyright: This module has been placed in the public domain. + +"""Perform tests with the data in the functional/ directory. + +Read README.txt for details on how this is done.""" + +import docutils.core +import os +import os.path +import unittest +import difflib +import DocutilsTestSupport + +datadir = 'functional' +"""The directory to store the data needed for the functional tests.""" + +class FunctionalTestSuite(DocutilsTestSupport.CustomTestSuite): + + """Test suite containing test cases for all config files.""" + + def __init__(self): + """Process all config files in functional/tests/.""" + DocutilsTestSupport.CustomTestSuite.__init__(self) + os.path.walk(os.path.join(datadir, 'tests'), self.walker, None) + + def walker(self, dummy, dirname, names): + """Process all config files among ``names`` in ``dirname``. + + This is a helper function for os.path.walk. A config file is + a Python file (*.py) which sets several veriables.""" + + for i in filter(lambda x: x.endswith('.py') and not + x.startswith('_'), names): + + c = os.path.join(dirname, i) + """Full path of configuration file.""" + + self.addTestCase( + FunctionalTestCase, 'test', None, None, id=c, configfile=c) + +class FunctionalTestCase(DocutilsTestSupport.CustomTestCase): + + """Test case for one config file.""" + + def __init__(self, *args, **kwargs): + """Set self.configfile, pass arguments to parent __init__.""" + self.configfile = kwargs['configfile'] + del kwargs['configfile'] + self.shortDescription = self.getdesc + DocutilsTestSupport.CustomTestCase.__init__(self, *args, **kwargs) + + def getdesc(self): + """Ugly hack for Python 2.1.""" + return 'Functional test for ' + self.configfile + + def test(self): + + """Process self.configfile.""" + + params = {'settings_overrides': {}} + """Keyword parameters for publish_file.""" + # Note that settings_overrides has been initialized to an + # empty dictionary. + + # Read the variables set in the default config file and in + # the current config file into params. + execfile(os.path.join(datadir, 'tests', '_default.py'), params) + execfile(self.configfile, params) + + assert params.has_key('test_source'),\ + "No 'test_source' supplied in " + self.configfile + assert params.has_key('test_destination'),\ + "No 'test_destination' supplied in " + self.configfile + + # Set source_path and destination_path if not given. + params.setdefault( + 'source_path', + os.path.join(datadir, 'input', params['test_source'])) + params.setdefault( + 'destination_path', + os.path.join(datadir, 'output', params['test_destination'])) + """Path for actual output.""" + + expected_path = os.path.join(datadir, 'expected', + params['test_destination']) + """Path for expected output.""" + + # test_source and test_destination aren't needed anymore. + del params['test_source'] + del params['test_destination'] + + # Delete private stuff like params['__builtins__']. + for key in params.keys(): + if key.startswith('_'): + del params[key] + + # Get output. (Automatically written to the output/ directory + # by publish_file.) + output = docutils.core.publish_file(**params) + + # Get the expected output *after* writing the actual output. + self.assert_(os.access(expected_path, os.R_OK),\ + 'Cannot find expected output at\n' + expected_path) + expected = open(expected_path).read() + # Generate diff if unified_diff available. + if hasattr(difflib, 'unified_diff'): + diff = ('Functional test failed:\n\n' + + ''.join(difflib.unified_diff( + expected.splitlines(1), + output.splitlines(1), + expected_path, + params['destination_path']))) + else: + diff = ('Functional test failed. ' + 'Please compare the following files:\n%s\n%s\n' % + (expected_path, params['destination_path'])) + self.assertEqual(output, expected, diff) + +def suite(): + return FunctionalTestSuite() + +if __name__ == '__main__': + unittest.main(defaultTest='suite') -- cgit v1.2.1 From 0f1d03d98446f5349823810895fac5ecc2b205de Mon Sep 17 00:00:00 2001 From: wiemann Date: Tue, 22 Jun 2004 22:41:01 +0000 Subject: deactivated config file processing git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2359 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_functional.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/test_functional.py b/test/test_functional.py index 957880bea..6207c4eab 100755 --- a/test/test_functional.py +++ b/test/test_functional.py @@ -10,6 +10,7 @@ Read README.txt for details on how this is done.""" +import docutils import docutils.core import os import os.path @@ -44,10 +45,12 @@ class FunctionalTestSuite(DocutilsTestSupport.CustomTestSuite): self.addTestCase( FunctionalTestCase, 'test', None, None, id=c, configfile=c) -class FunctionalTestCase(DocutilsTestSupport.CustomTestCase): +class FunctionalTestCase(DocutilsTestSupport.CustomTestCase, docutils.SettingsSpec): """Test case for one config file.""" + settings_default_overrides = {'_disable_config': 1} + def __init__(self, *args, **kwargs): """Set self.configfile, pass arguments to parent __init__.""" self.configfile = kwargs['configfile'] @@ -102,7 +105,7 @@ class FunctionalTestCase(DocutilsTestSupport.CustomTestCase): # Get output. (Automatically written to the output/ directory # by publish_file.) - output = docutils.core.publish_file(**params) + output = docutils.core.publish_file(settings_spec=self, **params) # Get the expected output *after* writing the actual output. self.assert_(os.access(expected_path, os.R_OK),\ -- cgit v1.2.1 From 65fa51b97aaad5094386e9d3b51614989d3c8734 Mon Sep 17 00:00:00 2001 From: goodger Date: Tue, 22 Jun 2004 23:58:56 +0000 Subject: updated git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2360 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_parsers/test_rst/test_directives/test_tables.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_directives/test_tables.py b/test/test_parsers/test_rst/test_directives/test_tables.py index b212be8de..0bd44a8a5 100755 --- a/test/test_parsers/test_rst/test_directives/test_tables.py +++ b/test/test_parsers/test_rst/test_directives/test_tables.py @@ -690,6 +690,9 @@ if csv: good, csv, data """], ] +else: + print ('Tests of "csv-table" directive skipped; ' + 'Python 2.3 or higher required.') if __name__ == '__main__': -- cgit v1.2.1 From 32ae0f91e6e6b802ed1b569cacdf88209088a35e Mon Sep 17 00:00:00 2001 From: goodger Date: Wed, 23 Jun 2004 03:45:26 +0000 Subject: cleaned up, simplified, and standardized git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2366 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_functional.py | 133 +++++++++++++++++++++++++----------------------- 1 file changed, 70 insertions(+), 63 deletions(-) (limited to 'test') diff --git a/test/test_functional.py b/test/test_functional.py index 6207c4eab..e6d56fd3d 100755 --- a/test/test_functional.py +++ b/test/test_functional.py @@ -6,21 +6,33 @@ # Date: $Date$ # Copyright: This module has been placed in the public domain. -"""Perform tests with the data in the functional/ directory. +""" +Perform tests with the data in the functional/ directory. -Read README.txt for details on how this is done.""" +Read README.txt for details on how this is done. -import docutils -import docutils.core +To do: make this test module runnable from anywhere. For example:: + + cd docutils/test/functional + ../test_functional.py +""" + +import sys import os import os.path import unittest import difflib +import docutils +import docutils.core import DocutilsTestSupport + +testroot = os.path.dirname(DocutilsTestSupport.__file__) + datadir = 'functional' """The directory to store the data needed for the functional tests.""" + class FunctionalTestSuite(DocutilsTestSupport.CustomTestSuite): """Test suite containing test cases for all config files.""" @@ -29,23 +41,24 @@ class FunctionalTestSuite(DocutilsTestSupport.CustomTestSuite): """Process all config files in functional/tests/.""" DocutilsTestSupport.CustomTestSuite.__init__(self) os.path.walk(os.path.join(datadir, 'tests'), self.walker, None) - + def walker(self, dummy, dirname, names): - """Process all config files among ``names`` in ``dirname``. + """ + Process all config files among `names` in `dirname`. This is a helper function for os.path.walk. A config file is - a Python file (*.py) which sets several veriables.""" - - for i in filter(lambda x: x.endswith('.py') and not - x.startswith('_'), names): - - c = os.path.join(dirname, i) - """Full path of configuration file.""" - - self.addTestCase( - FunctionalTestCase, 'test', None, None, id=c, configfile=c) - -class FunctionalTestCase(DocutilsTestSupport.CustomTestCase, docutils.SettingsSpec): + a Python file (*.py) which sets several variables. + """ + for name in names: + if name.endswith('.py') and not name.startswith('_'): + config_file_full_path = os.path.join(dirname, name) + self.addTestCase(FunctionalTestCase, 'test', None, None, + id=config_file_full_path, + configfile=config_file_full_path) + + +class FunctionalTestCase(DocutilsTestSupport.CustomTestCase, + docutils.SettingsSpec): """Test case for one config file.""" @@ -55,78 +68,72 @@ class FunctionalTestCase(DocutilsTestSupport.CustomTestCase, docutils.SettingsSp """Set self.configfile, pass arguments to parent __init__.""" self.configfile = kwargs['configfile'] del kwargs['configfile'] - self.shortDescription = self.getdesc DocutilsTestSupport.CustomTestCase.__init__(self, *args, **kwargs) - def getdesc(self): - """Ugly hack for Python 2.1.""" - return 'Functional test for ' + self.configfile + def shortDescription(self): + return 'test_functional.py: ' + self.configfile def test(self): - """Process self.configfile.""" - - params = {'settings_overrides': {}} - """Keyword parameters for publish_file.""" - # Note that settings_overrides has been initialized to an - # empty dictionary. - + cwd = os.getcwd() + os.chdir(testroot) + # Keyword parameters for publish_file: + params = {'settings_overrides': {}} # initialize for settings files # Read the variables set in the default config file and in - # the current config file into params. + # the current config file into params: execfile(os.path.join(datadir, 'tests', '_default.py'), params) execfile(self.configfile, params) - + # Check for required settings: assert params.has_key('test_source'),\ "No 'test_source' supplied in " + self.configfile assert params.has_key('test_destination'),\ "No 'test_destination' supplied in " + self.configfile - - # Set source_path and destination_path if not given. - params.setdefault( - 'source_path', - os.path.join(datadir, 'input', params['test_source'])) - params.setdefault( - 'destination_path', - os.path.join(datadir, 'output', params['test_destination'])) - """Path for actual output.""" - + # Set source_path and destination_path if not given: + params.setdefault('source_path', + os.path.join(datadir, 'input', + params['test_source'])) + # Path for actual output: + params.setdefault('destination_path', + os.path.join(datadir, 'output', + params['test_destination'])) + # Path for expected output: expected_path = os.path.join(datadir, 'expected', params['test_destination']) - """Path for expected output.""" - - # test_source and test_destination aren't needed anymore. + # test_source and test_destination aren't needed any more: del params['test_source'] del params['test_destination'] - - # Delete private stuff like params['__builtins__']. + # Delete private stuff like params['__builtins__']: for key in params.keys(): if key.startswith('_'): del params[key] - - # Get output. (Automatically written to the output/ directory - # by publish_file.) + # Get output (automatically written to the output/ directory + # by publish_file): output = docutils.core.publish_file(settings_spec=self, **params) - + os.chdir(cwd) # Get the expected output *after* writing the actual output. self.assert_(os.access(expected_path, os.R_OK),\ 'Cannot find expected output at\n' + expected_path) expected = open(expected_path).read() - # Generate diff if unified_diff available. - if hasattr(difflib, 'unified_diff'): - diff = ('Functional test failed:\n\n' + - ''.join(difflib.unified_diff( - expected.splitlines(1), - output.splitlines(1), - expected_path, - params['destination_path']))) - else: - diff = ('Functional test failed. ' - 'Please compare the following files:\n%s\n%s\n' % - (expected_path, params['destination_path'])) - self.assertEqual(output, expected, diff) + diff = ('Please compare the expected and actual output files:\n' + 'diff %s %s\n' % (expected_path, params['destination_path'])) + try: + self.assertEquals(output, expected, diff) + except AssertionError: + if hasattr(difflib, 'unified_diff'): + # Generate diff if unified_diff available: + diff = ''.join( + difflib.unified_diff(expected.splitlines(1), + output.splitlines(1), + expected_path, + params['destination_path'])) + print >>sys.stderr, '\n%s:' % (self,) + print >>sys.stderr, diff + raise + def suite(): return FunctionalTestSuite() + if __name__ == '__main__': unittest.main(defaultTest='suite') -- cgit v1.2.1 From 385680011b16f266d5994dc69b5fffe3e403bdf1 Mon Sep 17 00:00:00 2001 From: wiemann Date: Fri, 25 Jun 2004 12:56:28 +0000 Subject: moved documentation for testing to docs/dev/testing.txt git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2369 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/README.txt | 111 ++------------------------------------------- 1 file changed, 3 insertions(+), 108 deletions(-) (limited to 'test') diff --git a/test/functional/README.txt b/test/functional/README.txt index 0a9729cee..fc104d52e 100644 --- a/test/functional/README.txt +++ b/test/functional/README.txt @@ -1,110 +1,5 @@ -================ -Functional tests -================ +This directory stores data files for functional tests. -:Author: Felix Wiemann -:Revision: $Revision$ -:Date: $Date$ -:Copyright: This document has been placed in the public domain. +Please see the documentation on `functional testing`__ for details. -(This document should probably be moved to the ``docs/`` directory of -Docutils, as it is real documentation. Maybe we need a file -``docs/dev/testing.txt``?) - -This directory (``functional/``) contains data for functional tests. - -Performing functional tests means testing the Docutils system as a -whole, i.e. blackbox testing. - -.. contents:: - -Directory Structure -=================== - -+ ``functional/`` The main data directory. - - + ``input/`` The input files. - - - ``some_test.txt``, for example. - - + ``output/`` The actual output. - - - ``some_test.html``, for example. - - + ``expected/`` The expected output. - - - ``some_test.html``, for example. - - + ``tests/`` The config files for processing the input files. - - - ``some_test.py``, for example. - - - ``default.py``, the `default configuration file`_. - -The Testing Process -=================== - -When running ``test_functional.py``, all config files in -``functional/some_test.py`` are processed. - -An example of what this means: - -Provided ``functional/tests/some_test.py`` reads like this:: - - # Source and destination file names. - test_source = "some_test.txt" - test_destination = "some_test.html" - - # Keyword parameters passed to publish_file. - reader_name = "standalone" - parser_name = "rst" - writer_name = "html" - settings_overrides['output-encoding': 'utf-8'] - -The two variables ``test_source`` and ``test_destination`` contain the -input file name (relative to ``functional/input/``) and the output -file name (relative to ``functional/output/`` and -``functional/expected/``). Note that the file names can be chosen -arbitrarily. However, the file names in ``functional/output/`` *must* -match the file names in ``functional/expected/``. - -All other variables are passed as keyword arguments to -``docutils.core.publish_file``, so you can set reader, parser, -writer and anything else you want to configure. - -Note that ``settings_overrides`` is already initialized as an empty -dictionary *before* the execution of the config file. This is done in -order to allow subsequent assignments to ``settings_overrides`` in the -`default configuration file`_ and in the actual configuration file. - -Creating New Tests -================== - -In order to create a new test, put the input test file into -``functional/input/``. Then create a config file in -``functional/tests/`` which sets at least input and output file names, -reader, parser and writer. - -Now run ``test_functional.py``. The test will fail, of course, -because you do not have an expected output yet. - -However, an output file will be generated in ``functional/output/``. -Check this output file for validity and correctness. Then copy the -file to ``functional/expected/``. - -If you run ``test_functional.py`` later and the actual output doesn't -match the expected output anymore, the test will fail. - -If this is the case and you made an intentional change, check the -actual output for validity and correctness and copy it to -``functional/expected/``, overwriting the old expected output. - -.. _default configuration file: - -The Default Configuration File -============================== - -The file ``functional/tests/default.py`` contains default settings. -It is executed just before the actual configuration files, which has -the same effect as the contents of ``default.py`` were prepended to -every configuration file. +__ ../../docs/dev/testing.html#functional -- cgit v1.2.1 From d779ab9e4aa1aacb65e8aa6b3d927bd9afeec805 Mon Sep 17 00:00:00 2001 From: grubert Date: Fri, 25 Jun 2004 13:35:07 +0000 Subject: Fix test_latex2e for graphicx option. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2371 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_writers/test_latex2e.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/test_writers/test_latex2e.py b/test/test_writers/test_latex2e.py index 4fa2472ed..2bdf3885d 100644 --- a/test/test_writers/test_latex2e.py +++ b/test/test_writers/test_latex2e.py @@ -27,8 +27,13 @@ latex_head = """\ \\usepackage{longtable} \\setlength{\\extrarowheight}{2pt} \\usepackage{amsmath} -\\usepackage{graphicx} -\\usepackage{color} +%Check if we are compiling under latex or pdflatex + \\ifx\\pdftexversion\\undefined + \\usepackage[dvips]{graphicx} + \\else + \\usepackage[pdftex]{graphicx} + \\fi + \\usepackage{color} \\usepackage{multirow} \\usepackage{ifthen} \\usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref} -- cgit v1.2.1 From 8684fe0e81cc6f4938b9621c5fe476e47c7797e2 Mon Sep 17 00:00:00 2001 From: goodger Date: Fri, 25 Jun 2004 18:08:49 +0000 Subject: updated; remember to run the test suite before checkins! git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2374 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_latex.tex | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_latex.tex b/test/functional/expected/standalone_rst_latex.tex index 159ffd03f..b3339d181 100644 --- a/test/functional/expected/standalone_rst_latex.tex +++ b/test/functional/expected/standalone_rst_latex.tex @@ -6,8 +6,13 @@ \usepackage{longtable} \setlength{\extrarowheight}{2pt} \usepackage{amsmath} -\usepackage{graphicx} -\usepackage{color} +%Check if we are compiling under latex or pdflatex + \ifx\pdftexversion\undefined + \usepackage[dvips]{graphicx} + \else + \usepackage[pdftex]{graphicx} + \fi + \usepackage{color} \usepackage{multirow} \usepackage{ifthen} \usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref} -- cgit v1.2.1 From 973428782b288d7ff451f72faeb95d1854cc9477 Mon Sep 17 00:00:00 2001 From: grubert Date: Fri, 25 Jun 2004 19:09:25 +0000 Subject: Add option: graphicx-option. Default to no option. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2377 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_writers/test_latex2e.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'test') diff --git a/test/test_writers/test_latex2e.py b/test/test_writers/test_latex2e.py index 2bdf3885d..4fa2472ed 100644 --- a/test/test_writers/test_latex2e.py +++ b/test/test_writers/test_latex2e.py @@ -27,13 +27,8 @@ latex_head = """\ \\usepackage{longtable} \\setlength{\\extrarowheight}{2pt} \\usepackage{amsmath} -%Check if we are compiling under latex or pdflatex - \\ifx\\pdftexversion\\undefined - \\usepackage[dvips]{graphicx} - \\else - \\usepackage[pdftex]{graphicx} - \\fi - \\usepackage{color} +\\usepackage{graphicx} +\\usepackage{color} \\usepackage{multirow} \\usepackage{ifthen} \\usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref} -- cgit v1.2.1 From 86e1b40edc0e10dbf6c33aa2e2a0eb826058f15f Mon Sep 17 00:00:00 2001 From: wiemann Date: Fri, 25 Jun 2004 21:28:02 +0000 Subject: docs/dev/todo.txt git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2379 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_latex.tex | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_latex.tex b/test/functional/expected/standalone_rst_latex.tex index b3339d181..159ffd03f 100644 --- a/test/functional/expected/standalone_rst_latex.tex +++ b/test/functional/expected/standalone_rst_latex.tex @@ -6,13 +6,8 @@ \usepackage{longtable} \setlength{\extrarowheight}{2pt} \usepackage{amsmath} -%Check if we are compiling under latex or pdflatex - \ifx\pdftexversion\undefined - \usepackage[dvips]{graphicx} - \else - \usepackage[pdftex]{graphicx} - \fi - \usepackage{color} +\usepackage{graphicx} +\usepackage{color} \usepackage{multirow} \usepackage{ifthen} \usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref} -- cgit v1.2.1 From b809a0a9d47b1ffb08758209129909408e72eaa8 Mon Sep 17 00:00:00 2001 From: goodger Date: Fri, 25 Jun 2004 22:12:37 +0000 Subject: updated git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2385 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/docutils.conf | 11 ++++++++--- test/test_functional.py | 12 ++++++------ 2 files changed, 14 insertions(+), 9 deletions(-) (limited to 'test') diff --git a/test/docutils.conf b/test/docutils.conf index 142869b61..df4b1e46a 100644 --- a/test/docutils.conf +++ b/test/docutils.conf @@ -1,6 +1,11 @@ -# This configuration file is not for testing, but to prevent -# tools/buildhtml.py from processing text files in and below -# this directory. +[general] +# This tests the test framework; this config file should *not* be read +# when testing. +source-link: yes +datestamp: %Y-%m-%d %H:%M UTC (If you see this in test output, there's a bug in the test code!) +generator: on [buildhtml application] +# This part is not for testing, but to prevent tools/buildhtml.py from +# processing text files in and below this directory. prune: . diff --git a/test/test_functional.py b/test/test_functional.py index e6d56fd3d..aa5a1dbb7 100755 --- a/test/test_functional.py +++ b/test/test_functional.py @@ -57,13 +57,10 @@ class FunctionalTestSuite(DocutilsTestSupport.CustomTestSuite): configfile=config_file_full_path) -class FunctionalTestCase(DocutilsTestSupport.CustomTestCase, - docutils.SettingsSpec): +class FunctionalTestCase(DocutilsTestSupport.CustomTestCase): """Test case for one config file.""" - settings_default_overrides = {'_disable_config': 1} - def __init__(self, *args, **kwargs): """Set self.configfile, pass arguments to parent __init__.""" self.configfile = kwargs['configfile'] @@ -78,7 +75,10 @@ class FunctionalTestCase(DocutilsTestSupport.CustomTestCase, cwd = os.getcwd() os.chdir(testroot) # Keyword parameters for publish_file: - params = {'settings_overrides': {}} # initialize for settings files + params = {} + # Initialize 'settings_overrides' for test settings scripts, + # and disable configuration files: + params['settings_overrides'] = {'_disable_config': 1} # Read the variables set in the default config file and in # the current config file into params: execfile(os.path.join(datadir, 'tests', '_default.py'), params) @@ -108,7 +108,7 @@ class FunctionalTestCase(DocutilsTestSupport.CustomTestCase, del params[key] # Get output (automatically written to the output/ directory # by publish_file): - output = docutils.core.publish_file(settings_spec=self, **params) + output = docutils.core.publish_file(**params) os.chdir(cwd) # Get the expected output *after* writing the actual output. self.assert_(os.access(expected_path, os.R_OK),\ -- cgit v1.2.1 From d9d1a5d2bc7951859e0adc63ac2ba24930462631 Mon Sep 17 00:00:00 2001 From: goodger Date: Sat, 26 Jun 2004 21:07:59 +0000 Subject: added date & time to header; flush output early for feedback git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2390 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/alltests.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/alltests.py b/test/alltests.py index 26b8838d0..ecd950853 100755 --- a/test/alltests.py +++ b/test/alltests.py @@ -61,11 +61,15 @@ sys.stdout = sys.stderr = Tee('alltests.out') import package_unittest -print ('Testing Docutils %s with Python %s' - % (docutils.__version__, sys.version.split()[0])) +print ('Testing Docutils %s with Python %s on %s at %s' + % (docutils.__version__, sys.version.split()[0], + time.strftime('%Y-%m-%d'), time.strftime('%H:%M:%S'))) +sys.stdout.flush() path, script = os.path.split(sys.argv[0]) suite = package_unittest.loadTestModules(path, 'test_', packages=1) +sys.stdout.flush() + package_unittest.main(suite) #if package_unittest.verbosity > 1: # print >>sys.stderr, pformat(suite) # check the test suite -- cgit v1.2.1 From c37244c86632b33aa167a75809bc25c56f097e21 Mon Sep 17 00:00:00 2001 From: goodger Date: Mon, 28 Jun 2004 19:55:26 +0000 Subject: updated git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2412 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_parsers/test_rst/test_inline_markup.py | 37 ++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_inline_markup.py b/test/test_parsers/test_rst/test_inline_markup.py index 4637e1e11..8f3fe5628 100755 --- a/test/test_parsers/test_rst/test_inline_markup.py +++ b/test/test_parsers/test_rst/test_inline_markup.py @@ -822,19 +822,52 @@ ftp://ends.with.a.period. ?) """], ["""\ -Valid URL with escaped markup characters: +Valid URLs with escaped markup characters: http://example.com/\\*content\\*/whatever + +http://example.com/\\*content*/whatever """, """\ - Valid URL with escaped markup characters: + Valid URLs with escaped markup characters: + + + http://example.com/*content*/whatever http://example.com/*content*/whatever """], ["""\ +Valid URLs may end with punctuation inside "<>": + + +""", +"""\ + + + Valid URLs may end with punctuation inside "<>": + + < + + http://example.org/ends-with-dot. + > +"""], +["""\ +Valid URLs with interesting endings: + +http://example.org/ends-with-pluses++ +""", +"""\ + + + Valid URLs with interesting endings: + + + http://example.org/ends-with-pluses++ +"""], +["""\ None of these are standalone hyperlinks (their "schemes" are not recognized): signal:noise, a:b. """, -- cgit v1.2.1 From dd993980aaed320742b3d1b4ecc8a84c1dd10a79 Mon Sep 17 00:00:00 2001 From: grubert Date: Wed, 7 Jul 2004 07:56:26 +0000 Subject: Indent literal-blocks. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2423 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_latex.tex | 8 ++++---- test/test_writers/test_latex2e.py | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_latex.tex b/test/functional/expected/standalone_rst_latex.tex index 159ffd03f..eed860f05 100644 --- a/test/functional/expected/standalone_rst_latex.tex +++ b/test/functional/expected/standalone_rst_latex.tex @@ -536,19 +536,19 @@ description. Literal blocks are indicated with a double-colon (``::'') at the end of the preceding paragraph (over there \texttt{-->}). They can be indented: -\begin{ttfamily}\begin{flushleft} +\begin{quote}{\ttfamily \raggedright \noindent if~literal{\underline{~}}block:~\\ ~~~~text~=~'is~left~as-is'~\\ ~~~~spaces{\underline{~}}and{\underline{~}}linebreaks~=~'are~preserved'~\\ ~~~~markup{\underline{~}}processing~=~None -\end{flushleft}\end{ttfamily} +}\end{quote} Or they can be quoted without indentation: -\begin{ttfamily}\begin{flushleft} +\begin{quote}{\ttfamily \raggedright \noindent >>~Great~idea!~\\ >~\\ >~Why~didn't~I~think~of~that? -\end{flushleft}\end{ttfamily} +}\end{quote} %___________________________________________________________________________ diff --git a/test/test_writers/test_latex2e.py b/test/test_writers/test_latex2e.py index 4fa2472ed..924ad9bfd 100644 --- a/test/test_writers/test_latex2e.py +++ b/test/test_writers/test_latex2e.py @@ -253,14 +253,14 @@ Expecting ``en'' here. Inside literal blocks quotes should be left untouched (use only two quotes in test code makes life easier for the python interpreter running the test): -\\begin{ttfamily}\\begin{flushleft} +\\begin{quote}{\\ttfamily \\raggedright \\noindent ""~\\\\ This~is~left~"untouched"~also~*this*.~\\\\ "" -\\end{flushleft}\\end{ttfamily} -\\begin{ttfamily}\\begin{flushleft} +}\\end{quote} +\\begin{quote}{\\ttfamily \\raggedright \\noindent should~get~"quotes"~and~\\emph{italics}. -\\end{flushleft}\\end{ttfamily} +}\\end{quote} Inline \\texttt{literal "quotes"} should be kept. @@ -325,13 +325,13 @@ latex_head + """\ \\setlength{\\locallinewidth}{\\linewidth} -\\begin{ttfamily}\\begin{flushleft} +\\begin{quote}{\\ttfamily \\raggedright \\noindent something~before~to~get~a~end~of~line.~\\\\ {[}~\\\\ ~\\\\ the~empty~line~gets~tested~too~\\\\ ] -\\end{flushleft}\\end{ttfamily} +}\\end{quote} \\end{document} """], -- cgit v1.2.1 From 2384d0cf6cd5f596511784ff8b54c8ae1e57e8fa Mon Sep 17 00:00:00 2001 From: cben Date: Sun, 25 Jul 2004 01:45:27 +0000 Subject: Allow the test suite to survive unimportable test modules. Notably, this fixes a crash on importing `moduleparser` under Python 2.1 from ``test/test_readers/test_python/test_functions.py``. (This shouldn't happen anyway, added to BUGS.txt) git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2449 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/package_unittest.py | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) (limited to 'test') diff --git a/test/package_unittest.py b/test/package_unittest.py index 019d6fb38..135b54f47 100644 --- a/test/package_unittest.py +++ b/test/package_unittest.py @@ -99,25 +99,29 @@ def loadTestModules(path, name='', packages=None): for mod in testModules: if debug: print >>sys.stderr, "importing %s" % mod - module = import_module(mod) - # if there's a suite defined, incorporate its contents try: - suite = getattr(module, 'suite') - except AttributeError: - # Look for individual tests - moduleTests = testLoader.loadTestsFromModule(module) - # unittest.TestSuite.addTests() doesn't work as advertised, - # as it can't load tests from another TestSuite, so we have - # to cheat: - testSuite.addTest(moduleTests) - continue - if type(suite) == types.FunctionType: - testSuite.addTest(suite()) - elif type(suite) == types.InstanceType \ - and isinstance(suite, unittest.TestSuite): - testSuite.addTest(suite) + module = import_module(mod) + except ImportError: + print >>sys.stderr, "ERROR: Can't import %s, skipping its tests!" % mod else: - raise AssertionError, "don't understand suite (%s)" % mod + # if there's a suite defined, incorporate its contents + try: + suite = getattr(module, 'suite') + except AttributeError: + # Look for individual tests + moduleTests = testLoader.loadTestsFromModule(module) + # unittest.TestSuite.addTests() doesn't work as advertised, + # as it can't load tests from another TestSuite, so we have + # to cheat: + testSuite.addTest(moduleTests) + continue + if type(suite) == types.FunctionType: + testSuite.addTest(suite()) + elif type(suite) == types.InstanceType \ + and isinstance(suite, unittest.TestSuite): + testSuite.addTest(suite) + else: + raise AssertionError, "don't understand suite (%s)" % mod sys.path.pop(0) return testSuite -- cgit v1.2.1 From 92cf1a41dfcfaecc618930fb85cf5fb5f775dc01 Mon Sep 17 00:00:00 2001 From: cben Date: Sun, 25 Jul 2004 02:14:23 +0000 Subject: Replace version number sniffing with specific features sniffing. Also fix 2 bugs in `report_UnicodeError`: * Print the current encoding (was a ``%s``). * Don't crash before Python 2.3 where `UnicodeError` objects had no ``object`` or ``encoding`` attributes. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2450 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/DocutilsTestSupport.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/DocutilsTestSupport.py b/test/DocutilsTestSupport.py index baaf44978..a7c17a105 100644 --- a/test/DocutilsTestSupport.py +++ b/test/DocutilsTestSupport.py @@ -56,9 +56,9 @@ from docutils.parsers.rst import states, tableparser, roles, languages from docutils.readers import standalone, pep from docutils.statemachine import StringList, string2lines -if sys.hexversion >= 0x02020000: # Python 2.2 +try: from docutils.readers.python import moduleparser -else: +except ImportError: # moduleparser depends on modules added in Python 2.2 moduleparser = None try: -- cgit v1.2.1 From d4225e8ef8630c0fa832c856620f77ed0636c0a9 Mon Sep 17 00:00:00 2001 From: cben Date: Sun, 25 Jul 2004 02:19:00 +0000 Subject: Print a backtrace on failed import of test modules. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2451 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/package_unittest.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/package_unittest.py b/test/package_unittest.py index 135b54f47..d1d94ff15 100644 --- a/test/package_unittest.py +++ b/test/package_unittest.py @@ -102,7 +102,8 @@ def loadTestModules(path, name='', packages=None): try: module = import_module(mod) except ImportError: - print >>sys.stderr, "ERROR: Can't import %s, skipping its tests!" % mod + print >>sys.stderr, "ERROR: Can't import %s, skipping its tests:" % mod + sys.excepthook(*sys.exc_info()) else: # if there's a suite defined, incorporate its contents try: -- cgit v1.2.1 From 80e3d5d2480ed56cb88094abfc6e88cc3bf1aef2 Mon Sep 17 00:00:00 2001 From: goodger Date: Sun, 25 Jul 2004 02:30:05 +0000 Subject: simple import isn't enough -- added another requirement (testing for 2.2 was easier!) git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2452 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/DocutilsTestSupport.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'test') diff --git a/test/DocutilsTestSupport.py b/test/DocutilsTestSupport.py index a7c17a105..7525141f3 100644 --- a/test/DocutilsTestSupport.py +++ b/test/DocutilsTestSupport.py @@ -58,6 +58,8 @@ from docutils.statemachine import StringList, string2lines try: from docutils.readers.python import moduleparser + from tokenize import generate_tokens + del generate_tokens except ImportError: # moduleparser depends on modules added in Python 2.2 moduleparser = None -- cgit v1.2.1 From 1f279af9ba27df1120fb7f9da97f3c368106ffb9 Mon Sep 17 00:00:00 2001 From: wiemann Date: Sun, 25 Jul 2004 11:29:43 +0000 Subject: fixed usage bug git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2454 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/package_unittest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/package_unittest.py b/test/package_unittest.py index d1d94ff15..43d724cd1 100644 --- a/test/package_unittest.py +++ b/test/package_unittest.py @@ -66,7 +66,7 @@ def parseArgs(argv=sys.argv): if len(args) != 0: usageExit("No command-line arguments supported yet.") except getopt.error, msg: - self.usageExit(msg) + usageExit(msg) def loadTestModules(path, name='', packages=None): """ -- cgit v1.2.1 From 4b88f898119ed68ac2fb2c6b527344f696d83dbb Mon Sep 17 00:00:00 2001 From: wiemann Date: Mon, 26 Jul 2004 17:04:48 +0000 Subject: test_functional.py now runnable from anywhere git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2457 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_html4css1.html | 2 +- test/functional/tests/standalone_rst_html4css1.py | 3 +++ test/test_functional.py | 12 +++++------- 3 files changed, 9 insertions(+), 8 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index 1289cb1a5..69ef2868b 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -14,7 +14,7 @@ - +

reStructuredText Test Document

diff --git a/test/functional/tests/standalone_rst_html4css1.py b/test/functional/tests/standalone_rst_html4css1.py index 6704df444..736905c9c 100644 --- a/test/functional/tests/standalone_rst_html4css1.py +++ b/test/functional/tests/standalone_rst_html4css1.py @@ -6,3 +6,6 @@ test_destination = "standalone_rst_html4css1.html" reader_name = "standalone" parser_name = "rst" writer_name = "html4css1" + +# Settings +settings_overrides['stylesheet_path'] = "../tools/stylesheets/default.css" diff --git a/test/test_functional.py b/test/test_functional.py index aa5a1dbb7..c8413be73 100755 --- a/test/test_functional.py +++ b/test/test_functional.py @@ -10,11 +10,6 @@ Perform tests with the data in the functional/ directory. Read README.txt for details on how this is done. - -To do: make this test module runnable from anywhere. For example:: - - cd docutils/test/functional - ../test_functional.py """ import sys @@ -27,6 +22,7 @@ import docutils.core import DocutilsTestSupport +# Ugly magic to determine the test directory. testroot = os.path.dirname(DocutilsTestSupport.__file__) datadir = 'functional' @@ -40,7 +36,10 @@ class FunctionalTestSuite(DocutilsTestSupport.CustomTestSuite): def __init__(self): """Process all config files in functional/tests/.""" DocutilsTestSupport.CustomTestSuite.__init__(self) + os.chdir(testroot) + self.added = 0 os.path.walk(os.path.join(datadir, 'tests'), self.walker, None) + assert self.added, 'No functional tests found.' def walker(self, dummy, dirname, names): """ @@ -55,6 +54,7 @@ class FunctionalTestSuite(DocutilsTestSupport.CustomTestSuite): self.addTestCase(FunctionalTestCase, 'test', None, None, id=config_file_full_path, configfile=config_file_full_path) + self.added += 1 class FunctionalTestCase(DocutilsTestSupport.CustomTestCase): @@ -72,7 +72,6 @@ class FunctionalTestCase(DocutilsTestSupport.CustomTestCase): def test(self): """Process self.configfile.""" - cwd = os.getcwd() os.chdir(testroot) # Keyword parameters for publish_file: params = {} @@ -109,7 +108,6 @@ class FunctionalTestCase(DocutilsTestSupport.CustomTestCase): # Get output (automatically written to the output/ directory # by publish_file): output = docutils.core.publish_file(**params) - os.chdir(cwd) # Get the expected output *after* writing the actual output. self.assert_(os.access(expected_path, os.R_OK),\ 'Cannot find expected output at\n' + expected_path) -- cgit v1.2.1 From c602d10c3f1ccdb964d839bbb9abd2ff546e4b8c Mon Sep 17 00:00:00 2001 From: wiemann Date: Wed, 28 Jul 2004 21:29:10 +0000 Subject: removed reference to html.py git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2495 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_parsers/test_rst/test_directives/test_meta.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_directives/test_meta.py b/test/test_parsers/test_rst/test_directives/test_meta.py index ecfedd721..7c8b34002 100755 --- a/test/test_parsers/test_rst/test_directives/test_meta.py +++ b/test/test_parsers/test_rst/test_directives/test_meta.py @@ -7,7 +7,7 @@ # Copyright: This module has been placed in the public domain. """ -Tests for html.py meta directives. +Tests for html meta directives. """ from __init__ import DocutilsTestSupport -- cgit v1.2.1 From 248763249e49339854e070dda04541e8bdfe5e75 Mon Sep 17 00:00:00 2001 From: wiemann Date: Thu, 29 Jul 2004 00:24:32 +0000 Subject: fixed \maketitle bug git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2500 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_writers/test_latex2e.py | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'test') diff --git a/test/test_writers/test_latex2e.py b/test/test_writers/test_latex2e.py index 924ad9bfd..d8f0c4d91 100644 --- a/test/test_writers/test_latex2e.py +++ b/test/test_writers/test_latex2e.py @@ -88,8 +88,6 @@ latex_head + """\ \\date{} \\raggedbottom \\begin{document} -\\maketitle - \\setlength{\\locallinewidth}{\\linewidth} \\hypertarget{table-of-contents}{} @@ -150,8 +148,6 @@ latex_head + """\ \\date{} \\raggedbottom \\begin{document} -\\maketitle - \\setlength{\\locallinewidth}{\\linewidth} \\newcounter{listcnt1} @@ -242,8 +238,6 @@ latex_head + """\ \\date{} \\raggedbottom \\begin{document} -\\maketitle - \\setlength{\\locallinewidth}{\\linewidth} @@ -285,8 +279,6 @@ latex_head + """\ \\date{} \\raggedbottom \\begin{document} -\\maketitle - \\setlength{\\locallinewidth}{\\linewidth} @@ -321,8 +313,6 @@ latex_head + """\ \\date{} \\raggedbottom \\begin{document} -\\maketitle - \\setlength{\\locallinewidth}{\\linewidth} \\begin{quote}{\\ttfamily \\raggedright \\noindent -- cgit v1.2.1 From db96d392b13e8f000dc76dd4baa7818d4567f6c7 Mon Sep 17 00:00:00 2001 From: wiemann Date: Thu, 29 Jul 2004 15:46:45 +0000 Subject: release 0.3.5 git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2514 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_html4css1.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index 69ef2868b..2b96627a5 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -3,7 +3,7 @@ - + reStructuredText Test Document -- cgit v1.2.1 From 314281dab392bc1f8089848702d41884ce785547 Mon Sep 17 00:00:00 2001 From: wiemann Date: Thu, 29 Jul 2004 20:35:18 +0000 Subject: release 0.3.5 git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2522 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_html4css1.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index 2b96627a5..8b55806d5 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -3,7 +3,7 @@ - + reStructuredText Test Document -- cgit v1.2.1 From 14d88a0e6bc1921b02952fc27b847121ea9ff2b1 Mon Sep 17 00:00:00 2001 From: lele Date: Fri, 20 Aug 2004 08:00:43 +0000 Subject: The directive now accepts a prefix option, a string that will be prepended to the generated section enumeration, and a start value, an integer used as the starting value for auto-numbering the sections. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2533 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms/test_sectnum.py | 154 +++++++++++++++++++++++++++++++++++ 1 file changed, 154 insertions(+) (limited to 'test') diff --git a/test/test_transforms/test_sectnum.py b/test/test_transforms/test_sectnum.py index 543deac16..e00816e2b 100644 --- a/test/test_transforms/test_sectnum.py +++ b/test/test_transforms/test_sectnum.py @@ -218,6 +218,160 @@ u"""\ Paragraph 4. """], +["""\ +.. sectnum:: + :prefix: Arbitrary + +Title 1 +======= +Paragraph 1. + +Title 2 +------- +Paragraph 2. + +Title 3 +``````` +Paragraph 3. + +Title 4 +------- +Paragraph 4. +""", +u"""\ + +
+ + <generated class="sectnum"> + Arbitrary.1\u00a0\u00a0\u00a0 + Title 1 + <paragraph> + Paragraph 1. + <section id="title-2" name="title 2"> + <title auto="1"> + <generated class="sectnum"> + Arbitrary.1.1\u00a0\u00a0\u00a0 + Title 2 + <paragraph> + Paragraph 2. + <section id="title-3" name="title 3"> + <title auto="1"> + <generated class="sectnum"> + Arbitrary.1.1.1\u00a0\u00a0\u00a0 + Title 3 + <paragraph> + Paragraph 3. + <section id="title-4" name="title 4"> + <title auto="1"> + <generated class="sectnum"> + Arbitrary.1.2\u00a0\u00a0\u00a0 + Title 4 + <paragraph> + Paragraph 4. +"""], +["""\ +.. sectnum:: + :start: 3 + +Title 1 +======= +Paragraph 1. + +Title 2 +------- +Paragraph 2. + +Title 3 +``````` +Paragraph 3. + +Title 4 +------- +Paragraph 4. +""", +u"""\ +<document source="test data"> + <section id="title-1" name="title 1"> + <title auto="1"> + <generated class="sectnum"> + 3\u00a0\u00a0\u00a0 + Title 1 + <paragraph> + Paragraph 1. + <section id="title-2" name="title 2"> + <title auto="1"> + <generated class="sectnum"> + 3.1\u00a0\u00a0\u00a0 + Title 2 + <paragraph> + Paragraph 2. + <section id="title-3" name="title 3"> + <title auto="1"> + <generated class="sectnum"> + 3.1.1\u00a0\u00a0\u00a0 + Title 3 + <paragraph> + Paragraph 3. + <section id="title-4" name="title 4"> + <title auto="1"> + <generated class="sectnum"> + 3.2\u00a0\u00a0\u00a0 + Title 4 + <paragraph> + Paragraph 4. +"""], +["""\ +.. sectnum:: + :prefix: 5.9 + :start: 3 + +Title 1 +======= +Paragraph 1. + +Title 2 +------- +Paragraph 2. + +Title 3 +``````` +Paragraph 3. + +Title 4 +------- +Paragraph 4. +""", +u"""\ +<document source="test data"> + <section id="title-1" name="title 1"> + <title auto="1"> + <generated class="sectnum"> + 5.9.3\u00a0\u00a0\u00a0 + Title 1 + <paragraph> + Paragraph 1. + <section id="title-2" name="title 2"> + <title auto="1"> + <generated class="sectnum"> + 5.9.3.1\u00a0\u00a0\u00a0 + Title 2 + <paragraph> + Paragraph 2. + <section id="title-3" name="title 3"> + <title auto="1"> + <generated class="sectnum"> + 5.9.3.1.1\u00a0\u00a0\u00a0 + Title 3 + <paragraph> + Paragraph 3. + <section id="title-4" name="title 4"> + <title auto="1"> + <generated class="sectnum"> + 5.9.3.2\u00a0\u00a0\u00a0 + Title 4 + <paragraph> + Paragraph 4. +"""], ]) -- cgit v1.2.1 From ac8a961d0712912d52ee9651253e314b5e08e10a Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sun, 22 Aug 2004 15:57:38 +0000 Subject: Updated functional test for LaTeX writer. *Please* don't forget to update tests after checking in changes. Running alltests.py, verifying that the actual LaTeX output in test/functional/output/ is correct and copying the actual output file into the expected/ directory would already have been sufficient. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2535 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_latex.tex | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_latex.tex b/test/functional/expected/standalone_rst_latex.tex index eed860f05..ec21353eb 100644 --- a/test/functional/expected/standalone_rst_latex.tex +++ b/test/functional/expected/standalone_rst_latex.tex @@ -104,11 +104,11 @@ Like this. \\ \setlength{\locallinewidth}{\linewidth} -\subsection*{~\hfill Dedication\hfill ~} +\subsubsection*{~\hfill Dedication\hfill ~} For Docutils users {\&} co-developers. -\subsection*{~\hfill Abstract\hfill ~} +\subsubsection*{~\hfill Abstract\hfill ~} This is a test document, containing at least one example of each reStructuredText construct. @@ -120,7 +120,7 @@ reStructuredText construct. % bibliographic fields (which also require a transform): \hypertarget{table-of-contents}{} \pdfbookmark[0]{Table of Contents}{table-of-contents} -\subsection*{~\hfill Table of Contents\hfill ~} +\subsubsection*{~\hfill Table of Contents\hfill ~} \begin{list}{}{} \item {} \href{\#structural-elements}{1~~~Structural Elements} \begin{list}{}{} @@ -892,7 +892,7 @@ background color. \end{center} \setlength{\locallinewidth}{\linewidth} -\subsection*{~\hfill Topic Title\hfill ~} +\subsubsection*{~\hfill Topic Title\hfill ~} This is a topic. -- cgit v1.2.1 From dd41f1d54cc42fe5cfed4ea7e2cccd4eeb0543ce Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sun, 22 Aug 2004 16:56:57 +0000 Subject: updated git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2537 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_writers/test_latex2e.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/test_writers/test_latex2e.py b/test/test_writers/test_latex2e.py index d8f0c4d91..de74a24f3 100644 --- a/test/test_writers/test_latex2e.py +++ b/test/test_writers/test_latex2e.py @@ -92,7 +92,7 @@ latex_head + """\ \\setlength{\\locallinewidth}{\\linewidth} \\hypertarget{table-of-contents}{} \\pdfbookmark[0]{Table of Contents}{table-of-contents} -\\subsection*{~\\hfill Table of Contents\\hfill ~} +\\subsubsection*{~\\hfill Table of Contents\\hfill ~} \\begin{list}{}{} \\item {} \\href{\\#title-1}{Title 1} \\begin{list}{}{} -- cgit v1.2.1 From 96cef63ca0e73f97052a3286d8480b7ea870313e Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Mon, 23 Aug 2004 17:35:50 +0000 Subject: added "suffix" option to "sectnum" directive; require separating punctuation git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2539 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms/test_sectnum.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'test') diff --git a/test/test_transforms/test_sectnum.py b/test/test_transforms/test_sectnum.py index e00816e2b..2ecb6b802 100644 --- a/test/test_transforms/test_sectnum.py +++ b/test/test_transforms/test_sectnum.py @@ -220,7 +220,7 @@ u"""\ """], ["""\ .. sectnum:: - :prefix: Arbitrary + :prefix: Arbitrary- Title 1 ======= @@ -243,28 +243,28 @@ u"""\ <section id="title-1" name="title 1"> <title auto="1"> <generated class="sectnum"> - Arbitrary.1\u00a0\u00a0\u00a0 + Arbitrary-1\u00a0\u00a0\u00a0 Title 1 <paragraph> Paragraph 1. <section id="title-2" name="title 2"> <title auto="1"> <generated class="sectnum"> - Arbitrary.1.1\u00a0\u00a0\u00a0 + Arbitrary-1.1\u00a0\u00a0\u00a0 Title 2 <paragraph> Paragraph 2. <section id="title-3" name="title 3"> <title auto="1"> <generated class="sectnum"> - Arbitrary.1.1.1\u00a0\u00a0\u00a0 + Arbitrary-1.1.1\u00a0\u00a0\u00a0 Title 3 <paragraph> Paragraph 3. <section id="title-4" name="title 4"> <title auto="1"> <generated class="sectnum"> - Arbitrary.1.2\u00a0\u00a0\u00a0 + Arbitrary-1.2\u00a0\u00a0\u00a0 Title 4 <paragraph> Paragraph 4. @@ -322,7 +322,8 @@ u"""\ """], ["""\ .. sectnum:: - :prefix: 5.9 + :prefix: (5.9. + :suffix: ) :start: 3 Title 1 @@ -346,28 +347,28 @@ u"""\ <section id="title-1" name="title 1"> <title auto="1"> <generated class="sectnum"> - 5.9.3\u00a0\u00a0\u00a0 + (5.9.3)\u00a0\u00a0\u00a0 Title 1 <paragraph> Paragraph 1. <section id="title-2" name="title 2"> <title auto="1"> <generated class="sectnum"> - 5.9.3.1\u00a0\u00a0\u00a0 + (5.9.3.1)\u00a0\u00a0\u00a0 Title 2 <paragraph> Paragraph 2. <section id="title-3" name="title 3"> <title auto="1"> <generated class="sectnum"> - 5.9.3.1.1\u00a0\u00a0\u00a0 + (5.9.3.1.1)\u00a0\u00a0\u00a0 Title 3 <paragraph> Paragraph 3. <section id="title-4" name="title 4"> <title auto="1"> <generated class="sectnum"> - 5.9.3.2\u00a0\u00a0\u00a0 + (5.9.3.2)\u00a0\u00a0\u00a0 Title 4 <paragraph> Paragraph 4. -- cgit v1.2.1 From 5c1ef3d165e68715f8dd4c226e59a60d9610ca58 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sun, 29 Aug 2004 19:30:56 +0000 Subject: reordering so that TestCases appear before TestSuites git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2547 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/DocutilsTestSupport.py | 206 ++++++++++++++++++++++---------------------- 1 file changed, 103 insertions(+), 103 deletions(-) (limited to 'test') diff --git a/test/DocutilsTestSupport.py b/test/DocutilsTestSupport.py index 7525141f3..fc4e97d6f 100644 --- a/test/DocutilsTestSupport.py +++ b/test/DocutilsTestSupport.py @@ -81,6 +81,64 @@ class DevNull: pass +class CustomTestCase(unittest.TestCase): + + compare = docutils_difflib.Differ().compare + """Comparison method shared by all subclasses.""" + + def __init__(self, method_name, input, expected, id, + run_in_debugger=0, short_description=None): + """ + Initialise the CustomTestCase. + + Arguments: + + method_name -- name of test method to run. + input -- input to the parser. + expected -- expected output from the parser. + id -- unique test identifier, used by the test framework. + run_in_debugger -- if true, run this test under the pdb debugger. + short_description -- override to default test description. + """ + self.id = id + self.input = input + self.expected = expected + self.run_in_debugger = run_in_debugger + # Ring your mother. + unittest.TestCase.__init__(self, method_name) + + def __str__(self): + """ + Return string conversion. Overridden to give test id, in addition to + method name. + """ + return '%s; %s' % (self.id, unittest.TestCase.__str__(self)) + + def __repr__(self): + return "<%s %s>" % (self.id, unittest.TestCase.__repr__(self)) + + def compare_output(self, input, output, expected): + """`input`, `output`, and `expected` should all be strings.""" + if type(input) == UnicodeType: + input = input.encode('raw_unicode_escape') + if type(output) == UnicodeType: + output = output.encode('raw_unicode_escape') + if type(expected) == UnicodeType: + expected = expected.encode('raw_unicode_escape') + try: + self.assertEquals('\n' + output, '\n' + expected) + except AssertionError: + print >>sys.stderr, '\n%s\ninput:' % (self,) + print >>sys.stderr, input + print >>sys.stderr, '-: expected\n+: output' + print >>sys.stderr, ''.join(self.compare(expected.splitlines(1), + output.splitlines(1))) + raise + + def skip_test(self): + print >>sys.stderr, '%s: Test skipped' % self + + class CustomTestSuite(unittest.TestSuite): """ @@ -160,109 +218,6 @@ class CustomTestSuite(unittest.TestSuite): pass -class CustomTestCase(unittest.TestCase): - - compare = docutils_difflib.Differ().compare - """Comparison method shared by all subclasses.""" - - def __init__(self, method_name, input, expected, id, - run_in_debugger=0, short_description=None): - """ - Initialise the CustomTestCase. - - Arguments: - - method_name -- name of test method to run. - input -- input to the parser. - expected -- expected output from the parser. - id -- unique test identifier, used by the test framework. - run_in_debugger -- if true, run this test under the pdb debugger. - short_description -- override to default test description. - """ - self.id = id - self.input = input - self.expected = expected - self.run_in_debugger = run_in_debugger - # Ring your mother. - unittest.TestCase.__init__(self, method_name) - - def __str__(self): - """ - Return string conversion. Overridden to give test id, in addition to - method name. - """ - return '%s; %s' % (self.id, unittest.TestCase.__str__(self)) - - def __repr__(self): - return "<%s %s>" % (self.id, unittest.TestCase.__repr__(self)) - - def compare_output(self, input, output, expected): - """`input`, `output`, and `expected` should all be strings.""" - if type(input) == UnicodeType: - input = input.encode('raw_unicode_escape') - if type(output) == UnicodeType: - output = output.encode('raw_unicode_escape') - if type(expected) == UnicodeType: - expected = expected.encode('raw_unicode_escape') - try: - self.assertEquals('\n' + output, '\n' + expected) - except AssertionError: - print >>sys.stderr, '\n%s\ninput:' % (self,) - print >>sys.stderr, input - print >>sys.stderr, '-: expected\n+: output' - print >>sys.stderr, ''.join(self.compare(expected.splitlines(1), - output.splitlines(1))) - raise - - def skip_test(self): - print >>sys.stderr, '%s: Test skipped' % self - - -class TransformTestSuite(CustomTestSuite): - - """ - A collection of TransformTestCases. - - A TransformTestSuite instance manufactures TransformTestCases, - keeps track of them, and provides a shared test fixture (a-la - setUp and tearDown). - """ - - def __init__(self, parser): - self.parser = parser - """Parser shared by all test cases.""" - - CustomTestSuite.__init__(self) - - def generateTests(self, dict, dictname='totest', - testmethod='test_transforms'): - """ - Stock the suite with test cases generated from a test data dictionary. - - Each dictionary key (test type's name) maps to a list of transform - classes and list of tests. Each test is a list: input, expected - output, optional modifier. The optional third entry, a behavior - modifier, can be 0 (temporarily disable this test) or 1 (run this test - under the pdb debugger). Tests should be self-documenting and not - require external comments. - """ - for name, (transforms, cases) in dict.items(): - for casenum in range(len(cases)): - case = cases[casenum] - run_in_debugger = 0 - if len(case)==3: - if case[2]: - run_in_debugger = 1 - else: - continue - self.addTestCase( - TransformTestCase, testmethod, - transforms=transforms, parser=self.parser, - input=case[0], expected=case[1], - id='%s[%r][%s]' % (dictname, name, casenum), - run_in_debugger=run_in_debugger) - - class TransformTestCase(CustomTestCase): """ @@ -326,6 +281,51 @@ class TransformTestCase(CustomTestCase): self.compare_output(self.input, output, self.expected) +class TransformTestSuite(CustomTestSuite): + + """ + A collection of TransformTestCases. + + A TransformTestSuite instance manufactures TransformTestCases, + keeps track of them, and provides a shared test fixture (a-la + setUp and tearDown). + """ + + def __init__(self, parser): + self.parser = parser + """Parser shared by all test cases.""" + + CustomTestSuite.__init__(self) + + def generateTests(self, dict, dictname='totest', + testmethod='test_transforms'): + """ + Stock the suite with test cases generated from a test data dictionary. + + Each dictionary key (test type's name) maps to a list of transform + classes and list of tests. Each test is a list: input, expected + output, optional modifier. The optional third entry, a behavior + modifier, can be 0 (temporarily disable this test) or 1 (run this test + under the pdb debugger). Tests should be self-documenting and not + require external comments. + """ + for name, (transforms, cases) in dict.items(): + for casenum in range(len(cases)): + case = cases[casenum] + run_in_debugger = 0 + if len(case)==3: + if case[2]: + run_in_debugger = 1 + else: + continue + self.addTestCase( + TransformTestCase, testmethod, + transforms=transforms, parser=self.parser, + input=case[0], expected=case[1], + id='%s[%r][%s]' % (dictname, name, casenum), + run_in_debugger=run_in_debugger) + + class ParserTestCase(CustomTestCase): """ -- cgit v1.2.1 From 0c6e28c65c75920ad60b651a4535d90fc87013dd Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sun, 29 Aug 2004 21:55:26 +0000 Subject: added some comments, did some cleanup; David Goodger, could you review this? git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2549 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/DocutilsTestSupport.py | 63 ++++++++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 29 deletions(-) (limited to 'test') diff --git a/test/DocutilsTestSupport.py b/test/DocutilsTestSupport.py index fc4e97d6f..0e6d3a08c 100644 --- a/test/DocutilsTestSupport.py +++ b/test/DocutilsTestSupport.py @@ -17,18 +17,18 @@ Exports the following: - `tableparser` is 'docutils.parsers.rst.tableparser' :Classes: - - `CustomTestSuite` - `CustomTestCase` - - `TransformTestSuite` + - `CustomTestSuite` - `TransformTestCase` - - `ParserTestSuite` + - `TransformTestSuite` - `ParserTestCase` - - `PEPParserTestSuite` + - `ParserTestSuite` - `PEPParserTestCase` - - `GridTableParserTestSuite` + - `PEPParserTestSuite` - `GridTableParserTestCase` - - `SimpleTableParserTestSuite` + - `GridTableParserTestSuite` - `SimpleTableParserTestCase` + - `SimpleTableParserTestSuite` - `WriterPublishTestCase` - `LatexWriterPublishTestCase` - `PseudoXMLWriterPublishTestCase` @@ -82,6 +82,14 @@ class DevNull: class CustomTestCase(unittest.TestCase): + + """ + Helper class, providing extended functionality over unittest.TestCase. + + This isn't specific to Docutils but of general use when dealing + with large amounts of text. In particular, see the compare_output + method and the parameter list of __init__. + """ compare = docutils_difflib.Differ().compare """Comparison method shared by all subclasses.""" @@ -104,6 +112,10 @@ class CustomTestCase(unittest.TestCase): self.input = input self.expected = expected self.run_in_debugger = run_in_debugger + + # XXX What do we do with short_description? It isn't used at + # all. + # Ring your mother. unittest.TestCase.__init__(self, method_name) @@ -135,15 +147,15 @@ class CustomTestCase(unittest.TestCase): output.splitlines(1))) raise - def skip_test(self): - print >>sys.stderr, '%s: Test skipped' % self - class CustomTestSuite(unittest.TestSuite): """ - A collection of custom TestCases. + A collection of CustomTestCases. + Provides test suite ID generation. + + XXX Any other reason why we need this class? """ id = '' @@ -188,13 +200,13 @@ class CustomTestSuite(unittest.TestSuite): id=None, run_in_debugger=0, short_description=None, **kwargs): """ - Create a custom TestCase in the CustomTestSuite. + Create a CustomTestCase in the CustomTestSuite. Also return it, just in case. Arguments: - test_case_class -- - method_name -- + test_case_class -- the CustomTestCase to add + method_name -- a string; CustomTestCase.method_name is the test input -- input to the parser. expected -- expected output from the parser. id -- unique test identifier, used by the test framework. @@ -302,12 +314,13 @@ class TransformTestSuite(CustomTestSuite): """ Stock the suite with test cases generated from a test data dictionary. - Each dictionary key (test type's name) maps to a list of transform - classes and list of tests. Each test is a list: input, expected - output, optional modifier. The optional third entry, a behavior - modifier, can be 0 (temporarily disable this test) or 1 (run this test - under the pdb debugger). Tests should be self-documenting and not - require external comments. + Each dictionary key (test type's name) maps to a tuple, whose + first item is a list of transform classes and whose second + item is a list of tests. Each test is a list: input, expected + output, optional modifier. The optional third entry, a + behavior modifier, can be 0 (temporarily disable this test) or + 1 (run this test under the pdb debugger). Tests should be + self-documenting and not require external comments. """ for name, (transforms, cases) in dict.items(): for casenum in range(len(cases)): @@ -604,20 +617,12 @@ class WriterPublishTestCase(CustomTestCase, docutils.SettingsSpec): class LatexWriterPublishTestCase(WriterPublishTestCase): - - """ - Test case for Latex writer. - """ - + """Test case for Latex writer.""" writer_name = 'latex' class PseudoXMLWriterPublishTestCase(WriterPublishTestCase): - - """ - Test case for pseudo-XML writer. - """ - + """Test case for pseudo-XML writer.""" writer_name = 'pseudoxml' -- cgit v1.2.1 From 6c23b2962f4d2738522df31f13c8fad3c373973c Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Tue, 31 Aug 2004 15:27:47 +0000 Subject: trying to fix the slash/backslash bug occuring on Windows systems git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2550 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_functional.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'test') diff --git a/test/test_functional.py b/test/test_functional.py index c8413be73..091532dc4 100755 --- a/test/test_functional.py +++ b/test/test_functional.py @@ -23,12 +23,16 @@ import DocutilsTestSupport # Ugly magic to determine the test directory. -testroot = os.path.dirname(DocutilsTestSupport.__file__) +testroot = os.path.dirname(DocutilsTestSupport.__file__) or '.' datadir = 'functional' """The directory to store the data needed for the functional tests.""" +def join_path(*args): + return '/'.join(args) or '.' + + class FunctionalTestSuite(DocutilsTestSupport.CustomTestSuite): """Test suite containing test cases for all config files.""" @@ -38,7 +42,7 @@ class FunctionalTestSuite(DocutilsTestSupport.CustomTestSuite): DocutilsTestSupport.CustomTestSuite.__init__(self) os.chdir(testroot) self.added = 0 - os.path.walk(os.path.join(datadir, 'tests'), self.walker, None) + os.path.walk(join_path(datadir, 'tests'), self.walker, None) assert self.added, 'No functional tests found.' def walker(self, dummy, dirname, names): @@ -50,7 +54,7 @@ class FunctionalTestSuite(DocutilsTestSupport.CustomTestSuite): """ for name in names: if name.endswith('.py') and not name.startswith('_'): - config_file_full_path = os.path.join(dirname, name) + config_file_full_path = join_path(dirname, name) self.addTestCase(FunctionalTestCase, 'test', None, None, id=config_file_full_path, configfile=config_file_full_path) @@ -80,7 +84,7 @@ class FunctionalTestCase(DocutilsTestSupport.CustomTestCase): params['settings_overrides'] = {'_disable_config': 1} # Read the variables set in the default config file and in # the current config file into params: - execfile(os.path.join(datadir, 'tests', '_default.py'), params) + execfile(join_path(datadir, 'tests', '_default.py'), params) execfile(self.configfile, params) # Check for required settings: assert params.has_key('test_source'),\ @@ -89,14 +93,14 @@ class FunctionalTestCase(DocutilsTestSupport.CustomTestCase): "No 'test_destination' supplied in " + self.configfile # Set source_path and destination_path if not given: params.setdefault('source_path', - os.path.join(datadir, 'input', + join_path(datadir, 'input', params['test_source'])) # Path for actual output: params.setdefault('destination_path', - os.path.join(datadir, 'output', + join_path(datadir, 'output', params['test_destination'])) # Path for expected output: - expected_path = os.path.join(datadir, 'expected', + expected_path = join_path(datadir, 'expected', params['test_destination']) # test_source and test_destination aren't needed any more: del params['test_source'] -- cgit v1.2.1 From 0e4e4fc6de0df34ca437f7ed4d3a8b8db810a198 Mon Sep 17 00:00:00 2001 From: grubert <grubert@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sun, 5 Sep 2004 17:16:26 +0000 Subject: New option "font-encoding". git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2552 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_latex.tex | 13 +++++++------ test/test_writers/test_latex2e.py | 1 + 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_latex.tex b/test/functional/expected/standalone_rst_latex.tex index ec21353eb..965892d6d 100644 --- a/test/functional/expected/standalone_rst_latex.tex +++ b/test/functional/expected/standalone_rst_latex.tex @@ -1,5 +1,6 @@ \documentclass[10pt,a4paper,english]{article} \usepackage{babel} +\usepackage{ae} \usepackage{shortvrb} \usepackage[latin1]{inputenc} \usepackage{tabularx} @@ -274,13 +275,13 @@ and explicit roles for \emph{standard} \textbf{inline} % DO NOT RE-WRAP THE FOLLOWING PARAGRAPH! Let's test wrapping and whitespace significance in inline literals: -\texttt{This is an example of --inline-literal --text, --including some-- -strangely--hyphenated-words. Adjust-the-width-of-your-browser-window -to see how the text is wrapped. -- ---- -------- Now note the +\texttt{This is an example of -{}-inline-literal -{}-text, -{}-including some-{}- +strangely-{}-hyphenated-words. Adjust-the-width-of-your-browser-window +to see how the text is wrapped. -{}- -{}-{}-{}- -{}-{}-{}-{}-{}-{}-{}- Now note the spacing between the words of this sentence (words should be grouped in pairs).} -If the \texttt{--pep-references} option was supplied, there should be a +If the \texttt{-{}-pep-references} option was supplied, there should be a live link to PEP 258 here. @@ -535,7 +536,7 @@ description. \subsection*{2.7~~~Literal Blocks} Literal blocks are indicated with a double-colon (``::'') at the end of -the preceding paragraph (over there \texttt{-->}). They can be indented: +the preceding paragraph (over there \texttt{-{}->}). They can be indented: \begin{quote}{\ttfamily \raggedright \noindent if~literal{\underline{~}}block:~\\ ~~~~text~=~'is~left~as-is'~\\ @@ -545,7 +546,7 @@ if~literal{\underline{~}}block:~\\ Or they can be quoted without indentation: \begin{quote}{\ttfamily \raggedright \noindent ->>~Great~idea!~\\ +>{}>~Great~idea!~\\ >~\\ >~Why~didn't~I~think~of~that? }\end{quote} diff --git a/test/test_writers/test_latex2e.py b/test/test_writers/test_latex2e.py index de74a24f3..948a77b0b 100644 --- a/test/test_writers/test_latex2e.py +++ b/test/test_writers/test_latex2e.py @@ -21,6 +21,7 @@ def suite(): latex_head = """\ \\documentclass[10pt,a4paper,english]{article} \\usepackage{babel} +\\usepackage{ae} \\usepackage{shortvrb} \\usepackage[latin1]{inputenc} \\usepackage{tabularx} -- cgit v1.2.1 From fc0939b7cc8a9eef961e2301df8bee0f9bebfb7f Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Tue, 7 Sep 2004 11:11:01 +0000 Subject: added LaTeX tests git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2555 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/input/data/latex.txt | 16 ++++++++++++++++ test/functional/input/standalone_rst_latex.txt | 1 + 2 files changed, 17 insertions(+) create mode 100644 test/functional/input/data/latex.txt (limited to 'test') diff --git a/test/functional/input/data/latex.txt b/test/functional/input/data/latex.txt new file mode 100644 index 000000000..be47a51c9 --- /dev/null +++ b/test/functional/input/data/latex.txt @@ -0,0 +1,16 @@ +Tests for the LaTeX writer +========================== + +Monospaced non-alphanumeric characters +-------------------------------------- + +These are all ASCII characters except a-zA-Z0-9 and space: + +``!!!"""###$$$%%%&&&'''((()))***+++,,,---...///:::`` + +``;;;<<<===>>>???@@@[[[\\\]]]^^^___```{{{|||}}}~~~`` + +``xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`` + +The two lines of non-alphanumeric characters should both have the same +width as the third line. diff --git a/test/functional/input/standalone_rst_latex.txt b/test/functional/input/standalone_rst_latex.txt index 1d78c0b7b..76b8c3e25 100644 --- a/test/functional/input/standalone_rst_latex.txt +++ b/test/functional/input/standalone_rst_latex.txt @@ -1,3 +1,4 @@ .. include:: data/standard.txt .. include:: data/table_colspan.txt +.. include:: data/latex.txt .. include:: data/errors.txt -- cgit v1.2.1 From 10c6afc0a3d3db729e156905bc93a2674f094315 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Tue, 7 Sep 2004 11:13:40 +0000 Subject: updated git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2557 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_latex.tex | 43 +++++++++++++++++++---- 1 file changed, 37 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_latex.tex b/test/functional/expected/standalone_rst_latex.tex index 965892d6d..03b261d17 100644 --- a/test/functional/expected/standalone_rst_latex.tex +++ b/test/functional/expected/standalone_rst_latex.tex @@ -193,7 +193,13 @@ reStructuredText construct. \end{list} -\item {} \href{\#error-handling}{3~~~Error Handling} +\item {} \href{\#tests-for-the-latex-writer}{3~~~Tests for the LaTeX writer} +\begin{list}{}{} +\item {} \href{\#monospaced-non-alphanumeric-characters}{3.1~~~Monospaced non-alphanumeric characters} + +\end{list} + +\item {} \href{\#error-handling}{4~~~Error Handling} \end{list} @@ -538,10 +544,10 @@ description. Literal blocks are indicated with a double-colon (``::'') at the end of the preceding paragraph (over there \texttt{-{}->}). They can be indented: \begin{quote}{\ttfamily \raggedright \noindent -if~literal{\underline{~}}block:~\\ +if~literal{\_}block:~\\ ~~~~text~=~'is~left~as-is'~\\ -~~~~spaces{\underline{~}}and{\underline{~}}linebreaks~=~'are~preserved'~\\ -~~~~markup{\underline{~}}processing~=~None +~~~~spaces{\_}and{\_}linebreaks~=~'are~preserved'~\\ +~~~~markup{\_}processing~=~None }\end{quote} Or they can be quoted without indentation: @@ -1030,11 +1036,36 @@ True \end{longtable} +%___________________________________________________________________________ + +\hypertarget{tests-for-the-latex-writer}{} +\pdfbookmark[0]{3~~~Tests for the LaTeX writer}{tests-for-the-latex-writer} +\section*{3~~~Tests for the LaTeX writer} + + +%___________________________________________________________________________ + +\hypertarget{monospaced-non-alphanumeric-characters}{} +\pdfbookmark[1]{3.1~~~Monospaced non-alphanumeric characters}{monospaced-non-alphanumeric-characters} +\subsection*{3.1~~~Monospaced non-alphanumeric characters} + +These are all ASCII characters except a-zA-Z0-9 and space: + +\texttt{!!!"{}"{}"{\#}{\#}{\#}{\$}{\$}{\$}{\%}{\%}{\%}{\&}{\&}{\&}'{}'{}'((()))***+++,{},{},-{}-{}-...///:::} + +\texttt{;;;<{}<{}<===>{}>{}>???@@@{[}{[}{[}{\textbackslash}{\textbackslash}{\textbackslash}]]]{\textasciicircum}{\textasciicircum}{\textasciicircum}{\_}{\_}{\_}`{}`{}`{\{}{\{}{\{}|||{\}}{\}}{\}}{\textasciitilde}{\textasciitilde}{\textasciitilde}} + +\texttt{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} + +The two lines of non-alphanumeric characters should both have the same +width as the third line. + + %___________________________________________________________________________ \hypertarget{error-handling}{} -\pdfbookmark[0]{3~~~Error Handling}{error-handling} -\section*{3~~~Error Handling} +\pdfbookmark[0]{4~~~Error Handling}{error-handling} +\section*{4~~~Error Handling} Any errors caught during processing will generate system messages. -- cgit v1.2.1 From cffdad13694b6eefeadf291950be7a06388c58d7 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Tue, 7 Sep 2004 13:32:17 +0000 Subject: updated test git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2558 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_writers/test_latex2e.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/test_writers/test_latex2e.py b/test/test_writers/test_latex2e.py index 948a77b0b..77fced315 100644 --- a/test/test_writers/test_latex2e.py +++ b/test/test_writers/test_latex2e.py @@ -249,9 +249,9 @@ Inside literal blocks quotes should be left untouched (use only two quotes in test code makes life easier for the python interpreter running the test): \\begin{quote}{\\ttfamily \\raggedright \\noindent -""~\\\\ +"{}"~\\\\ This~is~left~"untouched"~also~*this*.~\\\\ -"" +"{}" }\\end{quote} \\begin{quote}{\\ttfamily \\raggedright \\noindent should~get~"quotes"~and~\\emph{italics}. -- cgit v1.2.1 From 151d9d61630c16ec0bf11441338413b2614a4a41 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Tue, 7 Sep 2004 17:53:23 +0000 Subject: added aeguill package git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2560 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_latex.tex | 1 + test/test_writers/test_latex2e.py | 1 + 2 files changed, 2 insertions(+) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_latex.tex b/test/functional/expected/standalone_rst_latex.tex index 03b261d17..6393c9079 100644 --- a/test/functional/expected/standalone_rst_latex.tex +++ b/test/functional/expected/standalone_rst_latex.tex @@ -1,6 +1,7 @@ \documentclass[10pt,a4paper,english]{article} \usepackage{babel} \usepackage{ae} +\usepackage{aeguill} \usepackage{shortvrb} \usepackage[latin1]{inputenc} \usepackage{tabularx} diff --git a/test/test_writers/test_latex2e.py b/test/test_writers/test_latex2e.py index 77fced315..8ef958e2a 100644 --- a/test/test_writers/test_latex2e.py +++ b/test/test_writers/test_latex2e.py @@ -22,6 +22,7 @@ latex_head = """\ \\documentclass[10pt,a4paper,english]{article} \\usepackage{babel} \\usepackage{ae} +\\usepackage{aeguill} \\usepackage{shortvrb} \\usepackage[latin1]{inputenc} \\usepackage{tabularx} -- cgit v1.2.1 From 39aebfa76a0130a96d3ba65fa973069bc1fe96f4 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Wed, 8 Sep 2004 19:48:26 +0000 Subject: fixed bug when multiple "class" directives are applied git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2561 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms/test_class.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test') diff --git a/test/test_transforms/test_class.py b/test/test_transforms/test_class.py index fe570656c..119445d91 100755 --- a/test/test_transforms/test_class.py +++ b/test/test_transforms/test_class.py @@ -96,6 +96,17 @@ Paragraph <literal_block xml:space="preserve"> .. class:: 99 """], +["""\ +.. class:: one +.. class:: two + +multiple class values may be assigned to one element +""", +"""\ +<document source="test data"> + <paragraph class="one two"> + multiple class values may be assigned to one element +"""], ]) -- cgit v1.2.1 From d2edd67b9b6308dc91f914c0d765cec908174e10 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sat, 11 Sep 2004 11:20:30 +0000 Subject: added test for unicode strings for csv-table git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2566 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../test_rst/test_directives/test_tables.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_directives/test_tables.py b/test/test_parsers/test_rst/test_directives/test_tables.py index 0bd44a8a5..51d8a6ee4 100755 --- a/test/test_parsers/test_rst/test_directives/test_tables.py +++ b/test/test_parsers/test_rst/test_directives/test_tables.py @@ -1,4 +1,5 @@ #! /usr/bin/env python +# -*- coding: iso-8859-1 -*- # Author: David Goodger # Contact: goodger@python.org @@ -105,7 +106,7 @@ if csv: totest['csv-table'] = [ ["""\ .. csv-table:: inline with integral header - :widths: 10,20,30 + :widths: 10, 20, 30 :header-rows: 1 "Treat", "Quantity", "Description" @@ -345,6 +346,24 @@ if csv: <entry> <entry> """], +[u"""\ +.. csv-table:: non-ASCII characters + + Heiz\xf6lr\xfccksto\xdfabd\xe4mpfung +""", +u"""\ +<document source="test data"> + <table> + <title> + non-ASCII characters + <tgroup cols="1"> + <colspec colwidth="100"> + <tbody> + <row> + <entry> + <paragraph> + Heiz\xf6lr\xfccksto\xdfabd\xe4mpfung +"""], ["""\ .. csv-table:: empty """, -- cgit v1.2.1 From 9882a30cccdd1eb70fc137b6859083624cca3b85 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sat, 11 Sep 2004 11:24:34 +0000 Subject: removed unneeded -*- coding -*- git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2567 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_parsers/test_rst/test_directives/test_tables.py | 1 - 1 file changed, 1 deletion(-) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_directives/test_tables.py b/test/test_parsers/test_rst/test_directives/test_tables.py index 51d8a6ee4..e3def1aa0 100755 --- a/test/test_parsers/test_rst/test_directives/test_tables.py +++ b/test/test_parsers/test_rst/test_directives/test_tables.py @@ -1,5 +1,4 @@ #! /usr/bin/env python -# -*- coding: iso-8859-1 -*- # Author: David Goodger # Contact: goodger@python.org -- cgit v1.2.1 From 2f501770ad9f819f37a18f5c0c0dd50e19aae9e7 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sun, 12 Sep 2004 16:21:16 +0000 Subject: added quotation marks in field name and field body git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2584 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_html4css1.html | 4 ++-- test/functional/expected/standalone_rst_latex.tex | 4 ++-- test/functional/input/data/standard.txt | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index 8b55806d5..1189bf068 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -58,9 +58,9 @@ destroy, or improve it, quote it at length, excerpt, incorporate, collate, fold, staple, or mutilate it, or do anything else to it that your or anyone else's heart desires.</td></tr> -<tr class="field"><th class="docinfo-name">field name:</th><td class="field-body">This is a generic bibliographic field.</td> +<tr class="field"><th class="docinfo-name">field name:</th><td class="field-body">This is a "generic bibliographic field".</td> </tr> -<tr class="field"><th class="docinfo-name">field name 2:</th><td class="field-body"><p class="first">Generic bibliographic fields may contain multiple body elements.</p> +<tr class="field"><th class="docinfo-name">field name "2":</th><td class="field-body"><p class="first">Generic bibliographic fields may contain multiple body elements.</p> <p class="last">Like this.</p> </td> </tr> diff --git a/test/functional/expected/standalone_rst_latex.tex b/test/functional/expected/standalone_rst_latex.tex index 6393c9079..e7712f123 100644 --- a/test/functional/expected/standalone_rst_latex.tex +++ b/test/functional/expected/standalone_rst_latex.tex @@ -95,8 +95,8 @@ incorporate, collate, fold, staple, or mutilate it, or do anything else to it that your or anyone else's heart desires. \\ \textbf{field name}: & - This is a generic bibliographic field. \\ -\textbf{field name 2}: & + This is a ``generic bibliographic field''. \\ +\textbf{field name ``2''}: & Generic bibliographic fields may contain multiple body elements. Like this. \\ diff --git a/test/functional/input/data/standard.txt b/test/functional/input/data/standard.txt index bf4d562f9..770efe072 100644 --- a/test/functional/input/data/standard.txt +++ b/test/functional/input/data/standard.txt @@ -32,8 +32,8 @@ incorporate, collate, fold, staple, or mutilate it, or do anything else to it that your or anyone else's heart desires. -:field name: This is a generic bibliographic field. -:field name 2: +:field name: This is a "generic bibliographic field". +:field name "2": Generic bibliographic fields may contain multiple body elements. Like this. -- cgit v1.2.1 From 439e10c3dc34a84fe174a288bfbefd7491c9f070 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sun, 12 Sep 2004 21:18:45 +0000 Subject: updated git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2594 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../test_rst/test_directives/test_tables.py | 110 ++++++++++++++++++--- 1 file changed, 97 insertions(+), 13 deletions(-) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_directives/test_tables.py b/test/test_parsers/test_rst/test_directives/test_tables.py index e3def1aa0..50a03f2e5 100755 --- a/test/test_parsers/test_rst/test_directives/test_tables.py +++ b/test/test_parsers/test_rst/test_directives/test_tables.py @@ -12,6 +12,7 @@ Tests for tables.py directives. from __init__ import DocutilsTestSupport +import os try: import csv except ImportError: @@ -23,6 +24,10 @@ def suite(): s.generateTests(totest) return s +mydir = os.path.dirname(suite.func_code.co_filename) +utf_16_csv = os.path.join(mydir, 'utf-16.csv') +utf_16_csv_rel = DocutilsTestSupport.utils.relative_path(None, utf_16_csv) + totest = {} totest['table'] = [ @@ -101,7 +106,10 @@ totest['table'] = [ """], ] -if csv: +if not csv: + print ('Tests of "csv-table" directive skipped; ' + 'Python 2.3 or higher required.') +else: totest['csv-table'] = [ ["""\ .. csv-table:: inline with integral header @@ -388,7 +396,7 @@ u"""\ <literal_block xml:space="preserve"> .. csv-table:: insufficient header row data :header-rows: 2 - + \n\ some, csv, data """], ["""\ @@ -405,7 +413,7 @@ u"""\ <literal_block xml:space="preserve"> .. csv-table:: insufficient body data :header-rows: 1 - + \n\ some, csv, data """], ["""\ @@ -422,7 +430,7 @@ u"""\ <literal_block xml:space="preserve"> .. csv-table:: content and external :file: bogus.csv - + \n\ some, csv, data """], ["""\ @@ -449,7 +457,7 @@ u"""\ <document source="test data"> <table> <title> - error in the + error in the \n\ <problematic id="id2" refid="id1"> * title @@ -514,7 +522,7 @@ u"""\ <literal_block xml:space="preserve"> .. csv-table:: column mismatch :widths: 10,20 - + \n\ some, csv, data """], ["""\ @@ -538,7 +546,7 @@ u"""\ <literal_block xml:space="preserve"> .. csv-table:: bad column widths :widths: 10,y,z - + \n\ some, csv, data <system_message level="3" line="6" source="test data" type="ERROR"> <paragraph> @@ -548,7 +556,7 @@ u"""\ <literal_block xml:space="preserve"> .. csv-table:: bad column widths :widths: 0 0 0 - + \n\ some, csv, data """], ["""\ @@ -686,7 +694,7 @@ u"""\ newline inside string <literal_block xml:space="preserve"> .. csv-table:: bad CSV data - + \n\ "bad", \"csv, data """], ["""\ @@ -704,13 +712,89 @@ u"""\ <literal_block xml:space="preserve"> .. csv-table:: bad CSV header data :header: "bad", \"csv, data - + \n\ good, csv, data """], +["""\ +.. csv-table:: bad encoding + :file: %s + :encoding: latin-1 + +(7- and 8-bit text encoded as UTF-16 has lots of null/zero bytes.) +""" % utf_16_csv, +"""\ +<document source="test data"> + <system_message level="3" line="1" source="test data" type="ERROR"> + <paragraph> + Error with CSV data in "csv-table" directive: + string with NUL bytes + <literal_block xml:space="preserve"> + .. csv-table:: bad encoding + :file: %s + :encoding: latin-1 + <paragraph> + (7- and 8-bit text encoded as UTF-16 has lots of null/zero bytes.) +""" % utf_16_csv], +["""\ +.. csv-table:: good encoding + :file: %s + :encoding: utf-16 + :header-rows: 1 +""" % utf_16_csv, +u"""\ +<document source="test data"> + <table> + <title> + good encoding + <tgroup cols="3"> + <colspec colwidth="33"> + <colspec colwidth="33"> + <colspec colwidth="33"> + <thead> + <row> + <entry> + <paragraph> + Treat + <entry> + <paragraph> + Quantity + <entry> + <paragraph> + Description + <tbody> + <row> + <entry> + <paragraph> + Albatr\u00b0\u00df + <entry> + <paragraph> + 2.99 + <entry> + <paragraph> + \u00a1On a \u03c3\u03c4\u03b9\u03ba! + <row> + <entry> + <paragraph> + Crunchy Frog + <entry> + <paragraph> + 1.49 + <entry> + <paragraph> + If we took the b\u00f6nes out, it wouldn\u2019t be + crunchy, now would it? + <row> + <entry> + <paragraph> + Gannet Ripple + <entry> + <paragraph> + 1.99 + <entry> + <paragraph> + \u00bfOn a \u03c3\u03c4\u03b9\u03ba? +"""], ] -else: - print ('Tests of "csv-table" directive skipped; ' - 'Python 2.3 or higher required.') if __name__ == '__main__': -- cgit v1.2.1 From cdcc5485b4d7e01896dfbfe495881ddb1dc68e3a Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sun, 12 Sep 2004 21:21:50 +0000 Subject: test data for encoded external CSV table git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2595 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_parsers/test_rst/test_directives/utf-16.csv | Bin 0 -> 386 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 test/test_parsers/test_rst/test_directives/utf-16.csv (limited to 'test') diff --git a/test/test_parsers/test_rst/test_directives/utf-16.csv b/test/test_parsers/test_rst/test_directives/utf-16.csv new file mode 100644 index 000000000..ba60d155e Binary files /dev/null and b/test/test_parsers/test_rst/test_directives/utf-16.csv differ -- cgit v1.2.1 From 8d705b3ca9aa64b640f5ece19e44cee6cc4d627d Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Mon, 13 Sep 2004 13:21:08 +0000 Subject: updated git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2601 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../expected/standalone_rst_html4css1.html | 146 ++++++++++----------- 1 file changed, 73 insertions(+), 73 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index 1189bf068..75f4397c4 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -84,71 +84,71 @@ They are transformed from section titles after parsing. --> <div class="contents topic" id="table-of-contents"> <p class="topic-title first"><a name="table-of-contents">Table of Contents</a></p> <ul class="auto-toc simple"> -<li><a class="reference" href="#structural-elements" id="id25" name="id25">1   Structural Elements</a><ul class="auto-toc"> -<li><a class="reference" href="#section-title" id="id26" name="id26">1.1   Section Title</a></li> -<li><a class="reference" href="#transitions" id="id27" name="id27">1.2   Transitions</a></li> +<li><a class="reference" href="#structural-elements" id="id25" name="id25">1   Structural Elements</a><ul class="auto-toc"> +<li><a class="reference" href="#section-title" id="id26" name="id26">1.1   Section Title</a></li> +<li><a class="reference" href="#transitions" id="id27" name="id27">1.2   Transitions</a></li> </ul> </li> -<li><a class="reference" href="#body-elements" id="id28" name="id28">2   Body Elements</a><ul class="auto-toc"> -<li><a class="reference" href="#paragraphs" id="id29" name="id29">2.1   Paragraphs</a><ul class="auto-toc"> -<li><a class="reference" href="#inline-markup" id="id30" name="id30">2.1.1   Inline Markup</a></li> +<li><a class="reference" href="#body-elements" id="id28" name="id28">2   Body Elements</a><ul class="auto-toc"> +<li><a class="reference" href="#paragraphs" id="id29" name="id29">2.1   Paragraphs</a><ul class="auto-toc"> +<li><a class="reference" href="#inline-markup" id="id30" name="id30">2.1.1   Inline Markup</a></li> </ul> </li> -<li><a class="reference" href="#bullet-lists" id="id31" name="id31">2.2   Bullet Lists</a></li> -<li><a class="reference" href="#enumerated-lists" id="id32" name="id32">2.3   Enumerated Lists</a></li> -<li><a class="reference" href="#definition-lists" id="id33" name="id33">2.4   Definition Lists</a></li> -<li><a class="reference" href="#field-lists" id="id34" name="id34">2.5   Field Lists</a></li> -<li><a class="reference" href="#option-lists" id="id35" name="id35">2.6   Option Lists</a></li> -<li><a class="reference" href="#literal-blocks" id="id36" name="id36">2.7   Literal Blocks</a></li> -<li><a class="reference" href="#block-quotes" id="id37" name="id37">2.8   Block Quotes</a></li> -<li><a class="reference" href="#doctest-blocks" id="id38" name="id38">2.9   Doctest Blocks</a></li> -<li><a class="reference" href="#footnotes" id="id39" name="id39">2.10   Footnotes</a></li> -<li><a class="reference" href="#citations" id="id40" name="id40">2.11   Citations</a></li> -<li><a class="reference" href="#targets" id="id41" name="id41">2.12   Targets</a><ul class="auto-toc"> -<li><a class="reference" href="#duplicate-target-names" id="id42" name="id42">2.12.1   Duplicate Target Names</a></li> -<li><a class="reference" href="#id18" id="id43" name="id43">2.12.2   Duplicate Target Names</a></li> +<li><a class="reference" href="#bullet-lists" id="id31" name="id31">2.2   Bullet Lists</a></li> +<li><a class="reference" href="#enumerated-lists" id="id32" name="id32">2.3   Enumerated Lists</a></li> +<li><a class="reference" href="#definition-lists" id="id33" name="id33">2.4   Definition Lists</a></li> +<li><a class="reference" href="#field-lists" id="id34" name="id34">2.5   Field Lists</a></li> +<li><a class="reference" href="#option-lists" id="id35" name="id35">2.6   Option Lists</a></li> +<li><a class="reference" href="#literal-blocks" id="id36" name="id36">2.7   Literal Blocks</a></li> +<li><a class="reference" href="#block-quotes" id="id37" name="id37">2.8   Block Quotes</a></li> +<li><a class="reference" href="#doctest-blocks" id="id38" name="id38">2.9   Doctest Blocks</a></li> +<li><a class="reference" href="#footnotes" id="id39" name="id39">2.10   Footnotes</a></li> +<li><a class="reference" href="#citations" id="id40" name="id40">2.11   Citations</a></li> +<li><a class="reference" href="#targets" id="id41" name="id41">2.12   Targets</a><ul class="auto-toc"> +<li><a class="reference" href="#duplicate-target-names" id="id42" name="id42">2.12.1   Duplicate Target Names</a></li> +<li><a class="reference" href="#id18" id="id43" name="id43">2.12.2   Duplicate Target Names</a></li> </ul> </li> -<li><a class="reference" href="#directives" id="id44" name="id44">2.13   Directives</a><ul class="auto-toc"> -<li><a class="reference" href="#document-parts" id="id45" name="id45">2.13.1   Document Parts</a></li> -<li><a class="reference" href="#images" id="id46" name="id46">2.13.2   Images</a></li> -<li><a class="reference" href="#admonitions" id="id47" name="id47">2.13.3   Admonitions</a></li> -<li><a class="reference" href="#topics-sidebars-and-rubrics" id="id48" name="id48">2.13.4   Topics, Sidebars, and Rubrics</a></li> -<li><a class="reference" href="#target-footnotes" id="id49" name="id49">2.13.5   Target Footnotes</a></li> -<li><a class="reference" href="#line-blocks" id="id50" name="id50">2.13.6   Line Blocks</a></li> -<li><a class="reference" href="#replacement-text" id="id51" name="id51">2.13.7   Replacement Text</a></li> +<li><a class="reference" href="#directives" id="id44" name="id44">2.13   Directives</a><ul class="auto-toc"> +<li><a class="reference" href="#document-parts" id="id45" name="id45">2.13.1   Document Parts</a></li> +<li><a class="reference" href="#images" id="id46" name="id46">2.13.2   Images</a></li> +<li><a class="reference" href="#admonitions" id="id47" name="id47">2.13.3   Admonitions</a></li> +<li><a class="reference" href="#topics-sidebars-and-rubrics" id="id48" name="id48">2.13.4   Topics, Sidebars, and Rubrics</a></li> +<li><a class="reference" href="#target-footnotes" id="id49" name="id49">2.13.5   Target Footnotes</a></li> +<li><a class="reference" href="#line-blocks" id="id50" name="id50">2.13.6   Line Blocks</a></li> +<li><a class="reference" href="#replacement-text" id="id51" name="id51">2.13.7   Replacement Text</a></li> </ul> </li> -<li><a class="reference" href="#substitution-definitions" id="id52" name="id52">2.14   Substitution Definitions</a></li> -<li><a class="reference" href="#comments" id="id53" name="id53">2.15   Comments</a></li> -<li><a class="reference" href="#colspanning-tables" id="id54" name="id54">2.16   Colspanning tables</a></li> -<li><a class="reference" href="#rowspanning-tables" id="id55" name="id55">2.17   Rowspanning tables</a></li> -<li><a class="reference" href="#complex-tables" id="id56" name="id56">2.18   Complex tables</a></li> +<li><a class="reference" href="#substitution-definitions" id="id52" name="id52">2.14   Substitution Definitions</a></li> +<li><a class="reference" href="#comments" id="id53" name="id53">2.15   Comments</a></li> +<li><a class="reference" href="#colspanning-tables" id="id54" name="id54">2.16   Colspanning tables</a></li> +<li><a class="reference" href="#rowspanning-tables" id="id55" name="id55">2.17   Rowspanning tables</a></li> +<li><a class="reference" href="#complex-tables" id="id56" name="id56">2.18   Complex tables</a></li> </ul> </li> -<li><a class="reference" href="#error-handling" id="id57" name="id57">3   Error Handling</a></li> +<li><a class="reference" href="#error-handling" id="id57" name="id57">3   Error Handling</a></li> </ul> </div> <div class="section" id="structural-elements"> -<h1><a class="toc-backref" href="#id25" name="structural-elements">1   Structural Elements</a></h1> +<h1><a class="toc-backref" href="#id25" name="structural-elements">1   Structural Elements</a></h1> <div class="section" id="section-title"> -<h2><a class="toc-backref" href="#id26" name="section-title">1.1   Section Title</a></h2> +<h2><a class="toc-backref" href="#id26" name="section-title">1.1   Section Title</a></h2> <p>That's it, the text just above this line.</p> </div> <div class="section" id="transitions"> -<h2><a class="toc-backref" href="#id27" name="transitions">1.2   Transitions</a></h2> +<h2><a class="toc-backref" href="#id27" name="transitions">1.2   Transitions</a></h2> <p>Here's a transition:</p> <hr /> <p>It divides the section.</p> </div> </div> <div class="section" id="body-elements"> -<h1><a class="toc-backref" href="#id28" name="body-elements">2   Body Elements</a></h1> +<h1><a class="toc-backref" href="#id28" name="body-elements">2   Body Elements</a></h1> <div class="section" id="paragraphs"> -<h2><a class="toc-backref" href="#id29" name="paragraphs">2.1   Paragraphs</a></h2> +<h2><a class="toc-backref" href="#id29" name="paragraphs">2.1   Paragraphs</a></h2> <p>A paragraph.</p> <div class="section" id="inline-markup"> -<h3><a class="toc-backref" href="#id30" name="inline-markup">2.1.1   Inline Markup</a></h3> +<h3><a class="toc-backref" href="#id30" name="inline-markup">2.1.1   Inline Markup</a></h3> <p>Paragraphs contain text and may contain inline markup: <em>emphasis</em>, <strong>strong emphasis</strong>, <tt class="literal"><span class="pre">inline</span> <span class="pre">literals</span></tt>, standalone hyperlinks (<a class="reference" href="http://www.python.org">http://www.python.org</a>), external hyperlinks (<a class="reference" href="http://www.python.org/">Python</a> <a class="footnote-reference" href="#id21" id="id22" name="id22"><sup>5</sup></a>), internal @@ -179,7 +179,7 @@ live link to PEP 258 here.</p> </div> </div> <div class="section" id="bullet-lists"> -<h2><a class="toc-backref" href="#id31" name="bullet-lists">2.2   Bullet Lists</a></h2> +<h2><a class="toc-backref" href="#id31" name="bullet-lists">2.2   Bullet Lists</a></h2> <ul> <li><p class="first">A bullet list</p> <ul class="simple"> @@ -202,7 +202,7 @@ live link to PEP 258 here.</p> </ul> </div> <div class="section" id="enumerated-lists"> -<h2><a class="toc-backref" href="#id32" name="enumerated-lists">2.3   Enumerated Lists</a></h2> +<h2><a class="toc-backref" href="#id32" name="enumerated-lists">2.3   Enumerated Lists</a></h2> <ol class="arabic"> <li><p class="first">Arabic numerals.</p> <ol class="loweralpha simple"> @@ -235,7 +235,7 @@ live link to PEP 258 here.</p> </ol> </div> <div class="section" id="definition-lists"> -<h2><a class="toc-backref" href="#id33" name="definition-lists">2.4   Definition Lists</a></h2> +<h2><a class="toc-backref" href="#id33" name="definition-lists">2.4   Definition Lists</a></h2> <dl> <dt>Term</dt> <dd>Definition</dd> @@ -248,7 +248,7 @@ live link to PEP 258 here.</p> </dl> </div> <div class="section" id="field-lists"> -<h2><a class="toc-backref" href="#id34" name="field-lists">2.5   Field Lists</a></h2> +<h2><a class="toc-backref" href="#id34" name="field-lists">2.5   Field Lists</a></h2> <table class="field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> @@ -266,7 +266,7 @@ relative to the field marker.</p> </table> </div> <div class="section" id="option-lists"> -<h2><a class="toc-backref" href="#id35" name="option-lists">2.6   Option Lists</a></h2> +<h2><a class="toc-backref" href="#id35" name="option-lists">2.6   Option Lists</a></h2> <p>For listing command-line options:</p> <table class="option-list" frame="void" rules="none"> <col class="option" /> @@ -312,7 +312,7 @@ regardless of where it starts.</p> description.</p> </div> <div class="section" id="literal-blocks"> -<h2><a class="toc-backref" href="#id36" name="literal-blocks">2.7   Literal Blocks</a></h2> +<h2><a class="toc-backref" href="#id36" name="literal-blocks">2.7   Literal Blocks</a></h2> <p>Literal blocks are indicated with a double-colon ("::") at the end of the preceding paragraph (over there <tt class="literal"><span class="pre">--></span></tt>). They can be indented:</p> <pre class="literal-block"> @@ -329,7 +329,7 @@ if literal_block: </pre> </div> <div class="section" id="block-quotes"> -<h2><a class="toc-backref" href="#id37" name="block-quotes">2.8   Block Quotes</a></h2> +<h2><a class="toc-backref" href="#id37" name="block-quotes">2.8   Block Quotes</a></h2> <p>Block quotes consist of indented body elements:</p> <blockquote> <p>My theory by A. Elk. Brackets Miss, brackets. This theory goes @@ -341,7 +341,7 @@ own it, and what it is too.</p> </blockquote> </div> <div class="section" id="doctest-blocks"> -<h2><a class="toc-backref" href="#id38" name="doctest-blocks">2.9   Doctest Blocks</a></h2> +<h2><a class="toc-backref" href="#id38" name="doctest-blocks">2.9   Doctest Blocks</a></h2> <pre class="doctest-block"> >>> print 'Python-specific usage examples; begun with ">>>"' Python-specific usage examples; begun with ">>>" @@ -350,7 +350,7 @@ Python-specific usage examples; begun with ">>>" </pre> </div> <div class="section" id="footnotes"> -<h2><a class="toc-backref" href="#id39" name="footnotes">2.10   Footnotes</a></h2> +<h2><a class="toc-backref" href="#id39" name="footnotes">2.10   Footnotes</a></h2> <table class="footnote" frame="void" id="id6" rules="none"> <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> @@ -399,7 +399,7 @@ nonexistent footnote: <a href="#id65" name="id66"><span class="problematic" id=" </table> </div> <div class="section" id="citations"> -<h2><a class="toc-backref" href="#id40" name="citations">2.11   Citations</a></h2> +<h2><a class="toc-backref" href="#id40" name="citations">2.11   Citations</a></h2> <table class="citation" frame="void" id="cit2002" rules="none"> <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> @@ -411,7 +411,7 @@ rendered separately and differently from footnotes.</td></tr> citation.</p> </div> <div class="section" id="targets"> -<h2><a class="toc-backref" href="#id41" name="targets">2.12   Targets</a></h2> +<h2><a class="toc-backref" href="#id41" name="targets">2.12   Targets</a></h2> <a class="target" id="example" name="example"></a><p>This paragraph is pointed to by the explicit "example" target. A reference can be found under <a class="reference" href="#inline-markup">Inline Markup</a>, above. <a class="reference" href="#inline-hyperlink-targets">Inline hyperlink targets</a> are also possible.</p> @@ -424,42 +424,42 @@ refer to the <a class="reference" href="#targets">Targets</a> section.</p> <p>Here's a <a href="#id69" name="id70"><span class="problematic" id="id70">`hyperlink reference without a target`_</span></a>, which generates an error.</p> <div class="section" id="duplicate-target-names"> -<h3><a class="toc-backref" href="#id42" name="duplicate-target-names">2.12.1   Duplicate Target Names</a></h3> +<h3><a class="toc-backref" href="#id42" name="duplicate-target-names">2.12.1   Duplicate Target Names</a></h3> <p>Duplicate names in section headers or other implicit targets will generate "info" (level-1) system messages. Duplicate names in explicit targets will generate "warning" (level-2) system messages.</p> </div> <div class="section" id="id18"> -<h3><a class="toc-backref" href="#id43" name="id18">2.12.2   Duplicate Target Names</a></h3> +<h3><a class="toc-backref" href="#id43" name="id18">2.12.2   Duplicate Target Names</a></h3> <p>Since there are two "Duplicate Target Names" section headers, we cannot uniquely refer to either of them by name. If we try to (like this: <a href="#id71" name="id72"><span class="problematic" id="id72">`Duplicate Target Names`_</span></a>), an error is generated.</p> </div> </div> <div class="section" id="directives"> -<h2><a class="toc-backref" href="#id44" name="directives">2.13   Directives</a></h2> +<h2><a class="toc-backref" href="#id44" name="directives">2.13   Directives</a></h2> <div class="contents topic" id="contents"> <ul class="auto-toc simple"> -<li><a class="reference" href="#document-parts" id="id58" name="id58">2.13.1   Document Parts</a></li> -<li><a class="reference" href="#images" id="id59" name="id59">2.13.2   Images</a></li> -<li><a class="reference" href="#admonitions" id="id60" name="id60">2.13.3   Admonitions</a></li> -<li><a class="reference" href="#topics-sidebars-and-rubrics" id="id61" name="id61">2.13.4   Topics, Sidebars, and Rubrics</a></li> -<li><a class="reference" href="#target-footnotes" id="id62" name="id62">2.13.5   Target Footnotes</a></li> -<li><a class="reference" href="#line-blocks" id="id63" name="id63">2.13.6   Line Blocks</a></li> -<li><a class="reference" href="#replacement-text" id="id64" name="id64">2.13.7   Replacement Text</a></li> +<li><a class="reference" href="#document-parts" id="id58" name="id58">2.13.1   Document Parts</a></li> +<li><a class="reference" href="#images" id="id59" name="id59">2.13.2   Images</a></li> +<li><a class="reference" href="#admonitions" id="id60" name="id60">2.13.3   Admonitions</a></li> +<li><a class="reference" href="#topics-sidebars-and-rubrics" id="id61" name="id61">2.13.4   Topics, Sidebars, and Rubrics</a></li> +<li><a class="reference" href="#target-footnotes" id="id62" name="id62">2.13.5   Target Footnotes</a></li> +<li><a class="reference" href="#line-blocks" id="id63" name="id63">2.13.6   Line Blocks</a></li> +<li><a class="reference" href="#replacement-text" id="id64" name="id64">2.13.7   Replacement Text</a></li> </ul> </div> <p>These are just a sample of the many reStructuredText Directives. For others, please see <a class="reference" href="http://docutils.sourceforge.net/docs/ref/rst/directives.html">http://docutils.sourceforge.net/docs/ref/rst/directives.html</a>.</p> <div class="section" id="document-parts"> -<h3><a class="toc-backref" href="#id58" name="document-parts">2.13.1   Document Parts</a></h3> +<h3><a class="toc-backref" href="#id58" name="document-parts">2.13.1   Document Parts</a></h3> <p>An example of the "contents" directive can be seen above this section (a local, untitled table of <a class="reference" href="#contents">contents</a>) and at the beginning of the document (a document-wide <a class="reference" href="#table-of-contents">table of contents</a>).</p> </div> <div class="section" id="images"> -<h3><a class="toc-backref" href="#id59" name="images">2.13.2   Images</a></h3> +<h3><a class="toc-backref" href="#id59" name="images">2.13.2   Images</a></h3> <p>An image directive (also clickable -- a hyperlink reference):</p> <p><a class="reference" href="#directives"><img alt="../../../docs/user/rst/images/title.png" src="../../../docs/user/rst/images/title.png" /></a></p> <p>A figure directive:</p> @@ -489,7 +489,7 @@ document (a document-wide <a class="reference" href="#table-of-contents">table o </div> </div> <div class="section" id="admonitions"> -<h3><a class="toc-backref" href="#id60" name="admonitions">2.13.3   Admonitions</a></h3> +<h3><a class="toc-backref" href="#id60" name="admonitions">2.13.3   Admonitions</a></h3> <div class="attention"> <p class="admonition-title first">Attention!</p> Directives at large.</div> @@ -530,7 +530,7 @@ Reader discretion is strongly advised.</div> </div> </div> <div class="section" id="topics-sidebars-and-rubrics"> -<h3><a class="toc-backref" href="#id61" name="topics-sidebars-and-rubrics">2.13.4   Topics, Sidebars, and Rubrics</a></h3> +<h3><a class="toc-backref" href="#id61" name="topics-sidebars-and-rubrics">2.13.4   Topics, Sidebars, and Rubrics</a></h3> <div class="sidebar"> <p class="sidebar-title first">Sidebar Title</p> <p class="sidebar-subtitle">Optional Subtitle</p> @@ -547,7 +547,7 @@ background color.</p> <p class="rubric">This is a rubric</p> </div> <div class="section" id="target-footnotes"> -<h3><a class="toc-backref" href="#id62" name="target-footnotes">2.13.5   Target Footnotes</a></h3> +<h3><a class="toc-backref" href="#id62" name="target-footnotes">2.13.5   Target Footnotes</a></h3> <table class="footnote" frame="void" id="id21" rules="none"> <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> @@ -556,7 +556,7 @@ background color.</p> </table> </div> <div class="section" id="line-blocks"> -<h3><a class="toc-backref" href="#id63" name="line-blocks">2.13.6   Line Blocks</a></h3> +<h3><a class="toc-backref" href="#id63" name="line-blocks">2.13.6   Line Blocks</a></h3> <p>Take it away, Eric the Orchestra Leader!</p> <pre class="line-block"> A one, two, a one two three four @@ -575,17 +575,17 @@ Singing... </pre> </div> <div class="section" id="replacement-text"> -<h3><a class="toc-backref" href="#id64" name="replacement-text">2.13.7   Replacement Text</a></h3> +<h3><a class="toc-backref" href="#id64" name="replacement-text">2.13.7   Replacement Text</a></h3> <p>I recommend you try <a class="reference" href="http://www.python.org/">Python, <em>the</em> best language around</a> <a class="footnote-reference" href="#id21" id="id24" name="id24"><sup>5</sup></a>.</p> </div> </div> <div class="section" id="substitution-definitions"> -<h2><a class="toc-backref" href="#id52" name="substitution-definitions">2.14   Substitution Definitions</a></h2> +<h2><a class="toc-backref" href="#id52" name="substitution-definitions">2.14   Substitution Definitions</a></h2> <p>An inline image (<img alt="EXAMPLE" src="../../../docs/user/rst/images/biohazard.png" />) example:</p> <p>(Substitution definitions are not visible in the HTML source.)</p> </div> <div class="section" id="comments"> -<h2><a class="toc-backref" href="#id53" name="comments">2.15   Comments</a></h2> +<h2><a class="toc-backref" href="#id53" name="comments">2.15   Comments</a></h2> <p>Here's one:</p> <!-- Comments begin with two dots and a space. Anything may follow, except for the syntax of footnotes, hyperlink @@ -595,7 +595,7 @@ Double-dashes - - "- -" - - must be escaped somehow in HTML output. --> <p>(View the HTML source to see the comment.)</p> </div> <div class="section" id="colspanning-tables"> -<h2><a class="toc-backref" href="#id54" name="colspanning-tables">2.16   Colspanning tables</a></h2> +<h2><a class="toc-backref" href="#id54" name="colspanning-tables">2.16   Colspanning tables</a></h2> <p>This table has a cell spanning two columns:</p> <table border="1" class="table"> <colgroup> @@ -633,7 +633,7 @@ Double-dashes - - "- -" - - must be escaped somehow in HTML output. --> </table> </div> <div class="section" id="rowspanning-tables"> -<h2><a class="toc-backref" href="#id55" name="rowspanning-tables">2.17   Rowspanning tables</a></h2> +<h2><a class="toc-backref" href="#id55" name="rowspanning-tables">2.17   Rowspanning tables</a></h2> <p>Here's a table with cells spanning several rows:</p> <table border="1" class="table"> <colgroup> @@ -669,7 +669,7 @@ span rows.</td> </table> </div> <div class="section" id="complex-tables"> -<h2><a class="toc-backref" href="#id56" name="complex-tables">2.18   Complex tables</a></h2> +<h2><a class="toc-backref" href="#id56" name="complex-tables">2.18   Complex tables</a></h2> <p>Here's a complex table, which should test all features.</p> <table border="1" class="table"> <colgroup> @@ -719,7 +719,7 @@ empty: <tt class="literal"><span class="pre">--></span></tt></td> </div> </div> <div class="section" id="error-handling"> -<h1><a class="toc-backref" href="#id57" name="error-handling">3   Error Handling</a></h1> +<h1><a class="toc-backref" href="#id57" name="error-handling">3   Error Handling</a></h1> <p>Any errors caught during processing will generate system messages.</p> <p>There should be five messages in the following, auto-generated section, "Docutils System Messages":</p> -- cgit v1.2.1 From 79fadb03aea8a33e2fc999aab34eef383059a3a4 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Mon, 13 Sep 2004 14:03:17 +0000 Subject: removed unused code; updated docstring git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2602 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/DocutilsTestSupport.py | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) (limited to 'test') diff --git a/test/DocutilsTestSupport.py b/test/DocutilsTestSupport.py index 0e6d3a08c..d4917094e 100644 --- a/test/DocutilsTestSupport.py +++ b/test/DocutilsTestSupport.py @@ -94,8 +94,7 @@ class CustomTestCase(unittest.TestCase): compare = docutils_difflib.Differ().compare """Comparison method shared by all subclasses.""" - def __init__(self, method_name, input, expected, id, - run_in_debugger=0, short_description=None): + def __init__(self, method_name, input, expected, id, run_in_debugger=0): """ Initialise the CustomTestCase. @@ -106,16 +105,12 @@ class CustomTestCase(unittest.TestCase): expected -- expected output from the parser. id -- unique test identifier, used by the test framework. run_in_debugger -- if true, run this test under the pdb debugger. - short_description -- override to default test description. """ self.id = id self.input = input self.expected = expected self.run_in_debugger = run_in_debugger - # XXX What do we do with short_description? It isn't used at - # all. - # Ring your mother. unittest.TestCase.__init__(self, method_name) @@ -153,9 +148,7 @@ class CustomTestSuite(unittest.TestSuite): """ A collection of CustomTestCases. - Provides test suite ID generation. - - XXX Any other reason why we need this class? + Provides test suite ID generation and a method for adding test cases. """ id = '' @@ -197,8 +190,7 @@ class CustomTestSuite(unittest.TestSuite): self.id = id def addTestCase(self, test_case_class, method_name, input, expected, - id=None, run_in_debugger=0, short_description=None, - **kwargs): + id=None, run_in_debugger=0, **kwargs): """ Create a CustomTestCase in the CustomTestSuite. Also return it, just in case. @@ -211,7 +203,6 @@ class CustomTestSuite(unittest.TestSuite): expected -- expected output from the parser. id -- unique test identifier, used by the test framework. run_in_debugger -- if true, run this test under the pdb debugger. - short_description -- override to default test description. """ if id is None: # generate id if required id = self.next_test_case_id @@ -220,9 +211,7 @@ class CustomTestSuite(unittest.TestSuite): tcid = '%s: %s' % (self.id, id) # generate and add test case tc = test_case_class(method_name, input, expected, tcid, - run_in_debugger=run_in_debugger, - short_description=short_description, - **kwargs) + run_in_debugger=run_in_debugger, **kwargs) self.addTest(tc) return tc -- cgit v1.2.1 From 097eea916324344e93db305e0faf43adbca92cc5 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Mon, 13 Sep 2004 18:14:34 +0000 Subject: added functions for proper multi-line string output git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2604 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/DocutilsTestSupport.py | 106 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 102 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/DocutilsTestSupport.py b/test/DocutilsTestSupport.py index d4917094e..4b45831cb 100644 --- a/test/DocutilsTestSupport.py +++ b/test/DocutilsTestSupport.py @@ -45,7 +45,7 @@ import unittest import docutils_difflib import inspect from pprint import pformat -from types import UnicodeType +from types import UnicodeType, StringType import package_unittest import docutils import docutils.core @@ -87,8 +87,11 @@ class CustomTestCase(unittest.TestCase): Helper class, providing extended functionality over unittest.TestCase. This isn't specific to Docutils but of general use when dealing - with large amounts of text. In particular, see the compare_output - method and the parameter list of __init__. + with large amounts of text. The methods failUnlessEqual, + failIfEqual, failUnlessAlmostEqual and failIfAlmostEqual have been + overwritten to provide better support for multi-line strings. + Furthermore, see the compare_output method and the parameter list + of __init__. """ compare = docutils_difflib.Differ().compare @@ -133,7 +136,7 @@ class CustomTestCase(unittest.TestCase): if type(expected) == UnicodeType: expected = expected.encode('raw_unicode_escape') try: - self.assertEquals('\n' + output, '\n' + expected) + self.assertEquals(output, expected) except AssertionError: print >>sys.stderr, '\n%s\ninput:' % (self,) print >>sys.stderr, input @@ -142,6 +145,58 @@ class CustomTestCase(unittest.TestCase): output.splitlines(1))) raise + def failUnlessEqual(self, first, second, msg=None): + """Fail if the two objects are unequal as determined by the '==' + operator. + """ + if not first == second: + raise self.failureException, \ + (msg or '%s != %s' % _format_str(first, second)) + + def failIfEqual(self, first, second, msg=None): + """Fail if the two objects are equal as determined by the '==' + operator. + """ + if first == second: + raise self.failureException, \ + (msg or '%s == %s' % _format_str(first, second)) + + def failUnlessAlmostEqual(self, first, second, places=7, msg=None): + """Fail if the two objects are unequal as determined by their + difference rounded to the given number of decimal places + (default 7) and comparing to zero. + + Note that decimal places (from zero) are usually not the same + as significant digits (measured from the most signficant digit). + """ + if round(second-first, places) != 0: + raise self.failureException, \ + (msg or '%s != %s within %s places' % + _format_str(first, second, places)) + + def failIfAlmostEqual(self, first, second, places=7, msg=None): + """Fail if the two objects are equal as determined by their + difference rounded to the given number of decimal places + (default 7) and comparing to zero. + + Note that decimal places (from zero) are usually not the same + as significant digits (measured from the most signficant digit). + """ + if round(second-first, places) == 0: + raise self.failureException, \ + (msg or '%s == %s within %s places' % + _format_str(first, second, places)) + + # Synonyms for assertion methods + + assertEqual = assertEquals = failUnlessEqual + + assertNotEqual = assertNotEquals = failIfEqual + + assertAlmostEqual = assertAlmostEquals = failUnlessAlmostEqual + + assertNotAlmostEqual = assertNotAlmostEquals = failIfAlmostEqual + class CustomTestSuite(unittest.TestSuite): @@ -739,3 +794,46 @@ def exception_data(code): except Exception, detail: return (detail, detail.args, '%s: %s' % (detail.__class__.__name__, detail)) + + +def _format_str(*args): + r""" + Return a tuple containing representations of all args. + + Same as map(repr, args) except that it returns multi-line + representations for strings containing newlines, e.g.:: + + '''\ + foo \n\ + bar + + baz''' + + instead of:: + + 'foo \nbar\n\nbaz' + + This is a helper function for CustomTestCase. + """ + import re + return_tuple = [] + for i in args: + r = repr(i) + if '\n' in i and (isinstance(i, StringType) or + isinstance(i, UnicodeType)): + stripped = '' + if isinstance(i, UnicodeType): + # stripped = 'u' or 'U' + stripped = r[0] + r = r[1:] + # quote_char = "'" or '"' + quote_char = r[0] + assert quote_char in ("'", "'") + assert r[0] == r[-1] + r = r[1:-1] + r = (stripped + 3 * quote_char + '\\\n' + + re.sub(r'(?<=[^\\])((\\\\)*)\\n', r'\1\n', r) + + 3 * quote_char) + r = re.sub(r' \n', r' \\n\\\n', r) + return_tuple.append(r) + return tuple(return_tuple) -- cgit v1.2.1 From ccd56c100333ddaed257f53f892ee6ee3f4db3f5 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Mon, 13 Sep 2004 18:16:41 +0000 Subject: removed floating point comparison methods If we need them, they're in the history now. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2605 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/DocutilsTestSupport.py | 39 ++++----------------------------------- 1 file changed, 4 insertions(+), 35 deletions(-) (limited to 'test') diff --git a/test/DocutilsTestSupport.py b/test/DocutilsTestSupport.py index 4b45831cb..6272557aa 100644 --- a/test/DocutilsTestSupport.py +++ b/test/DocutilsTestSupport.py @@ -87,11 +87,10 @@ class CustomTestCase(unittest.TestCase): Helper class, providing extended functionality over unittest.TestCase. This isn't specific to Docutils but of general use when dealing - with large amounts of text. The methods failUnlessEqual, - failIfEqual, failUnlessAlmostEqual and failIfAlmostEqual have been - overwritten to provide better support for multi-line strings. - Furthermore, see the compare_output method and the parameter list - of __init__. + with large amounts of text. The methods failUnlessEqual and + failIfEqual have been overwritten to provide better support for + multi-line strings. Furthermore, see the compare_output method + and the parameter list of __init__. """ compare = docutils_difflib.Differ().compare @@ -161,42 +160,12 @@ class CustomTestCase(unittest.TestCase): raise self.failureException, \ (msg or '%s == %s' % _format_str(first, second)) - def failUnlessAlmostEqual(self, first, second, places=7, msg=None): - """Fail if the two objects are unequal as determined by their - difference rounded to the given number of decimal places - (default 7) and comparing to zero. - - Note that decimal places (from zero) are usually not the same - as significant digits (measured from the most signficant digit). - """ - if round(second-first, places) != 0: - raise self.failureException, \ - (msg or '%s != %s within %s places' % - _format_str(first, second, places)) - - def failIfAlmostEqual(self, first, second, places=7, msg=None): - """Fail if the two objects are equal as determined by their - difference rounded to the given number of decimal places - (default 7) and comparing to zero. - - Note that decimal places (from zero) are usually not the same - as significant digits (measured from the most signficant digit). - """ - if round(second-first, places) == 0: - raise self.failureException, \ - (msg or '%s == %s within %s places' % - _format_str(first, second, places)) - # Synonyms for assertion methods assertEqual = assertEquals = failUnlessEqual assertNotEqual = assertNotEquals = failIfEqual - assertAlmostEqual = assertAlmostEquals = failUnlessAlmostEqual - - assertNotAlmostEqual = assertNotAlmostEquals = failIfAlmostEqual - class CustomTestSuite(unittest.TestSuite): -- cgit v1.2.1 From 30f6867a3415f285e4e89e9d2bafd23ce3c3965a Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sun, 19 Sep 2004 18:38:38 +0000 Subject: made stylesheet and stylesheet_path mutually exclusive git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2635 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/tests/standalone_rst_html4css1.py | 1 + 1 file changed, 1 insertion(+) (limited to 'test') diff --git a/test/functional/tests/standalone_rst_html4css1.py b/test/functional/tests/standalone_rst_html4css1.py index 736905c9c..9dbfa8d28 100644 --- a/test/functional/tests/standalone_rst_html4css1.py +++ b/test/functional/tests/standalone_rst_html4css1.py @@ -8,4 +8,5 @@ parser_name = "rst" writer_name = "html4css1" # Settings +settings_overrides['stylesheet'] = '' settings_overrides['stylesheet_path'] = "../tools/stylesheets/default.css" -- cgit v1.2.1 From 74264bb4f6d8eea24294913e8f5ec00ca24d7931 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sun, 19 Sep 2004 18:59:12 +0000 Subject: making stylesheet and stylesheet_path mutually exclusive was a bad idea; reverted git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2638 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/tests/standalone_rst_html4css1.py | 1 - 1 file changed, 1 deletion(-) (limited to 'test') diff --git a/test/functional/tests/standalone_rst_html4css1.py b/test/functional/tests/standalone_rst_html4css1.py index 9dbfa8d28..736905c9c 100644 --- a/test/functional/tests/standalone_rst_html4css1.py +++ b/test/functional/tests/standalone_rst_html4css1.py @@ -8,5 +8,4 @@ parser_name = "rst" writer_name = "html4css1" # Settings -settings_overrides['stylesheet'] = '' settings_overrides['stylesheet_path'] = "../tools/stylesheets/default.css" -- cgit v1.2.1 From 26efe6977a67b9a3c373fe826bd6a96ac12e5640 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Tue, 21 Sep 2004 16:49:04 +0000 Subject: Added config file support for "overrides" setting parameter. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2639 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/tests/standalone_rst_html4css1.py | 1 + test/test_settings.py | 3 +++ 2 files changed, 4 insertions(+) (limited to 'test') diff --git a/test/functional/tests/standalone_rst_html4css1.py b/test/functional/tests/standalone_rst_html4css1.py index 736905c9c..c7a2b7301 100644 --- a/test/functional/tests/standalone_rst_html4css1.py +++ b/test/functional/tests/standalone_rst_html4css1.py @@ -8,4 +8,5 @@ parser_name = "rst" writer_name = "html4css1" # Settings +settings_overrides['stylesheet'] = None settings_overrides['stylesheet_path'] = "../tools/stylesheets/default.css" diff --git a/test/test_settings.py b/test/test_settings.py index 3dcbc92d8..1b2ed5d0c 100755 --- a/test/test_settings.py +++ b/test/test_settings.py @@ -45,6 +45,7 @@ class ConfigFileTests(unittest.TestCase): 'no_random': 1, 'python_home': 'http://www.python.org', 'source_link': 1, + 'stylesheet': None, 'stylesheet_path': fixpath('data/stylesheets/pep.css'), 'template': fixpath('data/pep-html-template')}, 'one': {'datestamp': '%Y-%m-%d %H:%M UTC', @@ -52,9 +53,11 @@ class ConfigFileTests(unittest.TestCase): 'no_random': 1, 'python_home': 'http://www.python.org', 'source_link': 1, + 'stylesheet': None, 'stylesheet_path': fixpath('data/stylesheets/pep.css'), 'template': fixpath('data/pep-html-template')}, 'two': {'generator': 0, + 'stylesheet': None, 'stylesheet_path': fixpath('data/test.css')}, 'list': {'expose_internals': ['a', 'b', 'c', 'd', 'e']}, 'list2': {'expose_internals': ['a', 'b', 'c', 'd', 'e', 'f']}, -- cgit v1.2.1 From 1c0c571b781d8a19018c33d96639fc3a87e653ca Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sat, 25 Sep 2004 23:46:25 +0000 Subject: updated to match newly added record_dependencies setting git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2649 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_settings.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/test_settings.py b/test/test_settings.py index 1b2ed5d0c..b87019046 100755 --- a/test/test_settings.py +++ b/test/test_settings.py @@ -16,7 +16,8 @@ import docutils_difflib import pprint import warnings import unittest -from docutils import frontend +from types import StringType +from docutils import frontend, utils from docutils.writers import html4css1 from docutils.writers import pep_html @@ -52,11 +53,13 @@ class ConfigFileTests(unittest.TestCase): 'generator': 1, 'no_random': 1, 'python_home': 'http://www.python.org', + 'record_dependencies': 'foo', 'source_link': 1, 'stylesheet': None, 'stylesheet_path': fixpath('data/stylesheets/pep.css'), 'template': fixpath('data/pep-html-template')}, 'two': {'generator': 0, + 'record_dependencies': 'bar', 'stylesheet': None, 'stylesheet_path': fixpath('data/test.css')}, 'list': {'expose_internals': ['a', 'b', 'c', 'd', 'e']}, @@ -87,6 +90,13 @@ class ConfigFileTests(unittest.TestCase): def compare_output(self, result, expected): """`result` and `expected` should both be dicts.""" + self.assert_(result.has_key('record_dependencies')) + if not expected.has_key('record_dependencies'): + # Delete it if we don't want to test it. + del result['record_dependencies'] + elif type(expected['record_dependencies']) == StringType: + expected['record_dependencies'] = utils.DependencyList( + expected['record_dependencies']) result = pprint.pformat(result) + '\n' expected = pprint.pformat(expected) + '\n' try: -- cgit v1.2.1 From 7e01e55a123cbcb5ba89d7cc435ec97e2269f57e Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Mon, 27 Sep 2004 15:28:33 +0000 Subject: Fixed bug where a "role" directive in a nested parse would crash the parser; the "language" attribute was not being copied over to the new state machine. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2654 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../test_rst/test_directives/test_role.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_directives/test_role.py b/test/test_parsers/test_rst/test_directives/test_role.py index 2be2343dc..6dd1f742a 100755 --- a/test/test_parsers/test_rst/test_directives/test_role.py +++ b/test/test_parsers/test_rst/test_directives/test_role.py @@ -156,6 +156,25 @@ Now that it's defined, :custom:`interpreted` works. <literal_block xml:space="preserve"> .. role:: 1 """], +["""\ +Test +---- + +.. role:: fileref(emphasis) + +Testing a :fileref:`role` in a nested parse. +""", +"""\ +<document source="test data"> + <section id="test" name="test"> + <title> + Test + <paragraph> + Testing a \n\ + <emphasis class="fileref"> + role + in a nested parse. +"""], ] -- cgit v1.2.1 From 602c6acf1456caf15e5df5f97e86a02f98faa9b5 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Mon, 27 Sep 2004 15:42:14 +0000 Subject: No newline after depart_term. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2656 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_latex.tex | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_latex.tex b/test/functional/expected/standalone_rst_latex.tex index e7712f123..7ced05a16 100644 --- a/test/functional/expected/standalone_rst_latex.tex +++ b/test/functional/expected/standalone_rst_latex.tex @@ -445,16 +445,14 @@ iv \subsection*{2.4~~~Definition Lists} \begin{description} %[visit_definition_list_item] -\item[Term] -%[visit_definition] +\item[Term] %[visit_definition] Definition %[depart_definition] %[depart_definition_list_item] %[visit_definition_list_item] -\item[Term] -(\textbf{classifier}) +\item[Term] (\textbf{classifier}) %[visit_definition] Definition paragraph 1. @@ -464,8 +462,7 @@ Definition paragraph 2. %[depart_definition] %[depart_definition_list_item] %[visit_definition_list_item] -\item[Term] -%[visit_definition] +\item[Term] %[visit_definition] Definition -- cgit v1.2.1 From 3b803b1e77bce0ed51ee790cd50df6a71646c3f5 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Mon, 27 Sep 2004 18:30:29 +0000 Subject: added tests for non-ASCII characters git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2660 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_latex.tex | 120 ++++++++++++++++++++++ test/functional/input/data/latex.txt | 16 --- test/functional/input/data/nonalphanumeric.txt | 13 +++ test/functional/input/data/unicode.txt | 27 +++++ test/functional/input/standalone_rst_latex.txt | 9 +- test/functional/tests/_default.py | 1 + 6 files changed, 169 insertions(+), 17 deletions(-) delete mode 100644 test/functional/input/data/latex.txt create mode 100644 test/functional/input/data/nonalphanumeric.txt create mode 100644 test/functional/input/data/unicode.txt (limited to 'test') diff --git a/test/functional/expected/standalone_rst_latex.tex b/test/functional/expected/standalone_rst_latex.tex index 7ced05a16..e433f4480 100644 --- a/test/functional/expected/standalone_rst_latex.tex +++ b/test/functional/expected/standalone_rst_latex.tex @@ -198,6 +198,8 @@ reStructuredText construct. \begin{list}{}{} \item {} \href{\#monospaced-non-alphanumeric-characters}{3.1~~~Monospaced non-alphanumeric characters} +\item {} \href{\#various-non-ascii-characters}{3.2~~~Various non-ASCII characters} + \end{list} \item {} \href{\#error-handling}{4~~~Error Handling} @@ -1059,6 +1061,124 @@ The two lines of non-alphanumeric characters should both have the same width as the third line. +%___________________________________________________________________________ + +\hypertarget{various-non-ascii-characters}{} +\pdfbookmark[1]{3.2~~~Various non-ASCII characters}{various-non-ascii-characters} +\subsection*{3.2~~~Various non-ASCII characters} + +\begin{longtable}[c]{|p{0.03\locallinewidth}|p{0.42\locallinewidth}|} +\hline + +© + & +copyright sign + \\ +\hline + +® + & +registered sign + \\ +\hline + +« + & +left pointing guillemet + \\ +\hline + +» + & +right pointing guillemet + \\ +\hline + +{--} + & +en-dash + \\ +\hline + +{---} + & +em-dash + \\ +\hline + +` + & +single turned comma quotation mark + \\ +\hline + +' + & +single comma quotation mark + \\ +\hline + +, + & +low single comma quotation mark + \\ +\hline + +`` + & +double turned comma quotation mark + \\ +\hline + +'' + & +double comma quotation mark + \\ +\hline + +,, + & +low double comma quotation mark + \\ +\hline + +{\dag} + & +dagger + \\ +\hline + +{\ddag} + & +double dagger + \\ +\hline + +{\dots} + & +ellipsis + \\ +\hline + +{\texttrademark} + & +trade mark sign + \\ +\hline + +{$\Leftrightarrow$} + & +left-right double arrow + \\ +\hline +\end{longtable} + +The following line should not be wrapped, because it uses +non-breakable spaces: + +X~X~X~X~X~X~X~X~X~X~X~X~X~X~X~X~X~X~X~X~X~X~X~X~X~X~X~X~X~X~X~X~X~X~X~X~X~X~X~X~X~X~X~X~X~X~X~X~X~X~X~X~X~X~X~X~X~X~X~X~X~X~X~X~X~X + + %___________________________________________________________________________ \hypertarget{error-handling}{} diff --git a/test/functional/input/data/latex.txt b/test/functional/input/data/latex.txt deleted file mode 100644 index be47a51c9..000000000 --- a/test/functional/input/data/latex.txt +++ /dev/null @@ -1,16 +0,0 @@ -Tests for the LaTeX writer -========================== - -Monospaced non-alphanumeric characters --------------------------------------- - -These are all ASCII characters except a-zA-Z0-9 and space: - -``!!!"""###$$$%%%&&&'''((()))***+++,,,---...///:::`` - -``;;;<<<===>>>???@@@[[[\\\]]]^^^___```{{{|||}}}~~~`` - -``xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`` - -The two lines of non-alphanumeric characters should both have the same -width as the third line. diff --git a/test/functional/input/data/nonalphanumeric.txt b/test/functional/input/data/nonalphanumeric.txt new file mode 100644 index 000000000..4c4ee7343 --- /dev/null +++ b/test/functional/input/data/nonalphanumeric.txt @@ -0,0 +1,13 @@ +Monospaced non-alphanumeric characters +-------------------------------------- + +These are all ASCII characters except a-zA-Z0-9 and space: + +``!!!"""###$$$%%%&&&'''((()))***+++,,,---...///:::`` + +``;;;<<<===>>>???@@@[[[\\\]]]^^^___```{{{|||}}}~~~`` + +``xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`` + +The two lines of non-alphanumeric characters should both have the same +width as the third line. diff --git a/test/functional/input/data/unicode.txt b/test/functional/input/data/unicode.txt new file mode 100644 index 000000000..4bdd57653 --- /dev/null +++ b/test/functional/input/data/unicode.txt @@ -0,0 +1,27 @@ +Various non-ASCII characters +---------------------------- + += =================================== +© copyright sign +® registered sign +« left pointing guillemet +» right pointing guillemet +– en-dash +— em-dash +‘ single turned comma quotation mark +’ single comma quotation mark +‚ low single comma quotation mark +“ double turned comma quotation mark +†double comma quotation mark +„ low double comma quotation mark +† dagger +‡ double dagger +… ellipsis +â„¢ trade mark sign +⇔ left-right double arrow += =================================== + +The following line should not be wrapped, because it uses +non-breakable spaces: + +X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X diff --git a/test/functional/input/standalone_rst_latex.txt b/test/functional/input/standalone_rst_latex.txt index 76b8c3e25..a44810d9f 100644 --- a/test/functional/input/standalone_rst_latex.txt +++ b/test/functional/input/standalone_rst_latex.txt @@ -1,4 +1,11 @@ .. include:: data/standard.txt .. include:: data/table_colspan.txt -.. include:: data/latex.txt + + +Tests for the LaTeX writer +========================== + +.. include:: data/nonalphanumeric.txt +.. include:: data/unicode.txt + .. include:: data/errors.txt diff --git a/test/functional/tests/_default.py b/test/functional/tests/_default.py index 151a1824c..63e82451a 100644 --- a/test/functional/tests/_default.py +++ b/test/functional/tests/_default.py @@ -3,3 +3,4 @@ settings_overrides['report_level'] = 2 settings_overrides['halt_level'] = 5 settings_overrides['warning_stream'] = '' +settings_overrides['input_encoding'] = 'utf-8' -- cgit v1.2.1 From 01e27496cf9d56721b2843b5d8227f1f0a37fe3e Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Wed, 29 Sep 2004 17:56:10 +0000 Subject: added close() method for DevNull git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2669 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/DocutilsTestSupport.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'test') diff --git a/test/DocutilsTestSupport.py b/test/DocutilsTestSupport.py index 6272557aa..3f8451959 100644 --- a/test/DocutilsTestSupport.py +++ b/test/DocutilsTestSupport.py @@ -80,6 +80,9 @@ class DevNull: def write(self, string): pass + def close(self): + pass + class CustomTestCase(unittest.TestCase): -- cgit v1.2.1 From 90921e4ab5a06c92dcdd5cd2ff1a797a15c87b5a Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Thu, 30 Sep 2004 03:16:07 +0000 Subject: improved DependencyList.__repr__ git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2673 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_settings.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/test_settings.py b/test/test_settings.py index b87019046..e7163e766 100755 --- a/test/test_settings.py +++ b/test/test_settings.py @@ -53,13 +53,13 @@ class ConfigFileTests(unittest.TestCase): 'generator': 1, 'no_random': 1, 'python_home': 'http://www.python.org', - 'record_dependencies': 'foo', + 'record_dependencies': utils.DependencyList(), 'source_link': 1, 'stylesheet': None, 'stylesheet_path': fixpath('data/stylesheets/pep.css'), 'template': fixpath('data/pep-html-template')}, 'two': {'generator': 0, - 'record_dependencies': 'bar', + 'record_dependencies': utils.DependencyList(), 'stylesheet': None, 'stylesheet_path': fixpath('data/test.css')}, 'list': {'expose_internals': ['a', 'b', 'c', 'd', 'e']}, -- cgit v1.2.1 From f46f063e3570bf91f1b8765cabaf8dd0ae94e89d Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Thu, 30 Sep 2004 09:36:45 +0000 Subject: added test for DependencyList; removed junk code git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2676 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_settings.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'test') diff --git a/test/test_settings.py b/test/test_settings.py index e7163e766..31f6032b1 100755 --- a/test/test_settings.py +++ b/test/test_settings.py @@ -59,7 +59,7 @@ class ConfigFileTests(unittest.TestCase): 'stylesheet_path': fixpath('data/stylesheets/pep.css'), 'template': fixpath('data/pep-html-template')}, 'two': {'generator': 0, - 'record_dependencies': utils.DependencyList(), + 'record_dependencies': utils.DependencyList(None, ['x', 'y']), 'stylesheet': None, 'stylesheet_path': fixpath('data/test.css')}, 'list': {'expose_internals': ['a', 'b', 'c', 'd', 'e']}, @@ -94,9 +94,6 @@ class ConfigFileTests(unittest.TestCase): if not expected.has_key('record_dependencies'): # Delete it if we don't want to test it. del result['record_dependencies'] - elif type(expected['record_dependencies']) == StringType: - expected['record_dependencies'] = utils.DependencyList( - expected['record_dependencies']) result = pprint.pformat(result) + '\n' expected = pprint.pformat(expected) + '\n' try: -- cgit v1.2.1 From f650a9a7d1347251100527095a1abbbe586c4bfd Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Thu, 30 Sep 2004 10:07:07 +0000 Subject: removed DependencyList test -- that can't work git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2677 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/test_settings.py b/test/test_settings.py index 31f6032b1..b90f00f46 100755 --- a/test/test_settings.py +++ b/test/test_settings.py @@ -59,7 +59,7 @@ class ConfigFileTests(unittest.TestCase): 'stylesheet_path': fixpath('data/stylesheets/pep.css'), 'template': fixpath('data/pep-html-template')}, 'two': {'generator': 0, - 'record_dependencies': utils.DependencyList(None, ['x', 'y']), + 'record_dependencies': utils.DependencyList(), 'stylesheet': None, 'stylesheet_path': fixpath('data/test.css')}, 'list': {'expose_internals': ['a', 'b', 'c', 'd', 'e']}, -- cgit v1.2.1 From f467d41b749a5ef7cc6b8b898ba93d42143e678d Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Thu, 30 Sep 2004 10:49:47 +0000 Subject: added data files for dependency recorder test git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2678 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/data/csv_data.txt | 1 + test/data/csv_dep.txt | 2 ++ test/data/dependencies.txt | 8 ++++++++ test/data/include.txt | 1 + test/data/raw.txt | 0 test/data/stylesheet.txt | 0 6 files changed, 12 insertions(+) create mode 100644 test/data/csv_data.txt create mode 100644 test/data/csv_dep.txt create mode 100644 test/data/dependencies.txt create mode 100644 test/data/include.txt create mode 100644 test/data/raw.txt create mode 100644 test/data/stylesheet.txt (limited to 'test') diff --git a/test/data/csv_data.txt b/test/data/csv_data.txt new file mode 100644 index 000000000..f33f47f7f --- /dev/null +++ b/test/data/csv_data.txt @@ -0,0 +1 @@ +foo, bar diff --git a/test/data/csv_dep.txt b/test/data/csv_dep.txt new file mode 100644 index 000000000..14620a926 --- /dev/null +++ b/test/data/csv_dep.txt @@ -0,0 +1,2 @@ +.. csv-table:: + :file: csv_data.txt diff --git a/test/data/dependencies.txt b/test/data/dependencies.txt new file mode 100644 index 000000000..cc18c8f0c --- /dev/null +++ b/test/data/dependencies.txt @@ -0,0 +1,8 @@ +.. image:: some_image.png + +.. include:: include.txt + +.. raw:: HTML + :file: raw.txt + +.. include:: include.txt diff --git a/test/data/include.txt b/test/data/include.txt new file mode 100644 index 000000000..ae2a894bb --- /dev/null +++ b/test/data/include.txt @@ -0,0 +1 @@ +Some include text. diff --git a/test/data/raw.txt b/test/data/raw.txt new file mode 100644 index 000000000..e69de29bb diff --git a/test/data/stylesheet.txt b/test/data/stylesheet.txt new file mode 100644 index 000000000..e69de29bb -- cgit v1.2.1 From be14b34c3b4a3e9271ba98e2802a800b23ba585a Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Thu, 30 Sep 2004 10:50:11 +0000 Subject: added test for dependency recorder git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2679 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_dependencies.py | 81 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100755 test/test_dependencies.py (limited to 'test') diff --git a/test/test_dependencies.py b/test/test_dependencies.py new file mode 100755 index 000000000..90ca7d825 --- /dev/null +++ b/test/test_dependencies.py @@ -0,0 +1,81 @@ +#! /usr/bin/env python + +# Author: Felix Wiemann +# Contact: Felix_Wiemann@ososo.de +# Revision: $Revision$ +# Date: $Date$ +# Copyright: This module has been placed in the public domain. + +""" +Test module for the --record-dependencies option. +""" + +import os.path +import unittest +import sys +import docutils.core +import docutils.utils +import DocutilsTestSupport + + +class RecordDependenciesTests(unittest.TestCase): + + def setUp(self): + self.testroot = os.path.dirname(DocutilsTestSupport.__file__) or '.' + self.datadir = os.path.join(self.testroot, 'data') + + def get_record(self, inputfile=None, **settings): + + recordfile = os.path.join(self.datadir, 'record.txt') + settings.setdefault('source_path', os.path.join(self.datadir, + 'dependencies.txt')) + settings.setdefault('settings_overrides', {}) + settings['settings_overrides'] = settings['settings_overrides'].copy() + settings['settings_overrides']['_disable_config'] = 1 + if not settings['settings_overrides'].has_key('record_dependencies'): + settings['settings_overrides']['record_dependencies'] = \ + docutils.utils.DependencyList(recordfile) + docutils.core.publish_file(destination=DocutilsTestSupport.DevNull(), + **settings) + settings['settings_overrides']['record_dependencies'].close() + return [dep.split('/')[-1] + for dep in open(recordfile).read().splitlines()] + + def test_dependencies(self): + self.assertEqual(self.get_record(), + ['include.txt', + 'raw.txt']) + self.assertEqual(self.get_record(writer_name='latex'), + ['include.txt', + 'raw.txt', + 'some_image.png']) + + def test_csv_dependencies(self): + try: + import csv + self.assertEqual(self.get_record(source_path=os.path.join( + self.datadir, 'csv_dep.txt')), ['csv_data.txt']) + except ImportError: + pass + + def test_stylesheet_dependencies(self): + + # Parameters to publish_file. + s = {'settings_overrides': {}} + so = s['settings_overrides'] + so['stylesheet_path'] = os.path.join(self.datadir, 'stylesheet.txt') + so['stylesheet'] = None + s['writer_name'] = 'html' + self.assert_('stylesheet.txt' not in + self.get_record(**s)) + so['embed_stylesheet'] = 1 + self.assert_('stylesheet.txt' in + self.get_record(**s)) + del so['embed_stylesheet'] + s['writer_name'] = 'latex' + self.assert_('stylesheet.txt' in + self.get_record(**s)) + + +if __name__ == '__main__': + unittest.main() -- cgit v1.2.1 From 124f37c038f86eb6c3b1344150840b5fd2a1cdbd Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Thu, 30 Sep 2004 13:47:59 +0000 Subject: setting footnote_references to "superscript" or "brackets" now causes footnote-reference-space to be trimmed or not, resp. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2681 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_html4css1.html | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index 75f4397c4..37589ef5b 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -151,11 +151,11 @@ They are transformed from section titles after parsing. --> <h3><a class="toc-backref" href="#id30" name="inline-markup">2.1.1   Inline Markup</a></h3> <p>Paragraphs contain text and may contain inline markup: <em>emphasis</em>, <strong>strong emphasis</strong>, <tt class="literal"><span class="pre">inline</span> <span class="pre">literals</span></tt>, standalone hyperlinks -(<a class="reference" href="http://www.python.org">http://www.python.org</a>), external hyperlinks (<a class="reference" href="http://www.python.org/">Python</a> <a class="footnote-reference" href="#id21" id="id22" name="id22"><sup>5</sup></a>), internal +(<a class="reference" href="http://www.python.org">http://www.python.org</a>), external hyperlinks (<a class="reference" href="http://www.python.org/">Python</a><a class="footnote-reference" href="#id21" id="id22" name="id22"><sup>5</sup></a>), internal cross-references (<a class="reference" href="#example">example</a>), external hyperlinks with embedded URIs (<a class="reference" href="http://www.python.org">Python web site</a>), footnote references -(manually numbered <a class="footnote-reference" href="#id6" id="id1" name="id1"><sup>1</sup></a>, anonymous auto-numbered <a class="footnote-reference" href="#id9" id="id2" name="id2"><sup>3</sup></a>, labeled -auto-numbered <a class="footnote-reference" href="#label" id="id3" name="id3"><sup>2</sup></a>, or symbolic <a class="footnote-reference" href="#id10" id="id4" name="id4"><sup>*</sup></a>), citation references +(manually numbered<a class="footnote-reference" href="#id6" id="id1" name="id1"><sup>1</sup></a>, anonymous auto-numbered<a class="footnote-reference" href="#id9" id="id2" name="id2"><sup>3</sup></a>, labeled +auto-numbered<a class="footnote-reference" href="#label" id="id3" name="id3"><sup>2</sup></a>, or symbolic<a class="footnote-reference" href="#id10" id="id4" name="id4"><sup>*</sup></a>), citation references (<a class="citation-reference" href="#cit2002" id="id5" name="id5">[CIT2002]</a>), substitution references (<img alt="EXAMPLE" src="../../../docs/user/rst/images/biohazard.png" />), and <a class="target" id="inline-hyperlink-targets" name="inline-hyperlink-targets">inline hyperlink targets</a> (see <a class="reference" href="#targets">Targets</a> below for a reference back to here). Character-level inline markup is also possible (although exceedingly @@ -363,7 +363,7 @@ least 3 spaces.</p> <table class="footnote" frame="void" id="label" rules="none"> <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> -<tr><td class="label"><a name="label">[2]</a></td><td><em>(<a class="fn-backref" href="#id3">1</a>, <a class="fn-backref" href="#id8">2</a>)</em> Footnotes may be numbered, either manually (as in <a class="footnote-reference" href="#id6" id="id7" name="id7"><sup>1</sup></a>) or +<tr><td class="label"><a name="label">[2]</a></td><td><em>(<a class="fn-backref" href="#id3">1</a>, <a class="fn-backref" href="#id8">2</a>)</em> Footnotes may be numbered, either manually (as in<a class="footnote-reference" href="#id6" id="id7" name="id7"><sup>1</sup></a>) or automatically using a "#"-prefixed label. This footnote has a label so it can be referred to from multiple places, both as a footnote reference (<a class="footnote-reference" href="#label" id="id8" name="id8"><sup>2</sup></a>) and as a hyperlink reference @@ -381,7 +381,7 @@ label of "#" only.</td></tr> <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> <tr><td class="label"><a class="fn-backref" href="#id4" name="id10">[*]</a></td><td>Footnotes may also use symbols, specified with a "*" label. -Here's a reference to the next footnote: <a class="footnote-reference" href="#id12" id="id11" name="id11"><sup>†</sup></a>.</td></tr> +Here's a reference to the next footnote:<a class="footnote-reference" href="#id12" id="id11" name="id11"><sup>†</sup></a>.</td></tr> </tbody> </table> <table class="footnote" frame="void" id="id12" rules="none"> @@ -394,7 +394,7 @@ Here's a reference to the next footnote: <a class="footnote-reference" href="#id <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> <tr><td class="label"><a name="id13">[4]</a></td><td>Here's an unreferenced footnote, with a reference to a -nonexistent footnote: <a href="#id65" name="id66"><span class="problematic" id="id66">[5]_</span></a>.</td></tr> +nonexistent footnote:<a href="#id65" name="id66"><span class="problematic" id="id66">[5]_</span></a>.</td></tr> </tbody> </table> </div> @@ -418,7 +418,7 @@ hyperlink targets</a> are also possible.</p> <p>Section headers are implicit targets, referred to by name. See <a class="reference" href="#targets">Targets</a>, which is a subsection of <a class="reference" href="#body-elements">Body Elements</a>.</p> <p>Explicit external targets are interpolated into references such as -"<a class="reference" href="http://www.python.org/">Python</a> <a class="footnote-reference" href="#id21" id="id23" name="id23"><sup>5</sup></a>".</p> +"<a class="reference" href="http://www.python.org/">Python</a><a class="footnote-reference" href="#id21" id="id23" name="id23"><sup>5</sup></a>".</p> <p>Targets may be indirect and anonymous. Thus <a class="reference" href="#targets">this phrase</a> may also refer to the <a class="reference" href="#targets">Targets</a> section.</p> <p>Here's a <a href="#id69" name="id70"><span class="problematic" id="id70">`hyperlink reference without a target`_</span></a>, which generates an @@ -576,7 +576,7 @@ Singing... </div> <div class="section" id="replacement-text"> <h3><a class="toc-backref" href="#id64" name="replacement-text">2.13.7   Replacement Text</a></h3> -<p>I recommend you try <a class="reference" href="http://www.python.org/">Python, <em>the</em> best language around</a> <a class="footnote-reference" href="#id21" id="id24" name="id24"><sup>5</sup></a>.</p> +<p>I recommend you try <a class="reference" href="http://www.python.org/">Python, <em>the</em> best language around</a><a class="footnote-reference" href="#id21" id="id24" name="id24"><sup>5</sup></a>.</p> </div> </div> <div class="section" id="substitution-definitions"> -- cgit v1.2.1 From 7cbda7d4e42f3484eb7f1d7f5cce4961cf6f6016 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Fri, 1 Oct 2004 16:03:36 +0000 Subject: added DocutilsTestSupport.testroot git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2683 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/DocutilsTestSupport.py | 3 +++ test/test_dependencies.py | 17 +++++++---------- test/test_functional.py | 7 ++----- 3 files changed, 12 insertions(+), 15 deletions(-) (limited to 'test') diff --git a/test/DocutilsTestSupport.py b/test/DocutilsTestSupport.py index 3f8451959..2c30e2b6f 100644 --- a/test/DocutilsTestSupport.py +++ b/test/DocutilsTestSupport.py @@ -73,6 +73,9 @@ except: StringList.__repr__ = StringList.__str__ +testroot = os.path.abspath(os.path.dirname(__file__) or os.path.curdir) + + class DevNull: """Output sink.""" diff --git a/test/test_dependencies.py b/test/test_dependencies.py index 90ca7d825..61d19a6f2 100755 --- a/test/test_dependencies.py +++ b/test/test_dependencies.py @@ -21,14 +21,12 @@ import DocutilsTestSupport class RecordDependenciesTests(unittest.TestCase): def setUp(self): - self.testroot = os.path.dirname(DocutilsTestSupport.__file__) or '.' - self.datadir = os.path.join(self.testroot, 'data') + os.chdir(os.path.join(DocutilsTestSupport.testroot, 'data')) def get_record(self, inputfile=None, **settings): - recordfile = os.path.join(self.datadir, 'record.txt') - settings.setdefault('source_path', os.path.join(self.datadir, - 'dependencies.txt')) + recordfile = 'record.txt' + settings.setdefault('source_path', 'dependencies.txt') settings.setdefault('settings_overrides', {}) settings['settings_overrides'] = settings['settings_overrides'].copy() settings['settings_overrides']['_disable_config'] = 1 @@ -38,8 +36,7 @@ class RecordDependenciesTests(unittest.TestCase): docutils.core.publish_file(destination=DocutilsTestSupport.DevNull(), **settings) settings['settings_overrides']['record_dependencies'].close() - return [dep.split('/')[-1] - for dep in open(recordfile).read().splitlines()] + return open(recordfile).read().splitlines() def test_dependencies(self): self.assertEqual(self.get_record(), @@ -53,8 +50,8 @@ class RecordDependenciesTests(unittest.TestCase): def test_csv_dependencies(self): try: import csv - self.assertEqual(self.get_record(source_path=os.path.join( - self.datadir, 'csv_dep.txt')), ['csv_data.txt']) + self.assertEqual(self.get_record(source_path='csv_dep.txt'), + ['csv_data.txt']) except ImportError: pass @@ -63,7 +60,7 @@ class RecordDependenciesTests(unittest.TestCase): # Parameters to publish_file. s = {'settings_overrides': {}} so = s['settings_overrides'] - so['stylesheet_path'] = os.path.join(self.datadir, 'stylesheet.txt') + so['stylesheet_path'] = 'stylesheet.txt' so['stylesheet'] = None s['writer_name'] = 'html' self.assert_('stylesheet.txt' not in diff --git a/test/test_functional.py b/test/test_functional.py index 091532dc4..aa55b0651 100755 --- a/test/test_functional.py +++ b/test/test_functional.py @@ -22,9 +22,6 @@ import docutils.core import DocutilsTestSupport -# Ugly magic to determine the test directory. -testroot = os.path.dirname(DocutilsTestSupport.__file__) or '.' - datadir = 'functional' """The directory to store the data needed for the functional tests.""" @@ -40,7 +37,7 @@ class FunctionalTestSuite(DocutilsTestSupport.CustomTestSuite): def __init__(self): """Process all config files in functional/tests/.""" DocutilsTestSupport.CustomTestSuite.__init__(self) - os.chdir(testroot) + os.chdir(DocutilsTestSupport.testroot) self.added = 0 os.path.walk(join_path(datadir, 'tests'), self.walker, None) assert self.added, 'No functional tests found.' @@ -76,7 +73,7 @@ class FunctionalTestCase(DocutilsTestSupport.CustomTestCase): def test(self): """Process self.configfile.""" - os.chdir(testroot) + os.chdir(DocutilsTestSupport.testroot) # Keyword parameters for publish_file: params = {} # Initialize 'settings_overrides' for test settings scripts, -- cgit v1.2.1 From c5824048c8123eb5763ebf5d0be21e396c5897c4 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Fri, 1 Oct 2004 16:06:44 +0000 Subject: changed default footnote reference styles: brackets for HTML and superscript for LaTeX git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2684 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_html4css1.html | 18 +++++++++--------- test/functional/expected/standalone_rst_latex.tex | 18 +++++++++--------- 2 files changed, 18 insertions(+), 18 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index 37589ef5b..15763e916 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -151,11 +151,11 @@ They are transformed from section titles after parsing. --> <h3><a class="toc-backref" href="#id30" name="inline-markup">2.1.1   Inline Markup</a></h3> <p>Paragraphs contain text and may contain inline markup: <em>emphasis</em>, <strong>strong emphasis</strong>, <tt class="literal"><span class="pre">inline</span> <span class="pre">literals</span></tt>, standalone hyperlinks -(<a class="reference" href="http://www.python.org">http://www.python.org</a>), external hyperlinks (<a class="reference" href="http://www.python.org/">Python</a><a class="footnote-reference" href="#id21" id="id22" name="id22"><sup>5</sup></a>), internal +(<a class="reference" href="http://www.python.org">http://www.python.org</a>), external hyperlinks (<a class="reference" href="http://www.python.org/">Python</a> <a class="footnote-reference" href="#id21" id="id22" name="id22">[5]</a>), internal cross-references (<a class="reference" href="#example">example</a>), external hyperlinks with embedded URIs (<a class="reference" href="http://www.python.org">Python web site</a>), footnote references -(manually numbered<a class="footnote-reference" href="#id6" id="id1" name="id1"><sup>1</sup></a>, anonymous auto-numbered<a class="footnote-reference" href="#id9" id="id2" name="id2"><sup>3</sup></a>, labeled -auto-numbered<a class="footnote-reference" href="#label" id="id3" name="id3"><sup>2</sup></a>, or symbolic<a class="footnote-reference" href="#id10" id="id4" name="id4"><sup>*</sup></a>), citation references +(manually numbered <a class="footnote-reference" href="#id6" id="id1" name="id1">[1]</a>, anonymous auto-numbered <a class="footnote-reference" href="#id9" id="id2" name="id2">[3]</a>, labeled +auto-numbered <a class="footnote-reference" href="#label" id="id3" name="id3">[2]</a>, or symbolic <a class="footnote-reference" href="#id10" id="id4" name="id4">[*]</a>), citation references (<a class="citation-reference" href="#cit2002" id="id5" name="id5">[CIT2002]</a>), substitution references (<img alt="EXAMPLE" src="../../../docs/user/rst/images/biohazard.png" />), and <a class="target" id="inline-hyperlink-targets" name="inline-hyperlink-targets">inline hyperlink targets</a> (see <a class="reference" href="#targets">Targets</a> below for a reference back to here). Character-level inline markup is also possible (although exceedingly @@ -363,10 +363,10 @@ least 3 spaces.</p> <table class="footnote" frame="void" id="label" rules="none"> <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> -<tr><td class="label"><a name="label">[2]</a></td><td><em>(<a class="fn-backref" href="#id3">1</a>, <a class="fn-backref" href="#id8">2</a>)</em> Footnotes may be numbered, either manually (as in<a class="footnote-reference" href="#id6" id="id7" name="id7"><sup>1</sup></a>) or +<tr><td class="label"><a name="label">[2]</a></td><td><em>(<a class="fn-backref" href="#id3">1</a>, <a class="fn-backref" href="#id8">2</a>)</em> Footnotes may be numbered, either manually (as in <a class="footnote-reference" href="#id6" id="id7" name="id7">[1]</a>) or automatically using a "#"-prefixed label. This footnote has a label so it can be referred to from multiple places, both as a -footnote reference (<a class="footnote-reference" href="#label" id="id8" name="id8"><sup>2</sup></a>) and as a hyperlink reference +footnote reference (<a class="footnote-reference" href="#label" id="id8" name="id8">[2]</a>) and as a hyperlink reference (<a class="reference" href="#label">label</a>).</td></tr> </tbody> </table> @@ -381,7 +381,7 @@ label of "#" only.</td></tr> <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> <tr><td class="label"><a class="fn-backref" href="#id4" name="id10">[*]</a></td><td>Footnotes may also use symbols, specified with a "*" label. -Here's a reference to the next footnote:<a class="footnote-reference" href="#id12" id="id11" name="id11"><sup>†</sup></a>.</td></tr> +Here's a reference to the next footnote: <a class="footnote-reference" href="#id12" id="id11" name="id11">[†]</a>.</td></tr> </tbody> </table> <table class="footnote" frame="void" id="id12" rules="none"> @@ -394,7 +394,7 @@ Here's a reference to the next footnote:<a class="footnote-reference" href="#id1 <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> <tr><td class="label"><a name="id13">[4]</a></td><td>Here's an unreferenced footnote, with a reference to a -nonexistent footnote:<a href="#id65" name="id66"><span class="problematic" id="id66">[5]_</span></a>.</td></tr> +nonexistent footnote: <a href="#id65" name="id66"><span class="problematic" id="id66">[5]_</span></a>.</td></tr> </tbody> </table> </div> @@ -418,7 +418,7 @@ hyperlink targets</a> are also possible.</p> <p>Section headers are implicit targets, referred to by name. See <a class="reference" href="#targets">Targets</a>, which is a subsection of <a class="reference" href="#body-elements">Body Elements</a>.</p> <p>Explicit external targets are interpolated into references such as -"<a class="reference" href="http://www.python.org/">Python</a><a class="footnote-reference" href="#id21" id="id23" name="id23"><sup>5</sup></a>".</p> +"<a class="reference" href="http://www.python.org/">Python</a> <a class="footnote-reference" href="#id21" id="id23" name="id23">[5]</a>".</p> <p>Targets may be indirect and anonymous. Thus <a class="reference" href="#targets">this phrase</a> may also refer to the <a class="reference" href="#targets">Targets</a> section.</p> <p>Here's a <a href="#id69" name="id70"><span class="problematic" id="id70">`hyperlink reference without a target`_</span></a>, which generates an @@ -576,7 +576,7 @@ Singing... </div> <div class="section" id="replacement-text"> <h3><a class="toc-backref" href="#id64" name="replacement-text">2.13.7   Replacement Text</a></h3> -<p>I recommend you try <a class="reference" href="http://www.python.org/">Python, <em>the</em> best language around</a><a class="footnote-reference" href="#id21" id="id24" name="id24"><sup>5</sup></a>.</p> +<p>I recommend you try <a class="reference" href="http://www.python.org/">Python, <em>the</em> best language around</a> <a class="footnote-reference" href="#id21" id="id24" name="id24">[5]</a>.</p> </div> </div> <div class="section" id="substitution-definitions"> diff --git a/test/functional/expected/standalone_rst_latex.tex b/test/functional/expected/standalone_rst_latex.tex index e433f4480..e8b7a8bc9 100644 --- a/test/functional/expected/standalone_rst_latex.tex +++ b/test/functional/expected/standalone_rst_latex.tex @@ -264,11 +264,11 @@ A paragraph. Paragraphs contain text and may contain inline markup: \emph{emphasis}, \textbf{strong emphasis}, \texttt{inline literals}, standalone hyperlinks -(\href{http://www.python.org}{http://www.python.org}), external hyperlinks (\href{http://www.python.org/}{Python} [\hyperlink{id21}{5}]), internal +(\href{http://www.python.org}{http://www.python.org}), external hyperlinks (\href{http://www.python.org/}{Python}\raisebox{.5em}[0em]{\scriptsize\hyperlink{id21}{5}}), internal cross-references (\href{\#example}{example}), external hyperlinks with embedded URIs (\href{http://www.python.org}{Python web site}), footnote references -(manually numbered [\hyperlink{id6}{1}], anonymous auto-numbered [\hyperlink{id9}{3}], labeled -auto-numbered [\hyperlink{label}{2}], or symbolic [\hyperlink{id10}{*}]), citation references +(manually numbered\raisebox{.5em}[0em]{\scriptsize\hyperlink{id6}{1}}, anonymous auto-numbered\raisebox{.5em}[0em]{\scriptsize\hyperlink{id9}{3}}, labeled +auto-numbered\raisebox{.5em}[0em]{\scriptsize\hyperlink{label}{2}}, or symbolic\raisebox{.5em}[0em]{\scriptsize\hyperlink{id10}{*}}), citation references ([\hyperlink{cit2002}{CIT2002}]), substitution references (\includegraphics{../../../docs/user/rst/images/biohazard.png}), and \hypertarget{inline-hyperlink-targets}{inline hyperlink targets} (see \href{\#targets}{Targets} below for a reference back to here). Character-level inline markup is also possible (although exceedingly @@ -602,10 +602,10 @@ least 3 spaces. This is the footnote's second paragraph. \end{figure} \begin{figure}[b]\hypertarget{label}[2] -Footnotes may be numbered, either manually (as in [\hyperlink{id6}{1}]) or +Footnotes may be numbered, either manually (as in\raisebox{.5em}[0em]{\scriptsize\hyperlink{id6}{1}}) or automatically using a ``{\#}''-prefixed label. This footnote has a label so it can be referred to from multiple places, both as a -footnote reference ([\hyperlink{label}{2}]) and as a hyperlink reference +footnote reference (\raisebox{.5em}[0em]{\scriptsize\hyperlink{label}{2}}) and as a hyperlink reference (\href{\#label}{label}). \end{figure} \begin{figure}[b]\hypertarget{id9}[3] @@ -614,14 +614,14 @@ label of ``{\#}'' only. \end{figure} \begin{figure}[b]\hypertarget{id10}[*] Footnotes may also use symbols, specified with a ``*'' label. -Here's a reference to the next footnote: [\hyperlink{id12}{{\dag}}]. +Here's a reference to the next footnote:\raisebox{.5em}[0em]{\scriptsize\hyperlink{id12}{{\dag}}}. \end{figure} \begin{figure}[b]\hypertarget{id12}[{\dag}] This footnote shows the next symbol in the sequence. \end{figure} \begin{figure}[b]\hypertarget{id13}[4] Here's an unreferenced footnote, with a reference to a -nonexistent footnote: {\color{red}\bfseries{}{[}5]{\_}}. +nonexistent footnote:{\color{red}\bfseries{}{[}5]{\_}}. \end{figure} @@ -653,7 +653,7 @@ Section headers are implicit targets, referred to by name. See \href{\#targets}{Targets}, which is a subsection of \href{\#body-elements}{Body Elements}. Explicit external targets are interpolated into references such as -``\href{http://www.python.org/}{Python} [\hyperlink{id21}{5}]''. +``\href{http://www.python.org/}{Python}\raisebox{.5em}[0em]{\scriptsize\hyperlink{id21}{5}}''. Targets may be indirect and anonymous. Thus \href{\#targets}{this phrase} may also refer to the \href{\#targets}{Targets} section. @@ -946,7 +946,7 @@ Singing... \pdfbookmark[2]{2.13.7~~~Replacement Text}{replacement-text} \subsubsection*{2.13.7~~~Replacement Text} -I recommend you try \href{http://www.python.org/}{Python, \emph{the} best language around} [\hyperlink{id21}{5}]. +I recommend you try \href{http://www.python.org/}{Python, \emph{the} best language around}\raisebox{.5em}[0em]{\scriptsize\hyperlink{id21}{5}}. %___________________________________________________________________________ -- cgit v1.2.1 From fe4b262bb4706aa8bf7a7ea2567df93d1452fa58 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Tue, 5 Oct 2004 01:22:15 +0000 Subject: improved usefulness of test output git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2693 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_functional.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/test_functional.py b/test/test_functional.py index aa55b0651..4cacfb8f4 100755 --- a/test/test_functional.py +++ b/test/test_functional.py @@ -113,8 +113,15 @@ class FunctionalTestCase(DocutilsTestSupport.CustomTestCase): self.assert_(os.access(expected_path, os.R_OK),\ 'Cannot find expected output at\n' + expected_path) expected = open(expected_path).read() - diff = ('Please compare the expected and actual output files:\n' - 'diff %s %s\n' % (expected_path, params['destination_path'])) + diff = ('The expected and actual output differs.\n' + 'Please compare the expected and actual output files:\n' + ' diff %s %s\n' + 'If the actual output is correct, please replace the\n' + 'expected output and check it in to CVS:\n' + ' mv %s %s\n' + ' cvs commit -m "<comment>" %s' + % (expected_path, params['destination_path'], + params['destination_path'], expected_path, expected_path)) try: self.assertEquals(output, expected, diff) except AssertionError: -- cgit v1.2.1 From 24931fecad6a3eb7733a4c9beb1cbc6fa4758853 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Tue, 5 Oct 2004 01:22:34 +0000 Subject: line block test data (temporary; to be merged into standard.txt) git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2694 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/input/data/line_blocks.txt | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 test/functional/input/data/line_blocks.txt (limited to 'test') diff --git a/test/functional/input/data/line_blocks.txt b/test/functional/input/data/line_blocks.txt new file mode 100644 index 000000000..092403eda --- /dev/null +++ b/test/functional/input/data/line_blocks.txt @@ -0,0 +1,30 @@ +Line Blocks +----------- + +| This is a line block. It ends with a blank line. +| New lines begin with a vertical bar ("|"). +| Line breaks and initial indent are significant, and preserved. +| Continuation lines are also possible. A long line that is intended + to wrap should begin with a space in place of the vertical bar. +| The left edge of a continuation line need not be aligned with + the left edge of the text above it. + +| This is a second line block. +| +| Blank lines are permitted internally, but they must begin with a "|". + +Take it away, Eric the Orchestra Leader! + + | A one, two, a one two three four + | + | Half a bee, philosophically, + | must, *ipso facto*, half not be. + | But half the bee has got to be, + | *vis a vis* its entity. D'you see? + | + | But can a bee be said to be + | or not to be an entire bee, + | when half the bee is not a bee, + | due to some ancient injury? + | + | Singing... -- cgit v1.2.1 From 0f92d806f873a1f1fb05d893e22f2631787c6179 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Tue, 5 Oct 2004 01:22:40 +0000 Subject: tests for line blocks git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2695 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_parsers/test_rst/test_line_blocks.py | 208 +++++++++++++++++++++++++ 1 file changed, 208 insertions(+) create mode 100755 test/test_parsers/test_rst/test_line_blocks.py (limited to 'test') diff --git a/test/test_parsers/test_rst/test_line_blocks.py b/test/test_parsers/test_rst/test_line_blocks.py new file mode 100755 index 000000000..ff26ac639 --- /dev/null +++ b/test/test_parsers/test_rst/test_line_blocks.py @@ -0,0 +1,208 @@ +#! /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 states.py. +""" + +from __init__ import DocutilsTestSupport + +def suite(): + s = DocutilsTestSupport.ParserTestSuite() + s.generateTests(totest) + return s + +totest = {} + +totest['line_blocks'] = [ +["""\ +| This is a line block. +| Line breaks are *preserved*. + +| This is a second line block. + +| This is a third. +""", +"""\ +<document source="test data"> + <line_block> + <line> + This is a line block. + <line> + Line breaks are \n\ + <emphasis> + preserved + . + <line_block> + <line> + This is a second line block. + <line_block> + <line> + This is a third. +"""], +["""\ +| In line blocks, +| Initial indentation is *also* preserved. +""", +"""\ +<document source="test data"> + <line_block> + <line> + In line blocks, + <line_block> + <line> + Initial indentation is \n\ + <emphasis> + also + preserved. +"""], +["""\ +| Individual lines in line blocks + *may* wrap, as indicated by the lack of a vertical bar prefix. +| These are called "continuation lines". +""", +"""\ +<document source="test data"> + <line_block> + <line> + Individual lines in line blocks + <emphasis> + may + wrap, as indicated by the lack of a vertical bar prefix. + <line> + These are called "continuation lines". +"""], +["""\ +| Inline markup in line blocks may also wrap *to + continuation lines*. +| But not to following lines. +""", +"""\ +<document source="test data"> + <line_block> + <line> + Inline markup in line blocks may also wrap \n\ + <emphasis> + to + continuation lines + . + <line> + But not to following lines. +"""], +["""\ +\\| This is not a line block. +The vertical bar is simply part of a paragraph. +""", +"""\ +<document source="test data"> + <paragraph> + | This is not a line block. + The vertical bar is simply part of a paragraph. +"""], +["""\ +| This line block is incomplete. +There should be a blank line before this paragraph. +""", +"""\ +<document source="test data"> + <line_block> + <line> + This line block is incomplete. + <system_message level="2" line="2" source="test data" type="WARNING"> + <paragraph> + Line block ends without a blank line. + <paragraph> + There should be a blank line before this paragraph. +"""], +["""\ +| This line block contains +| +| blank lines. +""", +"""\ +<document source="test data"> + <line_block> + <line> + This line block contains + <line> + <line> + blank lines. +"""], +["""\ +| The blank lines in this block +| \n\ +| \n\ +| have bogus spaces. +""", +"""\ +<document source="test data"> + <line_block> + <line> + The blank lines in this block + <line> + <line> + <line> + have bogus spaces. +"""], +["""\ +| Initial indentation is also significant and preserved: +| +| Indented 4 spaces +| Not indented +| Indented 2 spaces +| Indented 4 spaces +| Only one space +| +| Continuation lines may be indented less + than their base lines. +""", +"""\ +<document source="test data"> + <line_block> + <line> + Initial indentation is also significant and preserved: + <line> + <line_block> + <line> + Indented 4 spaces + <line> + Not indented + <line_block> + <line_block> + <line> + Indented 2 spaces + <line_block> + <line> + Indented 4 spaces + <line> + Only one space + <line> + <line_block> + <line> + Continuation lines may be indented less + than their base lines. +"""], +["""\ +| +| This block begins and ends with blank lines. +| +""", +"""\ +<document source="test data"> + <line_block> + <line> + <line> + This block begins and ends with blank lines. + <line> +"""], +] + + +if __name__ == '__main__': + import unittest + unittest.main(defaultTest='suite') -- cgit v1.2.1 From d302e1c95789cc606d06580c5a351f091cb64e20 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Tue, 5 Oct 2004 01:22:47 +0000 Subject: tests for the line-block directive git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2696 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../test_rst/test_directives/test_line_blocks.py | 81 ++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100755 test/test_parsers/test_rst/test_directives/test_line_blocks.py (limited to 'test') diff --git a/test/test_parsers/test_rst/test_directives/test_line_blocks.py b/test/test_parsers/test_rst/test_directives/test_line_blocks.py new file mode 100755 index 000000000..f8d156e4b --- /dev/null +++ b/test/test_parsers/test_rst/test_directives/test_line_blocks.py @@ -0,0 +1,81 @@ +#! /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 body.py 'line-block' directive. +""" + +from __init__ import DocutilsTestSupport + +def suite(): + s = DocutilsTestSupport.ParserTestSuite() + s.generateTests(totest) + return s + +totest = {} + +totest['line_blocks'] = [ +["""\ +.. line-block:: + + This is a line block. + Newlines are *preserved*. + As is initial whitespace. +""", +"""\ +<document source="test data"> + <line_block> + <line> + This is a line block. + <line> + Newlines are \n\ + <emphasis> + preserved + . + <line_block> + <line> + As is initial whitespace. +"""], +["""\ +.. line-block:: + + Inline markup *may not span + multiple lines* of a line block. +""", +"""\ +<document source="test data"> + <line_block> + <line> + Inline markup \n\ + <problematic id="id2" refid="id1"> + * + may not span + <line_block> + <line> + multiple lines* of a line block. + <system_message backrefs="id2" id="id1" level="2" line="3" source="test data" type="WARNING"> + <paragraph> + Inline emphasis start-string without end-string. +"""], +["""\ +.. line-block:: +""", +"""\ +<document source="test data"> + <system_message level="2" line="1" source="test data" type="WARNING"> + <paragraph> + Content block expected for the "line-block" directive; none found. + <literal_block xml:space="preserve"> + .. line-block:: +"""], +] + + +if __name__ == '__main__': + import unittest + unittest.main(defaultTest='suite') -- cgit v1.2.1 From 52f8d5fcfca008f026f4cb9395666721d07f871a Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Tue, 5 Oct 2004 01:22:55 +0000 Subject: updated for line block syntax git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2697 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../expected/standalone_rst_html4css1.html | 257 ++++++++++++--------- test/functional/expected/standalone_rst_latex.tex | 154 ++++++------ test/functional/input/data/standard.txt | 26 +-- test/functional/input/standalone_rst_html4css1.txt | 1 + test/test_parsers/test_rst/test_inline_markup.py | 4 +- 5 files changed, 224 insertions(+), 218 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index 15763e916..2b94afa22 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -84,74 +84,75 @@ They are transformed from section titles after parsing. --> <div class="contents topic" id="table-of-contents"> <p class="topic-title first"><a name="table-of-contents">Table of Contents</a></p> <ul class="auto-toc simple"> -<li><a class="reference" href="#structural-elements" id="id25" name="id25">1   Structural Elements</a><ul class="auto-toc"> -<li><a class="reference" href="#section-title" id="id26" name="id26">1.1   Section Title</a></li> -<li><a class="reference" href="#transitions" id="id27" name="id27">1.2   Transitions</a></li> +<li><a class="reference" href="#structural-elements" id="id26" name="id26">1   Structural Elements</a><ul class="auto-toc"> +<li><a class="reference" href="#section-title" id="id27" name="id27">1.1   Section Title</a></li> +<li><a class="reference" href="#transitions" id="id28" name="id28">1.2   Transitions</a></li> </ul> </li> -<li><a class="reference" href="#body-elements" id="id28" name="id28">2   Body Elements</a><ul class="auto-toc"> -<li><a class="reference" href="#paragraphs" id="id29" name="id29">2.1   Paragraphs</a><ul class="auto-toc"> -<li><a class="reference" href="#inline-markup" id="id30" name="id30">2.1.1   Inline Markup</a></li> +<li><a class="reference" href="#body-elements" id="id29" name="id29">2   Body Elements</a><ul class="auto-toc"> +<li><a class="reference" href="#paragraphs" id="id30" name="id30">2.1   Paragraphs</a><ul class="auto-toc"> +<li><a class="reference" href="#inline-markup" id="id31" name="id31">2.1.1   Inline Markup</a></li> </ul> </li> -<li><a class="reference" href="#bullet-lists" id="id31" name="id31">2.2   Bullet Lists</a></li> -<li><a class="reference" href="#enumerated-lists" id="id32" name="id32">2.3   Enumerated Lists</a></li> -<li><a class="reference" href="#definition-lists" id="id33" name="id33">2.4   Definition Lists</a></li> -<li><a class="reference" href="#field-lists" id="id34" name="id34">2.5   Field Lists</a></li> -<li><a class="reference" href="#option-lists" id="id35" name="id35">2.6   Option Lists</a></li> -<li><a class="reference" href="#literal-blocks" id="id36" name="id36">2.7   Literal Blocks</a></li> -<li><a class="reference" href="#block-quotes" id="id37" name="id37">2.8   Block Quotes</a></li> -<li><a class="reference" href="#doctest-blocks" id="id38" name="id38">2.9   Doctest Blocks</a></li> -<li><a class="reference" href="#footnotes" id="id39" name="id39">2.10   Footnotes</a></li> -<li><a class="reference" href="#citations" id="id40" name="id40">2.11   Citations</a></li> -<li><a class="reference" href="#targets" id="id41" name="id41">2.12   Targets</a><ul class="auto-toc"> -<li><a class="reference" href="#duplicate-target-names" id="id42" name="id42">2.12.1   Duplicate Target Names</a></li> -<li><a class="reference" href="#id18" id="id43" name="id43">2.12.2   Duplicate Target Names</a></li> +<li><a class="reference" href="#bullet-lists" id="id32" name="id32">2.2   Bullet Lists</a></li> +<li><a class="reference" href="#enumerated-lists" id="id33" name="id33">2.3   Enumerated Lists</a></li> +<li><a class="reference" href="#definition-lists" id="id34" name="id34">2.4   Definition Lists</a></li> +<li><a class="reference" href="#field-lists" id="id35" name="id35">2.5   Field Lists</a></li> +<li><a class="reference" href="#option-lists" id="id36" name="id36">2.6   Option Lists</a></li> +<li><a class="reference" href="#literal-blocks" id="id37" name="id37">2.7   Literal Blocks</a></li> +<li><a class="reference" href="#line-blocks" id="id38" name="id38">2.8   Line Blocks</a></li> +<li><a class="reference" href="#block-quotes" id="id39" name="id39">2.9   Block Quotes</a></li> +<li><a class="reference" href="#doctest-blocks" id="id40" name="id40">2.10   Doctest Blocks</a></li> +<li><a class="reference" href="#footnotes" id="id41" name="id41">2.11   Footnotes</a></li> +<li><a class="reference" href="#citations" id="id42" name="id42">2.12   Citations</a></li> +<li><a class="reference" href="#targets" id="id43" name="id43">2.13   Targets</a><ul class="auto-toc"> +<li><a class="reference" href="#duplicate-target-names" id="id44" name="id44">2.13.1   Duplicate Target Names</a></li> +<li><a class="reference" href="#id18" id="id45" name="id45">2.13.2   Duplicate Target Names</a></li> </ul> </li> -<li><a class="reference" href="#directives" id="id44" name="id44">2.13   Directives</a><ul class="auto-toc"> -<li><a class="reference" href="#document-parts" id="id45" name="id45">2.13.1   Document Parts</a></li> -<li><a class="reference" href="#images" id="id46" name="id46">2.13.2   Images</a></li> -<li><a class="reference" href="#admonitions" id="id47" name="id47">2.13.3   Admonitions</a></li> -<li><a class="reference" href="#topics-sidebars-and-rubrics" id="id48" name="id48">2.13.4   Topics, Sidebars, and Rubrics</a></li> -<li><a class="reference" href="#target-footnotes" id="id49" name="id49">2.13.5   Target Footnotes</a></li> -<li><a class="reference" href="#line-blocks" id="id50" name="id50">2.13.6   Line Blocks</a></li> -<li><a class="reference" href="#replacement-text" id="id51" name="id51">2.13.7   Replacement Text</a></li> +<li><a class="reference" href="#directives" id="id46" name="id46">2.14   Directives</a><ul class="auto-toc"> +<li><a class="reference" href="#document-parts" id="id47" name="id47">2.14.1   Document Parts</a></li> +<li><a class="reference" href="#images" id="id48" name="id48">2.14.2   Images</a></li> +<li><a class="reference" href="#admonitions" id="id49" name="id49">2.14.3   Admonitions</a></li> +<li><a class="reference" href="#topics-sidebars-and-rubrics" id="id50" name="id50">2.14.4   Topics, Sidebars, and Rubrics</a></li> +<li><a class="reference" href="#target-footnotes" id="id51" name="id51">2.14.5   Target Footnotes</a></li> +<li><a class="reference" href="#replacement-text" id="id52" name="id52">2.14.6   Replacement Text</a></li> </ul> </li> -<li><a class="reference" href="#substitution-definitions" id="id52" name="id52">2.14   Substitution Definitions</a></li> -<li><a class="reference" href="#comments" id="id53" name="id53">2.15   Comments</a></li> -<li><a class="reference" href="#colspanning-tables" id="id54" name="id54">2.16   Colspanning tables</a></li> -<li><a class="reference" href="#rowspanning-tables" id="id55" name="id55">2.17   Rowspanning tables</a></li> -<li><a class="reference" href="#complex-tables" id="id56" name="id56">2.18   Complex tables</a></li> +<li><a class="reference" href="#substitution-definitions" id="id53" name="id53">2.15   Substitution Definitions</a></li> +<li><a class="reference" href="#comments" id="id54" name="id54">2.16   Comments</a></li> +<li><a class="reference" href="#id19" id="id55" name="id55">2.17   Line Blocks</a></li> +<li><a class="reference" href="#colspanning-tables" id="id56" name="id56">2.18   Colspanning tables</a></li> +<li><a class="reference" href="#rowspanning-tables" id="id57" name="id57">2.19   Rowspanning tables</a></li> +<li><a class="reference" href="#complex-tables" id="id58" name="id58">2.20   Complex tables</a></li> </ul> </li> -<li><a class="reference" href="#error-handling" id="id57" name="id57">3   Error Handling</a></li> +<li><a class="reference" href="#error-handling" id="id59" name="id59">3   Error Handling</a></li> </ul> </div> <div class="section" id="structural-elements"> -<h1><a class="toc-backref" href="#id25" name="structural-elements">1   Structural Elements</a></h1> +<h1><a class="toc-backref" href="#id26" name="structural-elements">1   Structural Elements</a></h1> <div class="section" id="section-title"> -<h2><a class="toc-backref" href="#id26" name="section-title">1.1   Section Title</a></h2> +<h2><a class="toc-backref" href="#id27" name="section-title">1.1   Section Title</a></h2> <p>That's it, the text just above this line.</p> </div> <div class="section" id="transitions"> -<h2><a class="toc-backref" href="#id27" name="transitions">1.2   Transitions</a></h2> +<h2><a class="toc-backref" href="#id28" name="transitions">1.2   Transitions</a></h2> <p>Here's a transition:</p> <hr /> <p>It divides the section.</p> </div> </div> <div class="section" id="body-elements"> -<h1><a class="toc-backref" href="#id28" name="body-elements">2   Body Elements</a></h1> +<h1><a class="toc-backref" href="#id29" name="body-elements">2   Body Elements</a></h1> <div class="section" id="paragraphs"> -<h2><a class="toc-backref" href="#id29" name="paragraphs">2.1   Paragraphs</a></h2> +<h2><a class="toc-backref" href="#id30" name="paragraphs">2.1   Paragraphs</a></h2> <p>A paragraph.</p> <div class="section" id="inline-markup"> -<h3><a class="toc-backref" href="#id30" name="inline-markup">2.1.1   Inline Markup</a></h3> +<h3><a class="toc-backref" href="#id31" name="inline-markup">2.1.1   Inline Markup</a></h3> <p>Paragraphs contain text and may contain inline markup: <em>emphasis</em>, <strong>strong emphasis</strong>, <tt class="literal"><span class="pre">inline</span> <span class="pre">literals</span></tt>, standalone hyperlinks -(<a class="reference" href="http://www.python.org">http://www.python.org</a>), external hyperlinks (<a class="reference" href="http://www.python.org/">Python</a> <a class="footnote-reference" href="#id21" id="id22" name="id22">[5]</a>), internal +(<a class="reference" href="http://www.python.org">http://www.python.org</a>), external hyperlinks (<a class="reference" href="http://www.python.org/">Python</a> <a class="footnote-reference" href="#id22" id="id23" name="id23">[5]</a>), internal cross-references (<a class="reference" href="#example">example</a>), external hyperlinks with embedded URIs (<a class="reference" href="http://www.python.org">Python web site</a>), footnote references (manually numbered <a class="footnote-reference" href="#id6" id="id1" name="id1">[1]</a>, anonymous auto-numbered <a class="footnote-reference" href="#id9" id="id2" name="id2">[3]</a>, labeled @@ -160,7 +161,7 @@ auto-numbered <a class="footnote-reference" href="#label" id="id3" name="id3">[2 hyperlink targets</a> (see <a class="reference" href="#targets">Targets</a> below for a reference back to here). Character-level inline markup is also possible (although exceedingly ugly!) in <em>re</em><tt class="literal"><span class="pre">Structured</span></tt><em>Text</em>. Problems are indicated by -<a href="#id19" name="id20"><span class="problematic" id="id20">|problematic|</span></a> text (generated by processing errors; this one is +<a href="#id20" name="id21"><span class="problematic" id="id21">|problematic|</span></a> text (generated by processing errors; this one is intentional).</p> <p>The default role for interpreted text is <cite>Title Reference</cite>. Here are some explicit interpreted text roles: a PEP reference (<a class="reference" href="http://www.python.org/peps/pep-0287.html">PEP 287</a>); an @@ -179,7 +180,7 @@ live link to PEP 258 here.</p> </div> </div> <div class="section" id="bullet-lists"> -<h2><a class="toc-backref" href="#id31" name="bullet-lists">2.2   Bullet Lists</a></h2> +<h2><a class="toc-backref" href="#id32" name="bullet-lists">2.2   Bullet Lists</a></h2> <ul> <li><p class="first">A bullet list</p> <ul class="simple"> @@ -202,7 +203,7 @@ live link to PEP 258 here.</p> </ul> </div> <div class="section" id="enumerated-lists"> -<h2><a class="toc-backref" href="#id32" name="enumerated-lists">2.3   Enumerated Lists</a></h2> +<h2><a class="toc-backref" href="#id33" name="enumerated-lists">2.3   Enumerated Lists</a></h2> <ol class="arabic"> <li><p class="first">Arabic numerals.</p> <ol class="loweralpha simple"> @@ -235,7 +236,7 @@ live link to PEP 258 here.</p> </ol> </div> <div class="section" id="definition-lists"> -<h2><a class="toc-backref" href="#id33" name="definition-lists">2.4   Definition Lists</a></h2> +<h2><a class="toc-backref" href="#id34" name="definition-lists">2.4   Definition Lists</a></h2> <dl> <dt>Term</dt> <dd>Definition</dd> @@ -248,7 +249,7 @@ live link to PEP 258 here.</p> </dl> </div> <div class="section" id="field-lists"> -<h2><a class="toc-backref" href="#id34" name="field-lists">2.5   Field Lists</a></h2> +<h2><a class="toc-backref" href="#id35" name="field-lists">2.5   Field Lists</a></h2> <table class="field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> @@ -266,7 +267,7 @@ relative to the field marker.</p> </table> </div> <div class="section" id="option-lists"> -<h2><a class="toc-backref" href="#id35" name="option-lists">2.6   Option Lists</a></h2> +<h2><a class="toc-backref" href="#id36" name="option-lists">2.6   Option Lists</a></h2> <p>For listing command-line options:</p> <table class="option-list" frame="void" rules="none"> <col class="option" /> @@ -312,7 +313,7 @@ regardless of where it starts.</p> description.</p> </div> <div class="section" id="literal-blocks"> -<h2><a class="toc-backref" href="#id36" name="literal-blocks">2.7   Literal Blocks</a></h2> +<h2><a class="toc-backref" href="#id37" name="literal-blocks">2.7   Literal Blocks</a></h2> <p>Literal blocks are indicated with a double-colon ("::") at the end of the preceding paragraph (over there <tt class="literal"><span class="pre">--></span></tt>). They can be indented:</p> <pre class="literal-block"> @@ -328,8 +329,13 @@ if literal_block: > Why didn't I think of that? </pre> </div> +<div class="section" id="line-blocks"> +<h2><a class="toc-backref" href="#id38" name="line-blocks">2.8   Line Blocks</a></h2> +<p>(To be inserted from line_blocks.txt once the LaTeX writer has +implemented it.)</p> +</div> <div class="section" id="block-quotes"> -<h2><a class="toc-backref" href="#id37" name="block-quotes">2.8   Block Quotes</a></h2> +<h2><a class="toc-backref" href="#id39" name="block-quotes">2.9   Block Quotes</a></h2> <p>Block quotes consist of indented body elements:</p> <blockquote> <p>My theory by A. Elk. Brackets Miss, brackets. This theory goes @@ -341,7 +347,7 @@ own it, and what it is too.</p> </blockquote> </div> <div class="section" id="doctest-blocks"> -<h2><a class="toc-backref" href="#id38" name="doctest-blocks">2.9   Doctest Blocks</a></h2> +<h2><a class="toc-backref" href="#id40" name="doctest-blocks">2.10   Doctest Blocks</a></h2> <pre class="doctest-block"> >>> print 'Python-specific usage examples; begun with ">>>"' Python-specific usage examples; begun with ">>>" @@ -350,7 +356,7 @@ Python-specific usage examples; begun with ">>>" </pre> </div> <div class="section" id="footnotes"> -<h2><a class="toc-backref" href="#id39" name="footnotes">2.10   Footnotes</a></h2> +<h2><a class="toc-backref" href="#id41" name="footnotes">2.11   Footnotes</a></h2> <table class="footnote" frame="void" id="id6" rules="none"> <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> @@ -394,12 +400,12 @@ Here's a reference to the next footnote: <a class="footnote-reference" href="#id <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> <tr><td class="label"><a name="id13">[4]</a></td><td>Here's an unreferenced footnote, with a reference to a -nonexistent footnote: <a href="#id65" name="id66"><span class="problematic" id="id66">[5]_</span></a>.</td></tr> +nonexistent footnote: <a href="#id66" name="id67"><span class="problematic" id="id67">[5]_</span></a>.</td></tr> </tbody> </table> </div> <div class="section" id="citations"> -<h2><a class="toc-backref" href="#id40" name="citations">2.11   Citations</a></h2> +<h2><a class="toc-backref" href="#id42" name="citations">2.12   Citations</a></h2> <table class="citation" frame="void" id="cit2002" rules="none"> <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> @@ -407,59 +413,58 @@ nonexistent footnote: <a href="#id65" name="id66"><span class="problematic" id=" rendered separately and differently from footnotes.</td></tr> </tbody> </table> -<p>Here's a reference to the above, <a class="citation-reference" href="#cit2002" id="id15" name="id15">[CIT2002]</a>, and a <a href="#id67" name="id68"><span class="problematic" id="id68">[nonexistent]_</span></a> +<p>Here's a reference to the above, <a class="citation-reference" href="#cit2002" id="id15" name="id15">[CIT2002]</a>, and a <a href="#id68" name="id69"><span class="problematic" id="id69">[nonexistent]_</span></a> citation.</p> </div> <div class="section" id="targets"> -<h2><a class="toc-backref" href="#id41" name="targets">2.12   Targets</a></h2> +<h2><a class="toc-backref" href="#id43" name="targets">2.13   Targets</a></h2> <a class="target" id="example" name="example"></a><p>This paragraph is pointed to by the explicit "example" target. A reference can be found under <a class="reference" href="#inline-markup">Inline Markup</a>, above. <a class="reference" href="#inline-hyperlink-targets">Inline hyperlink targets</a> are also possible.</p> <p>Section headers are implicit targets, referred to by name. See <a class="reference" href="#targets">Targets</a>, which is a subsection of <a class="reference" href="#body-elements">Body Elements</a>.</p> <p>Explicit external targets are interpolated into references such as -"<a class="reference" href="http://www.python.org/">Python</a> <a class="footnote-reference" href="#id21" id="id23" name="id23">[5]</a>".</p> +"<a class="reference" href="http://www.python.org/">Python</a> <a class="footnote-reference" href="#id22" id="id24" name="id24">[5]</a>".</p> <p>Targets may be indirect and anonymous. Thus <a class="reference" href="#targets">this phrase</a> may also refer to the <a class="reference" href="#targets">Targets</a> section.</p> -<p>Here's a <a href="#id69" name="id70"><span class="problematic" id="id70">`hyperlink reference without a target`_</span></a>, which generates an +<p>Here's a <a href="#id70" name="id71"><span class="problematic" id="id71">`hyperlink reference without a target`_</span></a>, which generates an error.</p> <div class="section" id="duplicate-target-names"> -<h3><a class="toc-backref" href="#id42" name="duplicate-target-names">2.12.1   Duplicate Target Names</a></h3> +<h3><a class="toc-backref" href="#id44" name="duplicate-target-names">2.13.1   Duplicate Target Names</a></h3> <p>Duplicate names in section headers or other implicit targets will generate "info" (level-1) system messages. Duplicate names in explicit targets will generate "warning" (level-2) system messages.</p> </div> <div class="section" id="id18"> -<h3><a class="toc-backref" href="#id43" name="id18">2.12.2   Duplicate Target Names</a></h3> +<h3><a class="toc-backref" href="#id45" name="id18">2.13.2   Duplicate Target Names</a></h3> <p>Since there are two "Duplicate Target Names" section headers, we cannot uniquely refer to either of them by name. If we try to (like -this: <a href="#id71" name="id72"><span class="problematic" id="id72">`Duplicate Target Names`_</span></a>), an error is generated.</p> +this: <a href="#id72" name="id73"><span class="problematic" id="id73">`Duplicate Target Names`_</span></a>), an error is generated.</p> </div> </div> <div class="section" id="directives"> -<h2><a class="toc-backref" href="#id44" name="directives">2.13   Directives</a></h2> +<h2><a class="toc-backref" href="#id46" name="directives">2.14   Directives</a></h2> <div class="contents topic" id="contents"> <ul class="auto-toc simple"> -<li><a class="reference" href="#document-parts" id="id58" name="id58">2.13.1   Document Parts</a></li> -<li><a class="reference" href="#images" id="id59" name="id59">2.13.2   Images</a></li> -<li><a class="reference" href="#admonitions" id="id60" name="id60">2.13.3   Admonitions</a></li> -<li><a class="reference" href="#topics-sidebars-and-rubrics" id="id61" name="id61">2.13.4   Topics, Sidebars, and Rubrics</a></li> -<li><a class="reference" href="#target-footnotes" id="id62" name="id62">2.13.5   Target Footnotes</a></li> -<li><a class="reference" href="#line-blocks" id="id63" name="id63">2.13.6   Line Blocks</a></li> -<li><a class="reference" href="#replacement-text" id="id64" name="id64">2.13.7   Replacement Text</a></li> +<li><a class="reference" href="#document-parts" id="id60" name="id60">2.14.1   Document Parts</a></li> +<li><a class="reference" href="#images" id="id61" name="id61">2.14.2   Images</a></li> +<li><a class="reference" href="#admonitions" id="id62" name="id62">2.14.3   Admonitions</a></li> +<li><a class="reference" href="#topics-sidebars-and-rubrics" id="id63" name="id63">2.14.4   Topics, Sidebars, and Rubrics</a></li> +<li><a class="reference" href="#target-footnotes" id="id64" name="id64">2.14.5   Target Footnotes</a></li> +<li><a class="reference" href="#replacement-text" id="id65" name="id65">2.14.6   Replacement Text</a></li> </ul> </div> <p>These are just a sample of the many reStructuredText Directives. For others, please see <a class="reference" href="http://docutils.sourceforge.net/docs/ref/rst/directives.html">http://docutils.sourceforge.net/docs/ref/rst/directives.html</a>.</p> <div class="section" id="document-parts"> -<h3><a class="toc-backref" href="#id58" name="document-parts">2.13.1   Document Parts</a></h3> +<h3><a class="toc-backref" href="#id60" name="document-parts">2.14.1   Document Parts</a></h3> <p>An example of the "contents" directive can be seen above this section (a local, untitled table of <a class="reference" href="#contents">contents</a>) and at the beginning of the document (a document-wide <a class="reference" href="#table-of-contents">table of contents</a>).</p> </div> <div class="section" id="images"> -<h3><a class="toc-backref" href="#id59" name="images">2.13.2   Images</a></h3> +<h3><a class="toc-backref" href="#id61" name="images">2.14.2   Images</a></h3> <p>An image directive (also clickable -- a hyperlink reference):</p> <p><a class="reference" href="#directives"><img alt="../../../docs/user/rst/images/title.png" src="../../../docs/user/rst/images/title.png" /></a></p> <p>A figure directive:</p> @@ -489,7 +494,7 @@ document (a document-wide <a class="reference" href="#table-of-contents">table o </div> </div> <div class="section" id="admonitions"> -<h3><a class="toc-backref" href="#id60" name="admonitions">2.13.3   Admonitions</a></h3> +<h3><a class="toc-backref" href="#id62" name="admonitions">2.14.3   Admonitions</a></h3> <div class="attention"> <p class="admonition-title first">Attention!</p> Directives at large.</div> @@ -530,7 +535,7 @@ Reader discretion is strongly advised.</div> </div> </div> <div class="section" id="topics-sidebars-and-rubrics"> -<h3><a class="toc-backref" href="#id61" name="topics-sidebars-and-rubrics">2.13.4   Topics, Sidebars, and Rubrics</a></h3> +<h3><a class="toc-backref" href="#id63" name="topics-sidebars-and-rubrics">2.14.4   Topics, Sidebars, and Rubrics</a></h3> <div class="sidebar"> <p class="sidebar-title first">Sidebar Title</p> <p class="sidebar-subtitle">Optional Subtitle</p> @@ -547,45 +552,26 @@ background color.</p> <p class="rubric">This is a rubric</p> </div> <div class="section" id="target-footnotes"> -<h3><a class="toc-backref" href="#id62" name="target-footnotes">2.13.5   Target Footnotes</a></h3> -<table class="footnote" frame="void" id="id21" rules="none"> +<h3><a class="toc-backref" href="#id64" name="target-footnotes">2.14.5   Target Footnotes</a></h3> +<table class="footnote" frame="void" id="id22" rules="none"> <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> -<tr><td class="label"><a name="id21">[5]</a></td><td><em>(<a class="fn-backref" href="#id22">1</a>, <a class="fn-backref" href="#id23">2</a>, <a class="fn-backref" href="#id24">3</a>)</em> <a class="reference" href="http://www.python.org/">http://www.python.org/</a></td></tr> +<tr><td class="label"><a name="id22">[5]</a></td><td><em>(<a class="fn-backref" href="#id23">1</a>, <a class="fn-backref" href="#id24">2</a>, <a class="fn-backref" href="#id25">3</a>)</em> <a class="reference" href="http://www.python.org/">http://www.python.org/</a></td></tr> </tbody> </table> </div> -<div class="section" id="line-blocks"> -<h3><a class="toc-backref" href="#id63" name="line-blocks">2.13.6   Line Blocks</a></h3> -<p>Take it away, Eric the Orchestra Leader!</p> -<pre class="line-block"> -A one, two, a one two three four - -Half a bee, philosophically, - must, <em>ipso facto</em>, half not be. -But half the bee has got to be, - <em>vis a vis</em> its entity. D'you see? - -But can a bee be said to be - or not to be an entire bee, - when half the bee is not a bee, - due to some ancient injury? - -Singing... -</pre> -</div> <div class="section" id="replacement-text"> -<h3><a class="toc-backref" href="#id64" name="replacement-text">2.13.7   Replacement Text</a></h3> -<p>I recommend you try <a class="reference" href="http://www.python.org/">Python, <em>the</em> best language around</a> <a class="footnote-reference" href="#id21" id="id24" name="id24">[5]</a>.</p> +<h3><a class="toc-backref" href="#id65" name="replacement-text">2.14.6   Replacement Text</a></h3> +<p>I recommend you try <a class="reference" href="http://www.python.org/">Python, <em>the</em> best language around</a> <a class="footnote-reference" href="#id22" id="id25" name="id25">[5]</a>.</p> </div> </div> <div class="section" id="substitution-definitions"> -<h2><a class="toc-backref" href="#id52" name="substitution-definitions">2.14   Substitution Definitions</a></h2> +<h2><a class="toc-backref" href="#id53" name="substitution-definitions">2.15   Substitution Definitions</a></h2> <p>An inline image (<img alt="EXAMPLE" src="../../../docs/user/rst/images/biohazard.png" />) example:</p> <p>(Substitution definitions are not visible in the HTML source.)</p> </div> <div class="section" id="comments"> -<h2><a class="toc-backref" href="#id53" name="comments">2.15   Comments</a></h2> +<h2><a class="toc-backref" href="#id54" name="comments">2.16   Comments</a></h2> <p>Here's one:</p> <!-- Comments begin with two dots and a space. Anything may follow, except for the syntax of footnotes, hyperlink @@ -594,8 +580,57 @@ targets, directives, or substitution definitions. Double-dashes - - "- -" - - must be escaped somehow in HTML output. --> <p>(View the HTML source to see the comment.)</p> </div> +<div class="section" id="id19"> +<h2><a class="toc-backref" href="#id55" name="id19">2.17   Line Blocks</a></h2> +<div class="line-block"> +<div class="line">This is a line block. It ends with a blank line.</div> +<div class="line-block"> +<div class="line">New lines begin with a vertical bar ("|").</div> +<div class="line">Line breaks and initial indent are significant, and preserved.</div> +</div> +<div class="line">Continuation lines are also possible. A long line that is intended +to wrap should begin with a space in place of the vertical bar.</div> +<div class="line-block"> +<div class="line">The left edge of a continuation line need not be aligned with +the left edge of the text above it.</div> +</div> +</div> +<div class="line-block"> +<div class="line">This is a second line block.</div> +<div class="line"><br /></div> +<div class="line">Blank lines are permitted internally, but they must begin with a "|".</div> +</div> +<p>Take it away, Eric the Orchestra Leader!</p> +<blockquote> +<div class="line-block"> +<div class="line">A one, two, a one two three four</div> +<div class="line"><br /></div> +<div class="line">Half a bee, philosophically,</div> +<div class="line-block"> +<div class="line">must, <em>ipso facto</em>, half not be.</div> +</div> +<div class="line">But half the bee has got to be,</div> +<div class="line-block"> +<div class="line"><em>vis a vis</em> its entity. D'you see?</div> +<div class="line"><br /></div> +</div> +<div class="line">But can a bee be said to be</div> +<div class="line-block"> +<div class="line">or not to be an entire bee,</div> +<div class="line-block"> +<div class="line">when half the bee is not a bee,</div> +<div class="line-block"> +<div class="line">due to some ancient injury?</div> +<div class="line"><br /></div> +</div> +</div> +</div> +<div class="line">Singing...</div> +</div> +</blockquote> +</div> <div class="section" id="colspanning-tables"> -<h2><a class="toc-backref" href="#id54" name="colspanning-tables">2.16   Colspanning tables</a></h2> +<h2><a class="toc-backref" href="#id56" name="colspanning-tables">2.18   Colspanning tables</a></h2> <p>This table has a cell spanning two columns:</p> <table border="1" class="table"> <colgroup> @@ -633,7 +668,7 @@ Double-dashes - - "- -" - - must be escaped somehow in HTML output. --> </table> </div> <div class="section" id="rowspanning-tables"> -<h2><a class="toc-backref" href="#id55" name="rowspanning-tables">2.17   Rowspanning tables</a></h2> +<h2><a class="toc-backref" href="#id57" name="rowspanning-tables">2.19   Rowspanning tables</a></h2> <p>Here's a table with cells spanning several rows:</p> <table border="1" class="table"> <colgroup> @@ -669,7 +704,7 @@ span rows.</td> </table> </div> <div class="section" id="complex-tables"> -<h2><a class="toc-backref" href="#id56" name="complex-tables">2.18   Complex tables</a></h2> +<h2><a class="toc-backref" href="#id58" name="complex-tables">2.20   Complex tables</a></h2> <p>Here's a complex table, which should test all features.</p> <table border="1" class="table"> <colgroup> @@ -719,7 +754,7 @@ empty: <tt class="literal"><span class="pre">--></span></tt></td> </div> </div> <div class="section" id="error-handling"> -<h1><a class="toc-backref" href="#id57" name="error-handling">3   Error Handling</a></h1> +<h1><a class="toc-backref" href="#id59" name="error-handling">3   Error Handling</a></h1> <p>Any errors caught during processing will generate system messages.</p> <p>There should be five messages in the following, auto-generated section, "Docutils System Messages":</p> @@ -727,20 +762,20 @@ section, "Docutils System Messages":</p> </div> <div class="system-messages section"> <h1><a>Docutils System Messages</a></h1> -<div class="system-message" id="id19"> -<p class="system-message-title">System Message: <a name="id19">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 89); <em><a href="#id20">backlink</a></em></p> +<div class="system-message" id="id20"> +<p class="system-message-title">System Message: <a name="id20">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 89); <em><a href="#id21">backlink</a></em></p> Undefined substitution referenced: "problematic".</div> -<div class="system-message" id="id65"> -<p class="system-message-title">System Message: <a name="id65">ERROR/3</a> (<tt>functional/input/standalone_rst_html4css1.txt</tt>, line 281); <em><a href="#id66">backlink</a></em></p> +<div class="system-message" id="id66"> +<p class="system-message-title">System Message: <a name="id66">ERROR/3</a> (<tt>functional/input/standalone_rst_html4css1.txt</tt>, line 287); <em><a href="#id67">backlink</a></em></p> Unknown target name: "5".</div> -<div class="system-message" id="id67"> -<p class="system-message-title">System Message: <a name="id67">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 290); <em><a href="#id68">backlink</a></em></p> +<div class="system-message" id="id68"> +<p class="system-message-title">System Message: <a name="id68">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 296); <em><a href="#id69">backlink</a></em></p> Unknown target name: "nonexistent".</div> -<div class="system-message" id="id69"> -<p class="system-message-title">System Message: <a name="id69">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 315); <em><a href="#id70">backlink</a></em></p> +<div class="system-message" id="id70"> +<p class="system-message-title">System Message: <a name="id70">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 321); <em><a href="#id71">backlink</a></em></p> Unknown target name: "hyperlink reference without a target".</div> -<div class="system-message" id="id71"> -<p class="system-message-title">System Message: <a name="id71">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 328); <em><a href="#id72">backlink</a></em></p> +<div class="system-message" id="id72"> +<p class="system-message-title">System Message: <a name="id72">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 334); <em><a href="#id73">backlink</a></em></p> Duplicate target name, cannot be used as a unique reference: "duplicate target names".</div> </div> </div> diff --git a/test/functional/expected/standalone_rst_latex.tex b/test/functional/expected/standalone_rst_latex.tex index e8b7a8bc9..6defb4518 100644 --- a/test/functional/expected/standalone_rst_latex.tex +++ b/test/functional/expected/standalone_rst_latex.tex @@ -152,45 +152,45 @@ reStructuredText construct. \item {} \href{\#literal-blocks}{2.7~~~Literal Blocks} -\item {} \href{\#block-quotes}{2.8~~~Block Quotes} +\item {} \href{\#line-blocks}{2.8~~~Line Blocks} -\item {} \href{\#doctest-blocks}{2.9~~~Doctest Blocks} +\item {} \href{\#block-quotes}{2.9~~~Block Quotes} -\item {} \href{\#footnotes}{2.10~~~Footnotes} +\item {} \href{\#doctest-blocks}{2.10~~~Doctest Blocks} -\item {} \href{\#citations}{2.11~~~Citations} +\item {} \href{\#footnotes}{2.11~~~Footnotes} -\item {} \href{\#targets}{2.12~~~Targets} +\item {} \href{\#citations}{2.12~~~Citations} + +\item {} \href{\#targets}{2.13~~~Targets} \begin{list}{}{} -\item {} \href{\#duplicate-target-names}{2.12.1~~~Duplicate Target Names} +\item {} \href{\#duplicate-target-names}{2.13.1~~~Duplicate Target Names} -\item {} \href{\#id18}{2.12.2~~~Duplicate Target Names} +\item {} \href{\#id18}{2.13.2~~~Duplicate Target Names} \end{list} -\item {} \href{\#directives}{2.13~~~Directives} +\item {} \href{\#directives}{2.14~~~Directives} \begin{list}{}{} -\item {} \href{\#document-parts}{2.13.1~~~Document Parts} - -\item {} \href{\#images}{2.13.2~~~Images} +\item {} \href{\#document-parts}{2.14.1~~~Document Parts} -\item {} \href{\#admonitions}{2.13.3~~~Admonitions} +\item {} \href{\#images}{2.14.2~~~Images} -\item {} \href{\#topics-sidebars-and-rubrics}{2.13.4~~~Topics, Sidebars, and Rubrics} +\item {} \href{\#admonitions}{2.14.3~~~Admonitions} -\item {} \href{\#target-footnotes}{2.13.5~~~Target Footnotes} +\item {} \href{\#topics-sidebars-and-rubrics}{2.14.4~~~Topics, Sidebars, and Rubrics} -\item {} \href{\#line-blocks}{2.13.6~~~Line Blocks} +\item {} \href{\#target-footnotes}{2.14.5~~~Target Footnotes} -\item {} \href{\#replacement-text}{2.13.7~~~Replacement Text} +\item {} \href{\#replacement-text}{2.14.6~~~Replacement Text} \end{list} -\item {} \href{\#substitution-definitions}{2.14~~~Substitution Definitions} +\item {} \href{\#substitution-definitions}{2.15~~~Substitution Definitions} -\item {} \href{\#comments}{2.15~~~Comments} +\item {} \href{\#comments}{2.16~~~Comments} -\item {} \href{\#colspanning-tables}{2.16~~~Colspanning tables} +\item {} \href{\#colspanning-tables}{2.17~~~Colspanning tables} \end{list} @@ -558,11 +558,21 @@ Or they can be quoted without indentation: }\end{quote} +%___________________________________________________________________________ + +\hypertarget{line-blocks}{} +\pdfbookmark[1]{2.8~~~Line Blocks}{line-blocks} +\subsection*{2.8~~~Line Blocks} + +(To be inserted from line{\_}blocks.txt once the LaTeX writer has +implemented it.) + + %___________________________________________________________________________ \hypertarget{block-quotes}{} -\pdfbookmark[1]{2.8~~~Block Quotes}{block-quotes} -\subsection*{2.8~~~Block Quotes} +\pdfbookmark[1]{2.9~~~Block Quotes}{block-quotes} +\subsection*{2.9~~~Block Quotes} Block quotes consist of indented body elements: \begin{quote} @@ -582,8 +592,8 @@ own it, and what it is too. %___________________________________________________________________________ \hypertarget{doctest-blocks}{} -\pdfbookmark[1]{2.9~~~Doctest Blocks}{doctest-blocks} -\subsection*{2.9~~~Doctest Blocks} +\pdfbookmark[1]{2.10~~~Doctest Blocks}{doctest-blocks} +\subsection*{2.10~~~Doctest Blocks} \begin{verbatim}>>> print 'Python-specific usage examples; begun with ">>>"' Python-specific usage examples; begun with ">>>" >>> print '(cut and pasted from interactive Python sessions)' @@ -593,8 +603,8 @@ Python-specific usage examples; begun with ">>>" %___________________________________________________________________________ \hypertarget{footnotes}{} -\pdfbookmark[1]{2.10~~~Footnotes}{footnotes} -\subsection*{2.10~~~Footnotes} +\pdfbookmark[1]{2.11~~~Footnotes}{footnotes} +\subsection*{2.11~~~Footnotes} \begin{figure}[b]\hypertarget{id6}[1] A footnote contains body elements, consistently indented by at least 3 spaces. @@ -628,8 +638,8 @@ nonexistent footnote:{\color{red}\bfseries{}{[}5]{\_}}. %___________________________________________________________________________ \hypertarget{citations}{} -\pdfbookmark[1]{2.11~~~Citations}{citations} -\subsection*{2.11~~~Citations} +\pdfbookmark[1]{2.12~~~Citations}{citations} +\subsection*{2.12~~~Citations} \begin{figure}[b]\hypertarget{cit2002}[CIT2002] Citations are text-labeled footnotes. They may be rendered separately and differently from footnotes. @@ -642,8 +652,8 @@ citation. %___________________________________________________________________________ \hypertarget{targets}{} -\pdfbookmark[1]{2.12~~~Targets}{targets} -\subsection*{2.12~~~Targets} +\pdfbookmark[1]{2.13~~~Targets}{targets} +\subsection*{2.13~~~Targets} \hypertarget{example}{} This paragraph is pointed to by the explicit ``example'' target. A reference can be found under \href{\#inline-markup}{Inline Markup}, above. \href{\#inline-hyperlink-targets}{Inline @@ -665,8 +675,8 @@ error. %___________________________________________________________________________ \hypertarget{duplicate-target-names}{} -\pdfbookmark[2]{2.12.1~~~Duplicate Target Names}{duplicate-target-names} -\subsubsection*{2.12.1~~~Duplicate Target Names} +\pdfbookmark[2]{2.13.1~~~Duplicate Target Names}{duplicate-target-names} +\subsubsection*{2.13.1~~~Duplicate Target Names} Duplicate names in section headers or other implicit targets will generate ``info'' (level-1) system messages. Duplicate names in @@ -676,8 +686,8 @@ explicit targets will generate ``warning'' (level-2) system messages. %___________________________________________________________________________ \hypertarget{id18}{} -\pdfbookmark[2]{2.12.2~~~Duplicate Target Names}{id18} -\subsubsection*{2.12.2~~~Duplicate Target Names} +\pdfbookmark[2]{2.13.2~~~Duplicate Target Names}{id18} +\subsubsection*{2.13.2~~~Duplicate Target Names} Since there are two ``Duplicate Target Names'' section headers, we cannot uniquely refer to either of them by name. If we try to (like @@ -687,22 +697,20 @@ this: {\color{red}\bfseries{}`Duplicate Target Names`{\_}}), an error is generat %___________________________________________________________________________ \hypertarget{directives}{} -\pdfbookmark[1]{2.13~~~Directives}{directives} -\subsection*{2.13~~~Directives} +\pdfbookmark[1]{2.14~~~Directives}{directives} +\subsection*{2.14~~~Directives} \begin{list}{}{} -\item {} \href{\#document-parts}{2.13.1~~~Document Parts} - -\item {} \href{\#images}{2.13.2~~~Images} +\item {} \href{\#document-parts}{2.14.1~~~Document Parts} -\item {} \href{\#admonitions}{2.13.3~~~Admonitions} +\item {} \href{\#images}{2.14.2~~~Images} -\item {} \href{\#topics-sidebars-and-rubrics}{2.13.4~~~Topics, Sidebars, and Rubrics} +\item {} \href{\#admonitions}{2.14.3~~~Admonitions} -\item {} \href{\#target-footnotes}{2.13.5~~~Target Footnotes} +\item {} \href{\#topics-sidebars-and-rubrics}{2.14.4~~~Topics, Sidebars, and Rubrics} -\item {} \href{\#line-blocks}{2.13.6~~~Line Blocks} +\item {} \href{\#target-footnotes}{2.14.5~~~Target Footnotes} -\item {} \href{\#replacement-text}{2.13.7~~~Replacement Text} +\item {} \href{\#replacement-text}{2.14.6~~~Replacement Text} \end{list} @@ -715,8 +723,8 @@ others, please see %___________________________________________________________________________ \hypertarget{document-parts}{} -\pdfbookmark[2]{2.13.1~~~Document Parts}{document-parts} -\subsubsection*{2.13.1~~~Document Parts} +\pdfbookmark[2]{2.14.1~~~Document Parts}{document-parts} +\subsubsection*{2.14.1~~~Document Parts} An example of the ``contents'' directive can be seen above this section (a local, untitled table of \href{\#contents}{contents}) and at the beginning of the @@ -726,8 +734,8 @@ document (a document-wide \href{\#table-of-contents}{table of contents}). %___________________________________________________________________________ \hypertarget{images}{} -\pdfbookmark[2]{2.13.2~~~Images}{images} -\subsubsection*{2.13.2~~~Images} +\pdfbookmark[2]{2.14.2~~~Images}{images} +\subsubsection*{2.14.2~~~Images} An image directive (also clickable -- a hyperlink reference): \href{\#directives}{\includegraphics{../../../docs/user/rst/images/title.png}} @@ -765,8 +773,8 @@ This paragraph is also part of the legend. %___________________________________________________________________________ \hypertarget{admonitions}{} -\pdfbookmark[2]{2.13.3~~~Admonitions}{admonitions} -\subsubsection*{2.13.3~~~Admonitions} +\pdfbookmark[2]{2.14.3~~~Admonitions}{admonitions} +\subsubsection*{2.14.3~~~Admonitions} \begin{center}\begin{sffamily} \fbox{\parbox{\admonitionwidth}{ \textbf{\large Attention!} @@ -876,8 +884,8 @@ You can make up your own admonition too. %___________________________________________________________________________ \hypertarget{topics-sidebars-and-rubrics}{} -\pdfbookmark[2]{2.13.4~~~Topics, Sidebars, and Rubrics}{topics-sidebars-and-rubrics} -\subsubsection*{2.13.4~~~Topics, Sidebars, and Rubrics} +\pdfbookmark[2]{2.14.4~~~Topics, Sidebars, and Rubrics}{topics-sidebars-and-rubrics} +\subsubsection*{2.14.4~~~Topics, Sidebars, and Rubrics} \setlength{\locallinewidth}{0.9\admonitionwidth} \begin{center}\begin{sffamily} @@ -909,42 +917,18 @@ This is a topic. %___________________________________________________________________________ \hypertarget{target-footnotes}{} -\pdfbookmark[2]{2.13.5~~~Target Footnotes}{target-footnotes} -\subsubsection*{2.13.5~~~Target Footnotes} +\pdfbookmark[2]{2.14.5~~~Target Footnotes}{target-footnotes} +\subsubsection*{2.14.5~~~Target Footnotes} \begin{figure}[b]\hypertarget{id21}[5] \href{http://www.python.org/}{http://www.python.org/} \end{figure} -%___________________________________________________________________________ - -\hypertarget{line-blocks}{} -\pdfbookmark[2]{2.13.6~~~Line Blocks}{line-blocks} -\subsubsection*{2.13.6~~~Line Blocks} - -Take it away, Eric the Orchestra Leader! -\begin{flushleft} -A~one,~two,~a~one~two~three~four~\\ -~\\ -Half~a~bee,~philosophically,~\\ -~~~~must,~\emph{ipso~facto},~half~not~be.~\\ -But~half~the~bee~has~got~to~be,~\\ -~~~~\emph{vis~a~vis}~its~entity.~~D'you~see?~\\ -~\\ -But~can~a~bee~be~said~to~be~\\ -~~~~or~not~to~be~an~entire~bee,~\\ -~~~~~~~~when~half~the~bee~is~not~a~bee,~\\ -~~~~~~~~~~~~due~to~some~ancient~injury?~\\ -~\\ -Singing... -\end{flushleft} - - %___________________________________________________________________________ \hypertarget{replacement-text}{} -\pdfbookmark[2]{2.13.7~~~Replacement Text}{replacement-text} -\subsubsection*{2.13.7~~~Replacement Text} +\pdfbookmark[2]{2.14.6~~~Replacement Text}{replacement-text} +\subsubsection*{2.14.6~~~Replacement Text} I recommend you try \href{http://www.python.org/}{Python, \emph{the} best language around}\raisebox{.5em}[0em]{\scriptsize\hyperlink{id21}{5}}. @@ -952,8 +936,8 @@ I recommend you try \href{http://www.python.org/}{Python, \emph{the} best langua %___________________________________________________________________________ \hypertarget{substitution-definitions}{} -\pdfbookmark[1]{2.14~~~Substitution Definitions}{substitution-definitions} -\subsection*{2.14~~~Substitution Definitions} +\pdfbookmark[1]{2.15~~~Substitution Definitions}{substitution-definitions} +\subsection*{2.15~~~Substitution Definitions} An inline image (\includegraphics{../../../docs/user/rst/images/biohazard.png}) example: @@ -963,8 +947,8 @@ An inline image (\includegraphics{../../../docs/user/rst/images/biohazard.png}) %___________________________________________________________________________ \hypertarget{comments}{} -\pdfbookmark[1]{2.15~~~Comments}{comments} -\subsection*{2.15~~~Comments} +\pdfbookmark[1]{2.16~~~Comments}{comments} +\subsection*{2.16~~~Comments} Here's one: % Comments begin with two dots and a space. Anything may @@ -979,8 +963,8 @@ Here's one: %___________________________________________________________________________ \hypertarget{colspanning-tables}{} -\pdfbookmark[1]{2.16~~~Colspanning tables}{colspanning-tables} -\subsection*{2.16~~~Colspanning tables} +\pdfbookmark[1]{2.17~~~Colspanning tables}{colspanning-tables} +\subsection*{2.17~~~Colspanning tables} This table has a cell spanning two columns: diff --git a/test/functional/input/data/standard.txt b/test/functional/input/data/standard.txt index 770efe072..730c68cfb 100644 --- a/test/functional/input/data/standard.txt +++ b/test/functional/input/data/standard.txt @@ -233,6 +233,12 @@ Or they can be quoted without indentation:: > > Why didn't I think of that? +Line Blocks +----------- + +(To be inserted from line_blocks.txt once the LaTeX writer has +implemented it.) + Block Quotes ------------ @@ -425,26 +431,6 @@ Target Footnotes .. target-notes:: -Line Blocks -``````````` - -Take it away, Eric the Orchestra Leader! - -.. line-block:: - - A one, two, a one two three four - - Half a bee, philosophically, - must, *ipso facto*, half not be. - But half the bee has got to be, - *vis a vis* its entity. D'you see? - - But can a bee be said to be - or not to be an entire bee, - when half the bee is not a bee, - due to some ancient injury? - - Singing... Replacement Text ```````````````` diff --git a/test/functional/input/standalone_rst_html4css1.txt b/test/functional/input/standalone_rst_html4css1.txt index 68f9de864..b0a5eec04 100644 --- a/test/functional/input/standalone_rst_html4css1.txt +++ b/test/functional/input/standalone_rst_html4css1.txt @@ -1,4 +1,5 @@ .. include:: data/standard.txt +.. include:: data/line_blocks.txt .. include:: data/table_colspan.txt .. include:: data/table_rowspan.txt .. include:: data/table_complex.txt diff --git a/test/test_parsers/test_rst/test_inline_markup.py b/test/test_parsers/test_rst/test_inline_markup.py index 8f3fe5628..127d4dab7 100755 --- a/test/test_parsers/test_rst/test_inline_markup.py +++ b/test/test_parsers/test_rst/test_inline_markup.py @@ -730,12 +730,12 @@ reference| Inline substitution_reference start-string without end-string. """], ["""\ -| and || and ||| +first | then || and finally ||| """, """\ <document source="test data"> <paragraph> - | and || and ||| + first | then || and finally ||| """], ] -- cgit v1.2.1 From 0bfcd094bb1caf0050981139617139cce2e7880c Mon Sep 17 00:00:00 2001 From: fdrake <fdrake@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Tue, 5 Oct 2004 14:00:10 +0000 Subject: backward compatibility fix git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2702 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/DocutilsTestSupport.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/DocutilsTestSupport.py b/test/DocutilsTestSupport.py index 2c30e2b6f..82a580df4 100644 --- a/test/DocutilsTestSupport.py +++ b/test/DocutilsTestSupport.py @@ -73,7 +73,7 @@ except: StringList.__repr__ = StringList.__str__ -testroot = os.path.abspath(os.path.dirname(__file__) or os.path.curdir) +testroot = os.path.abspath(os.path.dirname(__file__) or os.curdir) class DevNull: -- cgit v1.2.1 From ec1ff4de7d5175824a763277de41fa1d556b68d9 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sat, 16 Oct 2004 15:00:35 +0000 Subject: only strip <p>aragraphs in HTML if we don't lose relevant attributes git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2706 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_html4css1.html | 13 +++++++++---- test/functional/expected/standalone_rst_latex.tex | 6 ++++++ test/functional/input/data/standard.txt | 8 ++++++++ 3 files changed, 23 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index 2b94afa22..ba7c9acf7 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -263,6 +263,11 @@ an unambiguous variant of RFC 2822 fields.</td> relative to the field marker.</p> </td> </tr> +<tr class="field"><th class="field-name">credits:</th><td class="field-body"><p class="credits first last">This paragraph has the <cite>credits</cite> class set. (This is actually not +about credits but just for ensuring that the class attribute +doesn't get stripped away.)</p> +</td> +</tr> </tbody> </table> </div> @@ -766,16 +771,16 @@ section, "Docutils System Messages":</p> <p class="system-message-title">System Message: <a name="id20">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 89); <em><a href="#id21">backlink</a></em></p> Undefined substitution referenced: "problematic".</div> <div class="system-message" id="id66"> -<p class="system-message-title">System Message: <a name="id66">ERROR/3</a> (<tt>functional/input/standalone_rst_html4css1.txt</tt>, line 287); <em><a href="#id67">backlink</a></em></p> +<p class="system-message-title">System Message: <a name="id66">ERROR/3</a> (<tt>functional/input/standalone_rst_html4css1.txt</tt>, line 295); <em><a href="#id67">backlink</a></em></p> Unknown target name: "5".</div> <div class="system-message" id="id68"> -<p class="system-message-title">System Message: <a name="id68">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 296); <em><a href="#id69">backlink</a></em></p> +<p class="system-message-title">System Message: <a name="id68">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 304); <em><a href="#id69">backlink</a></em></p> Unknown target name: "nonexistent".</div> <div class="system-message" id="id70"> -<p class="system-message-title">System Message: <a name="id70">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 321); <em><a href="#id71">backlink</a></em></p> +<p class="system-message-title">System Message: <a name="id70">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 329); <em><a href="#id71">backlink</a></em></p> Unknown target name: "hyperlink reference without a target".</div> <div class="system-message" id="id72"> -<p class="system-message-title">System Message: <a name="id72">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 334); <em><a href="#id73">backlink</a></em></p> +<p class="system-message-title">System Message: <a name="id72">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 342); <em><a href="#id73">backlink</a></em></p> Duplicate target name, cannot be used as a unique reference: "duplicate target names".</div> </div> </div> diff --git a/test/functional/expected/standalone_rst_latex.tex b/test/functional/expected/standalone_rst_latex.tex index 6defb4518..d06cd97d7 100644 --- a/test/functional/expected/standalone_rst_latex.tex +++ b/test/functional/expected/standalone_rst_latex.tex @@ -493,6 +493,12 @@ The field body may contain one or more body elements, indented relative to the field marker. +\item [credits:] +This paragraph has the \titlereference{credits} class set. (This is actually not +about credits but just for ensuring that the class attribute +doesn't get stripped away.) + + \end{description} \end{quote} diff --git a/test/functional/input/data/standard.txt b/test/functional/input/data/standard.txt index 730c68cfb..bc2165f9c 100644 --- a/test/functional/input/data/standard.txt +++ b/test/functional/input/data/standard.txt @@ -189,6 +189,14 @@ Field Lists The field body may contain one or more body elements, indented relative to the field marker. +:credits: + + .. class:: credits + + This paragraph has the `credits` class set. (This is actually not + about credits but just for ensuring that the class attribute + doesn't get stripped away.) + Option Lists ------------ -- cgit v1.2.1 From ce54b93f0e8694150fabc72e275a87fbec1bd567 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sat, 16 Oct 2004 17:33:56 +0000 Subject: added some more line block tests git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2707 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_parsers/test_rst/test_line_blocks.py | 102 +++++++++++++++++++++++++ 1 file changed, 102 insertions(+) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_line_blocks.py b/test/test_parsers/test_rst/test_line_blocks.py index ff26ac639..b41a27167 100755 --- a/test/test_parsers/test_rst/test_line_blocks.py +++ b/test/test_parsers/test_rst/test_line_blocks.py @@ -200,6 +200,108 @@ There should be a blank line before this paragraph. This block begins and ends with blank lines. <line> """], +["""\ +This is not +| a line block. +""", +"""\ +<document source="test data"> + <paragraph> + This is not + | a line block. +"""], +["""\ +| The first line is indented. +| The second line is more indented. +""", +"""\ +<document source="test data"> + <line_block> + <line> + The first line is indented. + <line_block> + <line> + The second line is more indented. +"""], +["""\ +| The first line is indented. +| The second line is less indented. +""", +"""\ +<document source="test data"> + <line_block> + <line_block> + <line> + The first line is indented. + <line> + The second line is less indented. +"""], +["""\ +|This is not +|a line block + +| This is an +|incomplete line block. +""", +"""\ +<document source="test data"> + <paragraph> + <problematic id="id2" refid="id1"> + | + This is not + <problematic id="id4" refid="id3"> + | + a line block + <system_message backrefs="id2" id="id1" level="2" line="1" source="test data" type="WARNING"> + <paragraph> + Inline substitution_reference start-string without end-string. + <system_message backrefs="id4" id="id3" level="2" line="1" source="test data" type="WARNING"> + <paragraph> + Inline substitution_reference start-string without end-string. + <line_block> + <line> + This is an + <system_message level="2" line="5" source="test data" type="WARNING"> + <paragraph> + Line block ends without a blank line. + <paragraph> + <problematic id="id6" refid="id5"> + | + incomplete line block. + <system_message backrefs="id6" id="id5" level="2" line="5" source="test data" type="WARNING"> + <paragraph> + Inline substitution_reference start-string without end-string. +"""], +["""\ +| Inline markup *may not +| wrap* over several lines. +""", +"""\ +<document source="test data"> + <line_block> + <line> + Inline markup \n\ + <problematic id="id2" refid="id1"> + * + may not + <line> + wrap* over several lines. + <system_message backrefs="id2" id="id1" level="2" line="1" source="test data" type="WARNING"> + <paragraph> + Inline emphasis start-string without end-string. +"""], +["""\ +| * Block level markup +| * is not recognized. +""", +"""\ +<document source="test data"> + <line_block> + <line> + * Block level markup + <line> + * is not recognized. +"""], ] -- cgit v1.2.1 From c56e320218d66ae9cc4b72b0f24f51c11ca5211a Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sun, 17 Oct 2004 23:19:34 +0000 Subject: added test for overriding trim_footnote_reference_space git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2710 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/data/config_1.txt | 5 +++++ test/data/config_2.txt | 1 + test/test_settings.py | 15 +++++++++------ 3 files changed, 15 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/data/config_1.txt b/test/data/config_1.txt index 9524dfb8c..f94074a8a 100644 --- a/test/data/config_1.txt +++ b/test/data/config_1.txt @@ -7,6 +7,11 @@ datestamp: %Y-%m-%d %H:%M UTC generator: true +[restructuredtext parser] + +trim-footnote-reference-space: 1 + + [html4css1 writer] stylesheet-path: stylesheets/default.css diff --git a/test/data/config_2.txt b/test/data/config_2.txt index 6f1d17008..35c307c6c 100644 --- a/test/data/config_2.txt +++ b/test/data/config_2.txt @@ -7,4 +7,5 @@ generator: no [html4css1 writer] +footnote-references: superscript stylesheet-path: test.css diff --git a/test/test_settings.py b/test/test_settings.py index b90f00f46..2a17c6eef 100755 --- a/test/test_settings.py +++ b/test/test_settings.py @@ -18,8 +18,8 @@ import warnings import unittest from types import StringType from docutils import frontend, utils -from docutils.writers import html4css1 -from docutils.writers import pep_html +from docutils.writers import html4css1, pep_html +from docutils.parsers import rst warnings.filterwarnings(action='ignore', @@ -57,11 +57,14 @@ class ConfigFileTests(unittest.TestCase): 'source_link': 1, 'stylesheet': None, 'stylesheet_path': fixpath('data/stylesheets/pep.css'), - 'template': fixpath('data/pep-html-template')}, - 'two': {'generator': 0, + 'template': fixpath('data/pep-html-template'), + 'trim_footnote_reference_space': 1}, + 'two': {'footnote_references': 'superscript', + 'generator': 0, 'record_dependencies': utils.DependencyList(), 'stylesheet': None, - 'stylesheet_path': fixpath('data/test.css')}, + 'stylesheet_path': fixpath('data/test.css'), + 'trim_footnote_reference_space': None}, 'list': {'expose_internals': ['a', 'b', 'c', 'd', 'e']}, 'list2': {'expose_internals': ['a', 'b', 'c', 'd', 'e', 'f']}, 'error': {'error_encoding': 'ascii', @@ -73,7 +76,7 @@ class ConfigFileTests(unittest.TestCase): def setUp(self): self.option_parser = frontend.OptionParser( - components=(pep_html.Writer,), read_config_files=None) + components=(pep_html.Writer, rst.Parser), read_config_files=None) def files_settings(self, *names): settings = frontend.Values() -- cgit v1.2.1 From 1c46e36e735eaa4c44d7bd0c5f0b209be515ec21 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Mon, 18 Oct 2004 14:21:45 +0000 Subject: made footnote label style match footnote reference style (superscript/brackets) for LaTeX writer git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2713 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_latex.tex | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_latex.tex b/test/functional/expected/standalone_rst_latex.tex index d06cd97d7..083156ab0 100644 --- a/test/functional/expected/standalone_rst_latex.tex +++ b/test/functional/expected/standalone_rst_latex.tex @@ -611,31 +611,31 @@ Python-specific usage examples; begun with ">>>" \hypertarget{footnotes}{} \pdfbookmark[1]{2.11~~~Footnotes}{footnotes} \subsection*{2.11~~~Footnotes} -\begin{figure}[b]\hypertarget{id6}[1] +\begin{figure}[b]\hypertarget{id6}$^{1}$ A footnote contains body elements, consistently indented by at least 3 spaces. This is the footnote's second paragraph. \end{figure} -\begin{figure}[b]\hypertarget{label}[2] +\begin{figure}[b]\hypertarget{label}$^{2}$ Footnotes may be numbered, either manually (as in\raisebox{.5em}[0em]{\scriptsize\hyperlink{id6}{1}}) or automatically using a ``{\#}''-prefixed label. This footnote has a label so it can be referred to from multiple places, both as a footnote reference (\raisebox{.5em}[0em]{\scriptsize\hyperlink{label}{2}}) and as a hyperlink reference (\href{\#label}{label}). \end{figure} -\begin{figure}[b]\hypertarget{id9}[3] +\begin{figure}[b]\hypertarget{id9}$^{3}$ This footnote is numbered automatically and anonymously using a label of ``{\#}'' only. \end{figure} -\begin{figure}[b]\hypertarget{id10}[*] +\begin{figure}[b]\hypertarget{id10}$^{*}$ Footnotes may also use symbols, specified with a ``*'' label. Here's a reference to the next footnote:\raisebox{.5em}[0em]{\scriptsize\hyperlink{id12}{{\dag}}}. \end{figure} -\begin{figure}[b]\hypertarget{id12}[{\dag}] +\begin{figure}[b]\hypertarget{id12}$^{{\dag}}$ This footnote shows the next symbol in the sequence. \end{figure} -\begin{figure}[b]\hypertarget{id13}[4] +\begin{figure}[b]\hypertarget{id13}$^{4}$ Here's an unreferenced footnote, with a reference to a nonexistent footnote:{\color{red}\bfseries{}{[}5]{\_}}. \end{figure} @@ -925,7 +925,7 @@ This is a topic. \hypertarget{target-footnotes}{} \pdfbookmark[2]{2.14.5~~~Target Footnotes}{target-footnotes} \subsubsection*{2.14.5~~~Target Footnotes} -\begin{figure}[b]\hypertarget{id21}[5] +\begin{figure}[b]\hypertarget{id21}$^{5}$ \href{http://www.python.org/}{http://www.python.org/} \end{figure} -- cgit v1.2.1 From d44f41b5f415d2d51a68296ace70a87c927fcdfe Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Mon, 18 Oct 2004 14:45:41 +0000 Subject: added two footnote paragraphs git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2715 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_html4css1.html | 15 +++++++++------ test/functional/expected/standalone_rst_latex.tex | 4 ++++ test/functional/input/data/standard.txt | 4 ++++ 3 files changed, 17 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index ba7c9acf7..d423226db 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -384,8 +384,11 @@ footnote reference (<a class="footnote-reference" href="#label" id="id8" name="i <table class="footnote" frame="void" id="id9" rules="none"> <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> -<tr><td class="label"><a class="fn-backref" href="#id2" name="id9">[3]</a></td><td>This footnote is numbered automatically and anonymously using a -label of "#" only.</td></tr> +<tr><td class="label"><a class="fn-backref" href="#id2" name="id9">[3]</a></td><td><p>This footnote is numbered automatically and anonymously using a +label of "#" only.</p> +<p>This is the second paragraph.</p> +<p>And this is the third paragraph.</p> +</td></tr> </tbody> </table> <table class="footnote" frame="void" id="id10" rules="none"> @@ -771,16 +774,16 @@ section, "Docutils System Messages":</p> <p class="system-message-title">System Message: <a name="id20">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 89); <em><a href="#id21">backlink</a></em></p> Undefined substitution referenced: "problematic".</div> <div class="system-message" id="id66"> -<p class="system-message-title">System Message: <a name="id66">ERROR/3</a> (<tt>functional/input/standalone_rst_html4css1.txt</tt>, line 295); <em><a href="#id67">backlink</a></em></p> +<p class="system-message-title">System Message: <a name="id66">ERROR/3</a> (<tt>functional/input/standalone_rst_html4css1.txt</tt>, line 299); <em><a href="#id67">backlink</a></em></p> Unknown target name: "5".</div> <div class="system-message" id="id68"> -<p class="system-message-title">System Message: <a name="id68">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 304); <em><a href="#id69">backlink</a></em></p> +<p class="system-message-title">System Message: <a name="id68">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 308); <em><a href="#id69">backlink</a></em></p> Unknown target name: "nonexistent".</div> <div class="system-message" id="id70"> -<p class="system-message-title">System Message: <a name="id70">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 329); <em><a href="#id71">backlink</a></em></p> +<p class="system-message-title">System Message: <a name="id70">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 333); <em><a href="#id71">backlink</a></em></p> Unknown target name: "hyperlink reference without a target".</div> <div class="system-message" id="id72"> -<p class="system-message-title">System Message: <a name="id72">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 342); <em><a href="#id73">backlink</a></em></p> +<p class="system-message-title">System Message: <a name="id72">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 346); <em><a href="#id73">backlink</a></em></p> Duplicate target name, cannot be used as a unique reference: "duplicate target names".</div> </div> </div> diff --git a/test/functional/expected/standalone_rst_latex.tex b/test/functional/expected/standalone_rst_latex.tex index 083156ab0..26db14046 100644 --- a/test/functional/expected/standalone_rst_latex.tex +++ b/test/functional/expected/standalone_rst_latex.tex @@ -627,6 +627,10 @@ footnote reference (\raisebox{.5em}[0em]{\scriptsize\hyperlink{label}{2}}) and a \begin{figure}[b]\hypertarget{id9}$^{3}$ This footnote is numbered automatically and anonymously using a label of ``{\#}'' only. + +This is the second paragraph. + +And this is the third paragraph. \end{figure} \begin{figure}[b]\hypertarget{id10}$^{*}$ Footnotes may also use symbols, specified with a ``*'' label. diff --git a/test/functional/input/data/standard.txt b/test/functional/input/data/standard.txt index bc2165f9c..b4d4de4c9 100644 --- a/test/functional/input/data/standard.txt +++ b/test/functional/input/data/standard.txt @@ -285,6 +285,10 @@ Footnotes .. [#] This footnote is numbered automatically and anonymously using a label of "#" only. + This is the second paragraph. + + And this is the third paragraph. + .. [*] Footnotes may also use symbols, specified with a "*" label. Here's a reference to the next footnote: [*]_. -- cgit v1.2.1 From 9937d8a5651ad5d90babc22cf6bb0d516839ccc6 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Mon, 18 Oct 2004 14:56:38 +0000 Subject: added "first" and "last" class attributes for footnotes to fix margins (cvs-up to rev. 1.11 to see the broken margins) git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2716 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_html4css1.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index d423226db..41c84f94c 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -367,7 +367,7 @@ Python-specific usage examples; begun with ">>>" <tbody valign="top"> <tr><td class="label"><a name="id6">[1]</a></td><td><em>(<a class="fn-backref" href="#id1">1</a>, <a class="fn-backref" href="#id7">2</a>)</em> <p>A footnote contains body elements, consistently indented by at least 3 spaces.</p> -<p>This is the footnote's second paragraph.</p> +<p class="last">This is the footnote's second paragraph.</p> </td></tr> </tbody> </table> @@ -384,10 +384,10 @@ footnote reference (<a class="footnote-reference" href="#label" id="id8" name="i <table class="footnote" frame="void" id="id9" rules="none"> <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> -<tr><td class="label"><a class="fn-backref" href="#id2" name="id9">[3]</a></td><td><p>This footnote is numbered automatically and anonymously using a +<tr><td class="label"><a class="fn-backref" href="#id2" name="id9">[3]</a></td><td><p class="first">This footnote is numbered automatically and anonymously using a label of "#" only.</p> <p>This is the second paragraph.</p> -<p>And this is the third paragraph.</p> +<p class="last">And this is the third paragraph.</p> </td></tr> </tbody> </table> -- cgit v1.2.1 From b443ac5601b89208915cb3532f2a3919244f438e Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Tue, 19 Oct 2004 23:42:18 +0000 Subject: tests for "compound" directive git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2728 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../test_rst/test_directives/test_compound.py | 106 +++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100755 test/test_parsers/test_rst/test_directives/test_compound.py (limited to 'test') diff --git a/test/test_parsers/test_rst/test_directives/test_compound.py b/test/test_parsers/test_rst/test_directives/test_compound.py new file mode 100755 index 000000000..eea4dd53b --- /dev/null +++ b/test/test_parsers/test_rst/test_directives/test_compound.py @@ -0,0 +1,106 @@ +#! /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 'compound' directive from body.py. +""" + +from __init__ import DocutilsTestSupport + +def suite(): + s = DocutilsTestSupport.ParserTestSuite() + s.generateTests(totest) + return s + +totest = {} + +totest['compound'] = [ +["""\ +.. compound:: + + Compound paragraphs are single logical paragraphs + which contain embedded + + * lists + * tables + * literal blocks + * and other body elements + + and are split into multiple physical paragraphs. +""", +"""\ +<document source="test data"> + <compound> + <paragraph> + Compound paragraphs are single logical paragraphs + which contain embedded + <bullet_list bullet="*"> + <list_item> + <paragraph> + lists + <list_item> + <paragraph> + tables + <list_item> + <paragraph> + literal blocks + <list_item> + <paragraph> + and other body elements + <paragraph> + and are split into multiple physical paragraphs. +"""], +["""\ +.. compound:: + + This is an extremely interesting compound paragraph containing a + simple paragraph, a literal block with some useless log messages:: + + Connecting... OK + Transmitting data... OK + Disconnecting... OK + + and another simple paragraph which is actually just a continuation + of the first simple paragraph, with the literal block in between. +""", +"""\ +<document source="test data"> + <compound> + <paragraph> + This is an extremely interesting compound paragraph containing a + simple paragraph, a literal block with some useless log messages: + <literal_block xml:space="preserve"> + Connecting... OK + Transmitting data... OK + Disconnecting... OK + <paragraph> + and another simple paragraph which is actually just a continuation + of the first simple paragraph, with the literal block in between. +"""], +["""\ +.. compound:: arg1 arg2 + + text +""", +"""\ +<document source="test data"> + <system_message level="3" line="1" source="test data" type="ERROR"> + <paragraph> + Error in "compound" directive: + no arguments permitted; blank line required before content block. + <literal_block xml:space="preserve"> + .. compound:: arg1 arg2 + \n\ + text +"""], +] + + +if __name__ == '__main__': + import unittest + unittest.main(defaultTest='suite') -- cgit v1.2.1 From 6fa2e20d77db8d257d35ca5c6bead6125a1977c6 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Wed, 20 Oct 2004 00:02:37 +0000 Subject: set --strict-visitor for writer tests git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2729 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/DocutilsTestSupport.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/DocutilsTestSupport.py b/test/DocutilsTestSupport.py index 82a580df4..6bed804e2 100644 --- a/test/DocutilsTestSupport.py +++ b/test/DocutilsTestSupport.py @@ -620,7 +620,7 @@ class WriterPublishTestCase(CustomTestCase, docutils.SettingsSpec): Test case for publish. """ - settings_default_overrides = {'_disable_config': 1} + settings_default_overrides = {'_disable_config': 1, 'strict_visitor': 1} writer_name = '' # override in subclasses def test_publish(self): -- cgit v1.2.1 From 7ae362549481adae75a701b5d6c17209fc101958 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Wed, 20 Oct 2004 15:38:19 +0000 Subject: added functional tests for compound paragraphs git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2737 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../expected/standalone_rst_html4css1.html | 106 +++++++++++++-------- test/functional/expected/standalone_rst_latex.tex | 37 +++++++ test/functional/input/data/standard.txt | 36 +++++++ 3 files changed, 141 insertions(+), 38 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index 41c84f94c..973db96aa 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -117,17 +117,18 @@ They are transformed from section titles after parsing. --> <li><a class="reference" href="#topics-sidebars-and-rubrics" id="id50" name="id50">2.14.4   Topics, Sidebars, and Rubrics</a></li> <li><a class="reference" href="#target-footnotes" id="id51" name="id51">2.14.5   Target Footnotes</a></li> <li><a class="reference" href="#replacement-text" id="id52" name="id52">2.14.6   Replacement Text</a></li> +<li><a class="reference" href="#compound-paragraph" id="id53" name="id53">2.14.7   Compound Paragraph</a></li> </ul> </li> -<li><a class="reference" href="#substitution-definitions" id="id53" name="id53">2.15   Substitution Definitions</a></li> -<li><a class="reference" href="#comments" id="id54" name="id54">2.16   Comments</a></li> -<li><a class="reference" href="#id19" id="id55" name="id55">2.17   Line Blocks</a></li> -<li><a class="reference" href="#colspanning-tables" id="id56" name="id56">2.18   Colspanning tables</a></li> -<li><a class="reference" href="#rowspanning-tables" id="id57" name="id57">2.19   Rowspanning tables</a></li> -<li><a class="reference" href="#complex-tables" id="id58" name="id58">2.20   Complex tables</a></li> +<li><a class="reference" href="#substitution-definitions" id="id54" name="id54">2.15   Substitution Definitions</a></li> +<li><a class="reference" href="#comments" id="id55" name="id55">2.16   Comments</a></li> +<li><a class="reference" href="#id19" id="id56" name="id56">2.17   Line Blocks</a></li> +<li><a class="reference" href="#colspanning-tables" id="id57" name="id57">2.18   Colspanning tables</a></li> +<li><a class="reference" href="#rowspanning-tables" id="id58" name="id58">2.19   Rowspanning tables</a></li> +<li><a class="reference" href="#complex-tables" id="id59" name="id59">2.20   Complex tables</a></li> </ul> </li> -<li><a class="reference" href="#error-handling" id="id59" name="id59">3   Error Handling</a></li> +<li><a class="reference" href="#error-handling" id="id60" name="id60">3   Error Handling</a></li> </ul> </div> <div class="section" id="structural-elements"> @@ -408,7 +409,7 @@ Here's a reference to the next footnote: <a class="footnote-reference" href="#id <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> <tr><td class="label"><a name="id13">[4]</a></td><td>Here's an unreferenced footnote, with a reference to a -nonexistent footnote: <a href="#id66" name="id67"><span class="problematic" id="id67">[5]_</span></a>.</td></tr> +nonexistent footnote: <a href="#id68" name="id69"><span class="problematic" id="id69">[5]_</span></a>.</td></tr> </tbody> </table> </div> @@ -421,7 +422,7 @@ nonexistent footnote: <a href="#id66" name="id67"><span class="problematic" id=" rendered separately and differently from footnotes.</td></tr> </tbody> </table> -<p>Here's a reference to the above, <a class="citation-reference" href="#cit2002" id="id15" name="id15">[CIT2002]</a>, and a <a href="#id68" name="id69"><span class="problematic" id="id69">[nonexistent]_</span></a> +<p>Here's a reference to the above, <a class="citation-reference" href="#cit2002" id="id15" name="id15">[CIT2002]</a>, and a <a href="#id70" name="id71"><span class="problematic" id="id71">[nonexistent]_</span></a> citation.</p> </div> <div class="section" id="targets"> @@ -435,7 +436,7 @@ hyperlink targets</a> are also possible.</p> "<a class="reference" href="http://www.python.org/">Python</a> <a class="footnote-reference" href="#id22" id="id24" name="id24">[5]</a>".</p> <p>Targets may be indirect and anonymous. Thus <a class="reference" href="#targets">this phrase</a> may also refer to the <a class="reference" href="#targets">Targets</a> section.</p> -<p>Here's a <a href="#id70" name="id71"><span class="problematic" id="id71">`hyperlink reference without a target`_</span></a>, which generates an +<p>Here's a <a href="#id72" name="id73"><span class="problematic" id="id73">`hyperlink reference without a target`_</span></a>, which generates an error.</p> <div class="section" id="duplicate-target-names"> <h3><a class="toc-backref" href="#id44" name="duplicate-target-names">2.13.1   Duplicate Target Names</a></h3> @@ -447,32 +448,33 @@ explicit targets will generate "warning" (level-2) system messages.</p <h3><a class="toc-backref" href="#id45" name="id18">2.13.2   Duplicate Target Names</a></h3> <p>Since there are two "Duplicate Target Names" section headers, we cannot uniquely refer to either of them by name. If we try to (like -this: <a href="#id72" name="id73"><span class="problematic" id="id73">`Duplicate Target Names`_</span></a>), an error is generated.</p> +this: <a href="#id74" name="id75"><span class="problematic" id="id75">`Duplicate Target Names`_</span></a>), an error is generated.</p> </div> </div> <div class="section" id="directives"> <h2><a class="toc-backref" href="#id46" name="directives">2.14   Directives</a></h2> <div class="contents topic" id="contents"> <ul class="auto-toc simple"> -<li><a class="reference" href="#document-parts" id="id60" name="id60">2.14.1   Document Parts</a></li> -<li><a class="reference" href="#images" id="id61" name="id61">2.14.2   Images</a></li> -<li><a class="reference" href="#admonitions" id="id62" name="id62">2.14.3   Admonitions</a></li> -<li><a class="reference" href="#topics-sidebars-and-rubrics" id="id63" name="id63">2.14.4   Topics, Sidebars, and Rubrics</a></li> -<li><a class="reference" href="#target-footnotes" id="id64" name="id64">2.14.5   Target Footnotes</a></li> -<li><a class="reference" href="#replacement-text" id="id65" name="id65">2.14.6   Replacement Text</a></li> +<li><a class="reference" href="#document-parts" id="id61" name="id61">2.14.1   Document Parts</a></li> +<li><a class="reference" href="#images" id="id62" name="id62">2.14.2   Images</a></li> +<li><a class="reference" href="#admonitions" id="id63" name="id63">2.14.3   Admonitions</a></li> +<li><a class="reference" href="#topics-sidebars-and-rubrics" id="id64" name="id64">2.14.4   Topics, Sidebars, and Rubrics</a></li> +<li><a class="reference" href="#target-footnotes" id="id65" name="id65">2.14.5   Target Footnotes</a></li> +<li><a class="reference" href="#replacement-text" id="id66" name="id66">2.14.6   Replacement Text</a></li> +<li><a class="reference" href="#compound-paragraph" id="id67" name="id67">2.14.7   Compound Paragraph</a></li> </ul> </div> <p>These are just a sample of the many reStructuredText Directives. For others, please see <a class="reference" href="http://docutils.sourceforge.net/docs/ref/rst/directives.html">http://docutils.sourceforge.net/docs/ref/rst/directives.html</a>.</p> <div class="section" id="document-parts"> -<h3><a class="toc-backref" href="#id60" name="document-parts">2.14.1   Document Parts</a></h3> +<h3><a class="toc-backref" href="#id61" name="document-parts">2.14.1   Document Parts</a></h3> <p>An example of the "contents" directive can be seen above this section (a local, untitled table of <a class="reference" href="#contents">contents</a>) and at the beginning of the document (a document-wide <a class="reference" href="#table-of-contents">table of contents</a>).</p> </div> <div class="section" id="images"> -<h3><a class="toc-backref" href="#id61" name="images">2.14.2   Images</a></h3> +<h3><a class="toc-backref" href="#id62" name="images">2.14.2   Images</a></h3> <p>An image directive (also clickable -- a hyperlink reference):</p> <p><a class="reference" href="#directives"><img alt="../../../docs/user/rst/images/title.png" src="../../../docs/user/rst/images/title.png" /></a></p> <p>A figure directive:</p> @@ -502,7 +504,7 @@ document (a document-wide <a class="reference" href="#table-of-contents">table o </div> </div> <div class="section" id="admonitions"> -<h3><a class="toc-backref" href="#id62" name="admonitions">2.14.3   Admonitions</a></h3> +<h3><a class="toc-backref" href="#id63" name="admonitions">2.14.3   Admonitions</a></h3> <div class="attention"> <p class="admonition-title first">Attention!</p> Directives at large.</div> @@ -543,7 +545,7 @@ Reader discretion is strongly advised.</div> </div> </div> <div class="section" id="topics-sidebars-and-rubrics"> -<h3><a class="toc-backref" href="#id63" name="topics-sidebars-and-rubrics">2.14.4   Topics, Sidebars, and Rubrics</a></h3> +<h3><a class="toc-backref" href="#id64" name="topics-sidebars-and-rubrics">2.14.4   Topics, Sidebars, and Rubrics</a></h3> <div class="sidebar"> <p class="sidebar-title first">Sidebar Title</p> <p class="sidebar-subtitle">Optional Subtitle</p> @@ -560,7 +562,7 @@ background color.</p> <p class="rubric">This is a rubric</p> </div> <div class="section" id="target-footnotes"> -<h3><a class="toc-backref" href="#id64" name="target-footnotes">2.14.5   Target Footnotes</a></h3> +<h3><a class="toc-backref" href="#id65" name="target-footnotes">2.14.5   Target Footnotes</a></h3> <table class="footnote" frame="void" id="id22" rules="none"> <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> @@ -569,17 +571,45 @@ background color.</p> </table> </div> <div class="section" id="replacement-text"> -<h3><a class="toc-backref" href="#id65" name="replacement-text">2.14.6   Replacement Text</a></h3> +<h3><a class="toc-backref" href="#id66" name="replacement-text">2.14.6   Replacement Text</a></h3> <p>I recommend you try <a class="reference" href="http://www.python.org/">Python, <em>the</em> best language around</a> <a class="footnote-reference" href="#id22" id="id25" name="id25">[5]</a>.</p> </div> +<div class="section" id="compound-paragraph"> +<h3><a class="toc-backref" href="#id67" name="compound-paragraph">2.14.7   Compound Paragraph</a></h3> +<div class="some-class compound"> +<p>Compound 1, paragraph 1.</p> +<p>Compound 1, paragraph 2.</p> +<ul class="simple"> +<li>Compound 1, list item one.</li> +<li>Compound 1, list item two.</li> +</ul> +</div> +<p>Another compound statement:</p> +<div class="compound"> +<p>Compound 2, a literal block:</p> +<pre class="literal-block"> +Compound 2, literal. +</pre> +<p>Compound 2, this is a test.</p> +</div> +<div class="compound"> +Compound 3, only consisting of one paragraph.</div> +<div class="compound"> +<pre class="literal-block"> +Compound 4. +This one starts with a literal block. +</pre> +<p>Compound 4, a paragraph.</p> +</div> +</div> </div> <div class="section" id="substitution-definitions"> -<h2><a class="toc-backref" href="#id53" name="substitution-definitions">2.15   Substitution Definitions</a></h2> +<h2><a class="toc-backref" href="#id54" name="substitution-definitions">2.15   Substitution Definitions</a></h2> <p>An inline image (<img alt="EXAMPLE" src="../../../docs/user/rst/images/biohazard.png" />) example:</p> <p>(Substitution definitions are not visible in the HTML source.)</p> </div> <div class="section" id="comments"> -<h2><a class="toc-backref" href="#id54" name="comments">2.16   Comments</a></h2> +<h2><a class="toc-backref" href="#id55" name="comments">2.16   Comments</a></h2> <p>Here's one:</p> <!-- Comments begin with two dots and a space. Anything may follow, except for the syntax of footnotes, hyperlink @@ -589,7 +619,7 @@ Double-dashes - - "- -" - - must be escaped somehow in HTML output. --> <p>(View the HTML source to see the comment.)</p> </div> <div class="section" id="id19"> -<h2><a class="toc-backref" href="#id55" name="id19">2.17   Line Blocks</a></h2> +<h2><a class="toc-backref" href="#id56" name="id19">2.17   Line Blocks</a></h2> <div class="line-block"> <div class="line">This is a line block. It ends with a blank line.</div> <div class="line-block"> @@ -638,7 +668,7 @@ the left edge of the text above it.</div> </blockquote> </div> <div class="section" id="colspanning-tables"> -<h2><a class="toc-backref" href="#id56" name="colspanning-tables">2.18   Colspanning tables</a></h2> +<h2><a class="toc-backref" href="#id57" name="colspanning-tables">2.18   Colspanning tables</a></h2> <p>This table has a cell spanning two columns:</p> <table border="1" class="table"> <colgroup> @@ -676,7 +706,7 @@ the left edge of the text above it.</div> </table> </div> <div class="section" id="rowspanning-tables"> -<h2><a class="toc-backref" href="#id57" name="rowspanning-tables">2.19   Rowspanning tables</a></h2> +<h2><a class="toc-backref" href="#id58" name="rowspanning-tables">2.19   Rowspanning tables</a></h2> <p>Here's a table with cells spanning several rows:</p> <table border="1" class="table"> <colgroup> @@ -712,7 +742,7 @@ span rows.</td> </table> </div> <div class="section" id="complex-tables"> -<h2><a class="toc-backref" href="#id58" name="complex-tables">2.20   Complex tables</a></h2> +<h2><a class="toc-backref" href="#id59" name="complex-tables">2.20   Complex tables</a></h2> <p>Here's a complex table, which should test all features.</p> <table border="1" class="table"> <colgroup> @@ -762,7 +792,7 @@ empty: <tt class="literal"><span class="pre">--></span></tt></td> </div> </div> <div class="section" id="error-handling"> -<h1><a class="toc-backref" href="#id59" name="error-handling">3   Error Handling</a></h1> +<h1><a class="toc-backref" href="#id60" name="error-handling">3   Error Handling</a></h1> <p>Any errors caught during processing will generate system messages.</p> <p>There should be five messages in the following, auto-generated section, "Docutils System Messages":</p> @@ -773,17 +803,17 @@ section, "Docutils System Messages":</p> <div class="system-message" id="id20"> <p class="system-message-title">System Message: <a name="id20">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 89); <em><a href="#id21">backlink</a></em></p> Undefined substitution referenced: "problematic".</div> -<div class="system-message" id="id66"> -<p class="system-message-title">System Message: <a name="id66">ERROR/3</a> (<tt>functional/input/standalone_rst_html4css1.txt</tt>, line 299); <em><a href="#id67">backlink</a></em></p> -Unknown target name: "5".</div> <div class="system-message" id="id68"> -<p class="system-message-title">System Message: <a name="id68">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 308); <em><a href="#id69">backlink</a></em></p> -Unknown target name: "nonexistent".</div> +<p class="system-message-title">System Message: <a name="id68">ERROR/3</a> (<tt>functional/input/standalone_rst_html4css1.txt</tt>, line 299); <em><a href="#id69">backlink</a></em></p> +Unknown target name: "5".</div> <div class="system-message" id="id70"> -<p class="system-message-title">System Message: <a name="id70">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 333); <em><a href="#id71">backlink</a></em></p> -Unknown target name: "hyperlink reference without a target".</div> +<p class="system-message-title">System Message: <a name="id70">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 308); <em><a href="#id71">backlink</a></em></p> +Unknown target name: "nonexistent".</div> <div class="system-message" id="id72"> -<p class="system-message-title">System Message: <a name="id72">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 346); <em><a href="#id73">backlink</a></em></p> +<p class="system-message-title">System Message: <a name="id72">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 333); <em><a href="#id73">backlink</a></em></p> +Unknown target name: "hyperlink reference without a target".</div> +<div class="system-message" id="id74"> +<p class="system-message-title">System Message: <a name="id74">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 346); <em><a href="#id75">backlink</a></em></p> Duplicate target name, cannot be used as a unique reference: "duplicate target names".</div> </div> </div> diff --git a/test/functional/expected/standalone_rst_latex.tex b/test/functional/expected/standalone_rst_latex.tex index 26db14046..fe8858fe8 100644 --- a/test/functional/expected/standalone_rst_latex.tex +++ b/test/functional/expected/standalone_rst_latex.tex @@ -184,6 +184,8 @@ reStructuredText construct. \item {} \href{\#replacement-text}{2.14.6~~~Replacement Text} +\item {} \href{\#compound-paragraph}{2.14.7~~~Compound Paragraph} + \end{list} \item {} \href{\#substitution-definitions}{2.15~~~Substitution Definitions} @@ -722,6 +724,8 @@ this: {\color{red}\bfseries{}`Duplicate Target Names`{\_}}), an error is generat \item {} \href{\#replacement-text}{2.14.6~~~Replacement Text} +\item {} \href{\#compound-paragraph}{2.14.7~~~Compound Paragraph} + \end{list} @@ -943,6 +947,39 @@ This is a topic. I recommend you try \href{http://www.python.org/}{Python, \emph{the} best language around}\raisebox{.5em}[0em]{\scriptsize\hyperlink{id21}{5}}. +%___________________________________________________________________________ + +\hypertarget{compound-paragraph}{} +\pdfbookmark[2]{2.14.7~~~Compound Paragraph}{compound-paragraph} +\subsubsection*{2.14.7~~~Compound Paragraph} + +Compound 1, paragraph 1. +Compound 1, paragraph 2. +\begin{itemize} +\item {} +Compound 1, list item one. + +\item {} +Compound 1, list item two. + +\end{itemize} + +Another compound statement: + +Compound 2, a literal block: +\begin{quote}{\ttfamily \raggedright \noindent +Compound~2,~literal. +}\end{quote} +Compound 2, this is a test. + +Compound 3, only consisting of one paragraph. +\begin{quote}{\ttfamily \raggedright \noindent +Compound~4.~\\ +This~one~starts~with~a~literal~block. +}\end{quote} +Compound 4, a paragraph. + + %___________________________________________________________________________ \hypertarget{substitution-definitions}{} diff --git a/test/functional/input/data/standard.txt b/test/functional/input/data/standard.txt index b4d4de4c9..26351be8a 100644 --- a/test/functional/input/data/standard.txt +++ b/test/functional/input/data/standard.txt @@ -451,6 +451,42 @@ I recommend you try |Python|_. .. |Python| replace:: Python, *the* best language around +Compound Paragraph +`````````````````` + +.. compound:: + :class: some-class + + Compound 1, paragraph 1. + + Compound 1, paragraph 2. + + * Compound 1, list item one. + * Compound 1, list item two. + +Another compound statement: + +.. compound:: + + Compound 2, a literal block:: + + Compound 2, literal. + + Compound 2, this is a test. + +.. compound:: + + Compound 3, only consisting of one paragraph. + +.. compound:: + + :: + + Compound 4. + This one starts with a literal block. + + Compound 4, a paragraph. + Substitution Definitions ------------------------ -- cgit v1.2.1 From 7a61fb0b3b0beea0aeb3d301295e7ec225cbf358 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Wed, 20 Oct 2004 16:33:40 +0000 Subject: added logic to avoid merging of consecutive simple paragraphs in compound paragraphs in LaTeX git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2740 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_latex.tex | 1 + 1 file changed, 1 insertion(+) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_latex.tex b/test/functional/expected/standalone_rst_latex.tex index fe8858fe8..ce0d190aa 100644 --- a/test/functional/expected/standalone_rst_latex.tex +++ b/test/functional/expected/standalone_rst_latex.tex @@ -954,6 +954,7 @@ I recommend you try \href{http://www.python.org/}{Python, \emph{the} best langua \subsubsection*{2.14.7~~~Compound Paragraph} Compound 1, paragraph 1. + Compound 1, paragraph 2. \begin{itemize} \item {} -- cgit v1.2.1 From f214a7086a409141d9fc618b5d573d1ffa7e57de Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Wed, 20 Oct 2004 17:35:12 +0000 Subject: added functional test for nested compounds git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2742 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_html4css1.html | 10 ++++++++++ test/functional/expected/standalone_rst_latex.tex | 11 +++++++++++ test/functional/input/data/standard.txt | 15 +++++++++++++++ 3 files changed, 36 insertions(+) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index 973db96aa..6011b8586 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -601,6 +601,16 @@ This one starts with a literal block. </pre> <p>Compound 4, a paragraph.</p> </div> +<p>Now something <em>really</em> perverted -- a nested compound block. In +LaTeX, the following paragraphs should all be first-line indented:</p> +<div class="compound"> +<p>Compound 5, block 1 (a paragraph).</p> +<div class="compound"> +<p>Compound 6, block 2 in compound 5.</p> +<p>Compound 6, another paragraph.</p> +</div> +<p>Compound 5, block 3 (a paragraph).</p> +</div> </div> </div> <div class="section" id="substitution-definitions"> diff --git a/test/functional/expected/standalone_rst_latex.tex b/test/functional/expected/standalone_rst_latex.tex index ce0d190aa..e003983d3 100644 --- a/test/functional/expected/standalone_rst_latex.tex +++ b/test/functional/expected/standalone_rst_latex.tex @@ -980,6 +980,17 @@ This~one~starts~with~a~literal~block. }\end{quote} Compound 4, a paragraph. +Now something \emph{really} perverted -- a nested compound block. In +LaTeX, the following paragraphs should all be first-line indented: + +Compound 5, block 1 (a paragraph). + +Compound 6, block 2 in compound 5. + +Compound 6, another paragraph. + +Compound 5, block 3 (a paragraph). + %___________________________________________________________________________ diff --git a/test/functional/input/data/standard.txt b/test/functional/input/data/standard.txt index 26351be8a..e182a9d91 100644 --- a/test/functional/input/data/standard.txt +++ b/test/functional/input/data/standard.txt @@ -487,6 +487,21 @@ Another compound statement: Compound 4, a paragraph. +Now something *really* perverted -- a nested compound block. In +LaTeX, the following paragraphs should all be first-line indented: + +.. compound:: + + Compound 5, block 1 (a paragraph). + + .. compound:: + + Compound 6, block 2 in compound 5. + + Compound 6, another paragraph. + + Compound 5, block 3 (a paragraph). + Substitution Definitions ------------------------ -- cgit v1.2.1 From 59f7427dda9446005d1f3b042667c2b02769673b Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Wed, 20 Oct 2004 19:26:25 +0000 Subject: updated LaTeX writer test for newly added lineblock environment git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2745 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_writers/test_latex2e.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test') diff --git a/test/test_writers/test_latex2e.py b/test/test_writers/test_latex2e.py index 8ef958e2a..3b0270477 100644 --- a/test/test_writers/test_latex2e.py +++ b/test/test_writers/test_latex2e.py @@ -51,6 +51,14 @@ latex_head = """\ \\addtolength{\\leftmargin}{\\labelsep} \\renewcommand{\\makelabel}{\\optionlistlabel}} }{\\end{list}} +\\newenvironment{lineblock} +{\\begin{list}{} + {\\setlength{\\partopsep}{\\parskip} + \\addtolength{\\partopsep}{\\baselineskip} + \\topsep0pt\\itemsep0.15\\baselineskip\\parsep0pt + \\leftmargin2em} + \\raggedright} +{\\end{list}} % begin: floats for footnotes tweaking. \\setlength{\\floatsep}{0.5em} \\setlength{\\textfloatsep}{\\fill} -- cgit v1.2.1 From 29a5394b86aa4fdcdfcb5925467bf4fc861f6a29 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Wed, 20 Oct 2004 19:26:40 +0000 Subject: extended line block test, moved from line_blocks.txt to standard.txt git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2746 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../expected/standalone_rst_html4css1.html | 298 +++++++++++---------- test/functional/expected/standalone_rst_latex.tex | 79 +++++- test/functional/input/data/line_blocks.txt | 30 --- test/functional/input/data/standard.txt | 40 ++- test/functional/input/standalone_rst_html4css1.txt | 1 - 5 files changed, 266 insertions(+), 182 deletions(-) delete mode 100644 test/functional/input/data/line_blocks.txt (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index 6011b8586..5360548fa 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -84,76 +84,75 @@ They are transformed from section titles after parsing. --> <div class="contents topic" id="table-of-contents"> <p class="topic-title first"><a name="table-of-contents">Table of Contents</a></p> <ul class="auto-toc simple"> -<li><a class="reference" href="#structural-elements" id="id26" name="id26">1   Structural Elements</a><ul class="auto-toc"> -<li><a class="reference" href="#section-title" id="id27" name="id27">1.1   Section Title</a></li> -<li><a class="reference" href="#transitions" id="id28" name="id28">1.2   Transitions</a></li> +<li><a class="reference" href="#structural-elements" id="id25" name="id25">1   Structural Elements</a><ul class="auto-toc"> +<li><a class="reference" href="#section-title" id="id26" name="id26">1.1   Section Title</a></li> +<li><a class="reference" href="#transitions" id="id27" name="id27">1.2   Transitions</a></li> </ul> </li> -<li><a class="reference" href="#body-elements" id="id29" name="id29">2   Body Elements</a><ul class="auto-toc"> -<li><a class="reference" href="#paragraphs" id="id30" name="id30">2.1   Paragraphs</a><ul class="auto-toc"> -<li><a class="reference" href="#inline-markup" id="id31" name="id31">2.1.1   Inline Markup</a></li> +<li><a class="reference" href="#body-elements" id="id28" name="id28">2   Body Elements</a><ul class="auto-toc"> +<li><a class="reference" href="#paragraphs" id="id29" name="id29">2.1   Paragraphs</a><ul class="auto-toc"> +<li><a class="reference" href="#inline-markup" id="id30" name="id30">2.1.1   Inline Markup</a></li> </ul> </li> -<li><a class="reference" href="#bullet-lists" id="id32" name="id32">2.2   Bullet Lists</a></li> -<li><a class="reference" href="#enumerated-lists" id="id33" name="id33">2.3   Enumerated Lists</a></li> -<li><a class="reference" href="#definition-lists" id="id34" name="id34">2.4   Definition Lists</a></li> -<li><a class="reference" href="#field-lists" id="id35" name="id35">2.5   Field Lists</a></li> -<li><a class="reference" href="#option-lists" id="id36" name="id36">2.6   Option Lists</a></li> -<li><a class="reference" href="#literal-blocks" id="id37" name="id37">2.7   Literal Blocks</a></li> -<li><a class="reference" href="#line-blocks" id="id38" name="id38">2.8   Line Blocks</a></li> -<li><a class="reference" href="#block-quotes" id="id39" name="id39">2.9   Block Quotes</a></li> -<li><a class="reference" href="#doctest-blocks" id="id40" name="id40">2.10   Doctest Blocks</a></li> -<li><a class="reference" href="#footnotes" id="id41" name="id41">2.11   Footnotes</a></li> -<li><a class="reference" href="#citations" id="id42" name="id42">2.12   Citations</a></li> -<li><a class="reference" href="#targets" id="id43" name="id43">2.13   Targets</a><ul class="auto-toc"> -<li><a class="reference" href="#duplicate-target-names" id="id44" name="id44">2.13.1   Duplicate Target Names</a></li> -<li><a class="reference" href="#id18" id="id45" name="id45">2.13.2   Duplicate Target Names</a></li> +<li><a class="reference" href="#bullet-lists" id="id31" name="id31">2.2   Bullet Lists</a></li> +<li><a class="reference" href="#enumerated-lists" id="id32" name="id32">2.3   Enumerated Lists</a></li> +<li><a class="reference" href="#definition-lists" id="id33" name="id33">2.4   Definition Lists</a></li> +<li><a class="reference" href="#field-lists" id="id34" name="id34">2.5   Field Lists</a></li> +<li><a class="reference" href="#option-lists" id="id35" name="id35">2.6   Option Lists</a></li> +<li><a class="reference" href="#literal-blocks" id="id36" name="id36">2.7   Literal Blocks</a></li> +<li><a class="reference" href="#line-blocks" id="id37" name="id37">2.8   Line Blocks</a></li> +<li><a class="reference" href="#block-quotes" id="id38" name="id38">2.9   Block Quotes</a></li> +<li><a class="reference" href="#doctest-blocks" id="id39" name="id39">2.10   Doctest Blocks</a></li> +<li><a class="reference" href="#footnotes" id="id40" name="id40">2.11   Footnotes</a></li> +<li><a class="reference" href="#citations" id="id41" name="id41">2.12   Citations</a></li> +<li><a class="reference" href="#targets" id="id42" name="id42">2.13   Targets</a><ul class="auto-toc"> +<li><a class="reference" href="#duplicate-target-names" id="id43" name="id43">2.13.1   Duplicate Target Names</a></li> +<li><a class="reference" href="#id18" id="id44" name="id44">2.13.2   Duplicate Target Names</a></li> </ul> </li> -<li><a class="reference" href="#directives" id="id46" name="id46">2.14   Directives</a><ul class="auto-toc"> -<li><a class="reference" href="#document-parts" id="id47" name="id47">2.14.1   Document Parts</a></li> -<li><a class="reference" href="#images" id="id48" name="id48">2.14.2   Images</a></li> -<li><a class="reference" href="#admonitions" id="id49" name="id49">2.14.3   Admonitions</a></li> -<li><a class="reference" href="#topics-sidebars-and-rubrics" id="id50" name="id50">2.14.4   Topics, Sidebars, and Rubrics</a></li> -<li><a class="reference" href="#target-footnotes" id="id51" name="id51">2.14.5   Target Footnotes</a></li> -<li><a class="reference" href="#replacement-text" id="id52" name="id52">2.14.6   Replacement Text</a></li> -<li><a class="reference" href="#compound-paragraph" id="id53" name="id53">2.14.7   Compound Paragraph</a></li> +<li><a class="reference" href="#directives" id="id45" name="id45">2.14   Directives</a><ul class="auto-toc"> +<li><a class="reference" href="#document-parts" id="id46" name="id46">2.14.1   Document Parts</a></li> +<li><a class="reference" href="#images" id="id47" name="id47">2.14.2   Images</a></li> +<li><a class="reference" href="#admonitions" id="id48" name="id48">2.14.3   Admonitions</a></li> +<li><a class="reference" href="#topics-sidebars-and-rubrics" id="id49" name="id49">2.14.4   Topics, Sidebars, and Rubrics</a></li> +<li><a class="reference" href="#target-footnotes" id="id50" name="id50">2.14.5   Target Footnotes</a></li> +<li><a class="reference" href="#replacement-text" id="id51" name="id51">2.14.6   Replacement Text</a></li> +<li><a class="reference" href="#compound-paragraph" id="id52" name="id52">2.14.7   Compound Paragraph</a></li> </ul> </li> -<li><a class="reference" href="#substitution-definitions" id="id54" name="id54">2.15   Substitution Definitions</a></li> -<li><a class="reference" href="#comments" id="id55" name="id55">2.16   Comments</a></li> -<li><a class="reference" href="#id19" id="id56" name="id56">2.17   Line Blocks</a></li> -<li><a class="reference" href="#colspanning-tables" id="id57" name="id57">2.18   Colspanning tables</a></li> -<li><a class="reference" href="#rowspanning-tables" id="id58" name="id58">2.19   Rowspanning tables</a></li> -<li><a class="reference" href="#complex-tables" id="id59" name="id59">2.20   Complex tables</a></li> +<li><a class="reference" href="#substitution-definitions" id="id53" name="id53">2.15   Substitution Definitions</a></li> +<li><a class="reference" href="#comments" id="id54" name="id54">2.16   Comments</a></li> +<li><a class="reference" href="#colspanning-tables" id="id55" name="id55">2.17   Colspanning tables</a></li> +<li><a class="reference" href="#rowspanning-tables" id="id56" name="id56">2.18   Rowspanning tables</a></li> +<li><a class="reference" href="#complex-tables" id="id57" name="id57">2.19   Complex tables</a></li> </ul> </li> -<li><a class="reference" href="#error-handling" id="id60" name="id60">3   Error Handling</a></li> +<li><a class="reference" href="#error-handling" id="id58" name="id58">3   Error Handling</a></li> </ul> </div> <div class="section" id="structural-elements"> -<h1><a class="toc-backref" href="#id26" name="structural-elements">1   Structural Elements</a></h1> +<h1><a class="toc-backref" href="#id25" name="structural-elements">1   Structural Elements</a></h1> <div class="section" id="section-title"> -<h2><a class="toc-backref" href="#id27" name="section-title">1.1   Section Title</a></h2> +<h2><a class="toc-backref" href="#id26" name="section-title">1.1   Section Title</a></h2> <p>That's it, the text just above this line.</p> </div> <div class="section" id="transitions"> -<h2><a class="toc-backref" href="#id28" name="transitions">1.2   Transitions</a></h2> +<h2><a class="toc-backref" href="#id27" name="transitions">1.2   Transitions</a></h2> <p>Here's a transition:</p> <hr /> <p>It divides the section.</p> </div> </div> <div class="section" id="body-elements"> -<h1><a class="toc-backref" href="#id29" name="body-elements">2   Body Elements</a></h1> +<h1><a class="toc-backref" href="#id28" name="body-elements">2   Body Elements</a></h1> <div class="section" id="paragraphs"> -<h2><a class="toc-backref" href="#id30" name="paragraphs">2.1   Paragraphs</a></h2> +<h2><a class="toc-backref" href="#id29" name="paragraphs">2.1   Paragraphs</a></h2> <p>A paragraph.</p> <div class="section" id="inline-markup"> -<h3><a class="toc-backref" href="#id31" name="inline-markup">2.1.1   Inline Markup</a></h3> +<h3><a class="toc-backref" href="#id30" name="inline-markup">2.1.1   Inline Markup</a></h3> <p>Paragraphs contain text and may contain inline markup: <em>emphasis</em>, <strong>strong emphasis</strong>, <tt class="literal"><span class="pre">inline</span> <span class="pre">literals</span></tt>, standalone hyperlinks -(<a class="reference" href="http://www.python.org">http://www.python.org</a>), external hyperlinks (<a class="reference" href="http://www.python.org/">Python</a> <a class="footnote-reference" href="#id22" id="id23" name="id23">[5]</a>), internal +(<a class="reference" href="http://www.python.org">http://www.python.org</a>), external hyperlinks (<a class="reference" href="http://www.python.org/">Python</a> <a class="footnote-reference" href="#id21" id="id22" name="id22">[5]</a>), internal cross-references (<a class="reference" href="#example">example</a>), external hyperlinks with embedded URIs (<a class="reference" href="http://www.python.org">Python web site</a>), footnote references (manually numbered <a class="footnote-reference" href="#id6" id="id1" name="id1">[1]</a>, anonymous auto-numbered <a class="footnote-reference" href="#id9" id="id2" name="id2">[3]</a>, labeled @@ -162,7 +161,7 @@ auto-numbered <a class="footnote-reference" href="#label" id="id3" name="id3">[2 hyperlink targets</a> (see <a class="reference" href="#targets">Targets</a> below for a reference back to here). Character-level inline markup is also possible (although exceedingly ugly!) in <em>re</em><tt class="literal"><span class="pre">Structured</span></tt><em>Text</em>. Problems are indicated by -<a href="#id20" name="id21"><span class="problematic" id="id21">|problematic|</span></a> text (generated by processing errors; this one is +<a href="#id19" name="id20"><span class="problematic" id="id20">|problematic|</span></a> text (generated by processing errors; this one is intentional).</p> <p>The default role for interpreted text is <cite>Title Reference</cite>. Here are some explicit interpreted text roles: a PEP reference (<a class="reference" href="http://www.python.org/peps/pep-0287.html">PEP 287</a>); an @@ -181,7 +180,7 @@ live link to PEP 258 here.</p> </div> </div> <div class="section" id="bullet-lists"> -<h2><a class="toc-backref" href="#id32" name="bullet-lists">2.2   Bullet Lists</a></h2> +<h2><a class="toc-backref" href="#id31" name="bullet-lists">2.2   Bullet Lists</a></h2> <ul> <li><p class="first">A bullet list</p> <ul class="simple"> @@ -204,7 +203,7 @@ live link to PEP 258 here.</p> </ul> </div> <div class="section" id="enumerated-lists"> -<h2><a class="toc-backref" href="#id33" name="enumerated-lists">2.3   Enumerated Lists</a></h2> +<h2><a class="toc-backref" href="#id32" name="enumerated-lists">2.3   Enumerated Lists</a></h2> <ol class="arabic"> <li><p class="first">Arabic numerals.</p> <ol class="loweralpha simple"> @@ -237,7 +236,7 @@ live link to PEP 258 here.</p> </ol> </div> <div class="section" id="definition-lists"> -<h2><a class="toc-backref" href="#id34" name="definition-lists">2.4   Definition Lists</a></h2> +<h2><a class="toc-backref" href="#id33" name="definition-lists">2.4   Definition Lists</a></h2> <dl> <dt>Term</dt> <dd>Definition</dd> @@ -250,7 +249,7 @@ live link to PEP 258 here.</p> </dl> </div> <div class="section" id="field-lists"> -<h2><a class="toc-backref" href="#id35" name="field-lists">2.5   Field Lists</a></h2> +<h2><a class="toc-backref" href="#id34" name="field-lists">2.5   Field Lists</a></h2> <table class="field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> @@ -273,7 +272,7 @@ doesn't get stripped away.)</p> </table> </div> <div class="section" id="option-lists"> -<h2><a class="toc-backref" href="#id36" name="option-lists">2.6   Option Lists</a></h2> +<h2><a class="toc-backref" href="#id35" name="option-lists">2.6   Option Lists</a></h2> <p>For listing command-line options:</p> <table class="option-list" frame="void" rules="none"> <col class="option" /> @@ -319,7 +318,7 @@ regardless of where it starts.</p> description.</p> </div> <div class="section" id="literal-blocks"> -<h2><a class="toc-backref" href="#id37" name="literal-blocks">2.7   Literal Blocks</a></h2> +<h2><a class="toc-backref" href="#id36" name="literal-blocks">2.7   Literal Blocks</a></h2> <p>Literal blocks are indicated with a double-colon ("::") at the end of the preceding paragraph (over there <tt class="literal"><span class="pre">--></span></tt>). They can be indented:</p> <pre class="literal-block"> @@ -336,12 +335,66 @@ if literal_block: </pre> </div> <div class="section" id="line-blocks"> -<h2><a class="toc-backref" href="#id38" name="line-blocks">2.8   Line Blocks</a></h2> -<p>(To be inserted from line_blocks.txt once the LaTeX writer has -implemented it.)</p> +<h2><a class="toc-backref" href="#id37" name="line-blocks">2.8   Line Blocks</a></h2> +<p>This section tests line blocks. Line blocks are body elements which +consist of lines and other line blocks. Nested line blocks cause +indentation.</p> +<div class="line-block"> +<div class="line">This is a line block. It ends with a blank line.</div> +<div class="line-block"> +<div class="line">New lines begin with a vertical bar ("|").</div> +<div class="line">Line breaks and initial indent are significant, and preserved.</div> +<div class="line-block"> +<div class="line">Continuation lines are also possible. A long line that is intended +to wrap should begin with a space in place of the vertical bar.</div> +</div> +<div class="line">The left edge of a continuation line need not be aligned with +the left edge of the text above it.</div> +</div> +</div> +<div class="line-block"> +<div class="line">This is a second line block.</div> +<div class="line"><br /></div> +<div class="line">Blank lines are permitted internally, but they must begin with a "|".</div> +</div> +<p>Another line block, surrounded by paragraphs:</p> +<div class="line-block"> +<div class="line">And it's no good waiting by the window</div> +<div class="line">It's no good waiting for the sun</div> +<div class="line">Please believe me, the things you dream of</div> +<div class="line">They don't fall in the lap of no-one</div> +</div> +<p>Take it away, Eric the Orchestra Leader!</p> +<blockquote> +<div class="line-block"> +<div class="line">A one, two, a one two three four</div> +<div class="line"><br /></div> +<div class="line">Half a bee, philosophically,</div> +<div class="line-block"> +<div class="line">must, <em>ipso facto</em>, half not be.</div> +</div> +<div class="line">But half the bee has got to be,</div> +<div class="line-block"> +<div class="line"><em>vis a vis</em> its entity. D'you see?</div> +<div class="line"><br /></div> +</div> +<div class="line">But can a bee be said to be</div> +<div class="line-block"> +<div class="line">or not to be an entire bee,</div> +<div class="line-block"> +<div class="line">when half the bee is not a bee,</div> +<div class="line-block"> +<div class="line">due to some ancient injury?</div> +<div class="line"><br /></div> +</div> +</div> +</div> +<div class="line">Singing...</div> +</div> +</blockquote> </div> <div class="section" id="block-quotes"> -<h2><a class="toc-backref" href="#id39" name="block-quotes">2.9   Block Quotes</a></h2> +<h2><a class="toc-backref" href="#id38" name="block-quotes">2.9   Block Quotes</a></h2> <p>Block quotes consist of indented body elements:</p> <blockquote> <p>My theory by A. Elk. Brackets Miss, brackets. This theory goes @@ -353,7 +406,7 @@ own it, and what it is too.</p> </blockquote> </div> <div class="section" id="doctest-blocks"> -<h2><a class="toc-backref" href="#id40" name="doctest-blocks">2.10   Doctest Blocks</a></h2> +<h2><a class="toc-backref" href="#id39" name="doctest-blocks">2.10   Doctest Blocks</a></h2> <pre class="doctest-block"> >>> print 'Python-specific usage examples; begun with ">>>"' Python-specific usage examples; begun with ">>>" @@ -362,7 +415,7 @@ Python-specific usage examples; begun with ">>>" </pre> </div> <div class="section" id="footnotes"> -<h2><a class="toc-backref" href="#id41" name="footnotes">2.11   Footnotes</a></h2> +<h2><a class="toc-backref" href="#id40" name="footnotes">2.11   Footnotes</a></h2> <table class="footnote" frame="void" id="id6" rules="none"> <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> @@ -409,12 +462,12 @@ Here's a reference to the next footnote: <a class="footnote-reference" href="#id <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> <tr><td class="label"><a name="id13">[4]</a></td><td>Here's an unreferenced footnote, with a reference to a -nonexistent footnote: <a href="#id68" name="id69"><span class="problematic" id="id69">[5]_</span></a>.</td></tr> +nonexistent footnote: <a href="#id66" name="id67"><span class="problematic" id="id67">[5]_</span></a>.</td></tr> </tbody> </table> </div> <div class="section" id="citations"> -<h2><a class="toc-backref" href="#id42" name="citations">2.12   Citations</a></h2> +<h2><a class="toc-backref" href="#id41" name="citations">2.12   Citations</a></h2> <table class="citation" frame="void" id="cit2002" rules="none"> <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> @@ -422,59 +475,59 @@ nonexistent footnote: <a href="#id68" name="id69"><span class="problematic" id=" rendered separately and differently from footnotes.</td></tr> </tbody> </table> -<p>Here's a reference to the above, <a class="citation-reference" href="#cit2002" id="id15" name="id15">[CIT2002]</a>, and a <a href="#id70" name="id71"><span class="problematic" id="id71">[nonexistent]_</span></a> +<p>Here's a reference to the above, <a class="citation-reference" href="#cit2002" id="id15" name="id15">[CIT2002]</a>, and a <a href="#id68" name="id69"><span class="problematic" id="id69">[nonexistent]_</span></a> citation.</p> </div> <div class="section" id="targets"> -<h2><a class="toc-backref" href="#id43" name="targets">2.13   Targets</a></h2> +<h2><a class="toc-backref" href="#id42" name="targets">2.13   Targets</a></h2> <a class="target" id="example" name="example"></a><p>This paragraph is pointed to by the explicit "example" target. A reference can be found under <a class="reference" href="#inline-markup">Inline Markup</a>, above. <a class="reference" href="#inline-hyperlink-targets">Inline hyperlink targets</a> are also possible.</p> <p>Section headers are implicit targets, referred to by name. See <a class="reference" href="#targets">Targets</a>, which is a subsection of <a class="reference" href="#body-elements">Body Elements</a>.</p> <p>Explicit external targets are interpolated into references such as -"<a class="reference" href="http://www.python.org/">Python</a> <a class="footnote-reference" href="#id22" id="id24" name="id24">[5]</a>".</p> +"<a class="reference" href="http://www.python.org/">Python</a> <a class="footnote-reference" href="#id21" id="id23" name="id23">[5]</a>".</p> <p>Targets may be indirect and anonymous. Thus <a class="reference" href="#targets">this phrase</a> may also refer to the <a class="reference" href="#targets">Targets</a> section.</p> -<p>Here's a <a href="#id72" name="id73"><span class="problematic" id="id73">`hyperlink reference without a target`_</span></a>, which generates an +<p>Here's a <a href="#id70" name="id71"><span class="problematic" id="id71">`hyperlink reference without a target`_</span></a>, which generates an error.</p> <div class="section" id="duplicate-target-names"> -<h3><a class="toc-backref" href="#id44" name="duplicate-target-names">2.13.1   Duplicate Target Names</a></h3> +<h3><a class="toc-backref" href="#id43" name="duplicate-target-names">2.13.1   Duplicate Target Names</a></h3> <p>Duplicate names in section headers or other implicit targets will generate "info" (level-1) system messages. Duplicate names in explicit targets will generate "warning" (level-2) system messages.</p> </div> <div class="section" id="id18"> -<h3><a class="toc-backref" href="#id45" name="id18">2.13.2   Duplicate Target Names</a></h3> +<h3><a class="toc-backref" href="#id44" name="id18">2.13.2   Duplicate Target Names</a></h3> <p>Since there are two "Duplicate Target Names" section headers, we cannot uniquely refer to either of them by name. If we try to (like -this: <a href="#id74" name="id75"><span class="problematic" id="id75">`Duplicate Target Names`_</span></a>), an error is generated.</p> +this: <a href="#id72" name="id73"><span class="problematic" id="id73">`Duplicate Target Names`_</span></a>), an error is generated.</p> </div> </div> <div class="section" id="directives"> -<h2><a class="toc-backref" href="#id46" name="directives">2.14   Directives</a></h2> +<h2><a class="toc-backref" href="#id45" name="directives">2.14   Directives</a></h2> <div class="contents topic" id="contents"> <ul class="auto-toc simple"> -<li><a class="reference" href="#document-parts" id="id61" name="id61">2.14.1   Document Parts</a></li> -<li><a class="reference" href="#images" id="id62" name="id62">2.14.2   Images</a></li> -<li><a class="reference" href="#admonitions" id="id63" name="id63">2.14.3   Admonitions</a></li> -<li><a class="reference" href="#topics-sidebars-and-rubrics" id="id64" name="id64">2.14.4   Topics, Sidebars, and Rubrics</a></li> -<li><a class="reference" href="#target-footnotes" id="id65" name="id65">2.14.5   Target Footnotes</a></li> -<li><a class="reference" href="#replacement-text" id="id66" name="id66">2.14.6   Replacement Text</a></li> -<li><a class="reference" href="#compound-paragraph" id="id67" name="id67">2.14.7   Compound Paragraph</a></li> +<li><a class="reference" href="#document-parts" id="id59" name="id59">2.14.1   Document Parts</a></li> +<li><a class="reference" href="#images" id="id60" name="id60">2.14.2   Images</a></li> +<li><a class="reference" href="#admonitions" id="id61" name="id61">2.14.3   Admonitions</a></li> +<li><a class="reference" href="#topics-sidebars-and-rubrics" id="id62" name="id62">2.14.4   Topics, Sidebars, and Rubrics</a></li> +<li><a class="reference" href="#target-footnotes" id="id63" name="id63">2.14.5   Target Footnotes</a></li> +<li><a class="reference" href="#replacement-text" id="id64" name="id64">2.14.6   Replacement Text</a></li> +<li><a class="reference" href="#compound-paragraph" id="id65" name="id65">2.14.7   Compound Paragraph</a></li> </ul> </div> <p>These are just a sample of the many reStructuredText Directives. For others, please see <a class="reference" href="http://docutils.sourceforge.net/docs/ref/rst/directives.html">http://docutils.sourceforge.net/docs/ref/rst/directives.html</a>.</p> <div class="section" id="document-parts"> -<h3><a class="toc-backref" href="#id61" name="document-parts">2.14.1   Document Parts</a></h3> +<h3><a class="toc-backref" href="#id59" name="document-parts">2.14.1   Document Parts</a></h3> <p>An example of the "contents" directive can be seen above this section (a local, untitled table of <a class="reference" href="#contents">contents</a>) and at the beginning of the document (a document-wide <a class="reference" href="#table-of-contents">table of contents</a>).</p> </div> <div class="section" id="images"> -<h3><a class="toc-backref" href="#id62" name="images">2.14.2   Images</a></h3> +<h3><a class="toc-backref" href="#id60" name="images">2.14.2   Images</a></h3> <p>An image directive (also clickable -- a hyperlink reference):</p> <p><a class="reference" href="#directives"><img alt="../../../docs/user/rst/images/title.png" src="../../../docs/user/rst/images/title.png" /></a></p> <p>A figure directive:</p> @@ -504,7 +557,7 @@ document (a document-wide <a class="reference" href="#table-of-contents">table o </div> </div> <div class="section" id="admonitions"> -<h3><a class="toc-backref" href="#id63" name="admonitions">2.14.3   Admonitions</a></h3> +<h3><a class="toc-backref" href="#id61" name="admonitions">2.14.3   Admonitions</a></h3> <div class="attention"> <p class="admonition-title first">Attention!</p> Directives at large.</div> @@ -545,7 +598,7 @@ Reader discretion is strongly advised.</div> </div> </div> <div class="section" id="topics-sidebars-and-rubrics"> -<h3><a class="toc-backref" href="#id64" name="topics-sidebars-and-rubrics">2.14.4   Topics, Sidebars, and Rubrics</a></h3> +<h3><a class="toc-backref" href="#id62" name="topics-sidebars-and-rubrics">2.14.4   Topics, Sidebars, and Rubrics</a></h3> <div class="sidebar"> <p class="sidebar-title first">Sidebar Title</p> <p class="sidebar-subtitle">Optional Subtitle</p> @@ -562,20 +615,20 @@ background color.</p> <p class="rubric">This is a rubric</p> </div> <div class="section" id="target-footnotes"> -<h3><a class="toc-backref" href="#id65" name="target-footnotes">2.14.5   Target Footnotes</a></h3> -<table class="footnote" frame="void" id="id22" rules="none"> +<h3><a class="toc-backref" href="#id63" name="target-footnotes">2.14.5   Target Footnotes</a></h3> +<table class="footnote" frame="void" id="id21" rules="none"> <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> -<tr><td class="label"><a name="id22">[5]</a></td><td><em>(<a class="fn-backref" href="#id23">1</a>, <a class="fn-backref" href="#id24">2</a>, <a class="fn-backref" href="#id25">3</a>)</em> <a class="reference" href="http://www.python.org/">http://www.python.org/</a></td></tr> +<tr><td class="label"><a name="id21">[5]</a></td><td><em>(<a class="fn-backref" href="#id22">1</a>, <a class="fn-backref" href="#id23">2</a>, <a class="fn-backref" href="#id24">3</a>)</em> <a class="reference" href="http://www.python.org/">http://www.python.org/</a></td></tr> </tbody> </table> </div> <div class="section" id="replacement-text"> -<h3><a class="toc-backref" href="#id66" name="replacement-text">2.14.6   Replacement Text</a></h3> -<p>I recommend you try <a class="reference" href="http://www.python.org/">Python, <em>the</em> best language around</a> <a class="footnote-reference" href="#id22" id="id25" name="id25">[5]</a>.</p> +<h3><a class="toc-backref" href="#id64" name="replacement-text">2.14.6   Replacement Text</a></h3> +<p>I recommend you try <a class="reference" href="http://www.python.org/">Python, <em>the</em> best language around</a> <a class="footnote-reference" href="#id21" id="id24" name="id24">[5]</a>.</p> </div> <div class="section" id="compound-paragraph"> -<h3><a class="toc-backref" href="#id67" name="compound-paragraph">2.14.7   Compound Paragraph</a></h3> +<h3><a class="toc-backref" href="#id65" name="compound-paragraph">2.14.7   Compound Paragraph</a></h3> <div class="some-class compound"> <p>Compound 1, paragraph 1.</p> <p>Compound 1, paragraph 2.</p> @@ -614,12 +667,12 @@ LaTeX, the following paragraphs should all be first-line indented:</p> </div> </div> <div class="section" id="substitution-definitions"> -<h2><a class="toc-backref" href="#id54" name="substitution-definitions">2.15   Substitution Definitions</a></h2> +<h2><a class="toc-backref" href="#id53" name="substitution-definitions">2.15   Substitution Definitions</a></h2> <p>An inline image (<img alt="EXAMPLE" src="../../../docs/user/rst/images/biohazard.png" />) example:</p> <p>(Substitution definitions are not visible in the HTML source.)</p> </div> <div class="section" id="comments"> -<h2><a class="toc-backref" href="#id55" name="comments">2.16   Comments</a></h2> +<h2><a class="toc-backref" href="#id54" name="comments">2.16   Comments</a></h2> <p>Here's one:</p> <!-- Comments begin with two dots and a space. Anything may follow, except for the syntax of footnotes, hyperlink @@ -628,57 +681,8 @@ targets, directives, or substitution definitions. Double-dashes - - "- -" - - must be escaped somehow in HTML output. --> <p>(View the HTML source to see the comment.)</p> </div> -<div class="section" id="id19"> -<h2><a class="toc-backref" href="#id56" name="id19">2.17   Line Blocks</a></h2> -<div class="line-block"> -<div class="line">This is a line block. It ends with a blank line.</div> -<div class="line-block"> -<div class="line">New lines begin with a vertical bar ("|").</div> -<div class="line">Line breaks and initial indent are significant, and preserved.</div> -</div> -<div class="line">Continuation lines are also possible. A long line that is intended -to wrap should begin with a space in place of the vertical bar.</div> -<div class="line-block"> -<div class="line">The left edge of a continuation line need not be aligned with -the left edge of the text above it.</div> -</div> -</div> -<div class="line-block"> -<div class="line">This is a second line block.</div> -<div class="line"><br /></div> -<div class="line">Blank lines are permitted internally, but they must begin with a "|".</div> -</div> -<p>Take it away, Eric the Orchestra Leader!</p> -<blockquote> -<div class="line-block"> -<div class="line">A one, two, a one two three four</div> -<div class="line"><br /></div> -<div class="line">Half a bee, philosophically,</div> -<div class="line-block"> -<div class="line">must, <em>ipso facto</em>, half not be.</div> -</div> -<div class="line">But half the bee has got to be,</div> -<div class="line-block"> -<div class="line"><em>vis a vis</em> its entity. D'you see?</div> -<div class="line"><br /></div> -</div> -<div class="line">But can a bee be said to be</div> -<div class="line-block"> -<div class="line">or not to be an entire bee,</div> -<div class="line-block"> -<div class="line">when half the bee is not a bee,</div> -<div class="line-block"> -<div class="line">due to some ancient injury?</div> -<div class="line"><br /></div> -</div> -</div> -</div> -<div class="line">Singing...</div> -</div> -</blockquote> -</div> <div class="section" id="colspanning-tables"> -<h2><a class="toc-backref" href="#id57" name="colspanning-tables">2.18   Colspanning tables</a></h2> +<h2><a class="toc-backref" href="#id55" name="colspanning-tables">2.17   Colspanning tables</a></h2> <p>This table has a cell spanning two columns:</p> <table border="1" class="table"> <colgroup> @@ -716,7 +720,7 @@ the left edge of the text above it.</div> </table> </div> <div class="section" id="rowspanning-tables"> -<h2><a class="toc-backref" href="#id58" name="rowspanning-tables">2.19   Rowspanning tables</a></h2> +<h2><a class="toc-backref" href="#id56" name="rowspanning-tables">2.18   Rowspanning tables</a></h2> <p>Here's a table with cells spanning several rows:</p> <table border="1" class="table"> <colgroup> @@ -752,7 +756,7 @@ span rows.</td> </table> </div> <div class="section" id="complex-tables"> -<h2><a class="toc-backref" href="#id59" name="complex-tables">2.20   Complex tables</a></h2> +<h2><a class="toc-backref" href="#id57" name="complex-tables">2.19   Complex tables</a></h2> <p>Here's a complex table, which should test all features.</p> <table border="1" class="table"> <colgroup> @@ -802,7 +806,7 @@ empty: <tt class="literal"><span class="pre">--></span></tt></td> </div> </div> <div class="section" id="error-handling"> -<h1><a class="toc-backref" href="#id60" name="error-handling">3   Error Handling</a></h1> +<h1><a class="toc-backref" href="#id58" name="error-handling">3   Error Handling</a></h1> <p>Any errors caught during processing will generate system messages.</p> <p>There should be five messages in the following, auto-generated section, "Docutils System Messages":</p> @@ -810,20 +814,20 @@ section, "Docutils System Messages":</p> </div> <div class="system-messages section"> <h1><a>Docutils System Messages</a></h1> -<div class="system-message" id="id20"> -<p class="system-message-title">System Message: <a name="id20">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 89); <em><a href="#id21">backlink</a></em></p> +<div class="system-message" id="id19"> +<p class="system-message-title">System Message: <a name="id19">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 89); <em><a href="#id20">backlink</a></em></p> Undefined substitution referenced: "problematic".</div> -<div class="system-message" id="id68"> -<p class="system-message-title">System Message: <a name="id68">ERROR/3</a> (<tt>functional/input/standalone_rst_html4css1.txt</tt>, line 299); <em><a href="#id69">backlink</a></em></p> +<div class="system-message" id="id66"> +<p class="system-message-title">System Message: <a name="id66">ERROR/3</a> (<tt>functional/input/standalone_rst_html4css1.txt</tt>, line 335); <em><a href="#id67">backlink</a></em></p> Unknown target name: "5".</div> -<div class="system-message" id="id70"> -<p class="system-message-title">System Message: <a name="id70">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 308); <em><a href="#id71">backlink</a></em></p> +<div class="system-message" id="id68"> +<p class="system-message-title">System Message: <a name="id68">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 344); <em><a href="#id69">backlink</a></em></p> Unknown target name: "nonexistent".</div> -<div class="system-message" id="id72"> -<p class="system-message-title">System Message: <a name="id72">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 333); <em><a href="#id73">backlink</a></em></p> +<div class="system-message" id="id70"> +<p class="system-message-title">System Message: <a name="id70">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 369); <em><a href="#id71">backlink</a></em></p> Unknown target name: "hyperlink reference without a target".</div> -<div class="system-message" id="id74"> -<p class="system-message-title">System Message: <a name="id74">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 346); <em><a href="#id75">backlink</a></em></p> +<div class="system-message" id="id72"> +<p class="system-message-title">System Message: <a name="id72">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 382); <em><a href="#id73">backlink</a></em></p> Duplicate target name, cannot be used as a unique reference: "duplicate target names".</div> </div> </div> diff --git a/test/functional/expected/standalone_rst_latex.tex b/test/functional/expected/standalone_rst_latex.tex index e003983d3..26ff6957b 100644 --- a/test/functional/expected/standalone_rst_latex.tex +++ b/test/functional/expected/standalone_rst_latex.tex @@ -30,6 +30,14 @@ \addtolength{\leftmargin}{\labelsep} \renewcommand{\makelabel}{\optionlistlabel}} }{\end{list}} +\newenvironment{lineblock} +{\begin{list}{} + {\setlength{\partopsep}{\parskip} + \addtolength{\partopsep}{\baselineskip} + \topsep0pt\itemsep0.15\baselineskip\parsep0pt + \leftmargin2em} + \raggedright} +{\end{list}} % begin: floats for footnotes tweaking. \setlength{\floatsep}{0.5em} \setlength{\textfloatsep}{\fill} @@ -572,8 +580,75 @@ Or they can be quoted without indentation: \pdfbookmark[1]{2.8~~~Line Blocks}{line-blocks} \subsection*{2.8~~~Line Blocks} -(To be inserted from line{\_}blocks.txt once the LaTeX writer has -implemented it.) +This section tests line blocks. Line blocks are body elements which +consist of lines and other line blocks. Nested line blocks cause +indentation. + +\begin{lineblock} +\item[] This is a line block. It ends with a blank line. +\item[] +\begin{lineblock} +\item[] New lines begin with a vertical bar (``{\textbar}''). +\item[] Line breaks and initial indent are significant, and preserved. +\item[] +\begin{lineblock} +\item[] Continuation lines are also possible. A long line that is intended +to wrap should begin with a space in place of the vertical bar. +\end{lineblock} +\item[] The left edge of a continuation line need not be aligned with +the left edge of the text above it. +\end{lineblock} +\end{lineblock} + +\begin{lineblock} +\item[] This is a second line block. +\item[] +\item[] Blank lines are permitted internally, but they must begin with a ``{\textbar}''. +\end{lineblock} + +Another line block, surrounded by paragraphs: + +\begin{lineblock} +\item[] And it's no good waiting by the window +\item[] It's no good waiting for the sun +\item[] Please believe me, the things you dream of +\item[] They don't fall in the lap of no-one +\end{lineblock} + +Take it away, Eric the Orchestra Leader! +\begin{quote} + +\begin{lineblock} +\item[] A one, two, a one two three four +\item[] +\item[] Half a bee, philosophically, +\item[] +\begin{lineblock} +\item[] must, \emph{ipso facto}, half not be. +\end{lineblock} +\item[] But half the bee has got to be, +\item[] +\begin{lineblock} +\item[] \emph{vis a vis} its entity. D'you see? +\item[] +\end{lineblock} +\item[] But can a bee be said to be +\item[] +\begin{lineblock} +\item[] or not to be an entire bee, +\item[] +\begin{lineblock} +\item[] when half the bee is not a bee, +\item[] +\begin{lineblock} +\item[] due to some ancient injury? +\item[] +\end{lineblock} +\end{lineblock} +\end{lineblock} +\item[] Singing... +\end{lineblock} +\end{quote} %___________________________________________________________________________ diff --git a/test/functional/input/data/line_blocks.txt b/test/functional/input/data/line_blocks.txt deleted file mode 100644 index 092403eda..000000000 --- a/test/functional/input/data/line_blocks.txt +++ /dev/null @@ -1,30 +0,0 @@ -Line Blocks ------------ - -| This is a line block. It ends with a blank line. -| New lines begin with a vertical bar ("|"). -| Line breaks and initial indent are significant, and preserved. -| Continuation lines are also possible. A long line that is intended - to wrap should begin with a space in place of the vertical bar. -| The left edge of a continuation line need not be aligned with - the left edge of the text above it. - -| This is a second line block. -| -| Blank lines are permitted internally, but they must begin with a "|". - -Take it away, Eric the Orchestra Leader! - - | A one, two, a one two three four - | - | Half a bee, philosophically, - | must, *ipso facto*, half not be. - | But half the bee has got to be, - | *vis a vis* its entity. D'you see? - | - | But can a bee be said to be - | or not to be an entire bee, - | when half the bee is not a bee, - | due to some ancient injury? - | - | Singing... diff --git a/test/functional/input/data/standard.txt b/test/functional/input/data/standard.txt index e182a9d91..520d84312 100644 --- a/test/functional/input/data/standard.txt +++ b/test/functional/input/data/standard.txt @@ -244,8 +244,44 @@ Or they can be quoted without indentation:: Line Blocks ----------- -(To be inserted from line_blocks.txt once the LaTeX writer has -implemented it.) +This section tests line blocks. Line blocks are body elements which +consist of lines and other line blocks. Nested line blocks cause +indentation. + +| This is a line block. It ends with a blank line. +| New lines begin with a vertical bar ("|"). +| Line breaks and initial indent are significant, and preserved. +| Continuation lines are also possible. A long line that is intended + to wrap should begin with a space in place of the vertical bar. +| The left edge of a continuation line need not be aligned with + the left edge of the text above it. + +| This is a second line block. +| +| Blank lines are permitted internally, but they must begin with a "|". + +Another line block, surrounded by paragraphs: + +| And it's no good waiting by the window +| It's no good waiting for the sun +| Please believe me, the things you dream of +| They don't fall in the lap of no-one + +Take it away, Eric the Orchestra Leader! + + | A one, two, a one two three four + | + | Half a bee, philosophically, + | must, *ipso facto*, half not be. + | But half the bee has got to be, + | *vis a vis* its entity. D'you see? + | + | But can a bee be said to be + | or not to be an entire bee, + | when half the bee is not a bee, + | due to some ancient injury? + | + | Singing... Block Quotes ------------ diff --git a/test/functional/input/standalone_rst_html4css1.txt b/test/functional/input/standalone_rst_html4css1.txt index b0a5eec04..68f9de864 100644 --- a/test/functional/input/standalone_rst_html4css1.txt +++ b/test/functional/input/standalone_rst_html4css1.txt @@ -1,5 +1,4 @@ .. include:: data/standard.txt -.. include:: data/line_blocks.txt .. include:: data/table_colspan.txt .. include:: data/table_rowspan.txt .. include:: data/table_complex.txt -- cgit v1.2.1 From 22448f740617422662cb43a9025609f108559ce9 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Wed, 20 Oct 2004 19:41:45 +0000 Subject: made outermost line block unindented for LaTeX writer git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2747 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_latex.tex | 26 +++++++++++------------ test/test_writers/test_latex2e.py | 4 ++-- 2 files changed, 15 insertions(+), 15 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_latex.tex b/test/functional/expected/standalone_rst_latex.tex index 26ff6957b..326aecd7b 100644 --- a/test/functional/expected/standalone_rst_latex.tex +++ b/test/functional/expected/standalone_rst_latex.tex @@ -30,12 +30,12 @@ \addtolength{\leftmargin}{\labelsep} \renewcommand{\makelabel}{\optionlistlabel}} }{\end{list}} -\newenvironment{lineblock} +\newenvironment{lineblock}[1] {\begin{list}{} {\setlength{\partopsep}{\parskip} \addtolength{\partopsep}{\baselineskip} \topsep0pt\itemsep0.15\baselineskip\parsep0pt - \leftmargin2em} + \leftmargin#1} \raggedright} {\end{list}} % begin: floats for footnotes tweaking. @@ -584,14 +584,14 @@ This section tests line blocks. Line blocks are body elements which consist of lines and other line blocks. Nested line blocks cause indentation. -\begin{lineblock} +\begin{lineblock}{0em} \item[] This is a line block. It ends with a blank line. \item[] -\begin{lineblock} +\begin{lineblock}{1.5em} \item[] New lines begin with a vertical bar (``{\textbar}''). \item[] Line breaks and initial indent are significant, and preserved. \item[] -\begin{lineblock} +\begin{lineblock}{1.5em} \item[] Continuation lines are also possible. A long line that is intended to wrap should begin with a space in place of the vertical bar. \end{lineblock} @@ -600,7 +600,7 @@ the left edge of the text above it. \end{lineblock} \end{lineblock} -\begin{lineblock} +\begin{lineblock}{0em} \item[] This is a second line block. \item[] \item[] Blank lines are permitted internally, but they must begin with a ``{\textbar}''. @@ -608,7 +608,7 @@ the left edge of the text above it. Another line block, surrounded by paragraphs: -\begin{lineblock} +\begin{lineblock}{0em} \item[] And it's no good waiting by the window \item[] It's no good waiting for the sun \item[] Please believe me, the things you dream of @@ -618,29 +618,29 @@ Another line block, surrounded by paragraphs: Take it away, Eric the Orchestra Leader! \begin{quote} -\begin{lineblock} +\begin{lineblock}{0em} \item[] A one, two, a one two three four \item[] \item[] Half a bee, philosophically, \item[] -\begin{lineblock} +\begin{lineblock}{1.5em} \item[] must, \emph{ipso facto}, half not be. \end{lineblock} \item[] But half the bee has got to be, \item[] -\begin{lineblock} +\begin{lineblock}{1.5em} \item[] \emph{vis a vis} its entity. D'you see? \item[] \end{lineblock} \item[] But can a bee be said to be \item[] -\begin{lineblock} +\begin{lineblock}{1.5em} \item[] or not to be an entire bee, \item[] -\begin{lineblock} +\begin{lineblock}{1.5em} \item[] when half the bee is not a bee, \item[] -\begin{lineblock} +\begin{lineblock}{1.5em} \item[] due to some ancient injury? \item[] \end{lineblock} diff --git a/test/test_writers/test_latex2e.py b/test/test_writers/test_latex2e.py index 3b0270477..90b9d5845 100644 --- a/test/test_writers/test_latex2e.py +++ b/test/test_writers/test_latex2e.py @@ -51,12 +51,12 @@ latex_head = """\ \\addtolength{\\leftmargin}{\\labelsep} \\renewcommand{\\makelabel}{\\optionlistlabel}} }{\\end{list}} -\\newenvironment{lineblock} +\\newenvironment{lineblock}[1] {\\begin{list}{} {\\setlength{\\partopsep}{\\parskip} \\addtolength{\\partopsep}{\\baselineskip} \\topsep0pt\\itemsep0.15\\baselineskip\\parsep0pt - \\leftmargin2em} + \\leftmargin#1} \\raggedright} {\\end{list}} % begin: floats for footnotes tweaking. -- cgit v1.2.1 From 25f02bab6e61674afc8b21ac6dca450257ad8fbf Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Wed, 20 Oct 2004 20:46:16 +0000 Subject: made line block indentation parametrizable; changed to 2.5em to avoid visual confusion with paragraph first-line indentation git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2748 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_latex.tex | 16 +++++++++------- test/test_writers/test_latex2e.py | 2 ++ 2 files changed, 11 insertions(+), 7 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_latex.tex b/test/functional/expected/standalone_rst_latex.tex index 326aecd7b..ae89f5c56 100644 --- a/test/functional/expected/standalone_rst_latex.tex +++ b/test/functional/expected/standalone_rst_latex.tex @@ -30,6 +30,8 @@ \addtolength{\leftmargin}{\labelsep} \renewcommand{\makelabel}{\optionlistlabel}} }{\end{list}} +\newlength{\lineblockindentation} +\setlength{\lineblockindentation}{2.5em} \newenvironment{lineblock}[1] {\begin{list}{} {\setlength{\partopsep}{\parskip} @@ -587,11 +589,11 @@ indentation. \begin{lineblock}{0em} \item[] This is a line block. It ends with a blank line. \item[] -\begin{lineblock}{1.5em} +\begin{lineblock}{\lineblockindentation} \item[] New lines begin with a vertical bar (``{\textbar}''). \item[] Line breaks and initial indent are significant, and preserved. \item[] -\begin{lineblock}{1.5em} +\begin{lineblock}{\lineblockindentation} \item[] Continuation lines are also possible. A long line that is intended to wrap should begin with a space in place of the vertical bar. \end{lineblock} @@ -623,24 +625,24 @@ Take it away, Eric the Orchestra Leader! \item[] \item[] Half a bee, philosophically, \item[] -\begin{lineblock}{1.5em} +\begin{lineblock}{\lineblockindentation} \item[] must, \emph{ipso facto}, half not be. \end{lineblock} \item[] But half the bee has got to be, \item[] -\begin{lineblock}{1.5em} +\begin{lineblock}{\lineblockindentation} \item[] \emph{vis a vis} its entity. D'you see? \item[] \end{lineblock} \item[] But can a bee be said to be \item[] -\begin{lineblock}{1.5em} +\begin{lineblock}{\lineblockindentation} \item[] or not to be an entire bee, \item[] -\begin{lineblock}{1.5em} +\begin{lineblock}{\lineblockindentation} \item[] when half the bee is not a bee, \item[] -\begin{lineblock}{1.5em} +\begin{lineblock}{\lineblockindentation} \item[] due to some ancient injury? \item[] \end{lineblock} diff --git a/test/test_writers/test_latex2e.py b/test/test_writers/test_latex2e.py index 90b9d5845..2cc01b1f5 100644 --- a/test/test_writers/test_latex2e.py +++ b/test/test_writers/test_latex2e.py @@ -51,6 +51,8 @@ latex_head = """\ \\addtolength{\\leftmargin}{\\labelsep} \\renewcommand{\\makelabel}{\\optionlistlabel}} }{\\end{list}} +\\newlength{\\lineblockindentation} +\\setlength{\\lineblockindentation}{2.5em} \\newenvironment{lineblock}[1] {\\begin{list}{} {\\setlength{\\partopsep}{\\parskip} -- cgit v1.2.1 From 1f3e15ca9297a994be3113e08144d41178623f34 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Thu, 21 Oct 2004 01:27:56 +0000 Subject: moved first/last class-setting logic to method; <p> tags aren't stripped in compound nodes anymore git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2750 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_html4css1.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index 5360548fa..13172ada9 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -646,7 +646,8 @@ Compound 2, literal. <p>Compound 2, this is a test.</p> </div> <div class="compound"> -Compound 3, only consisting of one paragraph.</div> +<p>Compound 3, only consisting of one paragraph.</p> +</div> <div class="compound"> <pre class="literal-block"> Compound 4. -- cgit v1.2.1 From 3d05eaa6ec0678f844f7638f5b018737dc67d757 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Thu, 21 Oct 2004 02:17:23 +0000 Subject: reduced vertical space in compound blocks in HTML by adding compound-{first,middle,last} classes git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2751 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../expected/standalone_rst_html4css1.html | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index 13172ada9..ddf416889 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -630,40 +630,40 @@ background color.</p> <div class="section" id="compound-paragraph"> <h3><a class="toc-backref" href="#id65" name="compound-paragraph">2.14.7   Compound Paragraph</a></h3> <div class="some-class compound"> -<p>Compound 1, paragraph 1.</p> -<p>Compound 1, paragraph 2.</p> -<ul class="simple"> +<p class="compound-first">Compound 1, paragraph 1.</p> +<p class="compound-middle">Compound 1, paragraph 2.</p> +<ul class="compound-last simple"> <li>Compound 1, list item one.</li> <li>Compound 1, list item two.</li> </ul> </div> <p>Another compound statement:</p> <div class="compound"> -<p>Compound 2, a literal block:</p> -<pre class="literal-block"> +<p class="compound-first">Compound 2, a literal block:</p> +<pre class="compound-middle literal-block"> Compound 2, literal. </pre> -<p>Compound 2, this is a test.</p> +<p class="compound-last">Compound 2, this is a test.</p> </div> <div class="compound"> <p>Compound 3, only consisting of one paragraph.</p> </div> <div class="compound"> -<pre class="literal-block"> +<pre class="compound-first literal-block"> Compound 4. This one starts with a literal block. </pre> -<p>Compound 4, a paragraph.</p> +<p class="compound-last">Compound 4, a paragraph.</p> </div> <p>Now something <em>really</em> perverted -- a nested compound block. In LaTeX, the following paragraphs should all be first-line indented:</p> <div class="compound"> -<p>Compound 5, block 1 (a paragraph).</p> -<div class="compound"> -<p>Compound 6, block 2 in compound 5.</p> -<p>Compound 6, another paragraph.</p> +<p class="compound-first">Compound 5, block 1 (a paragraph).</p> +<div class="compound-middle compound"> +<p class="compound-first">Compound 6, block 2 in compound 5.</p> +<p class="compound-last">Compound 6, another paragraph.</p> </div> -<p>Compound 5, block 3 (a paragraph).</p> +<p class="compound-last">Compound 5, block 3 (a paragraph).</p> </div> </div> </div> -- cgit v1.2.1 From be39c74a67d6f83634355c2048325a0d5eb4f382 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Thu, 21 Oct 2004 02:22:45 +0000 Subject: added another functional test for the compound directive git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2752 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../expected/standalone_rst_html4css1.html | 28 ++++++++++++++++++++++ test/functional/expected/standalone_rst_latex.tex | 28 ++++++++++++++++++++++ test/functional/input/data/standard.txt | 16 +++++++++++++ 3 files changed, 72 insertions(+) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index ddf416889..ad6113d2c 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -665,6 +665,34 @@ LaTeX, the following paragraphs should all be first-line indented:</p> </div> <p class="compound-last">Compound 5, block 3 (a paragraph).</p> </div> +<div class="compound"> +<p class="compound-first">Compound 7, with a table inside:</p> +<table border="1" class="compound-middle table"> +<colgroup> +<col width="33%" /> +<col width="33%" /> +<col width="33%" /> +</colgroup> +<tbody valign="top"> +<tr><td><p class="first">Left cell, first +paragraph.</p> +<p class="last">Left cell, second +paragraph.</p> +</td> +<td>Middle cell, +consisting of +exactly one +paragraph.</td> +<td><p class="first">Right cell.</p> +<p>Paragraph 2.</p> +<p class="last">Paragraph 3.</p> +</td> +</tr> +</tbody> +</table> +<p class="compound-middle">Compound 7, a paragraph after the table.</p> +<p class="compound-last">Compound 7, another paragraph.</p> +</div> </div> </div> <div class="section" id="substitution-definitions"> diff --git a/test/functional/expected/standalone_rst_latex.tex b/test/functional/expected/standalone_rst_latex.tex index ae89f5c56..8ce529c9d 100644 --- a/test/functional/expected/standalone_rst_latex.tex +++ b/test/functional/expected/standalone_rst_latex.tex @@ -1068,6 +1068,34 @@ Compound 6, another paragraph. Compound 5, block 3 (a paragraph). +Compound 7, with a table inside: + +\begin{longtable}[c]{|p{0.25\locallinewidth}|p{0.25\locallinewidth}|p{0.25\locallinewidth}|} +\hline + +Left cell, first +paragraph. + +Left cell, second +paragraph. + & +Middle cell, +consisting of +exactly one +paragraph. + & +Right cell. + +Paragraph 2. + +Paragraph 3. + \\ +\hline +\end{longtable} +Compound 7, a paragraph after the table. + +Compound 7, another paragraph. + %___________________________________________________________________________ diff --git a/test/functional/input/data/standard.txt b/test/functional/input/data/standard.txt index 520d84312..b07b2f338 100644 --- a/test/functional/input/data/standard.txt +++ b/test/functional/input/data/standard.txt @@ -538,6 +538,22 @@ LaTeX, the following paragraphs should all be first-line indented: Compound 5, block 3 (a paragraph). +.. compound:: + + Compound 7, with a table inside: + + +--------------------+--------------------+--------------------+ + | Left cell, first | Middle cell, | Right cell. | + | paragraph. | consisting of | | + | | exactly one | Paragraph 2. | + | Left cell, second | paragraph. | | + | paragraph. | | Paragraph 3. | + +--------------------+--------------------+--------------------+ + + Compound 7, a paragraph after the table. + + Compound 7, another paragraph. + Substitution Definitions ------------------------ -- cgit v1.2.1 From d2995e5fff30d16439cae71a4f6aa3d173a92b7b Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Fri, 22 Oct 2004 01:51:28 +0000 Subject: fixed unwanted interaction of "class" directive and enumerated lists (start != 1) git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2761 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../test_parsers/test_rst/test_enumerated_lists.py | 28 +++++++++++----------- test/test_transforms/test_class.py | 19 +++++++++++++++ 2 files changed, 33 insertions(+), 14 deletions(-) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_enumerated_lists.py b/test/test_parsers/test_rst/test_enumerated_lists.py index b89691516..c79cba826 100755 --- a/test/test_parsers/test_rst/test_enumerated_lists.py +++ b/test/test_parsers/test_rst/test_enumerated_lists.py @@ -89,20 +89,20 @@ Scrambled: <document source="test data"> <paragraph> Scrambled: - <system_message level="1" line="3" source="test data" type="INFO"> - <paragraph> - Enumerated list start value not ordinal-1: "3" (ordinal 3) <enumerated_list enumtype="arabic" prefix="" start="3" suffix="."> <list_item> <paragraph> Item three. - <system_message level="1" line="5" source="test data" type="INFO"> + <system_message level="1" line="3" source="test data" type="INFO"> <paragraph> - Enumerated list start value not ordinal-1: "2" (ordinal 2) + Enumerated list start value not ordinal-1: "3" (ordinal 3) <enumerated_list enumtype="arabic" prefix="" start="2" suffix="."> <list_item> <paragraph> Item two. + <system_message level="1" line="5" source="test data" type="INFO"> + <paragraph> + Enumerated list start value not ordinal-1: "2" (ordinal 2) <enumerated_list enumtype="arabic" prefix="" suffix="."> <list_item> <paragraph> @@ -151,9 +151,6 @@ And again: <document source="test data"> <paragraph> Start with non-ordinal-1: - <system_message level="1" line="3" source="test data" type="INFO"> - <paragraph> - Enumerated list start value not ordinal-1: "0" (ordinal 0) <enumerated_list enumtype="arabic" prefix="" start="0" suffix="."> <list_item> <paragraph> @@ -167,11 +164,11 @@ And again: <list_item> <paragraph> Item three. + <system_message level="1" line="3" source="test data" type="INFO"> + <paragraph> + Enumerated list start value not ordinal-1: "0" (ordinal 0) <paragraph> And again: - <system_message level="1" line="10" source="test data" type="INFO"> - <paragraph> - Enumerated list start value not ordinal-1: "2" (ordinal 2) <enumerated_list enumtype="arabic" prefix="" start="2" suffix="."> <list_item> <paragraph> @@ -179,6 +176,9 @@ And again: <list_item> <paragraph> Item three. + <system_message level="1" line="10" source="test data" type="INFO"> + <paragraph> + Enumerated list start value not ordinal-1: "2" (ordinal 2) """], ["""\ 1. Item one: line 1, @@ -702,13 +702,13 @@ Princeton, NJ. <system_message level="2" line="5" source="test data" type="WARNING"> <paragraph> Block quote ends without a blank line; unexpected unindent. - <system_message level="1" line="5" source="test data" type="INFO"> - <paragraph> - Enumerated list start value not ordinal-1: "3" (ordinal 3) <enumerated_list enumtype="arabic" prefix="" start="3" suffix="."> <list_item> <paragraph> Item three: paragraph 1, line 1, + <system_message level="1" line="5" source="test data" type="INFO"> + <paragraph> + Enumerated list start value not ordinal-1: "3" (ordinal 3) <system_message level="2" line="6" source="test data" type="WARNING"> <paragraph> Enumerated list ends without a blank line; unexpected unindent. diff --git a/test/test_transforms/test_class.py b/test/test_transforms/test_class.py index 119445d91..c4de0cfac 100755 --- a/test/test_transforms/test_class.py +++ b/test/test_transforms/test_class.py @@ -107,6 +107,25 @@ multiple class values may be assigned to one element <paragraph class="one two"> multiple class values may be assigned to one element """], +["""\ +.. class:: fancy + +2. List starts at 2. +3. Class should apply to list, not to system message. +""", +"""\ +<document source="test data"> + <enumerated_list class="fancy" enumtype="arabic" prefix="" start="2" suffix="."> + <list_item> + <paragraph> + List starts at 2. + <list_item> + <paragraph> + Class should apply to list, not to system message. + <system_message level="1" line="3" source="test data" type="INFO"> + <paragraph> + Enumerated list start value not ordinal-1: "2" (ordinal 2) +"""], ]) -- cgit v1.2.1 From 598365ca8c5c1569a6ee7aeb17f03bae6d452ab2 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sun, 24 Oct 2004 00:25:51 +0000 Subject: minor output formatting improvement for failed tests git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2765 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/DocutilsTestSupport.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/DocutilsTestSupport.py b/test/DocutilsTestSupport.py index 6bed804e2..e920a768c 100644 --- a/test/DocutilsTestSupport.py +++ b/test/DocutilsTestSupport.py @@ -807,7 +807,7 @@ def _format_str(*args): assert r[0] == r[-1] r = r[1:-1] r = (stripped + 3 * quote_char + '\\\n' + - re.sub(r'(?<=[^\\])((\\\\)*)\\n', r'\1\n', r) + + re.sub(r'(?<!\\)((\\\\)*)\\n', r'\1\n', r) + 3 * quote_char) r = re.sub(r' \n', r' \\n\\\n', r) return_tuple.append(r) -- cgit v1.2.1 From ce2af9ea62a9d6f839c36650b34648ea55e17d9c Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sun, 24 Oct 2004 15:21:31 +0000 Subject: added test for changed applying behavior of class directive git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2767 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms/test_class.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'test') diff --git a/test/test_transforms/test_class.py b/test/test_transforms/test_class.py index c4de0cfac..41f918d82 100755 --- a/test/test_transforms/test_class.py +++ b/test/test_transforms/test_class.py @@ -126,6 +126,29 @@ multiple class values may be assigned to one element <paragraph> Enumerated list start value not ordinal-1: "2" (ordinal 2) """], +["""\ +2. List starts at 2. +3. Class should apply to next paragraph, not to system message. + + .. class:: fancy + +A paragraph. +""", +"""\ +<document source="test data"> + <enumerated_list enumtype="arabic" prefix="" start="2" suffix="."> + <list_item> + <paragraph> + List starts at 2. + <list_item> + <paragraph> + Class should apply to next paragraph, not to system message. + <system_message level="1" line="1" source="test data" type="INFO"> + <paragraph> + Enumerated list start value not ordinal-1: "2" (ordinal 2) + <paragraph class="fancy"> + A paragraph. +"""], ]) -- cgit v1.2.1 From 98ef57555daaa930508500c3ab28292ed232e9bd Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sat, 30 Oct 2004 13:57:06 +0000 Subject: added TransitionTestCase, which applies transforms git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2773 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/DocutilsTestSupport.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'test') diff --git a/test/DocutilsTestSupport.py b/test/DocutilsTestSupport.py index e920a768c..6bc536965 100644 --- a/test/DocutilsTestSupport.py +++ b/test/DocutilsTestSupport.py @@ -23,6 +23,7 @@ Exports the following: - `TransformTestSuite` - `ParserTestCase` - `ParserTestSuite` + - `TransitionTestCase` - `PEPParserTestCase` - `PEPParserTestSuite` - `GridTableParserTestCase` @@ -426,6 +427,26 @@ class ParserTestSuite(CustomTestSuite): run_in_debugger=run_in_debugger) +class TransitionTestCase(ParserTestCase): + + """ + Transitions-specific test case, testing parser and transforms. + For use with ParserTestSuite. + """ + + def test_parser(self): + if self.run_in_debugger: + pdb.set_trace() + document = utils.new_document('test data', self.settings) + # Remove any additions made by "role" directives: + roles._roles = {} + self.parser.parse(self.input, document) + document.transformer.apply_transforms() + output = document.pformat() + self.compare_output(self.input, output, self.expected) + + + class PEPParserTestCase(ParserTestCase): """PEP-specific parser test case.""" -- cgit v1.2.1 From 5cba021ca97842da2e8f5bd405c8d8425b000c9e Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sat, 30 Oct 2004 14:00:20 +0000 Subject: use TransitionTestCase; updated existing tests to match new error reporting behavior; added new tests to test moving of transitions git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2774 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_parsers/test_rst/test_transitions.py | 174 +++++++++++++++++++++++-- 1 file changed, 162 insertions(+), 12 deletions(-) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_transitions.py b/test/test_parsers/test_rst/test_transitions.py index 3e8a63e91..2da7b0021 100755 --- a/test/test_parsers/test_rst/test_transitions.py +++ b/test/test_parsers/test_rst/test_transitions.py @@ -14,6 +14,7 @@ from __init__ import DocutilsTestSupport def suite(): s = DocutilsTestSupport.ParserTestSuite() + s.test_case_class = DocutilsTestSupport.TransitionTestCase s.generateTests(totest) return s @@ -99,11 +100,11 @@ may not end with a transition. <transition> <system_message level="3" line="10" source="test data" type="ERROR"> <paragraph> - At least one body element must separate transitions; adjacent transitions not allowed. + At least one body element must separate transitions; adjacent transitions are not allowed. <transition> <system_message level="3" line="12" source="test data" type="ERROR"> <paragraph> - At least one body element must separate transitions; adjacent transitions not allowed. + At least one body element must separate transitions; adjacent transitions are not allowed. <transition> <paragraph> The DTD also specifies that a section or document @@ -111,7 +112,7 @@ may not end with a transition. <transition> <system_message level="3" line="17" source="test data" type="ERROR"> <paragraph> - Document or section may not end with a transition. + Document may not end with a transition. """], ["""\ Test unexpected transition markers. @@ -161,7 +162,7 @@ Section 1 ---------- -Illegal transitions. +The next transition is legal: ---------- @@ -179,24 +180,62 @@ Section 2 Section 1 <system_message level="3" line="6" source="test data" type="ERROR"> <paragraph> - Section may not begin with a transition. + Document or section may not begin with a transition. <transition> <paragraph> - Illegal transitions. - <transition> - <system_message level="3" line="10" source="test data" type="ERROR"> - <paragraph> - Section may not end with a transition. + The next transition is legal: + <transition> <section id="section-2" name="section 2"> <title> Section 2 <system_message level="3" line="15" source="test data" type="ERROR"> <paragraph> - Section may not begin with a transition. + Document or section may not begin with a transition. <transition> <system_message level="3" line="15" source="test data" type="ERROR"> <paragraph> - Document or section may not end with a transition. + Document may not end with a transition. +"""], +["""\ +A paragraph and two transitions. + +---------- + +---------- + +""", +"""\ +<document source="test data"> + <paragraph> + A paragraph and two transitions. + <transition> + <system_message level="3" line="5" source="test data" type="ERROR"> + <paragraph> + At least one body element must separate transitions; adjacent transitions are not allowed. + <transition> + <system_message level="3" line="5" source="test data" type="ERROR"> + <paragraph> + Document may not end with a transition. +"""], +["""\ +A paragraph and two transitions. + +---------- + +---------- +""", # the same: +"""\ +<document source="test data"> + <paragraph> + A paragraph and two transitions. + <transition> + <system_message level="3" line="5" source="test data" type="ERROR"> + <paragraph> + At least one body element must separate transitions; adjacent transitions are not allowed. + <transition> + <system_message level="3" line="5" source="test data" type="ERROR"> + <paragraph> + Document may not end with a transition. """], ["""\ ---------- @@ -212,6 +251,117 @@ Document beginning with a transition. <paragraph> Document beginning with a transition. """], +["""\ +Section 1 +========= + +Subsection 1 +------------ + +Some text. + +---------- + +Section 2 +========= + +Some text. +""", +"""\ +<document source="test data"> + <section id="section-1" name="section 1"> + <title> + Section 1 + <section id="subsection-1" name="subsection 1"> + <title> + Subsection 1 + <paragraph> + Some text. + <transition> + <section id="section-2" name="section 2"> + <title> + Section 2 + <paragraph> + Some text. +"""], +["""\ +Section 1 +========= + +---------- + +---------- + +---------- + +Section 2 +========= + +Some text. +""", +"""\ +<document source="test data"> + <section id="section-1" name="section 1"> + <title> + Section 1 + <system_message level="3" line="4" source="test data" type="ERROR"> + <paragraph> + Document or section may not begin with a transition. + <transition> + <system_message level="3" line="6" source="test data" type="ERROR"> + <paragraph> + At least one body element must separate transitions; adjacent transitions are not allowed. + <transition> + <system_message level="3" line="8" source="test data" type="ERROR"> + <paragraph> + At least one body element must separate transitions; adjacent transitions are not allowed. + <transition> + <section id="section-2" name="section 2"> + <title> + Section 2 + <paragraph> + Some text. +"""], +["""\ +---------- + +---------- + +---------- +""", +"""\ +<document source="test data"> + <system_message level="3" line="1" source="test data" type="ERROR"> + <paragraph> + Document or section may not begin with a transition. + <transition> + <system_message level="3" line="3" source="test data" type="ERROR"> + <paragraph> + At least one body element must separate transitions; adjacent transitions are not allowed. + <transition> + <system_message level="3" line="5" source="test data" type="ERROR"> + <paragraph> + At least one body element must separate transitions; adjacent transitions are not allowed. + <transition> + <system_message level="3" line="5" source="test data" type="ERROR"> + <paragraph> + Document may not end with a transition. +"""], +["""\ +A paragraph. + +---------- + +""", +"""\ +<document source="test data"> + <paragraph> + A paragraph. + <transition> + <system_message level="3" line="3" source="test data" type="ERROR"> + <paragraph> + Document may not end with a transition. +"""], ] -- cgit v1.2.1 From 55ca583cf428cf88a1d5fbee181d237cb4970335 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sat, 30 Oct 2004 14:17:02 +0000 Subject: updated test files to match new transition inserting behavior git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2775 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../test_rst/test_directives/test_include.py | 12 ++++----- test/test_parsers/test_rst/test_section_headers.py | 29 ++++++++++++---------- 2 files changed, 22 insertions(+), 19 deletions(-) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_directives/test_include.py b/test/test_parsers/test_rst/test_directives/test_include.py index 84e1e3653..0d285053f 100755 --- a/test/test_parsers/test_rst/test_directives/test_include.py +++ b/test/test_parsers/test_rst/test_directives/test_include.py @@ -185,14 +185,14 @@ A paragraph. <title> Inclusion 1 <paragraph> - This file is used by + This file is used by \n\ <literal> test_include.py . - <transition> - <system_message level="3" line="12" source="test data" type="ERROR"> - <paragraph> - Section may not end with a transition. + <pending> + .. internal attributes: + .transform: docutils.transforms.structural.Transition + .details: <section dupname="inclusion 1" id="id1"> <title> Inclusion 1 @@ -200,7 +200,7 @@ A paragraph. <paragraph> Duplicate implicit target name: "inclusion 1". <paragraph> - This file is used by + This file is used by \n\ <literal> test_include.py . diff --git a/test/test_parsers/test_rst/test_section_headers.py b/test/test_parsers/test_rst/test_section_headers.py index 98fdfcb8f..857565cad 100755 --- a/test/test_parsers/test_rst/test_section_headers.py +++ b/test/test_parsers/test_rst/test_section_headers.py @@ -250,21 +250,24 @@ Test missing titles; blank line in-between. """, """\ <document source="test data"> - <system_message level="3" line="1" source="test data" type="ERROR"> - <paragraph> - Document or section may not begin with a transition. - <transition> - <system_message level="3" line="3" source="test data" type="ERROR"> - <paragraph> - At least one body element must separate transitions; adjacent transitions not allowed. - <transition> + <pending> + .. internal attributes: + .transform: docutils.transforms.structural.Transition + .details: + <pending> + .. internal attributes: + .transform: docutils.transforms.structural.Transition + .details: <paragraph> Test missing titles; blank line in-between. - <transition> - <transition> - <system_message level="3" line="9" source="test data" type="ERROR"> - <paragraph> - Document or section may not end with a transition. + <pending> + .. internal attributes: + .transform: docutils.transforms.structural.Transition + .details: + <pending> + .. internal attributes: + .transform: docutils.transforms.structural.Transition + .details: """], ["""\ ======================== -- cgit v1.2.1 From f5badc85ced6a97b79cc6a6d85887f0f610824b6 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sat, 30 Oct 2004 15:54:45 +0000 Subject: renamed TransitionTestCase to ParserTransformTestCase; also run default transforms git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2779 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/DocutilsTestSupport.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/DocutilsTestSupport.py b/test/DocutilsTestSupport.py index 6bc536965..5a9951da9 100644 --- a/test/DocutilsTestSupport.py +++ b/test/DocutilsTestSupport.py @@ -23,7 +23,7 @@ Exports the following: - `TransformTestSuite` - `ParserTestCase` - `ParserTestSuite` - - `TransitionTestCase` + - `ParserTransformTestCase` - `PEPParserTestCase` - `PEPParserTestSuite` - `GridTableParserTestCase` @@ -427,13 +427,17 @@ class ParserTestSuite(CustomTestSuite): run_in_debugger=run_in_debugger) -class TransitionTestCase(ParserTestCase): +class ParserTransformTestCase(ParserTestCase): """ - Transitions-specific test case, testing parser and transforms. + Like ParserTestCase, except that default transforms are run. + For use with ParserTestSuite. """ - + + # Get settings with report_level == 1 from TransformTestCase + settings = TransformTestCase.settings + def test_parser(self): if self.run_in_debugger: pdb.set_trace() @@ -441,6 +445,7 @@ class TransitionTestCase(ParserTestCase): # Remove any additions made by "role" directives: roles._roles = {} self.parser.parse(self.input, document) + document.transformer.populate_from_components([rst.Parser]) document.transformer.apply_transforms() output = document.pformat() self.compare_output(self.input, output, self.expected) -- cgit v1.2.1 From 57e357cecd09faa06107ca46cf4cd8e082cb0fc3 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sat, 30 Oct 2004 16:01:42 +0000 Subject: use ParserTransformTestCase git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2782 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_parsers/test_rst/test_transitions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_transitions.py b/test/test_parsers/test_rst/test_transitions.py index 2da7b0021..9e7424734 100755 --- a/test/test_parsers/test_rst/test_transitions.py +++ b/test/test_parsers/test_rst/test_transitions.py @@ -14,7 +14,7 @@ from __init__ import DocutilsTestSupport def suite(): s = DocutilsTestSupport.ParserTestSuite() - s.test_case_class = DocutilsTestSupport.TransitionTestCase + s.test_case_class = DocutilsTestSupport.ParserTransformTestCase s.generateTests(totest) return s -- cgit v1.2.1 From f1dcee7884681e0611a929a303e771ff4bf100b3 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sat, 30 Oct 2004 16:02:08 +0000 Subject: updated to expect real transitions instead of pending nodes git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2783 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../test_rst/test_directives/test_include.py | 5 +---- test/test_parsers/test_rst/test_section_headers.py | 20 ++++---------------- 2 files changed, 5 insertions(+), 20 deletions(-) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_directives/test_include.py b/test/test_parsers/test_rst/test_directives/test_include.py index 0d285053f..42bbf39f3 100755 --- a/test/test_parsers/test_rst/test_directives/test_include.py +++ b/test/test_parsers/test_rst/test_directives/test_include.py @@ -189,10 +189,7 @@ A paragraph. <literal> test_include.py . - <pending> - .. internal attributes: - .transform: docutils.transforms.structural.Transition - .details: + <transition> <section dupname="inclusion 1" id="id1"> <title> Inclusion 1 diff --git a/test/test_parsers/test_rst/test_section_headers.py b/test/test_parsers/test_rst/test_section_headers.py index 857565cad..e1119f32a 100755 --- a/test/test_parsers/test_rst/test_section_headers.py +++ b/test/test_parsers/test_rst/test_section_headers.py @@ -250,24 +250,12 @@ Test missing titles; blank line in-between. """, """\ <document source="test data"> - <pending> - .. internal attributes: - .transform: docutils.transforms.structural.Transition - .details: - <pending> - .. internal attributes: - .transform: docutils.transforms.structural.Transition - .details: + <transition> + <transition> <paragraph> Test missing titles; blank line in-between. - <pending> - .. internal attributes: - .transform: docutils.transforms.structural.Transition - .details: - <pending> - .. internal attributes: - .transform: docutils.transforms.structural.Transition - .details: + <transition> + <transition> """], ["""\ ======================== -- cgit v1.2.1 From fe199e4df644621b7c5ceac3987a558af3321cdf Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sun, 31 Oct 2004 21:35:35 +0000 Subject: added test for substitution_definitions and targets before doctitle git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2790 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms/test_doctitle.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'test') diff --git a/test/test_transforms/test_doctitle.py b/test/test_transforms/test_doctitle.py index 3e08eb232..1e6bc1ee0 100755 --- a/test/test_transforms/test_doctitle.py +++ b/test/test_transforms/test_doctitle.py @@ -167,6 +167,27 @@ Paragraph 3. <paragraph> Paragraph 3. """], +["""\ +.. |foo| replace:: bar + +.. _invisible target: + +Title +===== +This title should be the document title despite the +substitution_definition. +""", +"""\ +<document id="title" name="title" source="test data"> + <title> + Title + <substitution_definition name="foo"> + bar + <target id="invisible-target" name="invisible target"> + <paragraph> + This title should be the document title despite the + substitution_definition. +"""], ]) -- cgit v1.2.1 From 04b99fa2349bff7e1f05b18e501b7d12b8d52175 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Mon, 1 Nov 2004 02:58:09 +0000 Subject: removed ParserTransformTestCase (it was mixing testing modes) git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2791 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/DocutilsTestSupport.py | 25 ------------------------- 1 file changed, 25 deletions(-) (limited to 'test') diff --git a/test/DocutilsTestSupport.py b/test/DocutilsTestSupport.py index 5a9951da9..221336336 100644 --- a/test/DocutilsTestSupport.py +++ b/test/DocutilsTestSupport.py @@ -427,31 +427,6 @@ class ParserTestSuite(CustomTestSuite): run_in_debugger=run_in_debugger) -class ParserTransformTestCase(ParserTestCase): - - """ - Like ParserTestCase, except that default transforms are run. - - For use with ParserTestSuite. - """ - - # Get settings with report_level == 1 from TransformTestCase - settings = TransformTestCase.settings - - def test_parser(self): - if self.run_in_debugger: - pdb.set_trace() - document = utils.new_document('test data', self.settings) - # Remove any additions made by "role" directives: - roles._roles = {} - self.parser.parse(self.input, document) - document.transformer.populate_from_components([rst.Parser]) - document.transformer.apply_transforms() - output = document.pformat() - self.compare_output(self.input, output, self.expected) - - - class PEPParserTestCase(ParserTestCase): """PEP-specific parser test case.""" -- cgit v1.2.1 From da34148e49ddac6e53cfcfcd63763d78087ee858 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Mon, 1 Nov 2004 02:58:27 +0000 Subject: added transition tests git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2792 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms/test_final_checks.py | 284 +++++++++++++++++++++++++++++- 1 file changed, 283 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/test_transforms/test_final_checks.py b/test/test_transforms/test_final_checks.py index 36c55efda..220f666db 100755 --- a/test/test_transforms/test_final_checks.py +++ b/test/test_transforms/test_final_checks.py @@ -23,7 +23,7 @@ def suite(): totest = {} -totest['final_checks'] = ((FinalChecks,), [ +totest['references'] = ((FinalChecks,), [ ["""\ Unknown reference_. """, @@ -41,6 +41,288 @@ Unknown reference_. ]) +# See DocutilsTestSupport.ParserTestSuite.generateTests for a +# description of the 'totest' data structure. +totest['transitions'] = ((FinalChecks,), [ +["""\ +Section 1 +========= + +Subsection 1 +------------ + +Some text. + +---------- + +Section 2 +========= + +Some text. +""", +"""\ +<document source="test data"> + <section id="section-1" name="section 1"> + <title> + Section 1 + <section id="subsection-1" name="subsection 1"> + <title> + Subsection 1 + <paragraph> + Some text. + <transition> + <section id="section-2" name="section 2"> + <title> + Section 2 + <paragraph> + Some text. +"""], +["""\ +A paragraph. + +---------- + +Section 1 +========= + +Paragraph. +""", +"""\ +<document source="test data"> + <paragraph> + A paragraph. + <transition> + <section id="section-1" name="section 1"> + <title> + Section 1 + <paragraph> + Paragraph. +"""], +["""\ +-------- + +A section or document may not begin with a transition. + +The DTD specifies that two transitions may not +be adjacent: + +-------- + +-------- + +-------- + +The DTD also specifies that a section or document +may not end with a transition. + +-------- +""", +"""\ +<document source="test data"> + <system_message level="3" line="1" source="test data" type="ERROR"> + <paragraph> + Document or section may not begin with a transition. + <transition> + <paragraph> + A section or document may not begin with a transition. + <paragraph> + The DTD specifies that two transitions may not + be adjacent: + <transition> + <system_message level="3" line="10" source="test data" type="ERROR"> + <paragraph> + At least one body element must separate transitions; adjacent transitions are not allowed. + <transition> + <system_message level="3" line="12" source="test data" type="ERROR"> + <paragraph> + At least one body element must separate transitions; adjacent transitions are not allowed. + <transition> + <paragraph> + The DTD also specifies that a section or document + may not end with a transition. + <transition> + <system_message level="3" line="17" source="test data" type="ERROR"> + <paragraph> + Document may not end with a transition. +"""], +["""\ +Sections with transitions at beginning and end. + +Section 1 +========= + +---------- + +The next transition is legal: + +---------- + +Section 2 +========= + +---------- +""", +"""\ +<document source="test data"> + <paragraph> + Sections with transitions at beginning and end. + <section id="section-1" name="section 1"> + <title> + Section 1 + <system_message level="3" line="6" source="test data" type="ERROR"> + <paragraph> + Document or section may not begin with a transition. + <transition> + <paragraph> + The next transition is legal: + <transition> + <section id="section-2" name="section 2"> + <title> + Section 2 + <system_message level="3" line="15" source="test data" type="ERROR"> + <paragraph> + Document or section may not begin with a transition. + <transition> + <system_message level="3" line="15" source="test data" type="ERROR"> + <paragraph> + Document may not end with a transition. +"""], +["""\ +A paragraph and two transitions. + +---------- + +---------- +""", # the same: +"""\ +<document source="test data"> + <paragraph> + A paragraph and two transitions. + <transition> + <system_message level="3" line="5" source="test data" type="ERROR"> + <paragraph> + At least one body element must separate transitions; adjacent transitions are not allowed. + <transition> + <system_message level="3" line="5" source="test data" type="ERROR"> + <paragraph> + Document may not end with a transition. +"""], +["""\ +A paragraph, two transitions, and a blank line. + +---------- + +---------- + +""", +"""\ +<document source="test data"> + <paragraph> + A paragraph, two transitions, and a blank line. + <transition> + <system_message level="3" line="5" source="test data" type="ERROR"> + <paragraph> + At least one body element must separate transitions; adjacent transitions are not allowed. + <transition> + <system_message level="3" line="5" source="test data" type="ERROR"> + <paragraph> + Document may not end with a transition. +"""], +["""\ +---------- + +Document beginning with a transition. +""", +"""\ +<document source="test data"> + <system_message level="3" line="1" source="test data" type="ERROR"> + <paragraph> + Document or section may not begin with a transition. + <transition> + <paragraph> + Document beginning with a transition. +"""], +["""\ +Section 1 +========= + +---------- + +---------- + +---------- + +Section 2 +========= + +Some text. +""", +"""\ +<document source="test data"> + <section id="section-1" name="section 1"> + <title> + Section 1 + <system_message level="3" line="4" source="test data" type="ERROR"> + <paragraph> + Document or section may not begin with a transition. + <transition> + <system_message level="3" line="6" source="test data" type="ERROR"> + <paragraph> + At least one body element must separate transitions; adjacent transitions are not allowed. + <transition> + <system_message level="3" line="8" source="test data" type="ERROR"> + <paragraph> + At least one body element must separate transitions; adjacent transitions are not allowed. + <transition> + <section id="section-2" name="section 2"> + <title> + Section 2 + <paragraph> + Some text. +"""], +["""\ +---------- + +---------- + +---------- +""", +"""\ +<document source="test data"> + <system_message level="3" line="1" source="test data" type="ERROR"> + <paragraph> + Document or section may not begin with a transition. + <transition> + <system_message level="3" line="3" source="test data" type="ERROR"> + <paragraph> + At least one body element must separate transitions; adjacent transitions are not allowed. + <transition> + <system_message level="3" line="5" source="test data" type="ERROR"> + <paragraph> + At least one body element must separate transitions; adjacent transitions are not allowed. + <transition> + <system_message level="3" line="5" source="test data" type="ERROR"> + <paragraph> + Document may not end with a transition. +"""], +["""\ +A paragraph. + +---------- + +""", +"""\ +<document source="test data"> + <paragraph> + A paragraph. + <transition> + <system_message level="3" line="3" source="test data" type="ERROR"> + <paragraph> + Document may not end with a transition. +"""], +]) + + if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') -- cgit v1.2.1 From 5b1dbdf0f95c619034127b36cec73f094a315a79 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Mon, 1 Nov 2004 02:59:17 +0000 Subject: updated tests for parser only -- no transforms applied git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2793 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_parsers/test_rst/test_transitions.py | 71 ++------------------------ 1 file changed, 5 insertions(+), 66 deletions(-) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_transitions.py b/test/test_parsers/test_rst/test_transitions.py index 9e7424734..a143fd264 100755 --- a/test/test_parsers/test_rst/test_transitions.py +++ b/test/test_parsers/test_rst/test_transitions.py @@ -14,7 +14,6 @@ from __init__ import DocutilsTestSupport def suite(): s = DocutilsTestSupport.ParserTestSuite() - s.test_case_class = DocutilsTestSupport.ParserTransformTestCase s.generateTests(totest) return s @@ -88,9 +87,6 @@ may not end with a transition. """, """\ <document source="test data"> - <system_message level="3" line="1" source="test data" type="ERROR"> - <paragraph> - Document or section may not begin with a transition. <transition> <paragraph> A section or document may not begin with a transition. @@ -98,21 +94,12 @@ may not end with a transition. The DTD specifies that two transitions may not be adjacent: <transition> - <system_message level="3" line="10" source="test data" type="ERROR"> - <paragraph> - At least one body element must separate transitions; adjacent transitions are not allowed. <transition> - <system_message level="3" line="12" source="test data" type="ERROR"> - <paragraph> - At least one body element must separate transitions; adjacent transitions are not allowed. <transition> <paragraph> The DTD also specifies that a section or document may not end with a transition. <transition> - <system_message level="3" line="17" source="test data" type="ERROR"> - <paragraph> - Document may not end with a transition. """], ["""\ Test unexpected transition markers. @@ -178,26 +165,17 @@ Section 2 <section id="section-1" name="section 1"> <title> Section 1 - <system_message level="3" line="6" source="test data" type="ERROR"> - <paragraph> - Document or section may not begin with a transition. <transition> <paragraph> The next transition is legal: - <transition> + <transition> <section id="section-2" name="section 2"> <title> Section 2 - <system_message level="3" line="15" source="test data" type="ERROR"> - <paragraph> - Document or section may not begin with a transition. <transition> - <system_message level="3" line="15" source="test data" type="ERROR"> - <paragraph> - Document may not end with a transition. """], ["""\ -A paragraph and two transitions. +A paragraph, two transitions, and a blank line. ---------- @@ -207,15 +185,9 @@ A paragraph and two transitions. """\ <document source="test data"> <paragraph> - A paragraph and two transitions. + A paragraph, two transitions, and a blank line. <transition> - <system_message level="3" line="5" source="test data" type="ERROR"> - <paragraph> - At least one body element must separate transitions; adjacent transitions are not allowed. <transition> - <system_message level="3" line="5" source="test data" type="ERROR"> - <paragraph> - Document may not end with a transition. """], ["""\ A paragraph and two transitions. @@ -229,13 +201,7 @@ A paragraph and two transitions. <paragraph> A paragraph and two transitions. <transition> - <system_message level="3" line="5" source="test data" type="ERROR"> - <paragraph> - At least one body element must separate transitions; adjacent transitions are not allowed. <transition> - <system_message level="3" line="5" source="test data" type="ERROR"> - <paragraph> - Document may not end with a transition. """], ["""\ ---------- @@ -244,9 +210,6 @@ Document beginning with a transition. """, """\ <document source="test data"> - <system_message level="3" line="1" source="test data" type="ERROR"> - <paragraph> - Document or section may not begin with a transition. <transition> <paragraph> Document beginning with a transition. @@ -277,7 +240,7 @@ Some text. Subsection 1 <paragraph> Some text. - <transition> + <transition> <section id="section-2" name="section 2"> <title> Section 2 @@ -304,18 +267,9 @@ Some text. <section id="section-1" name="section 1"> <title> Section 1 - <system_message level="3" line="4" source="test data" type="ERROR"> - <paragraph> - Document or section may not begin with a transition. <transition> - <system_message level="3" line="6" source="test data" type="ERROR"> - <paragraph> - At least one body element must separate transitions; adjacent transitions are not allowed. <transition> - <system_message level="3" line="8" source="test data" type="ERROR"> - <paragraph> - At least one body element must separate transitions; adjacent transitions are not allowed. - <transition> + <transition> <section id="section-2" name="section 2"> <title> Section 2 @@ -331,21 +285,9 @@ Some text. """, """\ <document source="test data"> - <system_message level="3" line="1" source="test data" type="ERROR"> - <paragraph> - Document or section may not begin with a transition. <transition> - <system_message level="3" line="3" source="test data" type="ERROR"> - <paragraph> - At least one body element must separate transitions; adjacent transitions are not allowed. <transition> - <system_message level="3" line="5" source="test data" type="ERROR"> - <paragraph> - At least one body element must separate transitions; adjacent transitions are not allowed. <transition> - <system_message level="3" line="5" source="test data" type="ERROR"> - <paragraph> - Document may not end with a transition. """], ["""\ A paragraph. @@ -358,9 +300,6 @@ A paragraph. <paragraph> A paragraph. <transition> - <system_message level="3" line="3" source="test data" type="ERROR"> - <paragraph> - Document may not end with a transition. """], ] -- cgit v1.2.1 From 9e41a6191aee10eedfa1df2d0d10a4700a194e55 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Tue, 2 Nov 2004 22:14:24 +0000 Subject: Added support for trimming whitespace from beside substitution references. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2796 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms/test_substitutions.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'test') diff --git a/test/test_transforms/test_substitutions.py b/test/test_transforms/test_substitutions.py index 503dfba40..687a20ca5 100755 --- a/test/test_transforms/test_substitutions.py +++ b/test/test_transforms/test_substitutions.py @@ -143,6 +143,29 @@ u"""\ BogusMegaCorp \u2122 """], +["""\ +Insert an em-dash |---| automatically trimming whitespace. +Some substitutions |TM| only need trimming on one side. + +.. |---| unicode:: U+02014 + :trim: +.. |TM| unicode:: U+02122 + :ltrim: +""", +u"""\ +<document source="test data"> + <paragraph> + Insert an em-dash + \u2014 + automatically trimming whitespace. + Some substitutions + \u2122 + only need trimming on one side. + <substitution_definition ltrim="1" name="---" rtrim="1"> + \u2014 + <substitution_definition ltrim="1" name="TM"> + \u2122 +"""], ]) -- cgit v1.2.1 From a6a2dd50bbaaea7412ef021329d7b3b518636583 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Wed, 3 Nov 2004 14:31:26 +0000 Subject: Enabled multiple format names for "raw" directive. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2799 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_parsers/test_rst/test_directives/test_raw.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_directives/test_raw.py b/test/test_parsers/test_rst/test_directives/test_raw.py index cbce2f50d..c310c344c 100755 --- a/test/test_parsers/test_rst/test_directives/test_raw.py +++ b/test/test_parsers/test_rst/test_directives/test_raw.py @@ -76,6 +76,16 @@ totest['raw'] = [ <p>Can't have both content and file attribute.</p> """], +[r""" +.. raw:: latex html + + \[ \sum_{n=1}^\infty \frac{1}{n} \text{ etc.} \] +""", +"""\ +<document source="test data"> + <raw format="latex html" xml:space="preserve"> + \\[ \\sum_{n=1}^\\infty \\frac{1}{n} \\text{ etc.} \\] +"""], ] -- cgit v1.2.1 From 3e8c9fb5e58a3985b1cc9db892c01202a1cb89ae Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Wed, 3 Nov 2004 20:12:06 +0000 Subject: updated for multiple classifiers in definition list items git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2803 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_html4css1.html | 10 ++++++---- test/functional/expected/standalone_rst_latex.tex | 9 +++++++++ test/functional/input/data/standard.txt | 2 ++ test/test_parsers/test_rst/test_definition_lists.py | 18 ++++++++++++++++++ 4 files changed, 35 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index ad6113d2c..2ed3dcf64 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -246,6 +246,8 @@ live link to PEP 258 here.</p> </dd> <dt>Term</dt> <dd>Definition</dd> +<dt>Term <span class="classifier-delimiter">:</span> <span class="classifier">classifier one</span> <span class="classifier-delimiter">:</span> <span class="classifier">classifier two</span></dt> +<dd>Definition</dd> </dl> </div> <div class="section" id="field-lists"> @@ -847,16 +849,16 @@ section, "Docutils System Messages":</p> <p class="system-message-title">System Message: <a name="id19">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 89); <em><a href="#id20">backlink</a></em></p> Undefined substitution referenced: "problematic".</div> <div class="system-message" id="id66"> -<p class="system-message-title">System Message: <a name="id66">ERROR/3</a> (<tt>functional/input/standalone_rst_html4css1.txt</tt>, line 335); <em><a href="#id67">backlink</a></em></p> +<p class="system-message-title">System Message: <a name="id66">ERROR/3</a> (<tt>functional/input/standalone_rst_html4css1.txt</tt>, line 337); <em><a href="#id67">backlink</a></em></p> Unknown target name: "5".</div> <div class="system-message" id="id68"> -<p class="system-message-title">System Message: <a name="id68">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 344); <em><a href="#id69">backlink</a></em></p> +<p class="system-message-title">System Message: <a name="id68">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 346); <em><a href="#id69">backlink</a></em></p> Unknown target name: "nonexistent".</div> <div class="system-message" id="id70"> -<p class="system-message-title">System Message: <a name="id70">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 369); <em><a href="#id71">backlink</a></em></p> +<p class="system-message-title">System Message: <a name="id70">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 371); <em><a href="#id71">backlink</a></em></p> Unknown target name: "hyperlink reference without a target".</div> <div class="system-message" id="id72"> -<p class="system-message-title">System Message: <a name="id72">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 382); <em><a href="#id73">backlink</a></em></p> +<p class="system-message-title">System Message: <a name="id72">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 384); <em><a href="#id73">backlink</a></em></p> Duplicate target name, cannot be used as a unique reference: "duplicate target names".</div> </div> </div> diff --git a/test/functional/expected/standalone_rst_latex.tex b/test/functional/expected/standalone_rst_latex.tex index 8ce529c9d..69dfba65d 100644 --- a/test/functional/expected/standalone_rst_latex.tex +++ b/test/functional/expected/standalone_rst_latex.tex @@ -480,6 +480,15 @@ Definition paragraph 2. Definition +%[depart_definition] +%[depart_definition_list_item] +%[visit_definition_list_item] +\item[Term] (\textbf{classifier one}) +(\textbf{classifier two}) +%[visit_definition] + +Definition + %[depart_definition] %[depart_definition_list_item] \end{description} diff --git a/test/functional/input/data/standard.txt b/test/functional/input/data/standard.txt index b07b2f338..838cfc0f5 100644 --- a/test/functional/input/data/standard.txt +++ b/test/functional/input/data/standard.txt @@ -174,6 +174,8 @@ Term : classifier Definition paragraph 2. Term Definition +Term : classifier one : classifier two + Definition Field Lists ----------- diff --git a/test/test_parsers/test_rst/test_definition_lists.py b/test/test_parsers/test_rst/test_definition_lists.py index 0ffee313e..ee7d070f6 100755 --- a/test/test_parsers/test_rst/test_definition_lists.py +++ b/test/test_parsers/test_rst/test_definition_lists.py @@ -370,6 +370,24 @@ Term `with *inline ``text **errors : classifier `with *errors ``too <paragraph> Inline strong start-string without end-string. """], +["""\ +Term : classifier one : classifier two + Definition +""", +"""\ +<document source="test data"> + <definition_list> + <definition_list_item> + <term> + Term + <classifier> + classifier one + <classifier> + classifier two + <definition> + <paragraph> + Definition +"""], ] if __name__ == '__main__': -- cgit v1.2.1 From ca40d84eba8e1ccfa232ea08c5d38d108d7238d9 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sat, 6 Nov 2004 17:13:39 +0000 Subject: Allow multiple class names in the "class" directive. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2808 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms/test_class.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test') diff --git a/test/test_transforms/test_class.py b/test/test_transforms/test_class.py index 41f918d82..2825cdf28 100755 --- a/test/test_transforms/test_class.py +++ b/test/test_transforms/test_class.py @@ -100,6 +100,16 @@ Paragraph .. class:: one .. class:: two +multiple class values may be assigned to one element +""", +"""\ +<document source="test data"> + <paragraph class="one two"> + multiple class values may be assigned to one element +"""], +["""\ +.. class:: one two + multiple class values may be assigned to one element """, """\ -- cgit v1.2.1 From d74ca66c1c0d32c7447bfcd10c3c02ad9ea40123 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sat, 6 Nov 2004 19:51:39 +0000 Subject: Added "raw" role git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2814 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../test_rst/test_directives/test_role.py | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_directives/test_role.py b/test/test_parsers/test_rst/test_directives/test_role.py index 6dd1f742a..8fcfa9081 100755 --- a/test/test_parsers/test_rst/test_directives/test_role.py +++ b/test/test_parsers/test_rst/test_directives/test_role.py @@ -177,6 +177,53 @@ Testing a :fileref:`role` in a nested parse. """], ] +totest['raw_role'] = [ +["""\ +.. role:: html(raw) + :format: html + +Here's some :html:`<i>raw HTML data</i>`. +""", +"""\ +<document source="test data"> + <paragraph> + Here's some \n\ + <raw class="html" format="html" xml:space="preserve"> + <i>raw HTML data</i> + . +"""], +["""\ +.. role:: itex(raw) + :format: latex html + +Here's some itex markup: :itex:`$x^\\infty$`. +""", +"""\ +<document source="test data"> + <paragraph> + Here's some itex markup: \n\ + <raw class="itex" format="latex html" xml:space="preserve"> + $x^\\infty$ + . +"""], +["""\ +Can't use the :raw:`role` directly. +""", +"""\ +<document source="test data"> + <paragraph> + Can't use the \n\ + <problematic id="id2" refid="id1"> + :raw:`role` + directly. + <system_message backrefs="id2" id="id1" level="3" line="1" source="test data" type="ERROR"> + <paragraph> + No format (Writer name) is associated with this role: "raw". + The "raw" role cannot be used directly. + Instead, use the "role" directive to create a new role with an associated format. +"""], +] + if __name__ == '__main__': import unittest -- cgit v1.2.1 From 020a9519cd5b72b152ffe7a89d89b3040ee2451e Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sun, 7 Nov 2004 19:31:00 +0000 Subject: removed newline at end of raw text, because sometimes (when there are two consecutive newlines) the newline creates a new paragraph in LaTeX; added test git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2825 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_writers/test_latex2e.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'test') diff --git a/test/test_writers/test_latex2e.py b/test/test_writers/test_latex2e.py index 2cc01b1f5..e0e7cc16f 100644 --- a/test/test_writers/test_latex2e.py +++ b/test/test_writers/test_latex2e.py @@ -339,6 +339,39 @@ the~empty~line~gets~tested~too~\\\\ """], ] +totest['raw'] = [ +["""\ +.. raw:: latex + + \\noindent + +A paragraph. + +.. |sub| raw:: latex + + (some raw text) + +Foo |sub| +same paragraph. +""", +latex_head + """\ +\\title{} +\\author{} +\\date{} +\\raggedbottom +\\begin{document} + +\\setlength{\\locallinewidth}{\\linewidth} +\\noindent +A paragraph. + +Foo (some raw text) +same paragraph. + +\\end{document} +"""], +] + if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') -- cgit v1.2.1 From 394204b9c7ea8b9c141a614f01c11d9839f6f8c5 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Mon, 8 Nov 2004 15:30:11 +0000 Subject: do not strip <p></p> from a paragraph which is the only child of a document git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2831 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_writers/test_html4css1/test_parts.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/test_writers/test_html4css1/test_parts.py b/test/test_writers/test_html4css1/test_parts.py index 30493f74f..ee1c6c6fb 100755 --- a/test/test_writers/test_html4css1/test_parts.py +++ b/test/test_writers/test_html4css1/test_parts.py @@ -29,21 +29,21 @@ totest['Title promotion'] = ({}, [ Simple String """, """\ -{'fragment': '''Simple String'''} +{'fragment': '''<p>Simple String</p>\\n'''} """ ], ["""\ Simple String with *markup* """, """\ -{'fragment': '''Simple String with <em>markup</em>'''} +{'fragment': '''<p>Simple String with <em>markup</em></p>\\n'''} """ ], ["""\ Simple String with an even simpler ``inline literal`` """, """\ -{'fragment': '''Simple String with an even simpler <tt class="literal"><span class="pre">inline</span> <span class="pre">literal</span></tt>'''} +{'fragment': '''<p>Simple String with an even simpler <tt class="literal"><span class="pre">inline</span> <span class="pre">literal</span></tt></p>\\n'''} """ ], ["""\ @@ -135,21 +135,21 @@ totest['No title promotion'] = ({'doctitle_xform' : 0}, [ Simple String """, """\ -{'fragment': '''Simple String'''} +{'fragment': '''<p>Simple String</p>\\n'''} """ ], ["""\ Simple String with *markup* """, """\ -{'fragment': '''Simple String with <em>markup</em>'''} +{'fragment': '''<p>Simple String with <em>markup</em></p>\\n'''} """ ], ["""\ Simple String with an even simpler ``inline literal`` """, """\ -{'fragment': '''Simple String with an even simpler <tt class="literal"><span class="pre">inline</span> <span class="pre">literal</span></tt>'''} +{'fragment': '''<p>Simple String with an even simpler <tt class="literal"><span class="pre">inline</span> <span class="pre">literal</span></tt></p>\\n'''} """ ], ["""\ -- cgit v1.2.1 From 6108a767c19a1d7af03564d04c9449e618422bd1 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Mon, 8 Nov 2004 18:11:54 +0000 Subject: really disregard invisible nodes when checking for compactable lists git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2834 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_html4css1.html | 10 ++++++---- test/functional/expected/standalone_rst_latex.tex | 4 ++++ test/functional/input/data/standard.txt | 6 ++++++ 3 files changed, 16 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index 2ed3dcf64..029e1ebdc 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -198,6 +198,8 @@ live link to PEP 258 here.</p> </ul> </li> <li>Nested item 3.</li> +<li>This nested list should be compacted by the HTML writer.<a class="target" id="target" name="target"></a><!-- Even if this item contains a target and a comment. --> +</li> </ul> </li> </ul> @@ -849,16 +851,16 @@ section, "Docutils System Messages":</p> <p class="system-message-title">System Message: <a name="id19">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 89); <em><a href="#id20">backlink</a></em></p> Undefined substitution referenced: "problematic".</div> <div class="system-message" id="id66"> -<p class="system-message-title">System Message: <a name="id66">ERROR/3</a> (<tt>functional/input/standalone_rst_html4css1.txt</tt>, line 337); <em><a href="#id67">backlink</a></em></p> +<p class="system-message-title">System Message: <a name="id66">ERROR/3</a> (<tt>functional/input/standalone_rst_html4css1.txt</tt>, line 343); <em><a href="#id67">backlink</a></em></p> Unknown target name: "5".</div> <div class="system-message" id="id68"> -<p class="system-message-title">System Message: <a name="id68">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 346); <em><a href="#id69">backlink</a></em></p> +<p class="system-message-title">System Message: <a name="id68">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 352); <em><a href="#id69">backlink</a></em></p> Unknown target name: "nonexistent".</div> <div class="system-message" id="id70"> -<p class="system-message-title">System Message: <a name="id70">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 371); <em><a href="#id71">backlink</a></em></p> +<p class="system-message-title">System Message: <a name="id70">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 377); <em><a href="#id71">backlink</a></em></p> Unknown target name: "hyperlink reference without a target".</div> <div class="system-message" id="id72"> -<p class="system-message-title">System Message: <a name="id72">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 384); <em><a href="#id73">backlink</a></em></p> +<p class="system-message-title">System Message: <a name="id72">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 390); <em><a href="#id73">backlink</a></em></p> Duplicate target name, cannot be used as a unique reference: "duplicate target names".</div> </div> </div> diff --git a/test/functional/expected/standalone_rst_latex.tex b/test/functional/expected/standalone_rst_latex.tex index 69dfba65d..38d308d70 100644 --- a/test/functional/expected/standalone_rst_latex.tex +++ b/test/functional/expected/standalone_rst_latex.tex @@ -345,6 +345,10 @@ Item 2. \item {} Nested item 3. +\item {} +This nested list should be compacted by the HTML writer. +\hypertarget{target}{}% Even if this item contains a target and a comment. + \end{itemize} \end{itemize} diff --git a/test/functional/input/data/standard.txt b/test/functional/input/data/standard.txt index 838cfc0f5..fcf3c7ad8 100644 --- a/test/functional/input/data/standard.txt +++ b/test/functional/input/data/standard.txt @@ -136,6 +136,12 @@ Bullet Lists * Nested item 3. + * This nested list should be compacted by the HTML writer. + + .. _target: + + .. Even if this item contains a target and a comment. + Enumerated Lists ---------------- -- cgit v1.2.1 From f11f070b03255964159a960a3f9a08cca32f1986 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sat, 13 Nov 2004 19:38:41 +0000 Subject: updated unit test for HTML writer because of new "docutils" class attributes git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2850 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_writers/test_html4css1/test_parts.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/test_writers/test_html4css1/test_parts.py b/test/test_writers/test_html4css1/test_parts.py index ee1c6c6fb..9da0214c5 100755 --- a/test/test_writers/test_html4css1/test_parts.py +++ b/test/test_writers/test_html4css1/test_parts.py @@ -43,7 +43,7 @@ Simple String with *markup* Simple String with an even simpler ``inline literal`` """, """\ -{'fragment': '''<p>Simple String with an even simpler <tt class="literal"><span class="pre">inline</span> <span class="pre">literal</span></tt></p>\\n'''} +{'fragment': '''<p>Simple String with an even simpler <tt class="docutils literal"><span class="pre">inline</span> <span class="pre">literal</span></tt></p>\\n'''} """ ], ["""\ @@ -149,7 +149,7 @@ Simple String with *markup* Simple String with an even simpler ``inline literal`` """, """\ -{'fragment': '''<p>Simple String with an even simpler <tt class="literal"><span class="pre">inline</span> <span class="pre">literal</span></tt></p>\\n'''} +{'fragment': '''<p>Simple String with an even simpler <tt class="docutils literal"><span class="pre">inline</span> <span class="pre">literal</span></tt></p>\\n'''} """ ], ["""\ -- cgit v1.2.1 From 2f7a697d726f5cc418133a57025fe9e80a51a805 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sat, 13 Nov 2004 19:42:17 +0000 Subject: updated expected HTML output of functional test because of newly added "docutils" class attributes; I visually verified that the appearance has not changed git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2851 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../expected/standalone_rst_html4css1.html | 58 +++++++++++----------- 1 file changed, 29 insertions(+), 29 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index 029e1ebdc..29d4f51df 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -139,7 +139,7 @@ They are transformed from section titles after parsing. --> <div class="section" id="transitions"> <h2><a class="toc-backref" href="#id27" name="transitions">1.2   Transitions</a></h2> <p>Here's a transition:</p> -<hr /> +<hr class="docutils" /> <p>It divides the section.</p> </div> </div> @@ -151,7 +151,7 @@ They are transformed from section titles after parsing. --> <div class="section" id="inline-markup"> <h3><a class="toc-backref" href="#id30" name="inline-markup">2.1.1   Inline Markup</a></h3> <p>Paragraphs contain text and may contain inline markup: <em>emphasis</em>, -<strong>strong emphasis</strong>, <tt class="literal"><span class="pre">inline</span> <span class="pre">literals</span></tt>, standalone hyperlinks +<strong>strong emphasis</strong>, <tt class="docutils literal"><span class="pre">inline</span> <span class="pre">literals</span></tt>, standalone hyperlinks (<a class="reference" href="http://www.python.org">http://www.python.org</a>), external hyperlinks (<a class="reference" href="http://www.python.org/">Python</a> <a class="footnote-reference" href="#id21" id="id22" name="id22">[5]</a>), internal cross-references (<a class="reference" href="#example">example</a>), external hyperlinks with embedded URIs (<a class="reference" href="http://www.python.org">Python web site</a>), footnote references @@ -160,22 +160,22 @@ auto-numbered <a class="footnote-reference" href="#label" id="id3" name="id3">[2 (<a class="citation-reference" href="#cit2002" id="id5" name="id5">[CIT2002]</a>), substitution references (<img alt="EXAMPLE" src="../../../docs/user/rst/images/biohazard.png" />), and <a class="target" id="inline-hyperlink-targets" name="inline-hyperlink-targets">inline hyperlink targets</a> (see <a class="reference" href="#targets">Targets</a> below for a reference back to here). Character-level inline markup is also possible (although exceedingly -ugly!) in <em>re</em><tt class="literal"><span class="pre">Structured</span></tt><em>Text</em>. Problems are indicated by +ugly!) in <em>re</em><tt class="docutils literal"><span class="pre">Structured</span></tt><em>Text</em>. Problems are indicated by <a href="#id19" name="id20"><span class="problematic" id="id20">|problematic|</span></a> text (generated by processing errors; this one is intentional).</p> <p>The default role for interpreted text is <cite>Title Reference</cite>. Here are some explicit interpreted text roles: a PEP reference (<a class="reference" href="http://www.python.org/peps/pep-0287.html">PEP 287</a>); an RFC reference (<a class="reference" href="http://www.faqs.org/rfcs/rfc2822.html">RFC 2822</a>); a <sub>subscript</sub>; a <sup>superscript</sup>; and explicit roles for <em>standard</em> <strong>inline</strong> -<tt class="literal"><span class="pre">markup</span></tt>.</p> +<tt class="docutils literal"><span class="pre">markup</span></tt>.</p> <!-- DO NOT RE-WRAP THE FOLLOWING PARAGRAPH! --> <p>Let's test wrapping and whitespace significance in inline literals: -<tt class="literal"><span class="pre">This</span> <span class="pre">is</span> <span class="pre">an</span> <span class="pre">example</span> <span class="pre">of</span> <span class="pre">--inline-literal</span> <span class="pre">--text,</span> <span class="pre">--including</span> <span class="pre">some--</span> +<tt class="docutils literal"><span class="pre">This</span> <span class="pre">is</span> <span class="pre">an</span> <span class="pre">example</span> <span class="pre">of</span> <span class="pre">--inline-literal</span> <span class="pre">--text,</span> <span class="pre">--including</span> <span class="pre">some--</span> <span class="pre">strangely--hyphenated-words.</span>  <span class="pre">Adjust-the-width-of-your-browser-window</span> <span class="pre">to</span> <span class="pre">see</span> <span class="pre">how</span> <span class="pre">the</span> <span class="pre">text</span> <span class="pre">is</span> <span class="pre">wrapped.</span>  <span class="pre">--</span> <span class="pre">----</span> <span class="pre">--------</span>  <span class="pre">Now</span> <span class="pre">note</span>    <span class="pre">the</span> <span class="pre">spacing</span>    <span class="pre">between</span> <span class="pre">the</span>    <span class="pre">words</span> <span class="pre">of</span>    <span class="pre">this</span> <span class="pre">sentence</span>    <span class="pre">(words</span> <span class="pre">should</span>    <span class="pre">be</span> <span class="pre">grouped</span>    <span class="pre">in</span> <span class="pre">pairs).</span></tt></p> -<p>If the <tt class="literal"><span class="pre">--pep-references</span></tt> option was supplied, there should be a +<p>If the <tt class="docutils literal"><span class="pre">--pep-references</span></tt> option was supplied, there should be a live link to PEP 258 here.</p> </div> </div> @@ -239,7 +239,7 @@ live link to PEP 258 here.</p> </div> <div class="section" id="definition-lists"> <h2><a class="toc-backref" href="#id33" name="definition-lists">2.4   Definition Lists</a></h2> -<dl> +<dl class="docutils"> <dt>Term</dt> <dd>Definition</dd> <dt>Term <span class="classifier-delimiter">:</span> <span class="classifier">classifier</span></dt> @@ -254,7 +254,7 @@ live link to PEP 258 here.</p> </div> <div class="section" id="field-lists"> <h2><a class="toc-backref" href="#id34" name="field-lists">2.5   Field Lists</a></h2> -<table class="field-list" frame="void" rules="none"> +<table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> @@ -278,7 +278,7 @@ doesn't get stripped away.)</p> <div class="section" id="option-lists"> <h2><a class="toc-backref" href="#id35" name="option-lists">2.6   Option Lists</a></h2> <p>For listing command-line options:</p> -<table class="option-list" frame="void" rules="none"> +<table class="docutils option-list" frame="void" rules="none"> <col class="option" /> <col class="description" /> <tbody valign="top"> @@ -324,7 +324,7 @@ description.</p> <div class="section" id="literal-blocks"> <h2><a class="toc-backref" href="#id36" name="literal-blocks">2.7   Literal Blocks</a></h2> <p>Literal blocks are indicated with a double-colon ("::") at the end of -the preceding paragraph (over there <tt class="literal"><span class="pre">--></span></tt>). They can be indented:</p> +the preceding paragraph (over there <tt class="docutils literal"><span class="pre">--></span></tt>). They can be indented:</p> <pre class="literal-block"> if literal_block: text = 'is left as-is' @@ -420,7 +420,7 @@ Python-specific usage examples; begun with ">>>" </div> <div class="section" id="footnotes"> <h2><a class="toc-backref" href="#id40" name="footnotes">2.11   Footnotes</a></h2> -<table class="footnote" frame="void" id="id6" rules="none"> +<table class="docutils footnote" frame="void" id="id6" rules="none"> <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> <tr><td class="label"><a name="id6">[1]</a></td><td><em>(<a class="fn-backref" href="#id1">1</a>, <a class="fn-backref" href="#id7">2</a>)</em> <p>A footnote contains body elements, consistently indented by at @@ -429,7 +429,7 @@ least 3 spaces.</p> </td></tr> </tbody> </table> -<table class="footnote" frame="void" id="label" rules="none"> +<table class="docutils footnote" frame="void" id="label" rules="none"> <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> <tr><td class="label"><a name="label">[2]</a></td><td><em>(<a class="fn-backref" href="#id3">1</a>, <a class="fn-backref" href="#id8">2</a>)</em> Footnotes may be numbered, either manually (as in <a class="footnote-reference" href="#id6" id="id7" name="id7">[1]</a>) or @@ -439,7 +439,7 @@ footnote reference (<a class="footnote-reference" href="#label" id="id8" name="i (<a class="reference" href="#label">label</a>).</td></tr> </tbody> </table> -<table class="footnote" frame="void" id="id9" rules="none"> +<table class="docutils footnote" frame="void" id="id9" rules="none"> <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> <tr><td class="label"><a class="fn-backref" href="#id2" name="id9">[3]</a></td><td><p class="first">This footnote is numbered automatically and anonymously using a @@ -449,20 +449,20 @@ label of "#" only.</p> </td></tr> </tbody> </table> -<table class="footnote" frame="void" id="id10" rules="none"> +<table class="docutils footnote" frame="void" id="id10" rules="none"> <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> <tr><td class="label"><a class="fn-backref" href="#id4" name="id10">[*]</a></td><td>Footnotes may also use symbols, specified with a "*" label. Here's a reference to the next footnote: <a class="footnote-reference" href="#id12" id="id11" name="id11">[†]</a>.</td></tr> </tbody> </table> -<table class="footnote" frame="void" id="id12" rules="none"> +<table class="docutils footnote" frame="void" id="id12" rules="none"> <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> <tr><td class="label"><a class="fn-backref" href="#id11" name="id12">[†]</a></td><td>This footnote shows the next symbol in the sequence.</td></tr> </tbody> </table> -<table class="footnote" frame="void" id="id13" rules="none"> +<table class="docutils footnote" frame="void" id="id13" rules="none"> <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> <tr><td class="label"><a name="id13">[4]</a></td><td>Here's an unreferenced footnote, with a reference to a @@ -472,7 +472,7 @@ nonexistent footnote: <a href="#id66" name="id67"><span class="problematic" id=" </div> <div class="section" id="citations"> <h2><a class="toc-backref" href="#id41" name="citations">2.12   Citations</a></h2> -<table class="citation" frame="void" id="cit2002" rules="none"> +<table class="docutils citation" frame="void" id="cit2002" rules="none"> <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> <tr><td class="label"><a name="cit2002">[CIT2002]</a></td><td><em>(<a class="fn-backref" href="#id5">1</a>, <a class="fn-backref" href="#id15">2</a>)</em> Citations are text-labeled footnotes. They may be @@ -539,7 +539,7 @@ document (a document-wide <a class="reference" href="#table-of-contents">table o <p><img alt="reStructuredText, the markup syntax" src="../../../docs/user/rst/images/title.png" /></p> <p class="caption">A figure is an image with a caption and/or a legend:</p> <div class="legend"> -<table border="1" class="table"> +<table border="1" class="docutils"> <colgroup> <col width="20%" /> <col width="80%" /> @@ -620,7 +620,7 @@ background color.</p> </div> <div class="section" id="target-footnotes"> <h3><a class="toc-backref" href="#id63" name="target-footnotes">2.14.5   Target Footnotes</a></h3> -<table class="footnote" frame="void" id="id21" rules="none"> +<table class="docutils footnote" frame="void" id="id21" rules="none"> <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> <tr><td class="label"><a name="id21">[5]</a></td><td><em>(<a class="fn-backref" href="#id22">1</a>, <a class="fn-backref" href="#id23">2</a>, <a class="fn-backref" href="#id24">3</a>)</em> <a class="reference" href="http://www.python.org/">http://www.python.org/</a></td></tr> @@ -671,7 +671,7 @@ LaTeX, the following paragraphs should all be first-line indented:</p> </div> <div class="compound"> <p class="compound-first">Compound 7, with a table inside:</p> -<table border="1" class="compound-middle table"> +<table border="1" class="compound-middle docutils"> <colgroup> <col width="33%" /> <col width="33%" /> @@ -717,7 +717,7 @@ Double-dashes - - "- -" - - must be escaped somehow in HTML output. --> <div class="section" id="colspanning-tables"> <h2><a class="toc-backref" href="#id55" name="colspanning-tables">2.17   Colspanning tables</a></h2> <p>This table has a cell spanning two columns:</p> -<table border="1" class="table"> +<table border="1" class="docutils"> <colgroup> <col width="31%" /> <col width="31%" /> @@ -755,7 +755,7 @@ Double-dashes - - "- -" - - must be escaped somehow in HTML output. --> <div class="section" id="rowspanning-tables"> <h2><a class="toc-backref" href="#id56" name="rowspanning-tables">2.18   Rowspanning tables</a></h2> <p>Here's a table with cells spanning several rows:</p> -<table border="1" class="table"> +<table border="1" class="docutils"> <colgroup> <col width="44%" /> <col width="22%" /> @@ -791,7 +791,7 @@ span rows.</td> <div class="section" id="complex-tables"> <h2><a class="toc-backref" href="#id57" name="complex-tables">2.19   Complex tables</a></h2> <p>Here's a complex table, which should test all features.</p> -<table border="1" class="table"> +<table border="1" class="docutils"> <colgroup> <col width="43%" /> <col width="21%" /> @@ -831,7 +831,7 @@ span rows.</p> </tr> <tr><td>body row 5</td> <td colspan="2">Cells may also be -empty: <tt class="literal"><span class="pre">--></span></tt></td> +empty: <tt class="docutils literal"><span class="pre">--></span></tt></td> <td> </td> </tr> </tbody> @@ -848,19 +848,19 @@ section, "Docutils System Messages":</p> <div class="system-messages section"> <h1><a>Docutils System Messages</a></h1> <div class="system-message" id="id19"> -<p class="system-message-title">System Message: <a name="id19">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 89); <em><a href="#id20">backlink</a></em></p> +<p class="system-message-title">System Message: <a name="id19">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 89); <em><a href="#id20">backlink</a></em></p> Undefined substitution referenced: "problematic".</div> <div class="system-message" id="id66"> -<p class="system-message-title">System Message: <a name="id66">ERROR/3</a> (<tt>functional/input/standalone_rst_html4css1.txt</tt>, line 343); <em><a href="#id67">backlink</a></em></p> +<p class="system-message-title">System Message: <a name="id66">ERROR/3</a> (<tt class="docutils">functional/input/standalone_rst_html4css1.txt</tt>, line 343); <em><a href="#id67">backlink</a></em></p> Unknown target name: "5".</div> <div class="system-message" id="id68"> -<p class="system-message-title">System Message: <a name="id68">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 352); <em><a href="#id69">backlink</a></em></p> +<p class="system-message-title">System Message: <a name="id68">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 352); <em><a href="#id69">backlink</a></em></p> Unknown target name: "nonexistent".</div> <div class="system-message" id="id70"> -<p class="system-message-title">System Message: <a name="id70">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 377); <em><a href="#id71">backlink</a></em></p> +<p class="system-message-title">System Message: <a name="id70">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 377); <em><a href="#id71">backlink</a></em></p> Unknown target name: "hyperlink reference without a target".</div> <div class="system-message" id="id72"> -<p class="system-message-title">System Message: <a name="id72">ERROR/3</a> (<tt>functional/input/data/standard.txt</tt>, line 390); <em><a href="#id73">backlink</a></em></p> +<p class="system-message-title">System Message: <a name="id72">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 390); <em><a href="#id73">backlink</a></em></p> Duplicate target name, cannot be used as a unique reference: "duplicate target names".</div> </div> </div> -- cgit v1.2.1 From 5646e5b5a5f7d0e29de74c557a829194f3619d89 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sat, 13 Nov 2004 20:28:58 +0000 Subject: added "last" attribute to last element in admonition in HTML to avoid vertical space git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2853 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_html4css1.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index 29d4f51df..f85ed4eb2 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -579,7 +579,7 @@ Does not compute.</div> It's bigger than a bread box.</div> <div class="important"> <p class="admonition-title first">Important</p> -<ul class="simple"> +<ul class="last simple"> <li>Wash behind your ears.</li> <li>Clean up your room.</li> <li>Call your mother.</li> @@ -597,8 +597,8 @@ This is a note.</div> Strong prose may provoke extreme mental exertion. Reader discretion is strongly advised.</div> <div class="admonition-and-by-the-way admonition"> -<p class="admonition-title first">And, by the way...</p> -<p>You can make up your own admonition too.</p> +<p class="first admonition-title first">And, by the way...</p> +<p class="last">You can make up your own admonition too.</p> </div> </div> <div class="section" id="topics-sidebars-and-rubrics"> -- cgit v1.2.1 From d0d253b0becd518e4a387a42785ae872a19692f8 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sat, 13 Nov 2004 20:51:59 +0000 Subject: Re-fixed rendering of admonitions in HTML to unify generated HTML of pre-defined and user-defined admonitions. This fix also avoids paragraph-compacting like this:: <div class="attention"> <p class="admonition-title first">Attention!</p> Directives at large.</div> (Note that the second paragraph has no <p> tags.) git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2854 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../expected/standalone_rst_html4css1.html | 46 +++++++++++++--------- 1 file changed, 27 insertions(+), 19 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index f85ed4eb2..9cf3d3e84 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -563,22 +563,27 @@ document (a document-wide <a class="reference" href="#table-of-contents">table o <div class="section" id="admonitions"> <h3><a class="toc-backref" href="#id61" name="admonitions">2.14.3   Admonitions</a></h3> <div class="attention"> -<p class="admonition-title first">Attention!</p> -Directives at large.</div> +<p class="first admonition-title">Attention!</p> +<p class="last">Directives at large.</p> +</div> <div class="caution"> -<p class="admonition-title first">Caution!</p> -Don't take any wooden nickels.</div> +<p class="first admonition-title">Caution!</p> +<p class="last">Don't take any wooden nickels.</p> +</div> <div class="danger"> -<p class="admonition-title first">!DANGER!</p> -Mad scientist at work!</div> +<p class="first admonition-title">!DANGER!</p> +<p class="last">Mad scientist at work!</p> +</div> <div class="error"> -<p class="admonition-title first">Error</p> -Does not compute.</div> +<p class="first admonition-title">Error</p> +<p class="last">Does not compute.</p> +</div> <div class="hint"> -<p class="admonition-title first">Hint</p> -It's bigger than a bread box.</div> +<p class="first admonition-title">Hint</p> +<p class="last">It's bigger than a bread box.</p> +</div> <div class="important"> -<p class="admonition-title first">Important</p> +<p class="first admonition-title">Important</p> <ul class="last simple"> <li>Wash behind your ears.</li> <li>Clean up your room.</li> @@ -587,17 +592,20 @@ It's bigger than a bread box.</div> </ul> </div> <div class="note"> -<p class="admonition-title first">Note</p> -This is a note.</div> +<p class="first admonition-title">Note</p> +<p class="last">This is a note.</p> +</div> <div class="tip"> -<p class="admonition-title first">Tip</p> -15% if the service is good.</div> +<p class="first admonition-title">Tip</p> +<p class="last">15% if the service is good.</p> +</div> <div class="warning"> -<p class="admonition-title first">Warning</p> -Strong prose may provoke extreme mental exertion. -Reader discretion is strongly advised.</div> +<p class="first admonition-title">Warning</p> +<p class="last">Strong prose may provoke extreme mental exertion. +Reader discretion is strongly advised.</p> +</div> <div class="admonition-and-by-the-way admonition"> -<p class="first admonition-title first">And, by the way...</p> +<p class="first admonition-title">And, by the way...</p> <p class="last">You can make up your own admonition too.</p> </div> </div> -- cgit v1.2.1 From dc6229375da8ddf286ff8fbf58e6cd9069b3ce4f Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sat, 13 Nov 2004 21:03:57 +0000 Subject: add classes "first" and "last" to sidebar children git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2856 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_html4css1.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index 9cf3d3e84..f8c74775b 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -612,12 +612,12 @@ Reader discretion is strongly advised.</p> <div class="section" id="topics-sidebars-and-rubrics"> <h3><a class="toc-backref" href="#id62" name="topics-sidebars-and-rubrics">2.14.4   Topics, Sidebars, and Rubrics</a></h3> <div class="sidebar"> -<p class="sidebar-title first">Sidebar Title</p> +<p class="first sidebar-title">Sidebar Title</p> <p class="sidebar-subtitle">Optional Subtitle</p> <p>This is a sidebar. It is for text outside the flow of the main text.</p> <p class="rubric">This is a rubric inside a sidebar</p> -<p>Sidebars often appears beside the main text with a border and +<p class="last">Sidebars often appears beside the main text with a border and background color.</p> </div> <div class="topic"> -- cgit v1.2.1 From 4c33c807d1631bb1e5e6fa42bc00a11b700347e7 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sat, 13 Nov 2004 21:25:51 +0000 Subject: added entries about newly added class="docutils" git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2857 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/alltests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/alltests.py b/test/alltests.py index ecd950853..7c31c4623 100755 --- a/test/alltests.py +++ b/test/alltests.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env py4123 # Author: David Goodger # Contact: goodger@users.sourceforge.net -- cgit v1.2.1 From 88dad9a434f03607458a8a0018e6b96eb9d48ae5 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sat, 13 Nov 2004 21:31:37 +0000 Subject: reverted erroneously checked-in changes git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2858 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/alltests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/alltests.py b/test/alltests.py index 7c31c4623..ecd950853 100755 --- a/test/alltests.py +++ b/test/alltests.py @@ -1,4 +1,4 @@ -#!/usr/bin/env py4123 +#!/usr/bin/env python # Author: David Goodger # Contact: goodger@users.sourceforge.net -- cgit v1.2.1 From dbd944e80a6f67bea3f3b0e332a3b0c34ee618f5 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Thu, 25 Nov 2004 11:26:34 +0000 Subject: removed no_random option; SF's Python doesn't seem to be broken anymore git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2868 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/data/config_1.txt | 1 - test/data/config_old.txt | 1 - test/test_settings.py | 2 -- 3 files changed, 4 deletions(-) (limited to 'test') diff --git a/test/data/config_1.txt b/test/data/config_1.txt index f94074a8a..0c513dc57 100644 --- a/test/data/config_1.txt +++ b/test/data/config_1.txt @@ -22,4 +22,3 @@ stylesheet-path: stylesheets/default.css template: pep-html-template stylesheet-path: stylesheets/pep.css python-home: http://www.python.org -no-random: yes diff --git a/test/data/config_old.txt b/test/data/config_old.txt index fa07d6dab..53ab8cb70 100644 --- a/test/data/config_old.txt +++ b/test/data/config_old.txt @@ -11,4 +11,3 @@ stylesheet-path: stylesheets/default.css pep-template: pep-html-template pep-stylesheet-path: stylesheets/pep.css python-home: http://www.python.org -no-random: 1 diff --git a/test/test_settings.py b/test/test_settings.py index 2a17c6eef..bb0b87020 100755 --- a/test/test_settings.py +++ b/test/test_settings.py @@ -43,7 +43,6 @@ class ConfigFileTests(unittest.TestCase): settings = { 'old': {'datestamp': '%Y-%m-%d %H:%M UTC', 'generator': 1, - 'no_random': 1, 'python_home': 'http://www.python.org', 'source_link': 1, 'stylesheet': None, @@ -51,7 +50,6 @@ class ConfigFileTests(unittest.TestCase): 'template': fixpath('data/pep-html-template')}, 'one': {'datestamp': '%Y-%m-%d %H:%M UTC', 'generator': 1, - 'no_random': 1, 'python_home': 'http://www.python.org', 'record_dependencies': utils.DependencyList(), 'source_link': 1, -- cgit v1.2.1 From 905976014be91324d50fa8e7d3d7a5ad05bfca63 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Thu, 25 Nov 2004 18:31:48 +0000 Subject: disable automatic dash-transformation ("--" to en-dash) in LaTeX git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2869 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_latex.tex | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_latex.tex b/test/functional/expected/standalone_rst_latex.tex index 38d308d70..5770de317 100644 --- a/test/functional/expected/standalone_rst_latex.tex +++ b/test/functional/expected/standalone_rst_latex.tex @@ -542,21 +542,21 @@ command-line option ``a'' \item [-b file] options can have arguments and long descriptions -\item [--long] +\item [-{}-long] options can be long also -\item [--input=file] +\item [-{}-input=file] long options can also have arguments -\item [--very-long-option] +\item [-{}-very-long-option] The description can also start on the next line. The description may contain multiple body elements, regardless of where it starts. \item [-x, -y, -z] Multiple options are an ``option group''. -\item [-v, --verbose] +\item [-v, -{}-verbose] Commonly-seen: short {\&} long options. -\item [-1 file, --one=file, --two file] +\item [-1 file, -{}-one=file, -{}-two file] Multiple options with arguments. \item [/V] DOS/VMS-style options too @@ -841,7 +841,7 @@ document (a document-wide \href{\#table-of-contents}{table of contents}). \pdfbookmark[2]{2.14.2~~~Images}{images} \subsubsection*{2.14.2~~~Images} -An image directive (also clickable -- a hyperlink reference): +An image directive (also clickable -{}- a hyperlink reference): \href{\#directives}{\includegraphics{../../../docs/user/rst/images/title.png}} A figure directive: \begin{figure}[htbp]\begin{center} @@ -1070,7 +1070,7 @@ This~one~starts~with~a~literal~block. }\end{quote} Compound 4, a paragraph. -Now something \emph{really} perverted -- a nested compound block. In +Now something \emph{really} perverted -{}- a nested compound block. In LaTeX, the following paragraphs should all be first-line indented: Compound 5, block 1 (a paragraph). -- cgit v1.2.1 From a33879a926ba9d3beffcc35e5f8c45cb62e85ce4 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Fri, 26 Nov 2004 09:27:55 +0000 Subject: allow empty sections and documents git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2870 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_parsers/test_rst/test_section_headers.py | 6 ------ 1 file changed, 6 deletions(-) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_section_headers.py b/test/test_parsers/test_rst/test_section_headers.py index e1119f32a..f95ee6f89 100755 --- a/test/test_parsers/test_rst/test_section_headers.py +++ b/test/test_parsers/test_rst/test_section_headers.py @@ -853,9 +853,6 @@ Empty Section <section id="empty-section" name="empty section"> <title> Empty Section - <system_message level="3" line="2" source="test data" type="ERROR"> - <paragraph> - Section empty; must have contents. """], ["""\ === @@ -891,9 +888,6 @@ Without it, the parser ends up in an infinite loop. """, """\ <document source="test data"> - <system_message level="3" line="0" source="test data" type="ERROR"> - <paragraph> - Document empty; must have contents. """], ] -- cgit v1.2.1 From 82b16cc9c594b09de2aac97fa4cb6f32bac7935e Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Fri, 26 Nov 2004 09:32:56 +0000 Subject: added functional tests for empty sections and transitions between sections git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2871 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../expected/standalone_rst_html4css1.html | 175 +++++++++++---------- test/functional/expected/standalone_rst_latex.tex | 22 ++- test/functional/input/data/standard.txt | 7 +- 3 files changed, 114 insertions(+), 90 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index f8c74775b..1e8140686 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -86,48 +86,49 @@ They are transformed from section titles after parsing. --> <ul class="auto-toc simple"> <li><a class="reference" href="#structural-elements" id="id25" name="id25">1   Structural Elements</a><ul class="auto-toc"> <li><a class="reference" href="#section-title" id="id26" name="id26">1.1   Section Title</a></li> -<li><a class="reference" href="#transitions" id="id27" name="id27">1.2   Transitions</a></li> +<li><a class="reference" href="#empty-section" id="id27" name="id27">1.2   Empty Section</a></li> +<li><a class="reference" href="#transitions" id="id28" name="id28">1.3   Transitions</a></li> </ul> </li> -<li><a class="reference" href="#body-elements" id="id28" name="id28">2   Body Elements</a><ul class="auto-toc"> -<li><a class="reference" href="#paragraphs" id="id29" name="id29">2.1   Paragraphs</a><ul class="auto-toc"> -<li><a class="reference" href="#inline-markup" id="id30" name="id30">2.1.1   Inline Markup</a></li> +<li><a class="reference" href="#body-elements" id="id29" name="id29">2   Body Elements</a><ul class="auto-toc"> +<li><a class="reference" href="#paragraphs" id="id30" name="id30">2.1   Paragraphs</a><ul class="auto-toc"> +<li><a class="reference" href="#inline-markup" id="id31" name="id31">2.1.1   Inline Markup</a></li> </ul> </li> -<li><a class="reference" href="#bullet-lists" id="id31" name="id31">2.2   Bullet Lists</a></li> -<li><a class="reference" href="#enumerated-lists" id="id32" name="id32">2.3   Enumerated Lists</a></li> -<li><a class="reference" href="#definition-lists" id="id33" name="id33">2.4   Definition Lists</a></li> -<li><a class="reference" href="#field-lists" id="id34" name="id34">2.5   Field Lists</a></li> -<li><a class="reference" href="#option-lists" id="id35" name="id35">2.6   Option Lists</a></li> -<li><a class="reference" href="#literal-blocks" id="id36" name="id36">2.7   Literal Blocks</a></li> -<li><a class="reference" href="#line-blocks" id="id37" name="id37">2.8   Line Blocks</a></li> -<li><a class="reference" href="#block-quotes" id="id38" name="id38">2.9   Block Quotes</a></li> -<li><a class="reference" href="#doctest-blocks" id="id39" name="id39">2.10   Doctest Blocks</a></li> -<li><a class="reference" href="#footnotes" id="id40" name="id40">2.11   Footnotes</a></li> -<li><a class="reference" href="#citations" id="id41" name="id41">2.12   Citations</a></li> -<li><a class="reference" href="#targets" id="id42" name="id42">2.13   Targets</a><ul class="auto-toc"> -<li><a class="reference" href="#duplicate-target-names" id="id43" name="id43">2.13.1   Duplicate Target Names</a></li> -<li><a class="reference" href="#id18" id="id44" name="id44">2.13.2   Duplicate Target Names</a></li> +<li><a class="reference" href="#bullet-lists" id="id32" name="id32">2.2   Bullet Lists</a></li> +<li><a class="reference" href="#enumerated-lists" id="id33" name="id33">2.3   Enumerated Lists</a></li> +<li><a class="reference" href="#definition-lists" id="id34" name="id34">2.4   Definition Lists</a></li> +<li><a class="reference" href="#field-lists" id="id35" name="id35">2.5   Field Lists</a></li> +<li><a class="reference" href="#option-lists" id="id36" name="id36">2.6   Option Lists</a></li> +<li><a class="reference" href="#literal-blocks" id="id37" name="id37">2.7   Literal Blocks</a></li> +<li><a class="reference" href="#line-blocks" id="id38" name="id38">2.8   Line Blocks</a></li> +<li><a class="reference" href="#block-quotes" id="id39" name="id39">2.9   Block Quotes</a></li> +<li><a class="reference" href="#doctest-blocks" id="id40" name="id40">2.10   Doctest Blocks</a></li> +<li><a class="reference" href="#footnotes" id="id41" name="id41">2.11   Footnotes</a></li> +<li><a class="reference" href="#citations" id="id42" name="id42">2.12   Citations</a></li> +<li><a class="reference" href="#targets" id="id43" name="id43">2.13   Targets</a><ul class="auto-toc"> +<li><a class="reference" href="#duplicate-target-names" id="id44" name="id44">2.13.1   Duplicate Target Names</a></li> +<li><a class="reference" href="#id18" id="id45" name="id45">2.13.2   Duplicate Target Names</a></li> </ul> </li> -<li><a class="reference" href="#directives" id="id45" name="id45">2.14   Directives</a><ul class="auto-toc"> -<li><a class="reference" href="#document-parts" id="id46" name="id46">2.14.1   Document Parts</a></li> -<li><a class="reference" href="#images" id="id47" name="id47">2.14.2   Images</a></li> -<li><a class="reference" href="#admonitions" id="id48" name="id48">2.14.3   Admonitions</a></li> -<li><a class="reference" href="#topics-sidebars-and-rubrics" id="id49" name="id49">2.14.4   Topics, Sidebars, and Rubrics</a></li> -<li><a class="reference" href="#target-footnotes" id="id50" name="id50">2.14.5   Target Footnotes</a></li> -<li><a class="reference" href="#replacement-text" id="id51" name="id51">2.14.6   Replacement Text</a></li> -<li><a class="reference" href="#compound-paragraph" id="id52" name="id52">2.14.7   Compound Paragraph</a></li> +<li><a class="reference" href="#directives" id="id46" name="id46">2.14   Directives</a><ul class="auto-toc"> +<li><a class="reference" href="#document-parts" id="id47" name="id47">2.14.1   Document Parts</a></li> +<li><a class="reference" href="#images" id="id48" name="id48">2.14.2   Images</a></li> +<li><a class="reference" href="#admonitions" id="id49" name="id49">2.14.3   Admonitions</a></li> +<li><a class="reference" href="#topics-sidebars-and-rubrics" id="id50" name="id50">2.14.4   Topics, Sidebars, and Rubrics</a></li> +<li><a class="reference" href="#target-footnotes" id="id51" name="id51">2.14.5   Target Footnotes</a></li> +<li><a class="reference" href="#replacement-text" id="id52" name="id52">2.14.6   Replacement Text</a></li> +<li><a class="reference" href="#compound-paragraph" id="id53" name="id53">2.14.7   Compound Paragraph</a></li> </ul> </li> -<li><a class="reference" href="#substitution-definitions" id="id53" name="id53">2.15   Substitution Definitions</a></li> -<li><a class="reference" href="#comments" id="id54" name="id54">2.16   Comments</a></li> -<li><a class="reference" href="#colspanning-tables" id="id55" name="id55">2.17   Colspanning tables</a></li> -<li><a class="reference" href="#rowspanning-tables" id="id56" name="id56">2.18   Rowspanning tables</a></li> -<li><a class="reference" href="#complex-tables" id="id57" name="id57">2.19   Complex tables</a></li> +<li><a class="reference" href="#substitution-definitions" id="id54" name="id54">2.15   Substitution Definitions</a></li> +<li><a class="reference" href="#comments" id="id55" name="id55">2.16   Comments</a></li> +<li><a class="reference" href="#colspanning-tables" id="id56" name="id56">2.17   Colspanning tables</a></li> +<li><a class="reference" href="#rowspanning-tables" id="id57" name="id57">2.18   Rowspanning tables</a></li> +<li><a class="reference" href="#complex-tables" id="id58" name="id58">2.19   Complex tables</a></li> </ul> </li> -<li><a class="reference" href="#error-handling" id="id58" name="id58">3   Error Handling</a></li> +<li><a class="reference" href="#error-handling" id="id59" name="id59">3   Error Handling</a></li> </ul> </div> <div class="section" id="structural-elements"> @@ -136,20 +137,24 @@ They are transformed from section titles after parsing. --> <h2><a class="toc-backref" href="#id26" name="section-title">1.1   Section Title</a></h2> <p>That's it, the text just above this line.</p> </div> +<div class="section" id="empty-section"> +<h2><a class="toc-backref" href="#id27" name="empty-section">1.2   Empty Section</a></h2> +</div> <div class="section" id="transitions"> -<h2><a class="toc-backref" href="#id27" name="transitions">1.2   Transitions</a></h2> +<h2><a class="toc-backref" href="#id28" name="transitions">1.3   Transitions</a></h2> <p>Here's a transition:</p> <hr class="docutils" /> -<p>It divides the section.</p> +<p>It divides the section. Transitions may also occur between sections:</p> </div> </div> +<hr class="docutils" /> <div class="section" id="body-elements"> -<h1><a class="toc-backref" href="#id28" name="body-elements">2   Body Elements</a></h1> +<h1><a class="toc-backref" href="#id29" name="body-elements">2   Body Elements</a></h1> <div class="section" id="paragraphs"> -<h2><a class="toc-backref" href="#id29" name="paragraphs">2.1   Paragraphs</a></h2> +<h2><a class="toc-backref" href="#id30" name="paragraphs">2.1   Paragraphs</a></h2> <p>A paragraph.</p> <div class="section" id="inline-markup"> -<h3><a class="toc-backref" href="#id30" name="inline-markup">2.1.1   Inline Markup</a></h3> +<h3><a class="toc-backref" href="#id31" name="inline-markup">2.1.1   Inline Markup</a></h3> <p>Paragraphs contain text and may contain inline markup: <em>emphasis</em>, <strong>strong emphasis</strong>, <tt class="docutils literal"><span class="pre">inline</span> <span class="pre">literals</span></tt>, standalone hyperlinks (<a class="reference" href="http://www.python.org">http://www.python.org</a>), external hyperlinks (<a class="reference" href="http://www.python.org/">Python</a> <a class="footnote-reference" href="#id21" id="id22" name="id22">[5]</a>), internal @@ -180,7 +185,7 @@ live link to PEP 258 here.</p> </div> </div> <div class="section" id="bullet-lists"> -<h2><a class="toc-backref" href="#id31" name="bullet-lists">2.2   Bullet Lists</a></h2> +<h2><a class="toc-backref" href="#id32" name="bullet-lists">2.2   Bullet Lists</a></h2> <ul> <li><p class="first">A bullet list</p> <ul class="simple"> @@ -205,7 +210,7 @@ live link to PEP 258 here.</p> </ul> </div> <div class="section" id="enumerated-lists"> -<h2><a class="toc-backref" href="#id32" name="enumerated-lists">2.3   Enumerated Lists</a></h2> +<h2><a class="toc-backref" href="#id33" name="enumerated-lists">2.3   Enumerated Lists</a></h2> <ol class="arabic"> <li><p class="first">Arabic numerals.</p> <ol class="loweralpha simple"> @@ -238,7 +243,7 @@ live link to PEP 258 here.</p> </ol> </div> <div class="section" id="definition-lists"> -<h2><a class="toc-backref" href="#id33" name="definition-lists">2.4   Definition Lists</a></h2> +<h2><a class="toc-backref" href="#id34" name="definition-lists">2.4   Definition Lists</a></h2> <dl class="docutils"> <dt>Term</dt> <dd>Definition</dd> @@ -253,7 +258,7 @@ live link to PEP 258 here.</p> </dl> </div> <div class="section" id="field-lists"> -<h2><a class="toc-backref" href="#id34" name="field-lists">2.5   Field Lists</a></h2> +<h2><a class="toc-backref" href="#id35" name="field-lists">2.5   Field Lists</a></h2> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> @@ -276,7 +281,7 @@ doesn't get stripped away.)</p> </table> </div> <div class="section" id="option-lists"> -<h2><a class="toc-backref" href="#id35" name="option-lists">2.6   Option Lists</a></h2> +<h2><a class="toc-backref" href="#id36" name="option-lists">2.6   Option Lists</a></h2> <p>For listing command-line options:</p> <table class="docutils option-list" frame="void" rules="none"> <col class="option" /> @@ -322,7 +327,7 @@ regardless of where it starts.</p> description.</p> </div> <div class="section" id="literal-blocks"> -<h2><a class="toc-backref" href="#id36" name="literal-blocks">2.7   Literal Blocks</a></h2> +<h2><a class="toc-backref" href="#id37" name="literal-blocks">2.7   Literal Blocks</a></h2> <p>Literal blocks are indicated with a double-colon ("::") at the end of the preceding paragraph (over there <tt class="docutils literal"><span class="pre">--></span></tt>). They can be indented:</p> <pre class="literal-block"> @@ -339,7 +344,7 @@ if literal_block: </pre> </div> <div class="section" id="line-blocks"> -<h2><a class="toc-backref" href="#id37" name="line-blocks">2.8   Line Blocks</a></h2> +<h2><a class="toc-backref" href="#id38" name="line-blocks">2.8   Line Blocks</a></h2> <p>This section tests line blocks. Line blocks are body elements which consist of lines and other line blocks. Nested line blocks cause indentation.</p> @@ -398,7 +403,7 @@ the left edge of the text above it.</div> </blockquote> </div> <div class="section" id="block-quotes"> -<h2><a class="toc-backref" href="#id38" name="block-quotes">2.9   Block Quotes</a></h2> +<h2><a class="toc-backref" href="#id39" name="block-quotes">2.9   Block Quotes</a></h2> <p>Block quotes consist of indented body elements:</p> <blockquote> <p>My theory by A. Elk. Brackets Miss, brackets. This theory goes @@ -410,7 +415,7 @@ own it, and what it is too.</p> </blockquote> </div> <div class="section" id="doctest-blocks"> -<h2><a class="toc-backref" href="#id39" name="doctest-blocks">2.10   Doctest Blocks</a></h2> +<h2><a class="toc-backref" href="#id40" name="doctest-blocks">2.10   Doctest Blocks</a></h2> <pre class="doctest-block"> >>> print 'Python-specific usage examples; begun with ">>>"' Python-specific usage examples; begun with ">>>" @@ -419,7 +424,7 @@ Python-specific usage examples; begun with ">>>" </pre> </div> <div class="section" id="footnotes"> -<h2><a class="toc-backref" href="#id40" name="footnotes">2.11   Footnotes</a></h2> +<h2><a class="toc-backref" href="#id41" name="footnotes">2.11   Footnotes</a></h2> <table class="docutils footnote" frame="void" id="id6" rules="none"> <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> @@ -466,12 +471,12 @@ Here's a reference to the next footnote: <a class="footnote-reference" href="#id <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> <tr><td class="label"><a name="id13">[4]</a></td><td>Here's an unreferenced footnote, with a reference to a -nonexistent footnote: <a href="#id66" name="id67"><span class="problematic" id="id67">[5]_</span></a>.</td></tr> +nonexistent footnote: <a href="#id67" name="id68"><span class="problematic" id="id68">[5]_</span></a>.</td></tr> </tbody> </table> </div> <div class="section" id="citations"> -<h2><a class="toc-backref" href="#id41" name="citations">2.12   Citations</a></h2> +<h2><a class="toc-backref" href="#id42" name="citations">2.12   Citations</a></h2> <table class="docutils citation" frame="void" id="cit2002" rules="none"> <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> @@ -479,11 +484,11 @@ nonexistent footnote: <a href="#id66" name="id67"><span class="problematic" id=" rendered separately and differently from footnotes.</td></tr> </tbody> </table> -<p>Here's a reference to the above, <a class="citation-reference" href="#cit2002" id="id15" name="id15">[CIT2002]</a>, and a <a href="#id68" name="id69"><span class="problematic" id="id69">[nonexistent]_</span></a> +<p>Here's a reference to the above, <a class="citation-reference" href="#cit2002" id="id15" name="id15">[CIT2002]</a>, and a <a href="#id69" name="id70"><span class="problematic" id="id70">[nonexistent]_</span></a> citation.</p> </div> <div class="section" id="targets"> -<h2><a class="toc-backref" href="#id42" name="targets">2.13   Targets</a></h2> +<h2><a class="toc-backref" href="#id43" name="targets">2.13   Targets</a></h2> <a class="target" id="example" name="example"></a><p>This paragraph is pointed to by the explicit "example" target. A reference can be found under <a class="reference" href="#inline-markup">Inline Markup</a>, above. <a class="reference" href="#inline-hyperlink-targets">Inline hyperlink targets</a> are also possible.</p> @@ -493,45 +498,45 @@ hyperlink targets</a> are also possible.</p> "<a class="reference" href="http://www.python.org/">Python</a> <a class="footnote-reference" href="#id21" id="id23" name="id23">[5]</a>".</p> <p>Targets may be indirect and anonymous. Thus <a class="reference" href="#targets">this phrase</a> may also refer to the <a class="reference" href="#targets">Targets</a> section.</p> -<p>Here's a <a href="#id70" name="id71"><span class="problematic" id="id71">`hyperlink reference without a target`_</span></a>, which generates an +<p>Here's a <a href="#id71" name="id72"><span class="problematic" id="id72">`hyperlink reference without a target`_</span></a>, which generates an error.</p> <div class="section" id="duplicate-target-names"> -<h3><a class="toc-backref" href="#id43" name="duplicate-target-names">2.13.1   Duplicate Target Names</a></h3> +<h3><a class="toc-backref" href="#id44" name="duplicate-target-names">2.13.1   Duplicate Target Names</a></h3> <p>Duplicate names in section headers or other implicit targets will generate "info" (level-1) system messages. Duplicate names in explicit targets will generate "warning" (level-2) system messages.</p> </div> <div class="section" id="id18"> -<h3><a class="toc-backref" href="#id44" name="id18">2.13.2   Duplicate Target Names</a></h3> +<h3><a class="toc-backref" href="#id45" name="id18">2.13.2   Duplicate Target Names</a></h3> <p>Since there are two "Duplicate Target Names" section headers, we cannot uniquely refer to either of them by name. If we try to (like -this: <a href="#id72" name="id73"><span class="problematic" id="id73">`Duplicate Target Names`_</span></a>), an error is generated.</p> +this: <a href="#id73" name="id74"><span class="problematic" id="id74">`Duplicate Target Names`_</span></a>), an error is generated.</p> </div> </div> <div class="section" id="directives"> -<h2><a class="toc-backref" href="#id45" name="directives">2.14   Directives</a></h2> +<h2><a class="toc-backref" href="#id46" name="directives">2.14   Directives</a></h2> <div class="contents topic" id="contents"> <ul class="auto-toc simple"> -<li><a class="reference" href="#document-parts" id="id59" name="id59">2.14.1   Document Parts</a></li> -<li><a class="reference" href="#images" id="id60" name="id60">2.14.2   Images</a></li> -<li><a class="reference" href="#admonitions" id="id61" name="id61">2.14.3   Admonitions</a></li> -<li><a class="reference" href="#topics-sidebars-and-rubrics" id="id62" name="id62">2.14.4   Topics, Sidebars, and Rubrics</a></li> -<li><a class="reference" href="#target-footnotes" id="id63" name="id63">2.14.5   Target Footnotes</a></li> -<li><a class="reference" href="#replacement-text" id="id64" name="id64">2.14.6   Replacement Text</a></li> -<li><a class="reference" href="#compound-paragraph" id="id65" name="id65">2.14.7   Compound Paragraph</a></li> +<li><a class="reference" href="#document-parts" id="id60" name="id60">2.14.1   Document Parts</a></li> +<li><a class="reference" href="#images" id="id61" name="id61">2.14.2   Images</a></li> +<li><a class="reference" href="#admonitions" id="id62" name="id62">2.14.3   Admonitions</a></li> +<li><a class="reference" href="#topics-sidebars-and-rubrics" id="id63" name="id63">2.14.4   Topics, Sidebars, and Rubrics</a></li> +<li><a class="reference" href="#target-footnotes" id="id64" name="id64">2.14.5   Target Footnotes</a></li> +<li><a class="reference" href="#replacement-text" id="id65" name="id65">2.14.6   Replacement Text</a></li> +<li><a class="reference" href="#compound-paragraph" id="id66" name="id66">2.14.7   Compound Paragraph</a></li> </ul> </div> <p>These are just a sample of the many reStructuredText Directives. For others, please see <a class="reference" href="http://docutils.sourceforge.net/docs/ref/rst/directives.html">http://docutils.sourceforge.net/docs/ref/rst/directives.html</a>.</p> <div class="section" id="document-parts"> -<h3><a class="toc-backref" href="#id59" name="document-parts">2.14.1   Document Parts</a></h3> +<h3><a class="toc-backref" href="#id60" name="document-parts">2.14.1   Document Parts</a></h3> <p>An example of the "contents" directive can be seen above this section (a local, untitled table of <a class="reference" href="#contents">contents</a>) and at the beginning of the document (a document-wide <a class="reference" href="#table-of-contents">table of contents</a>).</p> </div> <div class="section" id="images"> -<h3><a class="toc-backref" href="#id60" name="images">2.14.2   Images</a></h3> +<h3><a class="toc-backref" href="#id61" name="images">2.14.2   Images</a></h3> <p>An image directive (also clickable -- a hyperlink reference):</p> <p><a class="reference" href="#directives"><img alt="../../../docs/user/rst/images/title.png" src="../../../docs/user/rst/images/title.png" /></a></p> <p>A figure directive:</p> @@ -561,7 +566,7 @@ document (a document-wide <a class="reference" href="#table-of-contents">table o </div> </div> <div class="section" id="admonitions"> -<h3><a class="toc-backref" href="#id61" name="admonitions">2.14.3   Admonitions</a></h3> +<h3><a class="toc-backref" href="#id62" name="admonitions">2.14.3   Admonitions</a></h3> <div class="attention"> <p class="first admonition-title">Attention!</p> <p class="last">Directives at large.</p> @@ -610,7 +615,7 @@ Reader discretion is strongly advised.</p> </div> </div> <div class="section" id="topics-sidebars-and-rubrics"> -<h3><a class="toc-backref" href="#id62" name="topics-sidebars-and-rubrics">2.14.4   Topics, Sidebars, and Rubrics</a></h3> +<h3><a class="toc-backref" href="#id63" name="topics-sidebars-and-rubrics">2.14.4   Topics, Sidebars, and Rubrics</a></h3> <div class="sidebar"> <p class="first sidebar-title">Sidebar Title</p> <p class="sidebar-subtitle">Optional Subtitle</p> @@ -627,7 +632,7 @@ background color.</p> <p class="rubric">This is a rubric</p> </div> <div class="section" id="target-footnotes"> -<h3><a class="toc-backref" href="#id63" name="target-footnotes">2.14.5   Target Footnotes</a></h3> +<h3><a class="toc-backref" href="#id64" name="target-footnotes">2.14.5   Target Footnotes</a></h3> <table class="docutils footnote" frame="void" id="id21" rules="none"> <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> @@ -636,11 +641,11 @@ background color.</p> </table> </div> <div class="section" id="replacement-text"> -<h3><a class="toc-backref" href="#id64" name="replacement-text">2.14.6   Replacement Text</a></h3> +<h3><a class="toc-backref" href="#id65" name="replacement-text">2.14.6   Replacement Text</a></h3> <p>I recommend you try <a class="reference" href="http://www.python.org/">Python, <em>the</em> best language around</a> <a class="footnote-reference" href="#id21" id="id24" name="id24">[5]</a>.</p> </div> <div class="section" id="compound-paragraph"> -<h3><a class="toc-backref" href="#id65" name="compound-paragraph">2.14.7   Compound Paragraph</a></h3> +<h3><a class="toc-backref" href="#id66" name="compound-paragraph">2.14.7   Compound Paragraph</a></h3> <div class="some-class compound"> <p class="compound-first">Compound 1, paragraph 1.</p> <p class="compound-middle">Compound 1, paragraph 2.</p> @@ -708,12 +713,12 @@ paragraph.</td> </div> </div> <div class="section" id="substitution-definitions"> -<h2><a class="toc-backref" href="#id53" name="substitution-definitions">2.15   Substitution Definitions</a></h2> +<h2><a class="toc-backref" href="#id54" name="substitution-definitions">2.15   Substitution Definitions</a></h2> <p>An inline image (<img alt="EXAMPLE" src="../../../docs/user/rst/images/biohazard.png" />) example:</p> <p>(Substitution definitions are not visible in the HTML source.)</p> </div> <div class="section" id="comments"> -<h2><a class="toc-backref" href="#id54" name="comments">2.16   Comments</a></h2> +<h2><a class="toc-backref" href="#id55" name="comments">2.16   Comments</a></h2> <p>Here's one:</p> <!-- Comments begin with two dots and a space. Anything may follow, except for the syntax of footnotes, hyperlink @@ -723,7 +728,7 @@ Double-dashes - - "- -" - - must be escaped somehow in HTML output. --> <p>(View the HTML source to see the comment.)</p> </div> <div class="section" id="colspanning-tables"> -<h2><a class="toc-backref" href="#id55" name="colspanning-tables">2.17   Colspanning tables</a></h2> +<h2><a class="toc-backref" href="#id56" name="colspanning-tables">2.17   Colspanning tables</a></h2> <p>This table has a cell spanning two columns:</p> <table border="1" class="docutils"> <colgroup> @@ -761,7 +766,7 @@ Double-dashes - - "- -" - - must be escaped somehow in HTML output. --> </table> </div> <div class="section" id="rowspanning-tables"> -<h2><a class="toc-backref" href="#id56" name="rowspanning-tables">2.18   Rowspanning tables</a></h2> +<h2><a class="toc-backref" href="#id57" name="rowspanning-tables">2.18   Rowspanning tables</a></h2> <p>Here's a table with cells spanning several rows:</p> <table border="1" class="docutils"> <colgroup> @@ -797,7 +802,7 @@ span rows.</td> </table> </div> <div class="section" id="complex-tables"> -<h2><a class="toc-backref" href="#id57" name="complex-tables">2.19   Complex tables</a></h2> +<h2><a class="toc-backref" href="#id58" name="complex-tables">2.19   Complex tables</a></h2> <p>Here's a complex table, which should test all features.</p> <table border="1" class="docutils"> <colgroup> @@ -847,7 +852,7 @@ empty: <tt class="docutils literal"><span class="pre">--></span></tt></td> </div> </div> <div class="section" id="error-handling"> -<h1><a class="toc-backref" href="#id58" name="error-handling">3   Error Handling</a></h1> +<h1><a class="toc-backref" href="#id59" name="error-handling">3   Error Handling</a></h1> <p>Any errors caught during processing will generate system messages.</p> <p>There should be five messages in the following, auto-generated section, "Docutils System Messages":</p> @@ -856,19 +861,19 @@ section, "Docutils System Messages":</p> <div class="system-messages section"> <h1><a>Docutils System Messages</a></h1> <div class="system-message" id="id19"> -<p class="system-message-title">System Message: <a name="id19">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 89); <em><a href="#id20">backlink</a></em></p> +<p class="system-message-title">System Message: <a name="id19">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 94); <em><a href="#id20">backlink</a></em></p> Undefined substitution referenced: "problematic".</div> -<div class="system-message" id="id66"> -<p class="system-message-title">System Message: <a name="id66">ERROR/3</a> (<tt class="docutils">functional/input/standalone_rst_html4css1.txt</tt>, line 343); <em><a href="#id67">backlink</a></em></p> +<div class="system-message" id="id67"> +<p class="system-message-title">System Message: <a name="id67">ERROR/3</a> (<tt class="docutils">functional/input/standalone_rst_html4css1.txt</tt>, line 348); <em><a href="#id68">backlink</a></em></p> Unknown target name: "5".</div> -<div class="system-message" id="id68"> -<p class="system-message-title">System Message: <a name="id68">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 352); <em><a href="#id69">backlink</a></em></p> +<div class="system-message" id="id69"> +<p class="system-message-title">System Message: <a name="id69">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 357); <em><a href="#id70">backlink</a></em></p> Unknown target name: "nonexistent".</div> -<div class="system-message" id="id70"> -<p class="system-message-title">System Message: <a name="id70">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 377); <em><a href="#id71">backlink</a></em></p> +<div class="system-message" id="id71"> +<p class="system-message-title">System Message: <a name="id71">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 382); <em><a href="#id72">backlink</a></em></p> Unknown target name: "hyperlink reference without a target".</div> -<div class="system-message" id="id72"> -<p class="system-message-title">System Message: <a name="id72">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 390); <em><a href="#id73">backlink</a></em></p> +<div class="system-message" id="id73"> +<p class="system-message-title">System Message: <a name="id73">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 395); <em><a href="#id74">backlink</a></em></p> Duplicate target name, cannot be used as a unique reference: "duplicate target names".</div> </div> </div> diff --git a/test/functional/expected/standalone_rst_latex.tex b/test/functional/expected/standalone_rst_latex.tex index 5770de317..ed51f30ea 100644 --- a/test/functional/expected/standalone_rst_latex.tex +++ b/test/functional/expected/standalone_rst_latex.tex @@ -138,7 +138,9 @@ reStructuredText construct. \begin{list}{}{} \item {} \href{\#section-title}{1.1~~~Section Title} -\item {} \href{\#transitions}{1.2~~~Transitions} +\item {} \href{\#empty-section}{1.2~~~Empty Section} + +\item {} \href{\#transitions}{1.3~~~Transitions} \end{list} @@ -236,11 +238,18 @@ reStructuredText construct. That's it, the text just above this line. +%___________________________________________________________________________ + +\hypertarget{empty-section}{} +\pdfbookmark[1]{1.2~~~Empty Section}{empty-section} +\subsection*{1.2~~~Empty Section} + + %___________________________________________________________________________ \hypertarget{transitions}{} -\pdfbookmark[1]{1.2~~~Transitions}{transitions} -\subsection*{1.2~~~Transitions} +\pdfbookmark[1]{1.3~~~Transitions}{transitions} +\subsection*{1.3~~~Transitions} Here's a transition: @@ -249,7 +258,12 @@ Here's a transition: \hspace*{\fill}\hrulefill\hspace*{\fill} -It divides the section. +It divides the section. Transitions may also occur between sections: + + +%___________________________________________________________________________ +\hspace*{\fill}\hrulefill\hspace*{\fill} + %___________________________________________________________________________ diff --git a/test/functional/input/data/standard.txt b/test/functional/input/data/standard.txt index fcf3c7ad8..a8d773242 100644 --- a/test/functional/input/data/standard.txt +++ b/test/functional/input/data/standard.txt @@ -64,6 +64,9 @@ Section Title That's it, the text just above this line. +Empty Section +------------- + Transitions ----------- @@ -71,7 +74,9 @@ Here's a transition: --------- -It divides the section. +It divides the section. Transitions may also occur between sections: + +--------- Body Elements ============= -- cgit v1.2.1 From f294c8b62d8df782bd8dba3ca26a7fca08ad2050 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Fri, 26 Nov 2004 16:51:46 +0000 Subject: added test for ``raw`` role and directive git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2874 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../expected/standalone_rst_html4css1.html | 75 ++++++++++++---------- test/functional/expected/standalone_rst_latex.tex | 21 +++++- test/functional/input/data/standard.txt | 35 ++++++++++ 3 files changed, 94 insertions(+), 37 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index 1e8140686..009a8f482 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -123,12 +123,13 @@ They are transformed from section titles after parsing. --> </li> <li><a class="reference" href="#substitution-definitions" id="id54" name="id54">2.15   Substitution Definitions</a></li> <li><a class="reference" href="#comments" id="id55" name="id55">2.16   Comments</a></li> -<li><a class="reference" href="#colspanning-tables" id="id56" name="id56">2.17   Colspanning tables</a></li> -<li><a class="reference" href="#rowspanning-tables" id="id57" name="id57">2.18   Rowspanning tables</a></li> -<li><a class="reference" href="#complex-tables" id="id58" name="id58">2.19   Complex tables</a></li> +<li><a class="reference" href="#raw-text" id="id56" name="id56">2.17   Raw text</a></li> +<li><a class="reference" href="#colspanning-tables" id="id57" name="id57">2.18   Colspanning tables</a></li> +<li><a class="reference" href="#rowspanning-tables" id="id58" name="id58">2.19   Rowspanning tables</a></li> +<li><a class="reference" href="#complex-tables" id="id59" name="id59">2.20   Complex tables</a></li> </ul> </li> -<li><a class="reference" href="#error-handling" id="id59" name="id59">3   Error Handling</a></li> +<li><a class="reference" href="#error-handling" id="id60" name="id60">3   Error Handling</a></li> </ul> </div> <div class="section" id="structural-elements"> @@ -471,7 +472,7 @@ Here's a reference to the next footnote: <a class="footnote-reference" href="#id <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> <tr><td class="label"><a name="id13">[4]</a></td><td>Here's an unreferenced footnote, with a reference to a -nonexistent footnote: <a href="#id67" name="id68"><span class="problematic" id="id68">[5]_</span></a>.</td></tr> +nonexistent footnote: <a href="#id68" name="id69"><span class="problematic" id="id69">[5]_</span></a>.</td></tr> </tbody> </table> </div> @@ -484,7 +485,7 @@ nonexistent footnote: <a href="#id67" name="id68"><span class="problematic" id=" rendered separately and differently from footnotes.</td></tr> </tbody> </table> -<p>Here's a reference to the above, <a class="citation-reference" href="#cit2002" id="id15" name="id15">[CIT2002]</a>, and a <a href="#id69" name="id70"><span class="problematic" id="id70">[nonexistent]_</span></a> +<p>Here's a reference to the above, <a class="citation-reference" href="#cit2002" id="id15" name="id15">[CIT2002]</a>, and a <a href="#id70" name="id71"><span class="problematic" id="id71">[nonexistent]_</span></a> citation.</p> </div> <div class="section" id="targets"> @@ -498,7 +499,7 @@ hyperlink targets</a> are also possible.</p> "<a class="reference" href="http://www.python.org/">Python</a> <a class="footnote-reference" href="#id21" id="id23" name="id23">[5]</a>".</p> <p>Targets may be indirect and anonymous. Thus <a class="reference" href="#targets">this phrase</a> may also refer to the <a class="reference" href="#targets">Targets</a> section.</p> -<p>Here's a <a href="#id71" name="id72"><span class="problematic" id="id72">`hyperlink reference without a target`_</span></a>, which generates an +<p>Here's a <a href="#id72" name="id73"><span class="problematic" id="id73">`hyperlink reference without a target`_</span></a>, which generates an error.</p> <div class="section" id="duplicate-target-names"> <h3><a class="toc-backref" href="#id44" name="duplicate-target-names">2.13.1   Duplicate Target Names</a></h3> @@ -510,33 +511,33 @@ explicit targets will generate "warning" (level-2) system messages.</p <h3><a class="toc-backref" href="#id45" name="id18">2.13.2   Duplicate Target Names</a></h3> <p>Since there are two "Duplicate Target Names" section headers, we cannot uniquely refer to either of them by name. If we try to (like -this: <a href="#id73" name="id74"><span class="problematic" id="id74">`Duplicate Target Names`_</span></a>), an error is generated.</p> +this: <a href="#id74" name="id75"><span class="problematic" id="id75">`Duplicate Target Names`_</span></a>), an error is generated.</p> </div> </div> <div class="section" id="directives"> <h2><a class="toc-backref" href="#id46" name="directives">2.14   Directives</a></h2> <div class="contents topic" id="contents"> <ul class="auto-toc simple"> -<li><a class="reference" href="#document-parts" id="id60" name="id60">2.14.1   Document Parts</a></li> -<li><a class="reference" href="#images" id="id61" name="id61">2.14.2   Images</a></li> -<li><a class="reference" href="#admonitions" id="id62" name="id62">2.14.3   Admonitions</a></li> -<li><a class="reference" href="#topics-sidebars-and-rubrics" id="id63" name="id63">2.14.4   Topics, Sidebars, and Rubrics</a></li> -<li><a class="reference" href="#target-footnotes" id="id64" name="id64">2.14.5   Target Footnotes</a></li> -<li><a class="reference" href="#replacement-text" id="id65" name="id65">2.14.6   Replacement Text</a></li> -<li><a class="reference" href="#compound-paragraph" id="id66" name="id66">2.14.7   Compound Paragraph</a></li> +<li><a class="reference" href="#document-parts" id="id61" name="id61">2.14.1   Document Parts</a></li> +<li><a class="reference" href="#images" id="id62" name="id62">2.14.2   Images</a></li> +<li><a class="reference" href="#admonitions" id="id63" name="id63">2.14.3   Admonitions</a></li> +<li><a class="reference" href="#topics-sidebars-and-rubrics" id="id64" name="id64">2.14.4   Topics, Sidebars, and Rubrics</a></li> +<li><a class="reference" href="#target-footnotes" id="id65" name="id65">2.14.5   Target Footnotes</a></li> +<li><a class="reference" href="#replacement-text" id="id66" name="id66">2.14.6   Replacement Text</a></li> +<li><a class="reference" href="#compound-paragraph" id="id67" name="id67">2.14.7   Compound Paragraph</a></li> </ul> </div> <p>These are just a sample of the many reStructuredText Directives. For others, please see <a class="reference" href="http://docutils.sourceforge.net/docs/ref/rst/directives.html">http://docutils.sourceforge.net/docs/ref/rst/directives.html</a>.</p> <div class="section" id="document-parts"> -<h3><a class="toc-backref" href="#id60" name="document-parts">2.14.1   Document Parts</a></h3> +<h3><a class="toc-backref" href="#id61" name="document-parts">2.14.1   Document Parts</a></h3> <p>An example of the "contents" directive can be seen above this section (a local, untitled table of <a class="reference" href="#contents">contents</a>) and at the beginning of the document (a document-wide <a class="reference" href="#table-of-contents">table of contents</a>).</p> </div> <div class="section" id="images"> -<h3><a class="toc-backref" href="#id61" name="images">2.14.2   Images</a></h3> +<h3><a class="toc-backref" href="#id62" name="images">2.14.2   Images</a></h3> <p>An image directive (also clickable -- a hyperlink reference):</p> <p><a class="reference" href="#directives"><img alt="../../../docs/user/rst/images/title.png" src="../../../docs/user/rst/images/title.png" /></a></p> <p>A figure directive:</p> @@ -566,7 +567,7 @@ document (a document-wide <a class="reference" href="#table-of-contents">table o </div> </div> <div class="section" id="admonitions"> -<h3><a class="toc-backref" href="#id62" name="admonitions">2.14.3   Admonitions</a></h3> +<h3><a class="toc-backref" href="#id63" name="admonitions">2.14.3   Admonitions</a></h3> <div class="attention"> <p class="first admonition-title">Attention!</p> <p class="last">Directives at large.</p> @@ -615,7 +616,7 @@ Reader discretion is strongly advised.</p> </div> </div> <div class="section" id="topics-sidebars-and-rubrics"> -<h3><a class="toc-backref" href="#id63" name="topics-sidebars-and-rubrics">2.14.4   Topics, Sidebars, and Rubrics</a></h3> +<h3><a class="toc-backref" href="#id64" name="topics-sidebars-and-rubrics">2.14.4   Topics, Sidebars, and Rubrics</a></h3> <div class="sidebar"> <p class="first sidebar-title">Sidebar Title</p> <p class="sidebar-subtitle">Optional Subtitle</p> @@ -632,7 +633,7 @@ background color.</p> <p class="rubric">This is a rubric</p> </div> <div class="section" id="target-footnotes"> -<h3><a class="toc-backref" href="#id64" name="target-footnotes">2.14.5   Target Footnotes</a></h3> +<h3><a class="toc-backref" href="#id65" name="target-footnotes">2.14.5   Target Footnotes</a></h3> <table class="docutils footnote" frame="void" id="id21" rules="none"> <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> @@ -641,11 +642,11 @@ background color.</p> </table> </div> <div class="section" id="replacement-text"> -<h3><a class="toc-backref" href="#id65" name="replacement-text">2.14.6   Replacement Text</a></h3> +<h3><a class="toc-backref" href="#id66" name="replacement-text">2.14.6   Replacement Text</a></h3> <p>I recommend you try <a class="reference" href="http://www.python.org/">Python, <em>the</em> best language around</a> <a class="footnote-reference" href="#id21" id="id24" name="id24">[5]</a>.</p> </div> <div class="section" id="compound-paragraph"> -<h3><a class="toc-backref" href="#id66" name="compound-paragraph">2.14.7   Compound Paragraph</a></h3> +<h3><a class="toc-backref" href="#id67" name="compound-paragraph">2.14.7   Compound Paragraph</a></h3> <div class="some-class compound"> <p class="compound-first">Compound 1, paragraph 1.</p> <p class="compound-middle">Compound 1, paragraph 2.</p> @@ -727,8 +728,14 @@ targets, directives, or substitution definitions. Double-dashes - - "- -" - - must be escaped somehow in HTML output. --> <p>(View the HTML source to see the comment.)</p> </div> +<div class="section" id="raw-text"> +<h2><a class="toc-backref" href="#id56" name="raw-text">2.17   Raw text</a></h2> +<p>This does not necessarily look nice, because there may be missing white space.</p> +<p>It's just there to freeze the behavior.</p> +A test.Second test.<div class="myclass">Another test with myclass set.</div><p>This is the <span class="myrawroleclass">fourth test</span> with myrawroleclass set.</p> +Fifth test in HTML.<br />Line two.</div> <div class="section" id="colspanning-tables"> -<h2><a class="toc-backref" href="#id56" name="colspanning-tables">2.17   Colspanning tables</a></h2> +<h2><a class="toc-backref" href="#id57" name="colspanning-tables">2.18   Colspanning tables</a></h2> <p>This table has a cell spanning two columns:</p> <table border="1" class="docutils"> <colgroup> @@ -766,7 +773,7 @@ Double-dashes - - "- -" - - must be escaped somehow in HTML output. --> </table> </div> <div class="section" id="rowspanning-tables"> -<h2><a class="toc-backref" href="#id57" name="rowspanning-tables">2.18   Rowspanning tables</a></h2> +<h2><a class="toc-backref" href="#id58" name="rowspanning-tables">2.19   Rowspanning tables</a></h2> <p>Here's a table with cells spanning several rows:</p> <table border="1" class="docutils"> <colgroup> @@ -802,7 +809,7 @@ span rows.</td> </table> </div> <div class="section" id="complex-tables"> -<h2><a class="toc-backref" href="#id58" name="complex-tables">2.19   Complex tables</a></h2> +<h2><a class="toc-backref" href="#id59" name="complex-tables">2.20   Complex tables</a></h2> <p>Here's a complex table, which should test all features.</p> <table border="1" class="docutils"> <colgroup> @@ -852,7 +859,7 @@ empty: <tt class="docutils literal"><span class="pre">--></span></tt></td> </div> </div> <div class="section" id="error-handling"> -<h1><a class="toc-backref" href="#id59" name="error-handling">3   Error Handling</a></h1> +<h1><a class="toc-backref" href="#id60" name="error-handling">3   Error Handling</a></h1> <p>Any errors caught during processing will generate system messages.</p> <p>There should be five messages in the following, auto-generated section, "Docutils System Messages":</p> @@ -863,17 +870,17 @@ section, "Docutils System Messages":</p> <div class="system-message" id="id19"> <p class="system-message-title">System Message: <a name="id19">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 94); <em><a href="#id20">backlink</a></em></p> Undefined substitution referenced: "problematic".</div> -<div class="system-message" id="id67"> -<p class="system-message-title">System Message: <a name="id67">ERROR/3</a> (<tt class="docutils">functional/input/standalone_rst_html4css1.txt</tt>, line 348); <em><a href="#id68">backlink</a></em></p> +<div class="system-message" id="id68"> +<p class="system-message-title">System Message: <a name="id68">ERROR/3</a> (<tt class="docutils">functional/input/standalone_rst_html4css1.txt</tt>, line 348); <em><a href="#id69">backlink</a></em></p> Unknown target name: "5".</div> -<div class="system-message" id="id69"> -<p class="system-message-title">System Message: <a name="id69">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 357); <em><a href="#id70">backlink</a></em></p> +<div class="system-message" id="id70"> +<p class="system-message-title">System Message: <a name="id70">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 357); <em><a href="#id71">backlink</a></em></p> Unknown target name: "nonexistent".</div> -<div class="system-message" id="id71"> -<p class="system-message-title">System Message: <a name="id71">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 382); <em><a href="#id72">backlink</a></em></p> +<div class="system-message" id="id72"> +<p class="system-message-title">System Message: <a name="id72">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 382); <em><a href="#id73">backlink</a></em></p> Unknown target name: "hyperlink reference without a target".</div> -<div class="system-message" id="id73"> -<p class="system-message-title">System Message: <a name="id73">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 395); <em><a href="#id74">backlink</a></em></p> +<div class="system-message" id="id74"> +<p class="system-message-title">System Message: <a name="id74">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 395); <em><a href="#id75">backlink</a></em></p> Duplicate target name, cannot be used as a unique reference: "duplicate target names".</div> </div> </div> diff --git a/test/functional/expected/standalone_rst_latex.tex b/test/functional/expected/standalone_rst_latex.tex index ed51f30ea..19f52406f 100644 --- a/test/functional/expected/standalone_rst_latex.tex +++ b/test/functional/expected/standalone_rst_latex.tex @@ -204,7 +204,9 @@ reStructuredText construct. \item {} \href{\#comments}{2.16~~~Comments} -\item {} \href{\#colspanning-tables}{2.17~~~Colspanning tables} +\item {} \href{\#raw-text}{2.17~~~Raw text} + +\item {} \href{\#colspanning-tables}{2.18~~~Colspanning tables} \end{list} @@ -1151,11 +1153,24 @@ Here's one: (View the HTML source to see the comment.) +%___________________________________________________________________________ + +\hypertarget{raw-text}{} +\pdfbookmark[1]{2.17~~~Raw text}{raw-text} +\subsection*{2.17~~~Raw text} + +This does not necessarily look nice, because there may be missing white space. + +It's just there to freeze the behavior. +A test.Second test.Another test with myclass set. +This is the fourth test with myrawroleclass set. +Fifth test in LaTeX.\\Line two. + %___________________________________________________________________________ \hypertarget{colspanning-tables}{} -\pdfbookmark[1]{2.17~~~Colspanning tables}{colspanning-tables} -\subsection*{2.17~~~Colspanning tables} +\pdfbookmark[1]{2.18~~~Colspanning tables}{colspanning-tables} +\subsection*{2.18~~~Colspanning tables} This table has a cell spanning two columns: diff --git a/test/functional/input/data/standard.txt b/test/functional/input/data/standard.txt index a8d773242..69afbbc67 100644 --- a/test/functional/input/data/standard.txt +++ b/test/functional/input/data/standard.txt @@ -588,3 +588,38 @@ Here's one: Double-dashes -- "--" -- must be escaped somehow in HTML output. (View the HTML source to see the comment.) + +Raw text +-------- + +This does not necessarily look nice, because there may be missing white space. + +It's just there to freeze the behavior. + +.. raw:: html latex + + A test. + +.. raw:: html latex + + Second test. + +.. class:: myclass + +.. raw:: html latex + + Another test with myclass set. + +.. role:: raw-role(raw) + :format: html latex + :class: myrawroleclass + +This is the :raw-role:`fourth test` with myrawroleclass set. + +.. raw:: html + + Fifth test in HTML.<br />Line two. + +.. raw:: latex + + Fifth test in LaTeX.\\Line two. -- cgit v1.2.1 From f6253be6f54c20dbb4a65fa7c03d27c510299ebb Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Thu, 23 Dec 2004 16:34:24 +0000 Subject: added text about using the unicode directive for en and em dashes git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2888 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/alltests.py | 2 +- test/functional/expected/standalone_rst_html4css1.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/alltests.py b/test/alltests.py index ecd950853..7c31c4623 100755 --- a/test/alltests.py +++ b/test/alltests.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env py4123 # Author: David Goodger # Contact: goodger@users.sourceforge.net diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index 009a8f482..13ed5d5b8 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -3,7 +3,7 @@ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> -<meta name="generator" content="Docutils 0.3.6: http://docutils.sourceforge.net/" /> +<meta name="generator" content="Docutils 0.3.7: http://docutils.sourceforge.net/" /> <title>reStructuredText Test Document -- cgit v1.2.1 From 58f039b55de17ed6b25baa7902b7ea1dcbb7b598 Mon Sep 17 00:00:00 2001 From: wiemann Date: Thu, 23 Dec 2004 16:40:35 +0000 Subject: reverted accidentally committed files; sorry git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2889 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/alltests.py | 2 +- test/functional/expected/standalone_rst_html4css1.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/alltests.py b/test/alltests.py index 7c31c4623..ecd950853 100755 --- a/test/alltests.py +++ b/test/alltests.py @@ -1,4 +1,4 @@ -#!/usr/bin/env py4123 +#!/usr/bin/env python # Author: David Goodger # Contact: goodger@users.sourceforge.net diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index 13ed5d5b8..009a8f482 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -3,7 +3,7 @@ - + reStructuredText Test Document -- cgit v1.2.1 From 16285d9ba32a086ce2f12c1af08b844cba7339ca Mon Sep 17 00:00:00 2001 From: wiemann Date: Thu, 23 Dec 2004 23:04:11 +0000 Subject: Release 0.4.0: set version number to 0.4.0 git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2894 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_html4css1.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index 009a8f482..cd4bc96b7 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -3,7 +3,7 @@ - + reStructuredText Test Document -- cgit v1.2.1 From 825684c2919c06fd9bc2208aa135f5d79fa6e948 Mon Sep 17 00:00:00 2001 From: wiemann Date: Thu, 23 Dec 2004 23:29:16 +0000 Subject: applied David Goodger's patch from http://article.gmane.org/gmane.text.docutils.devel/2487 git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2896 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_html4css1.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index cd4bc96b7..9b3311ef1 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -17,6 +17,7 @@ +

reStructuredText Test Document

Examples of Syntax Constructs

@@ -66,7 +67,6 @@ desires.
-

Dedication

For Docutils users & co-developers.

@@ -539,10 +539,10 @@ document (a document-wide table o

2.14.2   Images

An image directive (also clickable -- a hyperlink reference):

-

../../../docs/user/rst/images/title.png

+
../../../docs/user/rst/images/title.png

A figure directive:

-

reStructuredText, the markup syntax

+
reStructuredText, the markup syntax

A figure is an image with a caption and/or a legend:

-- cgit v1.2.1 From 740682332c3a17b86db19fa219a99e44e74e24af Mon Sep 17 00:00:00 2001 From: wiemann Date: Thu, 23 Dec 2004 23:39:15 +0000 Subject: Release 0.3.7: set version number to 0.3.7 git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2897 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_html4css1.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index 9b3311ef1..2ecffa4f5 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -3,7 +3,7 @@ - + reStructuredText Test Document -- cgit v1.2.1 From 80af2e1d0332485531d35a433d680279ff82b047 Mon Sep 17 00:00:00 2001 From: wiemann Date: Fri, 24 Dec 2004 00:19:35 +0000 Subject: changed release day; added history entries for David's patch git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2899 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/alltests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/alltests.py b/test/alltests.py index ecd950853..7c31c4623 100755 --- a/test/alltests.py +++ b/test/alltests.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env py4123 # Author: David Goodger # Contact: goodger@users.sourceforge.net -- cgit v1.2.1 From b01fbaea218a0409bf63e5d4ef62737f3ab35582 Mon Sep 17 00:00:00 2001 From: wiemann Date: Fri, 24 Dec 2004 00:22:46 +0000 Subject: Gee; again an accidental checkin. (docs/dev/release.txt was also accidentally checked in, but that's OK.) I shouldn't work when I'm tired... git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2900 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/alltests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/alltests.py b/test/alltests.py index 7c31c4623..ecd950853 100755 --- a/test/alltests.py +++ b/test/alltests.py @@ -1,4 +1,4 @@ -#!/usr/bin/env py4123 +#!/usr/bin/env python # Author: David Goodger # Contact: goodger@users.sourceforge.net -- cgit v1.2.1 From 74ef0ca97d6a845eb24a2fa0546612d34474d043 Mon Sep 17 00:00:00 2001 From: wiemann Date: Fri, 24 Dec 2004 00:55:16 +0000 Subject: Release 0.3.7: set version number to 0.3.8 git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2901 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_html4css1.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index 2ecffa4f5..18d3495ab 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -3,7 +3,7 @@ - + reStructuredText Test Document -- cgit v1.2.1 From fca58d625852d0855d762397e806978732d1f599 Mon Sep 17 00:00:00 2001 From: wiemann Date: Fri, 24 Dec 2004 21:53:30 +0000 Subject: added tests for encoding option of raw and include git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2909 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../test_rst/test_directives/test_include.py | 17 +++++++++ .../test_rst/test_directives/test_raw.py | 43 ++++++++++++++++++++++ 2 files changed, 60 insertions(+) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_directives/test_include.py b/test/test_parsers/test_rst/test_directives/test_include.py index 42bbf39f3..ba756df1b 100755 --- a/test/test_parsers/test_rst/test_directives/test_include.py +++ b/test/test_parsers/test_rst/test_directives/test_include.py @@ -276,6 +276,23 @@ Testing relative includes: test_include.py . """], +["""\ +Encoding: + +.. include:: utf-16.csv + :encoding: utf-16 +""", +u"""\ + + + Encoding: + + "Treat", "Quantity", "Description" + "Albatr\xb0\xdf", 2.99, "\xa1On a \\u03c3\\u03c4\\u03b9\\u03ba!" + "Crunchy Frog", 1.49, "If we took the b\xf6nes out, it wouldn\\u2019t be + crunchy, now would it?" + "Gannet Ripple", 1.99, "\xbfOn a \\u03c3\\u03c4\\u03b9\\u03ba?" +"""], # @@@ BUG with errors reported with incorrect "source" & "line": # ["""\ # Testing bad charent includes: diff --git a/test/test_parsers/test_rst/test_directives/test_raw.py b/test/test_parsers/test_rst/test_directives/test_raw.py index c310c344c..f0b7c5202 100755 --- a/test/test_parsers/test_rst/test_directives/test_raw.py +++ b/test/test_parsers/test_rst/test_directives/test_raw.py @@ -86,6 +86,49 @@ totest['raw'] = [ \\[ \\sum_{n=1}^\\infty \\frac{1}{n} \\text{ etc.} \\] """], +["""\ +.. raw:: html + :file: utf-16.csv + :encoding: utf-16 +""", +"""\ + + + "Treat", "Quantity", "Description" + "Albatr\xb0\xdf", 2.99, "\xa1On a \\u03c3\\u03c4\\u03b9\\u03ba!" + "Crunchy Frog", 1.49, "If we took the b\xf6nes out, it wouldn\\u2019t be + crunchy, now would it?" + "Gannet Ripple", 1.99, "\xbfOn a \\u03c3\\u03c4\\u03b9\\u03ba?" +"""], +["""\ +UTF-16 is no valid ASCII, but the parser doesn't complain. BUG? + +.. raw:: html + :file: utf-16.csv + :encoding: ascii +""", +"""\ + + + UTF-16 is no valid ASCII, but the parser doesn't complain. BUG? + + \xfe\xff\x00"\x00T\x00r\x00e\x00a\x00t\x00"\x00,\x00 \x00"\x00Q\x00u\x00a\x00n\x00t\x00i\x00t\x00y\x00"\x00,\x00 \x00"\x00D\x00e\x00s\x00c\x00r\x00i\x00p\x00t\x00i\x00o\x00n\x00"\x00 + \x00"\x00A\x00l\x00b\x00a\x00t\x00r\x00\xb0\x00\xdf\x00"\x00,\x00 \x002\x00.\x009\x009\x00,\x00 \x00"\x00\xa1\x00O\x00n\x00 \x00a\x00 \x03\xc3\x03\xc4\x03\xb9\x03\xba\x00!\x00"\x00 + \x00"\x00C\x00r\x00u\x00n\x00c\x00h\x00y\x00 \x00F\x00r\x00o\x00g\x00"\x00,\x00 \x001\x00.\x004\x009\x00,\x00 \x00"\x00I\x00f\x00 \x00w\x00e\x00 \x00t\x00o\x00o\x00k\x00 \x00t\x00h\x00e\x00 \x00b\x00\xf6\x00n\x00e\x00s\x00 \x00o\x00u\x00t\x00,\x00 \x00i\x00t\x00 \x00w\x00o\x00u\x00l\x00d\x00n \x19\x00t\x00 \x00b\x00e\x00 + \x00c\x00r\x00u\x00n\x00c\x00h\x00y\x00,\x00 \x00n\x00o\x00w\x00 \x00w\x00o\x00u\x00l\x00d\x00 \x00i\x00t\x00?\x00"\x00 + \x00"\x00G\x00a\x00n\x00n\x00e\x00t\x00 \x00R\x00i\x00p\x00p\x00l\x00e\x00"\x00,\x00 \x001\x00.\x009\x009\x00,\x00 \x00"\x00\xbf\x00O\x00n\x00 \x00a\x00 \x03\xc3\x03\xc4\x03\xb9\x03\xba\x00?\x00"\x00 +"""], +["""\ +.. raw:: html + :encoding: utf-8 + + Should the parser complain becau\xdfe there is no :file:? BUG? +""", +"""\ + + + Should the parser complain becau\xdfe there is no :file:? BUG? +"""], ] -- cgit v1.2.1 From 6e4e51dd482a1bab74f14d020b340f089b72d5c7 Mon Sep 17 00:00:00 2001 From: wiemann Date: Fri, 24 Dec 2004 22:22:00 +0000 Subject: fixed bug in tests (paths were getting messed up); added another test git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2910 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../test_rst/test_directives/test_include.py | 19 +++++++++++++++++-- .../test_parsers/test_rst/test_directives/test_raw.py | 18 ++++++++++-------- 2 files changed, 27 insertions(+), 10 deletions(-) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_directives/test_include.py b/test/test_parsers/test_rst/test_directives/test_include.py index ba756df1b..3de8532c7 100755 --- a/test/test_parsers/test_rst/test_directives/test_include.py +++ b/test/test_parsers/test_rst/test_directives/test_include.py @@ -27,6 +27,8 @@ include3 = os.path.join(mydir, 'include3.txt') include8 = os.path.join(mydir, 'include8.txt') include10 = os.path.join(mydir, 'include10.txt') include10rel = DocutilsTestSupport.utils.relative_path(None, include10) +utf_16_file = os.path.join(mydir, 'utf-16.csv') +utf_16_file_rel = DocutilsTestSupport.utils.relative_path(None, utf_16_file) totest = {} @@ -279,9 +281,9 @@ Testing relative includes: ["""\ Encoding: -.. include:: utf-16.csv +.. include:: %s :encoding: utf-16 -""", +""" % utf_16_file_rel, u"""\ @@ -293,6 +295,19 @@ u"""\ crunchy, now would it?" "Gannet Ripple", 1.99, "\xbfOn a \\u03c3\\u03c4\\u03b9\\u03ba?" """], +["""\ +UTF-16 is no valid ASCII. BUG? + +.. include:: %s + :encoding: ascii +""" % utf_16_file_rel, +u"""\ + + + UTF-16 is no valid ASCII. BUG? + + \xfe\xff"Treat","Quantity","Description""Albatr\xb0\xdf",2.99,"\xa1Ona\x03\xc3\x03\xc4\x03\xb9\x03\xba!""CrunchyFrog",1.49,"Ifwetooktheb\xf6nesout,itwouldn \x19tbecrunchy,nowwouldit?""GannetRipple",1.99,"\xbfOna\x03\xc3\x03\xc4\x03\xb9\x03\xba?" +"""], # @@@ BUG with errors reported with incorrect "source" & "line": # ["""\ # Testing bad charent includes: diff --git a/test/test_parsers/test_rst/test_directives/test_raw.py b/test/test_parsers/test_rst/test_directives/test_raw.py index f0b7c5202..0185c8b02 100755 --- a/test/test_parsers/test_rst/test_directives/test_raw.py +++ b/test/test_parsers/test_rst/test_directives/test_raw.py @@ -21,6 +21,8 @@ def suite(): mydir = os.path.dirname(suite.func_code.co_filename) raw1 = os.path.join(mydir, 'raw1.txt') +utf_16_file = os.path.join(mydir, 'utf-16.csv') +utf_16_file_rel = DocutilsTestSupport.utils.relative_path(None, utf_16_file) totest = {} @@ -88,36 +90,36 @@ totest['raw'] = [ """], ["""\ .. raw:: html - :file: utf-16.csv + :file: %s :encoding: utf-16 -""", +""" % utf_16_file_rel, """\ - + "Treat", "Quantity", "Description" "Albatr\xb0\xdf", 2.99, "\xa1On a \\u03c3\\u03c4\\u03b9\\u03ba!" "Crunchy Frog", 1.49, "If we took the b\xf6nes out, it wouldn\\u2019t be crunchy, now would it?" "Gannet Ripple", 1.99, "\xbfOn a \\u03c3\\u03c4\\u03b9\\u03ba?" -"""], +""" % utf_16_file_rel], ["""\ UTF-16 is no valid ASCII, but the parser doesn't complain. BUG? .. raw:: html - :file: utf-16.csv + :file: %s :encoding: ascii -""", +""" % utf_16_file_rel, """\ UTF-16 is no valid ASCII, but the parser doesn't complain. BUG? - + \xfe\xff\x00"\x00T\x00r\x00e\x00a\x00t\x00"\x00,\x00 \x00"\x00Q\x00u\x00a\x00n\x00t\x00i\x00t\x00y\x00"\x00,\x00 \x00"\x00D\x00e\x00s\x00c\x00r\x00i\x00p\x00t\x00i\x00o\x00n\x00"\x00 \x00"\x00A\x00l\x00b\x00a\x00t\x00r\x00\xb0\x00\xdf\x00"\x00,\x00 \x002\x00.\x009\x009\x00,\x00 \x00"\x00\xa1\x00O\x00n\x00 \x00a\x00 \x03\xc3\x03\xc4\x03\xb9\x03\xba\x00!\x00"\x00 \x00"\x00C\x00r\x00u\x00n\x00c\x00h\x00y\x00 \x00F\x00r\x00o\x00g\x00"\x00,\x00 \x001\x00.\x004\x009\x00,\x00 \x00"\x00I\x00f\x00 \x00w\x00e\x00 \x00t\x00o\x00o\x00k\x00 \x00t\x00h\x00e\x00 \x00b\x00\xf6\x00n\x00e\x00s\x00 \x00o\x00u\x00t\x00,\x00 \x00i\x00t\x00 \x00w\x00o\x00u\x00l\x00d\x00n \x19\x00t\x00 \x00b\x00e\x00 \x00c\x00r\x00u\x00n\x00c\x00h\x00y\x00,\x00 \x00n\x00o\x00w\x00 \x00w\x00o\x00u\x00l\x00d\x00 \x00i\x00t\x00?\x00"\x00 \x00"\x00G\x00a\x00n\x00n\x00e\x00t\x00 \x00R\x00i\x00p\x00p\x00l\x00e\x00"\x00,\x00 \x001\x00.\x009\x009\x00,\x00 \x00"\x00\xbf\x00O\x00n\x00 \x00a\x00 \x03\xc3\x03\xc4\x03\xb9\x03\xba\x00?\x00"\x00 -"""], +""" % utf_16_file_rel], ["""\ .. raw:: html :encoding: utf-8 -- cgit v1.2.1 From fb2a5820dea90806c899c571a13e8da205ab30cb Mon Sep 17 00:00:00 2001 From: wiemann Date: Thu, 13 Jan 2005 20:14:48 +0000 Subject: added test for escaped email addresses git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2936 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_parsers/test_rst/test_inline_markup.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_inline_markup.py b/test/test_parsers/test_rst/test_inline_markup.py index 127d4dab7..fa83132ac 100755 --- a/test/test_parsers/test_rst/test_inline_markup.py +++ b/test/test_parsers/test_rst/test_inline_markup.py @@ -877,6 +877,14 @@ are not recognized): signal:noise, a:b. None of these are standalone hyperlinks (their "schemes" are not recognized): signal:noise, a:b. """], +["""\ +Escaped email addresses are not recognized: test\@example.org +""", +"""\ + + + Escaped email addresses are not recognized: test@example.org +"""], ] totest['miscellaneous'] = [ -- cgit v1.2.1 From c886e2546de890ab9378852536ede11269d93479 Mon Sep 17 00:00:00 2001 From: cben Date: Fri, 14 Jan 2005 14:34:05 +0000 Subject: Implemented support for multiple author,organization,address,contact fields with use_latex_docinfo. Still has a bug: the document must have a title for \maketitle to be emitted. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2937 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/latex_docinfo.tex | 85 ++++++++++++++++++++++++++++++ test/functional/input/latex_docinfo.txt | 13 +++++ test/functional/tests/latex_docinfo.py | 12 +++++ 3 files changed, 110 insertions(+) create mode 100644 test/functional/expected/latex_docinfo.tex create mode 100644 test/functional/input/latex_docinfo.txt create mode 100644 test/functional/tests/latex_docinfo.py (limited to 'test') diff --git a/test/functional/expected/latex_docinfo.tex b/test/functional/expected/latex_docinfo.tex new file mode 100644 index 000000000..4411b52bc --- /dev/null +++ b/test/functional/expected/latex_docinfo.tex @@ -0,0 +1,85 @@ +\documentclass[10pt,a4paper,english]{article} +\usepackage{babel} +\usepackage{ae} +\usepackage{aeguill} +\usepackage{shortvrb} +\usepackage[latin1]{inputenc} +\usepackage{tabularx} +\usepackage{longtable} +\setlength{\extrarowheight}{2pt} +\usepackage{amsmath} +\usepackage{graphicx} +\usepackage{color} +\usepackage{multirow} +\usepackage{ifthen} +\usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref} +\usepackage[DIV12]{typearea} +%% generator Docutils: http://docutils.sourceforge.net/ +\newlength{\admonitionwidth} +\setlength{\admonitionwidth}{0.9\textwidth} +\newlength{\docinfowidth} +\setlength{\docinfowidth}{0.9\textwidth} +\newlength{\locallinewidth} +\newcommand{\optionlistlabel}[1]{\bf #1 \hfill} +\newenvironment{optionlist}[1] +{\begin{list}{} + {\setlength{\labelwidth}{#1} + \setlength{\rightmargin}{1cm} + \setlength{\leftmargin}{\rightmargin} + \addtolength{\leftmargin}{\labelwidth} + \addtolength{\leftmargin}{\labelsep} + \renewcommand{\makelabel}{\optionlistlabel}} +}{\end{list}} +\newlength{\lineblockindentation} +\setlength{\lineblockindentation}{2.5em} +\newenvironment{lineblock}[1] +{\begin{list}{} + {\setlength{\partopsep}{\parskip} + \addtolength{\partopsep}{\baselineskip} + \topsep0pt\itemsep0.15\baselineskip\parsep0pt + \leftmargin#1} + \raggedright} +{\end{list}} +% begin: floats for footnotes tweaking. +\setlength{\floatsep}{0.5em} +\setlength{\textfloatsep}{\fill} +\addtolength{\textfloatsep}{3em} +\renewcommand{\textfraction}{0.5} +\renewcommand{\topfraction}{0.5} +\renewcommand{\bottomfraction}{0.5} +\setcounter{totalnumber}{50} +\setcounter{topnumber}{50} +\setcounter{bottomnumber}{50} +% end floats for footnotes +% some commands, that could be overwritten in the style file. +\newcommand{\rubric}[1]{\subsection*{~\hfill {\it #1} \hfill ~}} +\newcommand{\titlereference}[1]{\textsl{#1}} +% end of "some commands" +\title{Title} +\author{Foo Fred~\\ +Food Foomatics {\&} Friends~\\ +foo@food.example.info~\\ +Fox St 13~\\ +Foowood \and +Bar Barney~\\ +Bar-BQ Bar~\\ +1-800-BARBQBAR~\\ +Barbara St 16~\\ +South Barwell} +\hypersetup{ +pdftitle={Title}, +pdfauthor={Foo Fred;Bar Barney} +} +\raggedbottom +\begin{document} +\maketitle + +%___________________________________________________________________________ +\begin{center} +\begin{tabularx}{\docinfowidth}{lX} +\end{tabularx} +\end{center} + +\setlength{\locallinewidth}{\linewidth} + +\end{document} diff --git a/test/functional/input/latex_docinfo.txt b/test/functional/input/latex_docinfo.txt new file mode 100644 index 000000000..985a03ecd --- /dev/null +++ b/test/functional/input/latex_docinfo.txt @@ -0,0 +1,13 @@ +Title +***** + +:Author: Foo Fred +:Organization: Food Foomatics & Friends +:Contact: foo@food.example.info +:Address: Fox St 13 + Foowood +:Author: Bar Barney +:Organization: Bar-BQ Bar +:Contact: 1-800-BARBQBAR +:Address: Barbara St 16 + South Barwell diff --git a/test/functional/tests/latex_docinfo.py b/test/functional/tests/latex_docinfo.py new file mode 100644 index 000000000..3f9c34455 --- /dev/null +++ b/test/functional/tests/latex_docinfo.py @@ -0,0 +1,12 @@ +# Source and destination file names. +test_source = "latex_docinfo.txt" +test_destination = "latex_docinfo.tex" + +# Keyword parameters passed to publish_file. +reader_name = "standalone" +parser_name = "rst" +writer_name = "latex" + +# Extra setting we need + +settings_overrides['use_latex_docinfo'] = 1 -- cgit v1.2.1 From 8e61bea12a1e10ea035b823bd823c24cc030e35b Mon Sep 17 00:00:00 2001 From: cben Date: Sat, 15 Jan 2005 22:03:25 +0000 Subject: Fixed use_latex_docinfo to always show the titlepage. Forced \date{} and \author{} to be emitted at all times, to avoid latex's default (the date latex processed the file, which is never interesting for us; perhaps using the date *docutils* processed the file would make sense if --date is given?). git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2938 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/latex_docinfo.tex | 4 ++-- test/functional/input/latex_docinfo.txt | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/functional/expected/latex_docinfo.tex b/test/functional/expected/latex_docinfo.tex index 4411b52bc..04d9438f7 100644 --- a/test/functional/expected/latex_docinfo.tex +++ b/test/functional/expected/latex_docinfo.tex @@ -55,7 +55,7 @@ \newcommand{\rubric}[1]{\subsection*{~\hfill {\it #1} \hfill ~}} \newcommand{\titlereference}[1]{\textsl{#1}} % end of "some commands" -\title{Title} +\title{} \author{Foo Fred~\\ Food Foomatics {\&} Friends~\\ foo@food.example.info~\\ @@ -66,8 +66,8 @@ Bar-BQ Bar~\\ 1-800-BARBQBAR~\\ Barbara St 16~\\ South Barwell} +\date{} \hypersetup{ -pdftitle={Title}, pdfauthor={Foo Fred;Bar Barney} } \raggedbottom diff --git a/test/functional/input/latex_docinfo.txt b/test/functional/input/latex_docinfo.txt index 985a03ecd..f6c9ba2e4 100644 --- a/test/functional/input/latex_docinfo.txt +++ b/test/functional/input/latex_docinfo.txt @@ -1,6 +1,3 @@ -Title -***** - :Author: Foo Fred :Organization: Food Foomatics & Friends :Contact: foo@food.example.info -- cgit v1.2.1 From cbd0e428395a177fb91276711ea76bb7efb842b8 Mon Sep 17 00:00:00 2001 From: wiemann Date: Fri, 11 Feb 2005 10:11:46 +0000 Subject: made span.option contain option variable as well git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2957 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_html4css1.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index 18d3495ab..7297c9221 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -292,14 +292,14 @@ doesn't get stripped away.)

-a
+-b file +--input=file +-1 file, --one=file, --two file - - - - - - - - - -- cgit v1.2.1 From dd317b4e446e8c3666bf6e30e13ebf3a39e168f3 Mon Sep 17 00:00:00 2001 From: goodger Date: Fri, 11 Feb 2005 15:49:20 +0000 Subject: Added "list-table" directive. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2963 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../test_rst/test_directives/test_tables.py | 141 +++++++++++++++++++++ 1 file changed, 141 insertions(+) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_directives/test_tables.py b/test/test_parsers/test_rst/test_directives/test_tables.py index 50a03f2e5..254248c96 100755 --- a/test/test_parsers/test_rst/test_directives/test_tables.py +++ b/test/test_parsers/test_rst/test_directives/test_tables.py @@ -796,6 +796,147 @@ u"""\ """], ] +totest['list-table'] = [ +["""\ +.. list-table:: list table with integral header + :widths: 10 20 30 + :header-rows: 1 + + * - Treat + - Quantity + - Description + * - Albatross + - 2.99 + - On a stick! + * - Crunchy Frog + - 1.49 + - If we took the bones out, it wouldn\'t be + crunchy, now would it? + * - Gannet Ripple + - 1.99 + - On a stick! +""", +"""\ + +
command-line option "a"
--b file options can have arguments and long descriptions
--long options can be long also
---input=file long options can also have arguments
@@ -316,7 +316,7 @@ regardless of where it starts.

-v, --verbose
Commonly-seen: short & long options.
--1 file, --one=file, --two file
 Multiple options with arguments.
-- cgit v1.2.1 From 9a8a8bc179c879ad1e498f65029dfc8c2d0cab39 Mon Sep 17 00:00:00 2001 From: wiemann Date: Fri, 11 Feb 2005 10:26:47 +0000 Subject: added class="option-group" to option_group s for better customizability with CSS git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2959 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_html4css1.html | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index 7297c9221..adae23dd6 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -288,38 +288,38 @@ doesn't get stripped away.)

+
-a command-line option "a"
+
-b file options can have arguments and long descriptions
+
--long options can be long also
+
--input=file long options can also have arguments
+
--very-long-option
 

The description can also start on the next line.

The description may contain multiple body elements, regardless of where it starts.

+
-x, -y, -z Multiple options are an "option group".
+
-v, --verbose Commonly-seen: short & long options.
+
-1 file, --one=file, --two file
 Multiple options with arguments.
+
/V DOS/VMS-style options too
+ + list table with integral header + <tgroup cols="3"> + <colspec colwidth="10"> + <colspec colwidth="20"> + <colspec colwidth="30"> + <thead> + <row> + <entry> + <paragraph> + Treat + <entry> + <paragraph> + Quantity + <entry> + <paragraph> + Description + <tbody> + <row> + <entry> + <paragraph> + Albatross + <entry> + <paragraph> + 2.99 + <entry> + <paragraph> + On a stick! + <row> + <entry> + <paragraph> + Crunchy Frog + <entry> + <paragraph> + 1.49 + <entry> + <paragraph> + If we took the bones out, it wouldn\'t be + crunchy, now would it? + <row> + <entry> + <paragraph> + Gannet Ripple + <entry> + <paragraph> + 1.99 + <entry> + <paragraph> + On a stick! +"""], +["""\ +.. list-table:: + + not a bullet list +""", +"""\ +<document source="test data"> + <system_message level="3" line="1" source="test data" type="ERROR"> + <paragraph> + Error parsing content block for the "list-table" directive: exactly one bullet list expected. + <literal_block xml:space="preserve"> + .. list-table:: + \n\ + not a bullet list +"""], +["""\ +.. list-table:: + + * not a second-level bullet list +""", +"""\ +<document source="test data"> + <system_message level="3" line="1" source="test data" type="ERROR"> + <paragraph> + Error parsing content block for the "list-table" directive: two-level bullet list expected, but row 1 does not contain a second-level bullet list. + <literal_block xml:space="preserve"> + .. list-table:: + \n\ + * not a second-level bullet list +"""], +["""\ +.. list-table:: + + * - columns not uniform + * - first row has one, + - second row has two +""", +"""\ +<document source="test data"> + <system_message level="3" line="1" source="test data" type="ERROR"> + <paragraph> + Error parsing content block for the "list-table" directive: uniform two-level bullet list expected, but row 2 does not contain the same number of items as row 1 (2 vs 1). + <literal_block xml:space="preserve"> + .. list-table:: + \n\ + * - columns not uniform + * - first row has one, + - second row has two +"""], +["""\ +.. list-table:: + :widths: 10 20 + + * - ":widths:" option doesn't match columns +""", +"""\ +<document source="test data"> + <system_message level="3" line="1" source="test data" type="ERROR"> + <paragraph> + "list-table" widths do not match the number of columns in table (1). + <literal_block xml:space="preserve"> + .. list-table:: + :widths: 10 20 + \n\ + * - ":widths:" option doesn\'t match columns +"""], +] + if __name__ == '__main__': import unittest -- cgit v1.2.1 From b71590a10a403a6cec2a63a05d0946c2ce5961c6 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Thu, 17 Feb 2005 14:48:02 +0000 Subject: added test for option arguments in angle brackets whose first character is not alphanumeric; added test for option arguments in angle brackets with spaces (currently commented-out, because it's not yet fixed) git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2968 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_parsers/test_rst/test_option_lists.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_option_lists.py b/test/test_parsers/test_rst/test_option_lists.py index aa529de21..12d702da6 100755 --- a/test/test_parsers/test_rst/test_option_lists.py +++ b/test/test_parsers/test_rst/test_option_lists.py @@ -683,7 +683,9 @@ Complex optargs: --source-url=<URL> Use the supplied <URL> verbatim. --output-encoding=<name[:handler]>, -o<name[:handler]> Specify the text encoding for output. +-f <[path]filename> Send output to file. """, +# -d <src dest> Use diff from <src> to <dest>. """\ <document source="test data"> <paragraph> @@ -714,10 +716,29 @@ Complex optargs: <description> <paragraph> Specify the text encoding for output. + <option_list_item> + <option_group> + <option> + <option_string> + -f + <option_argument delimiter=" "> + <[path]filename> + <description> + <paragraph> + Send output to file. """], +# <option_list_item> +# <option_group> +# <option> +# <option_string> +# -d +# <option_argument delimiter=" "> +# <src dest> +# <description> +# <paragraph> +# Use diff from <src> to <dest>. ] - if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') -- cgit v1.2.1 From 73a27fb234ab7cb995d57ad1d4d2ddfd52e9c280 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Thu, 17 Feb 2005 16:26:54 +0000 Subject: updated git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2974 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../test_rst/test_directives/test_include.py | 17 +++++++++++------ test/test_parsers/test_rst/test_directives/test_raw.py | 18 ++++++++++-------- 2 files changed, 21 insertions(+), 14 deletions(-) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_directives/test_include.py b/test/test_parsers/test_rst/test_directives/test_include.py index 3de8532c7..34001c9fe 100755 --- a/test/test_parsers/test_rst/test_directives/test_include.py +++ b/test/test_parsers/test_rst/test_directives/test_include.py @@ -296,18 +296,23 @@ u"""\ "Gannet Ripple", 1.99, "\xbfOn a \\u03c3\\u03c4\\u03b9\\u03ba?" """], ["""\ -UTF-16 is no valid ASCII. BUG? +Include file is UTF-16-encoded, and is not valid ASCII. .. include:: %s :encoding: ascii """ % utf_16_file_rel, -u"""\ +"""\ <document source="test data"> <paragraph> - UTF-16 is no valid ASCII. BUG? - <paragraph> - \xfe\xff"Treat","Quantity","Description""Albatr\xb0\xdf",2.99,"\xa1Ona\x03\xc3\x03\xc4\x03\xb9\x03\xba!""CrunchyFrog",1.49,"Ifwetooktheb\xf6nesout,itwouldn \x19tbecrunchy,nowwouldit?""GannetRipple",1.99,"\xbfOna\x03\xc3\x03\xc4\x03\xb9\x03\xba?" -"""], + Include file is UTF-16-encoded, and is not valid ASCII. + <system_message level="4" line="3" source="test data" type="SEVERE"> + <paragraph> + Problem with "include" directive: + UnicodeError: Unable to decode input data. Tried the following encodings: 'ascii'. + <literal_block xml:space="preserve"> + .. include:: %s + :encoding: ascii +""" % utf_16_file_rel], # @@@ BUG with errors reported with incorrect "source" & "line": # ["""\ # Testing bad charent includes: diff --git a/test/test_parsers/test_rst/test_directives/test_raw.py b/test/test_parsers/test_rst/test_directives/test_raw.py index 0185c8b02..82b29d471 100755 --- a/test/test_parsers/test_rst/test_directives/test_raw.py +++ b/test/test_parsers/test_rst/test_directives/test_raw.py @@ -103,7 +103,7 @@ totest['raw'] = [ "Gannet Ripple", 1.99, "\xbfOn a \\u03c3\\u03c4\\u03b9\\u03ba?" """ % utf_16_file_rel], ["""\ -UTF-16 is no valid ASCII, but the parser doesn't complain. BUG? +Raw input file is UTF-16-encoded, and is not valid ASCII. .. raw:: html :file: %s @@ -112,13 +112,15 @@ UTF-16 is no valid ASCII, but the parser doesn't complain. BUG? """\ <document source="test data"> <paragraph> - UTF-16 is no valid ASCII, but the parser doesn't complain. BUG? - <raw format="html" source="%s" xml:space="preserve"> - \xfe\xff\x00"\x00T\x00r\x00e\x00a\x00t\x00"\x00,\x00 \x00"\x00Q\x00u\x00a\x00n\x00t\x00i\x00t\x00y\x00"\x00,\x00 \x00"\x00D\x00e\x00s\x00c\x00r\x00i\x00p\x00t\x00i\x00o\x00n\x00"\x00 - \x00"\x00A\x00l\x00b\x00a\x00t\x00r\x00\xb0\x00\xdf\x00"\x00,\x00 \x002\x00.\x009\x009\x00,\x00 \x00"\x00\xa1\x00O\x00n\x00 \x00a\x00 \x03\xc3\x03\xc4\x03\xb9\x03\xba\x00!\x00"\x00 - \x00"\x00C\x00r\x00u\x00n\x00c\x00h\x00y\x00 \x00F\x00r\x00o\x00g\x00"\x00,\x00 \x001\x00.\x004\x009\x00,\x00 \x00"\x00I\x00f\x00 \x00w\x00e\x00 \x00t\x00o\x00o\x00k\x00 \x00t\x00h\x00e\x00 \x00b\x00\xf6\x00n\x00e\x00s\x00 \x00o\x00u\x00t\x00,\x00 \x00i\x00t\x00 \x00w\x00o\x00u\x00l\x00d\x00n \x19\x00t\x00 \x00b\x00e\x00 - \x00c\x00r\x00u\x00n\x00c\x00h\x00y\x00,\x00 \x00n\x00o\x00w\x00 \x00w\x00o\x00u\x00l\x00d\x00 \x00i\x00t\x00?\x00"\x00 - \x00"\x00G\x00a\x00n\x00n\x00e\x00t\x00 \x00R\x00i\x00p\x00p\x00l\x00e\x00"\x00,\x00 \x001\x00.\x009\x009\x00,\x00 \x00"\x00\xbf\x00O\x00n\x00 \x00a\x00 \x03\xc3\x03\xc4\x03\xb9\x03\xba\x00?\x00"\x00 + Raw input file is UTF-16-encoded, and is not valid ASCII. + <system_message level="4" line="3" source="test data" type="SEVERE"> + <paragraph> + Problem with "raw" directive: + UnicodeError: Unable to decode input data. Tried the following encodings: \'ascii\'. + <literal_block xml:space="preserve"> + .. raw:: html + :file: %s + :encoding: ascii """ % utf_16_file_rel], ["""\ .. raw:: html -- cgit v1.2.1 From 6e59df17d0c4a53e5d5ced08f5ef58852bc66ec8 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sat, 19 Feb 2005 01:23:10 +0000 Subject: Fixed option lists to allow spaces inside ``<angle-bracketed option arguments>``. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2975 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_parsers/test_rst/test_option_lists.py | 34 +++++++++++++++++-------- 1 file changed, 23 insertions(+), 11 deletions(-) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_option_lists.py b/test/test_parsers/test_rst/test_option_lists.py index 12d702da6..a5afc498b 100755 --- a/test/test_parsers/test_rst/test_option_lists.py +++ b/test/test_parsers/test_rst/test_option_lists.py @@ -684,8 +684,9 @@ Complex optargs: --output-encoding=<name[:handler]>, -o<name[:handler]> Specify the text encoding for output. -f <[path]filename> Send output to file. +-d <src dest> Use diff from <src> to <dest>. +--bogus=<x y z> Bogus 3D coordinates. """, -# -d <src dest> Use diff from <src> to <dest>. """\ <document source="test data"> <paragraph> @@ -726,19 +727,30 @@ Complex optargs: <description> <paragraph> Send output to file. + <option_list_item> + <option_group> + <option> + <option_string> + -d + <option_argument delimiter=" "> + <src dest> + <description> + <paragraph> + Use diff from <src> to <dest>. + <option_list_item> + <option_group> + <option> + <option_string> + --bogus + <option_argument delimiter="="> + <x y z> + <description> + <paragraph> + Bogus 3D coordinates. """], -# <option_list_item> -# <option_group> -# <option> -# <option_string> -# -d -# <option_argument delimiter=" "> -# <src dest> -# <description> -# <paragraph> -# Use diff from <src> to <dest>. ] + if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') -- cgit v1.2.1 From f7470c17c303f9668595a23122d1dd222f2d21a6 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sat, 19 Feb 2005 13:15:18 +0000 Subject: run alltests.py with unbuffered stdout and stderr git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2976 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/alltests.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/alltests.py b/test/alltests.py index ecd950853..6a885a267 100755 --- a/test/alltests.py +++ b/test/alltests.py @@ -1,4 +1,5 @@ -#!/usr/bin/env python +#!/bin/sh +''''exec python -u "$0" #''' # Author: David Goodger # Contact: goodger@users.sourceforge.net @@ -6,6 +7,7 @@ # Date: $Date$ # Copyright: This module has been placed in the public domain. +__doc__ = \ """ All modules named 'test_*.py' in the current directory, and recursively in subdirectories (packages) called 'test_*', are loaded and test suites within -- cgit v1.2.1 From 702c2493fb37a8d3f451a7e1b3ff77a596a3dc3e Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sat, 19 Feb 2005 17:05:53 +0000 Subject: pass on parameters git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2977 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/alltests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/alltests.py b/test/alltests.py index 6a885a267..ee73f0376 100755 --- a/test/alltests.py +++ b/test/alltests.py @@ -1,5 +1,5 @@ #!/bin/sh -''''exec python -u "$0" #''' +''''exec python -u "$0" "$@" #''' # Author: David Goodger # Contact: goodger@users.sourceforge.net -- cgit v1.2.1 From 07fa4bd4ec0479f5288163dfab5fc38b43f4948e Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Tue, 22 Feb 2005 01:26:52 +0000 Subject: this file intentionally empty, for testing purposes git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2979 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_parsers/test_rst/test_directives/empty.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 test/test_parsers/test_rst/test_directives/empty.txt (limited to 'test') diff --git a/test/test_parsers/test_rst/test_directives/empty.txt b/test/test_parsers/test_rst/test_directives/empty.txt new file mode 100644 index 000000000..e69de29bb -- cgit v1.2.1 From a3e14f83bb27fe386e91b58604f7cf77810793cf Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Tue, 22 Feb 2005 01:29:17 +0000 Subject: Caught empty CSV table bug git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2980 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_parsers/test_rst/test_directives/test_tables.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_directives/test_tables.py b/test/test_parsers/test_rst/test_directives/test_tables.py index 254248c96..ab03f8518 100755 --- a/test/test_parsers/test_rst/test_directives/test_tables.py +++ b/test/test_parsers/test_rst/test_directives/test_tables.py @@ -27,6 +27,7 @@ def suite(): mydir = os.path.dirname(suite.func_code.co_filename) utf_16_csv = os.path.join(mydir, 'utf-16.csv') utf_16_csv_rel = DocutilsTestSupport.utils.relative_path(None, utf_16_csv) +empty_txt = os.path.join(mydir, 'empty.txt') totest = {} @@ -794,6 +795,19 @@ u"""\ <paragraph> \u00bfOn a \u03c3\u03c4\u03b9\u03ba? """], +["""\ +.. csv-table:: no CSV data + :file: %s +""" % empty_txt, +"""\ +<document source="test data"> + <system_message level="3" line="1" source="test data" type="ERROR"> + <paragraph> + No table data detected in CSV file. + <literal_block xml:space="preserve"> + .. csv-table:: no CSV data + :file: %s +""" % empty_txt], ] totest['list-table'] = [ -- cgit v1.2.1 From 920206cc36d23d7bf159246f0d9e4c036559683d Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Fri, 25 Feb 2005 01:32:01 +0000 Subject: provide better reporting of decoding errors git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2981 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_parsers/test_rst/test_directives/test_include.py | 1 + test/test_parsers/test_rst/test_directives/test_raw.py | 1 + 2 files changed, 2 insertions(+) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_directives/test_include.py b/test/test_parsers/test_rst/test_directives/test_include.py index 34001c9fe..6eb2ca7c0 100755 --- a/test/test_parsers/test_rst/test_directives/test_include.py +++ b/test/test_parsers/test_rst/test_directives/test_include.py @@ -309,6 +309,7 @@ Include file is UTF-16-encoded, and is not valid ASCII. <paragraph> Problem with "include" directive: UnicodeError: Unable to decode input data. Tried the following encodings: 'ascii'. + (UnicodeDecodeError: 'ascii' codec can't decode byte 0xfe in position 0: ordinal not in range(128)) <literal_block xml:space="preserve"> .. include:: %s :encoding: ascii diff --git a/test/test_parsers/test_rst/test_directives/test_raw.py b/test/test_parsers/test_rst/test_directives/test_raw.py index 82b29d471..e4566c0c7 100755 --- a/test/test_parsers/test_rst/test_directives/test_raw.py +++ b/test/test_parsers/test_rst/test_directives/test_raw.py @@ -117,6 +117,7 @@ Raw input file is UTF-16-encoded, and is not valid ASCII. <paragraph> Problem with "raw" directive: UnicodeError: Unable to decode input data. Tried the following encodings: \'ascii\'. + (UnicodeDecodeError: 'ascii' codec can't decode byte 0xfe in position 0: ordinal not in range(128)) <literal_block xml:space="preserve"> .. raw:: html :file: %s -- cgit v1.2.1 From 6702b7a9b8c842cf05719ef4c9c403495d28df04 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Fri, 25 Feb 2005 23:36:43 +0000 Subject: Fixed mislocated internal targets bug, by relocating targets into the next text element. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2984 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../expected/standalone_rst_html4css1.html | 6 ++-- test/functional/expected/standalone_rst_latex.tex | 8 ++--- test/test_transforms/test_hyperlinks.py | 42 +++++++++++++++++----- 3 files changed, 40 insertions(+), 16 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index adae23dd6..bc1cb3561 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -204,14 +204,14 @@ live link to PEP 258 here.</p> </ul> </li> <li>Nested item 3.</li> -<li>This nested list should be compacted by the HTML writer.<a class="target" id="target" name="target"></a><!-- Even if this item contains a target and a comment. --> +<li>This nested list should be compacted by the HTML writer.<!-- Even if this item contains a target and a comment. --> </li> </ul> </li> </ul> </div> <div class="section" id="enumerated-lists"> -<h2><a class="toc-backref" href="#id33" name="enumerated-lists">2.3   Enumerated Lists</a></h2> +<h2><a class="toc-backref" href="#id33" name="enumerated-lists">2.3   <a class="target" id="target" name="target"></a>Enumerated Lists</a></h2> <ol class="arabic"> <li><p class="first">Arabic numerals.</p> <ol class="loweralpha simple"> @@ -490,7 +490,7 @@ citation.</p> </div> <div class="section" id="targets"> <h2><a class="toc-backref" href="#id43" name="targets">2.13   Targets</a></h2> -<a class="target" id="example" name="example"></a><p>This paragraph is pointed to by the explicit "example" target. A +<p><a class="target" id="example" name="example"></a>This paragraph is pointed to by the explicit "example" target. A reference can be found under <a class="reference" href="#inline-markup">Inline Markup</a>, above. <a class="reference" href="#inline-hyperlink-targets">Inline hyperlink targets</a> are also possible.</p> <p>Section headers are implicit targets, referred to by name. See diff --git a/test/functional/expected/standalone_rst_latex.tex b/test/functional/expected/standalone_rst_latex.tex index 19f52406f..847e1749e 100644 --- a/test/functional/expected/standalone_rst_latex.tex +++ b/test/functional/expected/standalone_rst_latex.tex @@ -363,7 +363,7 @@ Nested item 3. \item {} This nested list should be compacted by the HTML writer. -\hypertarget{target}{}% Even if this item contains a target and a comment. +% Even if this item contains a target and a comment. \end{itemize} @@ -374,7 +374,7 @@ This nested list should be compacted by the HTML writer. \hypertarget{enumerated-lists}{} \pdfbookmark[1]{2.3~~~Enumerated Lists}{enumerated-lists} -\subsection*{2.3~~~Enumerated Lists} +\subsection*{2.3~~~\hypertarget{target}{}Enumerated Lists} \newcounter{listcnt1} \begin{list}{\arabic{listcnt1}.} { @@ -772,8 +772,8 @@ citation. \hypertarget{targets}{} \pdfbookmark[1]{2.13~~~Targets}{targets} \subsection*{2.13~~~Targets} -\hypertarget{example}{} -This paragraph is pointed to by the explicit ``example'' target. A + +\hypertarget{example}{}This paragraph is pointed to by the explicit ``example'' target. A reference can be found under \href{\#inline-markup}{Inline Markup}, above. \href{\#inline-hyperlink-targets}{Inline hyperlink targets} are also possible. diff --git a/test/test_transforms/test_hyperlinks.py b/test/test_transforms/test_hyperlinks.py index e73d9fe4e..8e666ca88 100755 --- a/test/test_transforms/test_hyperlinks.py +++ b/test/test_transforms/test_hyperlinks.py @@ -66,8 +66,8 @@ direct_ internal """, """\ <document source="test data"> - <target id="direct" name="direct"> <paragraph> + <target id="direct" name="direct"> <reference name="direct" refid="direct"> direct internal @@ -82,8 +82,8 @@ indirect_ internal """, """\ <document source="test data"> - <target id="ztarget" name="ztarget"> <paragraph> + <target id="ztarget" name="ztarget"> <reference name="indirect" refid="ztarget"> indirect internal @@ -240,8 +240,8 @@ __ ztarget_ """, """\ <document source="test data"> - <target id="ztarget" name="ztarget"> <paragraph> + <target id="ztarget" name="ztarget"> <reference anonymous="1" name="indirect internal" refid="ztarget"> indirect internal <target anonymous="1" id="id1" refid="ztarget"> @@ -261,14 +261,14 @@ __ ztarget_ """, """\ <document source="test data"> - <target dupname="ztarget" id="ztarget"> <paragraph> + <target dupname="ztarget" id="ztarget"> First <system_message backrefs="id1" level="2" line="5" source="test data" type="WARNING"> <paragraph> Duplicate explicit target name: "ztarget". - <target dupname="ztarget" id="id1"> <paragraph> + <target dupname="ztarget" id="id1"> Second <paragraph> <problematic id="id4" refid="id3"> @@ -322,8 +322,8 @@ By this `internal hyperlink`_ referemce. """, """\ <document source="test data"> - <target id="internal-hyperlink" name="internal hyperlink"> <paragraph> + <target id="internal-hyperlink" name="internal hyperlink"> This paragraph referenced. <paragraph> By this \n\ @@ -344,9 +344,9 @@ The results of the transform are not visible at the XML level. """, """\ <document source="test data"> - <target id="chained" name="chained"> - <target id="internal-hyperlink" name="internal hyperlink"> <paragraph> + <target id="internal-hyperlink" name="internal hyperlink"> + <target id="chained" name="chained"> This paragraph referenced. <paragraph> By this \n\ @@ -540,8 +540,8 @@ __ http://example.org <document source="test data"> <target id="external" name="external" refuri="http://uri"> <target id="indirect" name="indirect" refuri="http://uri"> - <target id="internal" name="internal"> <reference name="external_" refuri="http://uri"> + <target id="internal" name="internal"> <image uri="picture.png"> <reference name="indirect_" refuri="http://uri"> <image uri="picture.png"> @@ -577,6 +577,30 @@ Testing an `indirect reference to the table of contents`_. indirect reference to the table of contents . """], +["""\ +Target should end up inside the section title, not before the section: + +.. _explicit target: + +Title +----- + +Let's reference it (`explicit target`_) to avoid an irrelevant error. +""", +"""\ +<document source="test data"> + <paragraph> + Target should end up inside the section title, not before the section: + <section id="title" name="title"> + <title> + <target id="explicit-target" name="explicit target"> + Title + <paragraph> + Let's reference it ( + <reference name="explicit target" refid="explicit-target"> + explicit target + ) to avoid an irrelevant error. +"""], # ["""\ # Title # ----- -- cgit v1.2.1 From 1e79f68582d5e1e8db9c568e97d96b420cc8ef08 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Fri, 25 Feb 2005 23:42:11 +0000 Subject: removed unused lines git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2985 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms/test_hyperlinks.py | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'test') diff --git a/test/test_transforms/test_hyperlinks.py b/test/test_transforms/test_hyperlinks.py index 8e666ca88..3a09e0207 100755 --- a/test/test_transforms/test_hyperlinks.py +++ b/test/test_transforms/test_hyperlinks.py @@ -601,21 +601,6 @@ Let's reference it (`explicit target`_) to avoid an irrelevant error. explicit target ) to avoid an irrelevant error. """], -# ["""\ -# Title -# ----- - -# Duplicate implicit targets. - -# Title -# ----- - -# indirect_ internal - -# .. _indirect: implicit_ -# """, -# """\ -# """], ]) -- cgit v1.2.1 From d097e1056d6223b6681dbc620c7a302f641c3f73 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sat, 26 Feb 2005 18:20:45 +0000 Subject: Fixed duplicate footnote label bug. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2989 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms/test_final_checks.py | 32 +++++++++++++++++++++++++++++++ test/test_transforms/test_footnotes.py | 25 ++++++++++++++++++++++++ 2 files changed, 57 insertions(+) (limited to 'test') diff --git a/test/test_transforms/test_final_checks.py b/test/test_transforms/test_final_checks.py index 220f666db..ee8d6a205 100755 --- a/test/test_transforms/test_final_checks.py +++ b/test/test_transforms/test_final_checks.py @@ -12,6 +12,7 @@ Tests for docutils.transforms.universal.FinalChecks. from __init__ import DocutilsTestSupport from docutils.transforms.universal import FinalChecks +from docutils.transforms.references import Footnotes from docutils.parsers.rst import Parser @@ -38,6 +39,37 @@ Unknown reference_. <paragraph> Unknown target name: "reference". """], +["""\ +Duplicate manual footnote labels, with reference ([1]_): + +.. [1] Footnote. + +.. [1] Footnote. +""", +"""\ +<document source="test data"> + <paragraph> + Duplicate manual footnote labels, with reference ( + <problematic id="id5" refid="id4"> + [1]_ + ): + <footnote dupname="1" id="id2"> + <label> + 1 + <paragraph> + Footnote. + <footnote dupname="1" id="id3"> + <label> + 1 + <system_message backrefs="id3" level="2" line="5" source="test data" type="WARNING"> + <paragraph> + Duplicate explicit target name: "1". + <paragraph> + Footnote. + <system_message backrefs="id5" id="id4" level="3" line="1" source="test data" type="ERROR"> + <paragraph> + Duplicate target name, cannot be used as a unique reference: "1". +"""], ]) diff --git a/test/test_transforms/test_footnotes.py b/test/test_transforms/test_footnotes.py index 0eddbfaf0..033f8fed0 100755 --- a/test/test_transforms/test_footnotes.py +++ b/test/test_transforms/test_footnotes.py @@ -512,6 +512,31 @@ u"""\ <paragraph> Auto-symbol footnote 12. """], +["""\ +Duplicate manual footnote labels: + +.. [1] Footnote. + +.. [1] Footnote. +""", +"""\ +<document source="test data"> + <paragraph> + Duplicate manual footnote labels: + <footnote dupname="1" id="id1"> + <label> + 1 + <paragraph> + Footnote. + <footnote dupname="1" id="id2"> + <label> + 1 + <system_message backrefs="id2" level="2" line="5" source="test data" type="WARNING"> + <paragraph> + Duplicate explicit target name: "1". + <paragraph> + Footnote. +"""], ]) -- cgit v1.2.1 From 9ab128b4d6f8ea81f5d7f253a93b391ed56171fd Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sat, 26 Feb 2005 18:30:34 +0000 Subject: removed unnecessary import git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2990 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms/test_final_checks.py | 1 - 1 file changed, 1 deletion(-) (limited to 'test') diff --git a/test/test_transforms/test_final_checks.py b/test/test_transforms/test_final_checks.py index ee8d6a205..efc6df75a 100755 --- a/test/test_transforms/test_final_checks.py +++ b/test/test_transforms/test_final_checks.py @@ -12,7 +12,6 @@ Tests for docutils.transforms.universal.FinalChecks. from __init__ import DocutilsTestSupport from docutils.transforms.universal import FinalChecks -from docutils.transforms.references import Footnotes from docutils.parsers.rst import Parser -- cgit v1.2.1 From bb1e03059b265bbbb040d07ebec42ff407a537a7 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sat, 26 Feb 2005 18:49:25 +0000 Subject: for testing attributes and metadata git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2991 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/input/simple.txt | 1 + test/functional/output/misc_rst_html4css1.html | 15 +++++++++++++++ test/functional/tests/misc_rst_html4css1.py | 12 ++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 test/functional/input/simple.txt create mode 100644 test/functional/output/misc_rst_html4css1.html create mode 100644 test/functional/tests/misc_rst_html4css1.py (limited to 'test') diff --git a/test/functional/input/simple.txt b/test/functional/input/simple.txt new file mode 100644 index 000000000..492e4233b --- /dev/null +++ b/test/functional/input/simple.txt @@ -0,0 +1 @@ +simple input diff --git a/test/functional/output/misc_rst_html4css1.html b/test/functional/output/misc_rst_html4css1.html new file mode 100644 index 000000000..9301f6686 --- /dev/null +++ b/test/functional/output/misc_rst_html4css1.html @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<meta name="generator" content="Docutils 0.3.8: http://docutils.sourceforge.net/" /> +<title> + + + +
+

simple input

+
+ + diff --git a/test/functional/tests/misc_rst_html4css1.py b/test/functional/tests/misc_rst_html4css1.py new file mode 100644 index 000000000..d90f3453c --- /dev/null +++ b/test/functional/tests/misc_rst_html4css1.py @@ -0,0 +1,12 @@ +# Source and destination file names. +test_source = "simple.txt" +test_destination = "misc_rst_html4css1.html" + +# Keyword parameters passed to publish_file. +reader_name = "standalone" +parser_name = "rst" +writer_name = "html4css1" + +# Settings +# test for encoded attribute value: +settings_overrides['stylesheet'] = 'foo&bar.css' -- cgit v1.2.1 From 3530937feab5f3e0b0eaf0e90fce3a9fe648a18a Mon Sep 17 00:00:00 2001 From: wiemann Date: Sat, 26 Feb 2005 23:09:26 +0000 Subject: moved misc_rst_html4css1.html from .../output/ to .../expected/ git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2993 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/misc_rst_html4css1.html | 15 +++++++++++++++ test/functional/output/misc_rst_html4css1.html | 15 --------------- 2 files changed, 15 insertions(+), 15 deletions(-) create mode 100644 test/functional/expected/misc_rst_html4css1.html delete mode 100644 test/functional/output/misc_rst_html4css1.html (limited to 'test') diff --git a/test/functional/expected/misc_rst_html4css1.html b/test/functional/expected/misc_rst_html4css1.html new file mode 100644 index 000000000..9301f6686 --- /dev/null +++ b/test/functional/expected/misc_rst_html4css1.html @@ -0,0 +1,15 @@ + + + + + + + + + + +
+

simple input

+
+ + diff --git a/test/functional/output/misc_rst_html4css1.html b/test/functional/output/misc_rst_html4css1.html deleted file mode 100644 index 9301f6686..000000000 --- a/test/functional/output/misc_rst_html4css1.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - -
-

simple input

-
- - -- cgit v1.2.1 From 72f7720c0859dc53675b9162ca0a28f6ef1bb745 Mon Sep 17 00:00:00 2001 From: wiemann Date: Sat, 26 Feb 2005 23:44:13 +0000 Subject: skip tests whose output contains "UnicodeDecodeErro" on Python 2.2 or lower, because the exception class was "UnicodeError" before Python 2.3 git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2994 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_parsers/test_rst/test_directives/test_include.py | 12 ++++++++++++ test/test_parsers/test_rst/test_directives/test_raw.py | 12 ++++++++++++ 2 files changed, 24 insertions(+) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_directives/test_include.py b/test/test_parsers/test_rst/test_directives/test_include.py index 6eb2ca7c0..122a5e225 100755 --- a/test/test_parsers/test_rst/test_directives/test_include.py +++ b/test/test_parsers/test_rst/test_directives/test_include.py @@ -11,6 +11,7 @@ Tests for misc.py "include" directive. """ import os.path +import sys from __init__ import DocutilsTestSupport @@ -338,6 +339,17 @@ Include file is UTF-16-encoded, and is not valid ASCII. # """ % (include10rel, include10rel)], ] +# Skip tests whose output contains "UnicodeDecodeError" if we are not +# using Python 2.3 or higher. +if sys.version_info < (2, 3): + for i in range(len(totest['include'])): + if totest['include'][i][1].find('UnicodeDecodeError') != -1: + del totest['include'][i] + print ("Test totest['include'][%s] skipped; " + "Python 2.3+ required for expected output." % i) + # Assume we have only one of these tests. + break + if __name__ == '__main__': import unittest diff --git a/test/test_parsers/test_rst/test_directives/test_raw.py b/test/test_parsers/test_rst/test_directives/test_raw.py index e4566c0c7..c268e8344 100755 --- a/test/test_parsers/test_rst/test_directives/test_raw.py +++ b/test/test_parsers/test_rst/test_directives/test_raw.py @@ -11,6 +11,7 @@ Tests for misc.py "raw" directive. """ import os.path +import sys from __init__ import DocutilsTestSupport @@ -136,6 +137,17 @@ Raw input file is UTF-16-encoded, and is not valid ASCII. """], ] +# Skip tests whose output contains "UnicodeDecodeError" if we are not +# using Python 2.3 or higher. +if sys.version_info < (2, 3): + for i in range(len(totest['raw'])): + if totest['raw'][i][1].find('UnicodeDecodeError') != -1: + del totest['raw'][i] + print ("Test totest['raw'][%s] skipped; " + "Python 2.3+ required for expected output." % i) + # Assume we have only one of these tests. + break + if __name__ == '__main__': import unittest -- cgit v1.2.1 From d0042a179d7074b411890bdb80d17513dc43c335 Mon Sep 17 00:00:00 2001 From: wiemann Date: Sun, 27 Feb 2005 00:06:51 +0000 Subject: use "span" instead of "a" tags for targets, because otherwise we get invalid XHTML due to nested "a" elements git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2995 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_html4css1.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index bc1cb3561..b4e932b8d 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -163,8 +163,8 @@ cross-references (example), external hy (Python web site), footnote references (manually numbered [1], anonymous auto-numbered [3], labeled auto-numbered [2], or symbolic [*]), citation references -([CIT2002]), substitution references (EXAMPLE), and inline -hyperlink targets (see Targets below for a reference back to here). +([CIT2002]), substitution references (EXAMPLE), and inline +hyperlink targets (see Targets below for a reference back to here). Character-level inline markup is also possible (although exceedingly ugly!) in reStructuredText. Problems are indicated by |problematic| text (generated by processing errors; this one is @@ -211,7 +211,7 @@ live link to PEP 258 here.

-

2.3   Enumerated Lists

+

2.3   Enumerated Lists

  1. Arabic numerals.

      @@ -490,7 +490,7 @@ citation.

2.13   Targets

-

This paragraph is pointed to by the explicit "example" target. A +

This paragraph is pointed to by the explicit "example" target. A reference can be found under Inline Markup, above. Inline hyperlink targets are also possible.

Section headers are implicit targets, referred to by name. See -- cgit v1.2.1 From 6e194ab6b0f7b77f7c8edf53730f52bd8ce5f4a1 Mon Sep 17 00:00:00 2001 From: wiemann Date: Sun, 27 Feb 2005 01:00:59 +0000 Subject: when relocating a target, it now acquires the children of its new parent; fixed bug in recording internal targets so that anonymous targets are relocated as well git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2996 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../expected/standalone_rst_html4css1.html | 6 +- test/functional/expected/standalone_rst_latex.tex | 6 +- test/test_transforms/test_hyperlinks.py | 68 +++++++++++----------- 3 files changed, 40 insertions(+), 40 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index b4e932b8d..c54bf046d 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -211,7 +211,7 @@ live link to PEP 258 here.

-

2.3   Enumerated Lists

+

2.3   Enumerated Lists

  1. Arabic numerals.

      @@ -490,9 +490,9 @@ citation.

2.13   Targets

-

This paragraph is pointed to by the explicit "example" target. A +

This paragraph is pointed to by the explicit "example" target. A reference can be found under Inline Markup, above. Inline -hyperlink targets are also possible.

+hyperlink targets are also possible.

Section headers are implicit targets, referred to by name. See Targets, which is a subsection of Body Elements.

Explicit external targets are interpolated into references such as diff --git a/test/functional/expected/standalone_rst_latex.tex b/test/functional/expected/standalone_rst_latex.tex index 847e1749e..a65919472 100644 --- a/test/functional/expected/standalone_rst_latex.tex +++ b/test/functional/expected/standalone_rst_latex.tex @@ -374,7 +374,7 @@ This nested list should be compacted by the HTML writer. \hypertarget{enumerated-lists}{} \pdfbookmark[1]{2.3~~~Enumerated Lists}{enumerated-lists} -\subsection*{2.3~~~\hypertarget{target}{}Enumerated Lists} +\subsection*{2.3~~~\hypertarget{target}{Enumerated Lists}} \newcounter{listcnt1} \begin{list}{\arabic{listcnt1}.} { @@ -773,9 +773,9 @@ citation. \pdfbookmark[1]{2.13~~~Targets}{targets} \subsection*{2.13~~~Targets} -\hypertarget{example}{}This paragraph is pointed to by the explicit ``example'' target. A +\hypertarget{example}{This paragraph is pointed to by the explicit ``example'' target. A reference can be found under \href{\#inline-markup}{Inline Markup}, above. \href{\#inline-hyperlink-targets}{Inline -hyperlink targets} are also possible. +hyperlink targets} are also possible.} Section headers are implicit targets, referred to by name. See \href{\#targets}{Targets}, which is a subsection of \href{\#body-elements}{Body Elements}. diff --git a/test/test_transforms/test_hyperlinks.py b/test/test_transforms/test_hyperlinks.py index 3a09e0207..e82a3580d 100755 --- a/test/test_transforms/test_hyperlinks.py +++ b/test/test_transforms/test_hyperlinks.py @@ -68,9 +68,9 @@ direct_ internal - - direct - internal + + direct + internal """], ["""\ .. _ztarget: @@ -84,9 +84,9 @@ indirect_ internal - - indirect - internal + + indirect + internal """], @@ -226,10 +226,10 @@ __ """, """\ - - - direct internal + + + direct internal """], ["""\ .. _ztarget: @@ -242,8 +242,8 @@ __ ztarget_ - - indirect internal + + indirect internal """], ["""\ @@ -263,13 +263,13 @@ __ ztarget_ - First + First Duplicate explicit target name: "ztarget". - Second + Second `indirect internal`__ @@ -324,7 +324,7 @@ By this `internal hyperlink`_ referemce. - This paragraph referenced. + This paragraph referenced. By this \n\ @@ -346,8 +346,8 @@ The results of the transform are not visible at the XML level. - - This paragraph referenced. + + This paragraph referenced. By this \n\ @@ -461,23 +461,23 @@ __ - - - Full syntax anonymous external hyperlink reference - , - - chained anonymous external reference - , - - simplified syntax anonymous external hyperlink reference - , - - indirect anonymous hyperlink reference - , - - internal anonymous hyperlink reference - . + + + Full syntax anonymous external hyperlink reference + , + + chained anonymous external reference + , + + simplified syntax anonymous external hyperlink reference + , + + indirect anonymous hyperlink reference + , + + internal anonymous hyperlink reference + . """], ["""\ Duplicate external target_'s (different URIs): @@ -542,7 +542,7 @@ __ http://example.org - + @@ -594,7 +594,7 @@ Let's reference it (`explicit target`_) to avoid an irrelevant error.

<target id="explicit-target" name="explicit target"> - Title + Title <paragraph> Let's reference it ( <reference name="explicit target" refid="explicit-target"> -- cgit v1.2.1 From 24b6c2e1fce8d7cc7f9e3c482ed107cd63aa25ac Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Fri, 4 Mar 2005 22:50:47 +0000 Subject: added Element.clear() git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3003 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_nodes.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/test_nodes.py b/test/test_nodes.py index 4258d7817..fe8f0420f 100755 --- a/test/test_nodes.py +++ b/test/test_nodes.py @@ -75,11 +75,14 @@ class ElementTests(unittest.TestCase): '<Element attr="1">text\nmore</Element>') dom.unlink() self.assertEquals(element.pformat(), -"""\ -<Element attr="1"> - text - more -""") + '<Element attr="1">\n text\n more\n') + + def test_clear(self): + element = nodes.Element() + element += nodes.Element() + self.assert_(len(element)) + element.clear() + self.assert_(not len(element)) class MiscTests(unittest.TestCase): -- cgit v1.2.1 From cb57e80d4b9d16aed07b08408f9e7ac527833bd1 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sat, 5 Mar 2005 15:53:45 +0000 Subject: added Node.has_children() and Node.next_node() git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3007 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_nodes.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'test') diff --git a/test/test_nodes.py b/test/test_nodes.py index fe8f0420f..fee03ffe2 100755 --- a/test/test_nodes.py +++ b/test/test_nodes.py @@ -10,6 +10,8 @@ Test module for nodes.py. """ +from __future__ import nested_scopes + import unittest from types import ClassType from DocutilsTestSupport import nodes, utils @@ -108,6 +110,42 @@ class MiscTests(unittest.TestCase): normed = nodes.make_id(input) self.assertEquals(normed, output) + def test_has_children(self): + self.assert_(not nodes.Text('some text').has_children()) + self.assert_(not nodes.Node().has_children()) + e = nodes.TextElement() + self.assert_(not e.has_children()) + e += nodes.Text('some text') + self.assert_(e.has_children()) + self.assert_(not e[0].has_children()) + + def test_next_node(self): + def getlist(n, **kwargs): + r = [] + while n is not None: + n = n.next_node(**kwargs) + r.append(n) + return r[:-1] + e = nodes.Element() + e += nodes.Element() + e[0] += nodes.Element() + e[0] += nodes.Element() + e[0][1] += nodes.Text('some text') + e += nodes.Element() + e += nodes.Element() + i = e + l = [] + self.assertEquals(getlist(e), + [e[0], e[0][0], e[0][1], e[0][1][0], e[1], e[2]]) + self.assertEquals(getlist(e, descend=0), []) + self.assertEquals(getlist(e[0], descend=0), [e[1], e[2]]) + self.assertEquals(getlist(e[0][0], descend=0), [e[0][1], e[1], e[2]]) + self.assertEquals(getlist(e, ascend=0), + [e[0], e[0][0], e[0][1], e[0][1][0]]) + self.assertEquals(getlist(e[0][0], descend=0, ascend=0), [e[0][1]]) + self.assertEquals(getlist(e, cond=lambda x: x not in e[0:2]), + [e[0][0], e[0][1], e[0][1][0], e[2]]) + class TreeCopyVisitorTests(unittest.TestCase): -- cgit v1.2.1 From 26be35634ec3071982211cfe13e1c0b48d3aeb5f Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sat, 5 Mar 2005 16:52:14 +0000 Subject: relocate internal targets only in front of sections, doctitles and subtitles git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3008 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../expected/standalone_rst_html4css1.html | 24 +++--- test/functional/expected/standalone_rst_latex.tex | 12 +-- test/functional/input/data/standard.txt | 6 +- test/test_transforms/test_hyperlinks.py | 97 +++++++++++----------- 4 files changed, 73 insertions(+), 66 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index c54bf046d..899b86324 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -18,8 +18,8 @@ </head> <body> <div class="document" id="restructuredtext-test-document"> -<h1 class="title">reStructuredText Test Document</h1> -<h2 class="subtitle" id="examples-of-syntax-constructs">Examples of Syntax Constructs</h2> +<h1 class="title"><span class="target" id="doctitle">reStructuredText Test Document</span></h1> +<h2 class="subtitle" id="examples-of-syntax-constructs"><span class="target" id="subtitle">Examples of Syntax Constructs</span></h2> <table class="docinfo" frame="void" rules="none"> <col class="docinfo-name" /> <col class="docinfo-content" /> @@ -168,7 +168,7 @@ hyperlink targets</span> (see <a class="reference" href="#targets">Targets</a> b Character-level inline markup is also possible (although exceedingly ugly!) in <em>re</em><tt class="docutils literal"><span class="pre">Structured</span></tt><em>Text</em>. Problems are indicated by <a href="#id19" name="id20"><span class="problematic" id="id20">|problematic|</span></a> text (generated by processing errors; this one is -intentional).</p> +intentional). Here is a reference to the <a class="reference" href="#doctitle">doctitle</a> and the <a class="reference" href="#subtitle">subtitle</a>.</p> <p>The default role for interpreted text is <cite>Title Reference</cite>. Here are some explicit interpreted text roles: a PEP reference (<a class="reference" href="http://www.python.org/peps/pep-0287.html">PEP 287</a>); an RFC reference (<a class="reference" href="http://www.faqs.org/rfcs/rfc2822.html">RFC 2822</a>); a <sub>subscript</sub>; a <sup>superscript</sup>; @@ -204,14 +204,14 @@ live link to PEP 258 here.</p> </ul> </li> <li>Nested item 3.</li> -<li>This nested list should be compacted by the HTML writer.<!-- Even if this item contains a target and a comment. --> +<li>This nested list should be compacted by the HTML writer.<span class="target" id="target"></span><!-- Even if this item contains a target and a comment. --> </li> </ul> </li> </ul> </div> <div class="section" id="enumerated-lists"> -<h2><a class="toc-backref" href="#id33" name="enumerated-lists">2.3   <span class="target" id="target">Enumerated Lists</span></a></h2> +<h2><a class="toc-backref" href="#id33" name="enumerated-lists">2.3   Enumerated Lists</a></h2> <ol class="arabic"> <li><p class="first">Arabic numerals.</p> <ol class="loweralpha simple"> @@ -490,9 +490,9 @@ citation.</p> </div> <div class="section" id="targets"> <h2><a class="toc-backref" href="#id43" name="targets">2.13   Targets</a></h2> -<p><span class="target" id="example">This paragraph is pointed to by the explicit "example" target. A +<span class="target" id="example"></span><p>This paragraph is pointed to by the explicit "example" target. A reference can be found under <a class="reference" href="#inline-markup">Inline Markup</a>, above. <a class="reference" href="#inline-hyperlink-targets">Inline -hyperlink targets</a> are also possible.</span></p> +hyperlink targets</a> are also possible.</p> <p>Section headers are implicit targets, referred to by name. See <a class="reference" href="#targets">Targets</a>, which is a subsection of <a class="reference" href="#body-elements">Body Elements</a>.</p> <p>Explicit external targets are interpolated into references such as @@ -868,19 +868,19 @@ section, "Docutils System Messages":</p> <div class="system-messages section"> <h1><a>Docutils System Messages</a></h1> <div class="system-message" id="id19"> -<p class="system-message-title">System Message: <a name="id19">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 94); <em><a href="#id20">backlink</a></em></p> +<p class="system-message-title">System Message: <a name="id19">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 98); <em><a href="#id20">backlink</a></em></p> Undefined substitution referenced: "problematic".</div> <div class="system-message" id="id68"> -<p class="system-message-title">System Message: <a name="id68">ERROR/3</a> (<tt class="docutils">functional/input/standalone_rst_html4css1.txt</tt>, line 348); <em><a href="#id69">backlink</a></em></p> +<p class="system-message-title">System Message: <a name="id68">ERROR/3</a> (<tt class="docutils">functional/input/standalone_rst_html4css1.txt</tt>, line 352); <em><a href="#id69">backlink</a></em></p> Unknown target name: "5".</div> <div class="system-message" id="id70"> -<p class="system-message-title">System Message: <a name="id70">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 357); <em><a href="#id71">backlink</a></em></p> +<p class="system-message-title">System Message: <a name="id70">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 361); <em><a href="#id71">backlink</a></em></p> Unknown target name: "nonexistent".</div> <div class="system-message" id="id72"> -<p class="system-message-title">System Message: <a name="id72">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 382); <em><a href="#id73">backlink</a></em></p> +<p class="system-message-title">System Message: <a name="id72">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 386); <em><a href="#id73">backlink</a></em></p> Unknown target name: "hyperlink reference without a target".</div> <div class="system-message" id="id74"> -<p class="system-message-title">System Message: <a name="id74">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 395); <em><a href="#id75">backlink</a></em></p> +<p class="system-message-title">System Message: <a name="id74">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 399); <em><a href="#id75">backlink</a></em></p> Duplicate target name, cannot be used as a unique reference: "duplicate target names".</div> </div> </div> diff --git a/test/functional/expected/standalone_rst_latex.tex b/test/functional/expected/standalone_rst_latex.tex index a65919472..9f57af6ea 100644 --- a/test/functional/expected/standalone_rst_latex.tex +++ b/test/functional/expected/standalone_rst_latex.tex @@ -302,7 +302,7 @@ hyperlink targets} (see \href{\#targets}{Targets} below for a reference back to Character-level inline markup is also possible (although exceedingly ugly!) in \emph{re}\texttt{Structured}\emph{Text}. Problems are indicated by {\color{red}\bfseries{}{\textbar}problematic{\textbar}} text (generated by processing errors; this one is -intentional). +intentional). Here is a reference to the \href{\#doctitle}{doctitle} and the \href{\#subtitle}{subtitle}. The default role for interpreted text is \titlereference{Title Reference}. Here are some explicit interpreted text roles: a PEP reference (\href{http://www.python.org/peps/pep-0287.html}{PEP 287}); an @@ -363,7 +363,7 @@ Nested item 3. \item {} This nested list should be compacted by the HTML writer. -% Even if this item contains a target and a comment. +\hypertarget{target}{}% Even if this item contains a target and a comment. \end{itemize} @@ -374,7 +374,7 @@ This nested list should be compacted by the HTML writer. \hypertarget{enumerated-lists}{} \pdfbookmark[1]{2.3~~~Enumerated Lists}{enumerated-lists} -\subsection*{2.3~~~\hypertarget{target}{Enumerated Lists}} +\subsection*{2.3~~~Enumerated Lists} \newcounter{listcnt1} \begin{list}{\arabic{listcnt1}.} { @@ -772,10 +772,10 @@ citation. \hypertarget{targets}{} \pdfbookmark[1]{2.13~~~Targets}{targets} \subsection*{2.13~~~Targets} - -\hypertarget{example}{This paragraph is pointed to by the explicit ``example'' target. A +\hypertarget{example}{} +This paragraph is pointed to by the explicit ``example'' target. A reference can be found under \href{\#inline-markup}{Inline Markup}, above. \href{\#inline-hyperlink-targets}{Inline -hyperlink targets} are also possible.} +hyperlink targets} are also possible. Section headers are implicit targets, referred to by name. See \href{\#targets}{Targets}, which is a subsection of \href{\#body-elements}{Body Elements}. diff --git a/test/functional/input/data/standard.txt b/test/functional/input/data/standard.txt index 69afbbc67..95f74820c 100644 --- a/test/functional/input/data/standard.txt +++ b/test/functional/input/data/standard.txt @@ -1,6 +1,8 @@ .. This is a comment. Note how any initial comments are moved by transforms to after the document title, subtitle, and docinfo. +.. _doctitle: + ================================ reStructuredText Test Document ================================ @@ -8,6 +10,8 @@ .. Above is the document title, and below is the subtitle. They are transformed from section titles after parsing. +.. _subtitle: + -------------------------------- Examples of Syntax Constructs -------------------------------- @@ -101,7 +105,7 @@ hyperlink targets` (see Targets_ below for a reference back to here). Character-level inline markup is also possible (although exceedingly ugly!) in *re*\ ``Structured``\ *Text*. Problems are indicated by |problematic| text (generated by processing errors; this one is -intentional). +intentional). Here is a reference to the doctitle_ and the subtitle_. The default role for interpreted text is `Title Reference`. Here are some explicit interpreted text roles: a PEP reference (:PEP:`287`); an diff --git a/test/test_transforms/test_hyperlinks.py b/test/test_transforms/test_hyperlinks.py index e82a3580d..2fd9eb831 100755 --- a/test/test_transforms/test_hyperlinks.py +++ b/test/test_transforms/test_hyperlinks.py @@ -11,8 +11,10 @@ Tests for docutils.transforms.references.Hyperlinks. """ from __init__ import DocutilsTestSupport -from docutils.transforms.references import ChainedTargets, \ - AnonymousHyperlinks, IndirectHyperlinks, ExternalTargets, InternalTargets +from docutils.transforms.references import SectionTargets, ChainedTargets, \ + AnonymousHyperlinks, IndirectHyperlinks, ExternalTargets, \ + InternalTargets + from docutils.transforms.universal import FinalChecks from docutils.parsers.rst import Parser @@ -28,9 +30,10 @@ totest = {} # Exhaustive listing of hyperlink variations: every combination of # target/reference, direct/indirect, internal/external, and named/anonymous, # plus embedded URIs. -totest['exhaustive_hyperlinks'] = ((ChainedTargets, AnonymousHyperlinks, - IndirectHyperlinks, ExternalTargets, - InternalTargets, FinalChecks), [ +totest['exhaustive_hyperlinks'] = ((SectionTargets, ChainedTargets, + AnonymousHyperlinks, IndirectHyperlinks, + ExternalTargets, InternalTargets, + FinalChecks), [ ["""\ direct_ external @@ -66,11 +69,11 @@ direct_ internal """, """\ <document source="test data"> + <target id="direct" name="direct"> <paragraph> - <target id="direct" name="direct"> - <reference name="direct" refid="direct"> - direct - internal + <reference name="direct" refid="direct"> + direct + internal """], ["""\ .. _ztarget: @@ -82,11 +85,11 @@ indirect_ internal """, """\ <document source="test data"> + <target id="ztarget" name="ztarget"> <paragraph> - <target id="ztarget" name="ztarget"> - <reference name="indirect" refid="ztarget"> - indirect - internal + <reference name="indirect" refid="ztarget"> + indirect + internal <target id="indirect2" name="indirect2" refid="ztarget"> <target id="indirect" name="indirect" refid="ztarget"> """], @@ -226,10 +229,10 @@ __ """, """\ <document source="test data"> + <target anonymous="1" id="id1"> <paragraph> - <target anonymous="1" id="id1"> - <reference anonymous="1" name="direct internal" refid="id1"> - direct internal + <reference anonymous="1" name="direct internal" refid="id1"> + direct internal """], ["""\ .. _ztarget: @@ -240,10 +243,10 @@ __ ztarget_ """, """\ <document source="test data"> + <target id="ztarget" name="ztarget"> <paragraph> - <target id="ztarget" name="ztarget"> - <reference anonymous="1" name="indirect internal" refid="ztarget"> - indirect internal + <reference anonymous="1" name="indirect internal" refid="ztarget"> + indirect internal <target anonymous="1" id="id1" refid="ztarget"> """], ["""\ @@ -261,15 +264,15 @@ __ ztarget_ """, """\ <document source="test data"> + <target dupname="ztarget" id="ztarget"> <paragraph> - <target dupname="ztarget" id="ztarget"> - First + First <system_message backrefs="id1" level="2" line="5" source="test data" type="WARNING"> <paragraph> Duplicate explicit target name: "ztarget". + <target dupname="ztarget" id="id1"> <paragraph> - <target dupname="ztarget" id="id1"> - Second + Second <paragraph> <problematic id="id4" refid="id3"> `indirect internal`__ @@ -310,7 +313,7 @@ An `anonymous embedded uri <http://direct>`__. """], ]) -totest['hyperlinks'] = ((ChainedTargets, AnonymousHyperlinks, +totest['hyperlinks'] = ((SectionTargets, ChainedTargets, AnonymousHyperlinks, IndirectHyperlinks, ExternalTargets, InternalTargets,), [ ["""\ @@ -322,9 +325,9 @@ By this `internal hyperlink`_ referemce. """, """\ <document source="test data"> + <target id="internal-hyperlink" name="internal hyperlink"> <paragraph> - <target id="internal-hyperlink" name="internal hyperlink"> - This paragraph referenced. + This paragraph referenced. <paragraph> By this \n\ <reference name="internal hyperlink" refid="internal-hyperlink"> @@ -344,10 +347,10 @@ The results of the transform are not visible at the XML level. """, """\ <document source="test data"> + <target id="chained" name="chained"> + <target id="internal-hyperlink" name="internal hyperlink"> <paragraph> - <target id="internal-hyperlink" name="internal hyperlink"> - <target id="chained" name="chained"> - This paragraph referenced. + This paragraph referenced. <paragraph> By this \n\ <reference name="internal hyperlink" refid="internal-hyperlink"> @@ -461,23 +464,23 @@ __ <target anonymous="1" id="id3" refuri="http://simplified"> <target id="external" name="external" refuri="http://indirect.external"> <target anonymous="1" id="id4" refuri="http://indirect.external"> + <target anonymous="1" id="id5"> <paragraph> - <target anonymous="1" id="id5"> - <reference anonymous="1" name="Full syntax anonymous external hyperlink reference" refuri="http://full"> - Full syntax anonymous external hyperlink reference - , - <reference anonymous="1" name="chained anonymous external reference" refuri="http://simplified"> - chained anonymous external reference - , - <reference anonymous="1" name="simplified syntax anonymous external hyperlink reference" refuri="http://simplified"> - simplified syntax anonymous external hyperlink reference - , - <reference anonymous="1" name="indirect anonymous hyperlink reference" refuri="http://indirect.external"> - indirect anonymous hyperlink reference - , - <reference anonymous="1" name="internal anonymous hyperlink reference" refid="id5"> - internal anonymous hyperlink reference - . + <reference anonymous="1" name="Full syntax anonymous external hyperlink reference" refuri="http://full"> + Full syntax anonymous external hyperlink reference + , + <reference anonymous="1" name="chained anonymous external reference" refuri="http://simplified"> + chained anonymous external reference + , + <reference anonymous="1" name="simplified syntax anonymous external hyperlink reference" refuri="http://simplified"> + simplified syntax anonymous external hyperlink reference + , + <reference anonymous="1" name="indirect anonymous hyperlink reference" refuri="http://indirect.external"> + indirect anonymous hyperlink reference + , + <reference anonymous="1" name="internal anonymous hyperlink reference" refid="id5"> + internal anonymous hyperlink reference + . """], ["""\ Duplicate external target_'s (different URIs): @@ -540,9 +543,9 @@ __ http://example.org <document source="test data"> <target id="external" name="external" refuri="http://uri"> <target id="indirect" name="indirect" refuri="http://uri"> + <target id="internal" name="internal"> <reference name="external_" refuri="http://uri"> - <target id="internal" name="internal"> - <image uri="picture.png"> + <image uri="picture.png"> <reference name="indirect_" refuri="http://uri"> <image uri="picture.png"> <reference name="internal_" refid="internal"> -- cgit v1.2.1 From ade4df9e697e698d677ef99e5096f5d4023efddc Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sat, 5 Mar 2005 17:01:39 +0000 Subject: removed unnecessary __future__ import; simplified (& sped up!) test_next_node git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3009 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_nodes.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'test') diff --git a/test/test_nodes.py b/test/test_nodes.py index fee03ffe2..25bcd3d7a 100755 --- a/test/test_nodes.py +++ b/test/test_nodes.py @@ -10,8 +10,6 @@ Test module for nodes.py. """ -from __future__ import nested_scopes - import unittest from types import ClassType from DocutilsTestSupport import nodes, utils @@ -119,13 +117,15 @@ class MiscTests(unittest.TestCase): self.assert_(e.has_children()) self.assert_(not e[0].has_children()) + def getlist(self, n, **kwargs): + r = [] + while n is not None: + n = n.next_node(**kwargs) + r.append(n) + return r[:-1] + def test_next_node(self): - def getlist(n, **kwargs): - r = [] - while n is not None: - n = n.next_node(**kwargs) - r.append(n) - return r[:-1] + getlist = self.getlist e = nodes.Element() e += nodes.Element() e[0] += nodes.Element() -- cgit v1.2.1 From 6e46cba1abe3f4a769591fe971b99a51d6ff3005 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sat, 5 Mar 2005 17:11:05 +0000 Subject: reverted test_nodes.py from 1.14 to 1.13; the nested scopes are necessary because of the lambda expression in line 146:: self.assertEquals(getlist(e, cond=lambda x: x not in e[0:2]), [e[0][0], e[0][1], e[0][1][0], e[2]]) otherwise it doesn't work with Python 2.1 because we can't reference the local e variable. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3010 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_nodes.py | 16 ++++++++-------- test/test_transforms/test_contents.py | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'test') diff --git a/test/test_nodes.py b/test/test_nodes.py index 25bcd3d7a..fee03ffe2 100755 --- a/test/test_nodes.py +++ b/test/test_nodes.py @@ -10,6 +10,8 @@ Test module for nodes.py. """ +from __future__ import nested_scopes + import unittest from types import ClassType from DocutilsTestSupport import nodes, utils @@ -117,15 +119,13 @@ class MiscTests(unittest.TestCase): self.assert_(e.has_children()) self.assert_(not e[0].has_children()) - def getlist(self, n, **kwargs): - r = [] - while n is not None: - n = n.next_node(**kwargs) - r.append(n) - return r[:-1] - def test_next_node(self): - getlist = self.getlist + def getlist(n, **kwargs): + r = [] + while n is not None: + n = n.next_node(**kwargs) + r.append(n) + return r[:-1] e = nodes.Element() e += nodes.Element() e[0] += nodes.Element() diff --git a/test/test_transforms/test_contents.py b/test/test_transforms/test_contents.py index 6816ba2eb..3fbc04a9d 100755 --- a/test/test_transforms/test_contents.py +++ b/test/test_transforms/test_contents.py @@ -32,12 +32,12 @@ Title 1 ======= Paragraph 1. -Title 2 -------- +Title_ 2 +-------- Paragraph 2. -Title 3 -``````` +_`Title` 3 +`````````` Paragraph 3. Title 4 -- cgit v1.2.1 From 739ff84633cb5661e211b501c944d0e470c20910 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sat, 5 Mar 2005 17:12:08 +0000 Subject: reverted accidentally committed file git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3011 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms/test_contents.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/test_transforms/test_contents.py b/test/test_transforms/test_contents.py index 3fbc04a9d..6816ba2eb 100755 --- a/test/test_transforms/test_contents.py +++ b/test/test_transforms/test_contents.py @@ -32,12 +32,12 @@ Title 1 ======= Paragraph 1. -Title_ 2 --------- +Title 2 +------- Paragraph 2. -_`Title` 3 -`````````` +Title 3 +``````` Paragraph 3. Title 4 -- cgit v1.2.1 From aebd1663dd94913d95761b230354731500a873cd Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sat, 5 Mar 2005 17:40:15 +0000 Subject: added Node.tree() method git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3012 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_nodes.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/test_nodes.py b/test/test_nodes.py index fee03ffe2..96855c78c 100755 --- a/test/test_nodes.py +++ b/test/test_nodes.py @@ -129,12 +129,10 @@ class MiscTests(unittest.TestCase): e = nodes.Element() e += nodes.Element() e[0] += nodes.Element() - e[0] += nodes.Element() + e[0] += nodes.TextElement() e[0][1] += nodes.Text('some text') e += nodes.Element() e += nodes.Element() - i = e - l = [] self.assertEquals(getlist(e), [e[0], e[0][0], e[0][1], e[0][1][0], e[1], e[2]]) self.assertEquals(getlist(e, descend=0), []) @@ -146,6 +144,20 @@ class MiscTests(unittest.TestCase): self.assertEquals(getlist(e, cond=lambda x: x not in e[0:2]), [e[0][0], e[0][1], e[0][1][0], e[2]]) + def test_tree(self): + e = nodes.Element() + e += nodes.Element() + e[0] += nodes.Element() + e[0] += nodes.TextElement() + e[0][1] += nodes.Text('some text') + e += nodes.Element() + e += nodes.Element() + self.assertEquals(e.tree(), + [e, e[0], e[0][0], e[0][1], e[0][1][0], e[1], e[2]]) + self.assertEquals(e[0].tree(), [e[0], e[0][0], e[0][1], e[0][1][0]]) + self.assertEquals(e[1].tree(), [e[1]]) + self.assertEquals(e[0][1][0].tree(), [e[0][1][0]]) + class TreeCopyVisitorTests(unittest.TestCase): -- cgit v1.2.1 From 914268ed1172bb8fb80bba79c8c9f2bfa97f07c0 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sat, 5 Mar 2005 17:47:02 +0000 Subject: Reintroduced the changes from 1.13, plus allowance for py2.1, and no reliance on "from __future__ import" which I DO NOT want in production code. Also lambdas are ugly, confusing, and avoidable -- keep those out too. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3013 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_nodes.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'test') diff --git a/test/test_nodes.py b/test/test_nodes.py index 96855c78c..7420badd5 100755 --- a/test/test_nodes.py +++ b/test/test_nodes.py @@ -10,8 +10,6 @@ Test module for nodes.py. """ -from __future__ import nested_scopes - import unittest from types import ClassType from DocutilsTestSupport import nodes, utils @@ -119,13 +117,15 @@ class MiscTests(unittest.TestCase): self.assert_(e.has_children()) self.assert_(not e[0].has_children()) + def getlist(self, n, **kwargs): + r = [] + while n is not None: + n = n.next_node(**kwargs) + r.append(n) + return r[:-1] + def test_next_node(self): - def getlist(n, **kwargs): - r = [] - while n is not None: - n = n.next_node(**kwargs) - r.append(n) - return r[:-1] + getlist = self.getlist e = nodes.Element() e += nodes.Element() e[0] += nodes.Element() @@ -141,9 +141,13 @@ class MiscTests(unittest.TestCase): self.assertEquals(getlist(e, ascend=0), [e[0], e[0][0], e[0][1], e[0][1][0]]) self.assertEquals(getlist(e[0][0], descend=0, ascend=0), [e[0][1]]) - self.assertEquals(getlist(e, cond=lambda x: x not in e[0:2]), + self.testlist = e[0:2] + self.assertEquals(getlist(e, cond=self.not_in_testlist), [e[0][0], e[0][1], e[0][1][0], e[2]]) + def not_in_testlist(self, x): + return x not in self.testlist + def test_tree(self): e = nodes.Element() e += nodes.Element() -- cgit v1.2.1 From 95bd4c152312d1b9a71ef107b8e3d8146b54b90d Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sat, 5 Mar 2005 17:48:11 +0000 Subject: do not add a TOC-backlink if title contains a reference git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3014 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms/test_contents.py | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'test') diff --git a/test/test_transforms/test_contents.py b/test/test_transforms/test_contents.py index 6816ba2eb..4c9d515a8 100755 --- a/test/test_transforms/test_contents.py +++ b/test/test_transforms/test_contents.py @@ -32,12 +32,12 @@ Title 1 ======= Paragraph 1. -Title 2 -------- +Title_ 2 +-------- Paragraph 2. -Title 3 -``````` +_`Title` 3 +`````````` Paragraph 3. Title 4 @@ -58,12 +58,14 @@ Paragraph 4. <list_item> <paragraph> <reference id="id2" refid="title-2"> - Title 2 + Title + 2 <bullet_list> <list_item> <paragraph> <reference id="id3" refid="title-3"> - Title 3 + Title + 3 <list_item> <paragraph> <reference id="id4" refid="title-4"> @@ -74,13 +76,17 @@ Paragraph 4. <paragraph> Paragraph 1. <section id="title-2" name="title 2"> - <title refid="id2"> - Title 2 + <title> + <reference name="Title" refname="title"> + Title + 2 <paragraph> Paragraph 2. <section id="title-3" name="title 3"> <title refid="id3"> - Title 3 + <target id="title" name="title"> + Title + 3 <paragraph> Paragraph 3. <section id="title-4" name="title 4"> -- cgit v1.2.1 From eb61e1cc35eb16a7308e469e000a98f68d3ea896 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sat, 5 Mar 2005 18:06:48 +0000 Subject: removed lambda, renamed cond to condition (explicit & self-documenting) git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3016 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_nodes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/test_nodes.py b/test/test_nodes.py index 7420badd5..33dfe87ff 100755 --- a/test/test_nodes.py +++ b/test/test_nodes.py @@ -142,7 +142,7 @@ class MiscTests(unittest.TestCase): [e[0], e[0][0], e[0][1], e[0][1][0]]) self.assertEquals(getlist(e[0][0], descend=0, ascend=0), [e[0][1]]) self.testlist = e[0:2] - self.assertEquals(getlist(e, cond=self.not_in_testlist), + self.assertEquals(getlist(e, condition=self.not_in_testlist), [e[0][0], e[0][1], e[0][1][0], e[2]]) def not_in_testlist(self, x): -- cgit v1.2.1 From b17334d09de7211955e834b0243695d6cb637d84 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sat, 5 Mar 2005 18:32:47 +0000 Subject: Allowed whitespace in paths and URLs (targets; "image", "figure", & "include" directive args; ":file:" & ":url:" directive options). git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3018 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../test_rst/test_directives/test_figures.py | 26 ---------- .../test_rst/test_directives/test_images.py | 25 ++-------- test/test_parsers/test_rst/test_targets.py | 57 ++-------------------- 3 files changed, 6 insertions(+), 102 deletions(-) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_directives/test_figures.py b/test/test_parsers/test_rst/test_directives/test_figures.py index 888744bad..355a06825 100755 --- a/test/test_parsers/test_rst/test_directives/test_figures.py +++ b/test/test_parsers/test_rst/test_directives/test_figures.py @@ -29,17 +29,6 @@ totest['figures'] = [ <image uri="picture.png"> """], ["""\ -.. figure:: not an image URI -""", -"""\ -<document source="test data"> - <system_message level="3" line="1" source="test data" type="ERROR"> - <paragraph> - Image URI contains whitespace. - <literal_block xml:space="preserve"> - .. figure:: not an image URI -"""], -["""\ .. figure:: picture.png A picture with a caption. @@ -69,21 +58,6 @@ totest['figures'] = [ - A picture with an invalid caption. """], ["""\ -.. figure:: not an image URI - - And a caption. -""", -"""\ -<document source="test data"> - <system_message level="3" line="1" source="test data" type="ERROR"> - <paragraph> - Image URI contains whitespace. - <literal_block xml:space="preserve"> - .. figure:: not an image URI - \n\ - And a caption. -"""], -["""\ .. figure:: picture.png .. diff --git a/test/test_parsers/test_rst/test_directives/test_images.py b/test/test_parsers/test_rst/test_directives/test_images.py index 58f6cffd2..b7ffa40b7 100755 --- a/test/test_parsers/test_rst/test_directives/test_images.py +++ b/test/test_parsers/test_rst/test_directives/test_images.py @@ -40,15 +40,11 @@ totest['images'] = [ .. image:: """], ["""\ -.. image:: one two three +.. image:: one two three.png """, """\ <document source="test data"> - <system_message level="3" line="1" source="test data" type="ERROR"> - <paragraph> - Image URI contains whitespace. - <literal_block xml:space="preserve"> - .. image:: one two three + <image uri="one two three.png"> """], ["""\ .. image:: picture.png @@ -161,12 +157,7 @@ totest['images'] = [ """, """\ <document source="test data"> - <system_message level="3" line="1" source="test data" type="ERROR"> - <paragraph> - Image URI contains whitespace. - <literal_block xml:space="preserve"> - .. image:: picture.png - scale: 50 + <image uri="picture.pngscale: 50"> """], ["""\ .. image:: picture.png @@ -290,9 +281,6 @@ totest['images'] = [ ["""\ .. image:: picture.png :target: - -.. image:: picture.png - :target: an invalid URI """, """\ <document source="test data"> @@ -304,13 +292,6 @@ totest['images'] = [ <literal_block xml:space="preserve"> .. image:: picture.png :target: - <system_message level="2" line="4" source="test data" type="WARNING"> - <paragraph> - Hyperlink target contains whitespace. Perhaps a footnote was intended? - <literal_block xml:space="preserve"> - .. image:: picture.png - :target: an invalid URI - <image uri="picture.png"> """], ] diff --git a/test/test_parsers/test_rst/test_targets.py b/test/test_parsers/test_rst/test_targets.py index 9147a1e68..8d6fbe42b 100755 --- a/test/test_parsers/test_rst/test_targets.py +++ b/test/test_parsers/test_rst/test_targets.py @@ -77,60 +77,6 @@ Indirect hyperlink targets: <target id="target2" name="target2" refname="phrase-link reference"> """], ["""\ -.. _target1: Not a proper hyperlink target - -.. _target2: Although it ends with an underscore, this is not a phrase-link_ - -.. _target3: A multi-line verson of something - ending with an underscore, but not a phrase-link_ -""", -"""\ -<document source="test data"> - <system_message level="2" line="1" source="test data" type="WARNING"> - <paragraph> - Hyperlink target contains whitespace. Perhaps a footnote was intended? - <literal_block xml:space="preserve"> - .. _target1: Not a proper hyperlink target - <system_message level="2" line="3" source="test data" type="WARNING"> - <paragraph> - Hyperlink target contains whitespace. Perhaps a footnote was intended? - <literal_block xml:space="preserve"> - .. _target2: Although it ends with an underscore, this is not a phrase-link_ - <system_message level="2" line="5" source="test data" type="WARNING"> - <paragraph> - Hyperlink target contains whitespace. Perhaps a footnote was intended? - <literal_block xml:space="preserve"> - .. _target3: A multi-line verson of something - ending with an underscore, but not a phrase-link_ -"""], -["""\ -.. __: Not a proper hyperlink target - -__ Although it ends with an underscore, this is not a phrase-link_ - -__ A multi-line verson of something - ending with an underscore, but not a phrase-link_ -""", -"""\ -<document source="test data"> - <system_message level="2" line="1" source="test data" type="WARNING"> - <paragraph> - Hyperlink target contains whitespace. Perhaps a footnote was intended? - <literal_block xml:space="preserve"> - .. __: Not a proper hyperlink target - <system_message level="2" line="3" source="test data" type="WARNING"> - <paragraph> - Hyperlink target contains whitespace. Perhaps a footnote was intended? - <literal_block xml:space="preserve"> - __ Although it ends with an underscore, this is not a phrase-link_ - <system_message level="2" line="5" source="test data" type="WARNING"> - <paragraph> - Hyperlink target contains whitespace. Perhaps a footnote was intended? - <literal_block xml:space="preserve"> - __ A multi-line verson of something - ending with an underscore, but not a phrase-link_ -"""], -["""\ .. _a long target name: .. _`a target name: including a colon (quoted)`: @@ -392,12 +338,15 @@ Anonymous indirect hyperlink target: Anonymous external hyperlink target, not indirect: __ uri\\_ + +__ this URI ends with an underscore_ """, """\ <document source="test data"> <paragraph> Anonymous external hyperlink target, not indirect: <target anonymous="1" id="id1" refuri="uri_"> + <target anonymous="1" id="id2" refuri="this URI ends with an underscore_"> """], ["""\ Anonymous indirect hyperlink targets: -- cgit v1.2.1 From 696fdc7509435189525a9953fba48859e58ceab6 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sat, 5 Mar 2005 21:29:16 +0000 Subject: made relocated targets before sections zero-length git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3021 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_html4css1.html | 4 ++-- test/test_transforms/test_hyperlinks.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index 899b86324..e4a03e6cb 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -18,8 +18,8 @@ </head> <body> <div class="document" id="restructuredtext-test-document"> -<h1 class="title"><span class="target" id="doctitle">reStructuredText Test Document</span></h1> -<h2 class="subtitle" id="examples-of-syntax-constructs"><span class="target" id="subtitle">Examples of Syntax Constructs</span></h2> +<h1 class="title"><span class="target" id="doctitle"></span>reStructuredText Test Document</h1> +<h2 class="subtitle" id="examples-of-syntax-constructs"><span class="target" id="subtitle"></span>Examples of Syntax Constructs</h2> <table class="docinfo" frame="void" rules="none"> <col class="docinfo-name" /> <col class="docinfo-content" /> diff --git a/test/test_transforms/test_hyperlinks.py b/test/test_transforms/test_hyperlinks.py index 2fd9eb831..03f3a0c12 100755 --- a/test/test_transforms/test_hyperlinks.py +++ b/test/test_transforms/test_hyperlinks.py @@ -597,7 +597,7 @@ Let's reference it (`explicit target`_) to avoid an irrelevant error. <section id="title" name="title"> <title> <target id="explicit-target" name="explicit target"> - Title + Title <paragraph> Let's reference it ( <reference name="explicit target" refid="explicit-target"> -- cgit v1.2.1 From de76fb4857800cda681e1c1bb83a2feaaa87a3a8 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sat, 5 Mar 2005 22:07:49 +0000 Subject: fixed bug with chained targets in front of a section git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3022 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms/test_hyperlinks.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'test') diff --git a/test/test_transforms/test_hyperlinks.py b/test/test_transforms/test_hyperlinks.py index 03f3a0c12..40bf5a9e0 100755 --- a/test/test_transforms/test_hyperlinks.py +++ b/test/test_transforms/test_hyperlinks.py @@ -604,6 +604,30 @@ Let's reference it (`explicit target`_) to avoid an irrelevant error. explicit target ) to avoid an irrelevant error. """], +["""\ +target1_ should refer to target2_, not the Title. + +.. _target1: +.. _target2: URI + +Title +===== +""", +"""\ +<document source="test data"> + <paragraph> + <reference name="target1" refuri="URI"> + target1 + should refer to \n\ + <reference name="target2" refuri="URI"> + target2 + , not the Title. + <target id="target1" name="target1" refuri="URI"> + <target id="target2" name="target2" refuri="URI"> + <section id="title" name="title"> + <title> + Title +"""], ]) -- cgit v1.2.1 From ef0f3418f94c160ad02eb366a932a1dc9bb901d6 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sun, 13 Mar 2005 02:41:36 +0000 Subject: renamed docutils.nodes.Node.tree to docutils.nodes.Node.flattened, and added to the docstring git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3029 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_nodes.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/test_nodes.py b/test/test_nodes.py index 33dfe87ff..dcdd00a66 100755 --- a/test/test_nodes.py +++ b/test/test_nodes.py @@ -148,7 +148,7 @@ class MiscTests(unittest.TestCase): def not_in_testlist(self, x): return x not in self.testlist - def test_tree(self): + def test_flattened(self): e = nodes.Element() e += nodes.Element() e[0] += nodes.Element() @@ -156,11 +156,12 @@ class MiscTests(unittest.TestCase): e[0][1] += nodes.Text('some text') e += nodes.Element() e += nodes.Element() - self.assertEquals(e.tree(), + self.assertEquals(e.flattened(), [e, e[0], e[0][0], e[0][1], e[0][1][0], e[1], e[2]]) - self.assertEquals(e[0].tree(), [e[0], e[0][0], e[0][1], e[0][1][0]]) - self.assertEquals(e[1].tree(), [e[1]]) - self.assertEquals(e[0][1][0].tree(), [e[0][1][0]]) + self.assertEquals(e[0].flattened(), + [e[0], e[0][0], e[0][1], e[0][1][0]]) + self.assertEquals(e[1].flattened(), [e[1]]) + self.assertEquals(e[0][1][0].flattened(), [e[0][1][0]]) class TreeCopyVisitorTests(unittest.TestCase): -- cgit v1.2.1 From 4fe2b0fb8aa4609da22988bad7dd418c572386bf Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Mon, 14 Mar 2005 16:00:03 +0000 Subject: removed Node.has_children method git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3037 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_nodes.py | 9 --------- 1 file changed, 9 deletions(-) (limited to 'test') diff --git a/test/test_nodes.py b/test/test_nodes.py index dcdd00a66..f45af97b1 100755 --- a/test/test_nodes.py +++ b/test/test_nodes.py @@ -108,15 +108,6 @@ class MiscTests(unittest.TestCase): normed = nodes.make_id(input) self.assertEquals(normed, output) - def test_has_children(self): - self.assert_(not nodes.Text('some text').has_children()) - self.assert_(not nodes.Node().has_children()) - e = nodes.TextElement() - self.assert_(not e.has_children()) - e += nodes.Text('some text') - self.assert_(e.has_children()) - self.assert_(not e[0].has_children()) - def getlist(self, n, **kwargs): r = [] while n is not None: -- cgit v1.2.1 From 43ca6a79125d28fce6c2ab2142f93733319382d4 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Mon, 14 Mar 2005 16:16:57 +0000 Subject: removed redundant get_children(); in case we want to change the behavior later, be can use __getattr__ or a descriptor; (the list is modified in place anyway, so there'd be not much to change about get_children) git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3038 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_nodes.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/test_nodes.py b/test/test_nodes.py index f45af97b1..42cc4916f 100755 --- a/test/test_nodes.py +++ b/test/test_nodes.py @@ -172,11 +172,9 @@ class TreeCopyVisitorTests(unittest.TestCase): def compare_trees(self, one, two): self.assertEquals(one.__class__, two.__class__) self.assertNotEquals(id(one), id(two)) - children1 = one.get_children() - children2 = two.get_children() - self.assertEquals(len(children1), len(children2)) - for i in range(len(children1)): - self.compare_trees(children1[i], children2[i]) + self.assertEquals(len(one.children), len(two.children)) + for i in range(len(one.children)): + self.compare_trees(one.children[i], two.children[i]) def test_copy_whole(self): visitor = nodes.TreeCopyVisitor(self.document) -- cgit v1.2.1 From 4c757af54eabf7f37b89dcc53813b2d9da223e15 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Mon, 14 Mar 2005 16:45:09 +0000 Subject: re-added --no-random option of PEP writer for testing git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3039 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/data/config_1.txt | 1 + test/data/config_old.txt | 1 + test/test_settings.py | 2 ++ 3 files changed, 4 insertions(+) (limited to 'test') diff --git a/test/data/config_1.txt b/test/data/config_1.txt index 0c513dc57..f94074a8a 100644 --- a/test/data/config_1.txt +++ b/test/data/config_1.txt @@ -22,3 +22,4 @@ stylesheet-path: stylesheets/default.css template: pep-html-template stylesheet-path: stylesheets/pep.css python-home: http://www.python.org +no-random: yes diff --git a/test/data/config_old.txt b/test/data/config_old.txt index 53ab8cb70..fa07d6dab 100644 --- a/test/data/config_old.txt +++ b/test/data/config_old.txt @@ -11,3 +11,4 @@ stylesheet-path: stylesheets/default.css pep-template: pep-html-template pep-stylesheet-path: stylesheets/pep.css python-home: http://www.python.org +no-random: 1 diff --git a/test/test_settings.py b/test/test_settings.py index bb0b87020..2a17c6eef 100755 --- a/test/test_settings.py +++ b/test/test_settings.py @@ -43,6 +43,7 @@ class ConfigFileTests(unittest.TestCase): settings = { 'old': {'datestamp': '%Y-%m-%d %H:%M UTC', 'generator': 1, + 'no_random': 1, 'python_home': 'http://www.python.org', 'source_link': 1, 'stylesheet': None, @@ -50,6 +51,7 @@ class ConfigFileTests(unittest.TestCase): 'template': fixpath('data/pep-html-template')}, 'one': {'datestamp': '%Y-%m-%d %H:%M UTC', 'generator': 1, + 'no_random': 1, 'python_home': 'http://www.python.org', 'record_dependencies': utils.DependencyList(), 'source_link': 1, -- cgit v1.2.1 From 2bc67278cb433cf4622301f0f909f12c81f87c49 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Mon, 14 Mar 2005 17:06:53 +0000 Subject: added functional test for PEPs; the resulting pep_html.html is not valid XHTML; could you have a look at it, David? git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3040 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/pep_html.html | 75 ++++++++++++++++++++++++++++++++++ test/functional/input/pep_html.txt | 23 +++++++++++ test/functional/tests/pep_html.py | 16 ++++++++ 3 files changed, 114 insertions(+) create mode 100644 test/functional/expected/pep_html.html create mode 100644 test/functional/input/pep_html.txt create mode 100644 test/functional/tests/pep_html.py (limited to 'test') diff --git a/test/functional/expected/pep_html.html b/test/functional/expected/pep_html.html new file mode 100644 index 000000000..26a0203be --- /dev/null +++ b/test/functional/expected/pep_html.html @@ -0,0 +1,75 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<!-- +This HTML is auto-generated. DO NOT EDIT THIS FILE! If you are writing a new +PEP, see http://www.python.org/peps/pep-0001.html for instructions and links +to templates. DO NOT USE THIS HTML FILE AS YOUR TEMPLATE! +--> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + <meta name="generator" content="Docutils 0.3.8: http://docutils.sourceforge.net/" /> + <title>PEP 100 -- Test PEP + + + +
+ + + +++ + + + + + + + + + + + + + + + + + + + + + + + +
PEP:100
Title:Test PEP
Version:1.9
Last-Modified:2004/06/05 02:55:11
Author:John Doe <john at example.org>
Discussions-To:<devnull at example.org>
Status:Draft
Type:Standards Track
Content-Type:text/x-rst
Created:01-Jun-2001
Post-History:13-Jun-2001
+
+ +
+

Abstract

+

Just a test.

+
+ + +
+ + + diff --git a/test/functional/input/pep_html.txt b/test/functional/input/pep_html.txt new file mode 100644 index 000000000..fb70328b2 --- /dev/null +++ b/test/functional/input/pep_html.txt @@ -0,0 +1,23 @@ +PEP: 100 +Title: Test PEP +Version: $Revision$ +Last-Modified: $Date$ +Author: John Doe +Discussions-To: +Status: Draft +Type: Standards Track +Content-Type: text/x-rst +Created: 01-Jun-2001 +Post-History: 13-Jun-2001 + + +Abstract +======== + +Just a test. + + +Copyright +========= + +This document has been placed in the public domain. diff --git a/test/functional/tests/pep_html.py b/test/functional/tests/pep_html.py new file mode 100644 index 000000000..6dd226522 --- /dev/null +++ b/test/functional/tests/pep_html.py @@ -0,0 +1,16 @@ +# Source and destination file names. +test_source = "pep_html.txt" +test_destination = "pep_html.html" + +# Keyword parameters passed to publish_file. +reader_name = "pep" +parser_name = "rst" +writer_name = "pep_html" + +# Settings +settings_overrides['stylesheet'] = None +settings_overrides['stylesheet_path'] = "../tools/stylesheets/pep.css" +settings_overrides['template'] = "../tools/pep-html-template" +settings_overrides['python_home'] = "http://www.python.org/" +settings_overrides['pep_home'] = "http://www.python.org/peps/" +settings_overrides['no_random'] = 1 -- cgit v1.2.1 From 5231b910bd553bebf5108202ed796c4d43989b0c Mon Sep 17 00:00:00 2001 From: wiemann Date: Mon, 14 Mar 2005 17:11:18 +0000 Subject: removed trailing slash from python_home and pep_home; removed CVS keywords git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3041 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/pep_html.html | 14 +++++++------- test/functional/input/pep_html.txt | 4 ++-- test/functional/tests/pep_html.py | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) (limited to 'test') diff --git a/test/functional/expected/pep_html.html b/test/functional/expected/pep_html.html index 26a0203be..6e990e61a 100644 --- a/test/functional/expected/pep_html.html +++ b/test/functional/expected/pep_html.html @@ -16,13 +16,13 @@ to templates. DO NOT USE THIS HTML FILE AS YOUR TEMPLATE! @@ -32,9 +32,9 @@ to templates. DO NOT USE THIS HTML FILE AS YOUR TEMPLATE! - + - + diff --git a/test/functional/input/pep_html.txt b/test/functional/input/pep_html.txt index fb70328b2..5cca3726e 100644 --- a/test/functional/input/pep_html.txt +++ b/test/functional/input/pep_html.txt @@ -1,7 +1,7 @@ PEP: 100 Title: Test PEP -Version: $Revision$ -Last-Modified: $Date$ +Version: 42 +Last-Modified: A long time ago. Author: John Doe Discussions-To: Status: Draft diff --git a/test/functional/tests/pep_html.py b/test/functional/tests/pep_html.py index 6dd226522..47e8b52d3 100644 --- a/test/functional/tests/pep_html.py +++ b/test/functional/tests/pep_html.py @@ -11,6 +11,6 @@ writer_name = "pep_html" settings_overrides['stylesheet'] = None settings_overrides['stylesheet_path'] = "../tools/stylesheets/pep.css" settings_overrides['template'] = "../tools/pep-html-template" -settings_overrides['python_home'] = "http://www.python.org/" -settings_overrides['pep_home'] = "http://www.python.org/peps/" +settings_overrides['python_home'] = "http://www.python.org" +settings_overrides['pep_home'] = "http://www.python.org/peps" settings_overrides['no_random'] = 1 -- cgit v1.2.1 From 0a938a279683da492acd6512d0af6fa636c5a51c Mon Sep 17 00:00:00 2001 From: goodger Date: Tue, 15 Mar 2005 00:37:51 +0000 Subject: differentiate between paths and URIs git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3046 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_parsers/test_rst/test_directives/include 11.txt | 1 + test/test_parsers/test_rst/test_directives/test_images.py | 4 ++-- .../test_parsers/test_rst/test_directives/test_include.py | 15 +++++++++++++++ test/test_parsers/test_rst/test_targets.py | 2 +- 4 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 test/test_parsers/test_rst/test_directives/include 11.txt (limited to 'test') diff --git a/test/test_parsers/test_rst/test_directives/include 11.txt b/test/test_parsers/test_rst/test_directives/include 11.txt new file mode 100644 index 000000000..7b57bd29e --- /dev/null +++ b/test/test_parsers/test_rst/test_directives/include 11.txt @@ -0,0 +1 @@ +some text diff --git a/test/test_parsers/test_rst/test_directives/test_images.py b/test/test_parsers/test_rst/test_directives/test_images.py index b7ffa40b7..256f2e00f 100755 --- a/test/test_parsers/test_rst/test_directives/test_images.py +++ b/test/test_parsers/test_rst/test_directives/test_images.py @@ -44,7 +44,7 @@ totest['images'] = [ """, """\ - + """], ["""\ .. image:: picture.png @@ -157,7 +157,7 @@ totest['images'] = [ """, """\ - + """], ["""\ .. image:: picture.png diff --git a/test/test_parsers/test_rst/test_directives/test_include.py b/test/test_parsers/test_rst/test_directives/test_include.py index 122a5e225..31544dd6e 100755 --- a/test/test_parsers/test_rst/test_directives/test_include.py +++ b/test/test_parsers/test_rst/test_directives/test_include.py @@ -28,6 +28,8 @@ include3 = os.path.join(mydir, 'include3.txt') include8 = os.path.join(mydir, 'include8.txt') include10 = os.path.join(mydir, 'include10.txt') include10rel = DocutilsTestSupport.utils.relative_path(None, include10) +include11 = os.path.join(mydir, 'include 11.txt') +include11rel = DocutilsTestSupport.utils.relative_path(None, include11) utf_16_file = os.path.join(mydir, 'utf-16.csv') utf_16_file_rel = DocutilsTestSupport.utils.relative_path(None, utf_16_file) @@ -337,8 +339,21 @@ Include file is UTF-16-encoded, and is not valid ASCII. # # .. |bad| unicode:: 0xFFFFFFFFF # """ % (include10rel, include10rel)], +["""\ +Include file with whitespace in the path: + +.. include:: %s +""" % include11rel, +"""\ + + + Include file with whitespace in the path: + + some text +"""], ] + # Skip tests whose output contains "UnicodeDecodeError" if we are not # using Python 2.3 or higher. if sys.version_info < (2, 3): diff --git a/test/test_parsers/test_rst/test_targets.py b/test/test_parsers/test_rst/test_targets.py index 8d6fbe42b..ca1e239f1 100755 --- a/test/test_parsers/test_rst/test_targets.py +++ b/test/test_parsers/test_rst/test_targets.py @@ -346,7 +346,7 @@ __ this URI ends with an underscore_ Anonymous external hyperlink target, not indirect: - + """], ["""\ Anonymous indirect hyperlink targets: -- cgit v1.2.1 From 94ef88a19b8d2aae3b4c089d921b604c177f633c Mon Sep 17 00:00:00 2001 From: wiemann Date: Tue, 15 Mar 2005 15:23:52 +0000 Subject: removed Node.flattened(); added Node.traverse(); implemented Node.next_node() using Node.traverse() git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3048 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_nodes.py | 70 ++++++++++++++++++++++++++++++++---------------------- 1 file changed, 42 insertions(+), 28 deletions(-) (limited to 'test') diff --git a/test/test_nodes.py b/test/test_nodes.py index 42cc4916f..ebf9da3f0 100755 --- a/test/test_nodes.py +++ b/test/test_nodes.py @@ -108,15 +108,7 @@ class MiscTests(unittest.TestCase): normed = nodes.make_id(input) self.assertEquals(normed, output) - def getlist(self, n, **kwargs): - r = [] - while n is not None: - n = n.next_node(**kwargs) - r.append(n) - return r[:-1] - - def test_next_node(self): - getlist = self.getlist + def test_traverse(self): e = nodes.Element() e += nodes.Element() e[0] += nodes.Element() @@ -124,22 +116,34 @@ class MiscTests(unittest.TestCase): e[0][1] += nodes.Text('some text') e += nodes.Element() e += nodes.Element() - self.assertEquals(getlist(e), + self.assertEquals(list(e.traverse()), + [e, e[0], e[0][0], e[0][1], e[0][1][0], e[1], e[2]]) + self.assertEquals(list(e.traverse(include_self=0)), [e[0], e[0][0], e[0][1], e[0][1][0], e[1], e[2]]) - self.assertEquals(getlist(e, descend=0), []) - self.assertEquals(getlist(e[0], descend=0), [e[1], e[2]]) - self.assertEquals(getlist(e[0][0], descend=0), [e[0][1], e[1], e[2]]) - self.assertEquals(getlist(e, ascend=0), - [e[0], e[0][0], e[0][1], e[0][1][0]]) - self.assertEquals(getlist(e[0][0], descend=0, ascend=0), [e[0][1]]) + self.assertEquals(list(e.traverse(descend=0)), + [e]) + self.assertEquals(list(e[0].traverse(descend=0, ascend=1)), + [e[0], e[1], e[2]]) + self.assertEquals(list(e[0][0].traverse(descend=0, ascend=1)), + [e[0][0], e[0][1], e[1], e[2]]) + self.assertEquals(list(e[0][0].traverse(descend=0, siblings=1)), + [e[0][0], e[0][1]]) self.testlist = e[0:2] - self.assertEquals(getlist(e, condition=self.not_in_testlist), - [e[0][0], e[0][1], e[0][1][0], e[2]]) - - def not_in_testlist(self, x): - return x not in self.testlist + self.assertEquals(list(e.traverse(condition=self.not_in_testlist)), + [e, e[0][0], e[0][1], e[0][1][0], e[2]]) + # Return siblings despite siblings=0 because ascend is true. + self.assertEquals(list(e[1].traverse(ascend=1, siblings=0)), + [e[1], e[2]]) + self.assertEquals(list(e[0].traverse()), + [e[0], e[0][0], e[0][1], e[0][1][0]]) + self.testlist = [e[0][0], e[0][1]] + self.assertEquals(list(e[0].traverse(condition=self.not_in_testlist)), + [e[0], e[0][1][0]]) + self.testlist.append(e[0][1][0]) + self.assertEquals(list(e[0].traverse(condition=self.not_in_testlist)), + [e[0]]) - def test_flattened(self): + def test_next_node(self): e = nodes.Element() e += nodes.Element() e[0] += nodes.Element() @@ -147,12 +151,22 @@ class MiscTests(unittest.TestCase): e[0][1] += nodes.Text('some text') e += nodes.Element() e += nodes.Element() - self.assertEquals(e.flattened(), - [e, e[0], e[0][0], e[0][1], e[0][1][0], e[1], e[2]]) - self.assertEquals(e[0].flattened(), - [e[0], e[0][0], e[0][1], e[0][1][0]]) - self.assertEquals(e[1].flattened(), [e[1]]) - self.assertEquals(e[0][1][0].flattened(), [e[0][1][0]]) + self.testlist = [e[0], e[0][1], e[1]] + compare = [(e, e[0][0]), + (e[0], e[0][0]), + (e[0][0], e[0][1][0]), + (e[0][1], e[0][1][0]), + (e[0][1][0], e[2]), + (e[1], e[2]), + (e[2], None)] + for node, next_node in compare: + self.assertEquals(node.next_node(self.not_in_testlist, ascend=1), + next_node) + self.assertEquals(e[0][0].next_node(ascend=1), e[0][1]) + self.assertEquals(e[2].next_node(), None) + + def not_in_testlist(self, x): + return x not in self.testlist class TreeCopyVisitorTests(unittest.TestCase): -- cgit v1.2.1 From d06b559d1082b9881e16d0278a65aca3b42ec5e2 Mon Sep 17 00:00:00 2001 From: goodger Date: Mon, 21 Mar 2005 21:26:21 +0000 Subject: Added settings: ``file_insertion_enabled`` & ``raw_enabled``. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3071 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/dangerous.html | 50 +++++++++++++++++++++++++++++++++ test/functional/input/dangerous.txt | 13 +++++++++ test/functional/tests/dangerous.py | 12 ++++++++ 3 files changed, 75 insertions(+) create mode 100644 test/functional/expected/dangerous.html create mode 100644 test/functional/input/dangerous.txt create mode 100644 test/functional/tests/dangerous.py (limited to 'test') diff --git a/test/functional/expected/dangerous.html b/test/functional/expected/dangerous.html new file mode 100644 index 000000000..9f0b58a54 --- /dev/null +++ b/test/functional/expected/dangerous.html @@ -0,0 +1,50 @@ + + + + + + + + + + +
+

Potentially dangerous features (security holes):

+
+

System Message: WARNING/2 (functional/input/dangerous.txt, line 3)

+

"include" directive disabled.

+
+.. include:: /etc/passwd
+
+
+
+

System Message: WARNING/2 (functional/input/dangerous.txt, line 4)

+

"raw" directive disabled.

+
+.. raw:: html
+   :file: /etc/passwd
+
+
+
+

System Message: WARNING/2 (functional/input/dangerous.txt, line 6)

+

"raw" directive disabled.

+
+.. raw:: html
+   :url: file:///etc/passwd
+
+
+
+

System Message: WARNING/2 (functional/input/dangerous.txt, line 8)

+

"raw" directive disabled.

+
+.. raw:: html
+
+   <script>
+       that does something really nasty
+   </script>
+
+
+
+
+ + diff --git a/test/functional/input/dangerous.txt b/test/functional/input/dangerous.txt new file mode 100644 index 000000000..2c1e55251 --- /dev/null +++ b/test/functional/input/dangerous.txt @@ -0,0 +1,13 @@ +Potentially dangerous features (security holes): + +.. include:: /etc/passwd +.. raw:: html + :file: /etc/passwd +.. raw:: html + :url: file:///etc/passwd +.. raw:: html + + + diff --git a/test/functional/tests/dangerous.py b/test/functional/tests/dangerous.py new file mode 100644 index 000000000..620a927ba --- /dev/null +++ b/test/functional/tests/dangerous.py @@ -0,0 +1,12 @@ +# Source and destination file names. +test_source = "dangerous.txt" +test_destination = "dangerous.html" + +# Keyword parameters passed to publish_file. +reader_name = "standalone" +parser_name = "rst" +writer_name = "html" + +# Settings +settings_overrides['file_insertion_enabled'] = 0 +settings_overrides['raw_enabled'] = 0 -- cgit v1.2.1 From 916c9cce53ec74a1cb1ad3e522a2c837acc6cd06 Mon Sep 17 00:00:00 2001 From: goodger Date: Tue, 22 Mar 2005 13:56:53 +0000 Subject: updated for SVN git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3076 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_functional.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/test_functional.py b/test/test_functional.py index 4cacfb8f4..a6eafd9bf 100755 --- a/test/test_functional.py +++ b/test/test_functional.py @@ -117,9 +117,9 @@ class FunctionalTestCase(DocutilsTestSupport.CustomTestCase): 'Please compare the expected and actual output files:\n' ' diff %s %s\n' 'If the actual output is correct, please replace the\n' - 'expected output and check it in to CVS:\n' + 'expected output and check it in to Subversion:\n' ' mv %s %s\n' - ' cvs commit -m "" %s' + ' svn commit -m "" %s' % (expected_path, params['destination_path'], params['destination_path'], expected_path, expected_path)) try: -- cgit v1.2.1 From 5f56a5a8b5f52dc6c8026c89d19dbd55849ae3a9 Mon Sep 17 00:00:00 2001 From: wiemann Date: Tue, 22 Mar 2005 17:08:57 +0000 Subject: deleted old .cvsignore files git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3080 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/.cvsignore | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 test/.cvsignore (limited to 'test') diff --git a/test/.cvsignore b/test/.cvsignore deleted file mode 100644 index b8af75aec..000000000 --- a/test/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -*.pyc -alltests.out -- cgit v1.2.1 From b559771f98c67ca07b71c41dd947c2be6df75fee Mon Sep 17 00:00:00 2001 From: goodger Date: Tue, 22 Mar 2005 19:18:06 +0000 Subject: added csv-table directive support for the file_insertion_enabled setting git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3083 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/dangerous.html | 15 ++++++++++++++- test/functional/input/dangerous.txt | 3 ++- 2 files changed, 16 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/functional/expected/dangerous.html b/test/functional/expected/dangerous.html index 9f0b58a54..a95fb28af 100644 --- a/test/functional/expected/dangerous.html +++ b/test/functional/expected/dangerous.html @@ -42,7 +42,20 @@ <script> that does something really nasty </script> - + + +
+

System Message: WARNING/2 (functional/input/dangerous.txt, line 13)

+

"csv-table" directive disabled.

+
+.. csv-table:: :file: /etc/passwd
+
+
+
+

System Message: WARNING/2 (functional/input/dangerous.txt, line 14)

+

"csv-table" directive disabled.

+
+.. csv-table:: :url: file:///etc/passwd
 
diff --git a/test/functional/input/dangerous.txt b/test/functional/input/dangerous.txt index 2c1e55251..b3c69d14e 100644 --- a/test/functional/input/dangerous.txt +++ b/test/functional/input/dangerous.txt @@ -10,4 +10,5 @@ Potentially dangerous features (security holes): - +.. csv-table:: :file: /etc/passwd +.. csv-table:: :url: file:///etc/passwd -- cgit v1.2.1 From 2a857c08d7ce28e3cd7b0f9731041fca0d15a254 Mon Sep 17 00:00:00 2001 From: wiemann Date: Tue, 22 Mar 2005 20:38:43 +0000 Subject: set executable bits on test files git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3085 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_language.py | 0 test/test_parsers/test_rst/test_SimpleTableParser.py | 0 test/test_parsers/test_rst/test_directives/test_topics.py | 0 test/test_parsers/test_rst/test_interpreted.py | 0 test/test_readers/test_pep/test_inline_markup.py | 0 test/test_readers/test_pep/test_rfc2822.py | 0 test/test_readers/test_python/test_functions.py | 0 test/test_readers/test_python/test_parser.py | 0 test/test_readers/test_python/test_token_parser.py | 0 test/test_transforms/test_filter.py | 0 test/test_transforms/test_peps.py | 0 test/test_transforms/test_sectnum.py | 0 test/test_viewlist.py | 0 test/test_writers/test_docutils_xml.py | 0 test/test_writers/test_latex2e.py | 0 test/test_writers/test_pseudoxml.py | 0 16 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 test/test_language.py mode change 100644 => 100755 test/test_parsers/test_rst/test_SimpleTableParser.py mode change 100644 => 100755 test/test_parsers/test_rst/test_directives/test_topics.py mode change 100644 => 100755 test/test_parsers/test_rst/test_interpreted.py mode change 100644 => 100755 test/test_readers/test_pep/test_inline_markup.py mode change 100644 => 100755 test/test_readers/test_pep/test_rfc2822.py mode change 100644 => 100755 test/test_readers/test_python/test_functions.py mode change 100644 => 100755 test/test_readers/test_python/test_parser.py mode change 100644 => 100755 test/test_readers/test_python/test_token_parser.py mode change 100644 => 100755 test/test_transforms/test_filter.py mode change 100644 => 100755 test/test_transforms/test_peps.py mode change 100644 => 100755 test/test_transforms/test_sectnum.py mode change 100644 => 100755 test/test_viewlist.py mode change 100644 => 100755 test/test_writers/test_docutils_xml.py mode change 100644 => 100755 test/test_writers/test_latex2e.py mode change 100644 => 100755 test/test_writers/test_pseudoxml.py (limited to 'test') diff --git a/test/test_language.py b/test/test_language.py old mode 100644 new mode 100755 diff --git a/test/test_parsers/test_rst/test_SimpleTableParser.py b/test/test_parsers/test_rst/test_SimpleTableParser.py old mode 100644 new mode 100755 diff --git a/test/test_parsers/test_rst/test_directives/test_topics.py b/test/test_parsers/test_rst/test_directives/test_topics.py old mode 100644 new mode 100755 diff --git a/test/test_parsers/test_rst/test_interpreted.py b/test/test_parsers/test_rst/test_interpreted.py old mode 100644 new mode 100755 diff --git a/test/test_readers/test_pep/test_inline_markup.py b/test/test_readers/test_pep/test_inline_markup.py old mode 100644 new mode 100755 diff --git a/test/test_readers/test_pep/test_rfc2822.py b/test/test_readers/test_pep/test_rfc2822.py old mode 100644 new mode 100755 diff --git a/test/test_readers/test_python/test_functions.py b/test/test_readers/test_python/test_functions.py old mode 100644 new mode 100755 diff --git a/test/test_readers/test_python/test_parser.py b/test/test_readers/test_python/test_parser.py old mode 100644 new mode 100755 diff --git a/test/test_readers/test_python/test_token_parser.py b/test/test_readers/test_python/test_token_parser.py old mode 100644 new mode 100755 diff --git a/test/test_transforms/test_filter.py b/test/test_transforms/test_filter.py old mode 100644 new mode 100755 diff --git a/test/test_transforms/test_peps.py b/test/test_transforms/test_peps.py old mode 100644 new mode 100755 diff --git a/test/test_transforms/test_sectnum.py b/test/test_transforms/test_sectnum.py old mode 100644 new mode 100755 diff --git a/test/test_viewlist.py b/test/test_viewlist.py old mode 100644 new mode 100755 diff --git a/test/test_writers/test_docutils_xml.py b/test/test_writers/test_docutils_xml.py old mode 100644 new mode 100755 diff --git a/test/test_writers/test_latex2e.py b/test/test_writers/test_latex2e.py old mode 100644 new mode 100755 diff --git a/test/test_writers/test_pseudoxml.py b/test/test_writers/test_pseudoxml.py old mode 100644 new mode 100755 -- cgit v1.2.1 From 9757de8a9ede6e064e830d72adb8db2f8347f500 Mon Sep 17 00:00:00 2001 From: wiemann Date: Wed, 23 Mar 2005 17:28:46 +0000 Subject: ensure we are in the correct directory; the working directory is changed during execution of the test suite! git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3098 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/DocutilsTestSupport.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'test') diff --git a/test/DocutilsTestSupport.py b/test/DocutilsTestSupport.py index 221336336..e3764adfb 100644 --- a/test/DocutilsTestSupport.py +++ b/test/DocutilsTestSupport.py @@ -167,6 +167,9 @@ class CustomTestCase(unittest.TestCase): raise self.failureException, \ (msg or '%s == %s' % _format_str(first, second)) + def setUp(self): + os.chdir(testroot) + # Synonyms for assertion methods assertEqual = assertEquals = failUnlessEqual -- cgit v1.2.1 From 6adf9034472d079b9f0b9397a8c076e40b1f9ed9 Mon Sep 17 00:00:00 2001 From: goodger Date: Thu, 24 Mar 2005 03:14:33 +0000 Subject: applied file_insertion_enabled setting to "figure" directive (disable "figwidth" option) git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3106 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/dangerous.html | 3 +++ test/functional/input/dangerous.txt | 2 ++ 2 files changed, 5 insertions(+) (limited to 'test') diff --git a/test/functional/expected/dangerous.html b/test/functional/expected/dangerous.html index a95fb28af..184417b5e 100644 --- a/test/functional/expected/dangerous.html +++ b/test/functional/expected/dangerous.html @@ -58,6 +58,9 @@ .. csv-table:: :url: file:///etc/passwd +
+
picture.png
+
diff --git a/test/functional/input/dangerous.txt b/test/functional/input/dangerous.txt index b3c69d14e..8f75386c8 100644 --- a/test/functional/input/dangerous.txt +++ b/test/functional/input/dangerous.txt @@ -12,3 +12,5 @@ Potentially dangerous features (security holes): .. csv-table:: :file: /etc/passwd .. csv-table:: :url: file:///etc/passwd +.. figure:: picture.png + :figwidth: image -- cgit v1.2.1 From 7d76b140ee974b59e35f1f044949dc032630e15f Mon Sep 17 00:00:00 2001 From: goodger Date: Fri, 25 Mar 2005 03:02:32 +0000 Subject: added auto-enumerated list items git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3113 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../test_parsers/test_rst/test_enumerated_lists.py | 92 ++++++++++++++++++++++ 1 file changed, 92 insertions(+) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_enumerated_lists.py b/test/test_parsers/test_rst/test_enumerated_lists.py index c79cba826..b0be498b4 100755 --- a/test/test_parsers/test_rst/test_enumerated_lists.py +++ b/test/test_parsers/test_rst/test_enumerated_lists.py @@ -719,6 +719,98 @@ Princeton, NJ. Paragraph 2. """], +["""\ +1. Item one. + +#. Item two. + +#. Item three. +""", +"""\ + + + + + Item one. + + + Item two. + + + Item three. +"""], +["""\ +a. Item one. +#. Item two. +#. Item three. +""", +"""\ + + + + + Item one. + + + Item two. + + + Item three. +"""], +["""\ +i. Item one. +ii. Item two. +#. Item three. +""", +"""\ + + + + + Item one. + + + Item two. + + + Item three. +"""], +["""\ +#. Item one. +#. Item two. +#. Item three. +""", +"""\ + + + + + Item one. + + + Item two. + + + Item three. +"""], +["""\ +1. Item one. +#. Item two. +3. Item three. +""", +"""\ + + + + + Item one. + + + Enumerated list ends without a blank line; unexpected unindent. + + #. Item two. + 3. Item three. +"""], ] -- cgit v1.2.1 From 4df9fad485c1e12e850f9d7ff225d51c538af3dc Mon Sep 17 00:00:00 2001 From: goodger Date: Sat, 26 Mar 2005 01:04:09 +0000 Subject: fixed a bug that assumed text follows ".. _" git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3119 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_parsers/test_rst/test_targets.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_targets.py b/test/test_parsers/test_rst/test_targets.py index ca1e239f1..9f5d12672 100755 --- a/test/test_parsers/test_rst/test_targets.py +++ b/test/test_parsers/test_rst/test_targets.py @@ -400,6 +400,14 @@ no blank line no blank line """], +["""\ +.. _ +""", +"""\ + + + _ +"""], ] -- cgit v1.2.1 From 9dbc2adead008935245a396eab10bb7bcb11b226 Mon Sep 17 00:00:00 2001 From: wiemann Date: Sat, 26 Mar 2005 16:21:28 +0000 Subject: merged rev. 3094:3101 and 3102:HEAD from branches/multiple-ids to trunk git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3129 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../expected/standalone_rst_html4css1.html | 8 +- test/functional/expected/standalone_rst_latex.tex | 2 +- test/test_nodes.py | 23 +- test/test_parsers/test_rst/test_citations.py | 16 +- .../test_parsers/test_rst/test_definition_lists.py | 44 +-- .../test_rst/test_directives/test_admonitions.py | 6 +- .../test_rst/test_directives/test_contents.py | 14 +- .../test_rst/test_directives/test_include.py | 22 +- .../test_rst/test_directives/test_line_blocks.py | 4 +- .../test_rst/test_directives/test_replace.py | 12 +- .../test_rst/test_directives/test_role.py | 32 +-- .../test_rst/test_directives/test_tables.py | 10 +- .../test_rst/test_directives/test_unicode.py | 18 +- test/test_parsers/test_rst/test_field_lists.py | 4 +- test/test_parsers/test_rst/test_footnotes.py | 96 +++---- test/test_parsers/test_rst/test_inline_markup.py | 82 +++--- test/test_parsers/test_rst/test_interpreted.py | 32 +-- test/test_parsers/test_rst/test_line_blocks.py | 16 +- test/test_parsers/test_rst/test_section_headers.py | 74 ++--- test/test_parsers/test_rst/test_substitutions.py | 30 +- test/test_parsers/test_rst/test_targets.py | 94 +++--- test/test_parsers/test_rst/test_transitions.py | 18 +- test/test_readers/test_pep/test_inline_markup.py | 6 +- test/test_readers/test_pep/test_rfc2822.py | 18 +- test/test_transforms/test_class.py | 16 +- test/test_transforms/test_contents.py | 92 +++--- test/test_transforms/test_docinfo.py | 4 +- test/test_transforms/test_doctitle.py | 26 +- test/test_transforms/test_final_checks.py | 28 +- test/test_transforms/test_footnotes.py | 162 +++++------ test/test_transforms/test_hyperlinks.py | 315 ++++++++++++++------- test/test_transforms/test_messages.py | 6 +- test/test_transforms/test_peps.py | 8 +- test/test_transforms/test_sectnum.py | 116 ++++---- test/test_transforms/test_substitutions.py | 28 +- test/test_writers/test_docutils_xml.py | 8 +- test/test_writers/test_pseudoxml.py | 4 +- 37 files changed, 816 insertions(+), 678 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index e4a03e6cb..f7db7b852 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -17,9 +17,9 @@ -
-

reStructuredText Test Document

-

Examples of Syntax Constructs

+
+

reStructuredText Test Document

+

Examples of Syntax Constructs

Title:Test PEP
Version:1.9
Version:42
Last-Modified:2004/06/05 02:55:11
Last-Modified:A long time ago.
Author:John Doe <john at example.org>
@@ -490,7 +490,7 @@ citation.

2.13   Targets

-

This paragraph is pointed to by the explicit "example" target. A +

This paragraph is pointed to by the explicit "example" target. A reference can be found under Inline Markup, above. Inline hyperlink targets are also possible.

Section headers are implicit targets, referred to by name. See diff --git a/test/functional/expected/standalone_rst_latex.tex b/test/functional/expected/standalone_rst_latex.tex index 9f57af6ea..23d16de34 100644 --- a/test/functional/expected/standalone_rst_latex.tex +++ b/test/functional/expected/standalone_rst_latex.tex @@ -772,7 +772,7 @@ citation. \hypertarget{targets}{} \pdfbookmark[1]{2.13~~~Targets}{targets} \subsection*{2.13~~~Targets} -\hypertarget{example}{} + This paragraph is pointed to by the explicit ``example'' target. A reference can be found under \href{\#inline-markup}{Inline Markup}, above. \href{\#inline-hyperlink-targets}{Inline hyperlink targets} are also possible. diff --git a/test/test_nodes.py b/test/test_nodes.py index ebf9da3f0..faeb61eb7 100755 --- a/test/test_nodes.py +++ b/test/test_nodes.py @@ -84,6 +84,27 @@ class ElementTests(unittest.TestCase): element.clear() self.assert_(not len(element)) + def test_normal_attributes(self): + element = nodes.Element() + self.assert_(not element.has_key('foo')) + self.assertRaises(KeyError, element.__getitem__, 'foo') + element['foo'] = 'sometext' + self.assertEquals(element['foo'], 'sometext') + del element['foo'] + self.assertRaises(KeyError, element.__getitem__, 'foo') + + def test_default_attributes(self): + element = nodes.Element() + self.assertEquals(element['ids'], []) + self.assertEquals(element.non_default_attributes(), {}) + self.assert_(not element.is_not_default('ids')) + self.assert_(element['ids'] is not nodes.Element()['ids']) + element['ids'].append('someid') + self.assertEquals(element['ids'], ['someid']) + self.assertEquals(element.non_default_attributes(), + {'ids': ['someid']}) + self.assert_(element.is_not_default('ids')) + class MiscTests(unittest.TestCase): @@ -91,7 +112,7 @@ class MiscTests(unittest.TestCase): node_class_names = [] for x in dir(nodes): c = getattr(nodes, x) - if type(c) is ClassType and issubclass(c, nodes.Node) \ + if isinstance(c, ClassType) and issubclass(c, nodes.Node) \ and len(c.__bases__) > 1: node_class_names.append(x) node_class_names.sort() diff --git a/test/test_parsers/test_rst/test_citations.py b/test/test_parsers/test_rst/test_citations.py index a92e151a4..c50e28e0b 100755 --- a/test/test_parsers/test_rst/test_citations.py +++ b/test/test_parsers/test_rst/test_citations.py @@ -25,7 +25,7 @@ totest['citations'] = [ """, """\ - +

+
+++ + + + + + + + + + +
short:This field's name is short.
medium-length:This field's name is medium-length.
long field name:This field's name is long.
very very long field name:This field's name is quite long.
+
+ + diff --git a/test/functional/input/field_list.txt b/test/functional/input/field_list.txt new file mode 100644 index 000000000..fa04ba6ca --- /dev/null +++ b/test/functional/input/field_list.txt @@ -0,0 +1,5 @@ +:short: This field's name is short. +:medium-length: This field's name is medium-length. +:long field name: This field's name is long. +:very very long field name: + This field's name is quite long. diff --git a/test/functional/tests/field_name_limit.py b/test/functional/tests/field_name_limit.py new file mode 100644 index 000000000..db79d4c67 --- /dev/null +++ b/test/functional/tests/field_name_limit.py @@ -0,0 +1,12 @@ +# Source and destination file names. +test_source = "field_list.txt" +test_destination = "field_name_limit.html" + +# Keyword parameters passed to publish_file. +reader_name = "standalone" +parser_name = "rst" +writer_name = "html" + +# Settings +settings_overrides['field_name_limit'] = 0 # no limit +settings_overrides['docinfo_xform'] = 0 -- cgit v1.2.1 From dc3284ca85006e72f0e3b2c4ffbe078aa9148f76 Mon Sep 17 00:00:00 2001 From: goodger Date: Tue, 5 Apr 2005 02:55:06 +0000 Subject: added "stub-columns" options to "csv-table" and "list-table" directives, plus support, docs, and tests git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3165 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../expected/standalone_rst_html4css1.html | 90 +++++++++++++++------- test/functional/input/data/list_table.txt | 24 ++++++ test/functional/input/standalone_rst_html4css1.txt | 1 + .../test_rst/test_directives/test_tables.py | 44 ++++++++++- 4 files changed, 129 insertions(+), 30 deletions(-) create mode 100644 test/functional/input/data/list_table.txt (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index f9cf0a59b..f3b49e496 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -127,9 +127,10 @@ They are transformed from section titles after parsing. -->
  • 2.18   Colspanning tables
  • 2.19   Rowspanning tables
  • 2.20   Complex tables
  • +
  • 2.21   List Tables
  • -
  • 3   Error Handling
  • +
  • 3   Error Handling
  • @@ -472,7 +473,7 @@ Here's a reference to the next footnote: [4]Here's an unreferenced footnote, with a reference to a -nonexistent footnote: [5]_. +nonexistent footnote: [5]_.
    @@ -485,7 +486,7 @@ nonexistent footnote: [CIT2002], and a [nonexistent]_ +

    Here's a reference to the above, [CIT2002], and a [nonexistent]_ citation.

    @@ -499,7 +500,7 @@ hyperlink targets are also possible.

    "Python [5]".

    Targets may be indirect and anonymous. Thus this phrase may also refer to the Targets section.

    -

    Here's a `hyperlink reference without a target`_, which generates an +

    Here's a `hyperlink reference without a target`_, which generates an error.

    2.13.1   Duplicate Target Names

    @@ -511,33 +512,33 @@ explicit targets will generate "warning" (level-2) system messages.

    2.13.2   Duplicate Target Names

    Since there are two "Duplicate Target Names" section headers, we cannot uniquely refer to either of them by name. If we try to (like -this: `Duplicate Target Names`_), an error is generated.

    +this: `Duplicate Target Names`_), an error is generated.

    2.14   Directives

    These are just a sample of the many reStructuredText Directives. For others, please see http://docutils.sourceforge.net/docs/ref/rst/directives.html.

    -

    2.14.1   Document Parts

    +

    2.14.1   Document Parts

    An example of the "contents" directive can be seen above this section (a local, untitled table of contents) and at the beginning of the document (a document-wide table of contents).

    -

    2.14.2   Images

    +

    2.14.2   Images

    An image directive (also clickable -- a hyperlink reference):

    ../../../docs/user/rst/images/title.png

    A figure directive:

    @@ -567,7 +568,7 @@ document (a document-wide table o
    -

    2.14.3   Admonitions

    +

    2.14.3   Admonitions

    Attention!

    Directives at large.

    @@ -616,7 +617,7 @@ Reader discretion is strongly advised.

    -

    2.14.4   Topics, Sidebars, and Rubrics

    +

    2.14.4   Topics, Sidebars, and Rubrics

    -

    2.14.5   Target Footnotes

    +

    2.14.5   Target Footnotes

    @@ -642,11 +643,11 @@ background color.

    -

    2.14.7   Compound Paragraph

    +

    2.14.7   Compound Paragraph

    Compound 1, paragraph 1.

    Compound 1, paragraph 2.

    @@ -857,9 +858,42 @@ empty: -->
    +
    +

    2.21   List Tables

    +

    Here's a list table exercising all features:

    + + +++++ + + + + + + + + + + + + + + + + + + + + +
    list table with integral header
    TreatQuantityDescription
    Albatross2.99On a stick!
    Crunchy Frog1.49If we took the bones out, it wouldn't be +crunchy, now would it?
    Gannet Ripple1.99On a stick!
    +
    -

    3   Error Handling

    +

    3   Error Handling

    Any errors caught during processing will generate system messages.

    There should be five messages in the following, auto-generated section, "Docutils System Messages":

    @@ -870,17 +904,17 @@ section, "Docutils System Messages":

    System Message: ERROR/3 (functional/input/data/standard.txt, line 98); backlink

    Undefined substitution referenced: "problematic".
    -
    -

    System Message: ERROR/3 (functional/input/standalone_rst_html4css1.txt, line 352); backlink

    +
    +

    System Message: ERROR/3 (functional/input/standalone_rst_html4css1.txt, line 352); backlink

    Unknown target name: "5".
    -
    -

    System Message: ERROR/3 (functional/input/data/standard.txt, line 361); backlink

    +
    +

    System Message: ERROR/3 (functional/input/data/standard.txt, line 361); backlink

    Unknown target name: "nonexistent".
    -
    -

    System Message: ERROR/3 (functional/input/data/standard.txt, line 386); backlink

    +
    +

    System Message: ERROR/3 (functional/input/data/standard.txt, line 386); backlink

    Unknown target name: "hyperlink reference without a target".
    -
    -

    System Message: ERROR/3 (functional/input/data/standard.txt, line 399); backlink

    +
    +

    System Message: ERROR/3 (functional/input/data/standard.txt, line 399); backlink

    Duplicate target name, cannot be used as a unique reference: "duplicate target names".
    diff --git a/test/functional/input/data/list_table.txt b/test/functional/input/data/list_table.txt new file mode 100644 index 000000000..632285e36 --- /dev/null +++ b/test/functional/input/data/list_table.txt @@ -0,0 +1,24 @@ +List Tables +----------- + +Here's a list table exercising all features: + +.. list-table:: list table with integral header + :class: test + :widths: 10 20 30 + :header-rows: 1 + :stub-columns: 1 + + * - Treat + - Quantity + - Description + * - Albatross + - 2.99 + - On a stick! + * - Crunchy Frog + - 1.49 + - If we took the bones out, it wouldn't be + crunchy, now would it? + * - Gannet Ripple + - 1.99 + - On a stick! diff --git a/test/functional/input/standalone_rst_html4css1.txt b/test/functional/input/standalone_rst_html4css1.txt index 68f9de864..3847a089e 100644 --- a/test/functional/input/standalone_rst_html4css1.txt +++ b/test/functional/input/standalone_rst_html4css1.txt @@ -2,4 +2,5 @@ .. include:: data/table_colspan.txt .. include:: data/table_rowspan.txt .. include:: data/table_complex.txt +.. include:: data/list_table.txt .. include:: data/errors.txt diff --git a/test/test_parsers/test_rst/test_directives/test_tables.py b/test/test_parsers/test_rst/test_directives/test_tables.py index a38e8b343..da88510e7 100755 --- a/test/test_parsers/test_rst/test_directives/test_tables.py +++ b/test/test_parsers/test_rst/test_directives/test_tables.py @@ -116,6 +116,7 @@ else: .. csv-table:: inline with integral header :widths: 10, 20, 30 :header-rows: 1 + :stub-columns: 1 "Treat", "Quantity", "Description" "Albatross", 2.99, "On a stick!" @@ -129,7 +130,7 @@ else: inline with integral header <tgroup cols="3"> - <colspec colwidth="10"> + <colspec colwidth="10" stub="1"> <colspec colwidth="20"> <colspec colwidth="30"> <thead> @@ -815,6 +816,7 @@ totest['list-table'] = [ .. list-table:: list table with integral header :widths: 10 20 30 :header-rows: 1 + :stub-columns: 1 * - Treat - Quantity @@ -836,7 +838,7 @@ totest['list-table'] = [ <title> list table with integral header <tgroup cols="3"> - <colspec colwidth="10"> + <colspec colwidth="10" stub="1"> <colspec colwidth="20"> <colspec colwidth="30"> <thead> @@ -949,6 +951,44 @@ totest['list-table'] = [ \n\ * - ":widths:" option doesn\'t match columns """], +["""\ +.. list-table:: + :stub-columns: 3 + + * - column 1 + - column 2 +""", +"""\ +<document source="test data"> + <system_message level="3" line="1" source="test data" type="ERROR"> + <paragraph> + 3 stub column(s) specified but only 2 columns(s) of data supplied ("list-table" directive). + <literal_block xml:space="preserve"> + .. list-table:: + :stub-columns: 3 + \n\ + * - column 1 + - column 2 +"""], +["""\ +.. list-table:: + :stub-columns: 2 + + * - column 1 + - column 2 +""", +"""\ +<document source="test data"> + <system_message level="3" line="1" source="test data" type="ERROR"> + <paragraph> + Insufficient data supplied (2 columns(s)); no data remaining for table body, required by "list-table" directive. + <literal_block xml:space="preserve"> + .. list-table:: + :stub-columns: 2 + \n\ + * - column 1 + - column 2 +"""], ] -- cgit v1.2.1 From a9cb01249ed3351c1e3ba36caa9fc45d0522b842 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Tue, 5 Apr 2005 15:26:16 +0000 Subject: merged reporter-categories branch into trunk: removed docutils.utils.Reporter.categories, docutils.utils.ConditionSet, and all references to them, to simplify error reporting git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3171 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_utils.py | 81 ------------------------------------------------------ 1 file changed, 81 deletions(-) (limited to 'test') diff --git a/test/test_utils.py b/test/test_utils.py index 7077757ba..006495ac9 100755 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -123,87 +123,6 @@ class QuietReporterTests(unittest.TestCase): self.assertEquals(self.stream.getvalue(), '') -class ReporterCategoryTests(unittest.TestCase): - - stream = StringIO.StringIO() - - def setUp(self): - self.stream.seek(0) - self.stream.truncate() - self.reporter = utils.Reporter('test data', 2, 4, self.stream, 1) - self.reporter.set_conditions('lemon', 1, 3, self.stream, 0) - - def test_getset(self): - self.reporter.set_conditions('test', 5, 5, None, 0) - self.assertEquals(self.reporter.get_conditions('other').astuple(), - (1, 2, 4, self.stream)) - self.assertEquals(self.reporter.get_conditions('test').astuple(), - (0, 5, 5, sys.stderr)) - self.assertEquals(self.reporter.get_conditions('test.dummy').astuple(), - (0, 5, 5, sys.stderr)) - self.reporter.set_conditions('test.dummy.spam', 1, 2, self.stream, 1) - self.assertEquals( - self.reporter.get_conditions('test.dummy.spam').astuple(), - (1, 1, 2, self.stream)) - self.assertEquals(self.reporter.get_conditions('test.dummy').astuple(), - (0, 5, 5, sys.stderr)) - self.assertEquals( - self.reporter.get_conditions('test.dummy.spam.eggs').astuple(), - (1, 1, 2, self.stream)) - self.reporter.unset_conditions('test.dummy.spam') - self.assertEquals( - self.reporter.get_conditions('test.dummy.spam.eggs').astuple(), - (0, 5, 5, sys.stderr)) - - def test_debug(self): - sw = self.reporter.debug('debug output', category='lemon.curry') - self.assertEquals(self.stream.getvalue(), '') - sw = self.reporter.debug('debug output') - self.assertEquals(self.stream.getvalue(), - 'test data:: (DEBUG/0) debug output\n') - - def test_info(self): - sw = self.reporter.info('some info') - self.assertEquals(self.stream.getvalue(), '') - sw = self.reporter.info('some info', category='lemon.curry') - self.assertEquals( - self.stream.getvalue(), - 'test data:: (INFO/1) some info [lemon.curry]\n') - - def test_warning(self): - sw = self.reporter.warning('a warning') - self.assertEquals(self.stream.getvalue(), - 'test data:: (WARNING/2) a warning\n') - sw = self.reporter.warning('a warning', category='lemon.curry') - self.assertEquals(self.stream.getvalue(), """\ -test data:: (WARNING/2) a warning -test data:: (WARNING/2) a warning [lemon.curry] -""") - - def test_error(self): - sw = self.reporter.error('an error') - self.assertEquals(self.stream.getvalue(), - 'test data:: (ERROR/3) an error\n') - self.assertRaises(utils.SystemMessage, self.reporter.error, - 'an error', category='lemon.curry') - self.assertEquals(self.stream.getvalue(), """\ -test data:: (ERROR/3) an error -test data:: (ERROR/3) an error [lemon.curry] -""") - - def test_severe(self): - self.assertRaises(utils.SystemMessage, self.reporter.severe, - 'a severe error') - self.assertEquals(self.stream.getvalue(), - 'test data:: (SEVERE/4) a severe error\n') - self.assertRaises(utils.SystemMessage, self.reporter.severe, - 'a severe error', category='lemon.curry') - self.assertEquals(self.stream.getvalue(), """\ -test data:: (SEVERE/4) a severe error -test data:: (SEVERE/4) a severe error [lemon.curry] -""") - - class NameValueTests(unittest.TestCase): def test_extract_name_value(self): -- cgit v1.2.1 From e4d2d4afbc58816274503dcff87405d809db1013 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Tue, 5 Apr 2005 18:51:18 +0000 Subject: assigned classes to <th> elements to indicate role: table head and/or stub git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3172 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../expected/standalone_rst_html4css1.html | 36 +++++++++++----------- 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index f3b49e496..be1c9816e 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -745,12 +745,12 @@ Fifth test in HTML.<br />Line two.</div> <col width="38%" /> </colgroup> <thead valign="bottom"> -<tr><th colspan="2">Inputs</th> -<th>Output</th> +<tr><th class="head" colspan="2">Inputs</th> +<th class="head">Output</th> </tr> -<tr><th>A</th> -<th>B</th> -<th>A or B</th> +<tr><th class="head">A</th> +<th class="head">B</th> +<th class="head">A or B</th> </tr> </thead> <tbody valign="top"> @@ -783,10 +783,10 @@ Fifth test in HTML.<br />Line two.</div> <col width="33%" /> </colgroup> <thead valign="bottom"> -<tr><th>Header row, column 1 +<tr><th class="head">Header row, column 1 (header rows optional)</th> -<th>Header 2</th> -<th>Header 3</th> +<th class="head">Header 2</th> +<th class="head">Header 3</th> </tr> </thead> <tbody valign="top"> @@ -820,11 +820,11 @@ span rows.</td> <col width="18%" /> </colgroup> <thead valign="bottom"> -<tr><th>Header row, column 1 +<tr><th class="head">Header row, column 1 (header rows optional)</th> -<th>Header 2</th> -<th>Header 3</th> -<th>Header 4</th> +<th class="head">Header 2</th> +<th class="head">Header 3</th> +<th class="head">Header 4</th> </tr> </thead> <tbody valign="top"> @@ -869,22 +869,22 @@ empty: <tt class="docutils literal"><span class="pre">--></span></tt></td> <col width="50%" /> </colgroup> <thead valign="bottom"> -<tr><th>Treat</th> -<th>Quantity</th> -<th>Description</th> +<tr><th class="head stub">Treat</th> +<th class="head">Quantity</th> +<th class="head">Description</th> </tr> </thead> <tbody valign="top"> -<tr><th>Albatross</th> +<tr><th class="stub">Albatross</th> <td>2.99</td> <td>On a stick!</td> </tr> -<tr><th>Crunchy Frog</th> +<tr><th class="stub">Crunchy Frog</th> <td>1.49</td> <td>If we took the bones out, it wouldn't be crunchy, now would it?</td> </tr> -<tr><th>Gannet Ripple</th> +<tr><th class="stub">Gannet Ripple</th> <td>1.99</td> <td>On a stick!</td> </tr> -- cgit v1.2.1 From 929f0718c0eb410e888df9d56ab2d0c68d2db44d Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Wed, 6 Apr 2005 15:43:49 +0000 Subject: use universal newlines when opening expected output files to guard against cross-platform line ending problems git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3176 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_functional.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/test_functional.py b/test/test_functional.py index a6eafd9bf..e52d41422 100755 --- a/test/test_functional.py +++ b/test/test_functional.py @@ -112,7 +112,9 @@ class FunctionalTestCase(DocutilsTestSupport.CustomTestCase): # Get the expected output *after* writing the actual output. self.assert_(os.access(expected_path, os.R_OK),\ 'Cannot find expected output at\n' + expected_path) - expected = open(expected_path).read() + f = open(expected_path, 'rU') + expected = f.read() + f.close() diff = ('The expected and actual output differs.\n' 'Please compare the expected and actual output files:\n' ' diff %s %s\n' -- cgit v1.2.1 From dcc80f043243f34d0373a3150bacfff20b3212ae Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Thu, 7 Apr 2005 19:36:11 +0000 Subject: added "header" & "footer" directives, tests, docs, support, and some tweaks git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3184 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../expected/standalone_rst_html4css1.html | 8 ++ test/functional/input/data/header_footer.txt | 2 + test/functional/input/standalone_rst_html4css1.txt | 1 + .../test_rst/test_directives/test_decorations.py | 93 ++++++++++++++++++++++ 4 files changed, 104 insertions(+) create mode 100644 test/functional/input/data/header_footer.txt create mode 100755 test/test_parsers/test_rst/test_directives/test_decorations.py (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index be1c9816e..78605137a 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/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: "hyperlink reference without a target".</div> Duplicate target name, cannot be used as a unique reference: "duplicate target names".</div> </div> </div> +<hr class="docutils footer" /> +<div class="footer"> +Document footer +</div> </body> </html> diff --git a/test/functional/input/data/header_footer.txt b/test/functional/input/data/header_footer.txt new file mode 100644 index 000000000..875c9fac0 --- /dev/null +++ b/test/functional/input/data/header_footer.txt @@ -0,0 +1,2 @@ +.. header:: Document header +.. footer:: Document footer diff --git a/test/functional/input/standalone_rst_html4css1.txt b/test/functional/input/standalone_rst_html4css1.txt index 3847a089e..05f0287d0 100644 --- a/test/functional/input/standalone_rst_html4css1.txt +++ b/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/test/test_parsers/test_rst/test_directives/test_decorations.py b/test/test_parsers/test_rst/test_directives/test_decorations.py new file mode 100755 index 000000000..c770c6a49 --- /dev/null +++ b/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') -- cgit v1.2.1 From 9999f5ba8278fd069bdd966d506d27def9f03bc3 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Thu, 7 Apr 2005 19:37:12 +0000 Subject: new functional test for pseudo-XML output git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3185 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../expected/standalone_rst_pseudoxml.txt | 1700 ++++++++++++++++++++ test/functional/tests/standalone_rst_pseudoxml.py | 8 + 2 files changed, 1708 insertions(+) create mode 100644 test/functional/expected/standalone_rst_pseudoxml.txt create mode 100644 test/functional/tests/standalone_rst_pseudoxml.py (limited to 'test') diff --git a/test/functional/expected/standalone_rst_pseudoxml.txt b/test/functional/expected/standalone_rst_pseudoxml.txt new file mode 100644 index 000000000..b4d510854 --- /dev/null +++ b/test/functional/expected/standalone_rst_pseudoxml.txt @@ -0,0 +1,1700 @@ +<document ids="restructuredtext-test-document doctitle" names="restructuredtext test document doctitle" source="functional/input/standalone_rst_html4css1.txt"> + <title> + reStructuredText Test Document + <subtitle ids="examples-of-syntax-constructs subtitle" names="examples of syntax constructs subtitle"> + Examples of Syntax Constructs + <decoration> + <header> + <paragraph> + Document header + <footer> + <paragraph> + Document footer + <docinfo> + <author> + David Goodger + <address xml:space="preserve"> + 123 Example Street + Example, EX Canada + A1B 2C3 + <contact> + <reference refuri="mailto:goodger@users.sourceforge.net"> + goodger@users.sourceforge.net + <authors> + <author> + Me + <author> + Myself + <author> + I + <organization> + humankind + <date> + Now, or yesterday. Or maybe even + <emphasis> + before + yesterday. + <status> + This is a "work in progress" + <revision> + is managed by a version control system. + <version> + 1 + <copyright> + This document has been placed in the public domain. You + may do with it as you wish. You may copy, modify, + redistribute, reattribute, sell, buy, rent, lease, + destroy, or improve it, quote it at length, excerpt, + incorporate, collate, fold, staple, or mutilate it, or do + anything else to it that your or anyone else's heart + desires. + <field> + <field_name> + field name + <field_body> + <paragraph> + This is a "generic bibliographic field". + <field> + <field_name> + field name "2" + <field_body> + <paragraph> + Generic bibliographic fields may contain multiple body elements. + <paragraph> + Like this. + <topic classes="dedication"> + <title> + Dedication + <paragraph> + For Docutils users & co-developers. + <topic classes="abstract"> + <title> + Abstract + <paragraph> + This is a test document, containing at least one example of each + reStructuredText construct. + <comment xml:space="preserve"> + This is a comment. Note how any initial comments are moved by + transforms to after the document title, subtitle, and docinfo. + <target refid="doctitle"> + <comment xml:space="preserve"> + Above is the document title, and below is the subtitle. + They are transformed from section titles after parsing. + <target refid="subtitle"> + <comment xml:space="preserve"> + bibliographic fields (which also require a transform): + <meta content="reStructuredText, test, parser" name="keywords"> + <meta content="A test document, containing at least one example of each reStructuredText construct." lang="en" name="description"> + <topic classes="contents" ids="table-of-contents" names="table of contents"> + <title> + Table of Contents + <bullet_list classes="auto-toc"> + <list_item> + <paragraph> + <reference ids="id25" refid="structural-elements"> + <generated classes="sectnum"> + 1    + Structural Elements + <bullet_list classes="auto-toc"> + <list_item> + <paragraph> + <reference ids="id26" refid="section-title"> + <generated classes="sectnum"> + 1.1    + Section Title + <list_item> + <paragraph> + <reference ids="id27" refid="empty-section"> + <generated classes="sectnum"> + 1.2    + Empty Section + <list_item> + <paragraph> + <reference ids="id28" refid="transitions"> + <generated classes="sectnum"> + 1.3    + Transitions + <list_item> + <paragraph> + <reference ids="id29" refid="body-elements"> + <generated classes="sectnum"> + 2    + Body Elements + <bullet_list classes="auto-toc"> + <list_item> + <paragraph> + <reference ids="id30" refid="paragraphs"> + <generated classes="sectnum"> + 2.1    + Paragraphs + <bullet_list classes="auto-toc"> + <list_item> + <paragraph> + <reference ids="id31" refid="inline-markup"> + <generated classes="sectnum"> + 2.1.1    + Inline Markup + <list_item> + <paragraph> + <reference ids="id32" refid="bullet-lists"> + <generated classes="sectnum"> + 2.2    + Bullet Lists + <list_item> + <paragraph> + <reference ids="id33" refid="enumerated-lists"> + <generated classes="sectnum"> + 2.3    + Enumerated Lists + <list_item> + <paragraph> + <reference ids="id34" refid="definition-lists"> + <generated classes="sectnum"> + 2.4    + Definition Lists + <list_item> + <paragraph> + <reference ids="id35" refid="field-lists"> + <generated classes="sectnum"> + 2.5    + Field Lists + <list_item> + <paragraph> + <reference ids="id36" refid="option-lists"> + <generated classes="sectnum"> + 2.6    + Option Lists + <list_item> + <paragraph> + <reference ids="id37" refid="literal-blocks"> + <generated classes="sectnum"> + 2.7    + Literal Blocks + <list_item> + <paragraph> + <reference ids="id38" refid="line-blocks"> + <generated classes="sectnum"> + 2.8    + Line Blocks + <list_item> + <paragraph> + <reference ids="id39" refid="block-quotes"> + <generated classes="sectnum"> + 2.9    + Block Quotes + <list_item> + <paragraph> + <reference ids="id40" refid="doctest-blocks"> + <generated classes="sectnum"> + 2.10    + Doctest Blocks + <list_item> + <paragraph> + <reference ids="id41" refid="footnotes"> + <generated classes="sectnum"> + 2.11    + Footnotes + <list_item> + <paragraph> + <reference ids="id42" refid="citations"> + <generated classes="sectnum"> + 2.12    + Citations + <list_item> + <paragraph> + <reference ids="id43" refid="targets"> + <generated classes="sectnum"> + 2.13    + Targets + <bullet_list classes="auto-toc"> + <list_item> + <paragraph> + <reference ids="id44" refid="duplicate-target-names"> + <generated classes="sectnum"> + 2.13.1    + Duplicate Target Names + <list_item> + <paragraph> + <reference ids="id45" refid="id18"> + <generated classes="sectnum"> + 2.13.2    + Duplicate Target Names + <list_item> + <paragraph> + <reference ids="id46" refid="directives"> + <generated classes="sectnum"> + 2.14    + Directives + <bullet_list classes="auto-toc"> + <list_item> + <paragraph> + <reference ids="id47" refid="document-parts"> + <generated classes="sectnum"> + 2.14.1    + Document Parts + <list_item> + <paragraph> + <reference ids="id48" refid="images"> + <generated classes="sectnum"> + 2.14.2    + Images + <list_item> + <paragraph> + <reference ids="id49" refid="admonitions"> + <generated classes="sectnum"> + 2.14.3    + Admonitions + <list_item> + <paragraph> + <reference ids="id50" refid="topics-sidebars-and-rubrics"> + <generated classes="sectnum"> + 2.14.4    + Topics, Sidebars, and Rubrics + <list_item> + <paragraph> + <reference ids="id51" refid="target-footnotes"> + <generated classes="sectnum"> + 2.14.5    + Target Footnotes + <list_item> + <paragraph> + <reference ids="id52" refid="replacement-text"> + <generated classes="sectnum"> + 2.14.6    + Replacement Text + <list_item> + <paragraph> + <reference ids="id53" refid="compound-paragraph"> + <generated classes="sectnum"> + 2.14.7    + Compound Paragraph + <list_item> + <paragraph> + <reference ids="id54" refid="substitution-definitions"> + <generated classes="sectnum"> + 2.15    + Substitution Definitions + <list_item> + <paragraph> + <reference ids="id55" refid="comments"> + <generated classes="sectnum"> + 2.16    + Comments + <list_item> + <paragraph> + <reference ids="id56" refid="raw-text"> + <generated classes="sectnum"> + 2.17    + Raw text + <list_item> + <paragraph> + <reference ids="id57" refid="colspanning-tables"> + <generated classes="sectnum"> + 2.18    + Colspanning tables + <list_item> + <paragraph> + <reference ids="id58" refid="rowspanning-tables"> + <generated classes="sectnum"> + 2.19    + Rowspanning tables + <list_item> + <paragraph> + <reference ids="id59" refid="complex-tables"> + <generated classes="sectnum"> + 2.20    + Complex tables + <list_item> + <paragraph> + <reference ids="id60" refid="list-tables"> + <generated classes="sectnum"> + 2.21    + List Tables + <list_item> + <paragraph> + <reference ids="id61" refid="error-handling"> + <generated classes="sectnum"> + 3    + Error Handling + <section ids="structural-elements" names="structural elements"> + <title auto="1" refid="id25"> + <generated classes="sectnum"> + 1    + Structural Elements + <section ids="section-title" names="section title"> + <title auto="1" refid="id26"> + <generated classes="sectnum"> + 1.1    + Section Title + <paragraph> + That's it, the text just above this line. + <section ids="empty-section" names="empty section"> + <title auto="1" refid="id27"> + <generated classes="sectnum"> + 1.2    + Empty Section + <section ids="transitions" names="transitions"> + <title auto="1" refid="id28"> + <generated classes="sectnum"> + 1.3    + Transitions + <paragraph> + Here's a transition: + <transition> + <paragraph> + It divides the section. Transitions may also occur between sections: + <transition> + <section ids="body-elements" names="body elements"> + <title auto="1" refid="id29"> + <generated classes="sectnum"> + 2    + Body Elements + <section ids="paragraphs" names="paragraphs"> + <title auto="1" refid="id30"> + <generated classes="sectnum"> + 2.1    + Paragraphs + <paragraph> + A paragraph. + <section ids="inline-markup" names="inline markup"> + <title auto="1" refid="id31"> + <generated classes="sectnum"> + 2.1.1    + Inline Markup + <paragraph> + Paragraphs contain text and may contain inline markup: + <emphasis> + emphasis + , + <strong> + strong emphasis + , + <literal> + inline literals + , standalone hyperlinks + ( + <reference refuri="http://www.python.org"> + http://www.python.org + ), external hyperlinks ( + <reference name="Python" refuri="http://www.python.org/"> + Python + + <footnote_reference auto="1" ids="id22" refid="id21"> + 5 + ), internal + cross-references ( + <reference name="example" refid="example"> + example + ), external hyperlinks with embedded URIs + ( + <reference name="Python web site" refuri="http://www.python.org"> + Python web site + ), footnote references + (manually numbered + <footnote_reference ids="id1" refid="id6"> + 1 + , anonymous auto-numbered + <footnote_reference auto="1" ids="id2" refid="id9"> + 3 + , labeled + auto-numbered + <footnote_reference auto="1" ids="id3" refid="label"> + 2 + , or symbolic + <footnote_reference auto="*" ids="id4" refid="id10"> + * + ), citation references + ( + <citation_reference ids="id5" refid="cit2002"> + CIT2002 + ), substitution references ( + <image alt="EXAMPLE" uri="../../../docs/user/rst/images/biohazard.png"> + ), and + <target ids="inline-hyperlink-targets" names="inline hyperlink targets"> + inline + hyperlink targets + (see + <reference name="Targets" refid="targets"> + Targets + below for a reference back to here). + Character-level inline markup is also possible (although exceedingly + ugly!) in + <emphasis> + re + <literal> + Structured + <emphasis> + Text + . Problems are indicated by + <problematic ids="id20" refid="id19"> + |problematic| + text (generated by processing errors; this one is + intentional). Here is a reference to the + <reference name="doctitle" refid="doctitle"> + doctitle + and the + <reference name="subtitle" refid="subtitle"> + subtitle + . + <paragraph> + The default role for interpreted text is + <title_reference> + Title Reference + . Here are + some explicit interpreted text roles: a PEP reference ( + <reference refuri="http://www.python.org/peps/pep-0287.html"> + PEP 287 + ); an + RFC reference ( + <reference refuri="http://www.faqs.org/rfcs/rfc2822.html"> + RFC 2822 + ); a + <subscript> + subscript + ; a + <superscript> + superscript + ; + and explicit roles for + <emphasis> + standard + + <strong> + inline + + <literal> + markup + . + <comment xml:space="preserve"> + DO NOT RE-WRAP THE FOLLOWING PARAGRAPH! + <paragraph> + Let's test wrapping and whitespace significance in inline literals: + <literal> + This is an example of --inline-literal --text, --including some-- + strangely--hyphenated-words. Adjust-the-width-of-your-browser-window + to see how the text is wrapped. -- ---- -------- Now note the + spacing between the words of this sentence (words + should be grouped in pairs). + <paragraph> + If the + <literal> + --pep-references + option was supplied, there should be a + live link to PEP 258 here. + <section ids="bullet-lists" names="bullet lists"> + <title auto="1" refid="id32"> + <generated classes="sectnum"> + 2.2    + Bullet Lists + <bullet_list bullet="-"> + <list_item> + <paragraph> + A bullet list + <bullet_list bullet="+"> + <list_item> + <paragraph> + Nested bullet list. + <list_item> + <paragraph> + Nested item 2. + <list_item> + <paragraph> + Item 2. + <paragraph> + Paragraph 2 of item 2. + <bullet_list bullet="*"> + <list_item> + <paragraph> + Nested bullet list. + <list_item> + <paragraph> + Nested item 2. + <bullet_list bullet="-"> + <list_item> + <paragraph> + Third level. + <list_item> + <paragraph> + Item 2. + <list_item> + <paragraph> + Nested item 3. + <list_item> + <paragraph> + This nested list should be compacted by the HTML writer. + <target ids="target" names="target"> + <comment xml:space="preserve"> + Even if this item contains a target and a comment. + <section ids="enumerated-lists" names="enumerated lists"> + <title auto="1" refid="id33"> + <generated classes="sectnum"> + 2.3    + Enumerated Lists + <enumerated_list enumtype="arabic" prefix="" suffix="."> + <list_item> + <paragraph> + Arabic numerals. + <enumerated_list enumtype="loweralpha" prefix="" suffix=")"> + <list_item> + <paragraph> + lower alpha) + <enumerated_list enumtype="lowerroman" prefix="(" suffix=")"> + <list_item> + <paragraph> + (lower roman) + <enumerated_list enumtype="upperalpha" prefix="" suffix="."> + <list_item> + <paragraph> + upper alpha. + <enumerated_list enumtype="upperroman" prefix="" suffix=")"> + <list_item> + <paragraph> + upper roman) + <list_item> + <paragraph> + Lists that don't start at 1: + <enumerated_list enumtype="arabic" prefix="" start="3" suffix="."> + <list_item> + <paragraph> + Three + <list_item> + <paragraph> + Four + <enumerated_list enumtype="upperalpha" prefix="" start="3" suffix="."> + <list_item> + <paragraph> + C + <list_item> + <paragraph> + D + <enumerated_list enumtype="lowerroman" prefix="" start="3" suffix="."> + <list_item> + <paragraph> + iii + <list_item> + <paragraph> + iv + <section ids="definition-lists" names="definition lists"> + <title auto="1" refid="id34"> + <generated classes="sectnum"> + 2.4    + Definition Lists + <definition_list> + <definition_list_item> + <term> + Term + <definition> + <paragraph> + Definition + <definition_list_item> + <term> + Term + <classifier> + classifier + <definition> + <paragraph> + Definition paragraph 1. + <paragraph> + Definition paragraph 2. + <definition_list_item> + <term> + Term + <definition> + <paragraph> + Definition + <definition_list_item> + <term> + Term + <classifier> + classifier one + <classifier> + classifier two + <definition> + <paragraph> + Definition + <section ids="field-lists" names="field lists"> + <title auto="1" refid="id35"> + <generated classes="sectnum"> + 2.5    + Field Lists + <field_list> + <field> + <field_name> + what + <field_body> + <paragraph> + Field lists map field names to field bodies, like database + records. They are often part of an extension syntax. They are + an unambiguous variant of RFC 2822 fields. + <field> + <field_name> + how arg1 arg2 + <field_body> + <paragraph> + The field marker is a colon, the field name, and a colon. + <paragraph> + The field body may contain one or more body elements, indented + relative to the field marker. + <field> + <field_name> + credits + <field_body> + <paragraph classes="credits"> + This paragraph has the + <title_reference> + credits + class set. (This is actually not + about credits but just for ensuring that the class attribute + doesn't get stripped away.) + <section ids="option-lists" names="option lists"> + <title auto="1" refid="id36"> + <generated classes="sectnum"> + 2.6    + Option Lists + <paragraph> + For listing command-line options: + <option_list> + <option_list_item> + <option_group> + <option> + <option_string> + -a + <description> + <paragraph> + command-line option "a" + <option_list_item> + <option_group> + <option> + <option_string> + -b + <option_argument delimiter=" "> + file + <description> + <paragraph> + options can have arguments + and long descriptions + <option_list_item> + <option_group> + <option> + <option_string> + --long + <description> + <paragraph> + options can be long also + <option_list_item> + <option_group> + <option> + <option_string> + --input + <option_argument delimiter="="> + file + <description> + <paragraph> + long options can also have + arguments + <option_list_item> + <option_group> + <option> + <option_string> + --very-long-option + <description> + <paragraph> + The description can also start on the next line. + <paragraph> + The description may contain multiple body elements, + regardless of where it starts. + <option_list_item> + <option_group> + <option> + <option_string> + -x + <option> + <option_string> + -y + <option> + <option_string> + -z + <description> + <paragraph> + Multiple options are an "option group". + <option_list_item> + <option_group> + <option> + <option_string> + -v + <option> + <option_string> + --verbose + <description> + <paragraph> + Commonly-seen: short & long options. + <option_list_item> + <option_group> + <option> + <option_string> + -1 + <option_argument delimiter=" "> + file + <option> + <option_string> + --one + <option_argument delimiter="="> + file + <option> + <option_string> + --two + <option_argument delimiter=" "> + file + <description> + <paragraph> + Multiple options with arguments. + <option_list_item> + <option_group> + <option> + <option_string> + /V + <description> + <paragraph> + DOS/VMS-style options too + <paragraph> + There must be at least two spaces between the option and the + description. + <section ids="literal-blocks" names="literal blocks"> + <title auto="1" refid="id37"> + <generated classes="sectnum"> + 2.7    + Literal Blocks + <paragraph> + Literal blocks are indicated with a double-colon ("::") at the end of + the preceding paragraph (over there + <literal> + --> + ). They can be indented: + <literal_block xml:space="preserve"> + if literal_block: + text = 'is left as-is' + spaces_and_linebreaks = 'are preserved' + markup_processing = None + <paragraph> + Or they can be quoted without indentation: + <literal_block xml:space="preserve"> + >> Great idea! + > + > Why didn't I think of that? + <section ids="line-blocks" names="line blocks"> + <title auto="1" refid="id38"> + <generated classes="sectnum"> + 2.8    + Line Blocks + <paragraph> + This section tests line blocks. Line blocks are body elements which + consist of lines and other line blocks. Nested line blocks cause + indentation. + <line_block> + <line> + This is a line block. It ends with a blank line. + <line_block> + <line> + New lines begin with a vertical bar ("|"). + <line> + Line breaks and initial indent are significant, and preserved. + <line_block> + <line> + Continuation lines are also possible. A long line that is intended + to wrap should begin with a space in place of the vertical bar. + <line> + The left edge of a continuation line need not be aligned with + the left edge of the text above it. + <line_block> + <line> + This is a second line block. + <line> + <line> + Blank lines are permitted internally, but they must begin with a "|". + <paragraph> + Another line block, surrounded by paragraphs: + <line_block> + <line> + And it's no good waiting by the window + <line> + It's no good waiting for the sun + <line> + Please believe me, the things you dream of + <line> + They don't fall in the lap of no-one + <paragraph> + Take it away, Eric the Orchestra Leader! + <block_quote> + <line_block> + <line> + A one, two, a one two three four + <line> + <line> + Half a bee, philosophically, + <line_block> + <line> + must, + <emphasis> + ipso facto + , half not be. + <line> + But half the bee has got to be, + <line_block> + <line> + <emphasis> + vis a vis + its entity. D'you see? + <line> + <line> + But can a bee be said to be + <line_block> + <line> + or not to be an entire bee, + <line_block> + <line> + when half the bee is not a bee, + <line_block> + <line> + due to some ancient injury? + <line> + <line> + Singing... + <section ids="block-quotes" names="block quotes"> + <title auto="1" refid="id39"> + <generated classes="sectnum"> + 2.9    + Block Quotes + <paragraph> + Block quotes consist of indented body elements: + <block_quote> + <paragraph> + My theory by A. Elk. Brackets Miss, brackets. This theory goes + as follows and begins now. All brontosauruses are thin at one + end, much much thicker in the middle and then thin again at the + far end. That is my theory, it is mine, and belongs to me and I + own it, and what it is too. + <attribution> + Anne Elk (Miss) + <section ids="doctest-blocks" names="doctest blocks"> + <title auto="1" refid="id40"> + <generated classes="sectnum"> + 2.10    + Doctest Blocks + <doctest_block xml:space="preserve"> + >>> print 'Python-specific usage examples; begun with ">>>"' + Python-specific usage examples; begun with ">>>" + >>> print '(cut and pasted from interactive Python sessions)' + (cut and pasted from interactive Python sessions) + <section ids="footnotes" names="footnotes"> + <title auto="1" refid="id41"> + <generated classes="sectnum"> + 2.11    + Footnotes + <footnote backrefs="id1 id7" ids="id6" names="1"> + <label> + 1 + <paragraph> + A footnote contains body elements, consistently indented by at + least 3 spaces. + <paragraph> + This is the footnote's second paragraph. + <footnote auto="1" backrefs="id3 id8" ids="label" names="label"> + <label> + 2 + <paragraph> + Footnotes may be numbered, either manually (as in + <footnote_reference ids="id7" refid="id6"> + 1 + ) or + automatically using a "#"-prefixed label. This footnote has a + label so it can be referred to from multiple places, both as a + footnote reference ( + <footnote_reference auto="1" ids="id8" refid="label"> + 2 + ) and as a hyperlink reference + ( + <reference name="label" refid="label"> + label + ). + <footnote auto="1" backrefs="id2" ids="id9" names="3"> + <label> + 3 + <paragraph> + This footnote is numbered automatically and anonymously using a + label of "#" only. + <paragraph> + This is the second paragraph. + <paragraph> + And this is the third paragraph. + <footnote auto="*" backrefs="id4" ids="id10"> + <label> + * + <paragraph> + Footnotes may also use symbols, specified with a "*" label. + Here's a reference to the next footnote: + <footnote_reference auto="*" ids="id11" refid="id12"> + † + . + <footnote auto="*" backrefs="id11" ids="id12"> + <label> + † + <paragraph> + This footnote shows the next symbol in the sequence. + <footnote ids="id13" names="4"> + <label> + 4 + <paragraph> + Here's an unreferenced footnote, with a reference to a + nonexistent footnote: + <problematic ids="id70" refid="id69"> + [5]_ + . + <section ids="citations" names="citations"> + <title auto="1" refid="id42"> + <generated classes="sectnum"> + 2.12    + Citations + <citation backrefs="id5 id15" ids="cit2002" names="cit2002"> + <label> + CIT2002 + <paragraph> + Citations are text-labeled footnotes. They may be + rendered separately and differently from footnotes. + <paragraph> + Here's a reference to the above, + <citation_reference ids="id15" refid="cit2002"> + CIT2002 + , and a + <problematic ids="id72" refid="id71"> + [nonexistent]_ + + citation. + <section ids="targets" names="targets"> + <title auto="1" refid="id43"> + <generated classes="sectnum"> + 2.13    + Targets + <target refid="example"> + <paragraph ids="example" names="example"> + This paragraph is pointed to by the explicit "example" target. A + reference can be found under + <reference name="Inline Markup" refid="inline-markup"> + Inline Markup + , above. + <reference name="Inline hyperlink targets" refid="inline-hyperlink-targets"> + Inline + hyperlink targets + are also possible. + <paragraph> + Section headers are implicit targets, referred to by name. See + <reference name="Targets" refid="targets"> + Targets + , which is a subsection of + <reference name="Body Elements" refid="body-elements"> + Body Elements + . + <paragraph> + Explicit external targets are interpolated into references such as + " + <reference name="Python" refuri="http://www.python.org/"> + Python + + <footnote_reference auto="1" ids="id23" refid="id21"> + 5 + ". + <target ids="python" names="python" refuri="http://www.python.org/"> + <paragraph> + Targets may be indirect and anonymous. Thus + <reference anonymous="1" name="this phrase" refid="targets"> + this phrase + may also + refer to the + <reference name="Targets" refid="targets"> + Targets + section. + <target anonymous="1" ids="id17" refid="targets"> + <paragraph> + Here's a + <problematic ids="id74" refid="id73"> + `hyperlink reference without a target`_ + , which generates an + error. + <section dupnames="duplicate target names" ids="duplicate-target-names"> + <title auto="1" refid="id44"> + <generated classes="sectnum"> + 2.13.1    + Duplicate Target Names + <paragraph> + Duplicate names in section headers or other implicit targets will + generate "info" (level-1) system messages. Duplicate names in + explicit targets will generate "warning" (level-2) system messages. + <section dupnames="duplicate target names" ids="id18"> + <title auto="1" refid="id45"> + <generated classes="sectnum"> + 2.13.2    + Duplicate Target Names + <paragraph> + Since there are two "Duplicate Target Names" section headers, we + cannot uniquely refer to either of them by name. If we try to (like + this: + <problematic ids="id76" refid="id75"> + `Duplicate Target Names`_ + ), an error is generated. + <section ids="directives" names="directives"> + <title auto="1" refid="id46"> + <generated classes="sectnum"> + 2.14    + Directives + <topic classes="contents" ids="contents" names="contents"> + <bullet_list classes="auto-toc"> + <list_item> + <paragraph> + <reference ids="id62" refid="document-parts"> + <generated classes="sectnum"> + 2.14.1    + Document Parts + <list_item> + <paragraph> + <reference ids="id63" refid="images"> + <generated classes="sectnum"> + 2.14.2    + Images + <list_item> + <paragraph> + <reference ids="id64" refid="admonitions"> + <generated classes="sectnum"> + 2.14.3    + Admonitions + <list_item> + <paragraph> + <reference ids="id65" refid="topics-sidebars-and-rubrics"> + <generated classes="sectnum"> + 2.14.4    + Topics, Sidebars, and Rubrics + <list_item> + <paragraph> + <reference ids="id66" refid="target-footnotes"> + <generated classes="sectnum"> + 2.14.5    + Target Footnotes + <list_item> + <paragraph> + <reference ids="id67" refid="replacement-text"> + <generated classes="sectnum"> + 2.14.6    + Replacement Text + <list_item> + <paragraph> + <reference ids="id68" refid="compound-paragraph"> + <generated classes="sectnum"> + 2.14.7    + Compound Paragraph + <paragraph> + These are just a sample of the many reStructuredText Directives. For + others, please see + <reference refuri="http://docutils.sourceforge.net/docs/ref/rst/directives.html"> + http://docutils.sourceforge.net/docs/ref/rst/directives.html + . + <section ids="document-parts" names="document parts"> + <title auto="1" refid="id62"> + <generated classes="sectnum"> + 2.14.1    + Document Parts + <paragraph> + An example of the "contents" directive can be seen above this section + (a local, untitled table of + <reference name="contents" refid="contents"> + contents + ) and at the beginning of the + document (a document-wide + <reference name="table of contents" refid="table-of-contents"> + table of contents + ). + <section ids="images" names="images"> + <title auto="1" refid="id63"> + <generated classes="sectnum"> + 2.14.2    + Images + <paragraph> + An image directive (also clickable -- a hyperlink reference): + <reference name="directives_" refid="directives"> + <image classes="class1 class2" uri="../../../docs/user/rst/images/title.png"> + <paragraph> + A figure directive: + <figure classes="figclass1 figclass2"> + <image alt="reStructuredText, the markup syntax" classes="class1 class2" uri="../../../docs/user/rst/images/title.png"> + <caption> + A figure is an image with a caption and/or a legend: + <legend> + <table> + <tgroup cols="2"> + <colspec colwidth="12"> + <colspec colwidth="47"> + <tbody> + <row> + <entry> + <paragraph> + re + <entry> + <paragraph> + Revised, revisited, based on 're' module. + <row> + <entry> + <paragraph> + Structured + <entry> + <paragraph> + Structure-enhanced text, structuredtext. + <row> + <entry> + <paragraph> + Text + <entry> + <paragraph> + Well it is, isn't it? + <paragraph> + This paragraph is also part of the legend. + <section ids="admonitions" names="admonitions"> + <title auto="1" refid="id64"> + <generated classes="sectnum"> + 2.14.3    + Admonitions + <attention> + <paragraph> + Directives at large. + <caution> + <paragraph> + Don't take any wooden nickels. + <danger> + <paragraph> + Mad scientist at work! + <error> + <paragraph> + Does not compute. + <hint> + <paragraph> + It's bigger than a bread box. + <important> + <bullet_list bullet="-"> + <list_item> + <paragraph> + Wash behind your ears. + <list_item> + <paragraph> + Clean up your room. + <list_item> + <paragraph> + Call your mother. + <list_item> + <paragraph> + Back up your data. + <note> + <paragraph> + This is a note. + <tip> + <paragraph> + 15% if the service is good. + <warning> + <paragraph> + Strong prose may provoke extreme mental exertion. + Reader discretion is strongly advised. + <admonition classes="admonition-and-by-the-way"> + <title> + And, by the way... + <paragraph> + You can make up your own admonition too. + <section ids="topics-sidebars-and-rubrics" names="topics, sidebars, and rubrics"> + <title auto="1" refid="id65"> + <generated classes="sectnum"> + 2.14.4    + Topics, Sidebars, and Rubrics + <sidebar> + <title> + Sidebar Title + <subtitle> + Optional Subtitle + <paragraph> + This is a sidebar. It is for text outside the flow of the main + text. + <rubric> + This is a rubric inside a sidebar + <paragraph> + Sidebars often appears beside the main text with a border and + background color. + <topic> + <title> + Topic Title + <paragraph> + This is a topic. + <rubric> + This is a rubric + <section ids="target-footnotes" names="target footnotes"> + <title auto="1" refid="id66"> + <generated classes="sectnum"> + 2.14.5    + Target Footnotes + <footnote auto="1" backrefs="id22 id23 id24" ids="id21" names="TARGET_NOTE: id21"> + <label> + 5 + <paragraph> + <reference refuri="http://www.python.org/"> + http://www.python.org/ + <section ids="replacement-text" names="replacement text"> + <title auto="1" refid="id67"> + <generated classes="sectnum"> + 2.14.6    + Replacement Text + <paragraph> + I recommend you try + <reference refuri="http://www.python.org/"> + Python, + <emphasis> + the + best language around + + <footnote_reference auto="1" ids="id24" refid="id21"> + 5 + . + <substitution_definition names="Python"> + Python, + <emphasis> + the + best language around + <section ids="compound-paragraph" names="compound paragraph"> + <title auto="1" refid="id68"> + <generated classes="sectnum"> + 2.14.7    + Compound Paragraph + <compound classes="some-class"> + <paragraph> + Compound 1, paragraph 1. + <paragraph> + Compound 1, paragraph 2. + <bullet_list bullet="*"> + <list_item> + <paragraph> + Compound 1, list item one. + <list_item> + <paragraph> + Compound 1, list item two. + <paragraph> + Another compound statement: + <compound> + <paragraph> + Compound 2, a literal block: + <literal_block xml:space="preserve"> + Compound 2, literal. + <paragraph> + Compound 2, this is a test. + <compound> + <paragraph> + Compound 3, only consisting of one paragraph. + <compound> + <literal_block xml:space="preserve"> + Compound 4. + This one starts with a literal block. + <paragraph> + Compound 4, a paragraph. + <paragraph> + Now something + <emphasis> + really + perverted -- a nested compound block. In + LaTeX, the following paragraphs should all be first-line indented: + <compound> + <paragraph> + Compound 5, block 1 (a paragraph). + <compound> + <paragraph> + Compound 6, block 2 in compound 5. + <paragraph> + Compound 6, another paragraph. + <paragraph> + Compound 5, block 3 (a paragraph). + <compound> + <paragraph> + Compound 7, with a table inside: + <table> + <tgroup cols="3"> + <colspec colwidth="20"> + <colspec colwidth="20"> + <colspec colwidth="20"> + <tbody> + <row> + <entry> + <paragraph> + Left cell, first + paragraph. + <paragraph> + Left cell, second + paragraph. + <entry> + <paragraph> + Middle cell, + consisting of + exactly one + paragraph. + <entry> + <paragraph> + Right cell. + <paragraph> + Paragraph 2. + <paragraph> + Paragraph 3. + <paragraph> + Compound 7, a paragraph after the table. + <paragraph> + Compound 7, another paragraph. + <section ids="substitution-definitions" names="substitution definitions"> + <title auto="1" refid="id54"> + <generated classes="sectnum"> + 2.15    + Substitution Definitions + <paragraph> + An inline image ( + <image alt="EXAMPLE" uri="../../../docs/user/rst/images/biohazard.png"> + ) example: + <substitution_definition names="EXAMPLE"> + <image alt="EXAMPLE" uri="../../../docs/user/rst/images/biohazard.png"> + <paragraph> + (Substitution definitions are not visible in the HTML source.) + <section ids="comments" names="comments"> + <title auto="1" refid="id55"> + <generated classes="sectnum"> + 2.16    + Comments + <paragraph> + Here's one: + <comment xml:space="preserve"> + Comments begin with two dots and a space. Anything may + follow, except for the syntax of footnotes, hyperlink + targets, directives, or substitution definitions. + + Double-dashes -- "--" -- must be escaped somehow in HTML output. + <paragraph> + (View the HTML source to see the comment.) + <section ids="raw-text" names="raw text"> + <title auto="1" refid="id56"> + <generated classes="sectnum"> + 2.17    + Raw text + <paragraph> + This does not necessarily look nice, because there may be missing white space. + <paragraph> + It's just there to freeze the behavior. + <raw format="html latex" xml:space="preserve"> + A test. + <raw format="html latex" xml:space="preserve"> + Second test. + <raw classes="myclass" format="html latex" xml:space="preserve"> + Another test with myclass set. + <paragraph> + This is the + <raw classes="myrawroleclass" format="html latex" xml:space="preserve"> + fourth test + with myrawroleclass set. + <raw format="html" xml:space="preserve"> + Fifth test in HTML.<br />Line two. + <raw format="latex" xml:space="preserve"> + Fifth test in LaTeX.\\Line two. + <section ids="colspanning-tables" names="colspanning tables"> + <title auto="1" refid="id57"> + <generated classes="sectnum"> + 2.18    + Colspanning tables + <paragraph> + This table has a cell spanning two columns: + <table> + <tgroup cols="3"> + <colspec colwidth="5"> + <colspec colwidth="5"> + <colspec colwidth="6"> + <thead> + <row> + <entry morecols="1"> + <paragraph> + Inputs + <entry> + <paragraph> + Output + <row> + <entry> + <paragraph> + A + <entry> + <paragraph> + B + <entry> + <paragraph> + A or B + <tbody> + <row> + <entry> + <paragraph> + False + <entry> + <paragraph> + False + <entry> + <paragraph> + False + <row> + <entry> + <paragraph> + True + <entry> + <paragraph> + False + <entry> + <paragraph> + True + <row> + <entry> + <paragraph> + False + <entry> + <paragraph> + True + <entry> + <paragraph> + True + <row> + <entry> + <paragraph> + True + <entry> + <paragraph> + True + <entry> + <paragraph> + True + <section ids="rowspanning-tables" names="rowspanning tables"> + <title auto="1" refid="id58"> + <generated classes="sectnum"> + 2.19    + Rowspanning tables + <paragraph> + Here's a table with cells spanning several rows: + <table> + <tgroup cols="3"> + <colspec colwidth="24"> + <colspec colwidth="12"> + <colspec colwidth="18"> + <thead> + <row> + <entry> + <paragraph> + Header row, column 1 + (header rows optional) + <entry> + <paragraph> + Header 2 + <entry> + <paragraph> + Header 3 + <tbody> + <row> + <entry> + <paragraph> + body row 1, column 1 + <entry> + <paragraph> + column 2 + <entry> + <paragraph> + column 3 + <row> + <entry> + <paragraph> + body row 2 + <entry morerows="1"> + <paragraph> + Cells may + span rows. + <entry morerows="1"> + <bullet_list bullet="-"> + <list_item> + <paragraph> + Table cells + <list_item> + <paragraph> + contain + <list_item> + <paragraph> + body elements. + <row> + <entry> + <paragraph> + body row 3 + <section ids="complex-tables" names="complex tables"> + <title auto="1" refid="id59"> + <generated classes="sectnum"> + 2.20    + Complex tables + <paragraph> + Here's a complex table, which should test all features. + <table> + <tgroup cols="4"> + <colspec colwidth="24"> + <colspec colwidth="12"> + <colspec colwidth="10"> + <colspec colwidth="10"> + <thead> + <row> + <entry> + <paragraph> + Header row, column 1 + (header rows optional) + <entry> + <paragraph> + Header 2 + <entry> + <paragraph> + Header 3 + <entry> + <paragraph> + Header 4 + <tbody> + <row> + <entry> + <paragraph> + body row 1, column 1 + <entry> + <paragraph> + column 2 + <entry> + <paragraph> + column 3 + <entry> + <paragraph> + column 4 + <row> + <entry> + <paragraph> + body row 2 + <entry morecols="2"> + <paragraph> + Cells may span columns. + <row> + <entry> + <paragraph> + body row 3 + <entry morerows="1"> + <paragraph> + Cells may + span rows. + <paragraph> + Paragraph. + <entry morecols="1" morerows="1"> + <bullet_list bullet="-"> + <list_item> + <paragraph> + Table cells + <list_item> + <paragraph> + contain + <list_item> + <paragraph> + body elements. + <row> + <entry> + <paragraph> + body row 4 + <row> + <entry> + <paragraph> + body row 5 + <entry morecols="1"> + <paragraph> + Cells may also be + empty: + <literal> + --> + <entry> + <section ids="list-tables" names="list tables"> + <title auto="1" refid="id60"> + <generated classes="sectnum"> + 2.21    + List Tables + <paragraph> + Here's a list table exercising all features: + <table classes="test"> + <title> + list table with integral header + <tgroup cols="3"> + <colspec colwidth="10" stub="1"> + <colspec colwidth="20"> + <colspec colwidth="30"> + <thead> + <row> + <entry> + <paragraph> + Treat + <entry> + <paragraph> + Quantity + <entry> + <paragraph> + Description + <tbody> + <row> + <entry> + <paragraph> + Albatross + <entry> + <paragraph> + 2.99 + <entry> + <paragraph> + On a stick! + <row> + <entry> + <paragraph> + Crunchy Frog + <entry> + <paragraph> + 1.49 + <entry> + <paragraph> + If we took the bones out, it wouldn't be + crunchy, now would it? + <row> + <entry> + <paragraph> + Gannet Ripple + <entry> + <paragraph> + 1.99 + <entry> + <paragraph> + On a stick! + <section ids="error-handling" names="error handling"> + <title auto="1" refid="id61"> + <generated classes="sectnum"> + 3    + Error Handling + <paragraph> + Any errors caught during processing will generate system messages. + <paragraph> + There should be five messages in the following, auto-generated + section, "Docutils System Messages": + <comment xml:space="preserve"> + section should be added by Docutils automatically + <section classes="system-messages"> + <title> + Docutils System Messages + <system_message backrefs="id20" ids="id19" level="3" line="98" source="functional/input/data/standard.txt" type="ERROR"> + <paragraph> + Undefined substitution referenced: "problematic". + <system_message backrefs="id70" ids="id69" level="3" line="352" source="functional/input/standalone_rst_html4css1.txt" type="ERROR"> + <paragraph> + Unknown target name: "5". + <system_message backrefs="id72" ids="id71" level="3" line="361" source="functional/input/data/standard.txt" type="ERROR"> + <paragraph> + Unknown target name: "nonexistent". + <system_message backrefs="id74" ids="id73" level="3" line="386" source="functional/input/data/standard.txt" type="ERROR"> + <paragraph> + Unknown target name: "hyperlink reference without a target". + <system_message backrefs="id76" ids="id75" level="3" line="399" source="functional/input/data/standard.txt" type="ERROR"> + <paragraph> + Duplicate target name, cannot be used as a unique reference: "duplicate target names". diff --git a/test/functional/tests/standalone_rst_pseudoxml.py b/test/functional/tests/standalone_rst_pseudoxml.py new file mode 100644 index 000000000..4df832f64 --- /dev/null +++ b/test/functional/tests/standalone_rst_pseudoxml.py @@ -0,0 +1,8 @@ +# Source and destination file names. +test_source = "standalone_rst_html4css1.txt" +test_destination = "standalone_rst_pseudoxml.txt" + +# Keyword parameters passed to publish_file. +reader_name = "standalone" +parser_name = "rst" +writer_name = "pseudoxml" -- cgit v1.2.1 From 70252527abecd4374c194876c1c337db1976fb6b Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Fri, 8 Apr 2005 15:19:09 +0000 Subject: moved the <hr> tags inside the header and footer <div>s; changed the classes of these <hr> to just "header" and "footer" git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3192 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_html4css1.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index 78605137a..66879b19f 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -19,8 +19,8 @@ <body> <div class="header"> Document header +<hr class="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> @@ -922,8 +922,8 @@ Unknown target name: "hyperlink reference without a target".</div> Duplicate target name, cannot be used as a unique reference: "duplicate target names".</div> </div> </div> -<hr class="docutils footer" /> <div class="footer"> +<hr class="footer" /> Document footer </div> </body> -- cgit v1.2.1 From a65d49465f32f45cc8152ccfdd0ee4d26c398353 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sat, 9 Apr 2005 01:32:29 +0000 Subject: allow topics within sidebars; no topics within body elements git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3199 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../test_rst/test_directives/test_contents.py | 31 +++++++++++++ .../test_rst/test_directives/test_topics.py | 16 +++---- test/test_transforms/test_contents.py | 51 ++++++++++++++++++++++ 3 files changed, 89 insertions(+), 9 deletions(-) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_directives/test_contents.py b/test/test_parsers/test_rst/test_directives/test_contents.py index 7577152cc..e2b5f29a2 100755 --- a/test/test_parsers/test_rst/test_directives/test_contents.py +++ b/test/test_parsers/test_rst/test_directives/test_contents.py @@ -202,6 +202,37 @@ totest['contents'] = [ .. contents:: :backlinks: """], +["""\ +* .. contents:: +""", +"""\ +<document source="test data"> + <bullet_list bullet="*"> + <list_item> + <system_message level="3" line="1" source="test data" type="ERROR"> + <paragraph> + The "contents" directive may not be used within topics or body elements. + <literal_block xml:space="preserve"> + .. contents:: +"""], +["""\ +.. sidebar:: containing contents + + .. contents:: +""", +"""\ +<document source="test data"> + <sidebar> + <title> + containing contents + <topic classes="contents" ids="contents" names="contents"> + <title> + Contents + <pending> + .. internal attributes: + .transform: docutils.transforms.parts.Contents + .details: +"""], ] diff --git a/test/test_parsers/test_rst/test_directives/test_topics.py b/test/test_parsers/test_rst/test_directives/test_topics.py index fa3d91100..4d0fae27b 100755 --- a/test/test_parsers/test_rst/test_directives/test_topics.py +++ b/test/test_parsers/test_rst/test_directives/test_topics.py @@ -121,7 +121,7 @@ totest['topics'] = [ Title <system_message level="3" line="3" source="test data" type="ERROR"> <paragraph> - The "topic" directive may not be used within topics, sidebars, or body elements. + The "topic" directive may not be used within topics or body elements. <literal_block xml:space="preserve"> .. topic:: Nested \n\ @@ -142,7 +142,7 @@ totest['topics'] = [ Title <system_message level="3" line="3" source="test data" type="ERROR"> <paragraph> - The "topic" directive may not be used within topics, sidebars, or body elements. + The "topic" directive may not be used within topics or body elements. <literal_block xml:space="preserve"> .. topic:: Nested \n\ @@ -171,7 +171,7 @@ More. Title <system_message level="3" line="3" source="test data" type="ERROR"> <paragraph> - The "topic" directive may not be used within topics, sidebars, or body elements. + The "topic" directive may not be used within topics or body elements. <literal_block xml:space="preserve"> .. topic:: Nested \n\ @@ -222,13 +222,11 @@ More. Title <subtitle> Outer - <system_message level="3" line="4" source="test data" type="ERROR"> + <topic> + <title> + Nested <paragraph> - The "topic" directive may not be used within topics, sidebars, or body elements. - <literal_block xml:space="preserve"> - .. topic:: Nested - \n\ - Body. + Body. <paragraph> More. <paragraph> diff --git a/test/test_transforms/test_contents.py b/test/test_transforms/test_contents.py index 95cc098a6..0871aa8f0 100755 --- a/test/test_transforms/test_contents.py +++ b/test/test_transforms/test_contents.py @@ -375,6 +375,57 @@ Degenerate case, no table of contents generated. <paragraph> Degenerate case, no table of contents generated. """], +["""\ +Title 1 +======= + +Paragraph 1. + +.. sidebar:: Contents + + .. contents:: + :local: + +Title 2 +------- +Paragraph 2. + +Title 3 +``````` +Paragraph 3. +""", +"""\ +<document source="test data"> + <section ids="title-1" names="title 1"> + <title> + Title 1 + <paragraph> + Paragraph 1. + <sidebar> + <title> + Contents + <topic classes="contents" ids="contents" names="contents"> + <bullet_list> + <list_item> + <paragraph> + <reference ids="id1" refid="title-2"> + Title 2 + <bullet_list> + <list_item> + <paragraph> + <reference ids="id2" refid="title-3"> + Title 3 + <section ids="title-2" names="title 2"> + <title refid="id1"> + Title 2 + <paragraph> + Paragraph 2. + <section ids="title-3" names="title 3"> + <title refid="id2"> + Title 3 + <paragraph> + Paragraph 3. +"""], ]) -- cgit v1.2.1 From f74332157ab86e93794a4e9566f6737aefa7328d Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Mon, 11 Apr 2005 23:16:11 +0000 Subject: added checks for recursive sidebars git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3206 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../test_rst/test_directives/test_sidebars.py | 73 ++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100755 test/test_parsers/test_rst/test_directives/test_sidebars.py (limited to 'test') diff --git a/test/test_parsers/test_rst/test_directives/test_sidebars.py b/test/test_parsers/test_rst/test_directives/test_sidebars.py new file mode 100755 index 000000000..a84fc248d --- /dev/null +++ b/test/test_parsers/test_rst/test_directives/test_sidebars.py @@ -0,0 +1,73 @@ +#! /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 "sidebar" directive. +""" + +from __init__ import DocutilsTestSupport + +def suite(): + s = DocutilsTestSupport.ParserTestSuite() + s.generateTests(totest) + return s + +totest = {} + +totest['sidebars'] = [ +["""\ +.. sidebar:: Outer + + .. sidebar:: Nested + + Body. +""", +"""\ +<document source="test data"> + <sidebar> + <title> + Outer + <system_message level="3" line="3" source="test data" type="ERROR"> + <paragraph> + The "sidebar" directive may not be used within a sidebar element. + <literal_block xml:space="preserve"> + .. sidebar:: Nested + \n\ + Body. +"""], +["""\ +.. sidebar:: Outer + + .. topic:: Topic + + .. sidebar:: Inner + + text +""", +"""\ +<document source="test data"> + <sidebar> + <title> + Outer + <topic> + <title> + Topic + <system_message level="3" line="5" source="test data" type="ERROR"> + <paragraph> + The "sidebar" directive may not be used within topics or body elements. + <literal_block xml:space="preserve"> + .. sidebar:: Inner + \n\ + text +"""], +] + + +if __name__ == '__main__': + import unittest + unittest.main(defaultTest='suite') -- cgit v1.2.1 From bd559044426b3f80dd1e7cc9b2d3a25c61bb952f Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Thu, 21 Apr 2005 14:52:41 +0000 Subject: "image" directive: added checks for valid values of "align" option, depending on context. "figure" directive: added specialized "align" option and attribute on "figure" element. Added HTML support for ``align`` attribute on ``figure`` elements. Updated docs & tests. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3231 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_html4css1.html | 2 +- test/functional/expected/standalone_rst_pseudoxml.txt | 2 +- test/functional/input/data/standard.txt | 1 + test/test_parsers/test_rst/test_directives/test_figures.py | 13 +++++++++++++ 4 files changed, 16 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index 66879b19f..8ea472629 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -546,7 +546,7 @@ document (a document-wide <a class="reference" href="#table-of-contents">table o <p>An image directive (also clickable -- a hyperlink reference):</p> <div class="image class1 class2 image-reference"><a class="reference" href="#directives"><img alt="../../../docs/user/rst/images/title.png" class="class1 class2" src="../../../docs/user/rst/images/title.png" /></a></div> <p>A figure directive:</p> -<div class="figclass1 figclass2 figure"> +<div align="left" class="figclass1 figclass2 figure"> <div class="image class1 class2"><img alt="reStructuredText, the markup syntax" class="class1 class2" src="../../../docs/user/rst/images/title.png" /></div> <p class="caption">A figure is an image with a caption and/or a legend:</p> <div class="legend"> diff --git a/test/functional/expected/standalone_rst_pseudoxml.txt b/test/functional/expected/standalone_rst_pseudoxml.txt index b4d510854..6fd48b818 100644 --- a/test/functional/expected/standalone_rst_pseudoxml.txt +++ b/test/functional/expected/standalone_rst_pseudoxml.txt @@ -1121,7 +1121,7 @@ <image classes="class1 class2" uri="../../../docs/user/rst/images/title.png"> <paragraph> A figure directive: - <figure classes="figclass1 figclass2"> + <figure align="left" classes="figclass1 figclass2"> <image alt="reStructuredText, the markup syntax" classes="class1 class2" uri="../../../docs/user/rst/images/title.png"> <caption> A figure is an image with a caption and/or a legend: diff --git a/test/functional/input/data/standard.txt b/test/functional/input/data/standard.txt index 092a0ae44..507838b88 100644 --- a/test/functional/input/data/standard.txt +++ b/test/functional/input/data/standard.txt @@ -429,6 +429,7 @@ A figure directive: :figclass: figclass1 figclass2 :class: class1 class2 :alt: reStructuredText, the markup syntax + :align: left A figure is an image with a caption and/or a legend: diff --git a/test/test_parsers/test_rst/test_directives/test_figures.py b/test/test_parsers/test_rst/test_directives/test_figures.py index 821841e07..38c6e821f 100755 --- a/test/test_parsers/test_rst/test_directives/test_figures.py +++ b/test/test_parsers/test_rst/test_directives/test_figures.py @@ -106,6 +106,19 @@ totest['figures'] = [ A picture with image options on individual lines, and this caption. """], ["""\ +.. figure:: picture.png + :align: center + + A figure with explicit alignment. +""", +"""\ +<document source="test data"> + <figure align="center"> + <image uri="picture.png"> + <caption> + A figure with explicit alignment. +"""], +["""\ This figure lacks a caption. It may still have a "Figure 1."-style caption appended in the output. -- cgit v1.2.1 From 45afa3ca4d5aa4932685a91ec8ae15c876335de5 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Thu, 21 Apr 2005 16:20:11 +0000 Subject: added test for targets in front of sections git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3236 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_html4css1.html | 6 +++--- test/functional/expected/standalone_rst_latex.tex | 2 ++ test/functional/expected/standalone_rst_pseudoxml.txt | 7 ++++--- test/functional/input/data/standard.txt | 2 ++ 4 files changed, 11 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index 8ea472629..13f8c02c6 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -493,7 +493,7 @@ rendered separately and differently from footnotes.</td></tr> <p>Here's a reference to the above, <a class="citation-reference" href="#cit2002" id="id15" name="id15">[CIT2002]</a>, and a <a href="#id71" name="id72"><span class="problematic" id="id72">[nonexistent]_</span></a> citation.</p> </div> -<div class="section" id="targets"> +<span id="another-target"></span><div class="section" id="targets"> <h2><a class="toc-backref" href="#id43" name="targets">2.13   Targets</a></h2> <p id="example">This paragraph is pointed to by the explicit "example" target. A reference can be found under <a class="reference" href="#inline-markup">Inline Markup</a>, above. <a class="reference" href="#inline-hyperlink-targets">Inline @@ -915,10 +915,10 @@ Unknown target name: "5".</div> <p class="system-message-title">System Message: <a name="id71">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 361); <em><a href="#id72">backlink</a></em></p> Unknown target name: "nonexistent".</div> <div class="system-message" id="id73"> -<p class="system-message-title">System Message: <a name="id73">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 386); <em><a href="#id74">backlink</a></em></p> +<p class="system-message-title">System Message: <a name="id73">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 388); <em><a href="#id74">backlink</a></em></p> Unknown target name: "hyperlink reference without a target".</div> <div class="system-message" id="id75"> -<p class="system-message-title">System Message: <a name="id75">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 399); <em><a href="#id76">backlink</a></em></p> +<p class="system-message-title">System Message: <a name="id75">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 401); <em><a href="#id76">backlink</a></em></p> Duplicate target name, cannot be used as a unique reference: "duplicate target names".</div> </div> </div> diff --git a/test/functional/expected/standalone_rst_latex.tex b/test/functional/expected/standalone_rst_latex.tex index 32add09e3..5e937878c 100644 --- a/test/functional/expected/standalone_rst_latex.tex +++ b/test/functional/expected/standalone_rst_latex.tex @@ -770,7 +770,9 @@ citation. %___________________________________________________________________________ \hypertarget{targets}{} +\hypertarget{another-target}{} \pdfbookmark[1]{2.13~~~Targets}{targets} +\pdfbookmark[1]{2.13~~~Targets}{another-target} \subsection*{2.13~~~Targets} This paragraph is pointed to by the explicit ``example'' target. A diff --git a/test/functional/expected/standalone_rst_pseudoxml.txt b/test/functional/expected/standalone_rst_pseudoxml.txt index 6fd48b818..d647b11a8 100644 --- a/test/functional/expected/standalone_rst_pseudoxml.txt +++ b/test/functional/expected/standalone_rst_pseudoxml.txt @@ -969,7 +969,8 @@ [nonexistent]_ citation. - <section ids="targets" names="targets"> + <target refid="another-target"> + <section ids="targets another-target" names="targets another target"> <title auto="1" refid="id43"> <generated classes="sectnum"> 2.13    @@ -1692,9 +1693,9 @@ <system_message backrefs="id72" ids="id71" level="3" line="361" source="functional/input/data/standard.txt" type="ERROR"> <paragraph> Unknown target name: "nonexistent". - <system_message backrefs="id74" ids="id73" level="3" line="386" source="functional/input/data/standard.txt" type="ERROR"> + <system_message backrefs="id74" ids="id73" level="3" line="388" source="functional/input/data/standard.txt" type="ERROR"> <paragraph> Unknown target name: "hyperlink reference without a target". - <system_message backrefs="id76" ids="id75" level="3" line="399" source="functional/input/data/standard.txt" type="ERROR"> + <system_message backrefs="id76" ids="id75" level="3" line="401" source="functional/input/data/standard.txt" type="ERROR"> <paragraph> Duplicate target name, cannot be used as a unique reference: "duplicate target names". diff --git a/test/functional/input/data/standard.txt b/test/functional/input/data/standard.txt index 507838b88..7019df74a 100644 --- a/test/functional/input/data/standard.txt +++ b/test/functional/input/data/standard.txt @@ -359,6 +359,8 @@ Citations Here's a reference to the above, [CIT2002]_, and a [nonexistent]_ citation. +.. _Another Target: + Targets ------- -- cgit v1.2.1 From 09d3cf06d997a37f1b173e050daa2577009f3c5d Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Thu, 21 Apr 2005 17:46:08 +0000 Subject: added (more) tests for :align: option of image and figure directives git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3237 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../test_rst/test_directives/test_figures.py | 19 +++++++++ .../test_rst/test_directives/test_images.py | 49 ++++++++++++++++++++++ 2 files changed, 68 insertions(+) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_directives/test_figures.py b/test/test_parsers/test_rst/test_directives/test_figures.py index 38c6e821f..cdc95a2e3 100755 --- a/test/test_parsers/test_rst/test_directives/test_figures.py +++ b/test/test_parsers/test_rst/test_directives/test_figures.py @@ -119,6 +119,25 @@ totest['figures'] = [ A figure with explicit alignment. """], ["""\ +.. figure:: picture.png + :align: top + + A figure with wrong alignment. +""", +"""\ +<document source="<stdin>"> + <system_message level="3" line="1" source="<stdin>" type="ERROR"> + <paragraph> + Error in "figure" directive: + invalid option value: (option: "align"; value: u'top') + "top" unknown; choose from "left", "center", or "right". + <literal_block xml:space="preserve"> + .. figure:: picture.png + :align: top + + A figure with wrong alignment. +"""], +["""\ This figure lacks a caption. It may still have a "Figure 1."-style caption appended in the output. diff --git a/test/test_parsers/test_rst/test_directives/test_images.py b/test/test_parsers/test_rst/test_directives/test_images.py index 256f2e00f..6d016a82d 100755 --- a/test/test_parsers/test_rst/test_directives/test_images.py +++ b/test/test_parsers/test_rst/test_directives/test_images.py @@ -293,6 +293,55 @@ totest['images'] = [ .. image:: picture.png :target: """], +["""\ +.. image:: picture.png + :align: left +""", +"""\ +<document source="test data"> + <image align="left" uri="picture.png"> +"""], +["""\ +.. image:: picture.png + :align: top +""", +"""\ +<document source="test data"> + <system_message level="3" line="1" source="test data" type="ERROR"> + <paragraph> + Error in "image" directive: "top" is not a valid value for the "align" option. Valid values for "align" are: "left", "center", "right". + <literal_block xml:space="preserve"> + .. image:: picture.png + :align: top +"""], +["""\ +.. |img| image:: picture.png + :align: top +""", +"""\ +<document source="test data"> + <substitution_definition names="img"> + <image align="top" alt="img" uri="picture.png"> +"""], +["""\ +.. |img| image:: picture.png + :align: left +""", +"""\ +<document source="test data"> + <system_message level="3" line="1" source="test data" type="ERROR"> + <paragraph> + Error in "image" directive: "left" is not a valid value for the "align" option within a substitution definition. Valid values for "align" are: "top", "middle", "bottom". + <literal_block xml:space="preserve"> + image:: picture.png + :align: left + <system_message level="2" line="1" source="test data" type="WARNING"> + <paragraph> + Substitution definition "img" empty or invalid. + <literal_block xml:space="preserve"> + .. |img| image:: picture.png + :align: left +"""], ] -- cgit v1.2.1 From 306200306bd41a9104d23d9a95f1512d6c9c0685 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Thu, 21 Apr 2005 20:43:53 +0000 Subject: fixed error in test code git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3240 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_parsers/test_rst/test_directives/test_figures.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_directives/test_figures.py b/test/test_parsers/test_rst/test_directives/test_figures.py index cdc95a2e3..91fd91596 100755 --- a/test/test_parsers/test_rst/test_directives/test_figures.py +++ b/test/test_parsers/test_rst/test_directives/test_figures.py @@ -125,11 +125,11 @@ totest['figures'] = [ A figure with wrong alignment. """, """\ -<document source="<stdin>"> - <system_message level="3" line="1" source="<stdin>" type="ERROR"> +<document source="test data"> + <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Error in "figure" directive: - invalid option value: (option: "align"; value: u'top') + invalid option value: (option: "align"; value: 'top') "top" unknown; choose from "left", "center", or "right". <literal_block xml:space="preserve"> .. figure:: picture.png -- cgit v1.2.1 From 18bd99c8f3343501694e159080192f47eb16c34c Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Fri, 22 Apr 2005 23:57:18 +0000 Subject: Added "cloak_email_addresses" setting & support; updated test & docs. Thanks to Barry Warsaw & Ned Batchelder for the idea and initial patch. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3243 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/pep_html.html | 29 +++++++++++++++++++++++------ test/functional/input/pep_html.txt | 11 ++++++++++- test/functional/tests/pep_html.py | 1 + 3 files changed, 34 insertions(+), 7 deletions(-) (limited to 'test') diff --git a/test/functional/expected/pep_html.html b/test/functional/expected/pep_html.html index 6e990e61a..00d7d1d2b 100644 --- a/test/functional/expected/pep_html.html +++ b/test/functional/expected/pep_html.html @@ -38,7 +38,7 @@ to templates. DO NOT USE THIS HTML FILE AS YOUR TEMPLATE! </tr> <tr class="field"><th class="field-name">Author:</th><td class="field-body">John Doe <john at example.org></td> </tr> -<tr class="field"><th class="field-name">Discussions-To:</th><td class="field-body"><<a class="reference" href="mailto:devnull@example.org?subject=PEP%20100">devnull at example.org</a>></td> +<tr class="field"><th class="field-name">Discussions-To:</th><td class="field-body"><<a class="reference" href="mailto:%64%65%76%6E%75%6C%6C%40%65%78%61%6D%70%6C%65%2E%6F%72%67?subject=PEP%20100">devnull at example.org</a>></td> </tr> <tr class="field"><th class="field-name">Status:</th><td class="field-body">Draft</td> </tr> @@ -56,18 +56,35 @@ to templates. DO NOT USE THIS HTML FILE AS YOUR TEMPLATE! <div class="contents topic" id="contents"> <p class="topic-title first"><a name="contents">Contents</a></p> <ul class="simple"> -<li><a class="reference" href="#abstract" id="id2" name="id2">Abstract</a></li> -<li><a class="reference" href="#copyright" id="id3" name="id3">Copyright</a></li> +<li><a class="reference" href="#abstract" id="id5" name="id5">Abstract</a></li> +<li><a class="reference" href="#copyright" id="id6" name="id6">Copyright</a></li> +<li><a class="reference" href="#references-and-footnotes" id="id7" name="id7">References and Footnotes</a></li> </ul> </div> <div class="section" id="abstract"> -<h1><a class="toc-backref" href="#id2" name="abstract">Abstract</a></h1> -<p>Just a test.</p> +<h1><a class="toc-backref" href="#id5" name="abstract">Abstract</a></h1> +<p>This is just a test <a class="footnote-reference" href="#id2" id="id1" name="id1">[1]</a>. See the <a class="reference" href="http://www.python.org/peps/">PEP repository</a> <a class="footnote-reference" href="#id3" id="id4" name="id4">[2]</a> for the real +thing.</p> </div> <div class="section" id="copyright"> -<h1><a class="toc-backref" href="#id3" name="copyright">Copyright</a></h1> +<h1><a class="toc-backref" href="#id6" name="copyright">Copyright</a></h1> <p>This document has been placed in the public domain.</p> </div> +<div class="section" id="references-and-footnotes"> +<h1><a class="toc-backref" href="#id7" name="references-and-footnotes">References and Footnotes</a></h1> +<table class="docutils footnote" frame="void" id="id2" rules="none"> +<colgroup><col class="label" /><col /></colgroup> +<tbody valign="top"> +<tr><td class="label"><a class="fn-backref" href="#id1" name="id2">[1]</a></td><td>PEP editors: <a class="reference" href="mailto:%70%65%70%73%40%70%79%74%68%6F%6E%2E%6F%72%67">peps at python dot org</a></td></tr> +</tbody> +</table> +<table class="docutils footnote" frame="void" id="id3" rules="none"> +<colgroup><col class="label" /><col /></colgroup> +<tbody valign="top"> +<tr><td class="label"><a class="fn-backref" href="#id4" name="id3">[2]</a></td><td><a class="reference" href="http://www.python.org/peps/">http://www.python.org/peps/</a></td></tr> +</tbody> +</table> +</div> </div> </body> diff --git a/test/functional/input/pep_html.txt b/test/functional/input/pep_html.txt index 5cca3726e..483077131 100644 --- a/test/functional/input/pep_html.txt +++ b/test/functional/input/pep_html.txt @@ -14,10 +14,19 @@ Post-History: 13-Jun-2001 Abstract ======== -Just a test. +This is just a test [#]_. See the `PEP repository`_ for the real +thing. + +.. _PEP repository: http://www.python.org/peps/ Copyright ========= This document has been placed in the public domain. + + +References and Footnotes +======================== + +.. [#] PEP editors: peps@python.org diff --git a/test/functional/tests/pep_html.py b/test/functional/tests/pep_html.py index 47e8b52d3..efb067ac4 100644 --- a/test/functional/tests/pep_html.py +++ b/test/functional/tests/pep_html.py @@ -14,3 +14,4 @@ settings_overrides['template'] = "../tools/pep-html-template" settings_overrides['python_home'] = "http://www.python.org" settings_overrides['pep_home'] = "http://www.python.org/peps" settings_overrides['no_random'] = 1 +settings_overrides['cloak_email_addresses'] = 1 -- cgit v1.2.1 From edc53d064c0242cf29ca1c683f52794132a48ded Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sun, 24 Apr 2005 03:02:10 +0000 Subject: fixed typo git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3249 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/DocutilsTestSupport.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/DocutilsTestSupport.py b/test/DocutilsTestSupport.py index e3764adfb..9c09792ae 100644 --- a/test/DocutilsTestSupport.py +++ b/test/DocutilsTestSupport.py @@ -807,7 +807,7 @@ def _format_str(*args): r = r[1:] # quote_char = "'" or '"' quote_char = r[0] - assert quote_char in ("'", "'") + assert quote_char in ("'", '"') assert r[0] == r[-1] r = r[1:-1] r = (stripped + 3 * quote_char + '\\\n' + -- cgit v1.2.1 From 03da26f3c9d0d99ea4afd99cf5330fe307ce3bb3 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sun, 24 Apr 2005 23:21:48 +0000 Subject: Added ``html_body``, ``html_title``, & ``html_subtitle`` to HTML writer parts dictionary exposed by ``docutils.core.publish_parts``; updated tests. Added "``publish_parts`` Details" section to docs/api/publish.txt. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3251 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/DocutilsTestSupport.py | 1 + test/test_writers/test_html4css1.py | 129 +++++++++++++++++++++++++++++------- 2 files changed, 106 insertions(+), 24 deletions(-) (limited to 'test') diff --git a/test/DocutilsTestSupport.py b/test/DocutilsTestSupport.py index 9c09792ae..40ac89c4f 100644 --- a/test/DocutilsTestSupport.py +++ b/test/DocutilsTestSupport.py @@ -742,6 +742,7 @@ class HtmlWriterPublishPartsTestCase(WriterPublishTestCase): """Minimize & standardize the output.""" # remove redundant bits: del parts['whole'] + assert parts['body'] == parts['fragment'] del parts['body'] # remove standard bits: parts['meta'] = parts['meta'].replace(self.standard_meta_value, '') diff --git a/test/test_writers/test_html4css1.py b/test/test_writers/test_html4css1.py index 142465994..d93997a2d 100755 --- a/test/test_writers/test_html4css1.py +++ b/test/test_writers/test_html4css1.py @@ -29,30 +29,39 @@ totest['Title promotion'] = ({}, [ Simple String """, """\ -{'fragment': '''<p>Simple String</p>\\n'''} -""" -], +{'fragment': '''<p>Simple String</p>\\n''', + 'html_body': '''<div class="document"> +<p>Simple String</p> +</div>\\n'''} +"""], ["""\ Simple String with *markup* """, """\ -{'fragment': '''<p>Simple String with <em>markup</em></p>\\n'''} -""" -], +{'fragment': '''<p>Simple String with <em>markup</em></p>\\n''', + 'html_body': '''<div class="document"> +<p>Simple String with <em>markup</em></p> +</div>\\n'''} +"""], ["""\ Simple String with an even simpler ``inline literal`` """, """\ -{'fragment': '''<p>Simple String with an even simpler <tt class="docutils literal"><span class="pre">inline</span> <span class="pre">literal</span></tt></p>\\n'''} -""" -], +{'fragment': '''<p>Simple String with an even simpler <tt class="docutils literal"><span class="pre">inline</span> <span class="pre">literal</span></tt></p>\\n''', + 'html_body': '''<div class="document"> +<p>Simple String with an even simpler <tt class="docutils literal"><span class="pre">inline</span> <span class="pre">literal</span></tt></p> +</div>\\n'''} +"""], ["""\ A simple `anonymous reference`__ __ http://www.test.com/test_url """, """\ -{'fragment': '''<p>A simple <a class="reference" href="http://www.test.com/test_url">anonymous reference</a></p>\\n'''} +{'fragment': '''<p>A simple <a class="reference" href="http://www.test.com/test_url">anonymous reference</a></p>\\n''', + 'html_body': '''<div class="document"> +<p>A simple <a class="reference" href="http://www.test.com/test_url">anonymous reference</a></p> +</div>\\n'''} """], ["""\ One paragraph. @@ -61,7 +70,11 @@ Two paragraphs. """, """\ {'fragment': '''<p>One paragraph.</p> -<p>Two paragraphs.</p>\\n'''} +<p>Two paragraphs.</p>\\n''', + 'html_body': '''<div class="document"> +<p>One paragraph.</p> +<p>Two paragraphs.</p> +</div>\\n'''} """], ["""\ A simple `named reference`_ with stuff in between the @@ -71,7 +84,11 @@ reference and the target. """, """\ {'fragment': '''<p>A simple <a class="reference" href="http://www.test.com/test_url">named reference</a> with stuff in between the -reference and the target.</p>\\n'''} +reference and the target.</p>\\n''', + 'html_body': '''<div class="document"> +<p>A simple <a class="reference" href="http://www.test.com/test_url">named reference</a> with stuff in between the +reference and the target.</p> +</div>\\n'''} """], ["""\ +++++ @@ -103,6 +120,21 @@ And even more stuff <p>And even more stuff</p> </div> </div>\\n''', + 'html_body': '''<div class="document" id="title"> +<h1 class="title">Title</h1> +<h2 class="subtitle" id="subtitle">Subtitle</h2> +<p>Some stuff</p> +<div class="section" id="section"> +<h1><a name="section">Section</a></h1> +<p>Some more stuff</p> +<div class="section" id="another-section"> +<h2><a name="another-section">Another Section</a></h2> +<p>And even more stuff</p> +</div> +</div> +</div>\\n''', + 'html_subtitle': '''<h2 class="subtitle" id="subtitle">Subtitle</h2>\\n''', + 'html_title': '''<h1 class="title">Title</h1>\\n''', 'subtitle': '''Subtitle''', 'title': '''Title'''} """], @@ -125,6 +157,19 @@ Some stuff </tbody> </table>\\n''', 'fragment': '''<p>Some stuff</p>\\n''', + 'html_body': '''<div class="document" id="title"> +<h1 class="title">Title</h1> +<table class="docinfo" frame="void" rules="none"> +<col class="docinfo-name" /> +<col class="docinfo-content" /> +<tbody valign="top"> +<tr><th class="docinfo-name">Author:</th> +<td>me</td></tr> +</tbody> +</table> +<p>Some stuff</p> +</div>\\n''', + 'html_title': '''<h1 class="title">Title</h1>\\n''', 'meta': '''<meta name="author" content="me" />\\n''', 'title': '''Title'''} """] @@ -135,30 +180,39 @@ totest['No title promotion'] = ({'doctitle_xform' : 0}, [ Simple String """, """\ -{'fragment': '''<p>Simple String</p>\\n'''} -""" -], +{'fragment': '''<p>Simple String</p>\\n''', + 'html_body': '''<div class="document"> +<p>Simple String</p> +</div>\\n'''} +"""], ["""\ Simple String with *markup* """, """\ -{'fragment': '''<p>Simple String with <em>markup</em></p>\\n'''} -""" -], +{'fragment': '''<p>Simple String with <em>markup</em></p>\\n''', + 'html_body': '''<div class="document"> +<p>Simple String with <em>markup</em></p> +</div>\\n'''} +"""], ["""\ Simple String with an even simpler ``inline literal`` """, """\ -{'fragment': '''<p>Simple String with an even simpler <tt class="docutils literal"><span class="pre">inline</span> <span class="pre">literal</span></tt></p>\\n'''} -""" -], +{'fragment': '''<p>Simple String with an even simpler <tt class="docutils literal"><span class="pre">inline</span> <span class="pre">literal</span></tt></p>\\n''', + 'html_body': '''<div class="document"> +<p>Simple String with an even simpler <tt class="docutils literal"><span class="pre">inline</span> <span class="pre">literal</span></tt></p> +</div>\\n'''} +"""], ["""\ A simple `anonymous reference`__ __ http://www.test.com/test_url """, """\ -{'fragment': '''<p>A simple <a class="reference" href="http://www.test.com/test_url">anonymous reference</a></p>\\n'''} +{'fragment': '''<p>A simple <a class="reference" href="http://www.test.com/test_url">anonymous reference</a></p>\\n''', + 'html_body': '''<div class="document"> +<p>A simple <a class="reference" href="http://www.test.com/test_url">anonymous reference</a></p> +</div>\\n'''} """], ["""\ A simple `named reference`_ with stuff in between the @@ -168,7 +222,11 @@ reference and the target. """, """\ {'fragment': '''<p>A simple <a class="reference" href="http://www.test.com/test_url">named reference</a> with stuff in between the -reference and the target.</p>\\n'''} +reference and the target.</p>\\n''', + 'html_body': '''<div class="document"> +<p>A simple <a class="reference" href="http://www.test.com/test_url">named reference</a> with stuff in between the +reference and the target.</p> +</div>\\n'''} """], ["""\ +++++ @@ -205,6 +263,23 @@ And even more stuff </div> </div> </div> +</div>\\n''', + 'html_body': '''<div class="document"> +<div class="section" id="title"> +<h1><a name="title">Title</a></h1> +<div class="section" id="not-a-subtitle"> +<h2><a name="not-a-subtitle">Not A Subtitle</a></h2> +<p>Some stuff</p> +<div class="section" id="section"> +<h3><a name="section">Section</a></h3> +<p>Some more stuff</p> +<div class="section" id="another-section"> +<h4><a name="another-section">Another Section</a></h4> +<p>And even more stuff</p> +</div> +</div> +</div> +</div> </div>\\n'''} """], ["""\ @@ -215,7 +290,13 @@ And even more stuff {'fragment': '''<ul class="simple"> <li>bullet</li> <li>list</li> -</ul>\\n'''} +</ul>\\n''', + 'html_body': '''<div class="document"> +<ul class="simple"> +<li>bullet</li> +<li>list</li> +</ul> +</div>\\n'''} """], ]) -- cgit v1.2.1 From 3da860aec26788ffd148bdbbedeee98b53a1436a Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Mon, 25 Apr 2005 15:08:01 +0000 Subject: str(Exception) doesn't work for anything but ASCII Exception texts, so '%s' % exception_instance is unsafe unless exception_instance.args contains only byte strings. The change in alltests.py is a first attempt to catch such cases where a str(Exception) is done with an Exception text which is not necessarily ASCII-only (i.e. with a unicode string in Exception.args), but since most input data (in the totest dicts) is passed in as byte strings, it doesn't catch much. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3253 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/alltests.py | 11 +++++++++++ test/test_parsers/test_rst/test_directives/test_images.py | 15 +++++++++++++++ 2 files changed, 26 insertions(+) (limited to 'test') diff --git a/test/alltests.py b/test/alltests.py index ee73f0376..4092d38a6 100755 --- a/test/alltests.py +++ b/test/alltests.py @@ -21,9 +21,20 @@ start = time.time() import sys import os +from types import UnicodeType import docutils +def new_exception_str(self): + for i in self.args: + if isinstance(i, UnicodeType): + raise RuntimeError('Error (unicode): %r' % (self.args,)) + return old_exception_str(self) + +old_exception_str = Exception.__str__ +Exception.__str__ = new_exception_str + + class Tee: """Write to a file and a stream (default: stdout) simultaneously.""" diff --git a/test/test_parsers/test_rst/test_directives/test_images.py b/test/test_parsers/test_rst/test_directives/test_images.py index 6d016a82d..b35cab355 100755 --- a/test/test_parsers/test_rst/test_directives/test_images.py +++ b/test/test_parsers/test_rst/test_directives/test_images.py @@ -342,6 +342,21 @@ totest['images'] = [ .. |img| image:: picture.png :align: left """], +[u"""\ +.. image:: picture.png + :align: \xe4 +""", +u"""\ +<document source="test data"> + <system_message level="3" line="1" source="test data" type="ERROR"> + <paragraph> + Error in "image" directive: + invalid option value: (option: "align"; value: u\'\\xe4\') + "\xe4" unknown; choose from "top", "middle", "bottom", "left", "center", or "right". + <literal_block xml:space="preserve"> + .. image:: picture.png + :align: \xe4 +"""], ] -- cgit v1.2.1 From df86c29341bb830c87ee468323c1e3afa9d32a03 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Tue, 26 Apr 2005 03:57:00 +0000 Subject: Added ``html_prolog`` & ``html_head`` to HTML writer parts dictionary exposed by ``docutils.core.publish_parts``; updated tests & docs. At the request of Marcelo Huerta. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3257 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/DocutilsTestSupport.py | 13 ++++++++++-- test/test_writers/test_html4css1.py | 42 +++++++++++++++++++++++++------------ 2 files changed, 40 insertions(+), 15 deletions(-) (limited to 'test') diff --git a/test/DocutilsTestSupport.py b/test/DocutilsTestSupport.py index 40ac89c4f..87a200598 100644 --- a/test/DocutilsTestSupport.py +++ b/test/DocutilsTestSupport.py @@ -731,12 +731,17 @@ class HtmlWriterPublishPartsTestCase(WriterPublishTestCase): expected = self.expected % {'version': docutils.__version__} self.compare_output(self.input, output, expected) - standard_meta_value = """\ + standard_meta_value_template = """\ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="generator" content="Docutils %s: http://docutils.sourceforge.net/" /> -""" % docutils.__version__ +""" + standard_meta_value = standard_meta_value_template % docutils.__version__ standard_stylesheet_value = ('<link rel="stylesheet" href="default.css" ' 'type="text/css" />\n') + standard_html_prolog = """\ +<?xml version="1.0" encoding="%s" ?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +""" def format_output(self, parts): """Minimize & standardize the output.""" @@ -748,6 +753,10 @@ class HtmlWriterPublishPartsTestCase(WriterPublishTestCase): parts['meta'] = parts['meta'].replace(self.standard_meta_value, '') if parts['stylesheet'] == self.standard_stylesheet_value: del parts['stylesheet'] + parts['html_head'] = parts['html_head'].replace( + self.standard_meta_value, '...') + parts['html_prolog'] = parts['html_prolog'].replace( + self.standard_html_prolog, '') # remove empty values: for key in parts.keys(): if not parts[key]: diff --git a/test/test_writers/test_html4css1.py b/test/test_writers/test_html4css1.py index d93997a2d..70d3be772 100755 --- a/test/test_writers/test_html4css1.py +++ b/test/test_writers/test_html4css1.py @@ -32,7 +32,8 @@ Simple String {'fragment': '''<p>Simple String</p>\\n''', 'html_body': '''<div class="document"> <p>Simple String</p> -</div>\\n'''} +</div>\\n''', + 'html_head': '''...<title>\\n'''} """], ["""\ Simple String with *markup* @@ -41,7 +42,8 @@ Simple String with *markup* {'fragment': '''

    Simple String with markup

    \\n''', 'html_body': '''

    Simple String with markup

    -
    \\n'''} +
    \\n''', + 'html_head': '''...\\n'''} """], ["""\ Simple String with an even simpler ``inline literal`` @@ -50,7 +52,8 @@ Simple String with an even simpler ``inline literal`` {'fragment': '''

    Simple String with an even simpler inline literal

    \\n''', 'html_body': '''

    Simple String with an even simpler inline literal

    -
    \\n'''} +
    \\n''', + 'html_head': '''...\\n'''} """], ["""\ A simple `anonymous reference`__ @@ -61,7 +64,8 @@ __ http://www.test.com/test_url {'fragment': '''

    A simple anonymous reference

    \\n''', 'html_body': '''\\n'''} +
    \\n''', + 'html_head': '''...\\n'''} """], ["""\ One paragraph. @@ -74,7 +78,8 @@ Two paragraphs. 'html_body': '''

    One paragraph.

    Two paragraphs.

    -
    \\n'''} +
    \\n''', + 'html_head': '''...\\n'''} """], ["""\ A simple `named reference`_ with stuff in between the @@ -88,7 +93,8 @@ reference and the target.

    \\n''', 'html_body': '''

    A simple named reference with stuff in between the reference and the target.

    -
    \\n'''} +
    \\n''', + 'html_head': '''...\\n'''} """], ["""\ +++++ @@ -133,6 +139,7 @@ And even more stuff
    \\n''', + 'html_head': '''...Title\\n''', 'html_subtitle': '''

    Subtitle

    \\n''', 'html_title': '''

    Title

    \\n''', 'subtitle': '''Subtitle''', @@ -169,6 +176,8 @@ Some stuff

    Some stuff

    \\n''', + 'html_head': '''...Title +\\n''', 'html_title': '''

    Title

    \\n''', 'meta': '''\\n''', 'title': '''Title'''} @@ -183,7 +192,8 @@ Simple String {'fragment': '''

    Simple String

    \\n''', 'html_body': '''

    Simple String

    -
    \\n'''} +\\n''', + 'html_head': '''...\\n'''} """], ["""\ Simple String with *markup* @@ -192,7 +202,8 @@ Simple String with *markup* {'fragment': '''

    Simple String with markup

    \\n''', 'html_body': '''

    Simple String with markup

    -
    \\n'''} +\\n''', + 'html_head': '''...\\n'''} """], ["""\ Simple String with an even simpler ``inline literal`` @@ -201,7 +212,8 @@ Simple String with an even simpler ``inline literal`` {'fragment': '''

    Simple String with an even simpler inline literal

    \\n''', 'html_body': '''

    Simple String with an even simpler inline literal

    -
    \\n'''} +\\n''', + 'html_head': '''...\\n'''} """], ["""\ A simple `anonymous reference`__ @@ -212,7 +224,8 @@ __ http://www.test.com/test_url {'fragment': '''

    A simple anonymous reference

    \\n''', 'html_body': '''\\n'''} +\\n''', + 'html_head': '''...\\n'''} """], ["""\ A simple `named reference`_ with stuff in between the @@ -226,7 +239,8 @@ reference and the target.

    \\n''', 'html_body': '''

    A simple named reference with stuff in between the reference and the target.

    -
    \\n'''} +\\n''', + 'html_head': '''...\\n'''} """], ["""\ +++++ @@ -280,7 +294,8 @@ And even more stuff -\\n'''} +\\n''', + 'html_head': '''...\\n'''} """], ["""\ * bullet @@ -296,7 +311,8 @@ And even more stuff
  • bullet
  • list
  • -\\n'''} +\\n''', + 'html_head': '''...\\n'''} """], ]) -- cgit v1.2.1 From 2ed86e77045d1f2ae058c69e23c50a245330c1ec Mon Sep 17 00:00:00 2001 From: wiemann Date: Wed, 27 Apr 2005 11:44:59 +0000 Subject: added target at end of admonition git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3261 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_html4css1.html | 2 +- test/functional/expected/standalone_rst_pseudoxml.txt | 1 + test/functional/input/data/standard.txt | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index 13f8c02c6..e4067e2eb 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -617,7 +617,7 @@ Reader discretion is strongly advised.

    And, by the way...

    -

    You can make up your own admonition too.

    +

    You can make up your own admonition too.

    diff --git a/test/functional/expected/standalone_rst_pseudoxml.txt b/test/functional/expected/standalone_rst_pseudoxml.txt index d647b11a8..597408d23 100644 --- a/test/functional/expected/standalone_rst_pseudoxml.txt +++ b/test/functional/expected/standalone_rst_pseudoxml.txt @@ -1204,6 +1204,7 @@ And, by the way... You can make up your own admonition too. +
    <generated classes="sectnum"> diff --git a/test/functional/input/data/standard.txt b/test/functional/input/data/standard.txt index 7019df74a..b06a158d4 100644 --- a/test/functional/input/data/standard.txt +++ b/test/functional/input/data/standard.txt @@ -477,6 +477,8 @@ Admonitions You can make up your own admonition too. + .. _Docutils: http://docutils.sourceforge.net/ + Topics, Sidebars, and Rubrics ````````````````````````````` -- cgit v1.2.1 From ae9d340239b7bc97b08f3e0397a6c31ce0bc3919 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Wed, 27 Apr 2005 11:50:29 +0000 Subject: do not add first/last class to invisible elements git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3262 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_html4css1.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index e4067e2eb..13f8c02c6 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -617,7 +617,7 @@ Reader discretion is strongly advised.</p> </div> <div class="admonition-and-by-the-way admonition"> <p class="first admonition-title">And, by the way...</p> -<p>You can make up your own admonition too.</p> +<p class="last">You can make up your own admonition too.</p> </div> </div> <div class="section" id="topics-sidebars-and-rubrics"> -- cgit v1.2.1 From 8b0a779861f10ccfe3214975d38df595a5aa0dd0 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Wed, 27 Apr 2005 17:43:05 +0000 Subject: testing git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3266 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/svn | 1 + 1 file changed, 1 insertion(+) create mode 100644 test/svn (limited to 'test') diff --git a/test/svn b/test/svn new file mode 100644 index 000000000..e5ed7a988 --- /dev/null +++ b/test/svn @@ -0,0 +1 @@ +Testing whether check-in mails work when sent directly to SourceForge. -- cgit v1.2.1 From b5cedba871fd97228585a6d6484fc8363a45e07c Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Wed, 27 Apr 2005 17:51:01 +0000 Subject: Yes, it works. So now check-in mails are no longer sent via a forwarder at GMX but they are sent directly from BerliOS to SF.net; thanks to the SF.net people; the original support request was at <https://sourceforge.net/tracker/?func=detail&atid=200001&aid=1168447&group_id=1>. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3267 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/svn | 1 - 1 file changed, 1 deletion(-) delete mode 100644 test/svn (limited to 'test') diff --git a/test/svn b/test/svn deleted file mode 100644 index e5ed7a988..000000000 --- a/test/svn +++ /dev/null @@ -1 +0,0 @@ -Testing whether check-in mails work when sent directly to SourceForge. -- cgit v1.2.1 From ce727c88d8d89f9f86275c0d3fca3ae2be392cec Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Wed, 27 Apr 2005 21:04:03 +0000 Subject: fixed encoding/charset values in "html_prolog" & "html_head" parts, which should not have been interpolated git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3268 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/DocutilsTestSupport.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'test') diff --git a/test/DocutilsTestSupport.py b/test/DocutilsTestSupport.py index 87a200598..d9f78f774 100644 --- a/test/DocutilsTestSupport.py +++ b/test/DocutilsTestSupport.py @@ -731,11 +731,16 @@ class HtmlWriterPublishPartsTestCase(WriterPublishTestCase): expected = self.expected % {'version': docutils.__version__} self.compare_output(self.input, output, expected) - standard_meta_value_template = """\ -<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> -<meta name="generator" content="Docutils %s: http://docutils.sourceforge.net/" /> -""" - standard_meta_value = standard_meta_value_template % docutils.__version__ + + standard_content_type_template = ('<meta http-equiv="Content-Type"' + ' content="text/html; charset=%s" />\n') + standard_generator_template = ( + '<meta name="generator"' + ' content="Docutils %s: http://docutils.sourceforge.net/" />\n') + standard_html_meta_value = ( + standard_content_type_template + + standard_generator_template % docutils.__version__) + standard_meta_value = standard_html_meta_value % 'utf-8' standard_stylesheet_value = ('<link rel="stylesheet" href="default.css" ' 'type="text/css" />\n') standard_html_prolog = """\ @@ -745,16 +750,16 @@ class HtmlWriterPublishPartsTestCase(WriterPublishTestCase): def format_output(self, parts): """Minimize & standardize the output.""" - # remove redundant bits: + # remove redundant parts: del parts['whole'] assert parts['body'] == parts['fragment'] del parts['body'] - # remove standard bits: + # remove standard portions: parts['meta'] = parts['meta'].replace(self.standard_meta_value, '') if parts['stylesheet'] == self.standard_stylesheet_value: del parts['stylesheet'] parts['html_head'] = parts['html_head'].replace( - self.standard_meta_value, '...') + self.standard_html_meta_value, '...') parts['html_prolog'] = parts['html_prolog'].replace( self.standard_html_prolog, '') # remove empty values: -- cgit v1.2.1 From 8bdafc4194c3b1afa95ca4172878fa15247cb8e4 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Fri, 29 Apr 2005 23:51:01 +0000 Subject: added some tests for the new latex writer git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3271 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/input/data/latex.txt | 104 +++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 test/functional/input/data/latex.txt (limited to 'test') diff --git a/test/functional/input/data/latex.txt b/test/functional/input/data/latex.txt new file mode 100644 index 000000000..31e57c85d --- /dev/null +++ b/test/functional/input/data/latex.txt @@ -0,0 +1,104 @@ +Some Tests for the LaTeX Writer +=============================== + +These tests have been written to exercise some unusual combinations of +syntax elements which may cause trouble for the LaTeX writer but do +not need to be tested with other writers (e.g. the HTML writer). + +This file is not yet used by any automated test. It is currently only +used to control the visual appearance of the output. + + +Block Quotes +------------ + + This block quote comes directly after the section heading and is + followed by a paragraph. + + This is the second paragraph of the block quote and it contains + some more text filling up some space which would otherwise be + empty. + + -- Attribution + +This is a paragraph. + + This block quote does not have an attribution. + +This is another paragraph. + + Another block quote at the end of the section. + + +More Block Quotes +----------------- + + Block quote followed by a transition. + +---------- + + Another block quote. + + +Sidebars +-------- + +This paragraph precedes the sidebar. This is some text. This is some +text. This is some text. This is some text. This is some text. +This is some text. This is some text. This is some text. + +.. sidebar:: Sidebar Title + + These are the sidebar contents. These are the sidebar contents. + + These are the sidebar contents. These are the sidebar contents. + + These are the sidebar contents. These are the sidebar contents. + These are the sidebar contents. These are the sidebar contents. + +This paragraph follows the sidebar. This is some text. This is some +text. This is some text. + +This is some text. This is some text. This is some text. This is +some text. This is some text. This is some text. This is some text. +This is some text. This is some text. This is some text. This is +some text. This is some text. This is some text. This is some text. +This is some text. This is some text. This is some text. This is +some text. This is some text. This is some text. This is some text. +This is some text. This is some text. This is some text. This is +some text. This is some text. + + +Next Section +------------ + +This section comes after the sidebar, and this text should float +around the sidebar as well. This is some text. This is some text. +This is some text. This is some text. This is some text. This is +some text. This is some text. This is some text. This is some text. +This is some text. This is some text. This is some text. This is +some text. This is some text. + + +Nested Elements +--------------- + +:Field list: | Line + | Block +:Another field: * Bullet + * list + +* * * * * * * * Deeply nested list. + +1. 2. 3. 4. 5. 6. 7. 8. Deeply nested list. + ++---------------+ +| | Line block | +| | +| * Bullet list | +| | +| :: | +| | +| Literal | +| block | ++---------------+ -- cgit v1.2.1 From 0614aa5b89346e821552f758d3eb6ef586b572ab Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Fri, 29 Apr 2005 23:54:25 +0000 Subject: added test file for new LaTeX writer including everything than can be tested git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3272 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/input/standalone_rst_newlatex.txt | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 test/functional/input/standalone_rst_newlatex.txt (limited to 'test') diff --git a/test/functional/input/standalone_rst_newlatex.txt b/test/functional/input/standalone_rst_newlatex.txt new file mode 100644 index 000000000..81b4e5ea6 --- /dev/null +++ b/test/functional/input/standalone_rst_newlatex.txt @@ -0,0 +1,12 @@ +.. include:: data/standard.txt +.. include:: data/table_colspan.txt +.. include:: data/latex.txt + + +Tests for the LaTeX writer +========================== + +.. include:: data/nonalphanumeric.txt +.. include:: data/unicode.txt + +.. include:: data/errors.txt -- cgit v1.2.1 From 0d1b85a3a1746ad160ab7b7853f905e71251a8ad Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sat, 30 Apr 2005 16:47:51 +0000 Subject: changed the LaTeX sidebar-test a bit git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3278 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/input/data/latex.txt | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/functional/input/data/latex.txt b/test/functional/input/data/latex.txt index 31e57c85d..26c8319aa 100644 --- a/test/functional/input/data/latex.txt +++ b/test/functional/input/data/latex.txt @@ -61,12 +61,6 @@ text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. -This is some text. This is some text. This is some text. This is -some text. This is some text. This is some text. This is some text. -This is some text. This is some text. This is some text. This is -some text. This is some text. This is some text. This is some text. -This is some text. This is some text. This is some text. This is -some text. This is some text. Next Section @@ -79,6 +73,10 @@ some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. +This is some text. This is some text. This is some text. This is +some text. This is some text. This is some text. This is some text. +This is some text. This is some text. This is some text. + Nested Elements --------------- -- cgit v1.2.1 From e85e00e626eafa6f7271f494ac521cf8fea63d3f Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sat, 30 Apr 2005 16:51:33 +0000 Subject: renamed "dangerous" functional test to "restricted" so that it doesn't get in the way when tab-completing to input/data git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3279 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/dangerous.html | 66 -------------------------------- test/functional/expected/restricted.html | 66 ++++++++++++++++++++++++++++++++ test/functional/input/dangerous.txt | 16 -------- test/functional/input/restricted.txt | 16 ++++++++ test/functional/tests/dangerous.py | 12 ------ test/functional/tests/restricted.py | 12 ++++++ 6 files changed, 94 insertions(+), 94 deletions(-) delete mode 100644 test/functional/expected/dangerous.html create mode 100644 test/functional/expected/restricted.html delete mode 100644 test/functional/input/dangerous.txt create mode 100644 test/functional/input/restricted.txt delete mode 100644 test/functional/tests/dangerous.py create mode 100644 test/functional/tests/restricted.py (limited to 'test') diff --git a/test/functional/expected/dangerous.html b/test/functional/expected/dangerous.html deleted file mode 100644 index 184417b5e..000000000 --- a/test/functional/expected/dangerous.html +++ /dev/null @@ -1,66 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> -<meta name="generator" content="Docutils 0.3.8: http://docutils.sourceforge.net/" /> -<title> - - - -
    -

    Potentially dangerous features (security holes):

    -
    -

    System Message: WARNING/2 (functional/input/dangerous.txt, line 3)

    -

    "include" directive disabled.

    -
    -.. include:: /etc/passwd
    -
    -
    -
    -

    System Message: WARNING/2 (functional/input/dangerous.txt, line 4)

    -

    "raw" directive disabled.

    -
    -.. raw:: html
    -   :file: /etc/passwd
    -
    -
    -
    -

    System Message: WARNING/2 (functional/input/dangerous.txt, line 6)

    -

    "raw" directive disabled.

    -
    -.. raw:: html
    -   :url: file:///etc/passwd
    -
    -
    -
    -

    System Message: WARNING/2 (functional/input/dangerous.txt, line 8)

    -

    "raw" directive disabled.

    -
    -.. raw:: html
    -
    -   <script>
    -       that does something really nasty
    -   </script>
    -
    -
    -
    -

    System Message: WARNING/2 (functional/input/dangerous.txt, line 13)

    -

    "csv-table" directive disabled.

    -
    -.. csv-table:: :file: /etc/passwd
    -
    -
    -
    -

    System Message: WARNING/2 (functional/input/dangerous.txt, line 14)

    -

    "csv-table" directive disabled.

    -
    -.. csv-table:: :url: file:///etc/passwd
    -
    -
    -
    -
    picture.png
    -
    -
    - - diff --git a/test/functional/expected/restricted.html b/test/functional/expected/restricted.html new file mode 100644 index 000000000..28c6bac7a --- /dev/null +++ b/test/functional/expected/restricted.html @@ -0,0 +1,66 @@ + + + + + + + + + + +
    +

    Potentially dangerous features (security holes):

    +
    +

    System Message: WARNING/2 (functional/input/restricted.txt, line 3)

    +

    "include" directive disabled.

    +
    +.. include:: /etc/passwd
    +
    +
    +
    +

    System Message: WARNING/2 (functional/input/restricted.txt, line 4)

    +

    "raw" directive disabled.

    +
    +.. raw:: html
    +   :file: /etc/passwd
    +
    +
    +
    +

    System Message: WARNING/2 (functional/input/restricted.txt, line 6)

    +

    "raw" directive disabled.

    +
    +.. raw:: html
    +   :url: file:///etc/passwd
    +
    +
    +
    +

    System Message: WARNING/2 (functional/input/restricted.txt, line 8)

    +

    "raw" directive disabled.

    +
    +.. raw:: html
    +
    +   <script>
    +       that does something really nasty
    +   </script>
    +
    +
    +
    +

    System Message: WARNING/2 (functional/input/restricted.txt, line 13)

    +

    "csv-table" directive disabled.

    +
    +.. csv-table:: :file: /etc/passwd
    +
    +
    +
    +

    System Message: WARNING/2 (functional/input/restricted.txt, line 14)

    +

    "csv-table" directive disabled.

    +
    +.. csv-table:: :url: file:///etc/passwd
    +
    +
    +
    +
    picture.png
    +
    +
    + + diff --git a/test/functional/input/dangerous.txt b/test/functional/input/dangerous.txt deleted file mode 100644 index 8f75386c8..000000000 --- a/test/functional/input/dangerous.txt +++ /dev/null @@ -1,16 +0,0 @@ -Potentially dangerous features (security holes): - -.. include:: /etc/passwd -.. raw:: html - :file: /etc/passwd -.. raw:: html - :url: file:///etc/passwd -.. raw:: html - - -.. csv-table:: :file: /etc/passwd -.. csv-table:: :url: file:///etc/passwd -.. figure:: picture.png - :figwidth: image diff --git a/test/functional/input/restricted.txt b/test/functional/input/restricted.txt new file mode 100644 index 000000000..8f75386c8 --- /dev/null +++ b/test/functional/input/restricted.txt @@ -0,0 +1,16 @@ +Potentially dangerous features (security holes): + +.. include:: /etc/passwd +.. raw:: html + :file: /etc/passwd +.. raw:: html + :url: file:///etc/passwd +.. raw:: html + + +.. csv-table:: :file: /etc/passwd +.. csv-table:: :url: file:///etc/passwd +.. figure:: picture.png + :figwidth: image diff --git a/test/functional/tests/dangerous.py b/test/functional/tests/dangerous.py deleted file mode 100644 index 620a927ba..000000000 --- a/test/functional/tests/dangerous.py +++ /dev/null @@ -1,12 +0,0 @@ -# Source and destination file names. -test_source = "dangerous.txt" -test_destination = "dangerous.html" - -# Keyword parameters passed to publish_file. -reader_name = "standalone" -parser_name = "rst" -writer_name = "html" - -# Settings -settings_overrides['file_insertion_enabled'] = 0 -settings_overrides['raw_enabled'] = 0 diff --git a/test/functional/tests/restricted.py b/test/functional/tests/restricted.py new file mode 100644 index 000000000..375e884e8 --- /dev/null +++ b/test/functional/tests/restricted.py @@ -0,0 +1,12 @@ +# Source and destination file names. +test_source = "restricted.txt" +test_destination = "restricted.html" + +# Keyword parameters passed to publish_file. +reader_name = "standalone" +parser_name = "rst" +writer_name = "html" + +# Settings +settings_overrides['file_insertion_enabled'] = 0 +settings_overrides['raw_enabled'] = 0 -- cgit v1.2.1 From 09e24efaea8da760f29674aa89883d6aa54a94b7 Mon Sep 17 00:00:00 2001 From: wiemann Date: Tue, 3 May 2005 11:12:11 +0000 Subject: reverted r3279 git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3285 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/dangerous.html | 66 ++++++++++++++++++++++++++++++++ test/functional/expected/restricted.html | 66 -------------------------------- test/functional/input/dangerous.txt | 16 ++++++++ test/functional/input/restricted.txt | 16 -------- test/functional/tests/dangerous.py | 12 ++++++ test/functional/tests/restricted.py | 12 ------ 6 files changed, 94 insertions(+), 94 deletions(-) create mode 100644 test/functional/expected/dangerous.html delete mode 100644 test/functional/expected/restricted.html create mode 100644 test/functional/input/dangerous.txt delete mode 100644 test/functional/input/restricted.txt create mode 100644 test/functional/tests/dangerous.py delete mode 100644 test/functional/tests/restricted.py (limited to 'test') diff --git a/test/functional/expected/dangerous.html b/test/functional/expected/dangerous.html new file mode 100644 index 000000000..184417b5e --- /dev/null +++ b/test/functional/expected/dangerous.html @@ -0,0 +1,66 @@ + + + + + + + + + + +
    +

    Potentially dangerous features (security holes):

    +
    +

    System Message: WARNING/2 (functional/input/dangerous.txt, line 3)

    +

    "include" directive disabled.

    +
    +.. include:: /etc/passwd
    +
    +
    +
    +

    System Message: WARNING/2 (functional/input/dangerous.txt, line 4)

    +

    "raw" directive disabled.

    +
    +.. raw:: html
    +   :file: /etc/passwd
    +
    +
    +
    +

    System Message: WARNING/2 (functional/input/dangerous.txt, line 6)

    +

    "raw" directive disabled.

    +
    +.. raw:: html
    +   :url: file:///etc/passwd
    +
    +
    +
    +

    System Message: WARNING/2 (functional/input/dangerous.txt, line 8)

    +

    "raw" directive disabled.

    +
    +.. raw:: html
    +
    +   <script>
    +       that does something really nasty
    +   </script>
    +
    +
    +
    +

    System Message: WARNING/2 (functional/input/dangerous.txt, line 13)

    +

    "csv-table" directive disabled.

    +
    +.. csv-table:: :file: /etc/passwd
    +
    +
    +
    +

    System Message: WARNING/2 (functional/input/dangerous.txt, line 14)

    +

    "csv-table" directive disabled.

    +
    +.. csv-table:: :url: file:///etc/passwd
    +
    +
    +
    +
    picture.png
    +
    +
    + + diff --git a/test/functional/expected/restricted.html b/test/functional/expected/restricted.html deleted file mode 100644 index 28c6bac7a..000000000 --- a/test/functional/expected/restricted.html +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - - - -
    -

    Potentially dangerous features (security holes):

    -
    -

    System Message: WARNING/2 (functional/input/restricted.txt, line 3)

    -

    "include" directive disabled.

    -
    -.. include:: /etc/passwd
    -
    -
    -
    -

    System Message: WARNING/2 (functional/input/restricted.txt, line 4)

    -

    "raw" directive disabled.

    -
    -.. raw:: html
    -   :file: /etc/passwd
    -
    -
    -
    -

    System Message: WARNING/2 (functional/input/restricted.txt, line 6)

    -

    "raw" directive disabled.

    -
    -.. raw:: html
    -   :url: file:///etc/passwd
    -
    -
    -
    -

    System Message: WARNING/2 (functional/input/restricted.txt, line 8)

    -

    "raw" directive disabled.

    -
    -.. raw:: html
    -
    -   <script>
    -       that does something really nasty
    -   </script>
    -
    -
    -
    -

    System Message: WARNING/2 (functional/input/restricted.txt, line 13)

    -

    "csv-table" directive disabled.

    -
    -.. csv-table:: :file: /etc/passwd
    -
    -
    -
    -

    System Message: WARNING/2 (functional/input/restricted.txt, line 14)

    -

    "csv-table" directive disabled.

    -
    -.. csv-table:: :url: file:///etc/passwd
    -
    -
    -
    -
    picture.png
    -
    -
    - - diff --git a/test/functional/input/dangerous.txt b/test/functional/input/dangerous.txt new file mode 100644 index 000000000..8f75386c8 --- /dev/null +++ b/test/functional/input/dangerous.txt @@ -0,0 +1,16 @@ +Potentially dangerous features (security holes): + +.. include:: /etc/passwd +.. raw:: html + :file: /etc/passwd +.. raw:: html + :url: file:///etc/passwd +.. raw:: html + + +.. csv-table:: :file: /etc/passwd +.. csv-table:: :url: file:///etc/passwd +.. figure:: picture.png + :figwidth: image diff --git a/test/functional/input/restricted.txt b/test/functional/input/restricted.txt deleted file mode 100644 index 8f75386c8..000000000 --- a/test/functional/input/restricted.txt +++ /dev/null @@ -1,16 +0,0 @@ -Potentially dangerous features (security holes): - -.. include:: /etc/passwd -.. raw:: html - :file: /etc/passwd -.. raw:: html - :url: file:///etc/passwd -.. raw:: html - - -.. csv-table:: :file: /etc/passwd -.. csv-table:: :url: file:///etc/passwd -.. figure:: picture.png - :figwidth: image diff --git a/test/functional/tests/dangerous.py b/test/functional/tests/dangerous.py new file mode 100644 index 000000000..620a927ba --- /dev/null +++ b/test/functional/tests/dangerous.py @@ -0,0 +1,12 @@ +# Source and destination file names. +test_source = "dangerous.txt" +test_destination = "dangerous.html" + +# Keyword parameters passed to publish_file. +reader_name = "standalone" +parser_name = "rst" +writer_name = "html" + +# Settings +settings_overrides['file_insertion_enabled'] = 0 +settings_overrides['raw_enabled'] = 0 diff --git a/test/functional/tests/restricted.py b/test/functional/tests/restricted.py deleted file mode 100644 index 375e884e8..000000000 --- a/test/functional/tests/restricted.py +++ /dev/null @@ -1,12 +0,0 @@ -# Source and destination file names. -test_source = "restricted.txt" -test_destination = "restricted.html" - -# Keyword parameters passed to publish_file. -reader_name = "standalone" -parser_name = "rst" -writer_name = "html" - -# Settings -settings_overrides['file_insertion_enabled'] = 0 -settings_overrides['raw_enabled'] = 0 -- cgit v1.2.1 From 55cd5272b6cec7dc3cc9eae6bd8076dd0df064ab Mon Sep 17 00:00:00 2001 From: goodger Date: Mon, 9 May 2005 15:49:37 +0000 Subject: Added "border" option to "image" directive (& attribute to doctree element); updated docs & tests. Closes Feature Request 1193389. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3322 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_html4css1.html | 2 +- test/functional/expected/standalone_rst_pseudoxml.txt | 2 +- test/functional/input/data/standard.txt | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index 13f8c02c6..e39f3c4e2 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -544,7 +544,7 @@ document (a document-wide table o

    2.14.2   Images

    An image directive (also clickable -- a hyperlink reference):

    -
    ../../../docs/user/rst/images/title.png
    +
    ../../../docs/user/rst/images/title.png

    A figure directive:

    reStructuredText, the markup syntax
    diff --git a/test/functional/expected/standalone_rst_pseudoxml.txt b/test/functional/expected/standalone_rst_pseudoxml.txt index 597408d23..df683cd6a 100644 --- a/test/functional/expected/standalone_rst_pseudoxml.txt +++ b/test/functional/expected/standalone_rst_pseudoxml.txt @@ -1119,7 +1119,7 @@ An image directive (also clickable -- a hyperlink reference): - + A figure directive:
    diff --git a/test/functional/input/data/standard.txt b/test/functional/input/data/standard.txt index b06a158d4..6f3e447bc 100644 --- a/test/functional/input/data/standard.txt +++ b/test/functional/input/data/standard.txt @@ -424,6 +424,7 @@ An image directive (also clickable -- a hyperlink reference): .. image:: ../../../docs/user/rst/images/title.png :class: class1 class2 :target: directives_ + :border: 0 A figure directive: -- cgit v1.2.1 From dc191933df46e54b0c95d5405bdb6b10446241d9 Mon Sep 17 00:00:00 2001 From: wiemann Date: Mon, 9 May 2005 21:54:23 +0000 Subject: added images for convenience git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3324 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/input/data/biohazard.png | Bin 0 -> 179 bytes test/functional/input/data/rst.png | Bin 0 -> 1171 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 test/functional/input/data/biohazard.png create mode 100644 test/functional/input/data/rst.png (limited to 'test') diff --git a/test/functional/input/data/biohazard.png b/test/functional/input/data/biohazard.png new file mode 100644 index 000000000..ae4629d8b Binary files /dev/null and b/test/functional/input/data/biohazard.png differ diff --git a/test/functional/input/data/rst.png b/test/functional/input/data/rst.png new file mode 100644 index 000000000..cc6218efe Binary files /dev/null and b/test/functional/input/data/rst.png differ -- cgit v1.2.1 From 8dc84c07c5b8892422dfea066376b9785e53c182 Mon Sep 17 00:00:00 2001 From: wiemann Date: Mon, 9 May 2005 21:57:16 +0000 Subject: this was stupid; it doesn't work because of the paths, of course git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3325 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/input/data/biohazard.png | Bin 179 -> 0 bytes test/functional/input/data/rst.png | Bin 1171 -> 0 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 test/functional/input/data/biohazard.png delete mode 100644 test/functional/input/data/rst.png (limited to 'test') diff --git a/test/functional/input/data/biohazard.png b/test/functional/input/data/biohazard.png deleted file mode 100644 index ae4629d8b..000000000 Binary files a/test/functional/input/data/biohazard.png and /dev/null differ diff --git a/test/functional/input/data/rst.png b/test/functional/input/data/rst.png deleted file mode 100644 index cc6218efe..000000000 Binary files a/test/functional/input/data/rst.png and /dev/null differ -- cgit v1.2.1 From 3686727ee9114a7d3c30fa4c764c268885ef61c6 Mon Sep 17 00:00:00 2001 From: wiemann Date: Mon, 9 May 2005 22:38:34 +0000 Subject: added test for images git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3326 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/input/data/latex.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test') diff --git a/test/functional/input/data/latex.txt b/test/functional/input/data/latex.txt index 26c8319aa..39641de3b 100644 --- a/test/functional/input/data/latex.txt +++ b/test/functional/input/data/latex.txt @@ -100,3 +100,16 @@ Nested Elements | Literal | | block | +---------------+ + + +Images +====== + +Image with 20% width: + +.. image:: ../../../docs/user/rst/images/title.png + :width: 20 + +Image with 100% width: + +.. image:: ../../../docs/user/rst/images/title.png -- cgit v1.2.1 From 9f334eed0f7ac19a83b6405200e0d3356c763ca4 Mon Sep 17 00:00:00 2001 From: wiemann Date: Tue, 10 May 2005 19:46:05 +0000 Subject: added field list in table cell git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3330 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/input/data/latex.txt | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'test') diff --git a/test/functional/input/data/latex.txt b/test/functional/input/data/latex.txt index 39641de3b..df1f66d45 100644 --- a/test/functional/input/data/latex.txt +++ b/test/functional/input/data/latex.txt @@ -100,6 +100,11 @@ Nested Elements | Literal | | block | +---------------+ +| :Field 1: | +| Text. | +| :Field 2: | +| More text. | ++---------------+ Images -- cgit v1.2.1 From 9ed38a53f7de2eed5ed8ba98afb3e2ee28f2f75d Mon Sep 17 00:00:00 2001 From: goodger Date: Sat, 14 May 2005 16:14:44 +0000 Subject: reverting revision 3322: addition of ":border:" option to "image" directive git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3340 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_html4css1.html | 2 +- test/functional/expected/standalone_rst_pseudoxml.txt | 2 +- test/functional/input/data/standard.txt | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index e39f3c4e2..13f8c02c6 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -544,7 +544,7 @@ document (a document-wide table o

    2.14.2   Images

    An image directive (also clickable -- a hyperlink reference):

    -
    ../../../docs/user/rst/images/title.png
    +
    ../../../docs/user/rst/images/title.png

    A figure directive:

    reStructuredText, the markup syntax
    diff --git a/test/functional/expected/standalone_rst_pseudoxml.txt b/test/functional/expected/standalone_rst_pseudoxml.txt index df683cd6a..597408d23 100644 --- a/test/functional/expected/standalone_rst_pseudoxml.txt +++ b/test/functional/expected/standalone_rst_pseudoxml.txt @@ -1119,7 +1119,7 @@ An image directive (also clickable -- a hyperlink reference): - + A figure directive:
    diff --git a/test/functional/input/data/standard.txt b/test/functional/input/data/standard.txt index 6f3e447bc..b06a158d4 100644 --- a/test/functional/input/data/standard.txt +++ b/test/functional/input/data/standard.txt @@ -424,7 +424,6 @@ An image directive (also clickable -- a hyperlink reference): .. image:: ../../../docs/user/rst/images/title.png :class: class1 class2 :target: directives_ - :border: 0 A figure directive: -- cgit v1.2.1 From ad515ddd08093c451941419471afc6e422ab55fb Mon Sep 17 00:00:00 2001 From: wiemann Date: Wed, 18 May 2005 18:08:14 +0000 Subject: Fixed bug with ":width: image" option of figure directive. Closing https://sourceforge.net/tracker/?func=detail&atid=422030&aid=1202510&group_id=38414 git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3346 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_parsers/test_rst/test_directives/test_figures.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_directives/test_figures.py b/test/test_parsers/test_rst/test_directives/test_figures.py index 91fd91596..7e63fda16 100755 --- a/test/test_parsers/test_rst/test_directives/test_figures.py +++ b/test/test_parsers/test_rst/test_directives/test_figures.py @@ -10,6 +10,7 @@ Tests for images.py figure directives. """ +import os.path from __init__ import DocutilsTestSupport def suite(): @@ -17,6 +18,9 @@ def suite(): s.generateTests(totest) return s +mydir = 'test_parsers/test_rst/test_directives/' +biohazard = os.path.join(mydir, '../../../../docs/user/rst/images/biohazard.png') + totest = {} totest['figures'] = [ @@ -286,6 +290,15 @@ Testing for line-leaks:
    """], +["""\ +.. figure:: %s + :figwidth: image +""" % biohazard, +"""\ + +
    + +"""], ] -- cgit v1.2.1 From e8a50ca456b98d2a10a82a689cf6805c541b1244 Mon Sep 17 00:00:00 2001 From: wiemann Date: Wed, 18 May 2005 18:17:33 +0000 Subject: Fixed bug with uppercase image targets. Closing https://sourceforge.net/tracker/index.php?func=detail&aid=1202510&group_id=38414&atid=422030 git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3347 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_parsers/test_rst/test_directives/test_images.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_directives/test_images.py b/test/test_parsers/test_rst/test_directives/test_images.py index b35cab355..3e0c89344 100755 --- a/test/test_parsers/test_rst/test_directives/test_images.py +++ b/test/test_parsers/test_rst/test_directives/test_images.py @@ -357,6 +357,18 @@ u"""\ .. image:: picture.png :align: \xe4 """], +[""" +.. image:: test.png + :target: Uppercase_ + +.. _Uppercase: http://docutils.sourceforge.net/ +""", +"""\ + + + + +"""], ] -- cgit v1.2.1 From 4ae722d597317382b222737ecf0b898b224dddcd Mon Sep 17 00:00:00 2001 From: wiemann Date: Wed, 18 May 2005 22:27:52 +0000 Subject: added SectSubTitle transform git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3351 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms/test_doctitle.py | 37 +++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/test_transforms/test_doctitle.py b/test/test_transforms/test_doctitle.py index c196c38ec..0e2050494 100755 --- a/test/test_transforms/test_doctitle.py +++ b/test/test_transforms/test_doctitle.py @@ -11,7 +11,7 @@ Tests for docutils.transforms.frontmatter.DocTitle. """ from __init__ import DocutilsTestSupport -from docutils.transforms.frontmatter import DocTitle +from docutils.transforms.frontmatter import DocTitle, SectionSubTitle from docutils.parsers.rst import Parser @@ -23,7 +23,7 @@ def suite(): totest = {} -totest['section_headers'] = ((DocTitle,), [ +totest['section_headers'] = ((DocTitle, SectionSubTitle), [ ["""\ .. test title promotion @@ -188,6 +188,39 @@ substitution_definition. This title should be the document title despite the substitution_definition. """], +["""\ +This is no doc title. + +=============== + Section Title +=============== + +Subtitle +======== + +----------------- + Another Section +----------------- + +Another Subtitle +---------------- + +""", +"""\ + + + This is no doc title. +
    + + Section Title + <subtitle ids="subtitle" names="subtitle"> + Subtitle + <section ids="another-section" names="another section"> + <title> + Another Section + <subtitle ids="another-subtitle" names="another subtitle"> + Another Subtitle +"""], ]) -- cgit v1.2.1 From 60dfd2224bbb89c00c32a2258c99ad78bc52939a Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Wed, 18 May 2005 22:31:15 +0000 Subject: removed test for ":figwidth: image" because it has different output depending on whether PIL is installed or not; need to write another test git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3352 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_parsers/test_rst/test_directives/test_figures.py | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_directives/test_figures.py b/test/test_parsers/test_rst/test_directives/test_figures.py index 7e63fda16..91fd91596 100755 --- a/test/test_parsers/test_rst/test_directives/test_figures.py +++ b/test/test_parsers/test_rst/test_directives/test_figures.py @@ -10,7 +10,6 @@ Tests for images.py figure directives. """ -import os.path from __init__ import DocutilsTestSupport def suite(): @@ -18,9 +17,6 @@ def suite(): s.generateTests(totest) return s -mydir = 'test_parsers/test_rst/test_directives/' -biohazard = os.path.join(mydir, '../../../../docs/user/rst/images/biohazard.png') - totest = {} totest['figures'] = [ @@ -290,15 +286,6 @@ Testing for line-leaks: <figure> <image uri="picture.png"> """], -["""\ -.. figure:: %s - :figwidth: image -""" % biohazard, -"""\ -<document source="test data"> - <figure width="16"> - <image uri="test_parsers/test_rst/test_directives/../../../../docs/user/rst/images/biohazard.png"> -"""], ] -- cgit v1.2.1 From caa4d0fc6528ad55bdd96434d7970ecc86931199 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Thu, 19 May 2005 00:49:14 +0000 Subject: renamed command-line options for SectSubTitle transform (plural reads better); tweaked test text git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3353 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms/test_doctitle.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/test_transforms/test_doctitle.py b/test/test_transforms/test_doctitle.py index 0e2050494..3a672d1c2 100755 --- a/test/test_transforms/test_doctitle.py +++ b/test/test_transforms/test_doctitle.py @@ -189,7 +189,7 @@ substitution_definition. substitution_definition. """], ["""\ -This is no doc title. +(Because of this paragraph, the following is not a doc title.) =============== Section Title @@ -209,7 +209,7 @@ Another Subtitle """\ <document source="test data"> <paragraph> - This is no doc title. + (Because of this paragraph, the following is not a doc title.) <section ids="section-title" names="section title"> <title> Section Title -- cgit v1.2.1 From 77418191497fce93725befddcacb8a39c8869050 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Fri, 20 May 2005 22:27:23 +0000 Subject: more thorough figure testing git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3354 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../expected/standalone_rst_html4css1.html | 25 ++++++++++++++-- test/functional/expected/standalone_rst_latex.tex | 28 ++++++++++++++++- .../expected/standalone_rst_pseudoxml.txt | 32 ++++++++++++++++++-- test/functional/input/data/standard.txt | 35 ++++++++++++++++++++-- 4 files changed, 113 insertions(+), 7 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index 13f8c02c6..dcbe16a80 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -546,8 +546,8 @@ document (a document-wide <a class="reference" href="#table-of-contents">table o <p>An image directive (also clickable -- a hyperlink reference):</p> <div class="image class1 class2 image-reference"><a class="reference" href="#directives"><img alt="../../../docs/user/rst/images/title.png" class="class1 class2" src="../../../docs/user/rst/images/title.png" /></a></div> <p>A figure directive:</p> -<div align="left" class="figclass1 figclass2 figure"> -<div class="image class1 class2"><img alt="reStructuredText, the markup syntax" class="class1 class2" src="../../../docs/user/rst/images/title.png" /></div> +<div align="right" class="figclass1 figclass2 figure"> +<div class="image class1 class2"><img alt="reStructuredText, the markup syntax" class="class1 class2" src="../../../docs/user/rst/images/biohazard.png" width="50" /></div> <p class="caption">A figure is an image with a caption and/or a legend:</p> <div class="legend"> <table border="1" class="docutils"> @@ -570,6 +570,27 @@ document (a document-wide <a class="reference" href="#table-of-contents">table o <p>This paragraph is also part of the legend.</p> </div> </div> +<p>This paragraph might flow around the figure...</p> +<p>A centered figure:</p> +<div align="center" class="figure"> +<div class="image"><img alt="../../../docs/user/rst/images/biohazard.png" src="../../../docs/user/rst/images/biohazard.png" width="50" /></div> +<p class="caption">This is the caption.</p> +<div class="legend"> +<p>This is the legend.</p> +<p>The legend may consist of several paragraphs.</p> +</div> +</div> +<p>This paragraph might flow around the figure...</p> +<p>A left-aligned figure:</p> +<div align="left" class="figure"> +<div class="image"><img alt="../../../docs/user/rst/images/biohazard.png" src="../../../docs/user/rst/images/biohazard.png" width="50" /></div> +<p class="caption">This is the caption.</p> +<div class="legend"> +<p>This is the legend.</p> +<p>The legend may consist of several paragraphs.</p> +</div> +</div> +<p>This paragraph might flow around the figure...</p> </div> <div class="section" id="admonitions"> <h3><a class="toc-backref" href="#id64" name="admonitions">2.14.3   Admonitions</a></h3> diff --git a/test/functional/expected/standalone_rst_latex.tex b/test/functional/expected/standalone_rst_latex.tex index 5e937878c..368146eb0 100644 --- a/test/functional/expected/standalone_rst_latex.tex +++ b/test/functional/expected/standalone_rst_latex.tex @@ -864,7 +864,7 @@ An image directive (also clickable -{}- a hyperlink reference): A figure directive: \begin{figure}[htbp]\begin{center} -\includegraphics{../../../docs/user/rst/images/title.png} +\includegraphics{../../../docs/user/rst/images/biohazard.png} \caption{A figure is an image with a caption and/or a legend:}{\small \begin{longtable}[c]{|p{0.16\locallinewidth}|p{0.56\locallinewidth}|} \hline @@ -891,6 +891,32 @@ Well it is, isn't it? This paragraph is also part of the legend. }\end{center}\end{figure} +This paragraph might flow around the figure... + +A centered figure: +\begin{figure}[htbp]\begin{center} + +\includegraphics{../../../docs/user/rst/images/biohazard.png} +\caption{This is the caption.}{\small +This is the legend. + +The legend may consist of several paragraphs. +}\end{center}\end{figure} + +This paragraph might flow around the figure... + +A left-aligned figure: +\begin{figure}[htbp]\begin{center} + +\includegraphics{../../../docs/user/rst/images/biohazard.png} +\caption{This is the caption.}{\small +This is the legend. + +The legend may consist of several paragraphs. +}\end{center}\end{figure} + +This paragraph might flow around the figure... + %___________________________________________________________________________ diff --git a/test/functional/expected/standalone_rst_pseudoxml.txt b/test/functional/expected/standalone_rst_pseudoxml.txt index 597408d23..92c7eccfe 100644 --- a/test/functional/expected/standalone_rst_pseudoxml.txt +++ b/test/functional/expected/standalone_rst_pseudoxml.txt @@ -1122,8 +1122,8 @@ <image classes="class1 class2" uri="../../../docs/user/rst/images/title.png"> <paragraph> A figure directive: - <figure align="left" classes="figclass1 figclass2"> - <image alt="reStructuredText, the markup syntax" classes="class1 class2" uri="../../../docs/user/rst/images/title.png"> + <figure align="right" classes="figclass1 figclass2"> + <image alt="reStructuredText, the markup syntax" classes="class1 class2" uri="../../../docs/user/rst/images/biohazard.png" width="50"> <caption> A figure is an image with a caption and/or a legend: <legend> @@ -1155,6 +1155,34 @@ Well it is, isn't it? <paragraph> This paragraph is also part of the legend. + <paragraph> + This paragraph might flow around the figure... + <paragraph> + A centered figure: + <figure align="center"> + <image uri="../../../docs/user/rst/images/biohazard.png" width="50"> + <caption> + This is the caption. + <legend> + <paragraph> + This is the legend. + <paragraph> + The legend may consist of several paragraphs. + <paragraph> + This paragraph might flow around the figure... + <paragraph> + A left-aligned figure: + <figure align="left"> + <image uri="../../../docs/user/rst/images/biohazard.png" width="50"> + <caption> + This is the caption. + <legend> + <paragraph> + This is the legend. + <paragraph> + The legend may consist of several paragraphs. + <paragraph> + This paragraph might flow around the figure... <section ids="admonitions" names="admonitions"> <title auto="1" refid="id64"> <generated classes="sectnum"> diff --git a/test/functional/input/data/standard.txt b/test/functional/input/data/standard.txt index b06a158d4..2759d88e0 100644 --- a/test/functional/input/data/standard.txt +++ b/test/functional/input/data/standard.txt @@ -427,11 +427,12 @@ An image directive (also clickable -- a hyperlink reference): A figure directive: -.. figure:: ../../../docs/user/rst/images/title.png +.. figure:: ../../../docs/user/rst/images/biohazard.png :figclass: figclass1 figclass2 :class: class1 class2 :alt: reStructuredText, the markup syntax - :align: left + :align: right + :width: 50 A figure is an image with a caption and/or a legend: @@ -445,6 +446,36 @@ A figure directive: This paragraph is also part of the legend. +This paragraph might flow around the figure... + +A centered figure: + +.. figure:: ../../../docs/user/rst/images/biohazard.png + :align: center + :width: 50 + + This is the caption. + + This is the legend. + + The legend may consist of several paragraphs. + +This paragraph might flow around the figure... + +A left-aligned figure: + +.. figure:: ../../../docs/user/rst/images/biohazard.png + :align: left + :width: 50 + + This is the caption. + + This is the legend. + + The legend may consist of several paragraphs. + +This paragraph might flow around the figure... + Admonitions ``````````` -- cgit v1.2.1 From 3600f164d1078d31b98a31f9dbd878b6e2b7bf11 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sat, 21 May 2005 00:00:25 +0000 Subject: added --id-prefix and --auto-id-prefix options git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3358 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_nodes.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'test') diff --git a/test/test_nodes.py b/test/test_nodes.py index faeb61eb7..ce2115c0e 100755 --- a/test/test_nodes.py +++ b/test/test_nodes.py @@ -230,6 +230,33 @@ class MiscFunctionTests(unittest.TestCase): normed = nodes.fully_normalize_name(input) self.assertEquals(normed, output) + def test_set_id_default(self): + # Default prefixes. + document = utils.new_document('test') + # From name. + element = nodes.Element(names=['test']) + document.set_id(element) + self.assertEquals(element['ids'], ['test']) + # Auto-generated. + element = nodes.Element() + document.set_id(element) + self.assertEquals(element['ids'], ['id1']) + + def test_set_id_custom(self): + # Custom prefixes. + document = utils.new_document('test') + # Change settings. + document.settings.id_prefix = 'prefix' + document.settings.auto_id_prefix = 'auto' + # From name. + element = nodes.Element(names=['test']) + document.set_id(element) + self.assertEquals(element['ids'], ['prefixtest']) + # Auto-generated. + element = nodes.Element() + document.set_id(element) + self.assertEquals(element['ids'], ['prefixauto1']) + if __name__ == '__main__': unittest.main() -- cgit v1.2.1 From 60b348491b95eff14dbc894db703b0175d3b3dd6 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Wed, 25 May 2005 12:01:41 +0000 Subject: added test for rowspanning tables with the LaTeX writer git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3362 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../expected/standalone_rst_html4css1.html | 9 ++-- test/functional/expected/standalone_rst_latex.tex | 48 ++++++++++++++++++++++ .../expected/standalone_rst_pseudoxml.txt | 14 ++----- test/functional/input/data/table_rowspan.txt | 6 +-- test/functional/input/standalone_rst_latex.txt | 1 + 5 files changed, 59 insertions(+), 19 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index dcbe16a80..b2c113964 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -822,12 +822,9 @@ Fifth test in HTML.<br />Line two.</div> <tr><td>body row 2</td> <td rowspan="2">Cells may span rows.</td> -<td rowspan="2"><ul class="first last simple"> -<li>Table cells</li> -<li>contain</li> -<li>body elements.</li> -</ul> -</td> +<td rowspan="2">Another +rowspanning +cell.</td> </tr> <tr><td>body row 3</td> </tr> diff --git a/test/functional/expected/standalone_rst_latex.tex b/test/functional/expected/standalone_rst_latex.tex index 368146eb0..f618b05c5 100644 --- a/test/functional/expected/standalone_rst_latex.tex +++ b/test/functional/expected/standalone_rst_latex.tex @@ -208,6 +208,8 @@ reStructuredText construct. \item {} \href{\#colspanning-tables}{2.18~~~Colspanning tables} +\item {} \href{\#rowspanning-tables}{2.19~~~Rowspanning tables} + \end{list} \item {} \href{\#tests-for-the-latex-writer}{3~~~Tests for the LaTeX writer} @@ -1254,6 +1256,52 @@ True \end{longtable} +%___________________________________________________________________________ + +\hypertarget{rowspanning-tables}{} +\pdfbookmark[1]{2.19~~~Rowspanning tables}{rowspanning-tables} +\subsection*{2.19~~~Rowspanning tables} + +Here's a table with cells spanning several rows: + +\begin{longtable}[c]{|p{0.30\locallinewidth}|p{0.16\locallinewidth}|p{0.23\locallinewidth}|} +\hline +\textbf{ +Header row, column 1 +(header rows optional) +} & \textbf{ +Header 2 +} & \textbf{ +Header 3 +} \\ +\hline +\endhead + +body row 1, column 1 + & +column 2 + & +column 3 + \\ +\hline + +body row 2 + & \multirow{2}{0.16\locallinewidth}{ +Cells may +span rows. +} & \multirow{2}{0.23\locallinewidth}{ +Another +rowspanning +cell. +} \\ +\cline{1-1} + +body row 3 + & \\ +\hline +\end{longtable} + + %___________________________________________________________________________ \hypertarget{tests-for-the-latex-writer}{} diff --git a/test/functional/expected/standalone_rst_pseudoxml.txt b/test/functional/expected/standalone_rst_pseudoxml.txt index 92c7eccfe..38167aa22 100644 --- a/test/functional/expected/standalone_rst_pseudoxml.txt +++ b/test/functional/expected/standalone_rst_pseudoxml.txt @@ -1542,16 +1542,10 @@ Cells may span rows. <entry morerows="1"> - <bullet_list bullet="-"> - <list_item> - <paragraph> - Table cells - <list_item> - <paragraph> - contain - <list_item> - <paragraph> - body elements. + <paragraph> + Another + rowspanning + cell. <row> <entry> <paragraph> diff --git a/test/functional/input/data/table_rowspan.txt b/test/functional/input/data/table_rowspan.txt index 0ccb0f71d..5df3109c4 100644 --- a/test/functional/input/data/table_rowspan.txt +++ b/test/functional/input/data/table_rowspan.txt @@ -9,7 +9,7 @@ Here's a table with cells spanning several rows: +========================+============+==================+ | body row 1, column 1 | column 2 | column 3 | +------------------------+------------+------------------+ -| body row 2 | Cells may | - Table cells | -+------------------------+ span rows. | - contain | -| body row 3 | | - body elements. | +| body row 2 | Cells may | Another | ++------------------------+ span rows. | rowspanning | +| body row 3 | | cell. | +------------------------+------------+------------------+ diff --git a/test/functional/input/standalone_rst_latex.txt b/test/functional/input/standalone_rst_latex.txt index a44810d9f..09a4f8890 100644 --- a/test/functional/input/standalone_rst_latex.txt +++ b/test/functional/input/standalone_rst_latex.txt @@ -1,5 +1,6 @@ .. include:: data/standard.txt .. include:: data/table_colspan.txt +.. include:: data/table_rowspan.txt Tests for the LaTeX writer -- cgit v1.2.1 From e2e8e1fc7284f27455d69622344e976fde8094fc Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Wed, 25 May 2005 23:59:45 +0000 Subject: added defaults file for standalone_rst_... tests git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3366 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/tests/_standalone_rst_defaults.py | 6 ++++++ test/functional/tests/standalone_rst_html4css1.py | 6 +++--- test/functional/tests/standalone_rst_latex.py | 4 ++-- test/functional/tests/standalone_rst_pseudoxml.py | 4 ++-- 4 files changed, 13 insertions(+), 7 deletions(-) create mode 100644 test/functional/tests/_standalone_rst_defaults.py (limited to 'test') diff --git a/test/functional/tests/_standalone_rst_defaults.py b/test/functional/tests/_standalone_rst_defaults.py new file mode 100644 index 000000000..b51704929 --- /dev/null +++ b/test/functional/tests/_standalone_rst_defaults.py @@ -0,0 +1,6 @@ +# Keyword parameters passed to publish_file. +reader_name = "standalone" +parser_name = "rst" + +# Settings. +settings_overrides['sectsubtitle_xform'] = 1 diff --git a/test/functional/tests/standalone_rst_html4css1.py b/test/functional/tests/standalone_rst_html4css1.py index c7a2b7301..54252e83f 100644 --- a/test/functional/tests/standalone_rst_html4css1.py +++ b/test/functional/tests/standalone_rst_html4css1.py @@ -1,12 +1,12 @@ +execfile('functional/tests/_standalone_rst_defaults.py') + # Source and destination file names. test_source = "standalone_rst_html4css1.txt" test_destination = "standalone_rst_html4css1.html" # Keyword parameters passed to publish_file. -reader_name = "standalone" -parser_name = "rst" writer_name = "html4css1" -# Settings +# Settings. settings_overrides['stylesheet'] = None settings_overrides['stylesheet_path'] = "../tools/stylesheets/default.css" diff --git a/test/functional/tests/standalone_rst_latex.py b/test/functional/tests/standalone_rst_latex.py index a39bf6df1..f0c40b75a 100644 --- a/test/functional/tests/standalone_rst_latex.py +++ b/test/functional/tests/standalone_rst_latex.py @@ -1,8 +1,8 @@ +execfile('functional/tests/_standalone_rst_defaults.py') + # Source and destination file names. test_source = "standalone_rst_latex.txt" test_destination = "standalone_rst_latex.tex" # Keyword parameters passed to publish_file. -reader_name = "standalone" -parser_name = "rst" writer_name = "latex" diff --git a/test/functional/tests/standalone_rst_pseudoxml.py b/test/functional/tests/standalone_rst_pseudoxml.py index 4df832f64..05be80899 100644 --- a/test/functional/tests/standalone_rst_pseudoxml.py +++ b/test/functional/tests/standalone_rst_pseudoxml.py @@ -1,8 +1,8 @@ +execfile('functional/tests/_standalone_rst_defaults.py') + # Source and destination file names. test_source = "standalone_rst_html4css1.txt" test_destination = "standalone_rst_pseudoxml.txt" # Keyword parameters passed to publish_file. -reader_name = "standalone" -parser_name = "rst" writer_name = "pseudoxml" -- cgit v1.2.1 From 2c3a254f2a8e5e6a66fee2426b626fa8a853491b Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Thu, 26 May 2005 00:44:13 +0000 Subject: added support and test for section subtitles git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3367 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_html4css1.html | 13 +++++++------ test/functional/expected/standalone_rst_latex.tex | 2 ++ test/functional/expected/standalone_rst_pseudoxml.txt | 12 +++++++----- test/functional/input/data/standard.txt | 2 ++ 4 files changed, 18 insertions(+), 11 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index b2c113964..3666d6e18 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -140,7 +140,8 @@ They are transformed from section titles after parsing. --> <div class="section" id="structural-elements"> <h1><a class="toc-backref" href="#id25" name="structural-elements">1   Structural Elements</a></h1> <div class="section" id="section-title"> -<h2><a class="toc-backref" href="#id26" name="section-title">1.1   Section Title</a></h2> +<h2 class="with-subtitle"><a class="toc-backref" href="#id26" name="section-title">1.1   Section Title</a></h2> +<h2 class="section-subtitle" id="section-subtitle"><span class="section-subtitle">Section Subtitle</span></h2> <p>That's it, the text just above this line.</p> </div> <div class="section" id="empty-section"> @@ -924,19 +925,19 @@ section, "Docutils System Messages":</p> <div class="system-messages section"> <h1><a>Docutils System Messages</a></h1> <div class="system-message" id="id19"> -<p class="system-message-title">System Message: <a name="id19">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 98); <em><a href="#id20">backlink</a></em></p> +<p class="system-message-title">System Message: <a name="id19">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 100); <em><a href="#id20">backlink</a></em></p> Undefined substitution referenced: "problematic".</div> <div class="system-message" id="id69"> -<p class="system-message-title">System Message: <a name="id69">ERROR/3</a> (<tt class="docutils">functional/input/standalone_rst_html4css1.txt</tt>, line 352); <em><a href="#id70">backlink</a></em></p> +<p class="system-message-title">System Message: <a name="id69">ERROR/3</a> (<tt class="docutils">functional/input/standalone_rst_html4css1.txt</tt>, line 354); <em><a href="#id70">backlink</a></em></p> Unknown target name: "5".</div> <div class="system-message" id="id71"> -<p class="system-message-title">System Message: <a name="id71">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 361); <em><a href="#id72">backlink</a></em></p> +<p class="system-message-title">System Message: <a name="id71">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 363); <em><a href="#id72">backlink</a></em></p> Unknown target name: "nonexistent".</div> <div class="system-message" id="id73"> -<p class="system-message-title">System Message: <a name="id73">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 388); <em><a href="#id74">backlink</a></em></p> +<p class="system-message-title">System Message: <a name="id73">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 390); <em><a href="#id74">backlink</a></em></p> Unknown target name: "hyperlink reference without a target".</div> <div class="system-message" id="id75"> -<p class="system-message-title">System Message: <a name="id75">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 401); <em><a href="#id76">backlink</a></em></p> +<p class="system-message-title">System Message: <a name="id75">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 403); <em><a href="#id76">backlink</a></em></p> Duplicate target name, cannot be used as a unique reference: "duplicate target names".</div> </div> </div> diff --git a/test/functional/expected/standalone_rst_latex.tex b/test/functional/expected/standalone_rst_latex.tex index f618b05c5..ec682aa52 100644 --- a/test/functional/expected/standalone_rst_latex.tex +++ b/test/functional/expected/standalone_rst_latex.tex @@ -238,7 +238,9 @@ reStructuredText construct. \hypertarget{section-title}{} \pdfbookmark[1]{1.1~~~Section Title}{section-title} \subsection*{1.1~~~Section Title} +\textbf{Section Subtitle}\vspace{0.2cm} +\noindent That's it, the text just above this line. diff --git a/test/functional/expected/standalone_rst_pseudoxml.txt b/test/functional/expected/standalone_rst_pseudoxml.txt index 38167aa22..1c21abc9a 100644 --- a/test/functional/expected/standalone_rst_pseudoxml.txt +++ b/test/functional/expected/standalone_rst_pseudoxml.txt @@ -326,6 +326,8 @@ <generated classes="sectnum"> 1.1    Section Title + <subtitle ids="section-subtitle" names="section subtitle"> + Section Subtitle <paragraph> That's it, the text just above this line. <section ids="empty-section" names="empty section"> @@ -1707,18 +1709,18 @@ <section classes="system-messages"> <title> Docutils System Messages - <system_message backrefs="id20" ids="id19" level="3" line="98" source="functional/input/data/standard.txt" type="ERROR"> + <system_message backrefs="id20" ids="id19" level="3" line="100" source="functional/input/data/standard.txt" type="ERROR"> <paragraph> Undefined substitution referenced: "problematic". - <system_message backrefs="id70" ids="id69" level="3" line="352" source="functional/input/standalone_rst_html4css1.txt" type="ERROR"> + <system_message backrefs="id70" ids="id69" level="3" line="354" source="functional/input/standalone_rst_html4css1.txt" type="ERROR"> <paragraph> Unknown target name: "5". - <system_message backrefs="id72" ids="id71" level="3" line="361" source="functional/input/data/standard.txt" type="ERROR"> + <system_message backrefs="id72" ids="id71" level="3" line="363" source="functional/input/data/standard.txt" type="ERROR"> <paragraph> Unknown target name: "nonexistent". - <system_message backrefs="id74" ids="id73" level="3" line="388" source="functional/input/data/standard.txt" type="ERROR"> + <system_message backrefs="id74" ids="id73" level="3" line="390" source="functional/input/data/standard.txt" type="ERROR"> <paragraph> Unknown target name: "hyperlink reference without a target". - <system_message backrefs="id76" ids="id75" level="3" line="401" source="functional/input/data/standard.txt" type="ERROR"> + <system_message backrefs="id76" ids="id75" level="3" line="403" source="functional/input/data/standard.txt" type="ERROR"> <paragraph> Duplicate target name, cannot be used as a unique reference: "duplicate target names". diff --git a/test/functional/input/data/standard.txt b/test/functional/input/data/standard.txt index 2759d88e0..a4a75b078 100644 --- a/test/functional/input/data/standard.txt +++ b/test/functional/input/data/standard.txt @@ -65,6 +65,8 @@ Structural Elements Section Title ------------- +Section Subtitle +```````````````` That's it, the text just above this line. -- cgit v1.2.1 From e78956c8fc478dc7ef264531983024e8269130ea Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Thu, 26 May 2005 21:21:48 +0000 Subject: Release 0.3.9: set version number to 0.3.9 git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3374 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/dangerous.html | 2 +- test/functional/expected/field_name_limit.html | 2 +- test/functional/expected/misc_rst_html4css1.html | 2 +- test/functional/expected/pep_html.html | 2 +- test/functional/expected/standalone_rst_html4css1.html | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/functional/expected/dangerous.html b/test/functional/expected/dangerous.html index 184417b5e..df3de8cef 100644 --- a/test/functional/expected/dangerous.html +++ b/test/functional/expected/dangerous.html @@ -3,7 +3,7 @@ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> -<meta name="generator" content="Docutils 0.3.8: http://docutils.sourceforge.net/" /> +<meta name="generator" content="Docutils 0.3.9: http://docutils.sourceforge.net/" /> <title> diff --git a/test/functional/expected/field_name_limit.html b/test/functional/expected/field_name_limit.html index f5e7aaa78..f961650ae 100644 --- a/test/functional/expected/field_name_limit.html +++ b/test/functional/expected/field_name_limit.html @@ -3,7 +3,7 @@ - + diff --git a/test/functional/expected/misc_rst_html4css1.html b/test/functional/expected/misc_rst_html4css1.html index 9301f6686..324152872 100644 --- a/test/functional/expected/misc_rst_html4css1.html +++ b/test/functional/expected/misc_rst_html4css1.html @@ -3,7 +3,7 @@ - + diff --git a/test/functional/expected/pep_html.html b/test/functional/expected/pep_html.html index 00d7d1d2b..a1b9f2791 100644 --- a/test/functional/expected/pep_html.html +++ b/test/functional/expected/pep_html.html @@ -8,7 +8,7 @@ to templates. DO NOT USE THIS HTML FILE AS YOUR TEMPLATE! --> - + PEP 100 -- Test PEP diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index 3666d6e18..bc06486a2 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -3,7 +3,7 @@ - + reStructuredText Test Document -- cgit v1.2.1 From 63fff375aa144a601b0e9588f1868f1b15c21703 Mon Sep 17 00:00:00 2001 From: wiemann Date: Thu, 26 May 2005 22:52:48 +0000 Subject: Release 0.3.9: set version number to 0.3.10 git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3379 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/dangerous.html | 2 +- test/functional/expected/field_name_limit.html | 2 +- test/functional/expected/misc_rst_html4css1.html | 2 +- test/functional/expected/pep_html.html | 2 +- test/functional/expected/standalone_rst_html4css1.html | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/functional/expected/dangerous.html b/test/functional/expected/dangerous.html index df3de8cef..42236c729 100644 --- a/test/functional/expected/dangerous.html +++ b/test/functional/expected/dangerous.html @@ -3,7 +3,7 @@ - + diff --git a/test/functional/expected/field_name_limit.html b/test/functional/expected/field_name_limit.html index f961650ae..3b8b36a89 100644 --- a/test/functional/expected/field_name_limit.html +++ b/test/functional/expected/field_name_limit.html @@ -3,7 +3,7 @@ - + diff --git a/test/functional/expected/misc_rst_html4css1.html b/test/functional/expected/misc_rst_html4css1.html index 324152872..aeaa58e87 100644 --- a/test/functional/expected/misc_rst_html4css1.html +++ b/test/functional/expected/misc_rst_html4css1.html @@ -3,7 +3,7 @@ - + diff --git a/test/functional/expected/pep_html.html b/test/functional/expected/pep_html.html index a1b9f2791..f65f5d875 100644 --- a/test/functional/expected/pep_html.html +++ b/test/functional/expected/pep_html.html @@ -8,7 +8,7 @@ to templates. DO NOT USE THIS HTML FILE AS YOUR TEMPLATE! --> - + PEP 100 -- Test PEP diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index bc06486a2..f0ec8afb2 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -3,7 +3,7 @@ - + reStructuredText Test Document -- cgit v1.2.1 From 56fef30d6ecc31031ff4a82cad41d4da444d1822 Mon Sep 17 00:00:00 2001 From: wiemann Date: Sun, 29 May 2005 12:42:43 +0000 Subject: moved aux. tags for multiple IDs *inside* the element which carries the ID git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3409 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_html4css1.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index f0ec8afb2..928fb8801 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -21,9 +21,9 @@ Document header
    -
    -

    reStructuredText Test Document

    -

    Examples of Syntax Constructs

    +
    +

    reStructuredText Test Document

    +

    Examples of Syntax Constructs

    @@ -494,8 +494,8 @@ rendered separately and differently from footnotes.

    Here's a reference to the above, [CIT2002], and a [nonexistent]_ citation.

    -
    -

    2.13   Targets

    +
    +

    2.13   Targets

    This paragraph is pointed to by the explicit "example" target. A reference can be found under Inline Markup, above. Inline hyperlink targets are also possible.

    -- cgit v1.2.1 From b420a45b82cdbf20cd36de98690e4e15235c80e6 Mon Sep 17 00:00:00 2001 From: wiemann Date: Sun, 29 May 2005 12:51:35 +0000 Subject: added functional test for image with multiple IDs; somethings *really* broken there, both in the transforms and in the HTML writer git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3410 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_html4css1.html | 4 +++- test/functional/expected/standalone_rst_latex.tex | 4 ++++ test/functional/expected/standalone_rst_pseudoxml.txt | 6 ++++++ test/functional/input/data/standard.txt | 7 +++++++ 4 files changed, 20 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index 928fb8801..abfdcbfe7 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -546,7 +546,9 @@ document (a document-wide table o

    2.14.2   Images

    An image directive (also clickable -- a hyperlink reference):

    ../../../docs/user/rst/images/title.png
    -

    A figure directive:

    +

    Image with multiple IDs:

    +
    ../../../docs/user/rst/images/title.png
    +

    A figure directive:

    reStructuredText, the markup syntax

    A figure is an image with a caption and/or a legend:

    diff --git a/test/functional/expected/standalone_rst_latex.tex b/test/functional/expected/standalone_rst_latex.tex index ec682aa52..3abaf8a9e 100644 --- a/test/functional/expected/standalone_rst_latex.tex +++ b/test/functional/expected/standalone_rst_latex.tex @@ -865,6 +865,10 @@ document (a document-wide \href{\#table-of-contents}{table of contents}). An image directive (also clickable -{}- a hyperlink reference): \href{\#directives}{\includegraphics{../../../docs/user/rst/images/title.png}} +Image with multiple IDs: + +\includegraphics{../../../docs/user/rst/images/title.png} + A figure directive: \begin{figure}[htbp]\begin{center} diff --git a/test/functional/expected/standalone_rst_pseudoxml.txt b/test/functional/expected/standalone_rst_pseudoxml.txt index 1c21abc9a..b1cce6c09 100644 --- a/test/functional/expected/standalone_rst_pseudoxml.txt +++ b/test/functional/expected/standalone_rst_pseudoxml.txt @@ -1123,6 +1123,12 @@ + Image with multiple IDs: + + + + + A figure directive:
    diff --git a/test/functional/input/data/standard.txt b/test/functional/input/data/standard.txt index a4a75b078..cfcc6e7f7 100644 --- a/test/functional/input/data/standard.txt +++ b/test/functional/input/data/standard.txt @@ -427,6 +427,13 @@ An image directive (also clickable -- a hyperlink reference): :class: class1 class2 :target: directives_ +Image with multiple IDs: + +.. _image target 1: +.. _image target 2: +.. _image target 3: +.. image:: ../../../docs/user/rst/images/title.png + A figure directive: .. figure:: ../../../docs/user/rst/images/biohazard.png -- cgit v1.2.1 From e10b9dee23a956499f61c0bd3d8a3c4233c754c3 Mon Sep 17 00:00:00 2001 From: goodger Date: Wed, 1 Jun 2005 13:52:43 +0000 Subject: Added validator to tab_width setting, with test. Closes SF bug #1212515, report from Wu Wei. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3416 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/data/config_1.txt | 1 + test/test_settings.py | 1 + 2 files changed, 2 insertions(+) (limited to 'test') diff --git a/test/data/config_1.txt b/test/data/config_1.txt index f94074a8a..b19a213b3 100644 --- a/test/data/config_1.txt +++ b/test/data/config_1.txt @@ -10,6 +10,7 @@ generator: true [restructuredtext parser] trim-footnote-reference-space: 1 +tab-width = 8 [html4css1 writer] diff --git a/test/test_settings.py b/test/test_settings.py index 2a17c6eef..4226af580 100755 --- a/test/test_settings.py +++ b/test/test_settings.py @@ -57,6 +57,7 @@ class ConfigFileTests(unittest.TestCase): 'source_link': 1, 'stylesheet': None, 'stylesheet_path': fixpath('data/stylesheets/pep.css'), + 'tab_width': 8, 'template': fixpath('data/pep-html-template'), 'trim_footnote_reference_space': 1}, 'two': {'footnote_references': 'superscript', -- cgit v1.2.1 From 78ed5de20eb3c06ef02efd5710145321fc40596f Mon Sep 17 00:00:00 2001 From: goodger Date: Wed, 1 Jun 2005 14:44:50 +0000 Subject: docutils.__version_details__ renamed from .__version_suffix__ git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3417 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/alltests.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/alltests.py b/test/alltests.py index 4092d38a6..03c85e4ce 100755 --- a/test/alltests.py +++ b/test/alltests.py @@ -74,8 +74,9 @@ sys.stdout = sys.stderr = Tee('alltests.out') import package_unittest -print ('Testing Docutils %s with Python %s on %s at %s' - % (docutils.__version__, sys.version.split()[0], +print ('Testing Docutils %s %s with Python %s on %s at %s' + % (docutils.__version__, docutils.__version_details__, + sys.version.split()[0], time.strftime('%Y-%m-%d'), time.strftime('%H:%M:%S'))) sys.stdout.flush() -- cgit v1.2.1 From 58ac1f3ebac3963da6499457920fb94296ab24de Mon Sep 17 00:00:00 2001 From: goodger Date: Fri, 3 Jun 2005 20:46:33 +0000 Subject: tweaked header git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3425 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/alltests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/alltests.py b/test/alltests.py index 03c85e4ce..9c5d8b0aa 100755 --- a/test/alltests.py +++ b/test/alltests.py @@ -74,7 +74,7 @@ sys.stdout = sys.stderr = Tee('alltests.out') import package_unittest -print ('Testing Docutils %s %s with Python %s on %s at %s' +print ('Testing Docutils %s [%s] with Python %s on %s at %s' % (docutils.__version__, docutils.__version_details__, sys.version.split()[0], time.strftime('%Y-%m-%d'), time.strftime('%H:%M:%S'))) -- cgit v1.2.1 From c1312b37ba8887cf092065cb09f3d09ee034ac31 Mon Sep 17 00:00:00 2001 From: goodger Date: Sat, 4 Jun 2005 04:01:58 +0000 Subject: added "default-role" directive git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3427 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../test_rst/test_directives/test_default_role.py | 84 ++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100755 test/test_parsers/test_rst/test_directives/test_default_role.py (limited to 'test') diff --git a/test/test_parsers/test_rst/test_directives/test_default_role.py b/test/test_parsers/test_rst/test_directives/test_default_role.py new file mode 100755 index 000000000..fc9343247 --- /dev/null +++ b/test/test_parsers/test_rst/test_directives/test_default_role.py @@ -0,0 +1,84 @@ +#! /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 misc.py "default-role" directive. +""" + +from __init__ import DocutilsTestSupport + + +def suite(): + s = DocutilsTestSupport.ParserTestSuite() + s.generateTests(totest) + return s + +totest = {} + +totest['default-role'] = [ +["""\ +.. default-role:: subscript + +This is a `subscript`. +""", +"""\ + + + This is a \n\ + + subscript + . +"""], +["""\ +Must define a custom role before using it. + +.. default-role:: custom +""", +"""\ + + + Must define a custom role before using it. + + + No role entry for "custom" in module "docutils.parsers.rst.languages.en". + Trying "custom" as canonical role name. + + + Unknown interpreted text role "custom". + + .. default-role:: custom +"""], +["""\ +.. role:: custom +.. default-role:: custom + +This text uses the `default role`. + +.. default-role:: + +Returned the `default role` to its standard default. +""", +"""\ + + + This text uses the \n\ + + default role + . + + Returned the \n\ + + default role + to its standard default. +"""], +] + + +if __name__ == '__main__': + import unittest + unittest.main(defaultTest='suite') -- cgit v1.2.1 From f3bb5b2325061a52c7de10c726defec34e1d893f Mon Sep 17 00:00:00 2001 From: wiemann Date: Sun, 5 Jun 2005 21:30:29 +0000 Subject: fixed target bug git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3437 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_html4css1.html | 4 ++-- test/functional/expected/standalone_rst_pseudoxml.txt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index abfdcbfe7..954d3daf7 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -547,8 +547,8 @@ document (a document-wide table o

    An image directive (also clickable -- a hyperlink reference):

    ../../../docs/user/rst/images/title.png

    Image with multiple IDs:

    -
    ../../../docs/user/rst/images/title.png
    -

    A figure directive:

    +
    ../../../docs/user/rst/images/title.png
    +

    A figure directive:

    reStructuredText, the markup syntax

    A figure is an image with a caption and/or a legend:

    diff --git a/test/functional/expected/standalone_rst_pseudoxml.txt b/test/functional/expected/standalone_rst_pseudoxml.txt index b1cce6c09..80fd02bd6 100644 --- a/test/functional/expected/standalone_rst_pseudoxml.txt +++ b/test/functional/expected/standalone_rst_pseudoxml.txt @@ -1127,8 +1127,8 @@ - - + + A figure directive:
    -- cgit v1.2.1 From 94919da6a00f847aa507ec658f7edeb8676381f0 Mon Sep 17 00:00:00 2001 From: wiemann Date: Sun, 5 Jun 2005 23:05:51 +0000 Subject: added possibility to pass node classes to node.traverse() git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3438 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_nodes.py | 1 + 1 file changed, 1 insertion(+) (limited to 'test') diff --git a/test/test_nodes.py b/test/test_nodes.py index ce2115c0e..3889a19be 100755 --- a/test/test_nodes.py +++ b/test/test_nodes.py @@ -163,6 +163,7 @@ class MiscTests(unittest.TestCase): self.testlist.append(e[0][1][0]) self.assertEquals(list(e[0].traverse(condition=self.not_in_testlist)), [e[0]]) + self.assertEquals(list(e.traverse(nodes.TextElement)), [e[0][1]]) def test_next_node(self): e = nodes.Element() -- cgit v1.2.1 From 9061c56e4edac24c8e7adbe7aa6131578af9f040 Mon Sep 17 00:00:00 2001 From: wiemann Date: Mon, 6 Jun 2005 01:20:35 +0000 Subject: added "local" class to local TOCs git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3439 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_html4css1.html | 2 +- test/functional/expected/standalone_rst_pseudoxml.txt | 2 +- test/test_parsers/test_rst/test_directives/test_contents.py | 4 ++-- test/test_transforms/test_contents.py | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index 954d3daf7..73f60588b 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -522,7 +522,7 @@ this: `Duplicate

    2.14   Directives

    -
    +
    • 2.14.1   Document Parts
    • 2.14.2   Images
    • diff --git a/test/functional/expected/standalone_rst_pseudoxml.txt b/test/functional/expected/standalone_rst_pseudoxml.txt index 80fd02bd6..62f923a03 100644 --- a/test/functional/expected/standalone_rst_pseudoxml.txt +++ b/test/functional/expected/standalone_rst_pseudoxml.txt @@ -1048,7 +1048,7 @@ 2.14    Directives - + diff --git a/test/test_parsers/test_rst/test_directives/test_contents.py b/test/test_parsers/test_rst/test_directives/test_contents.py index e2b5f29a2..6d6d0f3e2 100755 --- a/test/test_parsers/test_rst/test_directives/test_contents.py +++ b/test/test_parsers/test_rst/test_directives/test_contents.py @@ -101,7 +101,7 @@ totest['contents'] = [ """, """\ - + .. internal attributes: .transform: docutils.transforms.parts.Contents @@ -132,7 +132,7 @@ totest['contents'] = [ """, """\ - + Table of Contents <pending> diff --git a/test/test_transforms/test_contents.py b/test/test_transforms/test_contents.py index 0871aa8f0..c96764343 100755 --- a/test/test_transforms/test_contents.py +++ b/test/test_transforms/test_contents.py @@ -258,7 +258,7 @@ Paragraph 4. <section ids="title-1" names="title 1"> <title> Title 1 - <topic classes="contents" ids="contents" names="contents"> + <topic classes="contents local" ids="contents" names="contents"> <bullet_list> <list_item> <paragraph> @@ -303,7 +303,7 @@ Paragraph. """, """\ <document source="test data"> - <topic classes="contents" ids="contents" names="contents"> + <topic classes="contents local" ids="contents" names="contents"> <bullet_list> <list_item> <paragraph> @@ -404,7 +404,7 @@ Paragraph 3. <sidebar> <title> Contents - <topic classes="contents" ids="contents" names="contents"> + <topic classes="contents local" ids="contents" names="contents"> <bullet_list> <list_item> <paragraph> -- cgit v1.2.1 From c196d1b588df3465000a0d836fc55eb9c11baed2 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Mon, 6 Jun 2005 13:05:49 +0000 Subject: removed <div>s around images git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3441 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/dangerous.html | 2 +- test/functional/expected/standalone_rst_html4css1.html | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/functional/expected/dangerous.html b/test/functional/expected/dangerous.html index 42236c729..779ea9479 100644 --- a/test/functional/expected/dangerous.html +++ b/test/functional/expected/dangerous.html @@ -59,7 +59,7 @@ </pre> </div> <div class="figure"> -<div class="image"><img alt="picture.png" src="picture.png" /></div> +<img alt="picture.png" src="picture.png" /> </div> </div> </body> diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index 73f60588b..280a9f1e5 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -545,12 +545,12 @@ document (a document-wide <a class="reference" href="#table-of-contents">table o <div class="section" id="images"> <h3><a class="toc-backref" href="#id63" name="images">2.14.2   Images</a></h3> <p>An image directive (also clickable -- a hyperlink reference):</p> -<div class="image class1 class2 image-reference"><a class="reference" href="#directives"><img alt="../../../docs/user/rst/images/title.png" class="class1 class2" src="../../../docs/user/rst/images/title.png" /></a></div> +<a class="reference image-reference" href="#directives"><img alt="../../../docs/user/rst/images/title.png" class="class1 class2" src="../../../docs/user/rst/images/title.png" /></a> <p>Image with multiple IDs:</p> -<div class="image"><span id="image-target-2"></span><span id="image-target-1"></span><img alt="../../../docs/user/rst/images/title.png" id="image-target-3" ids="image-target-3 image-target-2 image-target-1" name="image-target-3" names="image target 3 image target 2 image target 1" src="../../../docs/user/rst/images/title.png" /></div> +<span id="image-target-2"></span><span id="image-target-1"></span><img alt="../../../docs/user/rst/images/title.png" id="image-target-3" ids="image-target-3 image-target-2 image-target-1" name="image-target-3" names="image target 3 image target 2 image target 1" src="../../../docs/user/rst/images/title.png" /> <p>A figure directive:</p> <div align="right" class="figclass1 figclass2 figure"> -<div class="image class1 class2"><img alt="reStructuredText, the markup syntax" class="class1 class2" src="../../../docs/user/rst/images/biohazard.png" width="50" /></div> +<img alt="reStructuredText, the markup syntax" class="class1 class2" src="../../../docs/user/rst/images/biohazard.png" width="50" /> <p class="caption">A figure is an image with a caption and/or a legend:</p> <div class="legend"> <table border="1" class="docutils"> @@ -576,7 +576,7 @@ document (a document-wide <a class="reference" href="#table-of-contents">table o <p>This paragraph might flow around the figure...</p> <p>A centered figure:</p> <div align="center" class="figure"> -<div class="image"><img alt="../../../docs/user/rst/images/biohazard.png" src="../../../docs/user/rst/images/biohazard.png" width="50" /></div> +<img alt="../../../docs/user/rst/images/biohazard.png" src="../../../docs/user/rst/images/biohazard.png" width="50" /> <p class="caption">This is the caption.</p> <div class="legend"> <p>This is the legend.</p> @@ -586,7 +586,7 @@ document (a document-wide <a class="reference" href="#table-of-contents">table o <p>This paragraph might flow around the figure...</p> <p>A left-aligned figure:</p> <div align="left" class="figure"> -<div class="image"><img alt="../../../docs/user/rst/images/biohazard.png" src="../../../docs/user/rst/images/biohazard.png" width="50" /></div> +<img alt="../../../docs/user/rst/images/biohazard.png" src="../../../docs/user/rst/images/biohazard.png" width="50" /> <p class="caption">This is the caption.</p> <div class="legend"> <p>This is the legend.</p> -- cgit v1.2.1 From 488f267dde33c01264ded78b61298a1b06b877f3 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Mon, 6 Jun 2005 13:20:22 +0000 Subject: fixed wrong propagation of attributes to img elements in HTML git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3443 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_html4css1.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index 280a9f1e5..ba5d7784d 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -547,7 +547,7 @@ document (a document-wide <a class="reference" href="#table-of-contents">table o <p>An image directive (also clickable -- a hyperlink reference):</p> <a class="reference image-reference" href="#directives"><img alt="../../../docs/user/rst/images/title.png" class="class1 class2" src="../../../docs/user/rst/images/title.png" /></a> <p>Image with multiple IDs:</p> -<span id="image-target-2"></span><span id="image-target-1"></span><img alt="../../../docs/user/rst/images/title.png" id="image-target-3" ids="image-target-3 image-target-2 image-target-1" name="image-target-3" names="image target 3 image target 2 image target 1" src="../../../docs/user/rst/images/title.png" /> +<span id="image-target-2"></span><span id="image-target-1"></span><img alt="../../../docs/user/rst/images/title.png" id="image-target-3" name="image-target-3" src="../../../docs/user/rst/images/title.png" /> <p>A figure directive:</p> <div align="right" class="figclass1 figclass2 figure"> <img alt="reStructuredText, the markup syntax" class="class1 class2" src="../../../docs/user/rst/images/biohazard.png" width="50" /> -- cgit v1.2.1 From 3b7a7200860068db23463a6a4246c19814012ee9 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sun, 12 Jun 2005 16:40:14 +0000 Subject: Added standard data file syntax to the "include" directive. Added docutils/parsers/rst/include/ directory; contains the standard data files, with character entity substitution definition sets as initial contents. Added docs/ref/rst/substitutions.txt: "reStructuredText Standard Substitution Definition Sets". Updated docs, tests, & setup.py. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3472 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../test_rst/test_directives/test_include.py | 40 +++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_directives/test_include.py b/test/test_parsers/test_rst/test_directives/test_include.py index 3987e04e0..9199c1402 100755 --- a/test/test_parsers/test_rst/test_directives/test_include.py +++ b/test/test_parsers/test_rst/test_directives/test_include.py @@ -32,7 +32,8 @@ include11 = os.path.join(mydir, 'include 11.txt') include11rel = DocutilsTestSupport.utils.relative_path(None, include11) utf_16_file = os.path.join(mydir, 'utf-16.csv') utf_16_file_rel = DocutilsTestSupport.utils.relative_path(None, utf_16_file) - +nonexistant_rel = DocutilsTestSupport.utils.relative_path( + None, '../docutils/parsers/rst/data/nonexistant') totest = {} @@ -351,6 +352,43 @@ Include file with whitespace in the path: <paragraph> some text """], +["""\ +Standard include data file: + +.. include:: <isogrk4.txt> +""", +"""\ +<document source="test data"> + <paragraph> + Standard include data file: + <comment xml:space="preserve"> + This data file has been placed in the public domain. + <comment xml:space="preserve"> + Derived from the Unicode character mappings available from + <http://www.w3.org/2003/entities/xml/>. + Processed by unicode2rstsubs.py, part of Docutils: + <http://docutils.sourceforge.net>. + <substitution_definition names="b.Gammad"> + \\u03dc + <substitution_definition names="b.gammad"> + \\u03dd +"""], +["""\ +Nonexistant standard include data file: + +.. include:: <nonexistant> +""", +"""\ +<document source="test data"> + <paragraph> + Nonexistant standard include data file: + <system_message level="4" line="3" source="test data" type="SEVERE"> + <paragraph> + Problems with "include" directive path: + IOError: [Errno 2] No such file or directory: '../docutils/parsers/rst/data/nonexistant'. + <literal_block xml:space="preserve"> + .. include:: <nonexistant> +"""], ] -- cgit v1.2.1 From cbc0c71cce99abae907d275148e80e1e8a201881 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sun, 12 Jun 2005 16:59:38 +0000 Subject: corrected path to data files git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3474 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_parsers/test_rst/test_directives/test_include.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_directives/test_include.py b/test/test_parsers/test_rst/test_directives/test_include.py index 9199c1402..805a08e0c 100755 --- a/test/test_parsers/test_rst/test_directives/test_include.py +++ b/test/test_parsers/test_rst/test_directives/test_include.py @@ -33,7 +33,7 @@ include11rel = DocutilsTestSupport.utils.relative_path(None, include11) utf_16_file = os.path.join(mydir, 'utf-16.csv') utf_16_file_rel = DocutilsTestSupport.utils.relative_path(None, utf_16_file) nonexistant_rel = DocutilsTestSupport.utils.relative_path( - None, '../docutils/parsers/rst/data/nonexistant') + None, '../docutils/parsers/rst/include/nonexistant') totest = {} @@ -385,7 +385,7 @@ Nonexistant standard include data file: <system_message level="4" line="3" source="test data" type="SEVERE"> <paragraph> Problems with "include" directive path: - IOError: [Errno 2] No such file or directory: '../docutils/parsers/rst/data/nonexistant'. + IOError: [Errno 2] No such file or directory: '../docutils/parsers/rst/include/nonexistant'. <literal_block xml:space="preserve"> .. include:: <nonexistant> """], -- cgit v1.2.1 From d55d631ab124aa07e18845a72b45d413acf3852f Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Mon, 13 Jun 2005 18:58:56 +0000 Subject: spelling git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3477 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_parsers/test_rst/test_directives/test_include.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_directives/test_include.py b/test/test_parsers/test_rst/test_directives/test_include.py index 805a08e0c..330dfd8c8 100755 --- a/test/test_parsers/test_rst/test_directives/test_include.py +++ b/test/test_parsers/test_rst/test_directives/test_include.py @@ -32,8 +32,8 @@ include11 = os.path.join(mydir, 'include 11.txt') include11rel = DocutilsTestSupport.utils.relative_path(None, include11) utf_16_file = os.path.join(mydir, 'utf-16.csv') utf_16_file_rel = DocutilsTestSupport.utils.relative_path(None, utf_16_file) -nonexistant_rel = DocutilsTestSupport.utils.relative_path( - None, '../docutils/parsers/rst/include/nonexistant') +nonexistent_rel = DocutilsTestSupport.utils.relative_path( + None, '../docutils/parsers/rst/include/nonexistent') totest = {} @@ -374,20 +374,20 @@ Standard include data file: \\u03dd """], ["""\ -Nonexistant standard include data file: +Nonexistent standard include data file: -.. include:: <nonexistant> +.. include:: <nonexistent> """, """\ <document source="test data"> <paragraph> - Nonexistant standard include data file: + Nonexistent standard include data file: <system_message level="4" line="3" source="test data" type="SEVERE"> <paragraph> Problems with "include" directive path: - IOError: [Errno 2] No such file or directory: '../docutils/parsers/rst/include/nonexistant'. + IOError: [Errno 2] No such file or directory: '../docutils/parsers/rst/include/nonexistent'. <literal_block xml:space="preserve"> - .. include:: <nonexistant> + .. include:: <nonexistent> """], ] -- cgit v1.2.1 From 51dc4c46044bf4bbc46465cbd8536521cb9128ac Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Wed, 15 Jun 2005 23:54:52 +0000 Subject: moved profiledocutils and testcoverage into main tree git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3488 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/testcoverage.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 test/testcoverage.sh (limited to 'test') diff --git a/test/testcoverage.sh b/test/testcoverage.sh new file mode 100755 index 000000000..e2005448d --- /dev/null +++ b/test/testcoverage.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +# Author: Felix Wiemann +# Contact: Felix_Wiemann@ososo.de +# Revision: $Revision$ +# Date: $Date$ +# Copyright: This script has been placed in the public domain. + +set -e +proj="${PWD##*/}" +if test "$proj" == test; then + cd .. + proj="${PWD##*/}" +fi +if test "$1"; then + proj="$1" +fi +echo Performing code coverage test for project \""$proj"\"... +echo +cd test +rm -rf cover +mkdir -p cover +python -u -m trace --count --coverdir=cover --missing alltests.py +cd .. +echo +echo +echo Uncovered lines +echo =============== +echo +( + find "$proj" -name \*.py | while read i; do + i="${i%.py}" + test -f test/cover/"${i//\//.}".cover -o "${i##*/}" == Template || echo "${i//\//.}" "`cat "$i.py" | wc -l`" + done + cd test/cover + find . \( -name . -o ! -name "$proj".\* -exec rm {} \; \) + for i in *.cover; do + sed 's/^>>>>>> \(.*"""\)/ \1/' < "$i" > "${i%.cover}" + rm "$i" + done + for i in *; do echo -n "$i "; grep -c '^>>>>>> ' "$i" || true; done +) | grep -v ' 0$' | sort -nk 2 -- cgit v1.2.1 From 8f85d3e3390fb81fedfc42b709266a823cdba373 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Wed, 15 Jun 2005 23:56:28 +0000 Subject: renamed testcoverage.sh to coverage.sh git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3489 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/coverage.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ test/testcoverage.sh | 42 ------------------------------------------ 2 files changed, 42 insertions(+), 42 deletions(-) create mode 100755 test/coverage.sh delete mode 100755 test/testcoverage.sh (limited to 'test') diff --git a/test/coverage.sh b/test/coverage.sh new file mode 100755 index 000000000..e2005448d --- /dev/null +++ b/test/coverage.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +# Author: Felix Wiemann +# Contact: Felix_Wiemann@ososo.de +# Revision: $Revision$ +# Date: $Date$ +# Copyright: This script has been placed in the public domain. + +set -e +proj="${PWD##*/}" +if test "$proj" == test; then + cd .. + proj="${PWD##*/}" +fi +if test "$1"; then + proj="$1" +fi +echo Performing code coverage test for project \""$proj"\"... +echo +cd test +rm -rf cover +mkdir -p cover +python -u -m trace --count --coverdir=cover --missing alltests.py +cd .. +echo +echo +echo Uncovered lines +echo =============== +echo +( + find "$proj" -name \*.py | while read i; do + i="${i%.py}" + test -f test/cover/"${i//\//.}".cover -o "${i##*/}" == Template || echo "${i//\//.}" "`cat "$i.py" | wc -l`" + done + cd test/cover + find . \( -name . -o ! -name "$proj".\* -exec rm {} \; \) + for i in *.cover; do + sed 's/^>>>>>> \(.*"""\)/ \1/' < "$i" > "${i%.cover}" + rm "$i" + done + for i in *; do echo -n "$i "; grep -c '^>>>>>> ' "$i" || true; done +) | grep -v ' 0$' | sort -nk 2 diff --git a/test/testcoverage.sh b/test/testcoverage.sh deleted file mode 100755 index e2005448d..000000000 --- a/test/testcoverage.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash - -# Author: Felix Wiemann -# Contact: Felix_Wiemann@ososo.de -# Revision: $Revision$ -# Date: $Date$ -# Copyright: This script has been placed in the public domain. - -set -e -proj="${PWD##*/}" -if test "$proj" == test; then - cd .. - proj="${PWD##*/}" -fi -if test "$1"; then - proj="$1" -fi -echo Performing code coverage test for project \""$proj"\"... -echo -cd test -rm -rf cover -mkdir -p cover -python -u -m trace --count --coverdir=cover --missing alltests.py -cd .. -echo -echo -echo Uncovered lines -echo =============== -echo -( - find "$proj" -name \*.py | while read i; do - i="${i%.py}" - test -f test/cover/"${i//\//.}".cover -o "${i##*/}" == Template || echo "${i//\//.}" "`cat "$i.py" | wc -l`" - done - cd test/cover - find . \( -name . -o ! -name "$proj".\* -exec rm {} \; \) - for i in *.cover; do - sed 's/^>>>>>> \(.*"""\)/ \1/' < "$i" > "${i%.cover}" - rm "$i" - done - for i in *; do echo -n "$i "; grep -c '^>>>>>> ' "$i" || true; done -) | grep -v ' 0$' | sort -nk 2 -- cgit v1.2.1 From c9bdf0b05fc639f4112d0dfd7538ff63a02c79b5 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Thu, 16 Jun 2005 00:27:26 +0000 Subject: fixed bug with escaped colons introducing literal block git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3491 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_parsers/test_rst/test_literal_blocks.py | 40 +++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_literal_blocks.py b/test/test_parsers/test_rst/test_literal_blocks.py index 517edd557..332e0eb27 100755 --- a/test/test_parsers/test_rst/test_literal_blocks.py +++ b/test/test_parsers/test_rst/test_literal_blocks.py @@ -125,6 +125,46 @@ no blank line <paragraph> no blank line """], +[r""" +A paragraph\\:: + + A literal block. + +A paragraph\:: + + Not a literal block. +""", +r"""<document source="test data"> + <paragraph> + A paragraph\: + <literal_block xml:space="preserve"> + A literal block. + <paragraph> + A paragraph:: + <block_quote> + <paragraph> + Not a literal block. +"""], +[r""" +\\:: + + A literal block. + +\:: + + Not a literal block. +""", +r"""<document source="test data"> + <paragraph> + \: + <literal_block xml:space="preserve"> + A literal block. + <paragraph> + :: + <block_quote> + <paragraph> + Not a literal block. +"""], ["""\ A paragraph: :: -- cgit v1.2.1 From 04f2424447e9de96e74c65e24d68fab32bfa33e3 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Thu, 16 Jun 2005 22:03:08 +0000 Subject: added support for units in image widths and heights; I called a number combined with a unit (e.g. 5em) a "measure"; I am not entirely sure if that's the right term, though git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3497 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../expected/standalone_rst_html4css1.html | 15 +++++++-- test/functional/expected/standalone_rst_latex.tex | 18 +++++++++++ .../expected/standalone_rst_pseudoxml.txt | 14 +++++++++ test/functional/input/data/standard.txt | 24 +++++++++++++++ .../test_rst/test_directives/test_images.py | 36 ++++++++++++++++++++++ 5 files changed, 104 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index ba5d7784d..e624dacb0 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -550,7 +550,7 @@ document (a document-wide <a class="reference" href="#table-of-contents">table o <span id="image-target-2"></span><span id="image-target-1"></span><img alt="../../../docs/user/rst/images/title.png" id="image-target-3" name="image-target-3" src="../../../docs/user/rst/images/title.png" /> <p>A figure directive:</p> <div align="right" class="figclass1 figclass2 figure"> -<img alt="reStructuredText, the markup syntax" class="class1 class2" src="../../../docs/user/rst/images/biohazard.png" width="50" /> +<img alt="reStructuredText, the markup syntax" class="class1 class2" src="../../../docs/user/rst/images/biohazard.png" style="width: 50px;" /> <p class="caption">A figure is an image with a caption and/or a legend:</p> <div class="legend"> <table border="1" class="docutils"> @@ -576,7 +576,7 @@ document (a document-wide <a class="reference" href="#table-of-contents">table o <p>This paragraph might flow around the figure...</p> <p>A centered figure:</p> <div align="center" class="figure"> -<img alt="../../../docs/user/rst/images/biohazard.png" src="../../../docs/user/rst/images/biohazard.png" width="50" /> +<img alt="../../../docs/user/rst/images/biohazard.png" src="../../../docs/user/rst/images/biohazard.png" style="width: 50px;" /> <p class="caption">This is the caption.</p> <div class="legend"> <p>This is the legend.</p> @@ -586,7 +586,7 @@ document (a document-wide <a class="reference" href="#table-of-contents">table o <p>This paragraph might flow around the figure...</p> <p>A left-aligned figure:</p> <div align="left" class="figure"> -<img alt="../../../docs/user/rst/images/biohazard.png" src="../../../docs/user/rst/images/biohazard.png" width="50" /> +<img alt="../../../docs/user/rst/images/biohazard.png" src="../../../docs/user/rst/images/biohazard.png" style="width: 50px;" /> <p class="caption">This is the caption.</p> <div class="legend"> <p>This is the legend.</p> @@ -594,6 +594,15 @@ document (a document-wide <a class="reference" href="#table-of-contents">table o </div> </div> <p>This paragraph might flow around the figure...</p> +<p>Now widths:</p> +<p>An image 2 em wide:</p> +<img alt="../../../docs/user/rst/images/biohazard.png" src="../../../docs/user/rst/images/biohazard.png" style="width: 2em;" /> +<p>An image 2 em wide and 30 pixel high:</p> +<img alt="../../../docs/user/rst/images/biohazard.png" src="../../../docs/user/rst/images/biohazard.png" style="width: 2em; height: 30px;" /> +<p>An image occupying 70% of the line width:</p> +<img alt="../../../docs/user/rst/images/biohazard.png" src="../../../docs/user/rst/images/biohazard.png" style="width: 70%;" /> +<p>An image 3 cm high:</p> +<img alt="../../../docs/user/rst/images/biohazard.png" src="../../../docs/user/rst/images/biohazard.png" style="height: 3cm;" /> </div> <div class="section" id="admonitions"> <h3><a class="toc-backref" href="#id64" name="admonitions">2.14.3   Admonitions</a></h3> diff --git a/test/functional/expected/standalone_rst_latex.tex b/test/functional/expected/standalone_rst_latex.tex index 3abaf8a9e..06e00ab67 100644 --- a/test/functional/expected/standalone_rst_latex.tex +++ b/test/functional/expected/standalone_rst_latex.tex @@ -925,6 +925,24 @@ The legend may consist of several paragraphs. This paragraph might flow around the figure... +Now widths: + +An image 2 em wide: + +\includegraphics{../../../docs/user/rst/images/biohazard.png} + +An image 2 em wide and 30 pixel high: + +\includegraphics{../../../docs/user/rst/images/biohazard.png} + +An image occupying 70{\%} of the line width: + +\includegraphics{../../../docs/user/rst/images/biohazard.png} + +An image 3 cm high: + +\includegraphics{../../../docs/user/rst/images/biohazard.png} + %___________________________________________________________________________ diff --git a/test/functional/expected/standalone_rst_pseudoxml.txt b/test/functional/expected/standalone_rst_pseudoxml.txt index 62f923a03..d7f4d0103 100644 --- a/test/functional/expected/standalone_rst_pseudoxml.txt +++ b/test/functional/expected/standalone_rst_pseudoxml.txt @@ -1191,6 +1191,20 @@ The legend may consist of several paragraphs. <paragraph> This paragraph might flow around the figure... + <paragraph> + Now widths: + <paragraph> + An image 2 em wide: + <image uri="../../../docs/user/rst/images/biohazard.png" width="2em"> + <paragraph> + An image 2 em wide and 30 pixel high: + <image height="30px" uri="../../../docs/user/rst/images/biohazard.png" width="2em"> + <paragraph> + An image occupying 70% of the line width: + <image uri="../../../docs/user/rst/images/biohazard.png" width="70%"> + <paragraph> + An image 3 cm high: + <image height="3cm" uri="../../../docs/user/rst/images/biohazard.png"> <section ids="admonitions" names="admonitions"> <title auto="1" refid="id64"> <generated classes="sectnum"> diff --git a/test/functional/input/data/standard.txt b/test/functional/input/data/standard.txt index cfcc6e7f7..140be35c7 100644 --- a/test/functional/input/data/standard.txt +++ b/test/functional/input/data/standard.txt @@ -485,6 +485,30 @@ A left-aligned figure: This paragraph might flow around the figure... +Now widths: + +An image 2 em wide: + +.. image:: ../../../docs/user/rst/images/biohazard.png + :width: 2 em + +An image 2 em wide and 30 pixel high: + +.. image:: ../../../docs/user/rst/images/biohazard.png + :width: 2em + :height: 30 px + +An image occupying 70% of the line width: + +.. image:: ../../../docs/user/rst/images/biohazard.png + :width: 70% + +An image 3 cm high: + +.. image:: ../../../docs/user/rst/images/biohazard.png + :height: 3 cm + + Admonitions ``````````` diff --git a/test/test_parsers/test_rst/test_directives/test_images.py b/test/test_parsers/test_rst/test_directives/test_images.py index 3e0c89344..4e4c429f6 100755 --- a/test/test_parsers/test_rst/test_directives/test_images.py +++ b/test/test_parsers/test_rst/test_directives/test_images.py @@ -97,6 +97,42 @@ totest['images'] = [ <image height="100" scale="50" uri="a/very/long/path/to/picture.png" width="200"> """], ["""\ +.. image:: picture.png + :width: 200px + :height: 100 em +""", +"""\ +<document source="test data"> + <image height="100em" uri="picture.png" width="200px"> +"""], +["""\ +.. image:: picture.png + :width: 50% + :height: 10mm +""", +"""\ +<document source="test data"> + <image height="10mm" uri="picture.png" width="50%"> +"""], +["""\ +.. image:: picture.png + :width: 50% + :height: 40% +""", +"""\ +<document source="test data"> + <system_message level="3" line="1" source="test data" type="ERROR"> + <paragraph> + Error in "image" directive: + invalid option value: (option: "height"; value: \'40%\') + not a positive measure of one of the following units: + "em" "ex" "px" "in" "cm" "mm" "pt" "pc" "". + <literal_block xml:space="preserve"> + .. image:: picture.png + :width: 50% + :height: 40% +"""], +["""\ .. image:: picture.png :height: 100 :width: 200 -- cgit v1.2.1 From 21cbefe762f8fa767902ec12dfcd47b85638e24a Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Thu, 16 Jun 2005 23:45:08 +0000 Subject: fixed test case with broken path in test output; this fix is somewhat ugly, I admit git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3501 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../test_rst/test_directives/test_include.py | 36 +++++++++++++++++----- 1 file changed, 28 insertions(+), 8 deletions(-) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_directives/test_include.py b/test/test_parsers/test_rst/test_directives/test_include.py index 330dfd8c8..f7280a3d4 100755 --- a/test/test_parsers/test_rst/test_directives/test_include.py +++ b/test/test_parsers/test_rst/test_directives/test_include.py @@ -11,6 +11,7 @@ Tests for misc.py "include" directive. """ import os.path +import re import sys from __init__ import DocutilsTestSupport @@ -18,6 +19,9 @@ from __init__ import DocutilsTestSupport def suite(): s = DocutilsTestSupport.ParserTestSuite() s.generateTests(totest) + s.addTestCase( + SpecialIncludeTestCase, 'test_parser', + SpecialIncludeTestCase.input, SpecialIncludeTestCase.expected_regex) return s mydir = 'test_parsers/test_rst/test_directives/' @@ -373,23 +377,39 @@ Standard include data file: <substitution_definition names="b.gammad"> \\u03dd """], -["""\ +] + + +class SpecialIncludeTestCase(DocutilsTestSupport.ParserTestCase): + + def test_parser(self): + if self.run_in_debugger: + pdb.set_trace() + document = DocutilsTestSupport.utils.new_document( + 'test data', self.settings) + # Remove any additions made by "role" directives: + DocutilsTestSupport.roles._roles = {} + self.parser.parse(self.input, document) + output = document.pformat() + self.assert_(re.match(self.expected_regex, output), "Real output:\n" + + output + "\nExpected output:\n" + self.expected_regex) + + input = """\ Nonexistent standard include data file: .. include:: <nonexistent> -""", -"""\ -<document source="test data"> +""" + expected_regex = \ +r"""^<document source="test data"> <paragraph> Nonexistent standard include data file: <system_message level="4" line="3" source="test data" type="SEVERE"> <paragraph> Problems with "include" directive path: - IOError: [Errno 2] No such file or directory: '../docutils/parsers/rst/include/nonexistent'. + IOError: \[Errno 2\] No such file or directory: .*\. <literal_block xml:space="preserve"> - .. include:: <nonexistent> -"""], -] + \.\. include:: <nonexistent> +$""" # Skip tests whose output contains "UnicodeDecodeError" if we are not -- cgit v1.2.1 From 40318ee61cd1ad384d6ecae2ace8d3e734cfc7d7 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Fri, 17 Jun 2005 22:23:45 +0000 Subject: fixed path bug git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3508 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../test_rst/test_directives/test_include.py | 41 +++++++--------------- 1 file changed, 12 insertions(+), 29 deletions(-) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_directives/test_include.py b/test/test_parsers/test_rst/test_directives/test_include.py index f7280a3d4..cf6ada106 100755 --- a/test/test_parsers/test_rst/test_directives/test_include.py +++ b/test/test_parsers/test_rst/test_directives/test_include.py @@ -11,17 +11,14 @@ Tests for misc.py "include" directive. """ import os.path -import re import sys +from docutils.parsers.rst import states from __init__ import DocutilsTestSupport def suite(): s = DocutilsTestSupport.ParserTestSuite() s.generateTests(totest) - s.addTestCase( - SpecialIncludeTestCase, 'test_parser', - SpecialIncludeTestCase.input, SpecialIncludeTestCase.expected_regex) return s mydir = 'test_parsers/test_rst/test_directives/' @@ -36,8 +33,10 @@ include11 = os.path.join(mydir, 'include 11.txt') include11rel = DocutilsTestSupport.utils.relative_path(None, include11) utf_16_file = os.path.join(mydir, 'utf-16.csv') utf_16_file_rel = DocutilsTestSupport.utils.relative_path(None, utf_16_file) +nonexistent = os.path.join(os.path.dirname(states.__file__), + 'include', 'nonexistent') nonexistent_rel = DocutilsTestSupport.utils.relative_path( - None, '../docutils/parsers/rst/include/nonexistent') + os.path.join(DocutilsTestSupport.testroot, 'dummy'), nonexistent) totest = {} @@ -377,39 +376,23 @@ Standard include data file: <substitution_definition names="b.gammad"> \\u03dd """], -] - - -class SpecialIncludeTestCase(DocutilsTestSupport.ParserTestCase): - - def test_parser(self): - if self.run_in_debugger: - pdb.set_trace() - document = DocutilsTestSupport.utils.new_document( - 'test data', self.settings) - # Remove any additions made by "role" directives: - DocutilsTestSupport.roles._roles = {} - self.parser.parse(self.input, document) - output = document.pformat() - self.assert_(re.match(self.expected_regex, output), "Real output:\n" + - output + "\nExpected output:\n" + self.expected_regex) - - input = """\ +["""\ Nonexistent standard include data file: .. include:: <nonexistent> -""" - expected_regex = \ -r"""^<document source="test data"> +""", +"""\ +<document source="test data"> <paragraph> Nonexistent standard include data file: <system_message level="4" line="3" source="test data" type="SEVERE"> <paragraph> Problems with "include" directive path: - IOError: \[Errno 2\] No such file or directory: .*\. + IOError: [Errno 2] No such file or directory: '%s'. <literal_block xml:space="preserve"> - \.\. include:: <nonexistent> -$""" + .. include:: <nonexistent> +""" % nonexistent_rel], +] # Skip tests whose output contains "UnicodeDecodeError" if we are not -- cgit v1.2.1 From 0bb885fc5af28e2476186ce446ff991fe2f8438f Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Fri, 17 Jun 2005 22:24:13 +0000 Subject: fixed false assumption about path git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3509 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_parsers/__init__.py | 2 +- test/test_parsers/test_rst/__init__.py | 2 +- test/test_parsers/test_rst/test_directives/__init__.py | 2 +- test/test_readers/__init__.py | 2 +- test/test_readers/test_pep/__init__.py | 2 +- test/test_readers/test_python/__init__.py | 2 +- test/test_transforms/__init__.py | 2 +- test/test_writers/__init__.py | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) (limited to 'test') diff --git a/test/test_parsers/__init__.py b/test/test_parsers/__init__.py index 2fe79c55c..46fc50e06 100644 --- a/test/test_parsers/__init__.py +++ b/test/test_parsers/__init__.py @@ -2,7 +2,7 @@ import os import os.path import sys -sys.path.insert(0, os.path.abspath(os.curdir)) +sys.path.insert(0, os.path.abspath(os.path.dirname(__file__))) prev = '' while sys.path[0] != prev: try: diff --git a/test/test_parsers/test_rst/__init__.py b/test/test_parsers/test_rst/__init__.py index 2fe79c55c..46fc50e06 100644 --- a/test/test_parsers/test_rst/__init__.py +++ b/test/test_parsers/test_rst/__init__.py @@ -2,7 +2,7 @@ import os import os.path import sys -sys.path.insert(0, os.path.abspath(os.curdir)) +sys.path.insert(0, os.path.abspath(os.path.dirname(__file__))) prev = '' while sys.path[0] != prev: try: diff --git a/test/test_parsers/test_rst/test_directives/__init__.py b/test/test_parsers/test_rst/test_directives/__init__.py index 2fe79c55c..46fc50e06 100644 --- a/test/test_parsers/test_rst/test_directives/__init__.py +++ b/test/test_parsers/test_rst/test_directives/__init__.py @@ -2,7 +2,7 @@ import os import os.path import sys -sys.path.insert(0, os.path.abspath(os.curdir)) +sys.path.insert(0, os.path.abspath(os.path.dirname(__file__))) prev = '' while sys.path[0] != prev: try: diff --git a/test/test_readers/__init__.py b/test/test_readers/__init__.py index 2fe79c55c..46fc50e06 100644 --- a/test/test_readers/__init__.py +++ b/test/test_readers/__init__.py @@ -2,7 +2,7 @@ import os import os.path import sys -sys.path.insert(0, os.path.abspath(os.curdir)) +sys.path.insert(0, os.path.abspath(os.path.dirname(__file__))) prev = '' while sys.path[0] != prev: try: diff --git a/test/test_readers/test_pep/__init__.py b/test/test_readers/test_pep/__init__.py index 2fe79c55c..46fc50e06 100644 --- a/test/test_readers/test_pep/__init__.py +++ b/test/test_readers/test_pep/__init__.py @@ -2,7 +2,7 @@ import os import os.path import sys -sys.path.insert(0, os.path.abspath(os.curdir)) +sys.path.insert(0, os.path.abspath(os.path.dirname(__file__))) prev = '' while sys.path[0] != prev: try: diff --git a/test/test_readers/test_python/__init__.py b/test/test_readers/test_python/__init__.py index 2fe79c55c..46fc50e06 100644 --- a/test/test_readers/test_python/__init__.py +++ b/test/test_readers/test_python/__init__.py @@ -2,7 +2,7 @@ import os import os.path import sys -sys.path.insert(0, os.path.abspath(os.curdir)) +sys.path.insert(0, os.path.abspath(os.path.dirname(__file__))) prev = '' while sys.path[0] != prev: try: diff --git a/test/test_transforms/__init__.py b/test/test_transforms/__init__.py index 2fe79c55c..46fc50e06 100644 --- a/test/test_transforms/__init__.py +++ b/test/test_transforms/__init__.py @@ -2,7 +2,7 @@ import os import os.path import sys -sys.path.insert(0, os.path.abspath(os.curdir)) +sys.path.insert(0, os.path.abspath(os.path.dirname(__file__))) prev = '' while sys.path[0] != prev: try: diff --git a/test/test_writers/__init__.py b/test/test_writers/__init__.py index 2fe79c55c..46fc50e06 100644 --- a/test/test_writers/__init__.py +++ b/test/test_writers/__init__.py @@ -2,7 +2,7 @@ import os import os.path import sys -sys.path.insert(0, os.path.abspath(os.curdir)) +sys.path.insert(0, os.path.abspath(os.path.dirname(__file__))) prev = '' while sys.path[0] != prev: try: -- cgit v1.2.1 From d90d048247c7f3012414659a52078b6c8a89765f Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sun, 19 Jun 2005 14:51:42 +0000 Subject: added deactivation of config file reading (for easier testing) git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3511 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/DocutilsTestSupport.py | 35 ++++++++++++++++++++++------------ test/test_writers/test_docutils_xml.py | 6 ++---- 2 files changed, 25 insertions(+), 16 deletions(-) (limited to 'test') diff --git a/test/DocutilsTestSupport.py b/test/DocutilsTestSupport.py index d9f78f774..5aadf91bb 100644 --- a/test/DocutilsTestSupport.py +++ b/test/DocutilsTestSupport.py @@ -17,6 +17,7 @@ Exports the following: - `tableparser` is 'docutils.parsers.rst.tableparser' :Classes: + - `StandardTestCase` - `CustomTestCase` - `CustomTestSuite` - `TransformTestCase` @@ -88,16 +89,29 @@ class DevNull: pass -class CustomTestCase(unittest.TestCase): +class StandardTestCase(unittest.TestCase): + + """ + Helper class, providing the same interface as unittest.TestCase, + but with useful setUp and tearDown methods. + """ + + def setUp(self): + os.chdir(testroot) + frontend._globally_deactivate_config_files = 1 + + def tearDown(self): + frontend._globally_deactivate_config_files = 0 + + +class CustomTestCase(StandardTestCase): """ Helper class, providing extended functionality over unittest.TestCase. - This isn't specific to Docutils but of general use when dealing - with large amounts of text. The methods failUnlessEqual and - failIfEqual have been overwritten to provide better support for - multi-line strings. Furthermore, see the compare_output method - and the parameter list of __init__. + The methods failUnlessEqual and failIfEqual have been overwritten + to provide better support for multi-line strings. Furthermore, + see the compare_output method and the parameter list of __init__. """ compare = docutils_difflib.Differ().compare @@ -135,11 +149,11 @@ class CustomTestCase(unittest.TestCase): def compare_output(self, input, output, expected): """`input`, `output`, and `expected` should all be strings.""" - if type(input) == UnicodeType: + if isinstance(input, UnicodeType): input = input.encode('raw_unicode_escape') - if type(output) == UnicodeType: + if isinstance(output, UnicodeType): output = output.encode('raw_unicode_escape') - if type(expected) == UnicodeType: + if isinstance(expected, UnicodeType): expected = expected.encode('raw_unicode_escape') try: self.assertEquals(output, expected) @@ -167,9 +181,6 @@ class CustomTestCase(unittest.TestCase): raise self.failureException, \ (msg or '%s == %s' % _format_str(first, second)) - def setUp(self): - os.chdir(testroot) - # Synonyms for assertion methods assertEqual = assertEquals = failUnlessEqual diff --git a/test/test_writers/test_docutils_xml.py b/test/test_writers/test_docutils_xml.py index 26c842761..1b9790c6a 100755 --- a/test/test_writers/test_docutils_xml.py +++ b/test/test_writers/test_docutils_xml.py @@ -11,12 +11,13 @@ Test for docutils XML writer. """ import unittest +from __init__ import DocutilsTestSupport import docutils import docutils.core -class DocutilsXMLTestCase(unittest.TestCase, docutils.SettingsSpec): +class DocutilsXMLTestCase(DocutilsTestSupport.StandardTestCase): input = 'Test\n====\n\nSubsection\n----------\n\nTest\n\n----------\n\nTest.' xmldecl = '<?xml version="1.0" encoding="iso-8859-1"?>\n' @@ -27,8 +28,6 @@ class DocutilsXMLTestCase(unittest.TestCase, docutils.SettingsSpec): bodynewlines = '<document ids="test" names="test" source="<string>">\n<title>\nTest\n\n\nSubsection\n\n\nTest\n\n\n\nTest.\n\n\n' bodyindents = '\n \n Test\n \n \n Subsection\n \n \n Test\n \n \n \n Test.\n \n\n' - settings_default_overrides = {'_disable_config': 1} - def test_publish(self): settings = {'output_encoding': 'iso-8859-1'} for settings['newlines'] in 0, 1: @@ -53,7 +52,6 @@ class DocutilsXMLTestCase(unittest.TestCase, docutils.SettingsSpec): (source=self.input, reader_name='standalone', writer_name='docutils_xml', - settings_spec=self, settings_overrides=settings), expected) -- cgit v1.2.1 From b30cbb0571acc552f53b3021ad9c63508a14330c Mon Sep 17 00:00:00 2001 From: wiemann Date: Sun, 19 Jun 2005 15:26:13 +0000 Subject: made xmlcharrefreplace the default output encoding error handler for HTML and XML writer git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3512 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_writers/test_docutils_xml.py | 12 ++++++------ test/test_writers/test_html4css1.py | 16 ++++++++++++++++ 2 files changed, 22 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/test_writers/test_docutils_xml.py b/test/test_writers/test_docutils_xml.py index 1b9790c6a..f5cf18b3f 100755 --- a/test/test_writers/test_docutils_xml.py +++ b/test/test_writers/test_docutils_xml.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# -*- coding: utf-8 -*- # Author: Felix Wiemann # Contact: Felix_Wiemann@ososo.de @@ -19,17 +20,16 @@ import docutils.core class DocutilsXMLTestCase(DocutilsTestSupport.StandardTestCase): - input = 'Test\n====\n\nSubsection\n----------\n\nTest\n\n----------\n\nTest.' + input = 'Test\n====\n\nSubsection\n----------\n\nTest\n\n----------\n\nTest. äöü€' xmldecl = '\n' doctypedecl = '\n' generatedby = '\n' % docutils.__version__ - bodynormal = 'TestSubsectionTestTest.' - bodynormal = 'TestSubsectionTestTest.' - bodynewlines = '\n\nTest\n\n\nSubsection\n\n\nTest\n\n\n\nTest.\n\n\n' - bodyindents = '\n \n Test\n \n \n Subsection\n \n \n Test\n \n \n \n Test.\n \n\n' + bodynormal = 'TestSubsectionTestTest. \xe4\xf6\xfc€' + bodynewlines = '\n\nTest\n\n\nSubsection\n\n\nTest\n\n\n\nTest. \xe4\xf6\xfc€\n\n\n' + bodyindents = '\n \n Test\n \n \n Subsection\n \n \n Test\n \n \n \n Test. \xe4\xf6\xfc€\n \n\n' def test_publish(self): - settings = {'output_encoding': 'iso-8859-1'} + settings = {'input_encoding': 'utf8', 'output_encoding': 'iso-8859-1'} for settings['newlines'] in 0, 1: for settings['indents'] in 0, 1: for settings['xml_declaration'] in 0, 1: diff --git a/test/test_writers/test_html4css1.py b/test/test_writers/test_html4css1.py index 70d3be772..1cc15bd5e 100755 --- a/test/test_writers/test_html4css1.py +++ b/test/test_writers/test_html4css1.py @@ -1,4 +1,5 @@ #! /usr/bin/env python +# -*- coding: utf-8 -*- # Author: reggie dugard # Contact: reggie@users.sourceforge.net @@ -14,11 +15,16 @@ dictionaries (redundant), along with 'meta' and 'stylesheet' entries with standard values, and any entries with empty values. """ +from docutils import core + +import unittest from __init__ import DocutilsTestSupport def suite(): s = DocutilsTestSupport.HtmlPublishPartsTestSuite() s.generateTests(totest) + import test_html4css1 + s.addTest(unittest.defaultTestLoader.loadTestsFromModule(test_html4css1)) return s @@ -317,6 +323,16 @@ And even more stuff ]) +class EncodingTestCase(DocutilsTestSupport.StandardTestCase): + + def test_xmlcharrefreplace(self): + # Test that xmlcharrefreplace is the default output encoding + # error handler. + self.assert_('\xe4\xf6\xfc€' in core.publish_string( + 'äöü€', writer_name='html4css1', + settings_overrides={'output_encoding': 'latin1'})) + + if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') -- cgit v1.2.1 From 0b2a9c1f38b64f72e1d5e387bea0db076c1d8f13 Mon Sep 17 00:00:00 2001 From: wiemann Date: Sun, 19 Jun 2005 18:25:59 +0000 Subject: simplified test code git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3516 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/DocutilsTestSupport.py | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) (limited to 'test') diff --git a/test/DocutilsTestSupport.py b/test/DocutilsTestSupport.py index 5aadf91bb..e37d8698b 100644 --- a/test/DocutilsTestSupport.py +++ b/test/DocutilsTestSupport.py @@ -629,15 +629,19 @@ class PythonModuleParserTestSuite(CustomTestSuite): run_in_debugger=run_in_debugger) -class WriterPublishTestCase(CustomTestCase, docutils.SettingsSpec): +class WriterPublishTestCase(CustomTestCase): """ Test case for publish. """ - settings_default_overrides = {'_disable_config': 1, 'strict_visitor': 1} writer_name = '' # override in subclasses + def __init__(self, *args, **kwargs): + self.writer_name = kwargs['writer_name'] + del kwargs['writer_name'] + CustomTestCase.__init__(self, *args, **kwargs) + def test_publish(self): if self.run_in_debugger: pdb.set_trace() @@ -646,34 +650,19 @@ class WriterPublishTestCase(CustomTestCase, docutils.SettingsSpec): reader_name='standalone', parser_name='restructuredtext', writer_name=self.writer_name, - settings_spec=self) + settings_overrides={'strict_visitor': 1}) self.compare_output(self.input, output, self.expected) -class LatexWriterPublishTestCase(WriterPublishTestCase): - """Test case for Latex writer.""" - writer_name = 'latex' - - -class PseudoXMLWriterPublishTestCase(WriterPublishTestCase): - """Test case for pseudo-XML writer.""" - writer_name = 'pseudoxml' - - class PublishTestSuite(CustomTestSuite): - TEST_CLASSES = { - 'latex': LatexWriterPublishTestCase, - 'pseudoxml': PseudoXMLWriterPublishTestCase, - } - def __init__(self, writer_name): """ - `writer_name` is the name of the writer - to use. It must be a key in `TEST_CLASSES`. + `writer_name` is the name of the writer to use. """ CustomTestSuite.__init__(self) - self.test_class = self.TEST_CLASSES[writer_name] + self.test_class = WriterPublishTestCase + self.writer_name = writer_name def generateTests(self, dict, dictname='totest'): for name, cases in dict.items(): @@ -689,7 +678,9 @@ class PublishTestSuite(CustomTestSuite): self.test_class, 'test_publish', input=case[0], expected=case[1], id='%s[%r][%s]' % (dictname, name, casenum), - run_in_debugger=run_in_debugger) + run_in_debugger=run_in_debugger, + # Passed to constructor of self.test_class: + writer_name=self.writer_name) class HtmlPublishPartsTestSuite(CustomTestSuite): -- cgit v1.2.1 From 35f3e54cbfdeb7d4effa271bf0e7d07600ffd284 Mon Sep 17 00:00:00 2001 From: wiemann Date: Sun, 19 Jun 2005 18:31:28 +0000 Subject: fixed error git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3517 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/DocutilsTestSupport.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/DocutilsTestSupport.py b/test/DocutilsTestSupport.py index e37d8698b..3f459bebf 100644 --- a/test/DocutilsTestSupport.py +++ b/test/DocutilsTestSupport.py @@ -629,17 +629,19 @@ class PythonModuleParserTestSuite(CustomTestSuite): run_in_debugger=run_in_debugger) -class WriterPublishTestCase(CustomTestCase): +class WriterPublishTestCase(CustomTestCase, docutils.SettingsSpec): """ Test case for publish. """ - writer_name = '' # override in subclasses + settings_default_overrides = {'strict_visitor': 1} + writer_name = '' # set in subclasses or constructor def __init__(self, *args, **kwargs): - self.writer_name = kwargs['writer_name'] - del kwargs['writer_name'] + if kwargs.has_key('writer_name'): + self.writer_name = kwargs['writer_name'] + del kwargs['writer_name'] CustomTestCase.__init__(self, *args, **kwargs) def test_publish(self): @@ -650,7 +652,7 @@ class WriterPublishTestCase(CustomTestCase): reader_name='standalone', parser_name='restructuredtext', writer_name=self.writer_name, - settings_overrides={'strict_visitor': 1}) + settings_spec=self) self.compare_output(self.input, output, self.expected) -- cgit v1.2.1 From 441b917b41e9d168ad1d4150d2f46007623699b8 Mon Sep 17 00:00:00 2001 From: wiemann Date: Sun, 19 Jun 2005 18:31:40 +0000 Subject: made Null writer return an empty string git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3518 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_writers/test_null.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 test/test_writers/test_null.py (limited to 'test') diff --git a/test/test_writers/test_null.py b/test/test_writers/test_null.py new file mode 100755 index 000000000..9f8d8fe19 --- /dev/null +++ b/test/test_writers/test_null.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python + +# Author: Felix Wiemann +# Contact: Felix_Wiemann@ososo.de +# Revision: $Revision$ +# Date: $Date$ +# Copyright: This module has been placed in the public domain. + +""" +Test for Null writer. +""" + +from __init__ import DocutilsTestSupport + +def suite(): + s = DocutilsTestSupport.PublishTestSuite('null') + s.generateTests(totest) + return s + +totest = {} + +totest['basic'] = [ +["""\ +This is a paragraph. +""", +"""\ +"""] +] + +if __name__ == '__main__': + import unittest + unittest.main(defaultTest='suite') -- cgit v1.2.1 From f40247688ae8eb68afc4484ae1fbe9703e6e7590 Mon Sep 17 00:00:00 2001 From: wiemann Date: Mon, 20 Jun 2005 21:49:29 +0000 Subject: Py21 compatibility fix (usage of "in" operator for strings) git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3542 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_writers/test_html4css1.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/test_writers/test_html4css1.py b/test/test_writers/test_html4css1.py index 1cc15bd5e..15f5f26f6 100755 --- a/test/test_writers/test_html4css1.py +++ b/test/test_writers/test_html4css1.py @@ -328,9 +328,10 @@ class EncodingTestCase(DocutilsTestSupport.StandardTestCase): def test_xmlcharrefreplace(self): # Test that xmlcharrefreplace is the default output encoding # error handler. - self.assert_('\xe4\xf6\xfc€' in core.publish_string( - 'äöü€', writer_name='html4css1', - settings_overrides={'output_encoding': 'latin1'})) + self.assert_(core.publish_string( + 'äöü€', writer_name='html4css1', settings_overrides={ + 'output_encoding': 'latin1', 'stylesheet': None}).find( + '\xe4\xf6\xfc€') != -1) if __name__ == '__main__': -- cgit v1.2.1 From 5eb7b3b1420555500ad3e2c8756f683175d17699 Mon Sep 17 00:00:00 2001 From: wiemann Date: Mon, 20 Jun 2005 21:52:53 +0000 Subject: ensure that always a stylesheet path/URL is given; I've seen to many poor-looking documents on the web due to the missing stylesheet -- people seem to miss that quite frequently git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3543 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/DocutilsTestSupport.py | 4 ++++ test/functional/expected/dangerous.html | 2 +- test/functional/expected/field_name_limit.html | 2 +- test/functional/tests/dangerous.py | 2 ++ test/functional/tests/field_name_limit.py | 2 ++ 5 files changed, 10 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/DocutilsTestSupport.py b/test/DocutilsTestSupport.py index 3f459bebf..f1fa277a7 100644 --- a/test/DocutilsTestSupport.py +++ b/test/DocutilsTestSupport.py @@ -713,6 +713,10 @@ class HtmlWriterPublishPartsTestCase(WriterPublishTestCase): writer_name = 'html' + settings_default_overrides = \ + WriterPublishTestCase.settings_default_overrides.copy() + settings_default_overrides['stylesheet'] = None + def __init__(self, *args, **kwargs): self.settings_overrides = kwargs['settings_overrides'] """Settings overrides to use for this test case.""" diff --git a/test/functional/expected/dangerous.html b/test/functional/expected/dangerous.html index 779ea9479..9b9c321b6 100644 --- a/test/functional/expected/dangerous.html +++ b/test/functional/expected/dangerous.html @@ -5,7 +5,7 @@ - +
      diff --git a/test/functional/expected/field_name_limit.html b/test/functional/expected/field_name_limit.html index 3b8b36a89..736b8b98b 100644 --- a/test/functional/expected/field_name_limit.html +++ b/test/functional/expected/field_name_limit.html @@ -5,7 +5,7 @@ - +
      diff --git a/test/functional/tests/dangerous.py b/test/functional/tests/dangerous.py index 620a927ba..5611268eb 100644 --- a/test/functional/tests/dangerous.py +++ b/test/functional/tests/dangerous.py @@ -10,3 +10,5 @@ writer_name = "html" # Settings settings_overrides['file_insertion_enabled'] = 0 settings_overrides['raw_enabled'] = 0 +settings_overrides['stylesheet'] = None +settings_overrides['stylesheet_path'] = "../tools/stylesheets/default.css" diff --git a/test/functional/tests/field_name_limit.py b/test/functional/tests/field_name_limit.py index db79d4c67..86ad59a46 100644 --- a/test/functional/tests/field_name_limit.py +++ b/test/functional/tests/field_name_limit.py @@ -10,3 +10,5 @@ writer_name = "html" # Settings settings_overrides['field_name_limit'] = 0 # no limit settings_overrides['docinfo_xform'] = 0 +settings_overrides['stylesheet'] = None +settings_overrides['stylesheet_path'] = "../tools/stylesheets/default.css" -- cgit v1.2.1 From 703c9a840cb8c0538326fe6b95c7393d9e0bf909 Mon Sep 17 00:00:00 2001 From: wiemann Date: Mon, 20 Jun 2005 22:38:19 +0000 Subject: fixed tests git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3548 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/tests/_default.py | 1 + test/test_dependencies.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/functional/tests/_default.py b/test/functional/tests/_default.py index 63e82451a..2835c5b2e 100644 --- a/test/functional/tests/_default.py +++ b/test/functional/tests/_default.py @@ -4,3 +4,4 @@ settings_overrides['report_level'] = 2 settings_overrides['halt_level'] = 5 settings_overrides['warning_stream'] = '' settings_overrides['input_encoding'] = 'utf-8' +settings_overrides['embed_stylesheet'] = 0 diff --git a/test/test_dependencies.py b/test/test_dependencies.py index 61d19a6f2..c9f00518d 100755 --- a/test/test_dependencies.py +++ b/test/test_dependencies.py @@ -56,10 +56,10 @@ class RecordDependenciesTests(unittest.TestCase): pass def test_stylesheet_dependencies(self): - # Parameters to publish_file. s = {'settings_overrides': {}} so = s['settings_overrides'] + so['embed_stylesheet'] = 0 so['stylesheet_path'] = 'stylesheet.txt' so['stylesheet'] = None s['writer_name'] = 'html' -- cgit v1.2.1 From c04ee4d9948a2854fd9ea96eb9f1e22f56be29d5 Mon Sep 17 00:00:00 2001 From: wiemann Date: Tue, 21 Jun 2005 00:11:44 +0000 Subject: issue a warning rather than an error when no stylesheet is given; default for "stylesheet" is now None, not -1 git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3549 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/DocutilsTestSupport.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/DocutilsTestSupport.py b/test/DocutilsTestSupport.py index f1fa277a7..5452f1929 100644 --- a/test/DocutilsTestSupport.py +++ b/test/DocutilsTestSupport.py @@ -715,7 +715,7 @@ class HtmlWriterPublishPartsTestCase(WriterPublishTestCase): settings_default_overrides = \ WriterPublishTestCase.settings_default_overrides.copy() - settings_default_overrides['stylesheet'] = None + settings_default_overrides['stylesheet'] = '' def __init__(self, *args, **kwargs): self.settings_overrides = kwargs['settings_overrides'] -- cgit v1.2.1 From 65c38ac0991dd6a6dac04fd7fffa8b940188d2f6 Mon Sep 17 00:00:00 2001 From: wiemann Date: Tue, 21 Jun 2005 00:16:59 +0000 Subject: again a broken test; I should really rerun the test suite before committing changes git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3550 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_writers/test_html4css1.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/test_writers/test_html4css1.py b/test/test_writers/test_html4css1.py index 15f5f26f6..51b47f81b 100755 --- a/test/test_writers/test_html4css1.py +++ b/test/test_writers/test_html4css1.py @@ -330,7 +330,7 @@ class EncodingTestCase(DocutilsTestSupport.StandardTestCase): # error handler. self.assert_(core.publish_string( 'äöü€', writer_name='html4css1', settings_overrides={ - 'output_encoding': 'latin1', 'stylesheet': None}).find( + 'output_encoding': 'latin1', 'stylesheet': ''}).find( '\xe4\xf6\xfc€') != -1) -- cgit v1.2.1 From 25934f67bf5d516f1bcdb32cc4d770f5d479d6fc Mon Sep 17 00:00:00 2001 From: goodger Date: Thu, 23 Jun 2005 17:35:19 +0000 Subject: removed docutils.frontend._globally_deactivate_config_files (reverting much of rev. 3511), since it duplicates settings._disable_config functionality git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3567 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/DocutilsTestSupport.py | 7 ++----- test/test_writers/test_docutils_xml.py | 4 +++- test/test_writers/test_html4css1.py | 13 ++++++++----- 3 files changed, 13 insertions(+), 11 deletions(-) (limited to 'test') diff --git a/test/DocutilsTestSupport.py b/test/DocutilsTestSupport.py index 5452f1929..32c263982 100644 --- a/test/DocutilsTestSupport.py +++ b/test/DocutilsTestSupport.py @@ -98,10 +98,6 @@ class StandardTestCase(unittest.TestCase): def setUp(self): os.chdir(testroot) - frontend._globally_deactivate_config_files = 1 - - def tearDown(self): - frontend._globally_deactivate_config_files = 0 class CustomTestCase(StandardTestCase): @@ -635,7 +631,8 @@ class WriterPublishTestCase(CustomTestCase, docutils.SettingsSpec): Test case for publish. """ - settings_default_overrides = {'strict_visitor': 1} + settings_default_overrides = {'_disable_config': 1, + 'strict_visitor': 1} writer_name = '' # set in subclasses or constructor def __init__(self, *args, **kwargs): diff --git a/test/test_writers/test_docutils_xml.py b/test/test_writers/test_docutils_xml.py index f5cf18b3f..c46c472a8 100755 --- a/test/test_writers/test_docutils_xml.py +++ b/test/test_writers/test_docutils_xml.py @@ -29,7 +29,9 @@ class DocutilsXMLTestCase(DocutilsTestSupport.StandardTestCase): bodyindents = '\n \n Test\n \n \n Subsection\n \n \n Test\n \n \n \n Test. \xe4\xf6\xfc€\n \n\n' def test_publish(self): - settings = {'input_encoding': 'utf8', 'output_encoding': 'iso-8859-1'} + settings = {'input_encoding': 'utf8', + 'output_encoding': 'iso-8859-1', + '_disable_config': 1} for settings['newlines'] in 0, 1: for settings['indents'] in 0, 1: for settings['xml_declaration'] in 0, 1: diff --git a/test/test_writers/test_html4css1.py b/test/test_writers/test_html4css1.py index 51b47f81b..c3c69af08 100755 --- a/test/test_writers/test_html4css1.py +++ b/test/test_writers/test_html4css1.py @@ -328,12 +328,15 @@ class EncodingTestCase(DocutilsTestSupport.StandardTestCase): def test_xmlcharrefreplace(self): # Test that xmlcharrefreplace is the default output encoding # error handler. - self.assert_(core.publish_string( - 'äöü€', writer_name='html4css1', settings_overrides={ - 'output_encoding': 'latin1', 'stylesheet': ''}).find( - '\xe4\xf6\xfc€') != -1) + settings_overrides={ + 'output_encoding': 'latin1', + 'stylesheet': '', + '_disable_config': 1} + result = core.publish_string( + 'äöü€', writer_name='html4css1', + settings_overrides=settings_overrides) + self.assert_(result.find('\xe4\xf6\xfc€') != -1) if __name__ == '__main__': - import unittest unittest.main(defaultTest='suite') -- cgit v1.2.1 From 09591364de69c1795067989feff7d328cedfc9a5 Mon Sep 17 00:00:00 2001 From: goodger Date: Thu, 23 Jun 2005 17:56:05 +0000 Subject: moved import to guarded area git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3569 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_writers/test_docutils_xml.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/test_writers/test_docutils_xml.py b/test/test_writers/test_docutils_xml.py index c46c472a8..f11b620f4 100755 --- a/test/test_writers/test_docutils_xml.py +++ b/test/test_writers/test_docutils_xml.py @@ -11,7 +11,6 @@ Test for docutils XML writer. """ -import unittest from __init__ import DocutilsTestSupport import docutils @@ -59,4 +58,5 @@ class DocutilsXMLTestCase(DocutilsTestSupport.StandardTestCase): if __name__ == '__main__': + import unittest unittest.main() -- cgit v1.2.1 From 04e690ceca66ae968d84e4689b91cac93828a195 Mon Sep 17 00:00:00 2001 From: goodger Date: Thu, 23 Jun 2005 17:56:44 +0000 Subject: separated different types of tests git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3570 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_writers/test_html4css1.py | 22 ++------------------ test/test_writers/test_html4css1_misc.py | 35 ++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 20 deletions(-) create mode 100644 test/test_writers/test_html4css1_misc.py (limited to 'test') diff --git a/test/test_writers/test_html4css1.py b/test/test_writers/test_html4css1.py index c3c69af08..6ce0c15cd 100755 --- a/test/test_writers/test_html4css1.py +++ b/test/test_writers/test_html4css1.py @@ -15,16 +15,12 @@ dictionaries (redundant), along with 'meta' and 'stylesheet' entries with standard values, and any entries with empty values. """ -from docutils import core - -import unittest from __init__ import DocutilsTestSupport +from docutils import core def suite(): s = DocutilsTestSupport.HtmlPublishPartsTestSuite() s.generateTests(totest) - import test_html4css1 - s.addTest(unittest.defaultTestLoader.loadTestsFromModule(test_html4css1)) return s @@ -323,20 +319,6 @@ And even more stuff ]) -class EncodingTestCase(DocutilsTestSupport.StandardTestCase): - - def test_xmlcharrefreplace(self): - # Test that xmlcharrefreplace is the default output encoding - # error handler. - settings_overrides={ - 'output_encoding': 'latin1', - 'stylesheet': '', - '_disable_config': 1} - result = core.publish_string( - 'äöü€', writer_name='html4css1', - settings_overrides=settings_overrides) - self.assert_(result.find('\xe4\xf6\xfc€') != -1) - - if __name__ == '__main__': + import unittest unittest.main(defaultTest='suite') diff --git a/test/test_writers/test_html4css1_misc.py b/test/test_writers/test_html4css1_misc.py new file mode 100644 index 000000000..df07a7bd5 --- /dev/null +++ b/test/test_writers/test_html4css1_misc.py @@ -0,0 +1,35 @@ +#! /usr/bin/env python +# -*- coding: utf-8 -*- + +# Author: Felix Wiemann +# Contact: Felix_Wiemann@ososo.de +# Revision: $Revision$ +# Date: $Date$ +# Copyright: This module has been placed in the public domain. + +""" +Miscellaneous HTML writer tests. +""" + +from __init__ import DocutilsTestSupport +from docutils import core + + +class EncodingTestCase(DocutilsTestSupport.StandardTestCase): + + def test_xmlcharrefreplace(self): + # Test that xmlcharrefreplace is the default output encoding + # error handler. + settings_overrides={ + 'output_encoding': 'latin1', + 'stylesheet': '', + '_disable_config': 1} + result = core.publish_string( + 'äöü€', writer_name='html4css1', + settings_overrides=settings_overrides) + self.assert_(result.find('\xe4\xf6\xfc€') != -1) + + +if __name__ == '__main__': + import unittest + unittest.main() -- cgit v1.2.1 From 23466c11fa5196e68efaa4336e18b61b0ff1cb1a Mon Sep 17 00:00:00 2001 From: goodger Date: Fri, 24 Jun 2005 19:16:15 +0000 Subject: executable git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3574 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_writers/test_html4css1_misc.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 test/test_writers/test_html4css1_misc.py (limited to 'test') diff --git a/test/test_writers/test_html4css1_misc.py b/test/test_writers/test_html4css1_misc.py old mode 100644 new mode 100755 -- cgit v1.2.1 From 835cd6732507e8e4c76b0ef437bcc74177a9d174 Mon Sep 17 00:00:00 2001 From: wiemann Date: Sun, 26 Jun 2005 22:20:27 +0000 Subject: merge trunk/docutils@3525 branches/blais_interrupt_render/docutils@HEAD trunk/docutils git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3581 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_publish_doctree.py | 50 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100755 test/test_publish_doctree.py (limited to 'test') diff --git a/test/test_publish_doctree.py b/test/test_publish_doctree.py new file mode 100755 index 000000000..20b3cff79 --- /dev/null +++ b/test/test_publish_doctree.py @@ -0,0 +1,50 @@ +#!/usr/bin/env python + +# Author: Martin Blais +# Contact: blais@furius.ca +# Revision: $Revision$ +# Date: $Date$ +# Copyright: This module has been placed in the public domain. + +""" +Perform tests with publishing to a tree, and running a writer on that tree later. +""" + +import unittest +from types import DictType, StringType +import docutils.core +import docutils.nodes + + +test_document = """\ +Test Document +============= + +This is a test document. +""" + + +class PublishDoctreeTestCase(unittest.TestCase): + + def test_publish_doctree(self): + """Test publish_doctree and publish_from_doctree.""" + # Produce the document tree. + doctree, parts = docutils.core.publish_doctree( + source=test_document, + reader_name='standalone', + parser_name='restructuredtext', + settings_overrides={'_disable_config': 1}) + + self.assert_(isinstance(doctree, docutils.nodes.document)) + self.assert_(isinstance(parts, DictType)) + + # Write out the document. + output, parts = docutils.core.publish_from_doctree( + doctree, writer_name='pseudoxml') + + self.assert_(isinstance(output, StringType)) + assert isinstance(parts, dict) + + +if __name__ == '__main__': + unittest.main() -- cgit v1.2.1 From 35e38fe655db71e85b67c962d854eaab5f764608 Mon Sep 17 00:00:00 2001 From: wiemann Date: Sun, 26 Jun 2005 22:54:57 +0000 Subject: removed duplicate publish_doctree method; renamed publish_from_doctree to publish_doctree git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3585 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_publish_doctree.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/test_publish_doctree.py b/test/test_publish_doctree.py index 20b3cff79..d2b88b4ee 100755 --- a/test/test_publish_doctree.py +++ b/test/test_publish_doctree.py @@ -27,7 +27,7 @@ This is a test document. class PublishDoctreeTestCase(unittest.TestCase): def test_publish_doctree(self): - """Test publish_doctree and publish_from_doctree.""" + """Test publish_doctree and publish_doctree.""" # Produce the document tree. doctree, parts = docutils.core.publish_doctree( source=test_document, @@ -39,11 +39,11 @@ class PublishDoctreeTestCase(unittest.TestCase): self.assert_(isinstance(parts, DictType)) # Write out the document. - output, parts = docutils.core.publish_from_doctree( + output, parts = docutils.core.publish_doctree( doctree, writer_name='pseudoxml') self.assert_(isinstance(output, StringType)) - assert isinstance(parts, dict) + assert isinstance(parts, DictType) if __name__ == '__main__': -- cgit v1.2.1 From 86b1889e15d3cdbc3115746534623627e0c9edc2 Mon Sep 17 00:00:00 2001 From: wiemann Date: Sun, 26 Jun 2005 23:01:45 +0000 Subject: oh, publish_doctree was not a duplicate... 8-) git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3586 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_publish_doctree.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/test_publish_doctree.py b/test/test_publish_doctree.py index d2b88b4ee..3c37e45cf 100755 --- a/test/test_publish_doctree.py +++ b/test/test_publish_doctree.py @@ -27,7 +27,7 @@ This is a test document. class PublishDoctreeTestCase(unittest.TestCase): def test_publish_doctree(self): - """Test publish_doctree and publish_doctree.""" + """Test `publish_doctree` and `publish_from_doctree`.""" # Produce the document tree. doctree, parts = docutils.core.publish_doctree( source=test_document, @@ -39,7 +39,7 @@ class PublishDoctreeTestCase(unittest.TestCase): self.assert_(isinstance(parts, DictType)) # Write out the document. - output, parts = docutils.core.publish_doctree( + output, parts = docutils.core.publish_from_doctree( doctree, writer_name='pseudoxml') self.assert_(isinstance(output, StringType)) -- cgit v1.2.1 From 38e233c4e2d2e1736af4b4938d622e358204e564 Mon Sep 17 00:00:00 2001 From: wiemann Date: Sun, 26 Jun 2005 23:09:59 +0000 Subject: publish_doctree now returns only the doctree, not an empty (useless) "parts" dictionary; polished git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3587 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_publish_doctree.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'test') diff --git a/test/test_publish_doctree.py b/test/test_publish_doctree.py index 3c37e45cf..32f40d9ca 100755 --- a/test/test_publish_doctree.py +++ b/test/test_publish_doctree.py @@ -29,14 +29,13 @@ class PublishDoctreeTestCase(unittest.TestCase): def test_publish_doctree(self): """Test `publish_doctree` and `publish_from_doctree`.""" # Produce the document tree. - doctree, parts = docutils.core.publish_doctree( + doctree = docutils.core.publish_doctree( source=test_document, reader_name='standalone', parser_name='restructuredtext', settings_overrides={'_disable_config': 1}) self.assert_(isinstance(doctree, docutils.nodes.document)) - self.assert_(isinstance(parts, DictType)) # Write out the document. output, parts = docutils.core.publish_from_doctree( -- cgit v1.2.1 From 180de2ad7ed7e496b973c1715789986ac1d3bdfc Mon Sep 17 00:00:00 2001 From: wiemann Date: Mon, 27 Jun 2005 02:44:40 +0000 Subject: replaced data argument to Transform constructor with **kwargs; Transform.data contains now the kwargs dictionary; added transform instance to Transformer.applied tuples again -- this shouldn't cause problems with pickling because the Transformer isn't pickled; if it does cause any problems, please follow up on Docutils-develop git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3596 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms.py | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100755 test/test_transforms.py (limited to 'test') diff --git a/test/test_transforms.py b/test/test_transforms.py new file mode 100755 index 000000000..3356cb05f --- /dev/null +++ b/test/test_transforms.py @@ -0,0 +1,39 @@ +#! /usr/bin/env python + +# Author: Felix Wiemann +# Contact: Felix_Wiemann@ososo.de +# Revision: $Revision$ +# Date: $Date$ +# Copyright: This module has been placed in the public domain. + +""" +Test module for transforms/__init__.py. +""" + +from docutils import transforms, utils + +import unittest + +class TestTransform(transforms.Transform): + + default_priority = 100 + + applied = 0 + def apply(self): + self.applied += 1 + +class KwargsTestCase(unittest.TestCase): + + def test_kwargs(self): + transformer = transforms.Transformer(utils.new_document('test data')) + transformer.add_transform(TestTransform, foo=42) + transformer.apply_transforms() + self.assertEqual(len(transformer.applied), 1) + self.assertEqual(len(transformer.applied[0]), 4) + transform = transformer.applied[0][0] + self.assertEqual(transform.__class__, TestTransform) + self.assertEqual(transform.data, {'foo': 42}) + + +if __name__ == '__main__': + unittest.main() -- cgit v1.2.1 From 44460ad0092895cb934afef3caac756500397a18 Mon Sep 17 00:00:00 2001 From: wiemann Date: Mon, 27 Jun 2005 12:28:56 +0000 Subject: renamed test_publish_doctree.py to more generic test_publisher.py; polished git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3602 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_publish_doctree.py | 49 ----------------------------------------- test/test_publisher.py | 52 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 49 deletions(-) delete mode 100755 test/test_publish_doctree.py create mode 100755 test/test_publisher.py (limited to 'test') diff --git a/test/test_publish_doctree.py b/test/test_publish_doctree.py deleted file mode 100755 index 32f40d9ca..000000000 --- a/test/test_publish_doctree.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env python - -# Author: Martin Blais -# Contact: blais@furius.ca -# Revision: $Revision$ -# Date: $Date$ -# Copyright: This module has been placed in the public domain. - -""" -Perform tests with publishing to a tree, and running a writer on that tree later. -""" - -import unittest -from types import DictType, StringType -import docutils.core -import docutils.nodes - - -test_document = """\ -Test Document -============= - -This is a test document. -""" - - -class PublishDoctreeTestCase(unittest.TestCase): - - def test_publish_doctree(self): - """Test `publish_doctree` and `publish_from_doctree`.""" - # Produce the document tree. - doctree = docutils.core.publish_doctree( - source=test_document, - reader_name='standalone', - parser_name='restructuredtext', - settings_overrides={'_disable_config': 1}) - - self.assert_(isinstance(doctree, docutils.nodes.document)) - - # Write out the document. - output, parts = docutils.core.publish_from_doctree( - doctree, writer_name='pseudoxml') - - self.assert_(isinstance(output, StringType)) - assert isinstance(parts, DictType) - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_publisher.py b/test/test_publisher.py new file mode 100755 index 000000000..d62c320f6 --- /dev/null +++ b/test/test_publisher.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python + +# Author: Martin Blais +# Contact: blais@furius.ca +# Revision: $Revision$ +# Date: $Date$ +# Copyright: This module has been placed in the public domain. + +""" +Test the `Publisher` facade and the ``publish_*`` convenience functions. +""" + +import unittest +from types import DictType, StringType +from docutils import core, nodes + + +test_document = """\ +Test Document +============= + +This is a test document. +""" + + +class PublishDoctreeTestCase(unittest.TestCase): + + def test_publish_doctree(self): + """Test `publish_doctree` and `publish_from_doctree`.""" + # Produce the document tree. + doctree = core.publish_doctree( + source=test_document, + reader_name='standalone', + parser_name='restructuredtext', + settings_overrides={'_disable_config': 1}) + + self.assert_(isinstance(doctree, nodes.document)) + # Assert transforms have been applied (in this case the + # DocTitle transform). + self.assert_(isinstance(doctree[0], nodes.title)) + self.assert_(isinstance(doctree[1], nodes.paragraph)) + + # Write out the document. + output, parts = core.publish_from_doctree( + doctree, writer_name='pseudoxml') + + self.assert_(isinstance(output, StringType)) + assert isinstance(parts, DictType) + + +if __name__ == '__main__': + unittest.main() -- cgit v1.2.1 From 133e6176272678623431d07c7187147ec8172150 Mon Sep 17 00:00:00 2001 From: wiemann Date: Mon, 27 Jun 2005 12:47:29 +0000 Subject: added note about slowdown git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3603 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/coverage.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/coverage.sh b/test/coverage.sh index e2005448d..3edea0e2a 100755 --- a/test/coverage.sh +++ b/test/coverage.sh @@ -15,7 +15,10 @@ fi if test "$1"; then proj="$1" fi -echo Performing code coverage test for project \""$proj"\"... +echo "Performing code coverage test for project \"$proj\"..." +echo +echo "Please be patient; coverage tracking slows test execution down by more" +echo "than factor 10." echo cd test rm -rf cover -- cgit v1.2.1 From 40f643d01a54d73857a7a6fadd64794d654fcde4 Mon Sep 17 00:00:00 2001 From: wiemann Date: Mon, 27 Jun 2005 14:21:27 +0000 Subject: pass kwargs as single parameter to add_transform; to not pass on the kwargs to Transform.__init__ but to Transform.apply git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3604 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/test_transforms.py b/test/test_transforms.py index 3356cb05f..450c4e498 100755 --- a/test/test_transforms.py +++ b/test/test_transforms.py @@ -19,20 +19,22 @@ class TestTransform(transforms.Transform): default_priority = 100 applied = 0 - def apply(self): + + def apply(self, **kwargs): self.applied += 1 + self.kwargs = kwargs class KwargsTestCase(unittest.TestCase): def test_kwargs(self): transformer = transforms.Transformer(utils.new_document('test data')) - transformer.add_transform(TestTransform, foo=42) + transformer.add_transform(TestTransform, kwargs={'foo': 42}) transformer.apply_transforms() self.assertEqual(len(transformer.applied), 1) self.assertEqual(len(transformer.applied[0]), 4) transform = transformer.applied[0][0] self.assertEqual(transform.__class__, TestTransform) - self.assertEqual(transform.data, {'foo': 42}) + self.assertEqual(transform.kwargs, {'foo': 42}) if __name__ == '__main__': -- cgit v1.2.1 From 8e3d3b9a20ccb700b2269885de7daa65d45c797f Mon Sep 17 00:00:00 2001 From: wiemann Date: Mon, 27 Jun 2005 20:29:10 +0000 Subject: added assert to get a helpful error message when passing things like "writer='html'" to publish_* git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3606 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'test') diff --git a/test/test_transforms.py b/test/test_transforms.py index 450c4e498..12780ee29 100755 --- a/test/test_transforms.py +++ b/test/test_transforms.py @@ -14,6 +14,7 @@ from docutils import transforms, utils import unittest + class TestTransform(transforms.Transform): default_priority = 100 @@ -24,6 +25,7 @@ class TestTransform(transforms.Transform): self.applied += 1 self.kwargs = kwargs + class KwargsTestCase(unittest.TestCase): def test_kwargs(self): -- cgit v1.2.1 From 327bdfb407e87fb085488a17fb9e8d0a17a4c8e8 Mon Sep 17 00:00:00 2001 From: goodger Date: Mon, 27 Jun 2005 21:01:17 +0000 Subject: Pythonicized kwargs --dump-transforms git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3609 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/test_transforms.py b/test/test_transforms.py index 12780ee29..6ea982d2e 100755 --- a/test/test_transforms.py +++ b/test/test_transforms.py @@ -11,7 +11,6 @@ Test module for transforms/__init__.py. """ from docutils import transforms, utils - import unittest @@ -30,13 +29,13 @@ class KwargsTestCase(unittest.TestCase): def test_kwargs(self): transformer = transforms.Transformer(utils.new_document('test data')) - transformer.add_transform(TestTransform, kwargs={'foo': 42}) + transformer.add_transform(TestTransform, foo=42) transformer.apply_transforms() self.assertEqual(len(transformer.applied), 1) self.assertEqual(len(transformer.applied[0]), 4) - transform = transformer.applied[0][0] - self.assertEqual(transform.__class__, TestTransform) - self.assertEqual(transform.kwargs, {'foo': 42}) + transform_record = transformer.applied[0] + self.assertEqual(transform_record[1], TestTransform) + self.assertEqual(transform_record[3], {'foo': 42}) if __name__ == '__main__': -- cgit v1.2.1 From 7d0ef2330d86d0f0e06e5287296de625d44b0836 Mon Sep 17 00:00:00 2001 From: goodger Date: Mon, 27 Jun 2005 21:02:29 +0000 Subject: moved & renamed to remove overlap between file & directory/package git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3610 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms.py | 42 ----------------------------------- test/test_transforms/test___init__.py | 42 +++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 42 deletions(-) delete mode 100755 test/test_transforms.py create mode 100755 test/test_transforms/test___init__.py (limited to 'test') diff --git a/test/test_transforms.py b/test/test_transforms.py deleted file mode 100755 index 6ea982d2e..000000000 --- a/test/test_transforms.py +++ /dev/null @@ -1,42 +0,0 @@ -#! /usr/bin/env python - -# Author: Felix Wiemann -# Contact: Felix_Wiemann@ososo.de -# Revision: $Revision$ -# Date: $Date$ -# Copyright: This module has been placed in the public domain. - -""" -Test module for transforms/__init__.py. -""" - -from docutils import transforms, utils -import unittest - - -class TestTransform(transforms.Transform): - - default_priority = 100 - - applied = 0 - - def apply(self, **kwargs): - self.applied += 1 - self.kwargs = kwargs - - -class KwargsTestCase(unittest.TestCase): - - def test_kwargs(self): - transformer = transforms.Transformer(utils.new_document('test data')) - transformer.add_transform(TestTransform, foo=42) - transformer.apply_transforms() - self.assertEqual(len(transformer.applied), 1) - self.assertEqual(len(transformer.applied[0]), 4) - transform_record = transformer.applied[0] - self.assertEqual(transform_record[1], TestTransform) - self.assertEqual(transform_record[3], {'foo': 42}) - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_transforms/test___init__.py b/test/test_transforms/test___init__.py new file mode 100755 index 000000000..6ea982d2e --- /dev/null +++ b/test/test_transforms/test___init__.py @@ -0,0 +1,42 @@ +#! /usr/bin/env python + +# Author: Felix Wiemann +# Contact: Felix_Wiemann@ososo.de +# Revision: $Revision$ +# Date: $Date$ +# Copyright: This module has been placed in the public domain. + +""" +Test module for transforms/__init__.py. +""" + +from docutils import transforms, utils +import unittest + + +class TestTransform(transforms.Transform): + + default_priority = 100 + + applied = 0 + + def apply(self, **kwargs): + self.applied += 1 + self.kwargs = kwargs + + +class KwargsTestCase(unittest.TestCase): + + def test_kwargs(self): + transformer = transforms.Transformer(utils.new_document('test data')) + transformer.add_transform(TestTransform, foo=42) + transformer.apply_transforms() + self.assertEqual(len(transformer.applied), 1) + self.assertEqual(len(transformer.applied[0]), 4) + transform_record = transformer.applied[0] + self.assertEqual(transform_record[1], TestTransform) + self.assertEqual(transform_record[3], {'foo': 42}) + + +if __name__ == '__main__': + unittest.main() -- cgit v1.2.1 From 93fbf6330205a3d66a55d4ed57b5f183528ac111 Mon Sep 17 00:00:00 2001 From: wiemann Date: Mon, 27 Jun 2005 22:05:07 +0000 Subject: added assert to make sure the kwargs get passed to apply() git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3613 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms/test___init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/test_transforms/test___init__.py b/test/test_transforms/test___init__.py index 6ea982d2e..a126d8854 100755 --- a/test/test_transforms/test___init__.py +++ b/test/test_transforms/test___init__.py @@ -22,7 +22,7 @@ class TestTransform(transforms.Transform): def apply(self, **kwargs): self.applied += 1 - self.kwargs = kwargs + assert kwargs == {'foo': 42} class KwargsTestCase(unittest.TestCase): -- cgit v1.2.1 From fb247a2c98d8fffdca2a6ede5235f1b9e28a27ae Mon Sep 17 00:00:00 2001 From: goodger Date: Tue, 28 Jun 2005 13:49:10 +0000 Subject: Added ``_stylesheet_required`` internal setting, docutils.transforms.html.StylesheetCheck transform, docs, tests, and support. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3617 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/DocutilsTestSupport.py | 1 + test/functional/tests/_default.py | 1 + test/test_dependencies.py | 1 + test/test_writers/test_html4css1_misc.py | 3 ++- 4 files changed, 5 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/DocutilsTestSupport.py b/test/DocutilsTestSupport.py index 32c263982..72d5cdbc2 100644 --- a/test/DocutilsTestSupport.py +++ b/test/DocutilsTestSupport.py @@ -632,6 +632,7 @@ class WriterPublishTestCase(CustomTestCase, docutils.SettingsSpec): """ settings_default_overrides = {'_disable_config': 1, + '_stylesheet_required': 0, 'strict_visitor': 1} writer_name = '' # set in subclasses or constructor diff --git a/test/functional/tests/_default.py b/test/functional/tests/_default.py index 2835c5b2e..4c72c04c8 100644 --- a/test/functional/tests/_default.py +++ b/test/functional/tests/_default.py @@ -5,3 +5,4 @@ settings_overrides['halt_level'] = 5 settings_overrides['warning_stream'] = '' settings_overrides['input_encoding'] = 'utf-8' settings_overrides['embed_stylesheet'] = 0 +settings_overrides['_stylesheet_required'] = 0 diff --git a/test/test_dependencies.py b/test/test_dependencies.py index c9f00518d..e1ccc24ef 100755 --- a/test/test_dependencies.py +++ b/test/test_dependencies.py @@ -30,6 +30,7 @@ class RecordDependenciesTests(unittest.TestCase): settings.setdefault('settings_overrides', {}) settings['settings_overrides'] = settings['settings_overrides'].copy() settings['settings_overrides']['_disable_config'] = 1 + settings['settings_overrides']['_stylesheet_required'] = 0 if not settings['settings_overrides'].has_key('record_dependencies'): settings['settings_overrides']['record_dependencies'] = \ docutils.utils.DependencyList(recordfile) diff --git a/test/test_writers/test_html4css1_misc.py b/test/test_writers/test_html4css1_misc.py index df07a7bd5..940f99482 100755 --- a/test/test_writers/test_html4css1_misc.py +++ b/test/test_writers/test_html4css1_misc.py @@ -23,7 +23,8 @@ class EncodingTestCase(DocutilsTestSupport.StandardTestCase): settings_overrides={ 'output_encoding': 'latin1', 'stylesheet': '', - '_disable_config': 1} + '_disable_config': 1, + '_stylesheet_required': 0,} result = core.publish_string( 'äöü€', writer_name='html4css1', settings_overrides=settings_overrides) -- cgit v1.2.1 From 87d7a29637a909f7bb7c0a321d09d131fc45d7f8 Mon Sep 17 00:00:00 2001 From: wiemann Date: Wed, 29 Jun 2005 11:26:25 +0000 Subject: move metadata title into document['title'] git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3621 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../functional/expected/standalone_rst_pseudoxml.txt | 2 +- test/test_transforms/test_doctitle.py | 20 +++++++++++--------- test/test_writers/test_docutils_xml.py | 8 ++++---- test/test_writers/test_pseudoxml.py | 15 +++++---------- 4 files changed, 21 insertions(+), 24 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_pseudoxml.txt b/test/functional/expected/standalone_rst_pseudoxml.txt index d7f4d0103..2ae7e5c3b 100644 --- a/test/functional/expected/standalone_rst_pseudoxml.txt +++ b/test/functional/expected/standalone_rst_pseudoxml.txt @@ -1,4 +1,4 @@ - + reStructuredText Test Document <subtitle ids="examples-of-syntax-constructs subtitle" names="examples of syntax constructs subtitle"> diff --git a/test/test_transforms/test_doctitle.py b/test/test_transforms/test_doctitle.py index 3a672d1c2..22629c45a 100755 --- a/test/test_transforms/test_doctitle.py +++ b/test/test_transforms/test_doctitle.py @@ -33,7 +33,7 @@ Title Paragraph. """, """\ -<document ids="title" names="title" source="test data"> +<document ids="title" names="title" source="test data" title="Title"> <title> Title <comment xml:space="preserve"> @@ -47,7 +47,7 @@ Title Paragraph (no blank line). """, """\ -<document ids="title" names="title" source="test data"> +<document ids="title" names="title" source="test data" title="Title"> <title> Title <paragraph> @@ -78,16 +78,18 @@ Title Subtitle -------- -Test title & subtitle. +.. title:: Another Title + +Test title, subtitle, and title metadata. """, """\ -<document ids="title" names="title" source="test data"> +<document ids="title" names="title" source="test data" title="Another Title"> <title> Title <subtitle ids="subtitle" names="subtitle"> Subtitle <paragraph> - Test title & subtitle. + Test title, subtitle, and title metadata. """], ["""\ Title @@ -96,7 +98,7 @@ Title Test short underline. """, """\ -<document ids="title" names="title" source="test data"> +<document ids="title" names="title" source="test data" title="Title"> <title> Title <system_message level="2" line="2" source="test data" type="WARNING"> @@ -118,7 +120,7 @@ The system_message should move after the document title (it was before the beginning of the section). """, """\ -<document ids="long-title" names="long title" source="test data"> +<document ids="long-title" names="long title" source="test data" title="Long Title"> <title> Long Title <system_message level="2" line="1" source="test data" type="WARNING"> @@ -149,7 +151,7 @@ Title 3 Paragraph 3. """, """\ -<document ids="title-1" names="title 1" source="test data"> +<document ids="title-1" names="title 1" source="test data" title="Title 1"> <title> Title 1 <comment xml:space="preserve"> @@ -178,7 +180,7 @@ This title should be the document title despite the substitution_definition. """, """\ -<document ids="title" names="title" source="test data"> +<document ids="title" names="title" source="test data" title="Title"> <title> Title <substitution_definition names="foo"> diff --git a/test/test_writers/test_docutils_xml.py b/test/test_writers/test_docutils_xml.py index f11b620f4..1dab576c2 100755 --- a/test/test_writers/test_docutils_xml.py +++ b/test/test_writers/test_docutils_xml.py @@ -19,13 +19,13 @@ import docutils.core class DocutilsXMLTestCase(DocutilsTestSupport.StandardTestCase): - input = 'Test\n====\n\nSubsection\n----------\n\nTest\n\n----------\n\nTest. äöü€' + input = 'Test\n\n----------\n\nTest. äöü€' xmldecl = '<?xml version="1.0" encoding="iso-8859-1"?>\n' doctypedecl = '<!DOCTYPE document PUBLIC "+//IDN docutils.sourceforge.net//DTD Docutils Generic//EN//XML" "http://docutils.sourceforge.net/docs/ref/docutils.dtd">\n' generatedby = '<!-- Generated by Docutils %s -->\n' % docutils.__version__ - bodynormal = '<document ids="test" names="test" source="<string>"><title>TestSubsectionTestTest. \xe4\xf6\xfc€' - bodynewlines = '\n\nTest\n\n\nSubsection\n\n\nTest\n\n\n\nTest. \xe4\xf6\xfc€\n\n\n' - bodyindents = '\n \n Test\n \n \n Subsection\n \n \n Test\n \n \n \n Test. \xe4\xf6\xfc€\n \n\n' + bodynormal = 'TestTest. \xe4\xf6\xfc€' + bodynewlines = '\n\nTest\n\n\n\nTest. \xe4\xf6\xfc€\n\n\n' + bodyindents = '\n \n Test\n \n \n \n Test. \xe4\xf6\xfc€\n \n\n' def test_publish(self): settings = {'input_encoding': 'utf8', diff --git a/test/test_writers/test_pseudoxml.py b/test/test_writers/test_pseudoxml.py index 66bfef480..45b320b8b 100755 --- a/test/test_writers/test_pseudoxml.py +++ b/test/test_writers/test_pseudoxml.py @@ -22,33 +22,28 @@ totest = {} totest['basic'] = [ # input ["""\ -This is the title -================= - This is a paragraph. ---------- This is another paragraph. -A subsection ------------- +A Section +--------- Foo. """, # output """\ - - - This is the title +<document source="<string>"> <paragraph> This is a paragraph. <transition> <paragraph> This is another paragraph. - <section ids="a-subsection" names="a subsection"> + <section ids="a-section" names="a section"> <title> - A subsection + A Section <paragraph> Foo. """] -- cgit v1.2.1 From 59faeb587bf4a9f98d3541fea3f02fca6ab6a1be Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Wed, 29 Jun 2005 13:50:38 +0000 Subject: converted to real multi-line literal strings for readability git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3623 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_writers/test_docutils_xml.py | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/test_writers/test_docutils_xml.py b/test/test_writers/test_docutils_xml.py index 1dab576c2..eeb5bc94a 100755 --- a/test/test_writers/test_docutils_xml.py +++ b/test/test_writers/test_docutils_xml.py @@ -19,13 +19,38 @@ import docutils.core class DocutilsXMLTestCase(DocutilsTestSupport.StandardTestCase): - input = 'Test\n\n----------\n\nTest. äöü€' + input = """\ +Test + +---------- + +Test. äöü€""" xmldecl = '<?xml version="1.0" encoding="iso-8859-1"?>\n' doctypedecl = '<!DOCTYPE document PUBLIC "+//IDN docutils.sourceforge.net//DTD Docutils Generic//EN//XML" "http://docutils.sourceforge.net/docs/ref/docutils.dtd">\n' generatedby = '<!-- Generated by Docutils %s -->\n' % docutils.__version__ bodynormal = '<document source="<string>"><paragraph>Test</paragraph><transition/><paragraph>Test. \xe4\xf6\xfc€</paragraph></document>' - bodynewlines = '<document source="<string>">\n<paragraph>\nTest\n</paragraph>\n<transition/>\n<paragraph>\nTest. \xe4\xf6\xfc€\n</paragraph>\n</document>\n' - bodyindents = '<document source="<string>">\n <paragraph>\n Test\n </paragraph>\n <transition/>\n <paragraph>\n Test. \xe4\xf6\xfc€\n </paragraph>\n</document>\n' + bodynewlines = """\ +<document source="<string>"> +<paragraph> +Test +</paragraph> +<transition/> +<paragraph> +Test. \xe4\xf6\xfc€ +</paragraph> +</document> +""" + bodyindents = """\ +<document source="<string>"> + <paragraph> + Test + </paragraph> + <transition/> + <paragraph> + Test. \xe4\xf6\xfc€ + </paragraph> +</document> +""" def test_publish(self): settings = {'input_encoding': 'utf8', -- cgit v1.2.1 From 15d51dcd2e1dc82ea8c5120b983ed269350c72bb Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Wed, 29 Jun 2005 16:26:22 +0000 Subject: added test for publish_from_doctree git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3625 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_publisher.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/test_publisher.py b/test/test_publisher.py index d62c320f6..388253902 100755 --- a/test/test_publisher.py +++ b/test/test_publisher.py @@ -22,6 +22,14 @@ Test Document This is a test document. """ +pseudoxml_output = """\ +<document ids="test-document" names="test document" source="<string>" title="Test Document"> + <title> + Test Document + <paragraph> + This is a test document. +""" + class PublishDoctreeTestCase(unittest.TestCase): @@ -42,9 +50,10 @@ class PublishDoctreeTestCase(unittest.TestCase): # Write out the document. output, parts = core.publish_from_doctree( - doctree, writer_name='pseudoxml') + doctree, writer_name='pseudoxml', + settings_overrides={'_disable_config': 1}) - self.assert_(isinstance(output, StringType)) + self.assertEquals(output, pseudoxml_output) assert isinstance(parts, DictType) -- cgit v1.2.1 From a73f790481e8996fa6c2830ff6f68cbdef458f96 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Wed, 29 Jun 2005 19:47:03 +0000 Subject: updated git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3633 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_publisher.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'test') diff --git a/test/test_publisher.py b/test/test_publisher.py index 388253902..ebca64b70 100755 --- a/test/test_publisher.py +++ b/test/test_publisher.py @@ -21,7 +21,6 @@ Test Document This is a test document. """ - pseudoxml_output = """\ <document ids="test-document" names="test document" source="<string>" title="Test Document"> <title> @@ -41,20 +40,17 @@ class PublishDoctreeTestCase(unittest.TestCase): reader_name='standalone', parser_name='restructuredtext', settings_overrides={'_disable_config': 1}) - self.assert_(isinstance(doctree, nodes.document)) - # Assert transforms have been applied (in this case the - # DocTitle transform). + # Confirm that transforms have been applied (in this case, the + # DocTitle transform): self.assert_(isinstance(doctree[0], nodes.title)) self.assert_(isinstance(doctree[1], nodes.paragraph)) - - # Write out the document. + # Write out the document: output, parts = core.publish_from_doctree( doctree, writer_name='pseudoxml', settings_overrides={'_disable_config': 1}) - self.assertEquals(output, pseudoxml_output) - assert isinstance(parts, DictType) + self.assert_(isinstance(parts, DictType)) if __name__ == '__main__': -- cgit v1.2.1 From 77f04a55cc598dbfeb97703d5f115048daa01822 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Wed, 29 Jun 2005 20:01:19 +0000 Subject: implemented units for image widths; implemented language-support (e.g. for hyphenation) git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3635 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/input/data/latex.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/functional/input/data/latex.txt b/test/functional/input/data/latex.txt index df1f66d45..ee9c02a4d 100644 --- a/test/functional/input/data/latex.txt +++ b/test/functional/input/data/latex.txt @@ -113,8 +113,9 @@ Images Image with 20% width: .. image:: ../../../docs/user/rst/images/title.png - :width: 20 + :width: 20% Image with 100% width: .. image:: ../../../docs/user/rst/images/title.png + :width: 100% -- cgit v1.2.1 From 6a66e3e696c26896f3d5ffac5376beddd13a6f20 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Wed, 29 Jun 2005 22:34:44 +0000 Subject: removed document.internal_targets and document.external_targets; fixed bug (not sure yet if the code is clean -- needs refactoring) git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3637 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms/test_hyperlinks.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'test') diff --git a/test/test_transforms/test_hyperlinks.py b/test/test_transforms/test_hyperlinks.py index cf218ee47..fc7441c5f 100755 --- a/test/test_transforms/test_hyperlinks.py +++ b/test/test_transforms/test_hyperlinks.py @@ -396,6 +396,24 @@ The results of the transform are not visible at the XML level. The results of the transform are not visible at the XML level. """], ["""\ +.. _chained: +__ http://anonymous + +Anonymous__ and chained_ both refer to the same URI. +""", +"""\ +<document source="test data"> + <target refid="chained"> + <target anonymous="1" ids="id1 chained" names="chained" refuri="http://anonymous"> + <paragraph> + <reference anonymous="1" name="Anonymous" refuri="http://anonymous"> + Anonymous + and \n\ + <reference name="chained" refuri="http://anonymous"> + chained + both refer to the same URI. +"""], +["""\ .. _a: .. _b: -- cgit v1.2.1 From 992191ceb9e0efbfc0d3249f52966e1261c2bbe3 Mon Sep 17 00:00:00 2001 From: blais <blais@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Thu, 30 Jun 2005 14:41:26 +0000 Subject: Fixed bug introduced in doctree reader, added pickle test back in. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3638 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_publisher.py | 48 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/test_publisher.py b/test/test_publisher.py index ebca64b70..b96bb64b6 100755 --- a/test/test_publisher.py +++ b/test/test_publisher.py @@ -11,8 +11,9 @@ Test the `Publisher` facade and the ``publish_*`` convenience functions. """ import unittest -from types import DictType, StringType +from types import DictType from docutils import core, nodes +import pickle test_document = """\ @@ -34,6 +35,7 @@ class PublishDoctreeTestCase(unittest.TestCase): def test_publish_doctree(self): """Test `publish_doctree` and `publish_from_doctree`.""" + # Produce the document tree. doctree = core.publish_doctree( source=test_document, @@ -41,10 +43,12 @@ class PublishDoctreeTestCase(unittest.TestCase): parser_name='restructuredtext', settings_overrides={'_disable_config': 1}) self.assert_(isinstance(doctree, nodes.document)) + # Confirm that transforms have been applied (in this case, the # DocTitle transform): self.assert_(isinstance(doctree[0], nodes.title)) self.assert_(isinstance(doctree[1], nodes.paragraph)) + # Write out the document: output, parts = core.publish_from_doctree( doctree, writer_name='pseudoxml', @@ -52,6 +56,48 @@ class PublishDoctreeTestCase(unittest.TestCase): self.assertEquals(output, pseudoxml_output) self.assert_(isinstance(parts, DictType)) + def test_publish_pickle(self): + """Test publishing a document tree with pickling and unpickling.""" + + # Produce the document tree. + doctree = core.publish_doctree( + source=test_document, + reader_name='standalone', + parser_name='restructuredtext', + settings_overrides={'_disable_config': 1}) + self.assert_(isinstance(doctree, nodes.document)) + + # Confirm that transforms have been applied (in this case, the + # DocTitle transform): + self.assert_(isinstance(doctree[0], nodes.title)) + self.assert_(isinstance(doctree[1], nodes.paragraph)) + + # Pickle the document. Note: if this fails, some unpickleable reference + # has been added somewhere within the document tree. If so, you need to + # fix that. + # + # Note: Please do not remove this test, this is an important + # requirement, applications will be built on the assumption that we can + # pickle the document. + + # remove the reporter before pickling. + doctree.reporter = None + + doctree_pickled = pickle.dumps(doctree) + self.assert_(isinstance(doctree_pickled, str)) + del doctree + + # Unpickle the document. + doctree_zombie = pickle.loads(doctree_pickled) + self.assert_(isinstance(doctree_zombie, nodes.document)) + + # Write out the document: + output, parts = core.publish_from_doctree( + doctree_zombie, writer_name='pseudoxml', + settings_overrides={'_disable_config': 1}) + self.assertEquals(output, pseudoxml_output) + self.assert_(isinstance(parts, DictType)) + if __name__ == '__main__': unittest.main() -- cgit v1.2.1 From c7543e9e482ccce8174319d9203a0240ee13eb86 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Thu, 30 Jun 2005 15:54:03 +0000 Subject: Py21 compatibility fix git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3639 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_publisher.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/test_publisher.py b/test/test_publisher.py index b96bb64b6..f62a43374 100755 --- a/test/test_publisher.py +++ b/test/test_publisher.py @@ -11,7 +11,7 @@ Test the `Publisher` facade and the ``publish_*`` convenience functions. """ import unittest -from types import DictType +from types import DictType, StringType from docutils import core, nodes import pickle @@ -84,7 +84,7 @@ class PublishDoctreeTestCase(unittest.TestCase): doctree.reporter = None doctree_pickled = pickle.dumps(doctree) - self.assert_(isinstance(doctree_pickled, str)) + self.assert_(isinstance(doctree_pickled, StringType)) del doctree # Unpickle the document. -- cgit v1.2.1 From d349bc9360770f519cf48c48fb04d2bc96ce4a6e Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Thu, 30 Jun 2005 15:57:59 +0000 Subject: removed duplicate tests; wrapped lines git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3640 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_publisher.py | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'test') diff --git a/test/test_publisher.py b/test/test_publisher.py index f62a43374..d5460694c 100755 --- a/test/test_publisher.py +++ b/test/test_publisher.py @@ -66,21 +66,16 @@ class PublishDoctreeTestCase(unittest.TestCase): parser_name='restructuredtext', settings_overrides={'_disable_config': 1}) self.assert_(isinstance(doctree, nodes.document)) - - # Confirm that transforms have been applied (in this case, the - # DocTitle transform): - self.assert_(isinstance(doctree[0], nodes.title)) - self.assert_(isinstance(doctree[1], nodes.paragraph)) - # Pickle the document. Note: if this fails, some unpickleable reference - # has been added somewhere within the document tree. If so, you need to - # fix that. + # Pickle the document. Note: if this fails, some unpickleable + # reference has been added somewhere within the document tree. + # If so, you need to fix that. # # Note: Please do not remove this test, this is an important - # requirement, applications will be built on the assumption that we can - # pickle the document. + # requirement, applications will be built on the assumption + # that we can pickle the document. - # remove the reporter before pickling. + # Remove the reporter before pickling. doctree.reporter = None doctree_pickled = pickle.dumps(doctree) -- cgit v1.2.1 From 21d87f8811b672fc2726cc2d69baf229240e0dd3 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Fri, 1 Jul 2005 16:39:51 +0000 Subject: improved cloaking mechanism git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3644 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/pep_html.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/functional/expected/pep_html.html b/test/functional/expected/pep_html.html index f65f5d875..e12b15c0e 100644 --- a/test/functional/expected/pep_html.html +++ b/test/functional/expected/pep_html.html @@ -75,7 +75,7 @@ thing.</p> <table class="docutils footnote" frame="void" id="id2" rules="none"> <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> -<tr><td class="label"><a class="fn-backref" href="#id1" name="id2">[1]</a></td><td>PEP editors: <a class="reference" href="mailto:%70%65%70%73%40%70%79%74%68%6F%6E%2E%6F%72%67">peps at python dot org</a></td></tr> +<tr><td class="label"><a class="fn-backref" href="#id1" name="id2">[1]</a></td><td>PEP editors: <a class="reference" href="mailto:%70%65%70%73%40%70%79%74%68%6F%6E%2E%6F%72%67">peps<span>@</span>python<span>.</span>org</a></td></tr> </tbody> </table> <table class="docutils footnote" frame="void" id="id3" rules="none"> -- cgit v1.2.1 From d04b3b06ae8404240bd8ab5cd22bebb34dfdb0f3 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sat, 2 Jul 2005 23:08:53 +0000 Subject: revert docutils.writers.null.Writer.output to None, now with docutils.io.Output and test support git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3646 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/DocutilsTestSupport.py | 20 +++++++++++++------- test/test_writers/test_null.py | 3 +-- 2 files changed, 14 insertions(+), 9 deletions(-) (limited to 'test') diff --git a/test/DocutilsTestSupport.py b/test/DocutilsTestSupport.py index 72d5cdbc2..c0c2c331b 100644 --- a/test/DocutilsTestSupport.py +++ b/test/DocutilsTestSupport.py @@ -153,13 +153,19 @@ class CustomTestCase(StandardTestCase): expected = expected.encode('raw_unicode_escape') try: self.assertEquals(output, expected) - except AssertionError: + except AssertionError, error: print >>sys.stderr, '\n%s\ninput:' % (self,) print >>sys.stderr, input - print >>sys.stderr, '-: expected\n+: output' - print >>sys.stderr, ''.join(self.compare(expected.splitlines(1), - output.splitlines(1))) - raise + try: + comparison = ''.join(self.compare(expected.splitlines(1), + output.splitlines(1))) + print >>sys.stderr, '-: expected\n+: output' + print >>sys.stderr, comparison + except AttributeError: # expected or output not a string + # alternative output for non-strings: + print >>sys.stderr, 'expected: %r' % expected + print >>sys.stderr, 'output: %r' % output + raise error def failUnlessEqual(self, first, second, msg=None): """Fail if the two objects are unequal as determined by the '==' @@ -819,8 +825,8 @@ def _format_str(*args): return_tuple = [] for i in args: r = repr(i) - if '\n' in i and (isinstance(i, StringType) or - isinstance(i, UnicodeType)): + if ( (isinstance(i, StringType) or isinstance(i, UnicodeType)) + and '\n' in i): stripped = '' if isinstance(i, UnicodeType): # stripped = 'u' or 'U' diff --git a/test/test_writers/test_null.py b/test/test_writers/test_null.py index 9f8d8fe19..da385e565 100755 --- a/test/test_writers/test_null.py +++ b/test/test_writers/test_null.py @@ -23,8 +23,7 @@ totest['basic'] = [ ["""\ This is a paragraph. """, -"""\ -"""] +None] ] if __name__ == '__main__': -- cgit v1.2.1 From 2703f7c25b10c10f59db93e0776cb81c1d181bca Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Tue, 5 Jul 2005 20:29:55 +0000 Subject: moved transition transform logic from universal.FinalChecks to a separate transform, misc.Transitions git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3657 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms/test_final_checks.py | 282 --------------------------- test/test_transforms/test_transitions.py | 308 ++++++++++++++++++++++++++++++ 2 files changed, 308 insertions(+), 282 deletions(-) create mode 100755 test/test_transforms/test_transitions.py (limited to 'test') diff --git a/test/test_transforms/test_final_checks.py b/test/test_transforms/test_final_checks.py index 4d8a4ef88..4d58b8dbc 100755 --- a/test/test_transforms/test_final_checks.py +++ b/test/test_transforms/test_final_checks.py @@ -72,288 +72,6 @@ Duplicate manual footnote labels, with reference ([1]_): ]) -# See DocutilsTestSupport.ParserTestSuite.generateTests for a -# description of the 'totest' data structure. -totest['transitions'] = ((FinalChecks,), [ -["""\ -Section 1 -========= - -Subsection 1 ------------- - -Some text. - ----------- - -Section 2 -========= - -Some text. -""", -"""\ -<document source="test data"> - <section ids="section-1" names="section 1"> - <title> - Section 1 - <section ids="subsection-1" names="subsection 1"> - <title> - Subsection 1 - <paragraph> - Some text. - <transition> - <section ids="section-2" names="section 2"> - <title> - Section 2 - <paragraph> - Some text. -"""], -["""\ -A paragraph. - ----------- - -Section 1 -========= - -Paragraph. -""", -"""\ -<document source="test data"> - <paragraph> - A paragraph. - <transition> - <section ids="section-1" names="section 1"> - <title> - Section 1 - <paragraph> - Paragraph. -"""], -["""\ --------- - -A section or document may not begin with a transition. - -The DTD specifies that two transitions may not -be adjacent: - --------- - --------- - --------- - -The DTD also specifies that a section or document -may not end with a transition. - --------- -""", -"""\ -<document source="test data"> - <system_message level="3" line="1" source="test data" type="ERROR"> - <paragraph> - Document or section may not begin with a transition. - <transition> - <paragraph> - A section or document may not begin with a transition. - <paragraph> - The DTD specifies that two transitions may not - be adjacent: - <transition> - <system_message level="3" line="10" source="test data" type="ERROR"> - <paragraph> - At least one body element must separate transitions; adjacent transitions are not allowed. - <transition> - <system_message level="3" line="12" source="test data" type="ERROR"> - <paragraph> - At least one body element must separate transitions; adjacent transitions are not allowed. - <transition> - <paragraph> - The DTD also specifies that a section or document - may not end with a transition. - <transition> - <system_message level="3" line="17" source="test data" type="ERROR"> - <paragraph> - Document may not end with a transition. -"""], -["""\ -Sections with transitions at beginning and end. - -Section 1 -========= - ----------- - -The next transition is legal: - ----------- - -Section 2 -========= - ----------- -""", -"""\ -<document source="test data"> - <paragraph> - Sections with transitions at beginning and end. - <section ids="section-1" names="section 1"> - <title> - Section 1 - <system_message level="3" line="6" source="test data" type="ERROR"> - <paragraph> - Document or section may not begin with a transition. - <transition> - <paragraph> - The next transition is legal: - <transition> - <section ids="section-2" names="section 2"> - <title> - Section 2 - <system_message level="3" line="15" source="test data" type="ERROR"> - <paragraph> - Document or section may not begin with a transition. - <transition> - <system_message level="3" line="15" source="test data" type="ERROR"> - <paragraph> - Document may not end with a transition. -"""], -["""\ -A paragraph and two transitions. - ----------- - ----------- -""", # the same: -"""\ -<document source="test data"> - <paragraph> - A paragraph and two transitions. - <transition> - <system_message level="3" line="5" source="test data" type="ERROR"> - <paragraph> - At least one body element must separate transitions; adjacent transitions are not allowed. - <transition> - <system_message level="3" line="5" source="test data" type="ERROR"> - <paragraph> - Document may not end with a transition. -"""], -["""\ -A paragraph, two transitions, and a blank line. - ----------- - ----------- - -""", -"""\ -<document source="test data"> - <paragraph> - A paragraph, two transitions, and a blank line. - <transition> - <system_message level="3" line="5" source="test data" type="ERROR"> - <paragraph> - At least one body element must separate transitions; adjacent transitions are not allowed. - <transition> - <system_message level="3" line="5" source="test data" type="ERROR"> - <paragraph> - Document may not end with a transition. -"""], -["""\ ----------- - -Document beginning with a transition. -""", -"""\ -<document source="test data"> - <system_message level="3" line="1" source="test data" type="ERROR"> - <paragraph> - Document or section may not begin with a transition. - <transition> - <paragraph> - Document beginning with a transition. -"""], -["""\ -Section 1 -========= - ----------- - ----------- - ----------- - -Section 2 -========= - -Some text. -""", -"""\ -<document source="test data"> - <section ids="section-1" names="section 1"> - <title> - Section 1 - <system_message level="3" line="4" source="test data" type="ERROR"> - <paragraph> - Document or section may not begin with a transition. - <transition> - <system_message level="3" line="6" source="test data" type="ERROR"> - <paragraph> - At least one body element must separate transitions; adjacent transitions are not allowed. - <transition> - <system_message level="3" line="8" source="test data" type="ERROR"> - <paragraph> - At least one body element must separate transitions; adjacent transitions are not allowed. - <transition> - <section ids="section-2" names="section 2"> - <title> - Section 2 - <paragraph> - Some text. -"""], -["""\ ----------- - ----------- - ----------- -""", -"""\ -<document source="test data"> - <system_message level="3" line="1" source="test data" type="ERROR"> - <paragraph> - Document or section may not begin with a transition. - <transition> - <system_message level="3" line="3" source="test data" type="ERROR"> - <paragraph> - At least one body element must separate transitions; adjacent transitions are not allowed. - <transition> - <system_message level="3" line="5" source="test data" type="ERROR"> - <paragraph> - At least one body element must separate transitions; adjacent transitions are not allowed. - <transition> - <system_message level="3" line="5" source="test data" type="ERROR"> - <paragraph> - Document may not end with a transition. -"""], -["""\ -A paragraph. - ----------- - -""", -"""\ -<document source="test data"> - <paragraph> - A paragraph. - <transition> - <system_message level="3" line="3" source="test data" type="ERROR"> - <paragraph> - Document may not end with a transition. -"""], -]) - - if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') diff --git a/test/test_transforms/test_transitions.py b/test/test_transforms/test_transitions.py new file mode 100755 index 000000000..9711c4aee --- /dev/null +++ b/test/test_transforms/test_transitions.py @@ -0,0 +1,308 @@ +#! /usr/bin/env python + +# Author: David Goodger +# Contact: goodger@users.sourceforge.net +# Revision: $Revision$ +# Date: $Date$ +# Copyright: This module has been placed in the public domain. + +""" +Test module for transforms/__init__.py. +""" + +from docutils.transforms.misc import Transitions +from __init__ import DocutilsTestSupport +from docutils.parsers.rst import Parser + +def suite(): + parser = Parser() + s = DocutilsTestSupport.TransformTestSuite(parser) + s.generateTests(totest) + return s + + +totest = {} + +totest['transitions'] = ((Transitions,), [ +["""\ +Section 1 +========= + +Subsection 1 +------------ + +Some text. + +---------- + +Section 2 +========= + +Some text. +""", +"""\ +<document source="test data"> + <section ids="section-1" names="section 1"> + <title> + Section 1 + <section ids="subsection-1" names="subsection 1"> + <title> + Subsection 1 + <paragraph> + Some text. + <transition> + <section ids="section-2" names="section 2"> + <title> + Section 2 + <paragraph> + Some text. +"""], +["""\ +A paragraph. + +---------- + +Section 1 +========= + +Paragraph. +""", +"""\ +<document source="test data"> + <paragraph> + A paragraph. + <transition> + <section ids="section-1" names="section 1"> + <title> + Section 1 + <paragraph> + Paragraph. +"""], +["""\ +-------- + +A section or document may not begin with a transition. + +The DTD specifies that two transitions may not +be adjacent: + +-------- + +-------- + +-------- + +The DTD also specifies that a section or document +may not end with a transition. + +-------- +""", +"""\ +<document source="test data"> + <system_message level="3" line="1" source="test data" type="ERROR"> + <paragraph> + Document or section may not begin with a transition. + <transition> + <paragraph> + A section or document may not begin with a transition. + <paragraph> + The DTD specifies that two transitions may not + be adjacent: + <transition> + <system_message level="3" line="10" source="test data" type="ERROR"> + <paragraph> + At least one body element must separate transitions; adjacent transitions are not allowed. + <transition> + <system_message level="3" line="12" source="test data" type="ERROR"> + <paragraph> + At least one body element must separate transitions; adjacent transitions are not allowed. + <transition> + <paragraph> + The DTD also specifies that a section or document + may not end with a transition. + <transition> + <system_message level="3" line="17" source="test data" type="ERROR"> + <paragraph> + Document may not end with a transition. +"""], +["""\ +Sections with transitions at beginning and end. + +Section 1 +========= + +---------- + +The next transition is legal: + +---------- + +Section 2 +========= + +---------- +""", +"""\ +<document source="test data"> + <paragraph> + Sections with transitions at beginning and end. + <section ids="section-1" names="section 1"> + <title> + Section 1 + <system_message level="3" line="6" source="test data" type="ERROR"> + <paragraph> + Document or section may not begin with a transition. + <transition> + <paragraph> + The next transition is legal: + <transition> + <section ids="section-2" names="section 2"> + <title> + Section 2 + <system_message level="3" line="15" source="test data" type="ERROR"> + <paragraph> + Document or section may not begin with a transition. + <transition> + <system_message level="3" line="15" source="test data" type="ERROR"> + <paragraph> + Document may not end with a transition. +"""], +["""\ +A paragraph and two transitions. + +---------- + +---------- +""", # the same: +"""\ +<document source="test data"> + <paragraph> + A paragraph and two transitions. + <transition> + <system_message level="3" line="5" source="test data" type="ERROR"> + <paragraph> + At least one body element must separate transitions; adjacent transitions are not allowed. + <transition> + <system_message level="3" line="5" source="test data" type="ERROR"> + <paragraph> + Document may not end with a transition. +"""], +["""\ +A paragraph, two transitions, and a blank line. + +---------- + +---------- + +""", +"""\ +<document source="test data"> + <paragraph> + A paragraph, two transitions, and a blank line. + <transition> + <system_message level="3" line="5" source="test data" type="ERROR"> + <paragraph> + At least one body element must separate transitions; adjacent transitions are not allowed. + <transition> + <system_message level="3" line="5" source="test data" type="ERROR"> + <paragraph> + Document may not end with a transition. +"""], +["""\ +---------- + +Document beginning with a transition. +""", +"""\ +<document source="test data"> + <system_message level="3" line="1" source="test data" type="ERROR"> + <paragraph> + Document or section may not begin with a transition. + <transition> + <paragraph> + Document beginning with a transition. +"""], +["""\ +Section 1 +========= + +---------- + +---------- + +---------- + +Section 2 +========= + +Some text. +""", +"""\ +<document source="test data"> + <section ids="section-1" names="section 1"> + <title> + Section 1 + <system_message level="3" line="4" source="test data" type="ERROR"> + <paragraph> + Document or section may not begin with a transition. + <transition> + <system_message level="3" line="6" source="test data" type="ERROR"> + <paragraph> + At least one body element must separate transitions; adjacent transitions are not allowed. + <transition> + <system_message level="3" line="8" source="test data" type="ERROR"> + <paragraph> + At least one body element must separate transitions; adjacent transitions are not allowed. + <transition> + <section ids="section-2" names="section 2"> + <title> + Section 2 + <paragraph> + Some text. +"""], +["""\ +---------- + +---------- + +---------- +""", +"""\ +<document source="test data"> + <system_message level="3" line="1" source="test data" type="ERROR"> + <paragraph> + Document or section may not begin with a transition. + <transition> + <system_message level="3" line="3" source="test data" type="ERROR"> + <paragraph> + At least one body element must separate transitions; adjacent transitions are not allowed. + <transition> + <system_message level="3" line="5" source="test data" type="ERROR"> + <paragraph> + At least one body element must separate transitions; adjacent transitions are not allowed. + <transition> + <system_message level="3" line="5" source="test data" type="ERROR"> + <paragraph> + Document may not end with a transition. +"""], +["""\ +A paragraph. + +---------- + +""", +"""\ +<document source="test data"> + <paragraph> + A paragraph. + <transition> + <system_message level="3" line="3" source="test data" type="ERROR"> + <paragraph> + Document may not end with a transition. +"""], +]) + + +if __name__ == '__main__': + import unittest + unittest.main(defaultTest='suite') -- cgit v1.2.1 From e0a1eaac9d47da79a00c92c74ef7e789464421b7 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Tue, 5 Jul 2005 23:14:55 +0000 Subject: moved expose_internals logic out of FinalChecks into a separate transform, universal.ExposeInternals git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3658 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms/test_expose_internals.py | 41 +++++++++++++++++++++++++++ test/test_transforms/test_transitions.py | 2 +- 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100755 test/test_transforms/test_expose_internals.py (limited to 'test') diff --git a/test/test_transforms/test_expose_internals.py b/test/test_transforms/test_expose_internals.py new file mode 100755 index 000000000..37747a68b --- /dev/null +++ b/test/test_transforms/test_expose_internals.py @@ -0,0 +1,41 @@ +#! /usr/bin/env python + +# Author: Felix Wiemann +# Contact: Felix_Wiemann@ososo.de +# Revision: $Revision$ +# Date: $Date$ +# Copyright: This module has been placed in the public domain. + +""" +Test module for universal.ExposeInternals transform. +""" + + +from docutils.transforms.universal import ExposeInternals +from __init__ import DocutilsTestSupport +from docutils.parsers.rst import Parser + +def suite(): + parser = Parser() + s = DocutilsTestSupport.TransformTestSuite(parser) + s.generateTests(totest) + return s + + +totest = {} + +totest['transitions'] = ((ExposeInternals,), [ +["""\ +This is a test. +""", +"""\ +[Test disabled at the moment. How do we activate the expose_internals +setting for this test suite?] +""", +0], +]) + + +if __name__ == '__main__': + import unittest + unittest.main(defaultTest='suite') diff --git a/test/test_transforms/test_transitions.py b/test/test_transforms/test_transitions.py index 9711c4aee..24a69bb52 100755 --- a/test/test_transforms/test_transitions.py +++ b/test/test_transforms/test_transitions.py @@ -7,7 +7,7 @@ # Copyright: This module has been placed in the public domain. """ -Test module for transforms/__init__.py. +Test module for misc.Transitions transform. """ from docutils.transforms.misc import Transitions -- cgit v1.2.1 From 88b1bd28140150e41265cd8a84b5d0ee55f05138 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Tue, 5 Jul 2005 23:36:14 +0000 Subject: renamed universal.FinalChecks to references.DanglingReferences; changed priority to 680 git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3659 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../expected/standalone_rst_html4css1.html | 186 ++++++++++----------- .../expected/standalone_rst_pseudoxml.txt | 178 ++++++++++---------- test/test_transforms/test_final_checks.py | 77 --------- test/test_transforms/test_hyperlinks.py | 52 +++++- 4 files changed, 230 insertions(+), 263 deletions(-) delete mode 100755 test/test_transforms/test_final_checks.py (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index e624dacb0..7e4c91546 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -88,67 +88,67 @@ They are transformed from section titles after parsing. --> <div class="contents topic" id="table-of-contents"> <p class="topic-title first"><a name="table-of-contents">Table of Contents</a></p> <ul class="auto-toc simple"> -<li><a class="reference" href="#structural-elements" id="id25" name="id25">1   Structural Elements</a><ul class="auto-toc"> -<li><a class="reference" href="#section-title" id="id26" name="id26">1.1   Section Title</a></li> -<li><a class="reference" href="#empty-section" id="id27" name="id27">1.2   Empty Section</a></li> -<li><a class="reference" href="#transitions" id="id28" name="id28">1.3   Transitions</a></li> +<li><a class="reference" href="#structural-elements" id="id33" name="id33">1   Structural Elements</a><ul class="auto-toc"> +<li><a class="reference" href="#section-title" id="id34" name="id34">1.1   Section Title</a></li> +<li><a class="reference" href="#empty-section" id="id35" name="id35">1.2   Empty Section</a></li> +<li><a class="reference" href="#transitions" id="id36" name="id36">1.3   Transitions</a></li> </ul> </li> -<li><a class="reference" href="#body-elements" id="id29" name="id29">2   Body Elements</a><ul class="auto-toc"> -<li><a class="reference" href="#paragraphs" id="id30" name="id30">2.1   Paragraphs</a><ul class="auto-toc"> -<li><a class="reference" href="#inline-markup" id="id31" name="id31">2.1.1   Inline Markup</a></li> +<li><a class="reference" href="#body-elements" id="id37" name="id37">2   Body Elements</a><ul class="auto-toc"> +<li><a class="reference" href="#paragraphs" id="id38" name="id38">2.1   Paragraphs</a><ul class="auto-toc"> +<li><a class="reference" href="#inline-markup" id="id39" name="id39">2.1.1   Inline Markup</a></li> </ul> </li> -<li><a class="reference" href="#bullet-lists" id="id32" name="id32">2.2   Bullet Lists</a></li> -<li><a class="reference" href="#enumerated-lists" id="id33" name="id33">2.3   Enumerated Lists</a></li> -<li><a class="reference" href="#definition-lists" id="id34" name="id34">2.4   Definition Lists</a></li> -<li><a class="reference" href="#field-lists" id="id35" name="id35">2.5   Field Lists</a></li> -<li><a class="reference" href="#option-lists" id="id36" name="id36">2.6   Option Lists</a></li> -<li><a class="reference" href="#literal-blocks" id="id37" name="id37">2.7   Literal Blocks</a></li> -<li><a class="reference" href="#line-blocks" id="id38" name="id38">2.8   Line Blocks</a></li> -<li><a class="reference" href="#block-quotes" id="id39" name="id39">2.9   Block Quotes</a></li> -<li><a class="reference" href="#doctest-blocks" id="id40" name="id40">2.10   Doctest Blocks</a></li> -<li><a class="reference" href="#footnotes" id="id41" name="id41">2.11   Footnotes</a></li> -<li><a class="reference" href="#citations" id="id42" name="id42">2.12   Citations</a></li> -<li><a class="reference" href="#targets" id="id43" name="id43">2.13   Targets</a><ul class="auto-toc"> -<li><a class="reference" href="#duplicate-target-names" id="id44" name="id44">2.13.1   Duplicate Target Names</a></li> -<li><a class="reference" href="#id18" id="id45" name="id45">2.13.2   Duplicate Target Names</a></li> +<li><a class="reference" href="#bullet-lists" id="id40" name="id40">2.2   Bullet Lists</a></li> +<li><a class="reference" href="#enumerated-lists" id="id41" name="id41">2.3   Enumerated Lists</a></li> +<li><a class="reference" href="#definition-lists" id="id42" name="id42">2.4   Definition Lists</a></li> +<li><a class="reference" href="#field-lists" id="id43" name="id43">2.5   Field Lists</a></li> +<li><a class="reference" href="#option-lists" id="id44" name="id44">2.6   Option Lists</a></li> +<li><a class="reference" href="#literal-blocks" id="id45" name="id45">2.7   Literal Blocks</a></li> +<li><a class="reference" href="#line-blocks" id="id46" name="id46">2.8   Line Blocks</a></li> +<li><a class="reference" href="#block-quotes" id="id47" name="id47">2.9   Block Quotes</a></li> +<li><a class="reference" href="#doctest-blocks" id="id48" name="id48">2.10   Doctest Blocks</a></li> +<li><a class="reference" href="#footnotes" id="id49" name="id49">2.11   Footnotes</a></li> +<li><a class="reference" href="#citations" id="id50" name="id50">2.12   Citations</a></li> +<li><a class="reference" href="#targets" id="id51" name="id51">2.13   Targets</a><ul class="auto-toc"> +<li><a class="reference" href="#duplicate-target-names" id="id52" name="id52">2.13.1   Duplicate Target Names</a></li> +<li><a class="reference" href="#id18" id="id53" name="id53">2.13.2   Duplicate Target Names</a></li> </ul> </li> -<li><a class="reference" href="#directives" id="id46" name="id46">2.14   Directives</a><ul class="auto-toc"> -<li><a class="reference" href="#document-parts" id="id47" name="id47">2.14.1   Document Parts</a></li> -<li><a class="reference" href="#images" id="id48" name="id48">2.14.2   Images</a></li> -<li><a class="reference" href="#admonitions" id="id49" name="id49">2.14.3   Admonitions</a></li> -<li><a class="reference" href="#topics-sidebars-and-rubrics" id="id50" name="id50">2.14.4   Topics, Sidebars, and Rubrics</a></li> -<li><a class="reference" href="#target-footnotes" id="id51" name="id51">2.14.5   Target Footnotes</a></li> -<li><a class="reference" href="#replacement-text" id="id52" name="id52">2.14.6   Replacement Text</a></li> -<li><a class="reference" href="#compound-paragraph" id="id53" name="id53">2.14.7   Compound Paragraph</a></li> +<li><a class="reference" href="#directives" id="id54" name="id54">2.14   Directives</a><ul class="auto-toc"> +<li><a class="reference" href="#document-parts" id="id55" name="id55">2.14.1   Document Parts</a></li> +<li><a class="reference" href="#images" id="id56" name="id56">2.14.2   Images</a></li> +<li><a class="reference" href="#admonitions" id="id57" name="id57">2.14.3   Admonitions</a></li> +<li><a class="reference" href="#topics-sidebars-and-rubrics" id="id58" name="id58">2.14.4   Topics, Sidebars, and Rubrics</a></li> +<li><a class="reference" href="#target-footnotes" id="id59" name="id59">2.14.5   Target Footnotes</a></li> +<li><a class="reference" href="#replacement-text" id="id60" name="id60">2.14.6   Replacement Text</a></li> +<li><a class="reference" href="#compound-paragraph" id="id61" name="id61">2.14.7   Compound Paragraph</a></li> </ul> </li> -<li><a class="reference" href="#substitution-definitions" id="id54" name="id54">2.15   Substitution Definitions</a></li> -<li><a class="reference" href="#comments" id="id55" name="id55">2.16   Comments</a></li> -<li><a class="reference" href="#raw-text" id="id56" name="id56">2.17   Raw text</a></li> -<li><a class="reference" href="#colspanning-tables" id="id57" name="id57">2.18   Colspanning tables</a></li> -<li><a class="reference" href="#rowspanning-tables" id="id58" name="id58">2.19   Rowspanning tables</a></li> -<li><a class="reference" href="#complex-tables" id="id59" name="id59">2.20   Complex tables</a></li> -<li><a class="reference" href="#list-tables" id="id60" name="id60">2.21   List Tables</a></li> +<li><a class="reference" href="#substitution-definitions" id="id62" name="id62">2.15   Substitution Definitions</a></li> +<li><a class="reference" href="#comments" id="id63" name="id63">2.16   Comments</a></li> +<li><a class="reference" href="#raw-text" id="id64" name="id64">2.17   Raw text</a></li> +<li><a class="reference" href="#colspanning-tables" id="id65" name="id65">2.18   Colspanning tables</a></li> +<li><a class="reference" href="#rowspanning-tables" id="id66" name="id66">2.19   Rowspanning tables</a></li> +<li><a class="reference" href="#complex-tables" id="id67" name="id67">2.20   Complex tables</a></li> +<li><a class="reference" href="#list-tables" id="id68" name="id68">2.21   List Tables</a></li> </ul> </li> -<li><a class="reference" href="#error-handling" id="id61" name="id61">3   Error Handling</a></li> +<li><a class="reference" href="#error-handling" id="id69" name="id69">3   Error Handling</a></li> </ul> </div> <div class="section" id="structural-elements"> -<h1><a class="toc-backref" href="#id25" name="structural-elements">1   Structural Elements</a></h1> +<h1><a class="toc-backref" href="#id33" name="structural-elements">1   Structural Elements</a></h1> <div class="section" id="section-title"> -<h2 class="with-subtitle"><a class="toc-backref" href="#id26" name="section-title">1.1   Section Title</a></h2> +<h2 class="with-subtitle"><a class="toc-backref" href="#id34" name="section-title">1.1   Section Title</a></h2> <h2 class="section-subtitle" id="section-subtitle"><span class="section-subtitle">Section Subtitle</span></h2> <p>That's it, the text just above this line.</p> </div> <div class="section" id="empty-section"> -<h2><a class="toc-backref" href="#id27" name="empty-section">1.2   Empty Section</a></h2> +<h2><a class="toc-backref" href="#id35" name="empty-section">1.2   Empty Section</a></h2> </div> <div class="section" id="transitions"> -<h2><a class="toc-backref" href="#id28" name="transitions">1.3   Transitions</a></h2> +<h2><a class="toc-backref" href="#id36" name="transitions">1.3   Transitions</a></h2> <p>Here's a transition:</p> <hr class="docutils" /> <p>It divides the section. Transitions may also occur between sections:</p> @@ -156,12 +156,12 @@ They are transformed from section titles after parsing. --> </div> <hr class="docutils" /> <div class="section" id="body-elements"> -<h1><a class="toc-backref" href="#id29" name="body-elements">2   Body Elements</a></h1> +<h1><a class="toc-backref" href="#id37" name="body-elements">2   Body Elements</a></h1> <div class="section" id="paragraphs"> -<h2><a class="toc-backref" href="#id30" name="paragraphs">2.1   Paragraphs</a></h2> +<h2><a class="toc-backref" href="#id38" name="paragraphs">2.1   Paragraphs</a></h2> <p>A paragraph.</p> <div class="section" id="inline-markup"> -<h3><a class="toc-backref" href="#id31" name="inline-markup">2.1.1   Inline Markup</a></h3> +<h3><a class="toc-backref" href="#id39" name="inline-markup">2.1.1   Inline Markup</a></h3> <p>Paragraphs contain text and may contain inline markup: <em>emphasis</em>, <strong>strong emphasis</strong>, <tt class="docutils literal"><span class="pre">inline</span> <span class="pre">literals</span></tt>, standalone hyperlinks (<a class="reference" href="http://www.python.org">http://www.python.org</a>), external hyperlinks (<a class="reference" href="http://www.python.org/">Python</a> <a class="footnote-reference" href="#id21" id="id22" name="id22">[5]</a>), internal @@ -192,7 +192,7 @@ live link to PEP 258 here.</p> </div> </div> <div class="section" id="bullet-lists"> -<h2><a class="toc-backref" href="#id32" name="bullet-lists">2.2   Bullet Lists</a></h2> +<h2><a class="toc-backref" href="#id40" name="bullet-lists">2.2   Bullet Lists</a></h2> <ul> <li><p class="first">A bullet list</p> <ul class="simple"> @@ -217,7 +217,7 @@ live link to PEP 258 here.</p> </ul> </div> <div class="section" id="enumerated-lists"> -<h2><a class="toc-backref" href="#id33" name="enumerated-lists">2.3   Enumerated Lists</a></h2> +<h2><a class="toc-backref" href="#id41" name="enumerated-lists">2.3   Enumerated Lists</a></h2> <ol class="arabic"> <li><p class="first">Arabic numerals.</p> <ol class="loweralpha simple"> @@ -250,7 +250,7 @@ live link to PEP 258 here.</p> </ol> </div> <div class="section" id="definition-lists"> -<h2><a class="toc-backref" href="#id34" name="definition-lists">2.4   Definition Lists</a></h2> +<h2><a class="toc-backref" href="#id42" name="definition-lists">2.4   Definition Lists</a></h2> <dl class="docutils"> <dt>Term</dt> <dd>Definition</dd> @@ -265,7 +265,7 @@ live link to PEP 258 here.</p> </dl> </div> <div class="section" id="field-lists"> -<h2><a class="toc-backref" href="#id35" name="field-lists">2.5   Field Lists</a></h2> +<h2><a class="toc-backref" href="#id43" name="field-lists">2.5   Field Lists</a></h2> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> @@ -288,7 +288,7 @@ doesn't get stripped away.)</p> </table> </div> <div class="section" id="option-lists"> -<h2><a class="toc-backref" href="#id36" name="option-lists">2.6   Option Lists</a></h2> +<h2><a class="toc-backref" href="#id44" name="option-lists">2.6   Option Lists</a></h2> <p>For listing command-line options:</p> <table class="docutils option-list" frame="void" rules="none"> <col class="option" /> @@ -334,7 +334,7 @@ regardless of where it starts.</p> description.</p> </div> <div class="section" id="literal-blocks"> -<h2><a class="toc-backref" href="#id37" name="literal-blocks">2.7   Literal Blocks</a></h2> +<h2><a class="toc-backref" href="#id45" name="literal-blocks">2.7   Literal Blocks</a></h2> <p>Literal blocks are indicated with a double-colon ("::") at the end of the preceding paragraph (over there <tt class="docutils literal"><span class="pre">--></span></tt>). They can be indented:</p> <pre class="literal-block"> @@ -351,7 +351,7 @@ if literal_block: </pre> </div> <div class="section" id="line-blocks"> -<h2><a class="toc-backref" href="#id38" name="line-blocks">2.8   Line Blocks</a></h2> +<h2><a class="toc-backref" href="#id46" name="line-blocks">2.8   Line Blocks</a></h2> <p>This section tests line blocks. Line blocks are body elements which consist of lines and other line blocks. Nested line blocks cause indentation.</p> @@ -410,7 +410,7 @@ the left edge of the text above it.</div> </blockquote> </div> <div class="section" id="block-quotes"> -<h2><a class="toc-backref" href="#id39" name="block-quotes">2.9   Block Quotes</a></h2> +<h2><a class="toc-backref" href="#id47" name="block-quotes">2.9   Block Quotes</a></h2> <p>Block quotes consist of indented body elements:</p> <blockquote> <p>My theory by A. Elk. Brackets Miss, brackets. This theory goes @@ -422,7 +422,7 @@ own it, and what it is too.</p> </blockquote> </div> <div class="section" id="doctest-blocks"> -<h2><a class="toc-backref" href="#id40" name="doctest-blocks">2.10   Doctest Blocks</a></h2> +<h2><a class="toc-backref" href="#id48" name="doctest-blocks">2.10   Doctest Blocks</a></h2> <pre class="doctest-block"> >>> print 'Python-specific usage examples; begun with ">>>"' Python-specific usage examples; begun with ">>>" @@ -431,7 +431,7 @@ Python-specific usage examples; begun with ">>>" </pre> </div> <div class="section" id="footnotes"> -<h2><a class="toc-backref" href="#id41" name="footnotes">2.11   Footnotes</a></h2> +<h2><a class="toc-backref" href="#id49" name="footnotes">2.11   Footnotes</a></h2> <table class="docutils footnote" frame="void" id="id6" rules="none"> <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> @@ -478,12 +478,12 @@ Here's a reference to the next footnote: <a class="footnote-reference" href="#id <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> <tr><td class="label"><a name="id13">[4]</a></td><td>Here's an unreferenced footnote, with a reference to a -nonexistent footnote: <a href="#id69" name="id70"><span class="problematic" id="id70">[5]_</span></a>.</td></tr> +nonexistent footnote: <a href="#id25" name="id26"><span class="problematic" id="id26">[5]_</span></a>.</td></tr> </tbody> </table> </div> <div class="section" id="citations"> -<h2><a class="toc-backref" href="#id42" name="citations">2.12   Citations</a></h2> +<h2><a class="toc-backref" href="#id50" name="citations">2.12   Citations</a></h2> <table class="docutils citation" frame="void" id="cit2002" rules="none"> <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> @@ -491,11 +491,11 @@ nonexistent footnote: <a href="#id69" name="id70"><span class="problematic" id=" rendered separately and differently from footnotes.</td></tr> </tbody> </table> -<p>Here's a reference to the above, <a class="citation-reference" href="#cit2002" id="id15" name="id15">[CIT2002]</a>, and a <a href="#id71" name="id72"><span class="problematic" id="id72">[nonexistent]_</span></a> +<p>Here's a reference to the above, <a class="citation-reference" href="#cit2002" id="id15" name="id15">[CIT2002]</a>, and a <a href="#id27" name="id28"><span class="problematic" id="id28">[nonexistent]_</span></a> citation.</p> </div> <div class="section" id="targets"> -<span id="another-target"></span><h2><a class="toc-backref" href="#id43" name="targets">2.13   Targets</a></h2> +<span id="another-target"></span><h2><a class="toc-backref" href="#id51" name="targets">2.13   Targets</a></h2> <p id="example">This paragraph is pointed to by the explicit "example" target. A reference can be found under <a class="reference" href="#inline-markup">Inline Markup</a>, above. <a class="reference" href="#inline-hyperlink-targets">Inline hyperlink targets</a> are also possible.</p> @@ -505,45 +505,45 @@ hyperlink targets</a> are also possible.</p> "<a class="reference" href="http://www.python.org/">Python</a> <a class="footnote-reference" href="#id21" id="id23" name="id23">[5]</a>".</p> <p>Targets may be indirect and anonymous. Thus <a class="reference" href="#targets">this phrase</a> may also refer to the <a class="reference" href="#targets">Targets</a> section.</p> -<p>Here's a <a href="#id73" name="id74"><span class="problematic" id="id74">`hyperlink reference without a target`_</span></a>, which generates an +<p>Here's a <a href="#id29" name="id30"><span class="problematic" id="id30">`hyperlink reference without a target`_</span></a>, which generates an error.</p> <div class="section" id="duplicate-target-names"> -<h3><a class="toc-backref" href="#id44" name="duplicate-target-names">2.13.1   Duplicate Target Names</a></h3> +<h3><a class="toc-backref" href="#id52" name="duplicate-target-names">2.13.1   Duplicate Target Names</a></h3> <p>Duplicate names in section headers or other implicit targets will generate "info" (level-1) system messages. Duplicate names in explicit targets will generate "warning" (level-2) system messages.</p> </div> <div class="section" id="id18"> -<h3><a class="toc-backref" href="#id45" name="id18">2.13.2   Duplicate Target Names</a></h3> +<h3><a class="toc-backref" href="#id53" name="id18">2.13.2   Duplicate Target Names</a></h3> <p>Since there are two "Duplicate Target Names" section headers, we cannot uniquely refer to either of them by name. If we try to (like -this: <a href="#id75" name="id76"><span class="problematic" id="id76">`Duplicate Target Names`_</span></a>), an error is generated.</p> +this: <a href="#id31" name="id32"><span class="problematic" id="id32">`Duplicate Target Names`_</span></a>), an error is generated.</p> </div> </div> <div class="section" id="directives"> -<h2><a class="toc-backref" href="#id46" name="directives">2.14   Directives</a></h2> +<h2><a class="toc-backref" href="#id54" name="directives">2.14   Directives</a></h2> <div class="contents local topic" id="contents"> <ul class="auto-toc simple"> -<li><a class="reference" href="#document-parts" id="id62" name="id62">2.14.1   Document Parts</a></li> -<li><a class="reference" href="#images" id="id63" name="id63">2.14.2   Images</a></li> -<li><a class="reference" href="#admonitions" id="id64" name="id64">2.14.3   Admonitions</a></li> -<li><a class="reference" href="#topics-sidebars-and-rubrics" id="id65" name="id65">2.14.4   Topics, Sidebars, and Rubrics</a></li> -<li><a class="reference" href="#target-footnotes" id="id66" name="id66">2.14.5   Target Footnotes</a></li> -<li><a class="reference" href="#replacement-text" id="id67" name="id67">2.14.6   Replacement Text</a></li> -<li><a class="reference" href="#compound-paragraph" id="id68" name="id68">2.14.7   Compound Paragraph</a></li> +<li><a class="reference" href="#document-parts" id="id70" name="id70">2.14.1   Document Parts</a></li> +<li><a class="reference" href="#images" id="id71" name="id71">2.14.2   Images</a></li> +<li><a class="reference" href="#admonitions" id="id72" name="id72">2.14.3   Admonitions</a></li> +<li><a class="reference" href="#topics-sidebars-and-rubrics" id="id73" name="id73">2.14.4   Topics, Sidebars, and Rubrics</a></li> +<li><a class="reference" href="#target-footnotes" id="id74" name="id74">2.14.5   Target Footnotes</a></li> +<li><a class="reference" href="#replacement-text" id="id75" name="id75">2.14.6   Replacement Text</a></li> +<li><a class="reference" href="#compound-paragraph" id="id76" name="id76">2.14.7   Compound Paragraph</a></li> </ul> </div> <p>These are just a sample of the many reStructuredText Directives. For others, please see <a class="reference" href="http://docutils.sourceforge.net/docs/ref/rst/directives.html">http://docutils.sourceforge.net/docs/ref/rst/directives.html</a>.</p> <div class="section" id="document-parts"> -<h3><a class="toc-backref" href="#id62" name="document-parts">2.14.1   Document Parts</a></h3> +<h3><a class="toc-backref" href="#id70" name="document-parts">2.14.1   Document Parts</a></h3> <p>An example of the "contents" directive can be seen above this section (a local, untitled table of <a class="reference" href="#contents">contents</a>) and at the beginning of the document (a document-wide <a class="reference" href="#table-of-contents">table of contents</a>).</p> </div> <div class="section" id="images"> -<h3><a class="toc-backref" href="#id63" name="images">2.14.2   Images</a></h3> +<h3><a class="toc-backref" href="#id71" name="images">2.14.2   Images</a></h3> <p>An image directive (also clickable -- a hyperlink reference):</p> <a class="reference image-reference" href="#directives"><img alt="../../../docs/user/rst/images/title.png" class="class1 class2" src="../../../docs/user/rst/images/title.png" /></a> <p>Image with multiple IDs:</p> @@ -605,7 +605,7 @@ document (a document-wide <a class="reference" href="#table-of-contents">table o <img alt="../../../docs/user/rst/images/biohazard.png" src="../../../docs/user/rst/images/biohazard.png" style="height: 3cm;" /> </div> <div class="section" id="admonitions"> -<h3><a class="toc-backref" href="#id64" name="admonitions">2.14.3   Admonitions</a></h3> +<h3><a class="toc-backref" href="#id72" name="admonitions">2.14.3   Admonitions</a></h3> <div class="attention"> <p class="first admonition-title">Attention!</p> <p class="last">Directives at large.</p> @@ -654,7 +654,7 @@ Reader discretion is strongly advised.</p> </div> </div> <div class="section" id="topics-sidebars-and-rubrics"> -<h3><a class="toc-backref" href="#id65" name="topics-sidebars-and-rubrics">2.14.4   Topics, Sidebars, and Rubrics</a></h3> +<h3><a class="toc-backref" href="#id73" name="topics-sidebars-and-rubrics">2.14.4   Topics, Sidebars, and Rubrics</a></h3> <div class="sidebar"> <p class="first sidebar-title">Sidebar Title</p> <p class="sidebar-subtitle">Optional Subtitle</p> @@ -671,7 +671,7 @@ background color.</p> <p class="rubric">This is a rubric</p> </div> <div class="section" id="target-footnotes"> -<h3><a class="toc-backref" href="#id66" name="target-footnotes">2.14.5   Target Footnotes</a></h3> +<h3><a class="toc-backref" href="#id74" name="target-footnotes">2.14.5   Target Footnotes</a></h3> <table class="docutils footnote" frame="void" id="id21" rules="none"> <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> @@ -680,11 +680,11 @@ background color.</p> </table> </div> <div class="section" id="replacement-text"> -<h3><a class="toc-backref" href="#id67" name="replacement-text">2.14.6   Replacement Text</a></h3> +<h3><a class="toc-backref" href="#id75" name="replacement-text">2.14.6   Replacement Text</a></h3> <p>I recommend you try <a class="reference" href="http://www.python.org/">Python, <em>the</em> best language around</a> <a class="footnote-reference" href="#id21" id="id24" name="id24">[5]</a>.</p> </div> <div class="section" id="compound-paragraph"> -<h3><a class="toc-backref" href="#id68" name="compound-paragraph">2.14.7   Compound Paragraph</a></h3> +<h3><a class="toc-backref" href="#id76" name="compound-paragraph">2.14.7   Compound Paragraph</a></h3> <div class="some-class compound"> <p class="compound-first">Compound 1, paragraph 1.</p> <p class="compound-middle">Compound 1, paragraph 2.</p> @@ -752,12 +752,12 @@ paragraph.</td> </div> </div> <div class="section" id="substitution-definitions"> -<h2><a class="toc-backref" href="#id54" name="substitution-definitions">2.15   Substitution Definitions</a></h2> +<h2><a class="toc-backref" href="#id62" name="substitution-definitions">2.15   Substitution Definitions</a></h2> <p>An inline image (<img alt="EXAMPLE" src="../../../docs/user/rst/images/biohazard.png" />) example:</p> <p>(Substitution definitions are not visible in the HTML source.)</p> </div> <div class="section" id="comments"> -<h2><a class="toc-backref" href="#id55" name="comments">2.16   Comments</a></h2> +<h2><a class="toc-backref" href="#id63" name="comments">2.16   Comments</a></h2> <p>Here's one:</p> <!-- Comments begin with two dots and a space. Anything may follow, except for the syntax of footnotes, hyperlink @@ -767,13 +767,13 @@ Double-dashes - - "- -" - - must be escaped somehow in HTML output. --> <p>(View the HTML source to see the comment.)</p> </div> <div class="section" id="raw-text"> -<h2><a class="toc-backref" href="#id56" name="raw-text">2.17   Raw text</a></h2> +<h2><a class="toc-backref" href="#id64" name="raw-text">2.17   Raw text</a></h2> <p>This does not necessarily look nice, because there may be missing white space.</p> <p>It's just there to freeze the behavior.</p> A test.Second test.<div class="myclass">Another test with myclass set.</div><p>This is the <span class="myrawroleclass">fourth test</span> with myrawroleclass set.</p> Fifth test in HTML.<br />Line two.</div> <div class="section" id="colspanning-tables"> -<h2><a class="toc-backref" href="#id57" name="colspanning-tables">2.18   Colspanning tables</a></h2> +<h2><a class="toc-backref" href="#id65" name="colspanning-tables">2.18   Colspanning tables</a></h2> <p>This table has a cell spanning two columns:</p> <table border="1" class="docutils"> <colgroup> @@ -811,7 +811,7 @@ Fifth test in HTML.<br />Line two.</div> </table> </div> <div class="section" id="rowspanning-tables"> -<h2><a class="toc-backref" href="#id58" name="rowspanning-tables">2.19   Rowspanning tables</a></h2> +<h2><a class="toc-backref" href="#id66" name="rowspanning-tables">2.19   Rowspanning tables</a></h2> <p>Here's a table with cells spanning several rows:</p> <table border="1" class="docutils"> <colgroup> @@ -844,7 +844,7 @@ cell.</td> </table> </div> <div class="section" id="complex-tables"> -<h2><a class="toc-backref" href="#id59" name="complex-tables">2.20   Complex tables</a></h2> +<h2><a class="toc-backref" href="#id67" name="complex-tables">2.20   Complex tables</a></h2> <p>Here's a complex table, which should test all features.</p> <table border="1" class="docutils"> <colgroup> @@ -893,7 +893,7 @@ empty: <tt class="docutils literal"><span class="pre">--></span></tt></td> </table> </div> <div class="section" id="list-tables"> -<h2><a class="toc-backref" href="#id60" name="list-tables">2.21   List Tables</a></h2> +<h2><a class="toc-backref" href="#id68" name="list-tables">2.21   List Tables</a></h2> <p>Here's a list table exercising all features:</p> <table border="1" class="test docutils"> <caption>list table with integral header</caption> @@ -927,7 +927,7 @@ crunchy, now would it?</td> </div> </div> <div class="section" id="error-handling"> -<h1><a class="toc-backref" href="#id61" name="error-handling">3   Error Handling</a></h1> +<h1><a class="toc-backref" href="#id69" name="error-handling">3   Error Handling</a></h1> <p>Any errors caught during processing will generate system messages.</p> <p>There should be five messages in the following, auto-generated section, "Docutils System Messages":</p> @@ -938,17 +938,17 @@ section, "Docutils System Messages":</p> <div class="system-message" id="id19"> <p class="system-message-title">System Message: <a name="id19">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 100); <em><a href="#id20">backlink</a></em></p> Undefined substitution referenced: "problematic".</div> -<div class="system-message" id="id69"> -<p class="system-message-title">System Message: <a name="id69">ERROR/3</a> (<tt class="docutils">functional/input/standalone_rst_html4css1.txt</tt>, line 354); <em><a href="#id70">backlink</a></em></p> +<div class="system-message" id="id25"> +<p class="system-message-title">System Message: <a name="id25">ERROR/3</a> (<tt class="docutils">functional/input/standalone_rst_html4css1.txt</tt>, line 354); <em><a href="#id26">backlink</a></em></p> Unknown target name: "5".</div> -<div class="system-message" id="id71"> -<p class="system-message-title">System Message: <a name="id71">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 363); <em><a href="#id72">backlink</a></em></p> +<div class="system-message" id="id27"> +<p class="system-message-title">System Message: <a name="id27">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 363); <em><a href="#id28">backlink</a></em></p> Unknown target name: "nonexistent".</div> -<div class="system-message" id="id73"> -<p class="system-message-title">System Message: <a name="id73">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 390); <em><a href="#id74">backlink</a></em></p> +<div class="system-message" id="id29"> +<p class="system-message-title">System Message: <a name="id29">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 390); <em><a href="#id30">backlink</a></em></p> Unknown target name: "hyperlink reference without a target".</div> -<div class="system-message" id="id75"> -<p class="system-message-title">System Message: <a name="id75">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 403); <em><a href="#id76">backlink</a></em></p> +<div class="system-message" id="id31"> +<p class="system-message-title">System Message: <a name="id31">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 403); <em><a href="#id32">backlink</a></em></p> Duplicate target name, cannot be used as a unique reference: "duplicate target names".</div> </div> </div> diff --git a/test/functional/expected/standalone_rst_pseudoxml.txt b/test/functional/expected/standalone_rst_pseudoxml.txt index 2ae7e5c3b..c098ff0e0 100644 --- a/test/functional/expected/standalone_rst_pseudoxml.txt +++ b/test/functional/expected/standalone_rst_pseudoxml.txt @@ -91,238 +91,238 @@ <bullet_list classes="auto-toc"> <list_item> <paragraph> - <reference ids="id25" refid="structural-elements"> + <reference ids="id33" refid="structural-elements"> <generated classes="sectnum"> 1    Structural Elements <bullet_list classes="auto-toc"> <list_item> <paragraph> - <reference ids="id26" refid="section-title"> + <reference ids="id34" refid="section-title"> <generated classes="sectnum"> 1.1    Section Title <list_item> <paragraph> - <reference ids="id27" refid="empty-section"> + <reference ids="id35" refid="empty-section"> <generated classes="sectnum"> 1.2    Empty Section <list_item> <paragraph> - <reference ids="id28" refid="transitions"> + <reference ids="id36" refid="transitions"> <generated classes="sectnum"> 1.3    Transitions <list_item> <paragraph> - <reference ids="id29" refid="body-elements"> + <reference ids="id37" refid="body-elements"> <generated classes="sectnum"> 2    Body Elements <bullet_list classes="auto-toc"> <list_item> <paragraph> - <reference ids="id30" refid="paragraphs"> + <reference ids="id38" refid="paragraphs"> <generated classes="sectnum"> 2.1    Paragraphs <bullet_list classes="auto-toc"> <list_item> <paragraph> - <reference ids="id31" refid="inline-markup"> + <reference ids="id39" refid="inline-markup"> <generated classes="sectnum"> 2.1.1    Inline Markup <list_item> <paragraph> - <reference ids="id32" refid="bullet-lists"> + <reference ids="id40" refid="bullet-lists"> <generated classes="sectnum"> 2.2    Bullet Lists <list_item> <paragraph> - <reference ids="id33" refid="enumerated-lists"> + <reference ids="id41" refid="enumerated-lists"> <generated classes="sectnum"> 2.3    Enumerated Lists <list_item> <paragraph> - <reference ids="id34" refid="definition-lists"> + <reference ids="id42" refid="definition-lists"> <generated classes="sectnum"> 2.4    Definition Lists <list_item> <paragraph> - <reference ids="id35" refid="field-lists"> + <reference ids="id43" refid="field-lists"> <generated classes="sectnum"> 2.5    Field Lists <list_item> <paragraph> - <reference ids="id36" refid="option-lists"> + <reference ids="id44" refid="option-lists"> <generated classes="sectnum"> 2.6    Option Lists <list_item> <paragraph> - <reference ids="id37" refid="literal-blocks"> + <reference ids="id45" refid="literal-blocks"> <generated classes="sectnum"> 2.7    Literal Blocks <list_item> <paragraph> - <reference ids="id38" refid="line-blocks"> + <reference ids="id46" refid="line-blocks"> <generated classes="sectnum"> 2.8    Line Blocks <list_item> <paragraph> - <reference ids="id39" refid="block-quotes"> + <reference ids="id47" refid="block-quotes"> <generated classes="sectnum"> 2.9    Block Quotes <list_item> <paragraph> - <reference ids="id40" refid="doctest-blocks"> + <reference ids="id48" refid="doctest-blocks"> <generated classes="sectnum"> 2.10    Doctest Blocks <list_item> <paragraph> - <reference ids="id41" refid="footnotes"> + <reference ids="id49" refid="footnotes"> <generated classes="sectnum"> 2.11    Footnotes <list_item> <paragraph> - <reference ids="id42" refid="citations"> + <reference ids="id50" refid="citations"> <generated classes="sectnum"> 2.12    Citations <list_item> <paragraph> - <reference ids="id43" refid="targets"> + <reference ids="id51" refid="targets"> <generated classes="sectnum"> 2.13    Targets <bullet_list classes="auto-toc"> <list_item> <paragraph> - <reference ids="id44" refid="duplicate-target-names"> + <reference ids="id52" refid="duplicate-target-names"> <generated classes="sectnum"> 2.13.1    Duplicate Target Names <list_item> <paragraph> - <reference ids="id45" refid="id18"> + <reference ids="id53" refid="id18"> <generated classes="sectnum"> 2.13.2    Duplicate Target Names <list_item> <paragraph> - <reference ids="id46" refid="directives"> + <reference ids="id54" refid="directives"> <generated classes="sectnum"> 2.14    Directives <bullet_list classes="auto-toc"> <list_item> <paragraph> - <reference ids="id47" refid="document-parts"> + <reference ids="id55" refid="document-parts"> <generated classes="sectnum"> 2.14.1    Document Parts <list_item> <paragraph> - <reference ids="id48" refid="images"> + <reference ids="id56" refid="images"> <generated classes="sectnum"> 2.14.2    Images <list_item> <paragraph> - <reference ids="id49" refid="admonitions"> + <reference ids="id57" refid="admonitions"> <generated classes="sectnum"> 2.14.3    Admonitions <list_item> <paragraph> - <reference ids="id50" refid="topics-sidebars-and-rubrics"> + <reference ids="id58" refid="topics-sidebars-and-rubrics"> <generated classes="sectnum"> 2.14.4    Topics, Sidebars, and Rubrics <list_item> <paragraph> - <reference ids="id51" refid="target-footnotes"> + <reference ids="id59" refid="target-footnotes"> <generated classes="sectnum"> 2.14.5    Target Footnotes <list_item> <paragraph> - <reference ids="id52" refid="replacement-text"> + <reference ids="id60" refid="replacement-text"> <generated classes="sectnum"> 2.14.6    Replacement Text <list_item> <paragraph> - <reference ids="id53" refid="compound-paragraph"> + <reference ids="id61" refid="compound-paragraph"> <generated classes="sectnum"> 2.14.7    Compound Paragraph <list_item> <paragraph> - <reference ids="id54" refid="substitution-definitions"> + <reference ids="id62" refid="substitution-definitions"> <generated classes="sectnum"> 2.15    Substitution Definitions <list_item> <paragraph> - <reference ids="id55" refid="comments"> + <reference ids="id63" refid="comments"> <generated classes="sectnum"> 2.16    Comments <list_item> <paragraph> - <reference ids="id56" refid="raw-text"> + <reference ids="id64" refid="raw-text"> <generated classes="sectnum"> 2.17    Raw text <list_item> <paragraph> - <reference ids="id57" refid="colspanning-tables"> + <reference ids="id65" refid="colspanning-tables"> <generated classes="sectnum"> 2.18    Colspanning tables <list_item> <paragraph> - <reference ids="id58" refid="rowspanning-tables"> + <reference ids="id66" refid="rowspanning-tables"> <generated classes="sectnum"> 2.19    Rowspanning tables <list_item> <paragraph> - <reference ids="id59" refid="complex-tables"> + <reference ids="id67" refid="complex-tables"> <generated classes="sectnum"> 2.20    Complex tables <list_item> <paragraph> - <reference ids="id60" refid="list-tables"> + <reference ids="id68" refid="list-tables"> <generated classes="sectnum"> 2.21    List Tables <list_item> <paragraph> - <reference ids="id61" refid="error-handling"> + <reference ids="id69" refid="error-handling"> <generated classes="sectnum"> 3    Error Handling <section ids="structural-elements" names="structural elements"> - <title auto="1" refid="id25"> + <title auto="1" refid="id33"> <generated classes="sectnum"> 1    Structural Elements <section ids="section-title" names="section title"> - <title auto="1" refid="id26"> + <title auto="1" refid="id34"> <generated classes="sectnum"> 1.1    Section Title @@ -331,12 +331,12 @@ <paragraph> That's it, the text just above this line. <section ids="empty-section" names="empty section"> - <title auto="1" refid="id27"> + <title auto="1" refid="id35"> <generated classes="sectnum"> 1.2    Empty Section <section ids="transitions" names="transitions"> - <title auto="1" refid="id28"> + <title auto="1" refid="id36"> <generated classes="sectnum"> 1.3    Transitions @@ -347,19 +347,19 @@ It divides the section. Transitions may also occur between sections: <transition> <section ids="body-elements" names="body elements"> - <title auto="1" refid="id29"> + <title auto="1" refid="id37"> <generated classes="sectnum"> 2    Body Elements <section ids="paragraphs" names="paragraphs"> - <title auto="1" refid="id30"> + <title auto="1" refid="id38"> <generated classes="sectnum"> 2.1    Paragraphs <paragraph> A paragraph. <section ids="inline-markup" names="inline markup"> - <title auto="1" refid="id31"> + <title auto="1" refid="id39"> <generated classes="sectnum"> 2.1.1    Inline Markup @@ -484,7 +484,7 @@ option was supplied, there should be a live link to PEP 258 here. <section ids="bullet-lists" names="bullet lists"> - <title auto="1" refid="id32"> + <title auto="1" refid="id40"> <generated classes="sectnum"> 2.2    Bullet Lists @@ -528,7 +528,7 @@ <comment xml:space="preserve"> Even if this item contains a target and a comment. <section ids="enumerated-lists" names="enumerated lists"> - <title auto="1" refid="id33"> + <title auto="1" refid="id41"> <generated classes="sectnum"> 2.3    Enumerated Lists @@ -577,7 +577,7 @@ <paragraph> iv <section ids="definition-lists" names="definition lists"> - <title auto="1" refid="id34"> + <title auto="1" refid="id42"> <generated classes="sectnum"> 2.4    Definition Lists @@ -615,7 +615,7 @@ <paragraph> Definition <section ids="field-lists" names="field lists"> - <title auto="1" refid="id35"> + <title auto="1" refid="id43"> <generated classes="sectnum"> 2.5    Field Lists @@ -649,7 +649,7 @@ about credits but just for ensuring that the class attribute doesn't get stripped away.) <section ids="option-lists" names="option lists"> - <title auto="1" refid="id36"> + <title auto="1" refid="id44"> <generated classes="sectnum"> 2.6    Option Lists @@ -762,7 +762,7 @@ There must be at least two spaces between the option and the description. <section ids="literal-blocks" names="literal blocks"> - <title auto="1" refid="id37"> + <title auto="1" refid="id45"> <generated classes="sectnum"> 2.7    Literal Blocks @@ -784,7 +784,7 @@ > > Why didn't I think of that? <section ids="line-blocks" names="line blocks"> - <title auto="1" refid="id38"> + <title auto="1" refid="id46"> <generated classes="sectnum"> 2.8    Line Blocks @@ -862,7 +862,7 @@ <line> Singing... <section ids="block-quotes" names="block quotes"> - <title auto="1" refid="id39"> + <title auto="1" refid="id47"> <generated classes="sectnum"> 2.9    Block Quotes @@ -878,7 +878,7 @@ <attribution> Anne Elk (Miss) <section ids="doctest-blocks" names="doctest blocks"> - <title auto="1" refid="id40"> + <title auto="1" refid="id48"> <generated classes="sectnum"> 2.10    Doctest Blocks @@ -888,7 +888,7 @@ >>> print '(cut and pasted from interactive Python sessions)' (cut and pasted from interactive Python sessions) <section ids="footnotes" names="footnotes"> - <title auto="1" refid="id41"> + <title auto="1" refid="id49"> <generated classes="sectnum"> 2.11    Footnotes @@ -948,11 +948,11 @@ <paragraph> Here's an unreferenced footnote, with a reference to a nonexistent footnote: - <problematic ids="id70" refid="id69"> + <problematic ids="id26" refid="id25"> [5]_ . <section ids="citations" names="citations"> - <title auto="1" refid="id42"> + <title auto="1" refid="id50"> <generated classes="sectnum"> 2.12    Citations @@ -967,13 +967,13 @@ <citation_reference ids="id15" refid="cit2002"> CIT2002 , and a - <problematic ids="id72" refid="id71"> + <problematic ids="id28" refid="id27"> [nonexistent]_ citation. <target refid="another-target"> <section ids="targets another-target" names="targets another target"> - <title auto="1" refid="id43"> + <title auto="1" refid="id51"> <generated classes="sectnum"> 2.13    Targets @@ -1018,12 +1018,12 @@ <target anonymous="1" ids="id17" refid="targets"> <paragraph> Here's a - <problematic ids="id74" refid="id73"> + <problematic ids="id30" refid="id29"> `hyperlink reference without a target`_ , which generates an error. <section dupnames="duplicate target names" ids="duplicate-target-names"> - <title auto="1" refid="id44"> + <title auto="1" refid="id52"> <generated classes="sectnum"> 2.13.1    Duplicate Target Names @@ -1032,7 +1032,7 @@ generate "info" (level-1) system messages. Duplicate names in explicit targets will generate "warning" (level-2) system messages. <section dupnames="duplicate target names" ids="id18"> - <title auto="1" refid="id45"> + <title auto="1" refid="id53"> <generated classes="sectnum"> 2.13.2    Duplicate Target Names @@ -1040,11 +1040,11 @@ Since there are two "Duplicate Target Names" section headers, we cannot uniquely refer to either of them by name. If we try to (like this: - <problematic ids="id76" refid="id75"> + <problematic ids="id32" refid="id31"> `Duplicate Target Names`_ ), an error is generated. <section ids="directives" names="directives"> - <title auto="1" refid="id46"> + <title auto="1" refid="id54"> <generated classes="sectnum"> 2.14    Directives @@ -1052,43 +1052,43 @@ <bullet_list classes="auto-toc"> <list_item> <paragraph> - <reference ids="id62" refid="document-parts"> + <reference ids="id70" refid="document-parts"> <generated classes="sectnum"> 2.14.1    Document Parts <list_item> <paragraph> - <reference ids="id63" refid="images"> + <reference ids="id71" refid="images"> <generated classes="sectnum"> 2.14.2    Images <list_item> <paragraph> - <reference ids="id64" refid="admonitions"> + <reference ids="id72" refid="admonitions"> <generated classes="sectnum"> 2.14.3    Admonitions <list_item> <paragraph> - <reference ids="id65" refid="topics-sidebars-and-rubrics"> + <reference ids="id73" refid="topics-sidebars-and-rubrics"> <generated classes="sectnum"> 2.14.4    Topics, Sidebars, and Rubrics <list_item> <paragraph> - <reference ids="id66" refid="target-footnotes"> + <reference ids="id74" refid="target-footnotes"> <generated classes="sectnum"> 2.14.5    Target Footnotes <list_item> <paragraph> - <reference ids="id67" refid="replacement-text"> + <reference ids="id75" refid="replacement-text"> <generated classes="sectnum"> 2.14.6    Replacement Text <list_item> <paragraph> - <reference ids="id68" refid="compound-paragraph"> + <reference ids="id76" refid="compound-paragraph"> <generated classes="sectnum"> 2.14.7    Compound Paragraph @@ -1099,7 +1099,7 @@ http://docutils.sourceforge.net/docs/ref/rst/directives.html . <section ids="document-parts" names="document parts"> - <title auto="1" refid="id62"> + <title auto="1" refid="id70"> <generated classes="sectnum"> 2.14.1    Document Parts @@ -1114,7 +1114,7 @@ table of contents ). <section ids="images" names="images"> - <title auto="1" refid="id63"> + <title auto="1" refid="id71"> <generated classes="sectnum"> 2.14.2    Images @@ -1206,7 +1206,7 @@ An image 3 cm high: <image height="3cm" uri="../../../docs/user/rst/images/biohazard.png"> <section ids="admonitions" names="admonitions"> - <title auto="1" refid="id64"> + <title auto="1" refid="id72"> <generated classes="sectnum"> 2.14.3    Admonitions @@ -1256,7 +1256,7 @@ You can make up your own admonition too. <target ids="docutils" names="docutils" refuri="http://docutils.sourceforge.net/"> <section ids="topics-sidebars-and-rubrics" names="topics, sidebars, and rubrics"> - <title auto="1" refid="id65"> + <title auto="1" refid="id73"> <generated classes="sectnum"> 2.14.4    Topics, Sidebars, and Rubrics @@ -1281,7 +1281,7 @@ <rubric> This is a rubric <section ids="target-footnotes" names="target footnotes"> - <title auto="1" refid="id66"> + <title auto="1" refid="id74"> <generated classes="sectnum"> 2.14.5    Target Footnotes @@ -1292,7 +1292,7 @@ <reference refuri="http://www.python.org/"> http://www.python.org/ <section ids="replacement-text" names="replacement text"> - <title auto="1" refid="id67"> + <title auto="1" refid="id75"> <generated classes="sectnum"> 2.14.6    Replacement Text @@ -1313,7 +1313,7 @@ the best language around <section ids="compound-paragraph" names="compound paragraph"> - <title auto="1" refid="id68"> + <title auto="1" refid="id76"> <generated classes="sectnum"> 2.14.7    Compound Paragraph @@ -1398,7 +1398,7 @@ <paragraph> Compound 7, another paragraph. <section ids="substitution-definitions" names="substitution definitions"> - <title auto="1" refid="id54"> + <title auto="1" refid="id62"> <generated classes="sectnum"> 2.15    Substitution Definitions @@ -1411,7 +1411,7 @@ <paragraph> (Substitution definitions are not visible in the HTML source.) <section ids="comments" names="comments"> - <title auto="1" refid="id55"> + <title auto="1" refid="id63"> <generated classes="sectnum"> 2.16    Comments @@ -1426,7 +1426,7 @@ <paragraph> (View the HTML source to see the comment.) <section ids="raw-text" names="raw text"> - <title auto="1" refid="id56"> + <title auto="1" refid="id64"> <generated classes="sectnum"> 2.17    Raw text @@ -1450,7 +1450,7 @@ <raw format="latex" xml:space="preserve"> Fifth test in LaTeX.\\Line two. <section ids="colspanning-tables" names="colspanning tables"> - <title auto="1" refid="id57"> + <title auto="1" refid="id65"> <generated classes="sectnum"> 2.18    Colspanning tables @@ -1521,7 +1521,7 @@ <paragraph> True <section ids="rowspanning-tables" names="rowspanning tables"> - <title auto="1" refid="id58"> + <title auto="1" refid="id66"> <generated classes="sectnum"> 2.19    Rowspanning tables @@ -1573,7 +1573,7 @@ <paragraph> body row 3 <section ids="complex-tables" names="complex tables"> - <title auto="1" refid="id59"> + <title auto="1" refid="id67"> <generated classes="sectnum"> 2.20    Complex tables @@ -1658,7 +1658,7 @@ --> <entry> <section ids="list-tables" names="list tables"> - <title auto="1" refid="id60"> + <title auto="1" refid="id68"> <generated classes="sectnum"> 2.21    List Tables @@ -1715,7 +1715,7 @@ <paragraph> On a stick! <section ids="error-handling" names="error handling"> - <title auto="1" refid="id61"> + <title auto="1" refid="id69"> <generated classes="sectnum"> 3    Error Handling @@ -1732,15 +1732,15 @@ <system_message backrefs="id20" ids="id19" level="3" line="100" source="functional/input/data/standard.txt" type="ERROR"> <paragraph> Undefined substitution referenced: "problematic". - <system_message backrefs="id70" ids="id69" level="3" line="354" source="functional/input/standalone_rst_html4css1.txt" type="ERROR"> + <system_message backrefs="id26" ids="id25" level="3" line="354" source="functional/input/standalone_rst_html4css1.txt" type="ERROR"> <paragraph> Unknown target name: "5". - <system_message backrefs="id72" ids="id71" level="3" line="363" source="functional/input/data/standard.txt" type="ERROR"> + <system_message backrefs="id28" ids="id27" level="3" line="363" source="functional/input/data/standard.txt" type="ERROR"> <paragraph> Unknown target name: "nonexistent". - <system_message backrefs="id74" ids="id73" level="3" line="390" source="functional/input/data/standard.txt" type="ERROR"> + <system_message backrefs="id30" ids="id29" level="3" line="390" source="functional/input/data/standard.txt" type="ERROR"> <paragraph> Unknown target name: "hyperlink reference without a target". - <system_message backrefs="id76" ids="id75" level="3" line="403" source="functional/input/data/standard.txt" type="ERROR"> + <system_message backrefs="id32" ids="id31" level="3" line="403" source="functional/input/data/standard.txt" type="ERROR"> <paragraph> Duplicate target name, cannot be used as a unique reference: "duplicate target names". diff --git a/test/test_transforms/test_final_checks.py b/test/test_transforms/test_final_checks.py deleted file mode 100755 index 4d58b8dbc..000000000 --- a/test/test_transforms/test_final_checks.py +++ /dev/null @@ -1,77 +0,0 @@ -#! /usr/bin/env python - -# Author: David Goodger -# Contact: goodger@users.sourceforge.net -# Revision: $Revision$ -# Date: $Date$ -# Copyright: This module has been placed in the public domain. - -""" -Tests for docutils.transforms.universal.FinalChecks. -""" - -from __init__ import DocutilsTestSupport -from docutils.transforms.universal import FinalChecks -from docutils.parsers.rst import Parser - - -def suite(): - parser = Parser() - s = DocutilsTestSupport.TransformTestSuite(parser) - s.generateTests(totest) - return s - -totest = {} - -totest['references'] = ((FinalChecks,), [ -["""\ -Unknown reference_. -""", -"""\ -<document source="test data"> - <paragraph> - Unknown \n\ - <problematic ids="id2" refid="id1"> - reference_ - . - <system_message backrefs="id2" ids="id1" level="3" line="1" source="test data" type="ERROR"> - <paragraph> - Unknown target name: "reference". -"""], -["""\ -Duplicate manual footnote labels, with reference ([1]_): - -.. [1] Footnote. - -.. [1] Footnote. -""", -"""\ -<document source="test data"> - <paragraph> - Duplicate manual footnote labels, with reference ( - <problematic ids="id5" refid="id4"> - [1]_ - ): - <footnote dupnames="1" ids="id2"> - <label> - 1 - <paragraph> - Footnote. - <footnote dupnames="1" ids="id3"> - <label> - 1 - <system_message backrefs="id3" level="2" line="5" source="test data" type="WARNING"> - <paragraph> - Duplicate explicit target name: "1". - <paragraph> - Footnote. - <system_message backrefs="id5" ids="id4" level="3" line="1" source="test data" type="ERROR"> - <paragraph> - Duplicate target name, cannot be used as a unique reference: "1". -"""], -]) - - -if __name__ == '__main__': - import unittest - unittest.main(defaultTest='suite') diff --git a/test/test_transforms/test_hyperlinks.py b/test/test_transforms/test_hyperlinks.py index fc7441c5f..85dfe9a87 100755 --- a/test/test_transforms/test_hyperlinks.py +++ b/test/test_transforms/test_hyperlinks.py @@ -13,9 +13,8 @@ Tests for docutils.transforms.references.Hyperlinks. from __init__ import DocutilsTestSupport from docutils.transforms.references import PropagateTargets, \ AnonymousHyperlinks, IndirectHyperlinks, ExternalTargets, \ - InternalTargets + InternalTargets, DanglingReferences -from docutils.transforms.universal import FinalChecks from docutils.parsers.rst import Parser @@ -33,7 +32,7 @@ totest = {} totest['exhaustive_hyperlinks'] = ((PropagateTargets, AnonymousHyperlinks, IndirectHyperlinks, ExternalTargets, InternalTargets, - FinalChecks), [ + DanglingReferences), [ ["""\ direct_ external @@ -347,7 +346,7 @@ An `anonymous embedded uri <http://direct>`__. totest['hyperlinks'] = ((PropagateTargets, AnonymousHyperlinks, IndirectHyperlinks, ExternalTargets, - InternalTargets, FinalChecks), [ + InternalTargets, DanglingReferences), [ ["""\ .. _internal hyperlink: @@ -763,6 +762,51 @@ Title <title> Title """], +["""\ +Unknown reference_. +""", +"""\ +<document source="test data"> + <paragraph> + Unknown \n\ + <problematic ids="id2" refid="id1"> + reference_ + . + <system_message backrefs="id2" ids="id1" level="3" line="1" source="test data" type="ERROR"> + <paragraph> + Unknown target name: "reference". +"""], +["""\ +Duplicate manual footnote labels, with reference ([1]_): + +.. [1] Footnote. + +.. [1] Footnote. +""", +"""\ +<document source="test data"> + <paragraph> + Duplicate manual footnote labels, with reference ( + <problematic ids="id5" refid="id4"> + [1]_ + ): + <footnote dupnames="1" ids="id2"> + <label> + 1 + <paragraph> + Footnote. + <footnote dupnames="1" ids="id3"> + <label> + 1 + <system_message backrefs="id3" level="2" line="5" source="test data" type="WARNING"> + <paragraph> + Duplicate explicit target name: "1". + <paragraph> + Footnote. + <system_message backrefs="id5" ids="id4" level="3" line="1" source="test data" type="ERROR"> + <paragraph> + Duplicate target name, cannot be used as a unique reference: "1". +"""], ]) -- cgit v1.2.1 From 4687626a27fc714d021060ad45f4477c6dd904c8 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Wed, 6 Jul 2005 16:37:24 +0000 Subject: moved comparison methods up to StandardTestCase git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3662 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/DocutilsTestSupport.py | 46 ++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'test') diff --git a/test/DocutilsTestSupport.py b/test/DocutilsTestSupport.py index c0c2c331b..0466590fd 100644 --- a/test/DocutilsTestSupport.py +++ b/test/DocutilsTestSupport.py @@ -93,12 +93,34 @@ class StandardTestCase(unittest.TestCase): """ Helper class, providing the same interface as unittest.TestCase, - but with useful setUp and tearDown methods. + but with useful setUp and comparison methods. """ def setUp(self): os.chdir(testroot) + def failUnlessEqual(self, first, second, msg=None): + """Fail if the two objects are unequal as determined by the '==' + operator. + """ + if not first == second: + raise self.failureException, \ + (msg or '%s != %s' % _format_str(first, second)) + + def failIfEqual(self, first, second, msg=None): + """Fail if the two objects are equal as determined by the '==' + operator. + """ + if first == second: + raise self.failureException, \ + (msg or '%s == %s' % _format_str(first, second)) + + # Synonyms for assertion methods + + assertEqual = assertEquals = failUnlessEqual + + assertNotEqual = assertNotEquals = failIfEqual + class CustomTestCase(StandardTestCase): @@ -167,28 +189,6 @@ class CustomTestCase(StandardTestCase): print >>sys.stderr, 'output: %r' % output raise error - def failUnlessEqual(self, first, second, msg=None): - """Fail if the two objects are unequal as determined by the '==' - operator. - """ - if not first == second: - raise self.failureException, \ - (msg or '%s != %s' % _format_str(first, second)) - - def failIfEqual(self, first, second, msg=None): - """Fail if the two objects are equal as determined by the '==' - operator. - """ - if first == second: - raise self.failureException, \ - (msg or '%s == %s' % _format_str(first, second)) - - # Synonyms for assertion methods - - assertEqual = assertEquals = failUnlessEqual - - assertNotEqual = assertNotEquals = failIfEqual - class CustomTestSuite(unittest.TestSuite): -- cgit v1.2.1 From c5aecf0e115ab835a4c79657245bcaed911ad41e Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Thu, 7 Jul 2005 02:11:14 +0000 Subject: separated default (universal) transforms into two stages so that no transform is applied twice; do not delete document.transformer in publish_doctree (Martin, this may be important for the pickle writer -- you may need to delete document.transformer); regenerate reporter object unconditionally; do so in publish_from_doctree, not the doctree reader; added tests; I will post about all that on Docutils-develop in one or two days git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3663 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_publisher.py | 78 ++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 60 insertions(+), 18 deletions(-) (limited to 'test') diff --git a/test/test_publisher.py b/test/test_publisher.py index d5460694c..39b68cf37 100755 --- a/test/test_publisher.py +++ b/test/test_publisher.py @@ -10,61 +10,101 @@ Test the `Publisher` facade and the ``publish_*`` convenience functions. """ -import unittest -from types import DictType, StringType -from docutils import core, nodes import pickle +from types import DictType, StringType + +import docutils +from docutils import core, nodes, io + +import DocutilsTestSupport test_document = """\ Test Document ============= -This is a test document. +This is a test document with a broken reference: nonexistent_ """ pseudoxml_output = """\ <document ids="test-document" names="test document" source="<string>" title="Test Document"> <title> Test Document <paragraph> - This is a test document. + This is a test document with a broken reference: \n\ + <problematic ids="id2" refid="id1"> + nonexistent_ + <section classes="system-messages"> + <title> + Docutils System Messages + <system_message backrefs="id2" ids="id1" level="3" line="4" source="<string>" type="ERROR"> + <paragraph> + Unknown target name: "nonexistent". +""" +exposed_pseudoxml_output = """\ +<document ids="test-document" internal:refnames="{u\'nonexistent\': [<reference: <#text: u\'nonexistent\'>>]}" names="test document" source="<string>" title="Test Document"> + <title> + Test Document + <paragraph> + This is a test document with a broken reference: \n\ + <problematic ids="id2" refid="id1"> + nonexistent_ + <section classes="system-messages"> + <title> + Docutils System Messages + <system_message backrefs="id2" ids="id1" level="3" line="4" source="<string>" type="ERROR"> + <paragraph> + Unknown target name: "nonexistent". """ -class PublishDoctreeTestCase(unittest.TestCase): +class PublishDoctreeTestCase(DocutilsTestSupport.StandardTestCase, docutils.SettingsSpec): + + settings_default_overrides = { + '_disable_config': 1, + 'warning_stream': io.NullOutput()} def test_publish_doctree(self): - """Test `publish_doctree` and `publish_from_doctree`.""" + # Test `publish_doctree` and `publish_from_doctree`. # Produce the document tree. doctree = core.publish_doctree( - source=test_document, - reader_name='standalone', - parser_name='restructuredtext', - settings_overrides={'_disable_config': 1}) + source=test_document, reader_name='standalone', + parser_name='restructuredtext', settings_spec=self, + settings_overrides={'expose_internals': + ['refnames', 'do_not_expose'], + 'report_level': 5}) self.assert_(isinstance(doctree, nodes.document)) - + # Confirm that transforms have been applied (in this case, the # DocTitle transform): self.assert_(isinstance(doctree[0], nodes.title)) self.assert_(isinstance(doctree[1], nodes.paragraph)) + # Confirm that the Messages transform has not yet been applied: + self.assertEquals(len(doctree), 2) + # The `do_not_expose` attribute may not show up in the + # pseudoxml output because the expose_internals transform may + # not be applied twice. + doctree.do_not_expose = 'test' # Write out the document: output, parts = core.publish_from_doctree( doctree, writer_name='pseudoxml', - settings_overrides={'_disable_config': 1}) - self.assertEquals(output, pseudoxml_output) + settings_spec=self, + settings_overrides={'expose_internals': + ['refnames', 'do_not_expose'], + 'report_level': 1}) + self.assertEquals(output, exposed_pseudoxml_output) self.assert_(isinstance(parts, DictType)) def test_publish_pickle(self): - """Test publishing a document tree with pickling and unpickling.""" + # Test publishing a document tree with pickling and unpickling. # Produce the document tree. doctree = core.publish_doctree( source=test_document, reader_name='standalone', parser_name='restructuredtext', - settings_overrides={'_disable_config': 1}) + settings_spec=self) self.assert_(isinstance(doctree, nodes.document)) # Pickle the document. Note: if this fails, some unpickleable @@ -75,8 +115,9 @@ class PublishDoctreeTestCase(unittest.TestCase): # requirement, applications will be built on the assumption # that we can pickle the document. - # Remove the reporter before pickling. + # Remove the reporter and the transformer before pickling. doctree.reporter = None + doctree.transformer = None doctree_pickled = pickle.dumps(doctree) self.assert_(isinstance(doctree_pickled, StringType)) @@ -89,10 +130,11 @@ class PublishDoctreeTestCase(unittest.TestCase): # Write out the document: output, parts = core.publish_from_doctree( doctree_zombie, writer_name='pseudoxml', - settings_overrides={'_disable_config': 1}) + settings_spec=self) self.assertEquals(output, pseudoxml_output) self.assert_(isinstance(parts, DictType)) if __name__ == '__main__': + import unittest unittest.main() -- cgit v1.2.1 From dbe5d1f505a545190a1ed1adfc7d97772c710e38 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Fri, 8 Jul 2005 00:29:32 +0000 Subject: do not return parts dictionary in publish_from_doctree; you could use publish_parts for that, I think, and returning a tuple unnecessarily complicates the interface git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3671 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_publisher.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/test_publisher.py b/test/test_publisher.py index 39b68cf37..9446c07c2 100755 --- a/test/test_publisher.py +++ b/test/test_publisher.py @@ -11,7 +11,7 @@ Test the `Publisher` facade and the ``publish_*`` convenience functions. """ import pickle -from types import DictType, StringType +from types import StringType import docutils from docutils import core, nodes, io @@ -87,14 +87,13 @@ class PublishDoctreeTestCase(DocutilsTestSupport.StandardTestCase, docutils.Sett # not be applied twice. doctree.do_not_expose = 'test' # Write out the document: - output, parts = core.publish_from_doctree( + output = core.publish_from_doctree( doctree, writer_name='pseudoxml', settings_spec=self, settings_overrides={'expose_internals': ['refnames', 'do_not_expose'], 'report_level': 1}) self.assertEquals(output, exposed_pseudoxml_output) - self.assert_(isinstance(parts, DictType)) def test_publish_pickle(self): # Test publishing a document tree with pickling and unpickling. @@ -128,11 +127,10 @@ class PublishDoctreeTestCase(DocutilsTestSupport.StandardTestCase, docutils.Sett self.assert_(isinstance(doctree_zombie, nodes.document)) # Write out the document: - output, parts = core.publish_from_doctree( + output = core.publish_from_doctree( doctree_zombie, writer_name='pseudoxml', settings_spec=self) self.assertEquals(output, pseudoxml_output) - self.assert_(isinstance(parts, DictType)) if __name__ == '__main__': -- cgit v1.2.1 From 526bafba0ff4159728a02f9b068ce7f7a5d01cd6 Mon Sep 17 00:00:00 2001 From: blais <blais@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Fri, 8 Jul 2005 04:28:24 +0000 Subject: Added simple use case test for publishing document as parts. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3675 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_publisher.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/test_publisher.py b/test/test_publisher.py index 9446c07c2..28fecff62 100755 --- a/test/test_publisher.py +++ b/test/test_publisher.py @@ -11,7 +11,7 @@ Test the `Publisher` facade and the ``publish_*`` convenience functions. """ import pickle -from types import StringType +from types import StringType, DictType import docutils from docutils import core, nodes, io @@ -95,6 +95,12 @@ class PublishDoctreeTestCase(DocutilsTestSupport.StandardTestCase, docutils.Sett 'report_level': 1}) self.assertEquals(output, exposed_pseudoxml_output) + # Test publishing parts using document as the source. + parts = core.publish_parts( + reader_name='doctree', source_class=io.DocTreeInput, source=doctree, + source_path='test', writer_name='html') + self.assert_(isinstance(parts, DictType)) + def test_publish_pickle(self): # Test publishing a document tree with pickling and unpickling. -- cgit v1.2.1 From dc98554c2fc0308774c70dcebc6fe45617f22e00 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Fri, 15 Jul 2005 21:28:22 +0000 Subject: more precise error message git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3759 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/dangerous.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/functional/expected/dangerous.html b/test/functional/expected/dangerous.html index 9b9c321b6..89e86864b 100644 --- a/test/functional/expected/dangerous.html +++ b/test/functional/expected/dangerous.html @@ -46,14 +46,14 @@ </div> <div class="system-message"> <p class="system-message-title">System Message: WARNING/2 (<tt class="docutils">functional/input/dangerous.txt</tt>, line 13)</p> -<p>"csv-table" directive disabled.</p> +<p>File and URL access deactivated; ignoring "csv-table" directive.</p> <pre class="literal-block"> .. csv-table:: :file: /etc/passwd </pre> </div> <div class="system-message"> <p class="system-message-title">System Message: WARNING/2 (<tt class="docutils">functional/input/dangerous.txt</tt>, line 14)</p> -<p>"csv-table" directive disabled.</p> +<p>File and URL access deactivated; ignoring "csv-table" directive.</p> <pre class="literal-block"> .. csv-table:: :url: file:///etc/passwd </pre> -- cgit v1.2.1 From ac59b2c6739587c69ab2b5e7f1212e1b17529651 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Fri, 15 Jul 2005 21:38:42 +0000 Subject: fixed test case (no settings_spec) git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3760 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_publisher.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/test_publisher.py b/test/test_publisher.py index 28fecff62..f395eb419 100755 --- a/test/test_publisher.py +++ b/test/test_publisher.py @@ -97,8 +97,9 @@ class PublishDoctreeTestCase(DocutilsTestSupport.StandardTestCase, docutils.Sett # Test publishing parts using document as the source. parts = core.publish_parts( - reader_name='doctree', source_class=io.DocTreeInput, source=doctree, - source_path='test', writer_name='html') + reader_name='doctree', source_class=io.DocTreeInput, + source=doctree, source_path='test', writer_name='html', + settings_spec=self) self.assert_(isinstance(parts, DictType)) def test_publish_pickle(self): -- cgit v1.2.1 From d854c9bf42f3c21b876ad51e3c691def7e072840 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Wed, 10 Aug 2005 02:49:06 +0000 Subject: fixed enumerated list bug (SF#1254145) git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3789 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_parsers/test_rst/test_enumerated_lists.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_enumerated_lists.py b/test/test_parsers/test_rst/test_enumerated_lists.py index b0be498b4..6824efdbb 100755 --- a/test/test_parsers/test_rst/test_enumerated_lists.py +++ b/test/test_parsers/test_rst/test_enumerated_lists.py @@ -811,6 +811,16 @@ ii. Item two. #. Item two. 3. Item three. """], +["""\ +z. +x +""", +"""\ +<document source="test data"> + <paragraph> + z. + x +"""], ] -- cgit v1.2.1 From 3cb6c0f587d0b5ebe3f55b206d80ed03a684dd34 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sun, 14 Aug 2005 23:18:36 +0000 Subject: removed bug with indirect substitutions; seems to be fixed git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3807 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms/test_substitutions.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'test') diff --git a/test/test_transforms/test_substitutions.py b/test/test_transforms/test_substitutions.py index 33a33b754..67aa3dfed 100755 --- a/test/test_transforms/test_substitutions.py +++ b/test/test_transforms/test_substitutions.py @@ -76,6 +76,31 @@ u"""\ \u00C9 . """], +[u"""\ +Indirect substitution definitions with multiple references: + +|substitute| my coke for gin +|substitute| you for my mum +at least I'll get my washing done + +.. |substitute| replace:: |replace| +.. |replace| replace:: swap +""", +u"""\ +<document source="test data"> + <paragraph> + Indirect substitution definitions with multiple references: + <paragraph> + swap + my coke for gin + swap + you for my mum + at least I'll get my washing done + <substitution_definition names="substitute"> + swap + <substitution_definition names="replace"> + swap +"""], ]) totest['unicode'] = ((Substitutions,), [ -- cgit v1.2.1 From 74e448e6230eaaf792f6fe2b0c936cb9bdfeaf41 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Mon, 15 Aug 2005 19:45:02 +0000 Subject: restored a bug (removed in r3807) which lingers; added a commented-out test case for said bug; removed a bogus bug git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3809 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms/test_substitutions.py | 45 ++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'test') diff --git a/test/test_transforms/test_substitutions.py b/test/test_transforms/test_substitutions.py index 67aa3dfed..19534a486 100755 --- a/test/test_transforms/test_substitutions.py +++ b/test/test_transforms/test_substitutions.py @@ -101,6 +101,51 @@ u"""\ <substitution_definition names="replace"> swap """], +#["""\ +#.. |l| unicode:: U+00AB .. left chevron +#.. |r| unicode:: U+00BB .. right chevron +#.. |.| replace:: |l|\ ``.``\ |r| +# +#.. Delete either of the following lines, and there is no error. +# +#Regular expression |.| will match any character +# +#.. Note:: Note that |.| matches *exactly* one character +#""", +#u"""\ +#<document source="test data"> +# <substitution_definition names="l"> +# \xab +# <substitution_definition names="r"> +# \xbb +# <substitution_definition names="."> +# <substitution_reference refname="l"> +# l +# <literal> +# . +# <substitution_reference refname="r"> +# r +# <comment xml:space="preserve"> +# Delete either of the following lines, and there is no error. +# <paragraph> +# Regular expression \n\ +# \xab +# <literal> +# . +# \xbb +# will match any character +# <note> +# <paragraph> +# Note that \n\ +# \xab +# <literal> +# . +# \xbb +# matches \n\ +# <emphasis> +# exactly +# one character +#"""], ]) totest['unicode'] = ((Substitutions,), [ -- cgit v1.2.1 From 67c57d6128cf805d676bd3ff38a3a8f8a7da274b Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Mon, 15 Aug 2005 20:00:05 +0000 Subject: made Null writer "support" all formats git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3810 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_writers/test_null_misc.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 test/test_writers/test_null_misc.py (limited to 'test') diff --git a/test/test_writers/test_null_misc.py b/test/test_writers/test_null_misc.py new file mode 100755 index 000000000..bac41384f --- /dev/null +++ b/test/test_writers/test_null_misc.py @@ -0,0 +1,25 @@ +#! /usr/bin/env python + +# Author: Felix Wiemann +# Contact: Felix_Wiemann@ososo.de +# Revision: $Revision$ +# Date: $Date$ +# Copyright: This module has been placed in the public domain. + +""" +Miscellaneous Null writer tests. +""" + +from __init__ import DocutilsTestSupport +from docutils.writers import null + + +class SupportsTestCase(DocutilsTestSupport.StandardTestCase): + + def test_xmlcharrefreplace(self): + self.assert_(null.Writer().supports('anyformat')) + + +if __name__ == '__main__': + import unittest + unittest.main() -- cgit v1.2.1 From 12230a35702461fd90db1254371ad0050b74977e Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Mon, 15 Aug 2005 20:10:27 +0000 Subject: committed too early; sorry git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3811 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_writers/test_null_misc.py | 25 ------------------------- 1 file changed, 25 deletions(-) delete mode 100755 test/test_writers/test_null_misc.py (limited to 'test') diff --git a/test/test_writers/test_null_misc.py b/test/test_writers/test_null_misc.py deleted file mode 100755 index bac41384f..000000000 --- a/test/test_writers/test_null_misc.py +++ /dev/null @@ -1,25 +0,0 @@ -#! /usr/bin/env python - -# Author: Felix Wiemann -# Contact: Felix_Wiemann@ososo.de -# Revision: $Revision$ -# Date: $Date$ -# Copyright: This module has been placed in the public domain. - -""" -Miscellaneous Null writer tests. -""" - -from __init__ import DocutilsTestSupport -from docutils.writers import null - - -class SupportsTestCase(DocutilsTestSupport.StandardTestCase): - - def test_xmlcharrefreplace(self): - self.assert_(null.Writer().supports('anyformat')) - - -if __name__ == '__main__': - import unittest - unittest.main() -- cgit v1.2.1 From 03f113d5425662822ddb565d627b9c6b39e25aab Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Wed, 17 Aug 2005 13:32:03 +0000 Subject: removed superfluous error message git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3813 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_parsers/test_rst/test_directives/test_unknown.py | 9 --------- test/test_parsers/test_rst/test_substitutions.py | 3 --- 2 files changed, 12 deletions(-) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_directives/test_unknown.py b/test/test_parsers/test_rst/test_directives/test_unknown.py index 8340a224b..3c859faa3 100755 --- a/test/test_parsers/test_rst/test_directives/test_unknown.py +++ b/test/test_parsers/test_rst/test_directives/test_unknown.py @@ -34,9 +34,6 @@ totest['unknown'] = [ <paragraph> No directive entry for "reStructuredText-unknown-directive" in module "docutils.parsers.rst.languages.en". Trying "reStructuredText-unknown-directive" as canonical directive name. - <system_message level="3" line="1" source="test data" type="ERROR"> - <paragraph> - Directive "reStructuredText-unknown-directive" not registered (canonical name "restructuredtext-unknown-directive"). <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Unknown directive type "reStructuredText-unknown-directive". @@ -46,9 +43,6 @@ totest['unknown'] = [ <paragraph> No directive entry for "reStructuredText-unknown-directive" in module "docutils.parsers.rst.languages.en". Trying "reStructuredText-unknown-directive" as canonical directive name. - <system_message level="3" line="3" source="test data" type="ERROR"> - <paragraph> - Directive "reStructuredText-unknown-directive" not registered (canonical name "restructuredtext-unknown-directive"). <system_message level="3" line="3" source="test data" type="ERROR"> <paragraph> Unknown directive type "reStructuredText-unknown-directive". @@ -58,9 +52,6 @@ totest['unknown'] = [ <paragraph> No directive entry for "reStructuredText-unknown-directive" in module "docutils.parsers.rst.languages.en". Trying "reStructuredText-unknown-directive" as canonical directive name. - <system_message level="3" line="5" source="test data" type="ERROR"> - <paragraph> - Directive "reStructuredText-unknown-directive" not registered (canonical name "restructuredtext-unknown-directive"). <system_message level="3" line="5" source="test data" type="ERROR"> <paragraph> Unknown directive type "reStructuredText-unknown-directive". diff --git a/test/test_parsers/test_rst/test_substitutions.py b/test/test_parsers/test_rst/test_substitutions.py index 773702533..d2a5207c9 100755 --- a/test/test_parsers/test_rst/test_substitutions.py +++ b/test/test_parsers/test_rst/test_substitutions.py @@ -223,9 +223,6 @@ No blank line after. <paragraph> No directive entry for "directive" in module "docutils.parsers.rst.languages.en". Trying "directive" as canonical directive name. - <system_message level="3" line="8" source="test data" type="ERROR"> - <paragraph> - Directive "directive" not registered (canonical name "directive"). <system_message level="3" line="8" source="test data" type="ERROR"> <paragraph> Unknown directive type "directive". -- cgit v1.2.1 From 090741b70591dc6209c48d4147167b6d88c578c7 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Wed, 24 Aug 2005 00:05:38 +0000 Subject: fixed bug with "image" directive "target" option git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3828 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_parsers/test_rst/test_directives/test_images.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_directives/test_images.py b/test/test_parsers/test_rst/test_directives/test_images.py index 4e4c429f6..50f555ba1 100755 --- a/test/test_parsers/test_rst/test_directives/test_images.py +++ b/test/test_parsers/test_rst/test_directives/test_images.py @@ -295,7 +295,7 @@ totest['images'] = [ """, """\ <document source="test data"> - <reference name="indirect_" refname="indirect"> + <reference name="indirect" refname="indirect"> <image uri="picture.png"> """], ["""\ @@ -311,7 +311,7 @@ totest['images'] = [ <document source="test data"> <reference refuri="a/multi/line/uri"> <image uri="picture.png"> - <reference name="`a multi line internal reference`_" refname="a multi line internal reference"> + <reference name="a multi line internal reference" refname="a multi line internal reference"> <image uri="picture.png"> """], ["""\ @@ -401,7 +401,7 @@ u"""\ """, """\ <document source="test data"> - <reference name="uppercase_" refname="Uppercase"> + <reference name="Uppercase" refname="uppercase"> <image uri="test.png"> <target ids="uppercase" names="uppercase" refuri="http://docutils.sourceforge.net/"> """], -- cgit v1.2.1 From e7a14a1597305c6b282cfb59569395c0eef4b7bd Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Wed, 24 Aug 2005 00:23:46 +0000 Subject: also fixed by rev. 3828 git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3829 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_pseudoxml.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_pseudoxml.txt b/test/functional/expected/standalone_rst_pseudoxml.txt index c098ff0e0..c2af4aaa9 100644 --- a/test/functional/expected/standalone_rst_pseudoxml.txt +++ b/test/functional/expected/standalone_rst_pseudoxml.txt @@ -1120,7 +1120,7 @@ Images <paragraph> An image directive (also clickable -- a hyperlink reference): - <reference name="directives_" refid="directives"> + <reference name="directives" refid="directives"> <image classes="class1 class2" uri="../../../docs/user/rst/images/title.png"> <paragraph> Image with multiple IDs: -- cgit v1.2.1 From 5c90ddc006b36818e727b4a42196a708b2a78a25 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Wed, 24 Aug 2005 21:33:21 +0000 Subject: made _stylesheet_required setting default to 0, activating it in the rst2html.py front-end tool git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3830 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/DocutilsTestSupport.py | 1 - test/functional/tests/_default.py | 1 - test/test_dependencies.py | 1 - test/test_writers/test_html4css1_misc.py | 3 +-- 4 files changed, 1 insertion(+), 5 deletions(-) (limited to 'test') diff --git a/test/DocutilsTestSupport.py b/test/DocutilsTestSupport.py index 0466590fd..ba4a14f81 100644 --- a/test/DocutilsTestSupport.py +++ b/test/DocutilsTestSupport.py @@ -638,7 +638,6 @@ class WriterPublishTestCase(CustomTestCase, docutils.SettingsSpec): """ settings_default_overrides = {'_disable_config': 1, - '_stylesheet_required': 0, 'strict_visitor': 1} writer_name = '' # set in subclasses or constructor diff --git a/test/functional/tests/_default.py b/test/functional/tests/_default.py index 4c72c04c8..2835c5b2e 100644 --- a/test/functional/tests/_default.py +++ b/test/functional/tests/_default.py @@ -5,4 +5,3 @@ settings_overrides['halt_level'] = 5 settings_overrides['warning_stream'] = '' settings_overrides['input_encoding'] = 'utf-8' settings_overrides['embed_stylesheet'] = 0 -settings_overrides['_stylesheet_required'] = 0 diff --git a/test/test_dependencies.py b/test/test_dependencies.py index e1ccc24ef..c9f00518d 100755 --- a/test/test_dependencies.py +++ b/test/test_dependencies.py @@ -30,7 +30,6 @@ class RecordDependenciesTests(unittest.TestCase): settings.setdefault('settings_overrides', {}) settings['settings_overrides'] = settings['settings_overrides'].copy() settings['settings_overrides']['_disable_config'] = 1 - settings['settings_overrides']['_stylesheet_required'] = 0 if not settings['settings_overrides'].has_key('record_dependencies'): settings['settings_overrides']['record_dependencies'] = \ docutils.utils.DependencyList(recordfile) diff --git a/test/test_writers/test_html4css1_misc.py b/test/test_writers/test_html4css1_misc.py index 940f99482..ab728be13 100755 --- a/test/test_writers/test_html4css1_misc.py +++ b/test/test_writers/test_html4css1_misc.py @@ -23,8 +23,7 @@ class EncodingTestCase(DocutilsTestSupport.StandardTestCase): settings_overrides={ 'output_encoding': 'latin1', 'stylesheet': '', - '_disable_config': 1, - '_stylesheet_required': 0,} + '_disable_config': 1,} result = core.publish_string( 'äöü€', writer_name='html4css1', settings_overrides=settings_overrides) -- cgit v1.2.1 From 904258b0f9b4eb56b69dabff59ba73bf34488091 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Wed, 24 Aug 2005 21:40:39 +0000 Subject: fixed image target test in test_transforms/test_hyperlinks.py git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3831 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms/test_hyperlinks.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/test_transforms/test_hyperlinks.py b/test/test_transforms/test_hyperlinks.py index 85dfe9a87..8d7d6a029 100755 --- a/test/test_transforms/test_hyperlinks.py +++ b/test/test_transforms/test_hyperlinks.py @@ -682,11 +682,11 @@ __ http://example.org <target ids="external" names="external" refuri="http://uri"> <target ids="indirect" names="indirect" refuri="http://uri"> <target refid="internal"> - <reference ids="internal" name="external_" names="internal" refuri="http://uri"> + <reference ids="internal" name="external" names="internal" refuri="http://uri"> <image uri="picture.png"> - <reference name="indirect_" refuri="http://uri"> + <reference name="indirect" refuri="http://uri"> <image uri="picture.png"> - <reference name="internal_" refid="internal"> + <reference name="internal" refid="internal"> <image uri="picture.png"> """], ["""\ -- cgit v1.2.1 From 166a3c55fa3628d3f16237bd4360b687f5d1cef4 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Thu, 25 Aug 2005 17:15:22 +0000 Subject: Moved "id" attribute from container (section etc.) to the <a> tag in the title, to be on the same tag as "name". (!!! To be reverted in Docutils 0.5.) git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3832 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/pep_html.html | 16 +-- .../expected/standalone_rst_html4css1.html | 154 ++++++++++----------- test/test_writers/test_html4css1.py | 48 +++---- 3 files changed, 109 insertions(+), 109 deletions(-) (limited to 'test') diff --git a/test/functional/expected/pep_html.html b/test/functional/expected/pep_html.html index e12b15c0e..d48b8fb99 100644 --- a/test/functional/expected/pep_html.html +++ b/test/functional/expected/pep_html.html @@ -53,25 +53,25 @@ to templates. DO NOT USE THIS HTML FILE AS YOUR TEMPLATE! </tbody> </table> <hr /> -<div class="contents topic" id="contents"> -<p class="topic-title first"><a name="contents">Contents</a></p> +<div class="contents topic"> +<p class="topic-title first"><a id="contents" name="contents">Contents</a></p> <ul class="simple"> <li><a class="reference" href="#abstract" id="id5" name="id5">Abstract</a></li> <li><a class="reference" href="#copyright" id="id6" name="id6">Copyright</a></li> <li><a class="reference" href="#references-and-footnotes" id="id7" name="id7">References and Footnotes</a></li> </ul> </div> -<div class="section" id="abstract"> -<h1><a class="toc-backref" href="#id5" name="abstract">Abstract</a></h1> +<div class="section"> +<h1><a class="toc-backref" href="#id5" id="abstract" name="abstract">Abstract</a></h1> <p>This is just a test <a class="footnote-reference" href="#id2" id="id1" name="id1">[1]</a>. See the <a class="reference" href="http://www.python.org/peps/">PEP repository</a> <a class="footnote-reference" href="#id3" id="id4" name="id4">[2]</a> for the real thing.</p> </div> -<div class="section" id="copyright"> -<h1><a class="toc-backref" href="#id6" name="copyright">Copyright</a></h1> +<div class="section"> +<h1><a class="toc-backref" href="#id6" id="copyright" name="copyright">Copyright</a></h1> <p>This document has been placed in the public domain.</p> </div> -<div class="section" id="references-and-footnotes"> -<h1><a class="toc-backref" href="#id7" name="references-and-footnotes">References and Footnotes</a></h1> +<div class="section"> +<h1><a class="toc-backref" href="#id7" id="references-and-footnotes" name="references-and-footnotes">References and Footnotes</a></h1> <table class="docutils footnote" frame="void" id="id2" rules="none"> <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index 7e4c91546..86dfed7cb 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -85,8 +85,8 @@ transforms to after the document title, subtitle, and docinfo. --> <!-- Above is the document title, and below is the subtitle. They are transformed from section titles after parsing. --> <!-- bibliographic fields (which also require a transform): --> -<div class="contents topic" id="table-of-contents"> -<p class="topic-title first"><a name="table-of-contents">Table of Contents</a></p> +<div class="contents topic"> +<p class="topic-title first"><a id="table-of-contents" name="table-of-contents">Table of Contents</a></p> <ul class="auto-toc simple"> <li><a class="reference" href="#structural-elements" id="id33" name="id33">1   Structural Elements</a><ul class="auto-toc"> <li><a class="reference" href="#section-title" id="id34" name="id34">1.1   Section Title</a></li> @@ -137,31 +137,31 @@ They are transformed from section titles after parsing. --> <li><a class="reference" href="#error-handling" id="id69" name="id69">3   Error Handling</a></li> </ul> </div> -<div class="section" id="structural-elements"> -<h1><a class="toc-backref" href="#id33" name="structural-elements">1   Structural Elements</a></h1> -<div class="section" id="section-title"> -<h2 class="with-subtitle"><a class="toc-backref" href="#id34" name="section-title">1.1   Section Title</a></h2> +<div class="section"> +<h1><a class="toc-backref" href="#id33" id="structural-elements" name="structural-elements">1   Structural Elements</a></h1> +<div class="section"> +<h2 class="with-subtitle"><a class="toc-backref" href="#id34" id="section-title" name="section-title">1.1   Section Title</a></h2> <h2 class="section-subtitle" id="section-subtitle"><span class="section-subtitle">Section Subtitle</span></h2> <p>That's it, the text just above this line.</p> </div> -<div class="section" id="empty-section"> -<h2><a class="toc-backref" href="#id35" name="empty-section">1.2   Empty Section</a></h2> +<div class="section"> +<h2><a class="toc-backref" href="#id35" id="empty-section" name="empty-section">1.2   Empty Section</a></h2> </div> -<div class="section" id="transitions"> -<h2><a class="toc-backref" href="#id36" name="transitions">1.3   Transitions</a></h2> +<div class="section"> +<h2><a class="toc-backref" href="#id36" id="transitions" name="transitions">1.3   Transitions</a></h2> <p>Here's a transition:</p> <hr class="docutils" /> <p>It divides the section. Transitions may also occur between sections:</p> </div> </div> <hr class="docutils" /> -<div class="section" id="body-elements"> -<h1><a class="toc-backref" href="#id37" name="body-elements">2   Body Elements</a></h1> -<div class="section" id="paragraphs"> -<h2><a class="toc-backref" href="#id38" name="paragraphs">2.1   Paragraphs</a></h2> +<div class="section"> +<h1><a class="toc-backref" href="#id37" id="body-elements" name="body-elements">2   Body Elements</a></h1> +<div class="section"> +<h2><a class="toc-backref" href="#id38" id="paragraphs" name="paragraphs">2.1   Paragraphs</a></h2> <p>A paragraph.</p> -<div class="section" id="inline-markup"> -<h3><a class="toc-backref" href="#id39" name="inline-markup">2.1.1   Inline Markup</a></h3> +<div class="section"> +<h3><a class="toc-backref" href="#id39" id="inline-markup" name="inline-markup">2.1.1   Inline Markup</a></h3> <p>Paragraphs contain text and may contain inline markup: <em>emphasis</em>, <strong>strong emphasis</strong>, <tt class="docutils literal"><span class="pre">inline</span> <span class="pre">literals</span></tt>, standalone hyperlinks (<a class="reference" href="http://www.python.org">http://www.python.org</a>), external hyperlinks (<a class="reference" href="http://www.python.org/">Python</a> <a class="footnote-reference" href="#id21" id="id22" name="id22">[5]</a>), internal @@ -191,8 +191,8 @@ and explicit roles for <em>standard</em> <strong>inline</strong> live link to PEP 258 here.</p> </div> </div> -<div class="section" id="bullet-lists"> -<h2><a class="toc-backref" href="#id40" name="bullet-lists">2.2   Bullet Lists</a></h2> +<div class="section"> +<h2><a class="toc-backref" href="#id40" id="bullet-lists" name="bullet-lists">2.2   Bullet Lists</a></h2> <ul> <li><p class="first">A bullet list</p> <ul class="simple"> @@ -216,8 +216,8 @@ live link to PEP 258 here.</p> </li> </ul> </div> -<div class="section" id="enumerated-lists"> -<h2><a class="toc-backref" href="#id41" name="enumerated-lists">2.3   Enumerated Lists</a></h2> +<div class="section"> +<h2><a class="toc-backref" href="#id41" id="enumerated-lists" name="enumerated-lists">2.3   Enumerated Lists</a></h2> <ol class="arabic"> <li><p class="first">Arabic numerals.</p> <ol class="loweralpha simple"> @@ -249,8 +249,8 @@ live link to PEP 258 here.</p> </li> </ol> </div> -<div class="section" id="definition-lists"> -<h2><a class="toc-backref" href="#id42" name="definition-lists">2.4   Definition Lists</a></h2> +<div class="section"> +<h2><a class="toc-backref" href="#id42" id="definition-lists" name="definition-lists">2.4   Definition Lists</a></h2> <dl class="docutils"> <dt>Term</dt> <dd>Definition</dd> @@ -264,8 +264,8 @@ live link to PEP 258 here.</p> <dd>Definition</dd> </dl> </div> -<div class="section" id="field-lists"> -<h2><a class="toc-backref" href="#id43" name="field-lists">2.5   Field Lists</a></h2> +<div class="section"> +<h2><a class="toc-backref" href="#id43" id="field-lists" name="field-lists">2.5   Field Lists</a></h2> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> @@ -287,8 +287,8 @@ doesn't get stripped away.)</p> </tbody> </table> </div> -<div class="section" id="option-lists"> -<h2><a class="toc-backref" href="#id44" name="option-lists">2.6   Option Lists</a></h2> +<div class="section"> +<h2><a class="toc-backref" href="#id44" id="option-lists" name="option-lists">2.6   Option Lists</a></h2> <p>For listing command-line options:</p> <table class="docutils option-list" frame="void" rules="none"> <col class="option" /> @@ -333,8 +333,8 @@ regardless of where it starts.</p> <p>There must be at least two spaces between the option and the description.</p> </div> -<div class="section" id="literal-blocks"> -<h2><a class="toc-backref" href="#id45" name="literal-blocks">2.7   Literal Blocks</a></h2> +<div class="section"> +<h2><a class="toc-backref" href="#id45" id="literal-blocks" name="literal-blocks">2.7   Literal Blocks</a></h2> <p>Literal blocks are indicated with a double-colon ("::") at the end of the preceding paragraph (over there <tt class="docutils literal"><span class="pre">--></span></tt>). They can be indented:</p> <pre class="literal-block"> @@ -350,8 +350,8 @@ if literal_block: > Why didn't I think of that? </pre> </div> -<div class="section" id="line-blocks"> -<h2><a class="toc-backref" href="#id46" name="line-blocks">2.8   Line Blocks</a></h2> +<div class="section"> +<h2><a class="toc-backref" href="#id46" id="line-blocks" name="line-blocks">2.8   Line Blocks</a></h2> <p>This section tests line blocks. Line blocks are body elements which consist of lines and other line blocks. Nested line blocks cause indentation.</p> @@ -409,8 +409,8 @@ the left edge of the text above it.</div> </div> </blockquote> </div> -<div class="section" id="block-quotes"> -<h2><a class="toc-backref" href="#id47" name="block-quotes">2.9   Block Quotes</a></h2> +<div class="section"> +<h2><a class="toc-backref" href="#id47" id="block-quotes" name="block-quotes">2.9   Block Quotes</a></h2> <p>Block quotes consist of indented body elements:</p> <blockquote> <p>My theory by A. Elk. Brackets Miss, brackets. This theory goes @@ -421,8 +421,8 @@ own it, and what it is too.</p> <p class="attribution">—Anne Elk (Miss)</p> </blockquote> </div> -<div class="section" id="doctest-blocks"> -<h2><a class="toc-backref" href="#id48" name="doctest-blocks">2.10   Doctest Blocks</a></h2> +<div class="section"> +<h2><a class="toc-backref" href="#id48" id="doctest-blocks" name="doctest-blocks">2.10   Doctest Blocks</a></h2> <pre class="doctest-block"> >>> print 'Python-specific usage examples; begun with ">>>"' Python-specific usage examples; begun with ">>>" @@ -430,8 +430,8 @@ Python-specific usage examples; begun with ">>>" (cut and pasted from interactive Python sessions) </pre> </div> -<div class="section" id="footnotes"> -<h2><a class="toc-backref" href="#id49" name="footnotes">2.11   Footnotes</a></h2> +<div class="section"> +<h2><a class="toc-backref" href="#id49" id="footnotes" name="footnotes">2.11   Footnotes</a></h2> <table class="docutils footnote" frame="void" id="id6" rules="none"> <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> @@ -482,8 +482,8 @@ nonexistent footnote: <a href="#id25" name="id26"><span class="problematic" id=" </tbody> </table> </div> -<div class="section" id="citations"> -<h2><a class="toc-backref" href="#id50" name="citations">2.12   Citations</a></h2> +<div class="section"> +<h2><a class="toc-backref" href="#id50" id="citations" name="citations">2.12   Citations</a></h2> <table class="docutils citation" frame="void" id="cit2002" rules="none"> <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> @@ -494,8 +494,8 @@ rendered separately and differently from footnotes.</td></tr> <p>Here's a reference to the above, <a class="citation-reference" href="#cit2002" id="id15" name="id15">[CIT2002]</a>, and a <a href="#id27" name="id28"><span class="problematic" id="id28">[nonexistent]_</span></a> citation.</p> </div> -<div class="section" id="targets"> -<span id="another-target"></span><h2><a class="toc-backref" href="#id51" name="targets">2.13   Targets</a></h2> +<div class="section"> +<h2><a class="toc-backref" href="#id51" id="targets" name="targets"><span id="another-target"></span>2.13   Targets</a></h2> <p id="example">This paragraph is pointed to by the explicit "example" target. A reference can be found under <a class="reference" href="#inline-markup">Inline Markup</a>, above. <a class="reference" href="#inline-hyperlink-targets">Inline hyperlink targets</a> are also possible.</p> @@ -507,22 +507,22 @@ hyperlink targets</a> are also possible.</p> refer to the <a class="reference" href="#targets">Targets</a> section.</p> <p>Here's a <a href="#id29" name="id30"><span class="problematic" id="id30">`hyperlink reference without a target`_</span></a>, which generates an error.</p> -<div class="section" id="duplicate-target-names"> -<h3><a class="toc-backref" href="#id52" name="duplicate-target-names">2.13.1   Duplicate Target Names</a></h3> +<div class="section"> +<h3><a class="toc-backref" href="#id52" id="duplicate-target-names" name="duplicate-target-names">2.13.1   Duplicate Target Names</a></h3> <p>Duplicate names in section headers or other implicit targets will generate "info" (level-1) system messages. Duplicate names in explicit targets will generate "warning" (level-2) system messages.</p> </div> -<div class="section" id="id18"> -<h3><a class="toc-backref" href="#id53" name="id18">2.13.2   Duplicate Target Names</a></h3> +<div class="section"> +<h3><a class="toc-backref" href="#id53" id="id18" name="id18">2.13.2   Duplicate Target Names</a></h3> <p>Since there are two "Duplicate Target Names" section headers, we cannot uniquely refer to either of them by name. If we try to (like this: <a href="#id31" name="id32"><span class="problematic" id="id32">`Duplicate Target Names`_</span></a>), an error is generated.</p> </div> </div> -<div class="section" id="directives"> -<h2><a class="toc-backref" href="#id54" name="directives">2.14   Directives</a></h2> -<div class="contents local topic" id="contents"> +<div class="section"> +<h2><a class="toc-backref" href="#id54" id="directives" name="directives">2.14   Directives</a></h2> +<div class="contents local topic"> <ul class="auto-toc simple"> <li><a class="reference" href="#document-parts" id="id70" name="id70">2.14.1   Document Parts</a></li> <li><a class="reference" href="#images" id="id71" name="id71">2.14.2   Images</a></li> @@ -536,14 +536,14 @@ this: <a href="#id31" name="id32"><span class="problematic" id="id32">`Duplicate <p>These are just a sample of the many reStructuredText Directives. For others, please see <a class="reference" href="http://docutils.sourceforge.net/docs/ref/rst/directives.html">http://docutils.sourceforge.net/docs/ref/rst/directives.html</a>.</p> -<div class="section" id="document-parts"> -<h3><a class="toc-backref" href="#id70" name="document-parts">2.14.1   Document Parts</a></h3> +<div class="section"> +<h3><a class="toc-backref" href="#id70" id="document-parts" name="document-parts">2.14.1   Document Parts</a></h3> <p>An example of the "contents" directive can be seen above this section (a local, untitled table of <a class="reference" href="#contents">contents</a>) and at the beginning of the document (a document-wide <a class="reference" href="#table-of-contents">table of contents</a>).</p> </div> -<div class="section" id="images"> -<h3><a class="toc-backref" href="#id71" name="images">2.14.2   Images</a></h3> +<div class="section"> +<h3><a class="toc-backref" href="#id71" id="images" name="images">2.14.2   Images</a></h3> <p>An image directive (also clickable -- a hyperlink reference):</p> <a class="reference image-reference" href="#directives"><img alt="../../../docs/user/rst/images/title.png" class="class1 class2" src="../../../docs/user/rst/images/title.png" /></a> <p>Image with multiple IDs:</p> @@ -604,8 +604,8 @@ document (a document-wide <a class="reference" href="#table-of-contents">table o <p>An image 3 cm high:</p> <img alt="../../../docs/user/rst/images/biohazard.png" src="../../../docs/user/rst/images/biohazard.png" style="height: 3cm;" /> </div> -<div class="section" id="admonitions"> -<h3><a class="toc-backref" href="#id72" name="admonitions">2.14.3   Admonitions</a></h3> +<div class="section"> +<h3><a class="toc-backref" href="#id72" id="admonitions" name="admonitions">2.14.3   Admonitions</a></h3> <div class="attention"> <p class="first admonition-title">Attention!</p> <p class="last">Directives at large.</p> @@ -653,8 +653,8 @@ Reader discretion is strongly advised.</p> <p class="last">You can make up your own admonition too.</p> </div> </div> -<div class="section" id="topics-sidebars-and-rubrics"> -<h3><a class="toc-backref" href="#id73" name="topics-sidebars-and-rubrics">2.14.4   Topics, Sidebars, and Rubrics</a></h3> +<div class="section"> +<h3><a class="toc-backref" href="#id73" id="topics-sidebars-and-rubrics" name="topics-sidebars-and-rubrics">2.14.4   Topics, Sidebars, and Rubrics</a></h3> <div class="sidebar"> <p class="first sidebar-title">Sidebar Title</p> <p class="sidebar-subtitle">Optional Subtitle</p> @@ -670,8 +670,8 @@ background color.</p> </div> <p class="rubric">This is a rubric</p> </div> -<div class="section" id="target-footnotes"> -<h3><a class="toc-backref" href="#id74" name="target-footnotes">2.14.5   Target Footnotes</a></h3> +<div class="section"> +<h3><a class="toc-backref" href="#id74" id="target-footnotes" name="target-footnotes">2.14.5   Target Footnotes</a></h3> <table class="docutils footnote" frame="void" id="id21" rules="none"> <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> @@ -679,12 +679,12 @@ background color.</p> </tbody> </table> </div> -<div class="section" id="replacement-text"> -<h3><a class="toc-backref" href="#id75" name="replacement-text">2.14.6   Replacement Text</a></h3> +<div class="section"> +<h3><a class="toc-backref" href="#id75" id="replacement-text" name="replacement-text">2.14.6   Replacement Text</a></h3> <p>I recommend you try <a class="reference" href="http://www.python.org/">Python, <em>the</em> best language around</a> <a class="footnote-reference" href="#id21" id="id24" name="id24">[5]</a>.</p> </div> -<div class="section" id="compound-paragraph"> -<h3><a class="toc-backref" href="#id76" name="compound-paragraph">2.14.7   Compound Paragraph</a></h3> +<div class="section"> +<h3><a class="toc-backref" href="#id76" id="compound-paragraph" name="compound-paragraph">2.14.7   Compound Paragraph</a></h3> <div class="some-class compound"> <p class="compound-first">Compound 1, paragraph 1.</p> <p class="compound-middle">Compound 1, paragraph 2.</p> @@ -751,13 +751,13 @@ paragraph.</td> </div> </div> </div> -<div class="section" id="substitution-definitions"> -<h2><a class="toc-backref" href="#id62" name="substitution-definitions">2.15   Substitution Definitions</a></h2> +<div class="section"> +<h2><a class="toc-backref" href="#id62" id="substitution-definitions" name="substitution-definitions">2.15   Substitution Definitions</a></h2> <p>An inline image (<img alt="EXAMPLE" src="../../../docs/user/rst/images/biohazard.png" />) example:</p> <p>(Substitution definitions are not visible in the HTML source.)</p> </div> -<div class="section" id="comments"> -<h2><a class="toc-backref" href="#id63" name="comments">2.16   Comments</a></h2> +<div class="section"> +<h2><a class="toc-backref" href="#id63" id="comments" name="comments">2.16   Comments</a></h2> <p>Here's one:</p> <!-- Comments begin with two dots and a space. Anything may follow, except for the syntax of footnotes, hyperlink @@ -766,14 +766,14 @@ targets, directives, or substitution definitions. Double-dashes - - "- -" - - must be escaped somehow in HTML output. --> <p>(View the HTML source to see the comment.)</p> </div> -<div class="section" id="raw-text"> -<h2><a class="toc-backref" href="#id64" name="raw-text">2.17   Raw text</a></h2> +<div class="section"> +<h2><a class="toc-backref" href="#id64" id="raw-text" name="raw-text">2.17   Raw text</a></h2> <p>This does not necessarily look nice, because there may be missing white space.</p> <p>It's just there to freeze the behavior.</p> A test.Second test.<div class="myclass">Another test with myclass set.</div><p>This is the <span class="myrawroleclass">fourth test</span> with myrawroleclass set.</p> Fifth test in HTML.<br />Line two.</div> -<div class="section" id="colspanning-tables"> -<h2><a class="toc-backref" href="#id65" name="colspanning-tables">2.18   Colspanning tables</a></h2> +<div class="section"> +<h2><a class="toc-backref" href="#id65" id="colspanning-tables" name="colspanning-tables">2.18   Colspanning tables</a></h2> <p>This table has a cell spanning two columns:</p> <table border="1" class="docutils"> <colgroup> @@ -810,8 +810,8 @@ Fifth test in HTML.<br />Line two.</div> </tbody> </table> </div> -<div class="section" id="rowspanning-tables"> -<h2><a class="toc-backref" href="#id66" name="rowspanning-tables">2.19   Rowspanning tables</a></h2> +<div class="section"> +<h2><a class="toc-backref" href="#id66" id="rowspanning-tables" name="rowspanning-tables">2.19   Rowspanning tables</a></h2> <p>Here's a table with cells spanning several rows:</p> <table border="1" class="docutils"> <colgroup> @@ -843,8 +843,8 @@ cell.</td> </tbody> </table> </div> -<div class="section" id="complex-tables"> -<h2><a class="toc-backref" href="#id67" name="complex-tables">2.20   Complex tables</a></h2> +<div class="section"> +<h2><a class="toc-backref" href="#id67" id="complex-tables" name="complex-tables">2.20   Complex tables</a></h2> <p>Here's a complex table, which should test all features.</p> <table border="1" class="docutils"> <colgroup> @@ -892,8 +892,8 @@ empty: <tt class="docutils literal"><span class="pre">--></span></tt></td> </tbody> </table> </div> -<div class="section" id="list-tables"> -<h2><a class="toc-backref" href="#id68" name="list-tables">2.21   List Tables</a></h2> +<div class="section"> +<h2><a class="toc-backref" href="#id68" id="list-tables" name="list-tables">2.21   List Tables</a></h2> <p>Here's a list table exercising all features:</p> <table border="1" class="test docutils"> <caption>list table with integral header</caption> @@ -926,8 +926,8 @@ crunchy, now would it?</td> </table> </div> </div> -<div class="section" id="error-handling"> -<h1><a class="toc-backref" href="#id69" name="error-handling">3   Error Handling</a></h1> +<div class="section"> +<h1><a class="toc-backref" href="#id69" id="error-handling" name="error-handling">3   Error Handling</a></h1> <p>Any errors caught during processing will generate system messages.</p> <p>There should be five messages in the following, auto-generated section, "Docutils System Messages":</p> diff --git a/test/test_writers/test_html4css1.py b/test/test_writers/test_html4css1.py index 6ce0c15cd..fa072f9a1 100755 --- a/test/test_writers/test_html4css1.py +++ b/test/test_writers/test_html4css1.py @@ -120,11 +120,11 @@ And even more stuff """, """\ {'fragment': '''<p>Some stuff</p> -<div class="section" id="section"> -<h1><a name="section">Section</a></h1> +<div class="section"> +<h1><a id="section" name="section">Section</a></h1> <p>Some more stuff</p> -<div class="section" id="another-section"> -<h2><a name="another-section">Another Section</a></h2> +<div class="section"> +<h2><a id="another-section" name="another-section">Another Section</a></h2> <p>And even more stuff</p> </div> </div>\\n''', @@ -132,11 +132,11 @@ And even more stuff <h1 class="title">Title</h1> <h2 class="subtitle" id="subtitle">Subtitle</h2> <p>Some stuff</p> -<div class="section" id="section"> -<h1><a name="section">Section</a></h1> +<div class="section"> +<h1><a id="section" name="section">Section</a></h1> <p>Some more stuff</p> -<div class="section" id="another-section"> -<h2><a name="another-section">Another Section</a></h2> +<div class="section"> +<h2><a id="another-section" name="another-section">Another Section</a></h2> <p>And even more stuff</p> </div> </div> @@ -265,32 +265,32 @@ Another Section And even more stuff """, """\ -{'fragment': '''<div class="section" id="title"> -<h1><a name="title">Title</a></h1> -<div class="section" id="not-a-subtitle"> -<h2><a name="not-a-subtitle">Not A Subtitle</a></h2> +{'fragment': '''<div class="section"> +<h1><a id="title" name="title">Title</a></h1> +<div class="section"> +<h2><a id="not-a-subtitle" name="not-a-subtitle">Not A Subtitle</a></h2> <p>Some stuff</p> -<div class="section" id="section"> -<h3><a name="section">Section</a></h3> +<div class="section"> +<h3><a id="section" name="section">Section</a></h3> <p>Some more stuff</p> -<div class="section" id="another-section"> -<h4><a name="another-section">Another Section</a></h4> +<div class="section"> +<h4><a id="another-section" name="another-section">Another Section</a></h4> <p>And even more stuff</p> </div> </div> </div> </div>\\n''', 'html_body': '''<div class="document"> -<div class="section" id="title"> -<h1><a name="title">Title</a></h1> -<div class="section" id="not-a-subtitle"> -<h2><a name="not-a-subtitle">Not A Subtitle</a></h2> +<div class="section"> +<h1><a id="title" name="title">Title</a></h1> +<div class="section"> +<h2><a id="not-a-subtitle" name="not-a-subtitle">Not A Subtitle</a></h2> <p>Some stuff</p> -<div class="section" id="section"> -<h3><a name="section">Section</a></h3> +<div class="section"> +<h3><a id="section" name="section">Section</a></h3> <p>Some more stuff</p> -<div class="section" id="another-section"> -<h4><a name="another-section">Another Section</a></h4> +<div class="section"> +<h4><a id="another-section" name="another-section">Another Section</a></h4> <p>And even more stuff</p> </div> </div> -- cgit v1.2.1 From b67ead9a20e534e7bb5fac07d62a8738ea8e5f46 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Fri, 26 Aug 2005 03:14:19 +0000 Subject: catch unescaped colon at end of hyperlink targets git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3833 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_parsers/test_rst/test_targets.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_targets.py b/test/test_parsers/test_rst/test_targets.py index 9d846c142..ad3d3dd25 100755 --- a/test/test_parsers/test_rst/test_targets.py +++ b/test/test_parsers/test_rst/test_targets.py @@ -298,6 +298,23 @@ Explicit internal target. Duplicate explicit target name: "target". <target dupnames="target" ids="id4" refuri="Explicit_external_target"> """], +["""\ +.. _unescaped colon at end:: no good + +.. _escaped colon\:: OK + +.. _`unescaped colon, quoted:`: OK +""", +"""\ +<document source="test data"> + <comment xml:space="preserve"> + _unescaped colon at end:: no good + <system_message level="2" line="1" source="test data" type="WARNING"> + <paragraph> + malformed hyperlink target. + <target ids="escaped-colon" names="escaped colon:" refuri="OK"> + <target ids="unescaped-colon-quoted" names="unescaped colon, quoted:" refuri="OK"> +"""], ] totest['anonymous_targets'] = [ -- cgit v1.2.1 From 59693acd6fa7b6336dc7b56c8c4fe094aef2c93b Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Fri, 26 Aug 2005 13:10:47 +0000 Subject: catch another case of malformed hyperlink target git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3834 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_parsers/test_rst/test_targets.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_targets.py b/test/test_parsers/test_rst/test_targets.py index ad3d3dd25..ef7f8ec76 100755 --- a/test/test_parsers/test_rst/test_targets.py +++ b/test/test_parsers/test_rst/test_targets.py @@ -301,6 +301,8 @@ Explicit internal target. ["""\ .. _unescaped colon at end:: no good +.. _:: no good either + .. _escaped colon\:: OK .. _`unescaped colon, quoted:`: OK @@ -312,6 +314,11 @@ Explicit internal target. <system_message level="2" line="1" source="test data" type="WARNING"> <paragraph> malformed hyperlink target. + <comment xml:space="preserve"> + _:: no good either + <system_message level="2" line="3" source="test data" type="WARNING"> + <paragraph> + malformed hyperlink target. <target ids="escaped-colon" names="escaped colon:" refuri="OK"> <target ids="unescaped-colon-quoted" names="unescaped colon, quoted:" refuri="OK"> """], -- cgit v1.2.1 From 86b1366574934851dffcc5e622f0724882e90f6c Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sat, 27 Aug 2005 13:43:58 +0000 Subject: LaTeX writer: protect closing sqaure brackets as well git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3840 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_latex.tex | 6 +++--- test/test_writers/test_latex2e.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_latex.tex b/test/functional/expected/standalone_rst_latex.tex index 06e00ab67..fcdaea338 100644 --- a/test/functional/expected/standalone_rst_latex.tex +++ b/test/functional/expected/standalone_rst_latex.tex @@ -753,7 +753,7 @@ This footnote shows the next symbol in the sequence. \end{figure} \begin{figure}[b]\hypertarget{id13}$^{4}$ Here's an unreferenced footnote, with a reference to a -nonexistent footnote:{\color{red}\bfseries{}{[}5]{\_}}. +nonexistent footnote:{\color{red}\bfseries{}{[}5{]}{\_}}. \end{figure} @@ -767,7 +767,7 @@ Citations are text-labeled footnotes. They may be rendered separately and differently from footnotes. \end{figure} -Here's a reference to the above, [\hyperlink{cit2002}{CIT2002}], and a {\color{red}\bfseries{}{[}nonexistent]{\_}} +Here's a reference to the above, [\hyperlink{cit2002}{CIT2002}], and a {\color{red}\bfseries{}{[}nonexistent{]}{\_}} citation. @@ -1343,7 +1343,7 @@ These are all ASCII characters except a-zA-Z0-9 and space: \texttt{!!!"{}"{}"{\#}{\#}{\#}{\$}{\$}{\$}{\%}{\%}{\%}{\&}{\&}{\&}'{}'{}'((()))***+++,{},{},-{}-{}-...///:::} -\texttt{;;;<{}<{}<===>{}>{}>???@@@{[}{[}{[}{\textbackslash}{\textbackslash}{\textbackslash}]]]{\textasciicircum}{\textasciicircum}{\textasciicircum}{\_}{\_}{\_}`{}`{}`{\{}{\{}{\{}|||{\}}{\}}{\}}{\textasciitilde}{\textasciitilde}{\textasciitilde}} +\texttt{;;;<{}<{}<===>{}>{}>???@@@{[}{[}{[}{\textbackslash}{\textbackslash}{\textbackslash}{]}{]}{]}{\textasciicircum}{\textasciicircum}{\textasciicircum}{\_}{\_}{\_}`{}`{}`{\{}{\{}{\{}|||{\}}{\}}{\}}{\textasciitilde}{\textasciitilde}{\textasciitilde}} \texttt{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} diff --git a/test/test_writers/test_latex2e.py b/test/test_writers/test_latex2e.py index e0e7cc16f..04448883a 100755 --- a/test/test_writers/test_latex2e.py +++ b/test/test_writers/test_latex2e.py @@ -332,7 +332,7 @@ something~before~to~get~a~end~of~line.~\\\\ {[}~\\\\ ~\\\\ the~empty~line~gets~tested~too~\\\\ -] +{]} }\\end{quote} \\end{document} -- cgit v1.2.1 From fd75267451af302fc989b5e1f892dd4585311763 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Mon, 29 Aug 2005 22:34:31 +0000 Subject: HTML writer: - Added vertical space between fields of field lists. - Added ``--compact-field-lists`` option to remove vertical space in simple field lists. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3842 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_html4css1.html | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index 86dfed7cb..2093ab1bb 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -270,12 +270,13 @@ live link to PEP 258 here.</p> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field"><th class="field-name">what:</th><td class="field-body">Field lists map field names to field bodies, like database +<tr class="field"><th class="field-name">what:</th><td class="field-body"><p class="first">Field lists map field names to field bodies, like database records. They are often part of an extension syntax. They are -an unambiguous variant of RFC 2822 fields.</td> +an unambiguous variant of RFC 2822 fields.</p> +</td> </tr> <tr class="field"><th class="field-name">how arg1 arg2:</th><td class="field-body"><p class="first">The field marker is a colon, the field name, and a colon.</p> -<p class="last">The field body may contain one or more body elements, indented +<p>The field body may contain one or more body elements, indented relative to the field marker.</p> </td> </tr> -- cgit v1.2.1 From a1b0314ca1358c6730e1795a4fff9746fbc096a4 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Mon, 29 Aug 2005 22:42:16 +0000 Subject: allow field bodies of simple field lists to be empty; mmmh, the test source doesn't look particularly nice -- it contains redundancy; I think a lot of cleanup is required in both the test and the HTML writer git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3843 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_writers/test_html4css1.py | 47 +++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'test') diff --git a/test/test_writers/test_html4css1.py b/test/test_writers/test_html4css1.py index fa072f9a1..3e08d32c4 100755 --- a/test/test_writers/test_html4css1.py +++ b/test/test_writers/test_html4css1.py @@ -316,6 +316,53 @@ And even more stuff </div>\\n''', 'html_head': '''...<title>\\n'''} """], +["""\ +Not a docinfo. + +:This: .. _target: + + is +:a: +:simple: +:field: list +""", +"""\ +{'fragment': '''

      Not a docinfo.

      +
    +++ + + + + + + + + + +
    This:

    is

    +
    a:
    simple:
    field:list
    \\n''', + 'html_body': '''
    +

    Not a docinfo.

    + +++ + + + + + + + + + +
    This:

    is

    +
    a:
    simple:
    field:list
    +
    \\n''', + 'html_head': '''...\\n'''} +"""], ]) -- cgit v1.2.1 From 4bab3b641ddd264e0b3b3dad289c088758ed4cf2 Mon Sep 17 00:00:00 2001 From: wiemann Date: Sun, 11 Sep 2005 20:29:10 +0000 Subject: renamed Element.attr_defaults to list_attributes; added Element.update() method git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3865 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_nodes.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test') diff --git a/test/test_nodes.py b/test/test_nodes.py index 3889a19be..1427c6146 100755 --- a/test/test_nodes.py +++ b/test/test_nodes.py @@ -105,6 +105,19 @@ class ElementTests(unittest.TestCase): {'ids': ['someid']}) self.assert_(element.is_not_default('ids')) + def test_update(self): + element1 = nodes.Element() + element2 = nodes.Element() + element1['ids'] = ['foo', 'bar'] + element1['test'] = ['this is not a known list attribute'] + element2['ids'] = ['baz', 'qux'] + element2['test'] = ['overwrite'] + element1.update(element2) + # 'ids' are appended. + self.assertEquals(element1['ids'], ['foo', 'bar', 'baz', 'qux']) + # 'test' is overwritten. + self.assertEquals(element1['test'], ['overwrite']) + class MiscTests(unittest.TestCase): -- cgit v1.2.1 From 963bd1c5e6b84ae881a1046be9f95fc8b18547d3 Mon Sep 17 00:00:00 2001 From: wiemann Date: Sun, 11 Sep 2005 20:54:18 +0000 Subject: added Element.substitute() git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3866 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_nodes.py | 47 ++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 40 insertions(+), 7 deletions(-) (limited to 'test') diff --git a/test/test_nodes.py b/test/test_nodes.py index 1427c6146..deda8455d 100755 --- a/test/test_nodes.py +++ b/test/test_nodes.py @@ -106,18 +106,51 @@ class ElementTests(unittest.TestCase): self.assert_(element.is_not_default('ids')) def test_update(self): - element1 = nodes.Element() - element2 = nodes.Element() - element1['ids'] = ['foo', 'bar'] - element1['test'] = ['this is not a known list attribute'] - element2['ids'] = ['baz', 'qux'] - element2['test'] = ['overwrite'] + element1 = nodes.Element(ids=['foo', 'bar'], test=['a', 'list']) + element2 = nodes.Element(ids=['baz', 'qux'], test=['overwrite']) element1.update(element2) - # 'ids' are appended. + # 'ids' are appended because 'ids' is a known list attribute. self.assertEquals(element1['ids'], ['foo', 'bar', 'baz', 'qux']) # 'test' is overwritten. self.assertEquals(element1['test'], ['overwrite']) + def test_substitute(self): + parent = nodes.Element(ids=['parent']) + child1 = nodes.Element(ids=['child1']) + grandchild = nodes.Element(ids=['grandchild']) + child1 += grandchild + child2 = nodes.Element(ids=['child2']) + twins = [nodes.Element(ids=['twin%s' % i]) for i in (1, 2)] + child2 += twins + child3 = nodes.Element(ids=['child3']) + parent += [child1, child2, child3] + self.assertEquals(parent.pformat(), """\ + + + + + + + +""") + # Replace child1 with the grandchild. + child1.substitute(child1[0]) + self.assertEquals(parent[0], grandchild) + # Assert that 'ids' have been updated. + self.assertEquals(grandchild['ids'], ['grandchild', 'child1']) + # Replace child2 with its children. + child2.substitute(child2[:]) + self.assertEquals(parent[1:3], twins) + # Assert that 'ids' have been propagated to first child. + self.assertEquals(twins[0]['ids'], ['twin1', 'child2']) + self.assertEquals(twins[1]['ids'], ['twin2']) + # Replace child3 with new child. + newchild = nodes.Element(ids=['newchild']) + child3.substitute(newchild) + self.assertEquals(parent[3], newchild) + self.assertEquals(len(parent), 4) + self.assertEquals(newchild['ids'], ['newchild', 'child3']) + class MiscTests(unittest.TestCase): -- cgit v1.2.1 From 1fb082996542f35c18179afdff35ddba32d698f6 Mon Sep 17 00:00:00 2001 From: wiemann Date: Sun, 11 Sep 2005 21:22:16 +0000 Subject: renamed update to update_basic_atts; added history entry git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3868 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_nodes.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'test') diff --git a/test/test_nodes.py b/test/test_nodes.py index deda8455d..effdce2db 100755 --- a/test/test_nodes.py +++ b/test/test_nodes.py @@ -105,14 +105,14 @@ class ElementTests(unittest.TestCase): {'ids': ['someid']}) self.assert_(element.is_not_default('ids')) - def test_update(self): - element1 = nodes.Element(ids=['foo', 'bar'], test=['a', 'list']) - element2 = nodes.Element(ids=['baz', 'qux'], test=['overwrite']) - element1.update(element2) - # 'ids' are appended because 'ids' is a known list attribute. + def test_update_basic_atts(self): + element1 = nodes.Element(ids=['foo', 'bar'], test=['test1']) + element2 = nodes.Element(ids=['baz', 'qux'], test=['test2']) + element1.update_basic_atts(element2) + # 'ids' are appended because 'ids' is a basic attribute. self.assertEquals(element1['ids'], ['foo', 'bar', 'baz', 'qux']) - # 'test' is overwritten. - self.assertEquals(element1['test'], ['overwrite']) + # 'test' is not overwritten because it is not a basic attribute. + self.assertEquals(element1['test'], ['test1']) def test_substitute(self): parent = nodes.Element(ids=['parent']) -- cgit v1.2.1 From c0c6ea6df4b5fa31abd0d36c73a258b274eccc81 Mon Sep 17 00:00:00 2001 From: wiemann Date: Sun, 11 Sep 2005 21:53:02 +0000 Subject: cover two more cases: update() is passed an empty new list; substitute() is trying to substitute a node for itself git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3869 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_nodes.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/test_nodes.py b/test/test_nodes.py index effdce2db..520abd17a 100755 --- a/test/test_nodes.py +++ b/test/test_nodes.py @@ -123,7 +123,8 @@ class ElementTests(unittest.TestCase): twins = [nodes.Element(ids=['twin%s' % i]) for i in (1, 2)] child2 += twins child3 = nodes.Element(ids=['child3']) - parent += [child1, child2, child3] + child4 = nodes.Element(ids=['child4']) + parent += [child1, child2, child3, child4] self.assertEquals(parent.pformat(), """\ @@ -132,6 +133,7 @@ class ElementTests(unittest.TestCase): + """) # Replace child1 with the grandchild. child1.substitute(child1[0]) @@ -148,8 +150,12 @@ class ElementTests(unittest.TestCase): newchild = nodes.Element(ids=['newchild']) child3.substitute(newchild) self.assertEquals(parent[3], newchild) - self.assertEquals(len(parent), 4) self.assertEquals(newchild['ids'], ['newchild', 'child3']) + # Crazy but possible case: Substitute child4 for itself. + child4.substitute(child4) + # Make sure the 'child4' ID hasn't been duplicated. + self.assertEquals(child4['ids'], ['child4']) + self.assertEquals(len(parent), 5) class MiscTests(unittest.TestCase): -- cgit v1.2.1 From 469baf29f163924dca499b0591ca6f2addba6b35 Mon Sep 17 00:00:00 2001 From: wiemann Date: Sun, 11 Sep 2005 21:53:49 +0000 Subject: replaced node.parent.replace(node, new) constructs with node.substitute(new) git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3870 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_html4css1.html | 4 ++-- test/functional/expected/standalone_rst_pseudoxml.txt | 4 ++-- test/test_transforms/test_footnotes.py | 4 ++-- test/test_transforms/test_hyperlinks.py | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index 2093ab1bb..da34c5fee 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -479,7 +479,7 @@ Here's a reference to the next footnote: [4]Here's an unreferenced footnote, with a reference to a -nonexistent footnote: [5]_. +nonexistent footnote: [5]_.
    @@ -492,7 +492,7 @@ nonexistent footnote: [CIT2002], and a [nonexistent]_ +

    Here's a reference to the above, [CIT2002], and a [nonexistent]_ citation.

    diff --git a/test/functional/expected/standalone_rst_pseudoxml.txt b/test/functional/expected/standalone_rst_pseudoxml.txt index c2af4aaa9..1e16812f1 100644 --- a/test/functional/expected/standalone_rst_pseudoxml.txt +++ b/test/functional/expected/standalone_rst_pseudoxml.txt @@ -948,7 +948,7 @@ Here's an unreferenced footnote, with a reference to a nonexistent footnote: - + [5]_ .
    @@ -967,7 +967,7 @@ CIT2002 , and a - + [nonexistent]_ citation. diff --git a/test/test_transforms/test_footnotes.py b/test/test_transforms/test_footnotes.py index f0a1a2ed0..86cbd2110 100755 --- a/test/test_transforms/test_footnotes.py +++ b/test/test_transforms/test_footnotes.py @@ -182,7 +182,7 @@ Mixed anonymous and labelled auto-numbered footnotes: 3 should be 3, \n\ - + [#]_ is one too many, @@ -327,7 +327,7 @@ and labelled auto-numbered footnotes: 6 should be 6, \n\ - + [#]_ is one too many, diff --git a/test/test_transforms/test_hyperlinks.py b/test/test_transforms/test_hyperlinks.py index 8d7d6a029..d060043cd 100755 --- a/test/test_transforms/test_hyperlinks.py +++ b/test/test_transforms/test_hyperlinks.py @@ -145,7 +145,7 @@ circular_ indirect reference circular_ indirect reference - + .. _indirect: circular_ @@ -787,7 +787,7 @@ Duplicate manual footnote labels, with reference ([1]_): Duplicate manual footnote labels, with reference ( - + [1]_ ): -- cgit v1.2.1 From 77b4d3fc857f026b735bd906979900c63f314be6 Mon Sep 17 00:00:00 2001 From: wiemann Date: Sun, 11 Sep 2005 22:01:23 +0000 Subject: clarified test text git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3871 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_html4css1.html | 5 +++-- test/functional/expected/standalone_rst_latex.tex | 5 +++-- test/functional/expected/standalone_rst_pseudoxml.txt | 5 +++-- test/functional/input/data/standard.txt | 5 +++-- 4 files changed, 12 insertions(+), 8 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index da34c5fee..4aa0e097d 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -712,8 +712,9 @@ This one starts with a literal block.

    Compound 4, a paragraph.

    -

    Now something really perverted -- a nested compound block. In -LaTeX, the following paragraphs should all be first-line indented:

    +

    Now something really perverted -- a nested compound block. This is +just to test that it works at all; the results don't have to be +meaningful.

    Compound 5, block 1 (a paragraph).

    diff --git a/test/functional/expected/standalone_rst_latex.tex b/test/functional/expected/standalone_rst_latex.tex index fcdaea338..aa03b5dc0 100644 --- a/test/functional/expected/standalone_rst_latex.tex +++ b/test/functional/expected/standalone_rst_latex.tex @@ -1140,8 +1140,9 @@ This~one~starts~with~a~literal~block. }\end{quote} Compound 4, a paragraph. -Now something \emph{really} perverted -{}- a nested compound block. In -LaTeX, the following paragraphs should all be first-line indented: +Now something \emph{really} perverted -{}- a nested compound block. This is +just to test that it works at all; the results don't have to be +meaningful. Compound 5, block 1 (a paragraph). diff --git a/test/functional/expected/standalone_rst_pseudoxml.txt b/test/functional/expected/standalone_rst_pseudoxml.txt index 1e16812f1..cab207a70 100644 --- a/test/functional/expected/standalone_rst_pseudoxml.txt +++ b/test/functional/expected/standalone_rst_pseudoxml.txt @@ -1351,8 +1351,9 @@ Now something really - perverted -- a nested compound block. In - LaTeX, the following paragraphs should all be first-line indented: + perverted -- a nested compound block. This is + just to test that it works at all; the results don't have to be + meaningful. Compound 5, block 1 (a paragraph). diff --git a/test/functional/input/data/standard.txt b/test/functional/input/data/standard.txt index 140be35c7..85016529f 100644 --- a/test/functional/input/data/standard.txt +++ b/test/functional/input/data/standard.txt @@ -612,8 +612,9 @@ Another compound statement: Compound 4, a paragraph. -Now something *really* perverted -- a nested compound block. In -LaTeX, the following paragraphs should all be first-line indented: +Now something *really* perverted -- a nested compound block. This is +just to test that it works at all; the results don't have to be +meaningful. .. compound:: -- cgit v1.2.1 From 8252a44b36b80dc64f70b92666b525f5b44f2d4c Mon Sep 17 00:00:00 2001 From: wiemann Date: Sun, 11 Sep 2005 22:23:43 +0000 Subject: added writer_aux module containing Compound transform, which flattens the compound paragraph structure git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3872 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms/test_writer_aux.py | 57 +++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100755 test/test_transforms/test_writer_aux.py (limited to 'test') diff --git a/test/test_transforms/test_writer_aux.py b/test/test_transforms/test_writer_aux.py new file mode 100755 index 000000000..34b723241 --- /dev/null +++ b/test/test_transforms/test_writer_aux.py @@ -0,0 +1,57 @@ +#! /usr/bin/env python + +# Author: Felix Wiemann +# Contact: Felix_Wiemann@ososo.de +# Revision: $Revision$ +# Date: $Date$ +# Copyright: This module has been placed in the public domain. + +""" +Test module for writer_aux transforms. +""" + +from docutils.transforms import writer_aux +from __init__ import DocutilsTestSupport +from docutils.parsers.rst import Parser + +def suite(): + parser = Parser() + s = DocutilsTestSupport.TransformTestSuite(parser) + s.generateTests(totest) + return s + + +totest = {} + +totest['compound'] = ((writer_aux.Compound,), [ +["""\ +.. class:: compound + +.. compound:: + + .. class:: paragraph1 + + Paragraph 1. + + .. class:: paragraph2 + + Paragraph 2. + + Block quote. +""", +"""\ + + + Paragraph 1. + + Paragraph 2. + + + Block quote. +"""], +]) + + +if __name__ == '__main__': + import unittest + unittest.main(defaultTest='suite') -- cgit v1.2.1 From b07ac8b595e3217c26ee6eb04ff648511a99dc0e Mon Sep 17 00:00:00 2001 From: wiemann Date: Mon, 12 Sep 2005 21:22:07 +0000 Subject: more tests, more handling for edge cases, some polishing git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3875 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/input/data/latex.txt | 114 +++++++++++++++++++++++++++++------ 1 file changed, 97 insertions(+), 17 deletions(-) (limited to 'test') diff --git a/test/functional/input/data/latex.txt b/test/functional/input/data/latex.txt index ee9c02a4d..20d59db1e 100644 --- a/test/functional/input/data/latex.txt +++ b/test/functional/input/data/latex.txt @@ -83,28 +83,108 @@ Nested Elements :Field list: | Line | Block -:Another field: * Bullet - * list +:Field 2: * Bullet + * list +:Another (longer) field: * Bullet + * list +:Yet another long field: + * .. comment + + Bullet + + .. comment + + * .. comment + + list + + .. comment + +:Field: * This + + is + + a + + * bullet + + list + +:Field: * | This is + | a bullet + * | list with + | line blocks +:Last field: Last field. * * * * * * * * Deeply nested list. 1. 2. 3. 4. 5. 6. 7. 8. Deeply nested list. -+---------------+ -| | Line block | -| | -| * Bullet list | -| | -| :: | -| | -| Literal | -| block | -+---------------+ -| :Field 1: | -| Text. | -| :Field 2: | -| More text. | -+---------------+ ++-----------------+ +| | Line block | +| | +| * Bullet list | +| | +| :: | +| | +| Literal | +| block | ++-----------------+ +| :Field 1: | +| Text. | +| :Field 2: | +| More text. | ++-----------------+ +| +-------+-----+ | +| | A |* foo| | +| | nested| | | +| | table.|* bar| | +| +-------+-----+ | ++-----------------+ +| This is a | +| paragraph. | +| | +| +-------+-----+ | +| | A |* foo| | +| | nested| | | +| | table.|* bar| | +| +-------+-----+ | +| | +| Another longer | +| paragraph. | ++-----------------+ +| * A list. | +| * A list. | +| | +| +-------+-----+ | +| | A |* foo| | +| | nested| | | +| | table.|* bar| | +| +-------+-----+ | +| | +| * Another list. | +| * Another list. | ++-----------------+ +| Foo | +| | +| Bar | ++-----------------+ +| * Foo | +| | +| * Bar | ++-----------------+ +| * This is a | +| paragraph. | +| | +| This is a | +| paragraph. | +| | +| * This is a | +| paragraph. | +| | +| This is a | +| paragraph. | ++-----------------+ Images -- cgit v1.2.1 From 954c213bb271a9a2b91e694c8fbf155925dd9f4e Mon Sep 17 00:00:00 2001 From: goodger Date: Thu, 15 Sep 2005 14:16:33 +0000 Subject: Added support for specifying runtime settings at the suite level git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3879 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/DocutilsTestSupport.py | 55 +++++++++++++++++---------- test/test_transforms/test_expose_internals.py | 11 +++--- 2 files changed, 41 insertions(+), 25 deletions(-) (limited to 'test') diff --git a/test/DocutilsTestSupport.py b/test/DocutilsTestSupport.py index ba4a14f81..ea1672d1b 100644 --- a/test/DocutilsTestSupport.py +++ b/test/DocutilsTestSupport.py @@ -135,7 +135,8 @@ class CustomTestCase(StandardTestCase): compare = docutils_difflib.Differ().compare """Comparison method shared by all subclasses.""" - def __init__(self, method_name, input, expected, id, run_in_debugger=0): + def __init__(self, method_name, input, expected, id, run_in_debugger=0, + suite_settings=None): """ Initialise the CustomTestCase. @@ -146,11 +147,13 @@ class CustomTestCase(StandardTestCase): expected -- expected output from the parser. id -- unique test identifier, used by the test framework. run_in_debugger -- if true, run this test under the pdb debugger. + suite_settings -- settings overrides for this test suite. """ self.id = id self.input = input self.expected = expected self.run_in_debugger = run_in_debugger + self.suite_settings = suite_settings or {} # Ring your mother. unittest.TestCase.__init__(self, method_name) @@ -205,15 +208,17 @@ class CustomTestSuite(unittest.TestSuite): next_test_case_id = 0 """The next identifier to use for non-identified test cases.""" - def __init__(self, tests=(), id=None): + def __init__(self, tests=(), id=None, suite_settings=None): """ Initialize the CustomTestSuite. Arguments: id -- identifier for the suite, prepended to test cases. + suite_settings -- settings overrides for this test suite. """ unittest.TestSuite.__init__(self, tests) + self.suite_settings = suite_settings or {} if id is None: mypath = os.path.abspath( sys.modules[CustomTestSuite.__module__].__file__) @@ -256,6 +261,9 @@ class CustomTestSuite(unittest.TestSuite): self.next_test_case_id += 1 # test identifier will become suiteid.testid tcid = '%s: %s' % (self.id, id) + # suite_settings may be passed as a parameter; + # if not, set from attribute: + kwargs.setdefault('suite_settings', self.suite_settings) # generate and add test case tc = test_case_class(method_name, input, expected, tcid, run_in_debugger=run_in_debugger, **kwargs) @@ -300,7 +308,9 @@ class TransformTestCase(CustomTestCase): def test_transforms(self): if self.run_in_debugger: pdb.set_trace() - document = utils.new_document('test data', self.settings) + settings = self.settings.copy() + settings.__dict__.update(self.suite_settings) + document = utils.new_document('test data', settings) self.parser.parse(self.input, document) # Don't do a ``populate_from_components()`` because that would # enable the Transformer's default transforms. @@ -317,7 +327,9 @@ class TransformTestCase(CustomTestCase): print '\n', self.id print '-' * 70 print self.input - document = utils.new_document('test data', self.settings) + settings = self.settings.copy() + settings.__dict__.update(self.suite_settings) + document = utils.new_document('test data', settings) self.parser.parse(self.input, document) print '-' * 70 print document.pformat() @@ -339,11 +351,11 @@ class TransformTestSuite(CustomTestSuite): setUp and tearDown). """ - def __init__(self, parser): + def __init__(self, parser, suite_settings=None): self.parser = parser """Parser shared by all test cases.""" - CustomTestSuite.__init__(self) + CustomTestSuite.__init__(self, suite_settings=suite_settings) def generateTests(self, dict, dictname='totest', testmethod='test_transforms'): @@ -363,6 +375,11 @@ class TransformTestSuite(CustomTestSuite): case = cases[casenum] run_in_debugger = 0 if len(case)==3: + # TODO: (maybe) change the 3rd argument to a dict, so it + # can handle more cases by keyword ('disable', 'debug', + # 'settings'), here and in other generateTests methods. + # But there's also the method that + # HtmlPublishPartsTestSuite uses if case[2]: run_in_debugger = 1 else: @@ -397,7 +414,9 @@ class ParserTestCase(CustomTestCase): def test_parser(self): if self.run_in_debugger: pdb.set_trace() - document = utils.new_document('test data', self.settings) + settings = self.settings.copy() + settings.__dict__.update(self.suite_settings) + document = utils.new_document('test data', settings) # Remove any additions made by "role" directives: roles._roles = {} self.parser.parse(self.input, document) @@ -655,17 +674,18 @@ class WriterPublishTestCase(CustomTestCase, docutils.SettingsSpec): reader_name='standalone', parser_name='restructuredtext', writer_name=self.writer_name, - settings_spec=self) + settings_spec=self, + settings_overrides=self.suite_settings) self.compare_output(self.input, output, self.expected) class PublishTestSuite(CustomTestSuite): - def __init__(self, writer_name): + def __init__(self, writer_name, suite_settings=None): """ `writer_name` is the name of the writer to use. """ - CustomTestSuite.__init__(self) + CustomTestSuite.__init__(self, suite_settings=suite_settings) self.test_class = WriterPublishTestCase self.writer_name = writer_name @@ -692,6 +712,8 @@ class HtmlPublishPartsTestSuite(CustomTestSuite): def generateTests(self, dict, dictname='totest'): for name, (settings_overrides, cases) in dict.items(): + settings = self.suite_settings.copy() + settings.update(settings_overrides) for casenum in range(len(cases)): case = cases[casenum] run_in_debugger = 0 @@ -702,10 +724,10 @@ class HtmlPublishPartsTestSuite(CustomTestSuite): continue self.addTestCase( HtmlWriterPublishPartsTestCase, 'test_publish', - settings_overrides=settings_overrides, input=case[0], expected=case[1], id='%s[%r][%s]' % (dictname, name, casenum), - run_in_debugger=run_in_debugger) + run_in_debugger=run_in_debugger, + suite_settings=settings) class HtmlWriterPublishPartsTestCase(WriterPublishTestCase): @@ -720,13 +742,6 @@ class HtmlWriterPublishPartsTestCase(WriterPublishTestCase): WriterPublishTestCase.settings_default_overrides.copy() settings_default_overrides['stylesheet'] = '' - def __init__(self, *args, **kwargs): - self.settings_overrides = kwargs['settings_overrides'] - """Settings overrides to use for this test case.""" - - del kwargs['settings_overrides'] # only wanted here - CustomTestCase.__init__(self, *args, **kwargs) - def test_publish(self): if self.run_in_debugger: pdb.set_trace() @@ -736,7 +751,7 @@ class HtmlWriterPublishPartsTestCase(WriterPublishTestCase): parser_name='restructuredtext', writer_name=self.writer_name, settings_spec=self, - settings_overrides=self.settings_overrides) + settings_overrides=self.suite_settings) output = self.format_output(parts) # interpolate standard variables: expected = self.expected % {'version': docutils.__version__} diff --git a/test/test_transforms/test_expose_internals.py b/test/test_transforms/test_expose_internals.py index 37747a68b..db19d2a0a 100755 --- a/test/test_transforms/test_expose_internals.py +++ b/test/test_transforms/test_expose_internals.py @@ -17,7 +17,8 @@ from docutils.parsers.rst import Parser def suite(): parser = Parser() - s = DocutilsTestSupport.TransformTestSuite(parser) + s = DocutilsTestSupport.TransformTestSuite( + parser, suite_settings={'expose_internals': ['rawsource', 'source']}) s.generateTests(totest) return s @@ -29,10 +30,10 @@ totest['transitions'] = ((ExposeInternals,), [ This is a test. """, """\ -[Test disabled at the moment. How do we activate the expose_internals -setting for this test suite?] -""", -0], + + + This is a test. +"""], ]) -- cgit v1.2.1 From 8327158676328972e0e83dd2d7a8f3691d0345d1 Mon Sep 17 00:00:00 2001 From: wiemann Date: Sat, 17 Sep 2005 22:43:04 +0000 Subject: made cloaking of email addresses with ``--cloak-email-addresses`` less obtrusive; updated documentation; added warning about incorrectly decoded cloaked email addresses git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3883 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/pep_html.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/functional/expected/pep_html.html b/test/functional/expected/pep_html.html index d48b8fb99..c3809bf17 100644 --- a/test/functional/expected/pep_html.html +++ b/test/functional/expected/pep_html.html @@ -38,7 +38,7 @@ to templates. DO NOT USE THIS HTML FILE AS YOUR TEMPLATE! Author:John Doe <john at example.org> -Discussions-To:<devnull at example.org> +Discussions-To:<devnull at example.org> Status:Draft @@ -75,7 +75,7 @@ thing.

    - +
    [1]PEP editors: peps@python.org
    [1]PEP editors: peps@python.org
    -- cgit v1.2.1 From 50026aa92c1147e0786874ee793017dd46539f55 Mon Sep 17 00:00:00 2001 From: wiemann Date: Sun, 18 Sep 2005 16:08:13 +0000 Subject: added
    to make PEP writer output valid XHTML git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3888 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/pep_html.html | 1 + 1 file changed, 1 insertion(+) (limited to 'test') diff --git a/test/functional/expected/pep_html.html b/test/functional/expected/pep_html.html index c3809bf17..92b6772ab 100644 --- a/test/functional/expected/pep_html.html +++ b/test/functional/expected/pep_html.html @@ -24,6 +24,7 @@ to templates. DO NOT USE THIS HTML FILE AS YOUR TEMPLATE! [PEP Index] [PEP Source]
    +
    -- cgit v1.2.1 From c976bf8ced13397135c52212701c0ad3aed45013 Mon Sep 17 00:00:00 2001 From: wiemann Date: Thu, 22 Sep 2005 18:51:33 +0000 Subject: changed DanglingReferences priority back to 850 git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3897 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../expected/standalone_rst_html4css1.html | 186 ++++++++++----------- .../expected/standalone_rst_pseudoxml.txt | 178 ++++++++++---------- 2 files changed, 182 insertions(+), 182 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index 4aa0e097d..032e37a47 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -88,67 +88,67 @@ They are transformed from section titles after parsing. -->

    Table of Contents

    -

    1   Structural Elements

    +

    1   Structural Elements

    -

    1.1   Section Title

    +

    1.1   Section Title

    Section Subtitle

    That's it, the text just above this line.

    -

    1.3   Transitions

    +

    1.3   Transitions

    Here's a transition:


    It divides the section. Transitions may also occur between sections:

    @@ -156,12 +156,12 @@ They are transformed from section titles after parsing. -->

    -

    2   Body Elements

    +

    2   Body Elements

    -

    2.1   Paragraphs

    +

    2.1   Paragraphs

    A paragraph.

    -

    2.1.1   Inline Markup

    +

    2.1.1   Inline Markup

    Paragraphs contain text and may contain inline markup: emphasis, strong emphasis, inline literals, standalone hyperlinks (http://www.python.org), external hyperlinks (Python [5]), internal @@ -192,7 +192,7 @@ live link to PEP 258 here.

    -

    2.2   Bullet Lists

    +

    2.2   Bullet Lists

    • A bullet list

        @@ -217,7 +217,7 @@ live link to PEP 258 here.

    -

    2.3   Enumerated Lists

    +

    2.3   Enumerated Lists

    1. Arabic numerals.

        @@ -250,7 +250,7 @@ live link to PEP 258 here.

    -

    2.4   Definition Lists

    +

    2.4   Definition Lists

    Term
    Definition
    @@ -265,7 +265,7 @@ live link to PEP 258 here.

    @@ -289,7 +289,7 @@ doesn't get stripped away.)

    -

    2.6   Option Lists

    +

    2.6   Option Lists

    For listing command-line options:

    @@ -335,7 +335,7 @@ regardless of where it starts.

    description.

    -

    2.7   Literal Blocks

    +

    2.7   Literal Blocks

    Literal blocks are indicated with a double-colon ("::") at the end of the preceding paragraph (over there -->). They can be indented:

    @@ -352,7 +352,7 @@ if literal_block:
     
    -

    2.8   Line Blocks

    +

    2.8   Line Blocks

    This section tests line blocks. Line blocks are body elements which consist of lines and other line blocks. Nested line blocks cause indentation.

    @@ -411,7 +411,7 @@ the left edge of the text above it.
    -

    2.9   Block Quotes

    +

    2.9   Block Quotes

    Block quotes consist of indented body elements:

    My theory by A. Elk. Brackets Miss, brackets. This theory goes @@ -423,7 +423,7 @@ own it, and what it is too.

    -

    2.10   Doctest Blocks

    +

    2.10   Doctest Blocks

     >>> print 'Python-specific usage examples; begun with ">>>"'
     Python-specific usage examples; begun with ">>>"
    @@ -432,7 +432,7 @@ Python-specific usage examples; begun with ">>>"
     
    @@ -479,12 +479,12 @@ Here's a reference to the next footnote: +nonexistent footnote: [5]_.
    [4]Here's an unreferenced footnote, with a reference to a -nonexistent footnote: [5]_.
    -

    2.12   Citations

    +

    2.12   Citations

    @@ -492,11 +492,11 @@ nonexistent footnote: [CIT2002], and a [nonexistent]_ +

    Here's a reference to the above, [CIT2002], and a [nonexistent]_ citation.

    -

    2.13   Targets

    +

    2.13   Targets

    This paragraph is pointed to by the explicit "example" target. A reference can be found under Inline Markup, above. Inline hyperlink targets are also possible.

    @@ -506,45 +506,45 @@ hyperlink targets are also possible.

    "Python [5]".

    Targets may be indirect and anonymous. Thus this phrase may also refer to the Targets section.

    -

    Here's a `hyperlink reference without a target`_, which generates an +

    Here's a `hyperlink reference without a target`_, which generates an error.

    -

    2.13.1   Duplicate Target Names

    +

    2.13.1   Duplicate Target Names

    Duplicate names in section headers or other implicit targets will generate "info" (level-1) system messages. Duplicate names in explicit targets will generate "warning" (level-2) system messages.

    -

    2.13.2   Duplicate Target Names

    +

    2.13.2   Duplicate Target Names

    Since there are two "Duplicate Target Names" section headers, we cannot uniquely refer to either of them by name. If we try to (like -this: `Duplicate Target Names`_), an error is generated.

    +this: `Duplicate Target Names`_), an error is generated.

    -

    2.14   Directives

    +

    2.14   Directives

    These are just a sample of the many reStructuredText Directives. For others, please see http://docutils.sourceforge.net/docs/ref/rst/directives.html.

    -

    2.14.1   Document Parts

    +

    2.14.1   Document Parts

    An example of the "contents" directive can be seen above this section (a local, untitled table of contents) and at the beginning of the document (a document-wide table of contents).

    -

    2.14.2   Images

    +

    2.14.2   Images

    An image directive (also clickable -- a hyperlink reference):

    ../../../docs/user/rst/images/title.png

    Image with multiple IDs:

    @@ -606,7 +606,7 @@ document (a document-wide table o ../../../docs/user/rst/images/biohazard.png
    -

    2.14.3   Admonitions

    +

    2.14.3   Admonitions

    Attention!

    Directives at large.

    @@ -655,7 +655,7 @@ Reader discretion is strongly advised.

    -

    2.14.4   Topics, Sidebars, and Rubrics

    +

    2.14.4   Topics, Sidebars, and Rubrics

    @@ -681,11 +681,11 @@ background color.

    -

    2.14.7   Compound Paragraph

    +

    2.14.7   Compound Paragraph

    Compound 1, paragraph 1.

    Compound 1, paragraph 2.

    @@ -754,12 +754,12 @@ paragraph.
    -

    2.15   Substitution Definitions

    +

    2.15   Substitution Definitions

    An inline image (EXAMPLE) example:

    (Substitution definitions are not visible in the HTML source.)

    -

    2.16   Comments

    +

    2.16   Comments

    Here's one:

    (View the HTML source to see the comment.)

    -

    2.17   Raw text

    +

    2.17   Raw text

    This does not necessarily look nice, because there may be missing white space.

    It's just there to freeze the behavior.

    A test.Second test.
    Another test with myclass set.

    This is the fourth test with myrawroleclass set.

    Fifth test in HTML.
    Line two.
    -

    2.18   Colspanning tables

    +

    2.18   Colspanning tables

    This table has a cell spanning two columns:

    @@ -813,7 +813,7 @@ Fifth test in HTML.
    Line two.
    -

    2.19   Rowspanning tables

    +

    2.19   Rowspanning tables

    Here's a table with cells spanning several rows:

    @@ -846,7 +846,7 @@ cell.
    -

    2.20   Complex tables

    +

    2.20   Complex tables

    Here's a complex table, which should test all features.

    @@ -895,7 +895,7 @@ empty: -->
    -

    2.21   List Tables

    +

    2.21   List Tables

    Here's a list table exercising all features:

    @@ -929,7 +929,7 @@ crunchy, now would it?
    -

    3   Error Handling

    +

    3   Error Handling

    Any errors caught during processing will generate system messages.

    There should be five messages in the following, auto-generated section, "Docutils System Messages":

    @@ -940,17 +940,17 @@ section, "Docutils System Messages":

    System Message: ERROR/3 (functional/input/data/standard.txt, line 100); backlink

    Undefined substitution referenced: "problematic".
    -
    -

    System Message: ERROR/3 (functional/input/standalone_rst_html4css1.txt, line 354); backlink

    +
    +

    System Message: ERROR/3 (functional/input/standalone_rst_html4css1.txt, line 354); backlink

    Unknown target name: "5".
    -
    -

    System Message: ERROR/3 (functional/input/data/standard.txt, line 363); backlink

    +
    +

    System Message: ERROR/3 (functional/input/data/standard.txt, line 363); backlink

    Unknown target name: "nonexistent".
    -
    -

    System Message: ERROR/3 (functional/input/data/standard.txt, line 390); backlink

    +
    +

    System Message: ERROR/3 (functional/input/data/standard.txt, line 390); backlink

    Unknown target name: "hyperlink reference without a target".
    -
    -

    System Message: ERROR/3 (functional/input/data/standard.txt, line 403); backlink

    +
    +

    System Message: ERROR/3 (functional/input/data/standard.txt, line 403); backlink

    Duplicate target name, cannot be used as a unique reference: "duplicate target names".
    diff --git a/test/functional/expected/standalone_rst_pseudoxml.txt b/test/functional/expected/standalone_rst_pseudoxml.txt index cab207a70..dc7940ee1 100644 --- a/test/functional/expected/standalone_rst_pseudoxml.txt +++ b/test/functional/expected/standalone_rst_pseudoxml.txt @@ -91,238 +91,238 @@ - + 1    Structural Elements - + 1.1    Section Title - + 1.2    Empty Section - + 1.3    Transitions - + 2    Body Elements - + 2.1    Paragraphs - + 2.1.1    Inline Markup - + 2.2    Bullet Lists - + 2.3    Enumerated Lists - + 2.4    Definition Lists - + 2.5    Field Lists - + 2.6    Option Lists - + 2.7    Literal Blocks - + 2.8    Line Blocks - + 2.9    Block Quotes - + 2.10    Doctest Blocks - + 2.11    Footnotes - + 2.12    Citations - + 2.13    Targets - + 2.13.1    Duplicate Target Names - + 2.13.2    Duplicate Target Names - + 2.14    Directives - + 2.14.1    Document Parts - + 2.14.2    Images - + 2.14.3    Admonitions - + 2.14.4    Topics, Sidebars, and Rubrics - + 2.14.5    Target Footnotes - + 2.14.6    Replacement Text - + 2.14.7    Compound Paragraph - + 2.15    Substitution Definitions - + 2.16    Comments - + 2.17    Raw text - + 2.18    Colspanning tables - + 2.19    Rowspanning tables - + 2.20    Complex tables - + 2.21    List Tables - + 3    Error Handling
    - + <title auto="1" refid="id25"> <generated classes="sectnum"> 1    Structural Elements <section ids="section-title" names="section title"> - <title auto="1" refid="id34"> + <title auto="1" refid="id26"> <generated classes="sectnum"> 1.1    Section Title @@ -331,12 +331,12 @@ <paragraph> That's it, the text just above this line. <section ids="empty-section" names="empty section"> - <title auto="1" refid="id35"> + <title auto="1" refid="id27"> <generated classes="sectnum"> 1.2    Empty Section <section ids="transitions" names="transitions"> - <title auto="1" refid="id36"> + <title auto="1" refid="id28"> <generated classes="sectnum"> 1.3    Transitions @@ -347,19 +347,19 @@ It divides the section. Transitions may also occur between sections: <transition> <section ids="body-elements" names="body elements"> - <title auto="1" refid="id37"> + <title auto="1" refid="id29"> <generated classes="sectnum"> 2    Body Elements <section ids="paragraphs" names="paragraphs"> - <title auto="1" refid="id38"> + <title auto="1" refid="id30"> <generated classes="sectnum"> 2.1    Paragraphs <paragraph> A paragraph. <section ids="inline-markup" names="inline markup"> - <title auto="1" refid="id39"> + <title auto="1" refid="id31"> <generated classes="sectnum"> 2.1.1    Inline Markup @@ -484,7 +484,7 @@ option was supplied, there should be a live link to PEP 258 here. <section ids="bullet-lists" names="bullet lists"> - <title auto="1" refid="id40"> + <title auto="1" refid="id32"> <generated classes="sectnum"> 2.2    Bullet Lists @@ -528,7 +528,7 @@ <comment xml:space="preserve"> Even if this item contains a target and a comment. <section ids="enumerated-lists" names="enumerated lists"> - <title auto="1" refid="id41"> + <title auto="1" refid="id33"> <generated classes="sectnum"> 2.3    Enumerated Lists @@ -577,7 +577,7 @@ <paragraph> iv <section ids="definition-lists" names="definition lists"> - <title auto="1" refid="id42"> + <title auto="1" refid="id34"> <generated classes="sectnum"> 2.4    Definition Lists @@ -615,7 +615,7 @@ <paragraph> Definition <section ids="field-lists" names="field lists"> - <title auto="1" refid="id43"> + <title auto="1" refid="id35"> <generated classes="sectnum"> 2.5    Field Lists @@ -649,7 +649,7 @@ about credits but just for ensuring that the class attribute doesn't get stripped away.) <section ids="option-lists" names="option lists"> - <title auto="1" refid="id44"> + <title auto="1" refid="id36"> <generated classes="sectnum"> 2.6    Option Lists @@ -762,7 +762,7 @@ There must be at least two spaces between the option and the description. <section ids="literal-blocks" names="literal blocks"> - <title auto="1" refid="id45"> + <title auto="1" refid="id37"> <generated classes="sectnum"> 2.7    Literal Blocks @@ -784,7 +784,7 @@ > > Why didn't I think of that? <section ids="line-blocks" names="line blocks"> - <title auto="1" refid="id46"> + <title auto="1" refid="id38"> <generated classes="sectnum"> 2.8    Line Blocks @@ -862,7 +862,7 @@ <line> Singing... <section ids="block-quotes" names="block quotes"> - <title auto="1" refid="id47"> + <title auto="1" refid="id39"> <generated classes="sectnum"> 2.9    Block Quotes @@ -878,7 +878,7 @@ <attribution> Anne Elk (Miss) <section ids="doctest-blocks" names="doctest blocks"> - <title auto="1" refid="id48"> + <title auto="1" refid="id40"> <generated classes="sectnum"> 2.10    Doctest Blocks @@ -888,7 +888,7 @@ >>> print '(cut and pasted from interactive Python sessions)' (cut and pasted from interactive Python sessions) <section ids="footnotes" names="footnotes"> - <title auto="1" refid="id49"> + <title auto="1" refid="id41"> <generated classes="sectnum"> 2.11    Footnotes @@ -948,11 +948,11 @@ <paragraph> Here's an unreferenced footnote, with a reference to a nonexistent footnote: - <problematic ids="id26 id14" refid="id25"> + <problematic ids="id70 id14" refid="id69"> [5]_ . <section ids="citations" names="citations"> - <title auto="1" refid="id50"> + <title auto="1" refid="id42"> <generated classes="sectnum"> 2.12    Citations @@ -967,13 +967,13 @@ <citation_reference ids="id15" refid="cit2002"> CIT2002 , and a - <problematic ids="id28 id16" refid="id27"> + <problematic ids="id72 id16" refid="id71"> [nonexistent]_ citation. <target refid="another-target"> <section ids="targets another-target" names="targets another target"> - <title auto="1" refid="id51"> + <title auto="1" refid="id43"> <generated classes="sectnum"> 2.13    Targets @@ -1018,12 +1018,12 @@ <target anonymous="1" ids="id17" refid="targets"> <paragraph> Here's a - <problematic ids="id30" refid="id29"> + <problematic ids="id74" refid="id73"> `hyperlink reference without a target`_ , which generates an error. <section dupnames="duplicate target names" ids="duplicate-target-names"> - <title auto="1" refid="id52"> + <title auto="1" refid="id44"> <generated classes="sectnum"> 2.13.1    Duplicate Target Names @@ -1032,7 +1032,7 @@ generate "info" (level-1) system messages. Duplicate names in explicit targets will generate "warning" (level-2) system messages. <section dupnames="duplicate target names" ids="id18"> - <title auto="1" refid="id53"> + <title auto="1" refid="id45"> <generated classes="sectnum"> 2.13.2    Duplicate Target Names @@ -1040,11 +1040,11 @@ Since there are two "Duplicate Target Names" section headers, we cannot uniquely refer to either of them by name. If we try to (like this: - <problematic ids="id32" refid="id31"> + <problematic ids="id76" refid="id75"> `Duplicate Target Names`_ ), an error is generated. <section ids="directives" names="directives"> - <title auto="1" refid="id54"> + <title auto="1" refid="id46"> <generated classes="sectnum"> 2.14    Directives @@ -1052,43 +1052,43 @@ <bullet_list classes="auto-toc"> <list_item> <paragraph> - <reference ids="id70" refid="document-parts"> + <reference ids="id62" refid="document-parts"> <generated classes="sectnum"> 2.14.1    Document Parts <list_item> <paragraph> - <reference ids="id71" refid="images"> + <reference ids="id63" refid="images"> <generated classes="sectnum"> 2.14.2    Images <list_item> <paragraph> - <reference ids="id72" refid="admonitions"> + <reference ids="id64" refid="admonitions"> <generated classes="sectnum"> 2.14.3    Admonitions <list_item> <paragraph> - <reference ids="id73" refid="topics-sidebars-and-rubrics"> + <reference ids="id65" refid="topics-sidebars-and-rubrics"> <generated classes="sectnum"> 2.14.4    Topics, Sidebars, and Rubrics <list_item> <paragraph> - <reference ids="id74" refid="target-footnotes"> + <reference ids="id66" refid="target-footnotes"> <generated classes="sectnum"> 2.14.5    Target Footnotes <list_item> <paragraph> - <reference ids="id75" refid="replacement-text"> + <reference ids="id67" refid="replacement-text"> <generated classes="sectnum"> 2.14.6    Replacement Text <list_item> <paragraph> - <reference ids="id76" refid="compound-paragraph"> + <reference ids="id68" refid="compound-paragraph"> <generated classes="sectnum"> 2.14.7    Compound Paragraph @@ -1099,7 +1099,7 @@ http://docutils.sourceforge.net/docs/ref/rst/directives.html . <section ids="document-parts" names="document parts"> - <title auto="1" refid="id70"> + <title auto="1" refid="id62"> <generated classes="sectnum"> 2.14.1    Document Parts @@ -1114,7 +1114,7 @@ table of contents ). <section ids="images" names="images"> - <title auto="1" refid="id71"> + <title auto="1" refid="id63"> <generated classes="sectnum"> 2.14.2    Images @@ -1206,7 +1206,7 @@ An image 3 cm high: <image height="3cm" uri="../../../docs/user/rst/images/biohazard.png"> <section ids="admonitions" names="admonitions"> - <title auto="1" refid="id72"> + <title auto="1" refid="id64"> <generated classes="sectnum"> 2.14.3    Admonitions @@ -1256,7 +1256,7 @@ You can make up your own admonition too. <target ids="docutils" names="docutils" refuri="http://docutils.sourceforge.net/"> <section ids="topics-sidebars-and-rubrics" names="topics, sidebars, and rubrics"> - <title auto="1" refid="id73"> + <title auto="1" refid="id65"> <generated classes="sectnum"> 2.14.4    Topics, Sidebars, and Rubrics @@ -1281,7 +1281,7 @@ <rubric> This is a rubric <section ids="target-footnotes" names="target footnotes"> - <title auto="1" refid="id74"> + <title auto="1" refid="id66"> <generated classes="sectnum"> 2.14.5    Target Footnotes @@ -1292,7 +1292,7 @@ <reference refuri="http://www.python.org/"> http://www.python.org/ <section ids="replacement-text" names="replacement text"> - <title auto="1" refid="id75"> + <title auto="1" refid="id67"> <generated classes="sectnum"> 2.14.6    Replacement Text @@ -1313,7 +1313,7 @@ the best language around <section ids="compound-paragraph" names="compound paragraph"> - <title auto="1" refid="id76"> + <title auto="1" refid="id68"> <generated classes="sectnum"> 2.14.7    Compound Paragraph @@ -1399,7 +1399,7 @@ <paragraph> Compound 7, another paragraph. <section ids="substitution-definitions" names="substitution definitions"> - <title auto="1" refid="id62"> + <title auto="1" refid="id54"> <generated classes="sectnum"> 2.15    Substitution Definitions @@ -1412,7 +1412,7 @@ <paragraph> (Substitution definitions are not visible in the HTML source.) <section ids="comments" names="comments"> - <title auto="1" refid="id63"> + <title auto="1" refid="id55"> <generated classes="sectnum"> 2.16    Comments @@ -1427,7 +1427,7 @@ <paragraph> (View the HTML source to see the comment.) <section ids="raw-text" names="raw text"> - <title auto="1" refid="id64"> + <title auto="1" refid="id56"> <generated classes="sectnum"> 2.17    Raw text @@ -1451,7 +1451,7 @@ <raw format="latex" xml:space="preserve"> Fifth test in LaTeX.\\Line two. <section ids="colspanning-tables" names="colspanning tables"> - <title auto="1" refid="id65"> + <title auto="1" refid="id57"> <generated classes="sectnum"> 2.18    Colspanning tables @@ -1522,7 +1522,7 @@ <paragraph> True <section ids="rowspanning-tables" names="rowspanning tables"> - <title auto="1" refid="id66"> + <title auto="1" refid="id58"> <generated classes="sectnum"> 2.19    Rowspanning tables @@ -1574,7 +1574,7 @@ <paragraph> body row 3 <section ids="complex-tables" names="complex tables"> - <title auto="1" refid="id67"> + <title auto="1" refid="id59"> <generated classes="sectnum"> 2.20    Complex tables @@ -1659,7 +1659,7 @@ --> <entry> <section ids="list-tables" names="list tables"> - <title auto="1" refid="id68"> + <title auto="1" refid="id60"> <generated classes="sectnum"> 2.21    List Tables @@ -1716,7 +1716,7 @@ <paragraph> On a stick! <section ids="error-handling" names="error handling"> - <title auto="1" refid="id69"> + <title auto="1" refid="id61"> <generated classes="sectnum"> 3    Error Handling @@ -1733,15 +1733,15 @@ <system_message backrefs="id20" ids="id19" level="3" line="100" source="functional/input/data/standard.txt" type="ERROR"> <paragraph> Undefined substitution referenced: "problematic". - <system_message backrefs="id26" ids="id25" level="3" line="354" source="functional/input/standalone_rst_html4css1.txt" type="ERROR"> + <system_message backrefs="id70" ids="id69" level="3" line="354" source="functional/input/standalone_rst_html4css1.txt" type="ERROR"> <paragraph> Unknown target name: "5". - <system_message backrefs="id28" ids="id27" level="3" line="363" source="functional/input/data/standard.txt" type="ERROR"> + <system_message backrefs="id72" ids="id71" level="3" line="363" source="functional/input/data/standard.txt" type="ERROR"> <paragraph> Unknown target name: "nonexistent". - <system_message backrefs="id30" ids="id29" level="3" line="390" source="functional/input/data/standard.txt" type="ERROR"> + <system_message backrefs="id74" ids="id73" level="3" line="390" source="functional/input/data/standard.txt" type="ERROR"> <paragraph> Unknown target name: "hyperlink reference without a target". - <system_message backrefs="id32" ids="id31" level="3" line="403" source="functional/input/data/standard.txt" type="ERROR"> + <system_message backrefs="id76" ids="id75" level="3" line="403" source="functional/input/data/standard.txt" type="ERROR"> <paragraph> Duplicate target name, cannot be used as a unique reference: "duplicate target names". -- cgit v1.2.1 From 1b0c89fafde2292c03a0a21822ba083dca903bb1 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sun, 25 Sep 2005 15:49:54 +0000 Subject: added docutils/writers/support/ directory and removed tools/stylesheets/; updated defaults; removed docutils/transforms/html.py (no longer needed); removed ``_stylesheet_required`` internal setting; updated setup.py git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3901 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/tests/misc_rst_html4css1.py | 2 ++ test/functional/tests/pep_html.py | 7 ++++--- test/test_writers/test_html4css1.py | 7 +++++-- 3 files changed, 11 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/functional/tests/misc_rst_html4css1.py b/test/functional/tests/misc_rst_html4css1.py index d90f3453c..861a9e9c5 100644 --- a/test/functional/tests/misc_rst_html4css1.py +++ b/test/functional/tests/misc_rst_html4css1.py @@ -10,3 +10,5 @@ writer_name = "html4css1" # Settings # test for encoded attribute value: settings_overrides['stylesheet'] = 'foo&bar.css' +settings_overrides['stylesheet_path'] = '' +settings_overrides['embed_stylesheet'] = 0 diff --git a/test/functional/tests/pep_html.py b/test/functional/tests/pep_html.py index efb067ac4..fde5a0cd5 100644 --- a/test/functional/tests/pep_html.py +++ b/test/functional/tests/pep_html.py @@ -8,9 +8,10 @@ parser_name = "rst" writer_name = "pep_html" # Settings -settings_overrides['stylesheet'] = None -settings_overrides['stylesheet_path'] = "../tools/stylesheets/pep.css" -settings_overrides['template'] = "../tools/pep-html-template" +# settings_overrides['stylesheet'] = None +settings_overrides['stylesheet_path'] = ( + "../docutils/writers/support/pep_html/pep.css") +# settings_overrides['template'] = "../tools/pep-html-template" settings_overrides['python_home'] = "http://www.python.org" settings_overrides['pep_home'] = "http://www.python.org/peps" settings_overrides['no_random'] = 1 diff --git a/test/test_writers/test_html4css1.py b/test/test_writers/test_html4css1.py index 3e08d32c4..1df84de15 100755 --- a/test/test_writers/test_html4css1.py +++ b/test/test_writers/test_html4css1.py @@ -26,7 +26,8 @@ def suite(): totest = {} -totest['Title promotion'] = ({}, [ +totest['Title promotion'] = ({'stylesheet_path': '', + 'embed_stylesheet': 0}, [ ["""\ Simple String """, @@ -186,7 +187,9 @@ Some stuff """] ]) -totest['No title promotion'] = ({'doctitle_xform' : 0}, [ +totest['No title promotion'] = ({'doctitle_xform' : 0, + 'stylesheet_path': '', + 'embed_stylesheet': 0}, [ ["""\ Simple String """, -- cgit v1.2.1 From bc9ce2a9a1a519ee4d16c898fead56d6ae891ae1 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Mon, 26 Sep 2005 17:17:33 +0000 Subject: updated expected output of functional test git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3903 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/pep_html.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/functional/expected/pep_html.html b/test/functional/expected/pep_html.html index 92b6772ab..277b2e6ca 100644 --- a/test/functional/expected/pep_html.html +++ b/test/functional/expected/pep_html.html @@ -10,7 +10,7 @@ to templates. DO NOT USE THIS HTML FILE AS YOUR TEMPLATE! <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="generator" content="Docutils 0.3.10: http://docutils.sourceforge.net/" /> <title>PEP 100 -- Test PEP - +
    list table with integral header
    Date: Mon, 26 Sep 2005 18:17:31 +0000 Subject: renamed Element.substitute to Element.replace_self git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3909 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_nodes.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/test_nodes.py b/test/test_nodes.py index 520abd17a..42a64ad49 100755 --- a/test/test_nodes.py +++ b/test/test_nodes.py @@ -114,7 +114,7 @@ class ElementTests(unittest.TestCase): # 'test' is not overwritten because it is not a basic attribute. self.assertEquals(element1['test'], ['test1']) - def test_substitute(self): + def test_replace_self(self): parent = nodes.Element(ids=['parent']) child1 = nodes.Element(ids=['child1']) grandchild = nodes.Element(ids=['grandchild']) @@ -136,23 +136,23 @@ class ElementTests(unittest.TestCase): """) # Replace child1 with the grandchild. - child1.substitute(child1[0]) + child1.replace_self(child1[0]) self.assertEquals(parent[0], grandchild) # Assert that 'ids' have been updated. self.assertEquals(grandchild['ids'], ['grandchild', 'child1']) # Replace child2 with its children. - child2.substitute(child2[:]) + child2.replace_self(child2[:]) self.assertEquals(parent[1:3], twins) # Assert that 'ids' have been propagated to first child. self.assertEquals(twins[0]['ids'], ['twin1', 'child2']) self.assertEquals(twins[1]['ids'], ['twin2']) # Replace child3 with new child. newchild = nodes.Element(ids=['newchild']) - child3.substitute(newchild) + child3.replace_self(newchild) self.assertEquals(parent[3], newchild) self.assertEquals(newchild['ids'], ['newchild', 'child3']) # Crazy but possible case: Substitute child4 for itself. - child4.substitute(child4) + child4.replace_self(child4) # Make sure the 'child4' ID hasn't been duplicated. self.assertEquals(child4['ids'], ['child4']) self.assertEquals(len(parent), 5) -- cgit v1.2.1 From 4c16652c99cfc1ba8ec7dd2697d606972a98e952 Mon Sep 17 00:00:00 2001 From: goodger Date: Thu, 29 Sep 2005 13:10:07 +0000 Subject: Added support for "class" directive content. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3912 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms/test_class.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'test') diff --git a/test/test_transforms/test_class.py b/test/test_transforms/test_class.py index 6fc2b33a5..601272135 100755 --- a/test/test_transforms/test_class.py +++ b/test/test_transforms/test_class.py @@ -78,6 +78,30 @@ Paragraph Paragraph """], ["""\ +.. class:: multiple + + paragraph 1 + + paragraph 2 +""", +"""\ + + + paragraph 1 + + paragraph 2 +"""], +["""\ +.. class:: multiple + + .. Just a comment. It's silly, but possible +""", +"""\ + + + Just a comment. It's silly, but possible +"""], +["""\ .. class:: .. class:: 99 -- cgit v1.2.1 From fa67b65d49e091aec810d2e5e8db5b19fc5be2d5 Mon Sep 17 00:00:00 2001 From: goodger Date: Sun, 2 Oct 2005 01:06:42 +0000 Subject: Added ``serial_escape`` function; escapes string values that are elements of a list, for serialization. Modified Docutils-XML writing (``Element._dom_node``) and pseudo-XML writing (``Element.starttag``) to use ``serial_escape``. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3915 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../expected/standalone_rst_pseudoxml.txt | 72 +++++++++++----------- .../test_rst/test_directives/test_contents.py | 10 +-- .../test_rst/test_directives/test_include.py | 20 +++--- .../test_rst/test_directives/test_unicode.py | 6 +- test/test_parsers/test_rst/test_inline_markup.py | 8 +-- test/test_parsers/test_rst/test_section_headers.py | 46 +++++++------- test/test_parsers/test_rst/test_substitutions.py | 12 ++-- test/test_parsers/test_rst/test_targets.py | 18 +++--- test/test_parsers/test_rst/test_transitions.py | 18 +++--- test/test_publisher.py | 4 +- test/test_transforms/test_class.py | 2 +- test/test_transforms/test_contents.py | 44 ++++++------- test/test_transforms/test_doctitle.py | 16 ++--- test/test_transforms/test_hyperlinks.py | 28 ++++----- test/test_transforms/test_peps.py | 2 +- test/test_transforms/test_sectnum.py | 50 +++++++-------- test/test_transforms/test_substitutions.py | 2 +- test/test_transforms/test_transitions.py | 16 ++--- test/test_writers/test_pseudoxml.py | 2 +- 19 files changed, 188 insertions(+), 188 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_pseudoxml.txt b/test/functional/expected/standalone_rst_pseudoxml.txt index dc7940ee1..179760c86 100644 --- a/test/functional/expected/standalone_rst_pseudoxml.txt +++ b/test/functional/expected/standalone_rst_pseudoxml.txt @@ -1,7 +1,7 @@ - + reStructuredText Test Document - <subtitle ids="examples-of-syntax-constructs subtitle" names="examples of syntax constructs subtitle"> + <subtitle ids="examples-of-syntax-constructs subtitle" names="examples\ of\ syntax\ constructs subtitle"> Examples of Syntax Constructs <decoration> <header> @@ -85,7 +85,7 @@ bibliographic fields (which also require a transform): <meta content="reStructuredText, test, parser" name="keywords"> <meta content="A test document, containing at least one example of each reStructuredText construct." lang="en" name="description"> - <topic classes="contents" ids="table-of-contents" names="table of contents"> + <topic classes="contents" ids="table-of-contents" names="table\ of\ contents"> <title> Table of Contents <bullet_list classes="auto-toc"> @@ -316,21 +316,21 @@ <generated classes="sectnum"> 3    Error Handling - <section ids="structural-elements" names="structural elements"> + <section ids="structural-elements" names="structural\ elements"> <title auto="1" refid="id25"> <generated classes="sectnum"> 1    Structural Elements - <section ids="section-title" names="section title"> + <section ids="section-title" names="section\ title"> <title auto="1" refid="id26"> <generated classes="sectnum"> 1.1    Section Title - <subtitle ids="section-subtitle" names="section subtitle"> + <subtitle ids="section-subtitle" names="section\ subtitle"> Section Subtitle <paragraph> That's it, the text just above this line. - <section ids="empty-section" names="empty section"> + <section ids="empty-section" names="empty\ section"> <title auto="1" refid="id27"> <generated classes="sectnum"> 1.2    @@ -346,7 +346,7 @@ <paragraph> It divides the section. Transitions may also occur between sections: <transition> - <section ids="body-elements" names="body elements"> + <section ids="body-elements" names="body\ elements"> <title auto="1" refid="id29"> <generated classes="sectnum"> 2    @@ -358,7 +358,7 @@ Paragraphs <paragraph> A paragraph. - <section ids="inline-markup" names="inline markup"> + <section ids="inline-markup" names="inline\ markup"> <title auto="1" refid="id31"> <generated classes="sectnum"> 2.1.1    @@ -412,7 +412,7 @@ ), substitution references ( <image alt="EXAMPLE" uri="../../../docs/user/rst/images/biohazard.png"> ), and - <target ids="inline-hyperlink-targets" names="inline hyperlink targets"> + <target ids="inline-hyperlink-targets" names="inline\ hyperlink\ targets"> inline hyperlink targets (see @@ -483,7 +483,7 @@ --pep-references option was supplied, there should be a live link to PEP 258 here. - <section ids="bullet-lists" names="bullet lists"> + <section ids="bullet-lists" names="bullet\ lists"> <title auto="1" refid="id32"> <generated classes="sectnum"> 2.2    @@ -527,7 +527,7 @@ <target ids="target" names="target"> <comment xml:space="preserve"> Even if this item contains a target and a comment. - <section ids="enumerated-lists" names="enumerated lists"> + <section ids="enumerated-lists" names="enumerated\ lists"> <title auto="1" refid="id33"> <generated classes="sectnum"> 2.3    @@ -576,7 +576,7 @@ <list_item> <paragraph> iv - <section ids="definition-lists" names="definition lists"> + <section ids="definition-lists" names="definition\ lists"> <title auto="1" refid="id34"> <generated classes="sectnum"> 2.4    @@ -614,7 +614,7 @@ <definition> <paragraph> Definition - <section ids="field-lists" names="field lists"> + <section ids="field-lists" names="field\ lists"> <title auto="1" refid="id35"> <generated classes="sectnum"> 2.5    @@ -648,7 +648,7 @@ class set. (This is actually not about credits but just for ensuring that the class attribute doesn't get stripped away.) - <section ids="option-lists" names="option lists"> + <section ids="option-lists" names="option\ lists"> <title auto="1" refid="id36"> <generated classes="sectnum"> 2.6    @@ -761,7 +761,7 @@ <paragraph> There must be at least two spaces between the option and the description. - <section ids="literal-blocks" names="literal blocks"> + <section ids="literal-blocks" names="literal\ blocks"> <title auto="1" refid="id37"> <generated classes="sectnum"> 2.7    @@ -783,7 +783,7 @@ >> Great idea! > > Why didn't I think of that? - <section ids="line-blocks" names="line blocks"> + <section ids="line-blocks" names="line\ blocks"> <title auto="1" refid="id38"> <generated classes="sectnum"> 2.8    @@ -861,7 +861,7 @@ <line> <line> Singing... - <section ids="block-quotes" names="block quotes"> + <section ids="block-quotes" names="block\ quotes"> <title auto="1" refid="id39"> <generated classes="sectnum"> 2.9    @@ -877,7 +877,7 @@ own it, and what it is too. <attribution> Anne Elk (Miss) - <section ids="doctest-blocks" names="doctest blocks"> + <section ids="doctest-blocks" names="doctest\ blocks"> <title auto="1" refid="id40"> <generated classes="sectnum"> 2.10    @@ -972,7 +972,7 @@ citation. <target refid="another-target"> - <section ids="targets another-target" names="targets another target"> + <section ids="targets another-target" names="targets another\ target"> <title auto="1" refid="id43"> <generated classes="sectnum"> 2.13    @@ -1022,7 +1022,7 @@ `hyperlink reference without a target`_ , which generates an error. - <section dupnames="duplicate target names" ids="duplicate-target-names"> + <section dupnames="duplicate\ target\ names" ids="duplicate-target-names"> <title auto="1" refid="id44"> <generated classes="sectnum"> 2.13.1    @@ -1031,7 +1031,7 @@ Duplicate names in section headers or other implicit targets will generate "info" (level-1) system messages. Duplicate names in explicit targets will generate "warning" (level-2) system messages. - <section dupnames="duplicate target names" ids="id18"> + <section dupnames="duplicate\ target\ names" ids="id18"> <title auto="1" refid="id45"> <generated classes="sectnum"> 2.13.2    @@ -1098,7 +1098,7 @@ <reference refuri="http://docutils.sourceforge.net/docs/ref/rst/directives.html"> http://docutils.sourceforge.net/docs/ref/rst/directives.html . - <section ids="document-parts" names="document parts"> + <section ids="document-parts" names="document\ parts"> <title auto="1" refid="id62"> <generated classes="sectnum"> 2.14.1    @@ -1127,7 +1127,7 @@ <target refid="image-target-1"> <target refid="image-target-2"> <target refid="image-target-3"> - <image ids="image-target-3 image-target-2 image-target-1" names="image target 3 image target 2 image target 1" uri="../../../docs/user/rst/images/title.png"> + <image ids="image-target-3 image-target-2 image-target-1" names="image\ target\ 3 image\ target\ 2 image\ target\ 1" uri="../../../docs/user/rst/images/title.png"> <paragraph> A figure directive: <figure align="right" classes="figclass1 figclass2"> @@ -1255,7 +1255,7 @@ <paragraph> You can make up your own admonition too. <target ids="docutils" names="docutils" refuri="http://docutils.sourceforge.net/"> - <section ids="topics-sidebars-and-rubrics" names="topics, sidebars, and rubrics"> + <section ids="topics-sidebars-and-rubrics" names="topics,\ sidebars,\ and\ rubrics"> <title auto="1" refid="id65"> <generated classes="sectnum"> 2.14.4    @@ -1280,18 +1280,18 @@ This is a topic. <rubric> This is a rubric - <section ids="target-footnotes" names="target footnotes"> + <section ids="target-footnotes" names="target\ footnotes"> <title auto="1" refid="id66"> <generated classes="sectnum"> 2.14.5    Target Footnotes - <footnote auto="1" backrefs="id22 id23 id24" ids="id21" names="TARGET_NOTE: id21"> + <footnote auto="1" backrefs="id22 id23 id24" ids="id21" names="TARGET_NOTE:\ id21"> <label> 5 <paragraph> <reference refuri="http://www.python.org/"> http://www.python.org/ - <section ids="replacement-text" names="replacement text"> + <section ids="replacement-text" names="replacement\ text"> <title auto="1" refid="id67"> <generated classes="sectnum"> 2.14.6    @@ -1312,7 +1312,7 @@ <emphasis> the best language around - <section ids="compound-paragraph" names="compound paragraph"> + <section ids="compound-paragraph" names="compound\ paragraph"> <title auto="1" refid="id68"> <generated classes="sectnum"> 2.14.7    @@ -1398,7 +1398,7 @@ Compound 7, a paragraph after the table. <paragraph> Compound 7, another paragraph. - <section ids="substitution-definitions" names="substitution definitions"> + <section ids="substitution-definitions" names="substitution\ definitions"> <title auto="1" refid="id54"> <generated classes="sectnum"> 2.15    @@ -1426,7 +1426,7 @@ Double-dashes -- "--" -- must be escaped somehow in HTML output. <paragraph> (View the HTML source to see the comment.) - <section ids="raw-text" names="raw text"> + <section ids="raw-text" names="raw\ text"> <title auto="1" refid="id56"> <generated classes="sectnum"> 2.17    @@ -1450,7 +1450,7 @@ Fifth test in HTML.<br />Line two. <raw format="latex" xml:space="preserve"> Fifth test in LaTeX.\\Line two. - <section ids="colspanning-tables" names="colspanning tables"> + <section ids="colspanning-tables" names="colspanning\ tables"> <title auto="1" refid="id57"> <generated classes="sectnum"> 2.18    @@ -1521,7 +1521,7 @@ <entry> <paragraph> True - <section ids="rowspanning-tables" names="rowspanning tables"> + <section ids="rowspanning-tables" names="rowspanning\ tables"> <title auto="1" refid="id58"> <generated classes="sectnum"> 2.19    @@ -1573,7 +1573,7 @@ <entry> <paragraph> body row 3 - <section ids="complex-tables" names="complex tables"> + <section ids="complex-tables" names="complex\ tables"> <title auto="1" refid="id59"> <generated classes="sectnum"> 2.20    @@ -1658,7 +1658,7 @@ <literal> --> <entry> - <section ids="list-tables" names="list tables"> + <section ids="list-tables" names="list\ tables"> <title auto="1" refid="id60"> <generated classes="sectnum"> 2.21    @@ -1715,7 +1715,7 @@ <entry> <paragraph> On a stick! - <section ids="error-handling" names="error handling"> + <section ids="error-handling" names="error\ handling"> <title auto="1" refid="id61"> <generated classes="sectnum"> 3    diff --git a/test/test_parsers/test_rst/test_directives/test_contents.py b/test/test_parsers/test_rst/test_directives/test_contents.py index 6d6d0f3e2..cb7bbec0f 100755 --- a/test/test_parsers/test_rst/test_directives/test_contents.py +++ b/test/test_parsers/test_rst/test_directives/test_contents.py @@ -38,7 +38,7 @@ totest['contents'] = [ """, """\ <document source="test data"> - <topic classes="contents" ids="table-of-contents" names="table of contents"> + <topic classes="contents" ids="table-of-contents" names="table\ of\ contents"> <title> Table of Contents <pending> @@ -52,7 +52,7 @@ totest['contents'] = [ """, """\ <document source="test data"> - <topic classes="contents" ids="table-of-contents" names="table of contents"> + <topic classes="contents" ids="table-of-contents" names="table\ of\ contents"> <title> Table of Contents <pending> @@ -67,7 +67,7 @@ totest['contents'] = [ """, """\ <document source="test data"> - <topic classes="contents" ids="table-of-contents" names="table of contents"> + <topic classes="contents" ids="table-of-contents" names="table\ of\ contents"> <title> Table of @@ -82,7 +82,7 @@ totest['contents'] = [ """, """\ <document source="test data"> - <topic classes="contents" ids="table-of-contents" names="table of contents"> + <topic classes="contents" ids="table-of-contents" names="table\ of\ contents"> <title> <emphasis> Table @@ -132,7 +132,7 @@ totest['contents'] = [ """, """\ <document source="test data"> - <topic classes="contents local" ids="table-of-contents" names="table of contents"> + <topic classes="contents local" ids="table-of-contents" names="table\ of\ contents"> <title> Table of Contents <pending> diff --git a/test/test_parsers/test_rst/test_directives/test_include.py b/test/test_parsers/test_rst/test_directives/test_include.py index cf6ada106..f6009b96b 100755 --- a/test/test_parsers/test_rst/test_directives/test_include.py +++ b/test/test_parsers/test_rst/test_directives/test_include.py @@ -51,10 +51,10 @@ A paragraph. """ % include1, """\ <document source="test data"> - <section ids="include-test" names="include test"> + <section ids="include-test" names="include\ test"> <title> Include Test - <section ids="inclusion-1" names="inclusion 1"> + <section ids="inclusion-1" names="inclusion\ 1"> <title> Inclusion 1 <paragraph> @@ -76,7 +76,7 @@ A paragraph. """ % include1, """\ <document source="test data"> - <section ids="include-test" names="include test"> + <section ids="include-test" names="include\ test"> <title> Include Test <literal_block source="%s" xml:space="preserve"> @@ -124,7 +124,7 @@ A paragraph. """, """\ <document source="test data"> - <section ids="include-test" names="include test"> + <section ids="include-test" names="include\ test"> <title> Include Test <system_message level="4" line="4" source="test data" type="SEVERE"> @@ -148,10 +148,10 @@ A paragraph. """ % (include1, include1), """\ <document source="test data"> - <section ids="include-test" names="include test"> + <section ids="include-test" names="include\ test"> <title> Include Test - <section dupnames="inclusion 1" ids="inclusion-1"> + <section dupnames="inclusion\ 1" ids="inclusion-1"> <title> Inclusion 1 <paragraph> @@ -159,7 +159,7 @@ A paragraph. <literal> test_include.py . - <section dupnames="inclusion 1" ids="id1"> + <section dupnames="inclusion\ 1" ids="id1"> <title> Inclusion 1 <system_message backrefs="id1" level="1" line="2" source="%s" type="INFO"> @@ -187,10 +187,10 @@ A paragraph. """ % (include1, include1), """\ <document source="test data"> - <section ids="include-test" names="include test"> + <section ids="include-test" names="include\ test"> <title> Include Test - <section dupnames="inclusion 1" ids="inclusion-1"> + <section dupnames="inclusion\ 1" ids="inclusion-1"> <title> Inclusion 1 <paragraph> @@ -199,7 +199,7 @@ A paragraph. test_include.py . <transition> - <section dupnames="inclusion 1" ids="id1"> + <section dupnames="inclusion\ 1" ids="id1"> <title> Inclusion 1 <system_message backrefs="id1" level="1" line="2" source="%s" type="INFO"> diff --git a/test/test_parsers/test_rst/test_directives/test_unicode.py b/test/test_parsers/test_rst/test_directives/test_unicode.py index 526182a62..bd028cf42 100755 --- a/test/test_parsers/test_rst/test_directives/test_unicode.py +++ b/test/test_parsers/test_rst/test_directives/test_unicode.py @@ -92,9 +92,9 @@ Bad input: Substitution definition "empty too" empty or invalid. <literal_block xml:space="preserve"> .. |empty too| unicode:: .. comment doesn't count as content - <substitution_definition names="not hex"> + <substitution_definition names="not\ hex"> 0xHEX - <substitution_definition names="not all hex"> + <substitution_definition names="not\ all\ hex"> UABCX <system_message level="3" line="8" source="test data" type="ERROR"> <paragraph> @@ -125,7 +125,7 @@ u"""\ . <substitution_definition names="copy"> \u00A9 - <substitution_definition names="BogusMegaCorp (TM)"> + <substitution_definition names="BogusMegaCorp\ (TM)"> BogusMegaCorp \u2122 """], diff --git a/test/test_parsers/test_rst/test_inline_markup.py b/test/test_parsers/test_rst/test_inline_markup.py index 598902370..7185d723d 100755 --- a/test/test_parsers/test_rst/test_inline_markup.py +++ b/test/test_parsers/test_rst/test_inline_markup.py @@ -432,7 +432,7 @@ totest['embedded_URIs'] = [ <paragraph> <reference name="phrase reference" refuri="http://example.com"> phrase reference - <target ids="phrase-reference" names="phrase reference" refuri="http://example.com"> + <target ids="phrase-reference" names="phrase\ reference" refuri="http://example.com"> """], ["""\ `anonymous reference <http://example.com>`__ @@ -560,15 +560,15 @@ _`Here is a TaRgeT` with case and spacial difficulties. target <paragraph> Here is \n\ - <target ids="another-target" names="another target"> + <target ids="another-target" names="another\ target"> another target in some text. And \n\ - <target ids="yet-another-target" names="yet another target"> + <target ids="yet-another-target" names="yet\ another\ target"> yet another target , spanning lines. <paragraph> - <target ids="here-is-a-target" names="here is a target"> + <target ids="here-is-a-target" names="here\ is\ a\ target"> Here is a TaRgeT with case and spacial difficulties. """], diff --git a/test/test_parsers/test_rst/test_section_headers.py b/test/test_parsers/test_rst/test_section_headers.py index e1557fcb9..3c5a21170 100755 --- a/test/test_parsers/test_rst/test_section_headers.py +++ b/test/test_parsers/test_rst/test_section_headers.py @@ -205,7 +205,7 @@ Test long title and space normalization. """, """\ <document source="test data"> - <section ids="long-title" names="long title"> + <section ids="long-title" names="long\ title"> <title> Long Title <system_message level="2" line="1" source="test data" type="WARNING"> @@ -306,22 +306,22 @@ Paragraph 4. <document source="test data"> <comment xml:space="preserve"> Test return to existing, highest-level section (Title 3). - <section ids="title-1" names="title 1"> + <section ids="title-1" names="title\ 1"> <title> Title 1 <paragraph> Paragraph 1. - <section ids="title-2" names="title 2"> + <section ids="title-2" names="title\ 2"> <title> Title 2 <paragraph> Paragraph 2. - <section ids="title-3" names="title 3"> + <section ids="title-3" names="title\ 3"> <title> Title 3 <paragraph> Paragraph 3. - <section ids="title-4" names="title 4"> + <section ids="title-4" names="title\ 4"> <title> Title 4 <paragraph> @@ -354,22 +354,22 @@ Paragraph 4. <document source="test data"> <paragraph> Test return to existing, highest-level section (Title 3, with overlines). - <section ids="title-1" names="title 1"> + <section ids="title-1" names="title\ 1"> <title> Title 1 <paragraph> Paragraph 1. - <section ids="title-2" names="title 2"> + <section ids="title-2" names="title\ 2"> <title> Title 2 <paragraph> Paragraph 2. - <section ids="title-3" names="title 3"> + <section ids="title-3" names="title\ 3"> <title> Title 3 <paragraph> Paragraph 3. - <section ids="title-4" names="title 4"> + <section ids="title-4" names="title\ 4"> <title> Title 4 <paragraph> @@ -398,22 +398,22 @@ Paragraph 4. <document source="test data"> <paragraph> Test return to existing, higher-level section (Title 4). - <section ids="title-1" names="title 1"> + <section ids="title-1" names="title\ 1"> <title> Title 1 <paragraph> Paragraph 1. - <section ids="title-2" names="title 2"> + <section ids="title-2" names="title\ 2"> <title> Title 2 <paragraph> Paragraph 2. - <section ids="title-3" names="title 3"> + <section ids="title-3" names="title\ 3"> <title> Title 3 <paragraph> Paragraph 3. - <section ids="title-4" names="title 4"> + <section ids="title-4" names="title\ 4"> <title> Title 4 <paragraph> @@ -442,17 +442,17 @@ Paragraph 4. <document source="test data"> <paragraph> Test bad subsection order (Title 4). - <section ids="title-1" names="title 1"> + <section ids="title-1" names="title\ 1"> <title> Title 1 <paragraph> Paragraph 1. - <section ids="title-2" names="title 2"> + <section ids="title-2" names="title\ 2"> <title> Title 2 <paragraph> Paragraph 2. - <section ids="title-3" names="title 3"> + <section ids="title-3" names="title\ 3"> <title> Title 3 <paragraph> @@ -493,17 +493,17 @@ Paragraph 4. <document source="test data"> <paragraph> Test bad subsection order (Title 4, with overlines). - <section ids="title-1" names="title 1"> + <section ids="title-1" names="title\ 1"> <title> Title 1 <paragraph> Paragraph 1. - <section ids="title-2" names="title 2"> + <section ids="title-2" names="title\ 2"> <title> Title 2 <paragraph> Paragraph 2. - <section ids="title-3" names="title 3"> + <section ids="title-3" names="title\ 3"> <title> Title 3 <paragraph> @@ -526,7 +526,7 @@ Paragraph. """, """\ <document source="test data"> - <section ids="title-containing-inline-markup" names="title containing inline markup"> + <section ids="title-containing-inline-markup" names="title\ containing\ inline\ markup"> <title> Title containing \n\ <emphasis> @@ -545,7 +545,7 @@ Paragraph. """, """\ <document source="test data"> - <section ids="numbered-title" names="1. numbered title"> + <section ids="numbered-title" names="1.\ numbered\ title"> <title> 1. Numbered Title <paragraph> @@ -571,7 +571,7 @@ Paragraph. <system_message level="2" line="3" source="test data" type="WARNING"> <paragraph> Enumerated list ends without a blank line; unexpected unindent. - <section ids="numbered-title" names="3. numbered title"> + <section ids="numbered-title" names="3.\ numbered\ title"> <title> 3. Numbered Title <paragraph> @@ -850,7 +850,7 @@ Empty Section """, """\ <document source="test data"> - <section ids="empty-section" names="empty section"> + <section ids="empty-section" names="empty\ section"> <title> Empty Section """], diff --git a/test/test_parsers/test_rst/test_substitutions.py b/test/test_parsers/test_rst/test_substitutions.py index d2a5207c9..f949ce187 100755 --- a/test/test_parsers/test_rst/test_substitutions.py +++ b/test/test_parsers/test_rst/test_substitutions.py @@ -71,11 +71,11 @@ Here's a series of substitution definitions: <document source="test data"> <paragraph> Here's a series of substitution definitions: - <substitution_definition names="symbol 1"> + <substitution_definition names="symbol\ 1"> <image alt="symbol 1" uri="symbol1.png"> - <substitution_definition names="SYMBOL 2"> + <substitution_definition names="SYMBOL\ 2"> <image alt="SYMBOL 2" height="50" uri="symbol2.png" width="100"> - <substitution_definition names="symbol 3"> + <substitution_definition names="symbol\ 3"> <image alt="symbol 3" uri="symbol3.png"> """], ["""\ @@ -84,7 +84,7 @@ Here's a series of substitution definitions: """, """\ <document source="test data"> - <substitution_definition names="very long substitution text, split across lines"> + <substitution_definition names="very\ long\ substitution\ text,\ split\ across\ lines"> <image alt="very long substitution text, split across lines" uri="symbol.png"> """], ["""\ @@ -123,11 +123,11 @@ Followed by a paragraph. """, """\ <document source="test data"> - <substitution_definition names="symbol 1"> + <substitution_definition names="symbol\ 1"> <image alt="symbol 1" uri="symbol.png"> <paragraph> Followed by a paragraph. - <substitution_definition names="symbol 2"> + <substitution_definition names="symbol\ 2"> <image alt="symbol 2" uri="symbol.png"> <comment xml:space="preserve"> <block_quote> diff --git a/test/test_parsers/test_rst/test_targets.py b/test/test_parsers/test_rst/test_targets.py index ef7f8ec76..362bf2cca 100755 --- a/test/test_parsers/test_rst/test_targets.py +++ b/test/test_parsers/test_rst/test_targets.py @@ -36,7 +36,7 @@ totest['targets'] = [ """, """\ <document source="test data"> - <target ids="optional-space-before-colon" names="optional space before colon"> + <target ids="optional-space-before-colon" names="optional\ space\ before\ colon"> """], ["""\ External hyperlink targets: @@ -85,9 +85,9 @@ Indirect hyperlink targets: """, """\ <document source="test data"> - <target ids="a-long-target-name" names="a long target name"> - <target ids="a-target-name-including-a-colon-quoted" names="a target name: including a colon (quoted)"> - <target ids="a-target-name-including-a-colon-escaped" names="a target name: including a colon (escaped)"> + <target ids="a-long-target-name" names="a\ long\ target\ name"> + <target ids="a-target-name-including-a-colon-quoted" names="a\ target\ name:\ including\ a\ colon\ (quoted)"> + <target ids="a-target-name-including-a-colon-escaped" names="a\ target\ name:\ including\ a\ colon\ (escaped)"> """], ["""\ .. _a very long target name, @@ -97,8 +97,8 @@ Indirect hyperlink targets: """, """\ <document source="test data"> - <target ids="a-very-long-target-name-split-across-lines" names="a very long target name, split across lines"> - <target ids="and-another-with-backquotes" names="and another, with backquotes"> + <target ids="a-very-long-target-name-split-across-lines" names="a\ very\ long\ target\ name,\ split\ across\ lines"> + <target ids="and-another-with-backquotes" names="and\ another,\ with\ backquotes"> """], ["""\ External hyperlink: @@ -120,7 +120,7 @@ External hyperlink: """\ <document source="test data"> <target ids="email" names="email" refuri="mailto:jdoe@example.com"> - <target ids="multi-line-email" names="multi-line email" refuri="mailto:jdoe@example.com"> + <target ids="multi-line-email" names="multi-line\ email" refuri="mailto:jdoe@example.com"> """], ["""\ Duplicate external targets (different URIs): @@ -319,8 +319,8 @@ Explicit internal target. <system_message level="2" line="3" source="test data" type="WARNING"> <paragraph> malformed hyperlink target. - <target ids="escaped-colon" names="escaped colon:" refuri="OK"> - <target ids="unescaped-colon-quoted" names="unescaped colon, quoted:" refuri="OK"> + <target ids="escaped-colon" names="escaped\ colon:" refuri="OK"> + <target ids="unescaped-colon-quoted" names="unescaped\ colon,\ quoted:" refuri="OK"> """], ] diff --git a/test/test_parsers/test_rst/test_transitions.py b/test/test_parsers/test_rst/test_transitions.py index 8b143832c..c60a28e96 100755 --- a/test/test_parsers/test_rst/test_transitions.py +++ b/test/test_parsers/test_rst/test_transitions.py @@ -52,7 +52,7 @@ Paragraph 2 in section 2. """, """\ <document source="test data"> - <section ids="section-1" names="section 1"> + <section ids="section-1" names="section\ 1"> <title> Section 1 <paragraph> @@ -60,7 +60,7 @@ Paragraph 2 in section 2. <transition> <paragraph> Second text division of section 1. - <section ids="section-2" names="section 2"> + <section ids="section-2" names="section\ 2"> <title> Section 2 <paragraph> @@ -162,14 +162,14 @@ Section 2 <document source="test data"> <paragraph> Sections with transitions at beginning and end. - <section ids="section-1" names="section 1"> + <section ids="section-1" names="section\ 1"> <title> Section 1 <transition> <paragraph> The next transition is legal: <transition> - <section ids="section-2" names="section 2"> + <section ids="section-2" names="section\ 2"> <title> Section 2 <transition> @@ -232,16 +232,16 @@ Some text. """, """\ <document source="test data"> - <section ids="section-1" names="section 1"> + <section ids="section-1" names="section\ 1"> <title> Section 1 - <section ids="subsection-1" names="subsection 1"> + <section ids="subsection-1" names="subsection\ 1"> <title> Subsection 1 <paragraph> Some text. <transition> - <section ids="section-2" names="section 2"> + <section ids="section-2" names="section\ 2"> <title> Section 2 <paragraph> @@ -264,13 +264,13 @@ Some text. """, """\ <document source="test data"> - <section ids="section-1" names="section 1"> + <section ids="section-1" names="section\ 1"> <title> Section 1 <transition> <transition> <transition> - <section ids="section-2" names="section 2"> + <section ids="section-2" names="section\ 2"> <title> Section 2 <paragraph> diff --git a/test/test_publisher.py b/test/test_publisher.py index f395eb419..545822bc6 100755 --- a/test/test_publisher.py +++ b/test/test_publisher.py @@ -26,7 +26,7 @@ Test Document This is a test document with a broken reference: nonexistent_ """ pseudoxml_output = """\ -<document ids="test-document" names="test document" source="<string>" title="Test Document"> +<document ids="test-document" names="test\ document" source="<string>" title="Test Document"> <title> Test Document <paragraph> @@ -41,7 +41,7 @@ pseudoxml_output = """\ Unknown target name: "nonexistent". """ exposed_pseudoxml_output = """\ -<document ids="test-document" internal:refnames="{u\'nonexistent\': [<reference: <#text: u\'nonexistent\'>>]}" names="test document" source="<string>" title="Test Document"> +<document ids="test-document" internal:refnames="{u\'nonexistent\': [<reference: <#text: u\'nonexistent\'>>]}" names="test\ document" source="<string>" title="Test Document"> <title> Test Document <paragraph> diff --git a/test/test_transforms/test_class.py b/test/test_transforms/test_class.py index 601272135..4cd874ea3 100755 --- a/test/test_transforms/test_class.py +++ b/test/test_transforms/test_class.py @@ -71,7 +71,7 @@ Paragraph """, """\ <document source="test data"> - <section classes="four" ids="section-title" names="section title"> + <section classes="four" ids="section-title" names="section\ title"> <title> Section Title <paragraph> diff --git a/test/test_transforms/test_contents.py b/test/test_transforms/test_contents.py index c96764343..19705b5ba 100755 --- a/test/test_transforms/test_contents.py +++ b/test/test_transforms/test_contents.py @@ -70,26 +70,26 @@ Paragraph 4. <paragraph> <reference ids="id4" refid="title-4"> Title 4 - <section ids="title-1" names="title 1"> + <section ids="title-1" names="title\ 1"> <title refid="id1"> Title 1 <paragraph> Paragraph 1. - <section ids="title-2" names="title 2"> + <section ids="title-2" names="title\ 2"> <title> <reference name="Title" refname="title"> Title 2 <paragraph> Paragraph 2. - <section ids="title-3" names="title 3"> + <section ids="title-3" names="title\ 3"> <title refid="id3"> <target ids="title" names="title"> Title 3 <paragraph> Paragraph 3. - <section ids="title-4" names="title 4"> + <section ids="title-4" names="title\ 4"> <title refid="id4"> Title 4 <paragraph> @@ -108,7 +108,7 @@ Paragraph 2. """, """\ <document source="test data"> - <topic classes="contents" ids="table-of-contents" names="table of contents"> + <topic classes="contents" ids="table-of-contents" names="table\ of\ contents"> <title> Table of Contents <bullet_list> @@ -121,12 +121,12 @@ Paragraph 2. <paragraph> <reference ids="id2" refid="title-2"> Title 2 - <section ids="title-1" names="title 1"> + <section ids="title-1" names="title\ 1"> <title refid="id1"> Title 1 <paragraph> Paragraph 1. - <section ids="title-2" names="title 2"> + <section ids="title-2" names="title\ 2"> <title refid="id2"> Title 2 <paragraph> @@ -147,7 +147,7 @@ Paragraph 2. """, """\ <document source="test data"> - <topic classes="contents" ids="there-s-an-image-in-title-2" names="there's an image in title 2"> + <topic classes="contents" ids="there-s-an-image-in-title-2" names="there's\ an\ image\ in\ title\ 2"> <title> There's an image in Title 2 <bullet_list> @@ -159,17 +159,17 @@ Paragraph 2. <paragraph> <reference ids="id2" refid="title-2"> Title 2 - <section ids="title-1" names="title 1"> + <section ids="title-1" names="title\ 1"> <title refid="id1"> Title 1 <paragraph> Paragraph 1. - <section ids="title-2" names="title 2"> + <section ids="title-2" names="title\ 2"> <title refid="id2"> <image alt="Title 2" uri="title2.png"> <paragraph> Paragraph 2. - <substitution_definition names="Title 2"> + <substitution_definition names="Title\ 2"> <image alt="Title 2" uri="title2.png"> """], # emacs cruft: " ["""\ @@ -211,22 +211,22 @@ Paragraph 4. <paragraph> <reference ids="id3" refid="title-4"> Title 4 - <section ids="title-1" names="title 1"> + <section ids="title-1" names="title\ 1"> <title refid="id1"> Title 1 <paragraph> Paragraph 1. - <section ids="title-2" names="title 2"> + <section ids="title-2" names="title\ 2"> <title refid="id2"> Title 2 <paragraph> Paragraph 2. - <section ids="title-3" names="title 3"> + <section ids="title-3" names="title\ 3"> <title> Title 3 <paragraph> Paragraph 3. - <section ids="title-4" names="title 4"> + <section ids="title-4" names="title\ 4"> <title refid="id3"> Title 4 <paragraph> @@ -255,7 +255,7 @@ Paragraph 4. """, """\ <document source="test data"> - <section ids="title-1" names="title 1"> + <section ids="title-1" names="title\ 1"> <title> Title 1 <topic classes="contents local" ids="contents" names="contents"> @@ -275,17 +275,17 @@ Paragraph 4. Title 4 <paragraph> Paragraph 1. - <section ids="title-2" names="title 2"> + <section ids="title-2" names="title\ 2"> <title refid="id1"> Title 2 <paragraph> Paragraph 2. - <section ids="title-3" names="title 3"> + <section ids="title-3" names="title\ 3"> <title refid="id2"> Title 3 <paragraph> Paragraph 3. - <section ids="title-4" names="title 4"> + <section ids="title-4" names="title\ 4"> <title refid="id3"> Title 4 <paragraph> @@ -396,7 +396,7 @@ Paragraph 3. """, """\ <document source="test data"> - <section ids="title-1" names="title 1"> + <section ids="title-1" names="title\ 1"> <title> Title 1 <paragraph> @@ -415,12 +415,12 @@ Paragraph 3. <paragraph> <reference ids="id2" refid="title-3"> Title 3 - <section ids="title-2" names="title 2"> + <section ids="title-2" names="title\ 2"> <title refid="id1"> Title 2 <paragraph> Paragraph 2. - <section ids="title-3" names="title 3"> + <section ids="title-3" names="title\ 3"> <title refid="id2"> Title 3 <paragraph> diff --git a/test/test_transforms/test_doctitle.py b/test/test_transforms/test_doctitle.py index 22629c45a..3000f53a5 100755 --- a/test/test_transforms/test_doctitle.py +++ b/test/test_transforms/test_doctitle.py @@ -120,7 +120,7 @@ The system_message should move after the document title (it was before the beginning of the section). """, """\ -<document ids="long-title" names="long title" source="test data" title="Long Title"> +<document ids="long-title" names="long\ title" source="test data" title="Long Title"> <title> Long Title <system_message level="2" line="1" source="test data" type="WARNING"> @@ -151,19 +151,19 @@ Title 3 Paragraph 3. """, """\ -<document ids="title-1" names="title 1" source="test data" title="Title 1"> +<document ids="title-1" names="title\ 1" source="test data" title="Title 1"> <title> Title 1 <comment xml:space="preserve"> Test multiple second-level titles. <paragraph> Paragraph 1. - <section ids="title-2" names="title 2"> + <section ids="title-2" names="title\ 2"> <title> Title 2 <paragraph> Paragraph 2. - <section ids="title-3" names="title 3"> + <section ids="title-3" names="title\ 3"> <title> Title 3 <paragraph> @@ -185,7 +185,7 @@ substitution_definition. Title <substitution_definition names="foo"> bar - <target ids="invisible-target" names="invisible target"> + <target ids="invisible-target" names="invisible\ target"> <paragraph> This title should be the document title despite the substitution_definition. @@ -212,15 +212,15 @@ Another Subtitle <document source="test data"> <paragraph> (Because of this paragraph, the following is not a doc title.) - <section ids="section-title" names="section title"> + <section ids="section-title" names="section\ title"> <title> Section Title <subtitle ids="subtitle" names="subtitle"> Subtitle - <section ids="another-section" names="another section"> + <section ids="another-section" names="another\ section"> <title> Another Section - <subtitle ids="another-subtitle" names="another subtitle"> + <subtitle ids="another-subtitle" names="another\ subtitle"> Another Subtitle """], ]) diff --git a/test/test_transforms/test_hyperlinks.py b/test/test_transforms/test_hyperlinks.py index d060043cd..1b84a18c4 100755 --- a/test/test_transforms/test_hyperlinks.py +++ b/test/test_transforms/test_hyperlinks.py @@ -291,7 +291,7 @@ Another reference to the same `embedded URI`_. An \n\ <reference name="embedded uri" refuri="http://direct"> embedded uri - <target ids="embedded-uri" names="embedded uri" refuri="http://direct"> + <target ids="embedded-uri" names="embedded\ uri" refuri="http://direct"> . <paragraph> Another reference to the same \n\ @@ -357,7 +357,7 @@ By this `internal hyperlink`_ reference. """\ <document source="test data"> <target refid="internal-hyperlink"> - <paragraph ids="internal-hyperlink" names="internal hyperlink"> + <paragraph ids="internal-hyperlink" names="internal\ hyperlink"> This paragraph referenced. <paragraph> By this \n\ @@ -380,7 +380,7 @@ The results of the transform are not visible at the XML level. <document source="test data"> <target refid="chained"> <target refid="internal-hyperlink"> - <paragraph ids="internal-hyperlink chained" names="internal hyperlink chained"> + <paragraph ids="internal-hyperlink chained" names="internal\ hyperlink chained"> This paragraph referenced. <paragraph> By this \n\ @@ -488,7 +488,7 @@ a_\ b_ """, """\ <document source="test data"> - <target ids="external-hyperlink" names="external hyperlink" refuri="http://uri"> + <target ids="external-hyperlink" names="external\ hyperlink" refuri="http://uri"> <paragraph> <reference name="External hyperlink" refuri="http://uri"> External hyperlink @@ -500,8 +500,8 @@ a_\ b_ """, """\ <document source="test data"> - <target ids="external-hyperlink" names="external hyperlink" refuri="http://uri"> - <target ids="indirect-target" names="indirect target" refuri="http://uri"> + <target ids="external-hyperlink" names="external\ hyperlink" refuri="http://uri"> + <target ids="indirect-target" names="indirect\ target" refuri="http://uri"> <system_message level="1" line="2" source="test data" type="INFO"> <paragraph> Hyperlink target "indirect target" is not referenced. @@ -516,7 +516,7 @@ and a chained_ reference too. """\ <document source="test data"> <target refid="chained"> - <target ids="external-hyperlink chained" names="external hyperlink chained" refuri="http://uri"> + <target ids="external-hyperlink chained" names="external\ hyperlink chained" refuri="http://uri"> <paragraph> <reference name="External hyperlink" refuri="http://uri"> External hyperlink @@ -534,8 +534,8 @@ and a chained_ reference too. """, """\ <document source="test data"> - <target ids="external-hyperlink" names="external hyperlink" refuri="http://uri"> - <target ids="indirect-hyperlink" names="indirect hyperlink" refuri="http://uri"> + <target ids="external-hyperlink" names="external\ hyperlink" refuri="http://uri"> + <target ids="indirect-hyperlink" names="indirect\ hyperlink" refuri="http://uri"> <paragraph> <reference name="Indirect hyperlink" refuri="http://uri"> Indirect hyperlink @@ -550,9 +550,9 @@ Chained_ `indirect hyperlink`_ reference. """, """\ <document source="test data"> - <target ids="external-hyperlink" names="external hyperlink" refuri="http://uri"> + <target ids="external-hyperlink" names="external\ hyperlink" refuri="http://uri"> <target refuri="http://uri"> - <target ids="indirect-hyperlink chained" names="indirect hyperlink chained" refuri="http://uri"> + <target ids="indirect-hyperlink chained" names="indirect\ hyperlink chained" refuri="http://uri"> <paragraph> <reference name="Chained" refuri="http://uri"> Chained @@ -700,7 +700,7 @@ Testing an `indirect reference to the table of contents`_. """, """\ <document source="test data"> - <topic classes="contents" ids="table-of-contents" names="table of contents"> + <topic classes="contents" ids="table-of-contents" names="table\ of\ contents"> <title> Table of Contents <bullet_list> @@ -708,7 +708,7 @@ Testing an `indirect reference to the table of contents`_. <paragraph> <reference ids="id1" refid="section"> Section - <target ids="indirect-reference-to-the-table-of-contents" names="indirect reference to the table of contents" refid="table-of-contents"> + <target ids="indirect-reference-to-the-table-of-contents" names="indirect\ reference\ to\ the\ table\ of\ contents" refid="table-of-contents"> <section ids="section" names="section"> <title refid="id1"> Section @@ -729,7 +729,7 @@ Let's reference it (`explicit target`_) to avoid an irrelevant error. """\ <document source="test data"> <target refid="explicit-target"> - <section ids="title explicit-target" names="title explicit target"> + <section ids="title explicit-target" names="title explicit\ target"> <title> Title <paragraph> diff --git a/test/test_transforms/test_peps.py b/test/test_transforms/test_peps.py index 5ab57be50..5e34aea80 100755 --- a/test/test_transforms/test_peps.py +++ b/test/test_transforms/test_peps.py @@ -54,7 +54,7 @@ A "References" section should be generated. <section ids="id1"> <title> References - <footnote auto="1" ids="id2" names="TARGET_NOTE: id2"> + <footnote auto="1" ids="id2" names="TARGET_NOTE:\ id2"> <paragraph> <reference refuri="http://www.example.org"> http://www.example.org diff --git a/test/test_transforms/test_sectnum.py b/test/test_transforms/test_sectnum.py index 514ae419f..60237cea1 100755 --- a/test/test_transforms/test_sectnum.py +++ b/test/test_transforms/test_sectnum.py @@ -46,28 +46,28 @@ Paragraph 4. """, u"""\ <document source="test data"> - <section ids="title-1" names="title 1"> + <section ids="title-1" names="title\ 1"> <title auto="1"> <generated classes="sectnum"> 1\u00a0\u00a0\u00a0 Title 1 <paragraph> Paragraph 1. - <section ids="title-2" names="title 2"> + <section ids="title-2" names="title\ 2"> <title auto="1"> <generated classes="sectnum"> 1.1\u00a0\u00a0\u00a0 Title 2 <paragraph> Paragraph 2. - <section ids="title-3" names="title 3"> + <section ids="title-3" names="title\ 3"> <title auto="1"> <generated classes="sectnum"> 1.1.1\u00a0\u00a0\u00a0 Title 3 <paragraph> Paragraph 3. - <section ids="title-4" names="title 4"> + <section ids="title-4" names="title\ 4"> <title auto="1"> <generated classes="sectnum"> 1.2\u00a0\u00a0\u00a0 @@ -84,7 +84,7 @@ Paragraph 1. """, u"""\ <document source="test data"> - <section ids="bold-title" names="bold title"> + <section ids="bold-title" names="bold\ title"> <title auto="1"> <generated classes="sectnum"> 1\u00a0\u00a0\u00a0 @@ -114,26 +114,26 @@ Paragraph 4. """, u"""\ <document source="test data"> - <section ids="title-1" names="title 1"> + <section ids="title-1" names="title\ 1"> <title auto="1"> <generated classes="sectnum"> 1\u00a0\u00a0\u00a0 Title 1 <paragraph> Paragraph 1. - <section ids="title-2" names="title 2"> + <section ids="title-2" names="title\ 2"> <title auto="1"> <generated classes="sectnum"> 1.1\u00a0\u00a0\u00a0 Title 2 <paragraph> Paragraph 2. - <section ids="title-3" names="title 3"> + <section ids="title-3" names="title\ 3"> <title> Title 3 <paragraph> Paragraph 3. - <section ids="title-4" names="title 4"> + <section ids="title-4" names="title\ 4"> <title auto="1"> <generated classes="sectnum"> 1.2\u00a0\u00a0\u00a0 @@ -191,26 +191,26 @@ u"""\ <generated classes="sectnum"> 1.2\u00a0\u00a0\u00a0 Title 4 - <section ids="title-1" names="title 1"> + <section ids="title-1" names="title\ 1"> <title auto="1" refid="id1"> <generated classes="sectnum"> 1\u00a0\u00a0\u00a0 Title 1 <paragraph> Paragraph 1. - <section ids="title-2" names="title 2"> + <section ids="title-2" names="title\ 2"> <title auto="1" refid="id2"> <generated classes="sectnum"> 1.1\u00a0\u00a0\u00a0 Title 2 <paragraph> Paragraph 2. - <section ids="title-3" names="title 3"> + <section ids="title-3" names="title\ 3"> <title refid="id3"> Title 3 <paragraph> Paragraph 3. - <section ids="title-4" names="title 4"> + <section ids="title-4" names="title\ 4"> <title auto="1" refid="id4"> <generated classes="sectnum"> 1.2\u00a0\u00a0\u00a0 @@ -240,28 +240,28 @@ Paragraph 4. """, u"""\ <document source="test data"> - <section ids="title-1" names="title 1"> + <section ids="title-1" names="title\ 1"> <title auto="1"> <generated classes="sectnum"> Arbitrary-1\u00a0\u00a0\u00a0 Title 1 <paragraph> Paragraph 1. - <section ids="title-2" names="title 2"> + <section ids="title-2" names="title\ 2"> <title auto="1"> <generated classes="sectnum"> Arbitrary-1.1\u00a0\u00a0\u00a0 Title 2 <paragraph> Paragraph 2. - <section ids="title-3" names="title 3"> + <section ids="title-3" names="title\ 3"> <title auto="1"> <generated classes="sectnum"> Arbitrary-1.1.1\u00a0\u00a0\u00a0 Title 3 <paragraph> Paragraph 3. - <section ids="title-4" names="title 4"> + <section ids="title-4" names="title\ 4"> <title auto="1"> <generated classes="sectnum"> Arbitrary-1.2\u00a0\u00a0\u00a0 @@ -291,28 +291,28 @@ Paragraph 4. """, u"""\ <document source="test data"> - <section ids="title-1" names="title 1"> + <section ids="title-1" names="title\ 1"> <title auto="1"> <generated classes="sectnum"> 3\u00a0\u00a0\u00a0 Title 1 <paragraph> Paragraph 1. - <section ids="title-2" names="title 2"> + <section ids="title-2" names="title\ 2"> <title auto="1"> <generated classes="sectnum"> 3.1\u00a0\u00a0\u00a0 Title 2 <paragraph> Paragraph 2. - <section ids="title-3" names="title 3"> + <section ids="title-3" names="title\ 3"> <title auto="1"> <generated classes="sectnum"> 3.1.1\u00a0\u00a0\u00a0 Title 3 <paragraph> Paragraph 3. - <section ids="title-4" names="title 4"> + <section ids="title-4" names="title\ 4"> <title auto="1"> <generated classes="sectnum"> 3.2\u00a0\u00a0\u00a0 @@ -344,28 +344,28 @@ Paragraph 4. """, u"""\ <document source="test data"> - <section ids="title-1" names="title 1"> + <section ids="title-1" names="title\ 1"> <title auto="1"> <generated classes="sectnum"> (5.9.3)\u00a0\u00a0\u00a0 Title 1 <paragraph> Paragraph 1. - <section ids="title-2" names="title 2"> + <section ids="title-2" names="title\ 2"> <title auto="1"> <generated classes="sectnum"> (5.9.3.1)\u00a0\u00a0\u00a0 Title 2 <paragraph> Paragraph 2. - <section ids="title-3" names="title 3"> + <section ids="title-3" names="title\ 3"> <title auto="1"> <generated classes="sectnum"> (5.9.3.1.1)\u00a0\u00a0\u00a0 Title 3 <paragraph> Paragraph 3. - <section ids="title-4" names="title 4"> + <section ids="title-4" names="title\ 4"> <title auto="1"> <generated classes="sectnum"> (5.9.3.2)\u00a0\u00a0\u00a0 diff --git a/test/test_transforms/test_substitutions.py b/test/test_transforms/test_substitutions.py index 19534a486..723f01473 100755 --- a/test/test_transforms/test_substitutions.py +++ b/test/test_transforms/test_substitutions.py @@ -209,7 +209,7 @@ u"""\ . <substitution_definition names="copy"> \u00a9 - <substitution_definition names="BogusMegaCorp (TM)"> + <substitution_definition names="BogusMegaCorp\ (TM)"> BogusMegaCorp \u2122 """], diff --git a/test/test_transforms/test_transitions.py b/test/test_transforms/test_transitions.py index 24a69bb52..e450ddff7 100755 --- a/test/test_transforms/test_transitions.py +++ b/test/test_transforms/test_transitions.py @@ -42,16 +42,16 @@ Some text. """, """\ <document source="test data"> - <section ids="section-1" names="section 1"> + <section ids="section-1" names="section\ 1"> <title> Section 1 - <section ids="subsection-1" names="subsection 1"> + <section ids="subsection-1" names="subsection\ 1"> <title> Subsection 1 <paragraph> Some text. <transition> - <section ids="section-2" names="section 2"> + <section ids="section-2" names="section\ 2"> <title> Section 2 <paragraph> @@ -72,7 +72,7 @@ Paragraph. <paragraph> A paragraph. <transition> - <section ids="section-1" names="section 1"> + <section ids="section-1" names="section\ 1"> <title> Section 1 <paragraph> @@ -146,7 +146,7 @@ Section 2 <document source="test data"> <paragraph> Sections with transitions at beginning and end. - <section ids="section-1" names="section 1"> + <section ids="section-1" names="section\ 1"> <title> Section 1 <system_message level="3" line="6" source="test data" type="ERROR"> @@ -156,7 +156,7 @@ Section 2 <paragraph> The next transition is legal: <transition> - <section ids="section-2" names="section 2"> + <section ids="section-2" names="section\ 2"> <title> Section 2 <system_message level="3" line="15" source="test data" type="ERROR"> @@ -239,7 +239,7 @@ Some text. """, """\ <document source="test data"> - <section ids="section-1" names="section 1"> + <section ids="section-1" names="section\ 1"> <title> Section 1 <system_message level="3" line="4" source="test data" type="ERROR"> @@ -254,7 +254,7 @@ Some text. <paragraph> At least one body element must separate transitions; adjacent transitions are not allowed. <transition> - <section ids="section-2" names="section 2"> + <section ids="section-2" names="section\ 2"> <title> Section 2 <paragraph> diff --git a/test/test_writers/test_pseudoxml.py b/test/test_writers/test_pseudoxml.py index 45b320b8b..db8bed7cb 100755 --- a/test/test_writers/test_pseudoxml.py +++ b/test/test_writers/test_pseudoxml.py @@ -41,7 +41,7 @@ Foo. <transition> <paragraph> This is another paragraph. - <section ids="a-section" names="a section"> + <section ids="a-section" names="a\ section"> <title> A Section <paragraph> -- cgit v1.2.1 From 6a2fee95236a9e35897b8e321897ac358605e330 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Mon, 3 Oct 2005 13:11:40 +0000 Subject: added SimpleTable bug git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3918 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_parsers/test_rst/test_SimpleTableParser.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_SimpleTableParser.py b/test/test_parsers/test_rst/test_SimpleTableParser.py index ba6f1b2e0..aee037206 100755 --- a/test/test_parsers/test_rst/test_SimpleTableParser.py +++ b/test/test_parsers/test_rst/test_SimpleTableParser.py @@ -101,6 +101,20 @@ That's bad. [], [[[0, 0, 1, []], [0, 0, 1, []]]])], +# ["""\ +# ============== ========== +# Table with row separators +# ============== ========== +# and blank +# -------------- ---------- +# entries +# -------------- ---------- +# in first +# -------------- ---------- +# columns. +# ============== ========== +# """, +# ''] ] -- cgit v1.2.1 From e6715dd1ba80e7f59f70006387eb1d8726d6fa77 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Mon, 3 Oct 2005 18:33:46 +0000 Subject: added correct link to stylesheet path for visual checkability of HTML output git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3919 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/dangerous.html | 2 +- test/functional/expected/field_name_limit.html | 2 +- test/functional/expected/standalone_rst_html4css1.html | 2 +- test/functional/tests/dangerous.py | 3 +-- test/functional/tests/field_name_limit.py | 3 +-- test/functional/tests/pep_html.py | 2 -- test/functional/tests/standalone_rst_html4css1.py | 3 +-- 7 files changed, 6 insertions(+), 11 deletions(-) (limited to 'test') diff --git a/test/functional/expected/dangerous.html b/test/functional/expected/dangerous.html index 89e86864b..8eb626e62 100644 --- a/test/functional/expected/dangerous.html +++ b/test/functional/expected/dangerous.html @@ -5,7 +5,7 @@ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="generator" content="Docutils 0.3.10: http://docutils.sourceforge.net/" /> <title> - +
    diff --git a/test/functional/expected/field_name_limit.html b/test/functional/expected/field_name_limit.html index 736b8b98b..81bc6dc3a 100644 --- a/test/functional/expected/field_name_limit.html +++ b/test/functional/expected/field_name_limit.html @@ -5,7 +5,7 @@ - +
    diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index 032e37a47..0d61313d9 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -14,7 +14,7 @@ - +
    diff --git a/test/functional/tests/dangerous.py b/test/functional/tests/dangerous.py index 5611268eb..b2faca07a 100644 --- a/test/functional/tests/dangerous.py +++ b/test/functional/tests/dangerous.py @@ -10,5 +10,4 @@ writer_name = "html" # Settings settings_overrides['file_insertion_enabled'] = 0 settings_overrides['raw_enabled'] = 0 -settings_overrides['stylesheet'] = None -settings_overrides['stylesheet_path'] = "../tools/stylesheets/default.css" +settings_overrides['stylesheet_path'] = "../docutils/writers/support/html4css1.css" diff --git a/test/functional/tests/field_name_limit.py b/test/functional/tests/field_name_limit.py index 86ad59a46..27c5c296e 100644 --- a/test/functional/tests/field_name_limit.py +++ b/test/functional/tests/field_name_limit.py @@ -10,5 +10,4 @@ writer_name = "html" # Settings settings_overrides['field_name_limit'] = 0 # no limit settings_overrides['docinfo_xform'] = 0 -settings_overrides['stylesheet'] = None -settings_overrides['stylesheet_path'] = "../tools/stylesheets/default.css" +settings_overrides['stylesheet_path'] = "../docutils/writers/support/html4css1.css" diff --git a/test/functional/tests/pep_html.py b/test/functional/tests/pep_html.py index fde5a0cd5..5a292b207 100644 --- a/test/functional/tests/pep_html.py +++ b/test/functional/tests/pep_html.py @@ -8,10 +8,8 @@ parser_name = "rst" writer_name = "pep_html" # Settings -# settings_overrides['stylesheet'] = None settings_overrides['stylesheet_path'] = ( "../docutils/writers/support/pep_html/pep.css") -# settings_overrides['template'] = "../tools/pep-html-template" settings_overrides['python_home'] = "http://www.python.org" settings_overrides['pep_home'] = "http://www.python.org/peps" settings_overrides['no_random'] = 1 diff --git a/test/functional/tests/standalone_rst_html4css1.py b/test/functional/tests/standalone_rst_html4css1.py index 54252e83f..874deada5 100644 --- a/test/functional/tests/standalone_rst_html4css1.py +++ b/test/functional/tests/standalone_rst_html4css1.py @@ -8,5 +8,4 @@ test_destination = "standalone_rst_html4css1.html" writer_name = "html4css1" # Settings. -settings_overrides['stylesheet'] = None -settings_overrides['stylesheet_path'] = "../tools/stylesheets/default.css" +settings_overrides['stylesheet_path'] = "../docutils/writers/support/html4css1.css" -- cgit v1.2.1 From b7ea575d30a73cdb3efae6c1bb1d875a62e461fc Mon Sep 17 00:00:00 2001 From: wiemann Date: Mon, 3 Oct 2005 19:18:04 +0000 Subject: fixed bug with center-alignment of image; added test git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3920 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_html4css1.html | 6 ++++++ test/functional/expected/standalone_rst_latex.tex | 12 ++++++++++++ test/functional/expected/standalone_rst_pseudoxml.txt | 9 +++++++++ test/functional/input/data/standard.txt | 15 +++++++++++++++ 4 files changed, 42 insertions(+) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index 0d61313d9..3f6014854 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -549,6 +549,12 @@ document (a document-wide table o ../../../docs/user/rst/images/title.png

    Image with multiple IDs:

    ../../../docs/user/rst/images/title.png +

    A centered image:

    +
    ../../../docs/user/rst/images/biohazard.png
    +

    A left-aligned image:

    +../../../docs/user/rst/images/biohazard.png +

    A right-aligned image:

    +../../../docs/user/rst/images/biohazard.png

    A figure directive:

    reStructuredText, the markup syntax diff --git a/test/functional/expected/standalone_rst_latex.tex b/test/functional/expected/standalone_rst_latex.tex index aa03b5dc0..4e36fc61f 100644 --- a/test/functional/expected/standalone_rst_latex.tex +++ b/test/functional/expected/standalone_rst_latex.tex @@ -869,6 +869,18 @@ Image with multiple IDs: \includegraphics{../../../docs/user/rst/images/title.png} +A centered image: + +{\hfill\includegraphics{../../../docs/user/rst/images/biohazard.png}\hfill} + +A left-aligned image: + +{\includegraphics{../../../docs/user/rst/images/biohazard.png}\hfill} + +A right-aligned image: + +{\hfill\includegraphics{../../../docs/user/rst/images/biohazard.png}} + A figure directive: \begin{figure}[htbp]\begin{center} diff --git a/test/functional/expected/standalone_rst_pseudoxml.txt b/test/functional/expected/standalone_rst_pseudoxml.txt index 179760c86..f47750eb5 100644 --- a/test/functional/expected/standalone_rst_pseudoxml.txt +++ b/test/functional/expected/standalone_rst_pseudoxml.txt @@ -1128,6 +1128,15 @@ + + A centered image: + + + A left-aligned image: + + + A right-aligned image: + A figure directive:
    diff --git a/test/functional/input/data/standard.txt b/test/functional/input/data/standard.txt index 85016529f..0ce3020ef 100644 --- a/test/functional/input/data/standard.txt +++ b/test/functional/input/data/standard.txt @@ -434,6 +434,21 @@ Image with multiple IDs: .. _image target 3: .. image:: ../../../docs/user/rst/images/title.png +A centered image: + +.. image:: ../../../docs/user/rst/images/biohazard.png + :align: center + +A left-aligned image: + +.. image:: ../../../docs/user/rst/images/biohazard.png + :align: left + +A right-aligned image: + +.. image:: ../../../docs/user/rst/images/biohazard.png + :align: right + A figure directive: .. figure:: ../../../docs/user/rst/images/biohazard.png -- cgit v1.2.1 From 0880f518d78dc87baddd465adbaf500a2654b6d3 Mon Sep 17 00:00:00 2001 From: wiemann Date: Tue, 4 Oct 2005 17:26:33 +0000 Subject: added test for parsed literal block git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3922 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../expected/standalone_rst_html4css1.html | 224 ++++++++++--------- test/functional/expected/standalone_rst_latex.tex | 34 ++- .../expected/standalone_rst_pseudoxml.txt | 246 ++++++++++++--------- test/functional/input/data/standard.txt | 12 + 4 files changed, 300 insertions(+), 216 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index 3f6014854..8a8def5e9 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -88,67 +88,68 @@ They are transformed from section titles after parsing. -->

    Table of Contents

    -

    1   Structural Elements

    +

    1   Structural Elements

    -

    1.1   Section Title

    +

    1.1   Section Title

    Section Subtitle

    That's it, the text just above this line.

    -

    1.3   Transitions

    +

    1.3   Transitions

    Here's a transition:


    It divides the section. Transitions may also occur between sections:

    @@ -156,24 +157,24 @@ They are transformed from section titles after parsing. -->

    -

    2   Body Elements

    +

    2   Body Elements

    -

    2.1   Paragraphs

    +

    2.1   Paragraphs

    A paragraph.

    -

    2.1.1   Inline Markup

    +

    2.1.1   Inline Markup

    Paragraphs contain text and may contain inline markup: emphasis, strong emphasis, inline literals, standalone hyperlinks -(http://www.python.org), external hyperlinks (Python [5]), internal +(http://www.python.org), external hyperlinks (Python [5]), internal cross-references (example), external hyperlinks with embedded URIs (Python web site), footnote references (manually numbered [1], anonymous auto-numbered [3], labeled auto-numbered [2], or symbolic [*]), citation references ([CIT2002]), substitution references (EXAMPLE), and inline -hyperlink targets (see Targets below for a reference back to here). +hyperlink targets (see Targets below for a reference back to here). Character-level inline markup is also possible (although exceedingly ugly!) in reStructuredText. Problems are indicated by -|problematic| text (generated by processing errors; this one is +|problematic| text (generated by processing errors; this one is intentional). Here is a reference to the doctitle and the subtitle.

    The default role for interpreted text is Title Reference. Here are some explicit interpreted text roles: a PEP reference (PEP 287); an @@ -192,7 +193,7 @@ live link to PEP 258 here.

    -

    2.2   Bullet Lists

    +

    2.2   Bullet Lists

    • A bullet list

        @@ -217,7 +218,7 @@ live link to PEP 258 here.

    -

    2.3   Enumerated Lists

    +

    2.3   Enumerated Lists

    1. Arabic numerals.

        @@ -250,7 +251,7 @@ live link to PEP 258 here.

    -

    2.4   Definition Lists

    +

    2.4   Definition Lists

    Term
    Definition
    @@ -265,7 +266,7 @@ live link to PEP 258 here.

    @@ -289,7 +290,7 @@ doesn't get stripped away.)

    -

    2.6   Option Lists

    +

    2.6   Option Lists

    For listing command-line options:

    @@ -335,7 +336,7 @@ regardless of where it starts.

    description.

    -

    2.7   Literal Blocks

    +

    2.7   Literal Blocks

    Literal blocks are indicated with a double-colon ("::") at the end of the preceding paragraph (over there -->). They can be indented:

    @@ -352,7 +353,7 @@ if literal_block:
     
    -

    2.8   Line Blocks

    +

    2.8   Line Blocks

    This section tests line blocks. Line blocks are body elements which consist of lines and other line blocks. Nested line blocks cause indentation.

    @@ -411,7 +412,7 @@ the left edge of the text above it.
    -

    2.9   Block Quotes

    +

    2.9   Block Quotes

    Block quotes consist of indented body elements:

    My theory by A. Elk. Brackets Miss, brackets. This theory goes @@ -423,7 +424,7 @@ own it, and what it is too.

    -

    2.10   Doctest Blocks

    +

    2.10   Doctest Blocks

     >>> print 'Python-specific usage examples; begun with ">>>"'
     Python-specific usage examples; begun with ">>>"
    @@ -432,11 +433,11 @@ Python-specific usage examples; begun with ">>>"
     
    - @@ -479,12 +480,12 @@ Here's a reference to the next footnote: +nonexistent footnote: [5]_.
    [1](1, 2)

    A footnote contains body elements, consistently indented by at +

    [1](1, 2, 3)

    A footnote contains body elements, consistently indented by at least 3 spaces.

    This is the footnote's second paragraph.

    [4]Here's an unreferenced footnote, with a reference to a -nonexistent footnote: [5]_.
    -

    2.12   Citations

    +

    2.12   Citations

    @@ -492,59 +493,60 @@ nonexistent footnote: [CIT2002], and a [nonexistent]_ +

    Here's a reference to the above, [CIT2002], and a [nonexistent]_ citation.

    -

    2.13   Targets

    +

    2.13   Targets

    This paragraph is pointed to by the explicit "example" target. A reference can be found under Inline Markup, above. Inline hyperlink targets are also possible.

    Section headers are implicit targets, referred to by name. See -Targets, which is a subsection of Body Elements.

    +Targets, which is a subsection of Body Elements.

    Explicit external targets are interpolated into references such as -"Python [5]".

    -

    Targets may be indirect and anonymous. Thus this phrase may also -refer to the Targets section.

    -

    Here's a `hyperlink reference without a target`_, which generates an +"Python [5]".

    +

    Targets may be indirect and anonymous. Thus this phrase may also +refer to the Targets section.

    +

    Here's a `hyperlink reference without a target`_, which generates an error.

    -

    2.13.1   Duplicate Target Names

    +

    2.13.1   Duplicate Target Names

    Duplicate names in section headers or other implicit targets will generate "info" (level-1) system messages. Duplicate names in explicit targets will generate "warning" (level-2) system messages.

    -

    2.13.2   Duplicate Target Names

    +

    2.13.2   Duplicate Target Names

    Since there are two "Duplicate Target Names" section headers, we cannot uniquely refer to either of them by name. If we try to (like -this: `Duplicate Target Names`_), an error is generated.

    +this: `Duplicate Target Names`_), an error is generated.

    -

    2.14   Directives

    +

    2.14   Directives

    These are just a sample of the many reStructuredText Directives. For others, please see http://docutils.sourceforge.net/docs/ref/rst/directives.html.

    -

    2.14.1   Document Parts

    +

    2.14.1   Document Parts

    An example of the "contents" directive can be seen above this section (a local, untitled table of contents) and at the beginning of the document (a document-wide table of contents).

    -

    2.14.2   Images

    +

    2.14.2   Images

    An image directive (also clickable -- a hyperlink reference):

    ../../../docs/user/rst/images/title.png

    Image with multiple IDs:

    @@ -612,7 +614,7 @@ document (a document-wide table o ../../../docs/user/rst/images/biohazard.png
    -

    2.14.3   Admonitions

    +

    2.14.3   Admonitions

    Attention!

    Directives at large.

    @@ -661,7 +663,7 @@ Reader discretion is strongly advised.

    -

    2.14.4   Topics, Sidebars, and Rubrics

    +

    2.14.4   Topics, Sidebars, and Rubrics

    +

    2.14.5   Target Footnotes

    +
    - +
    [5](1, 2, 3) http://www.python.org/
    [5](1, 2, 3) http://www.python.org/
    -

    2.14.7   Compound Paragraph

    +

    2.14.7   Compound Paragraph

    Compound 1, paragraph 1.

    Compound 1, paragraph 2.

    @@ -758,14 +760,24 @@ paragraph.

    Compound 7, another paragraph.

    +
    +

    2.14.8   Parsed Literal Blocks

    +
    +This is a parsed literal block.
    +    This line is indented.  The next line is blank.
    +
    +Inline markup is supported, e.g. emphasis, strong, literal
    +text, footnotes [1], targets, and references.
    +
    +
    -

    2.15   Substitution Definitions

    +

    2.15   Substitution Definitions

    An inline image (EXAMPLE) example:

    (Substitution definitions are not visible in the HTML source.)

    -

    2.16   Comments

    +

    2.16   Comments

    Here's one:

    (View the HTML source to see the comment.)

    -

    2.17   Raw text

    +

    2.17   Raw text

    This does not necessarily look nice, because there may be missing white space.

    It's just there to freeze the behavior.

    A test.Second test.
    Another test with myclass set.

    This is the fourth test with myrawroleclass set.

    Fifth test in HTML.
    Line two.
    -

    2.18   Colspanning tables

    +

    2.18   Colspanning tables

    This table has a cell spanning two columns:

    @@ -819,7 +831,7 @@ Fifth test in HTML.
    Line two.
    -

    2.19   Rowspanning tables

    +

    2.19   Rowspanning tables

    Here's a table with cells spanning several rows:

    @@ -852,7 +864,7 @@ cell.
    -

    2.20   Complex tables

    +

    2.20   Complex tables

    Here's a complex table, which should test all features.

    @@ -901,7 +913,7 @@ empty: -->
    -

    2.21   List Tables

    +

    2.21   List Tables

    Here's a list table exercising all features:

    @@ -935,7 +947,7 @@ crunchy, now would it?
    -

    3   Error Handling

    +

    3   Error Handling

    Any errors caught during processing will generate system messages.

    There should be five messages in the following, auto-generated section, "Docutils System Messages":

    @@ -943,20 +955,20 @@ section, "Docutils System Messages":

    Docutils System Messages

    -
    -

    System Message: ERROR/3 (functional/input/data/standard.txt, line 100); backlink

    +
    +

    System Message: ERROR/3 (functional/input/data/standard.txt, line 100); backlink

    Undefined substitution referenced: "problematic".
    -
    -

    System Message: ERROR/3 (functional/input/standalone_rst_html4css1.txt, line 354); backlink

    +
    +

    System Message: ERROR/3 (functional/input/standalone_rst_html4css1.txt, line 354); backlink

    Unknown target name: "5".
    -
    -

    System Message: ERROR/3 (functional/input/data/standard.txt, line 363); backlink

    +
    +

    System Message: ERROR/3 (functional/input/data/standard.txt, line 363); backlink

    Unknown target name: "nonexistent".
    -
    -

    System Message: ERROR/3 (functional/input/data/standard.txt, line 390); backlink

    +
    +

    System Message: ERROR/3 (functional/input/data/standard.txt, line 390); backlink

    Unknown target name: "hyperlink reference without a target".
    -
    -

    System Message: ERROR/3 (functional/input/data/standard.txt, line 403); backlink

    +
    +

    System Message: ERROR/3 (functional/input/data/standard.txt, line 403); backlink

    Duplicate target name, cannot be used as a unique reference: "duplicate target names".
    diff --git a/test/functional/expected/standalone_rst_latex.tex b/test/functional/expected/standalone_rst_latex.tex index 4e36fc61f..0a5aec391 100644 --- a/test/functional/expected/standalone_rst_latex.tex +++ b/test/functional/expected/standalone_rst_latex.tex @@ -198,6 +198,8 @@ reStructuredText construct. \item {} \href{\#compound-paragraph}{2.14.7~~~Compound Paragraph} +\item {} \href{\#parsed-literal-blocks}{2.14.8~~~Parsed Literal Blocks} + \end{list} \item {} \href{\#substitution-definitions}{2.15~~~Substitution Definitions} @@ -296,13 +298,13 @@ A paragraph. Paragraphs contain text and may contain inline markup: \emph{emphasis}, \textbf{strong emphasis}, \texttt{inline literals}, standalone hyperlinks -(\href{http://www.python.org}{http://www.python.org}), external hyperlinks (\href{http://www.python.org/}{Python}\raisebox{.5em}[0em]{\scriptsize\hyperlink{id21}{5}}), internal +(\href{http://www.python.org}{http://www.python.org}), external hyperlinks (\href{http://www.python.org/}{Python}\raisebox{.5em}[0em]{\scriptsize\hyperlink{id23}{5}}), internal cross-references (\href{\#example}{example}), external hyperlinks with embedded URIs (\href{http://www.python.org}{Python web site}), footnote references (manually numbered\raisebox{.5em}[0em]{\scriptsize\hyperlink{id6}{1}}, anonymous auto-numbered\raisebox{.5em}[0em]{\scriptsize\hyperlink{id9}{3}}, labeled auto-numbered\raisebox{.5em}[0em]{\scriptsize\hyperlink{label}{2}}, or symbolic\raisebox{.5em}[0em]{\scriptsize\hyperlink{id10}{*}}), citation references ([\hyperlink{cit2002}{CIT2002}]), substitution references (\includegraphics{../../../docs/user/rst/images/biohazard.png}), and \hypertarget{inline-hyperlink-targets}{inline -hyperlink targets} (see \href{\#targets}{Targets} below for a reference back to here). +hyperlink targets} (see \href{\#id20}{Targets} below for a reference back to here). Character-level inline markup is also possible (although exceedingly ugly!) in \emph{re}\texttt{Structured}\emph{Text}. Problems are indicated by {\color{red}\bfseries{}{\textbar}problematic{\textbar}} text (generated by processing errors; this one is @@ -784,13 +786,13 @@ reference can be found under \href{\#inline-markup}{Inline Markup}, above. \href hyperlink targets} are also possible. Section headers are implicit targets, referred to by name. See -\href{\#targets}{Targets}, which is a subsection of \href{\#body-elements}{Body Elements}. +\href{\#id20}{Targets}, which is a subsection of \href{\#body-elements}{Body Elements}. Explicit external targets are interpolated into references such as -``\href{http://www.python.org/}{Python}\raisebox{.5em}[0em]{\scriptsize\hyperlink{id21}{5}}''. +``\href{http://www.python.org/}{Python}\raisebox{.5em}[0em]{\scriptsize\hyperlink{id23}{5}}''. -Targets may be indirect and anonymous. Thus \href{\#targets}{this phrase} may also -refer to the \href{\#targets}{Targets} section. +Targets may be indirect and anonymous. Thus \href{\#id20}{this phrase} may also +refer to the \href{\#id20}{Targets} section. Here's a {\color{red}\bfseries{}`hyperlink reference without a target`{\_}}, which generates an error. @@ -838,6 +840,8 @@ this: {\color{red}\bfseries{}`Duplicate Target Names`{\_}}), an error is generat \item {} \href{\#compound-paragraph}{2.14.7~~~Compound Paragraph} +\item {} \href{\#parsed-literal-blocks}{2.14.8~~~Parsed Literal Blocks} + \end{list} @@ -1105,7 +1109,7 @@ This is a topic. \hypertarget{target-footnotes}{} \pdfbookmark[2]{2.14.5~~~Target Footnotes}{target-footnotes} \subsubsection*{2.14.5~~~Target Footnotes} -\begin{figure}[b]\hypertarget{id21}$^{5}$ +\begin{figure}[b]\hypertarget{id23}$^{5}$ \href{http://www.python.org/}{http://www.python.org/} \end{figure} @@ -1116,7 +1120,7 @@ This is a topic. \pdfbookmark[2]{2.14.6~~~Replacement Text}{replacement-text} \subsubsection*{2.14.6~~~Replacement Text} -I recommend you try \href{http://www.python.org/}{Python, \emph{the} best language around}\raisebox{.5em}[0em]{\scriptsize\hyperlink{id21}{5}}. +I recommend you try \href{http://www.python.org/}{Python, \emph{the} best language around}\raisebox{.5em}[0em]{\scriptsize\hyperlink{id23}{5}}. %___________________________________________________________________________ @@ -1193,6 +1197,20 @@ Compound 7, a paragraph after the table. Compound 7, another paragraph. +%___________________________________________________________________________ + +\hypertarget{parsed-literal-blocks}{} +\pdfbookmark[2]{2.14.8~~~Parsed Literal Blocks}{parsed-literal-blocks} +\subsubsection*{2.14.8~~~Parsed Literal Blocks} +\begin{quote}{\ttfamily \raggedright \noindent +This~is~a~parsed~literal~block.~\\ +~~~~This~line~is~indented.~~The~next~line~is~blank.~\\ +~\\ +Inline~markup~is~supported,~e.g.~\emph{emphasis},~\textbf{strong},~\texttt{literal~\\ +text},~footnotes\raisebox{.5em}[0em]{\scriptsize\hyperlink{id6}{1}},~\hypertarget{id20}{targets},~and~\href{http://www.python.org/}{references}. +}\end{quote} + + %___________________________________________________________________________ \hypertarget{substitution-definitions}{} diff --git a/test/functional/expected/standalone_rst_pseudoxml.txt b/test/functional/expected/standalone_rst_pseudoxml.txt index f47750eb5..ac3fc98a7 100644 --- a/test/functional/expected/standalone_rst_pseudoxml.txt +++ b/test/functional/expected/standalone_rst_pseudoxml.txt @@ -91,238 +91,244 @@ - + 1    Structural Elements - + 1.1    Section Title - + 1.2    Empty Section - + 1.3    Transitions - + 2    Body Elements - + 2.1    Paragraphs - + 2.1.1    Inline Markup - + 2.2    Bullet Lists - + 2.3    Enumerated Lists - + 2.4    Definition Lists - + 2.5    Field Lists - + 2.6    Option Lists - + 2.7    Literal Blocks - + 2.8    Line Blocks - + 2.9    Block Quotes - + 2.10    Doctest Blocks - + 2.11    Footnotes - + 2.12    Citations - + 2.13    Targets - + 2.13.1    Duplicate Target Names - + 2.13.2    Duplicate Target Names - + 2.14    Directives - + 2.14.1    Document Parts - + 2.14.2    Images - + 2.14.3    Admonitions - + 2.14.4    Topics, Sidebars, and Rubrics - + 2.14.5    Target Footnotes - + 2.14.6    Replacement Text - + 2.14.7    Compound Paragraph + + + + + 2.14.8    + Parsed Literal Blocks - + 2.15    Substitution Definitions - + 2.16    Comments - + 2.17    Raw text - + 2.18    Colspanning tables - + 2.19    Rowspanning tables - + 2.20    Complex tables - + 2.21    List Tables - + 3    Error Handling
    - + <title auto="1" refid="id27"> <generated classes="sectnum"> 1    Structural Elements <section ids="section-title" names="section\ title"> - <title auto="1" refid="id26"> + <title auto="1" refid="id28"> <generated classes="sectnum"> 1.1    Section Title @@ -331,12 +337,12 @@ <paragraph> That's it, the text just above this line. <section ids="empty-section" names="empty\ section"> - <title auto="1" refid="id27"> + <title auto="1" refid="id29"> <generated classes="sectnum"> 1.2    Empty Section <section ids="transitions" names="transitions"> - <title auto="1" refid="id28"> + <title auto="1" refid="id30"> <generated classes="sectnum"> 1.3    Transitions @@ -347,19 +353,19 @@ It divides the section. Transitions may also occur between sections: <transition> <section ids="body-elements" names="body\ elements"> - <title auto="1" refid="id29"> + <title auto="1" refid="id31"> <generated classes="sectnum"> 2    Body Elements <section ids="paragraphs" names="paragraphs"> - <title auto="1" refid="id30"> + <title auto="1" refid="id32"> <generated classes="sectnum"> 2.1    Paragraphs <paragraph> A paragraph. <section ids="inline-markup" names="inline\ markup"> - <title auto="1" refid="id31"> + <title auto="1" refid="id33"> <generated classes="sectnum"> 2.1.1    Inline Markup @@ -381,7 +387,7 @@ <reference name="Python" refuri="http://www.python.org/"> Python - <footnote_reference auto="1" ids="id22" refid="id21"> + <footnote_reference auto="1" ids="id24" refid="id23"> 5 ), internal cross-references ( @@ -416,7 +422,7 @@ inline hyperlink targets (see - <reference name="Targets" refid="targets"> + <reference name="Targets" refid="id20"> Targets below for a reference back to here). Character-level inline markup is also possible (although exceedingly @@ -428,7 +434,7 @@ <emphasis> Text . Problems are indicated by - <problematic ids="id20" refid="id19"> + <problematic ids="id22" refid="id21"> |problematic| text (generated by processing errors; this one is intentional). Here is a reference to the @@ -484,7 +490,7 @@ option was supplied, there should be a live link to PEP 258 here. <section ids="bullet-lists" names="bullet\ lists"> - <title auto="1" refid="id32"> + <title auto="1" refid="id34"> <generated classes="sectnum"> 2.2    Bullet Lists @@ -528,7 +534,7 @@ <comment xml:space="preserve"> Even if this item contains a target and a comment. <section ids="enumerated-lists" names="enumerated\ lists"> - <title auto="1" refid="id33"> + <title auto="1" refid="id35"> <generated classes="sectnum"> 2.3    Enumerated Lists @@ -577,7 +583,7 @@ <paragraph> iv <section ids="definition-lists" names="definition\ lists"> - <title auto="1" refid="id34"> + <title auto="1" refid="id36"> <generated classes="sectnum"> 2.4    Definition Lists @@ -615,7 +621,7 @@ <paragraph> Definition <section ids="field-lists" names="field\ lists"> - <title auto="1" refid="id35"> + <title auto="1" refid="id37"> <generated classes="sectnum"> 2.5    Field Lists @@ -649,7 +655,7 @@ about credits but just for ensuring that the class attribute doesn't get stripped away.) <section ids="option-lists" names="option\ lists"> - <title auto="1" refid="id36"> + <title auto="1" refid="id38"> <generated classes="sectnum"> 2.6    Option Lists @@ -762,7 +768,7 @@ There must be at least two spaces between the option and the description. <section ids="literal-blocks" names="literal\ blocks"> - <title auto="1" refid="id37"> + <title auto="1" refid="id39"> <generated classes="sectnum"> 2.7    Literal Blocks @@ -784,7 +790,7 @@ > > Why didn't I think of that? <section ids="line-blocks" names="line\ blocks"> - <title auto="1" refid="id38"> + <title auto="1" refid="id40"> <generated classes="sectnum"> 2.8    Line Blocks @@ -862,7 +868,7 @@ <line> Singing... <section ids="block-quotes" names="block\ quotes"> - <title auto="1" refid="id39"> + <title auto="1" refid="id41"> <generated classes="sectnum"> 2.9    Block Quotes @@ -878,7 +884,7 @@ <attribution> Anne Elk (Miss) <section ids="doctest-blocks" names="doctest\ blocks"> - <title auto="1" refid="id40"> + <title auto="1" refid="id42"> <generated classes="sectnum"> 2.10    Doctest Blocks @@ -888,11 +894,11 @@ >>> print '(cut and pasted from interactive Python sessions)' (cut and pasted from interactive Python sessions) <section ids="footnotes" names="footnotes"> - <title auto="1" refid="id41"> + <title auto="1" refid="id43"> <generated classes="sectnum"> 2.11    Footnotes - <footnote backrefs="id1 id7" ids="id6" names="1"> + <footnote backrefs="id1 id7 id19" ids="id6" names="1"> <label> 1 <paragraph> @@ -948,11 +954,11 @@ <paragraph> Here's an unreferenced footnote, with a reference to a nonexistent footnote: - <problematic ids="id70 id14" refid="id69"> + <problematic ids="id74 id14" refid="id73"> [5]_ . <section ids="citations" names="citations"> - <title auto="1" refid="id42"> + <title auto="1" refid="id44"> <generated classes="sectnum"> 2.12    Citations @@ -967,13 +973,13 @@ <citation_reference ids="id15" refid="cit2002"> CIT2002 , and a - <problematic ids="id72 id16" refid="id71"> + <problematic ids="id76 id16" refid="id75"> [nonexistent]_ citation. <target refid="another-target"> - <section ids="targets another-target" names="targets another\ target"> - <title auto="1" refid="id43"> + <section dupnames="targets" ids="targets another-target" names="another\ target"> + <title auto="1" refid="id45"> <generated classes="sectnum"> 2.13    Targets @@ -990,7 +996,7 @@ are also possible. <paragraph> Section headers are implicit targets, referred to by name. See - <reference name="Targets" refid="targets"> + <reference name="Targets" refid="id20"> Targets , which is a subsection of <reference name="Body Elements" refid="body-elements"> @@ -1002,28 +1008,28 @@ <reference name="Python" refuri="http://www.python.org/"> Python - <footnote_reference auto="1" ids="id23" refid="id21"> + <footnote_reference auto="1" ids="id25" refid="id23"> 5 ". <target ids="python" names="python" refuri="http://www.python.org/"> <paragraph> Targets may be indirect and anonymous. Thus - <reference anonymous="1" name="this phrase" refid="targets"> + <reference anonymous="1" name="this phrase" refid="id20"> this phrase may also refer to the - <reference name="Targets" refid="targets"> + <reference name="Targets" refid="id20"> Targets section. - <target anonymous="1" ids="id17" refid="targets"> + <target anonymous="1" ids="id17" refid="id20"> <paragraph> Here's a - <problematic ids="id74" refid="id73"> + <problematic ids="id78" refid="id77"> `hyperlink reference without a target`_ , which generates an error. <section dupnames="duplicate\ target\ names" ids="duplicate-target-names"> - <title auto="1" refid="id44"> + <title auto="1" refid="id46"> <generated classes="sectnum"> 2.13.1    Duplicate Target Names @@ -1032,7 +1038,7 @@ generate "info" (level-1) system messages. Duplicate names in explicit targets will generate "warning" (level-2) system messages. <section dupnames="duplicate\ target\ names" ids="id18"> - <title auto="1" refid="id45"> + <title auto="1" refid="id47"> <generated classes="sectnum"> 2.13.2    Duplicate Target Names @@ -1040,11 +1046,11 @@ Since there are two "Duplicate Target Names" section headers, we cannot uniquely refer to either of them by name. If we try to (like this: - <problematic ids="id76" refid="id75"> + <problematic ids="id80" refid="id79"> `Duplicate Target Names`_ ), an error is generated. <section ids="directives" names="directives"> - <title auto="1" refid="id46"> + <title auto="1" refid="id48"> <generated classes="sectnum"> 2.14    Directives @@ -1052,46 +1058,52 @@ <bullet_list classes="auto-toc"> <list_item> <paragraph> - <reference ids="id62" refid="document-parts"> + <reference ids="id65" refid="document-parts"> <generated classes="sectnum"> 2.14.1    Document Parts <list_item> <paragraph> - <reference ids="id63" refid="images"> + <reference ids="id66" refid="images"> <generated classes="sectnum"> 2.14.2    Images <list_item> <paragraph> - <reference ids="id64" refid="admonitions"> + <reference ids="id67" refid="admonitions"> <generated classes="sectnum"> 2.14.3    Admonitions <list_item> <paragraph> - <reference ids="id65" refid="topics-sidebars-and-rubrics"> + <reference ids="id68" refid="topics-sidebars-and-rubrics"> <generated classes="sectnum"> 2.14.4    Topics, Sidebars, and Rubrics <list_item> <paragraph> - <reference ids="id66" refid="target-footnotes"> + <reference ids="id69" refid="target-footnotes"> <generated classes="sectnum"> 2.14.5    Target Footnotes <list_item> <paragraph> - <reference ids="id67" refid="replacement-text"> + <reference ids="id70" refid="replacement-text"> <generated classes="sectnum"> 2.14.6    Replacement Text <list_item> <paragraph> - <reference ids="id68" refid="compound-paragraph"> + <reference ids="id71" refid="compound-paragraph"> <generated classes="sectnum"> 2.14.7    Compound Paragraph + <list_item> + <paragraph> + <reference ids="id72" refid="parsed-literal-blocks"> + <generated classes="sectnum"> + 2.14.8    + Parsed Literal Blocks <paragraph> These are just a sample of the many reStructuredText Directives. For others, please see @@ -1099,7 +1111,7 @@ http://docutils.sourceforge.net/docs/ref/rst/directives.html . <section ids="document-parts" names="document\ parts"> - <title auto="1" refid="id62"> + <title auto="1" refid="id65"> <generated classes="sectnum"> 2.14.1    Document Parts @@ -1114,7 +1126,7 @@ table of contents ). <section ids="images" names="images"> - <title auto="1" refid="id63"> + <title auto="1" refid="id66"> <generated classes="sectnum"> 2.14.2    Images @@ -1215,7 +1227,7 @@ An image 3 cm high: <image height="3cm" uri="../../../docs/user/rst/images/biohazard.png"> <section ids="admonitions" names="admonitions"> - <title auto="1" refid="id64"> + <title auto="1" refid="id67"> <generated classes="sectnum"> 2.14.3    Admonitions @@ -1265,7 +1277,7 @@ You can make up your own admonition too. <target ids="docutils" names="docutils" refuri="http://docutils.sourceforge.net/"> <section ids="topics-sidebars-and-rubrics" names="topics,\ sidebars,\ and\ rubrics"> - <title auto="1" refid="id65"> + <title auto="1" refid="id68"> <generated classes="sectnum"> 2.14.4    Topics, Sidebars, and Rubrics @@ -1290,18 +1302,18 @@ <rubric> This is a rubric <section ids="target-footnotes" names="target\ footnotes"> - <title auto="1" refid="id66"> + <title auto="1" refid="id69"> <generated classes="sectnum"> 2.14.5    Target Footnotes - <footnote auto="1" backrefs="id22 id23 id24" ids="id21" names="TARGET_NOTE:\ id21"> + <footnote auto="1" backrefs="id24 id25 id26" ids="id23" names="TARGET_NOTE:\ id23"> <label> 5 <paragraph> <reference refuri="http://www.python.org/"> http://www.python.org/ <section ids="replacement-text" names="replacement\ text"> - <title auto="1" refid="id67"> + <title auto="1" refid="id70"> <generated classes="sectnum"> 2.14.6    Replacement Text @@ -1313,7 +1325,7 @@ the best language around - <footnote_reference auto="1" ids="id24" refid="id21"> + <footnote_reference auto="1" ids="id26" refid="id23"> 5 . <substitution_definition names="Python"> @@ -1322,7 +1334,7 @@ the best language around <section ids="compound-paragraph" names="compound\ paragraph"> - <title auto="1" refid="id68"> + <title auto="1" refid="id71"> <generated classes="sectnum"> 2.14.7    Compound Paragraph @@ -1407,8 +1419,38 @@ Compound 7, a paragraph after the table. <paragraph> Compound 7, another paragraph. + <section ids="parsed-literal-blocks" names="parsed\ literal\ blocks"> + <title auto="1" refid="id72"> + <generated classes="sectnum"> + 2.14.8    + Parsed Literal Blocks + <literal_block xml:space="preserve"> + This is a parsed literal block. + This line is indented. The next line is blank. + + Inline markup is supported, e.g. + <emphasis> + emphasis + , + <strong> + strong + , + <literal> + literal + text + , footnotes + <footnote_reference ids="id19" refid="id6"> + 1 + , + <target ids="id20" names="targets"> + targets + , and + <reference name="references" refuri="http://www.python.org/"> + references + <target ids="references" names="references" refuri="http://www.python.org/"> + . <section ids="substitution-definitions" names="substitution\ definitions"> - <title auto="1" refid="id54"> + <title auto="1" refid="id57"> <generated classes="sectnum"> 2.15    Substitution Definitions @@ -1421,7 +1463,7 @@ <paragraph> (Substitution definitions are not visible in the HTML source.) <section ids="comments" names="comments"> - <title auto="1" refid="id55"> + <title auto="1" refid="id58"> <generated classes="sectnum"> 2.16    Comments @@ -1436,7 +1478,7 @@ <paragraph> (View the HTML source to see the comment.) <section ids="raw-text" names="raw\ text"> - <title auto="1" refid="id56"> + <title auto="1" refid="id59"> <generated classes="sectnum"> 2.17    Raw text @@ -1460,7 +1502,7 @@ <raw format="latex" xml:space="preserve"> Fifth test in LaTeX.\\Line two. <section ids="colspanning-tables" names="colspanning\ tables"> - <title auto="1" refid="id57"> + <title auto="1" refid="id60"> <generated classes="sectnum"> 2.18    Colspanning tables @@ -1531,7 +1573,7 @@ <paragraph> True <section ids="rowspanning-tables" names="rowspanning\ tables"> - <title auto="1" refid="id58"> + <title auto="1" refid="id61"> <generated classes="sectnum"> 2.19    Rowspanning tables @@ -1583,7 +1625,7 @@ <paragraph> body row 3 <section ids="complex-tables" names="complex\ tables"> - <title auto="1" refid="id59"> + <title auto="1" refid="id62"> <generated classes="sectnum"> 2.20    Complex tables @@ -1668,7 +1710,7 @@ --> <entry> <section ids="list-tables" names="list\ tables"> - <title auto="1" refid="id60"> + <title auto="1" refid="id63"> <generated classes="sectnum"> 2.21    List Tables @@ -1725,7 +1767,7 @@ <paragraph> On a stick! <section ids="error-handling" names="error\ handling"> - <title auto="1" refid="id61"> + <title auto="1" refid="id64"> <generated classes="sectnum"> 3    Error Handling @@ -1739,18 +1781,18 @@ <section classes="system-messages"> <title> Docutils System Messages - <system_message backrefs="id20" ids="id19" level="3" line="100" source="functional/input/data/standard.txt" type="ERROR"> + <system_message backrefs="id22" ids="id21" level="3" line="100" source="functional/input/data/standard.txt" type="ERROR"> <paragraph> Undefined substitution referenced: "problematic". - <system_message backrefs="id70" ids="id69" level="3" line="354" source="functional/input/standalone_rst_html4css1.txt" type="ERROR"> + <system_message backrefs="id74" ids="id73" level="3" line="354" source="functional/input/standalone_rst_html4css1.txt" type="ERROR"> <paragraph> Unknown target name: "5". - <system_message backrefs="id72" ids="id71" level="3" line="363" source="functional/input/data/standard.txt" type="ERROR"> + <system_message backrefs="id76" ids="id75" level="3" line="363" source="functional/input/data/standard.txt" type="ERROR"> <paragraph> Unknown target name: "nonexistent". - <system_message backrefs="id74" ids="id73" level="3" line="390" source="functional/input/data/standard.txt" type="ERROR"> + <system_message backrefs="id78" ids="id77" level="3" line="390" source="functional/input/data/standard.txt" type="ERROR"> <paragraph> Unknown target name: "hyperlink reference without a target". - <system_message backrefs="id76" ids="id75" level="3" line="403" source="functional/input/data/standard.txt" type="ERROR"> + <system_message backrefs="id80" ids="id79" level="3" line="403" source="functional/input/data/standard.txt" type="ERROR"> <paragraph> Duplicate target name, cannot be used as a unique reference: "duplicate target names". diff --git a/test/functional/input/data/standard.txt b/test/functional/input/data/standard.txt index 0ce3020ef..ccb5ddbeb 100644 --- a/test/functional/input/data/standard.txt +++ b/test/functional/input/data/standard.txt @@ -659,6 +659,18 @@ meaningful. Compound 7, another paragraph. +Parsed Literal Blocks +````````````````````` + +.. parsed-literal:: + + This is a parsed literal block. + This line is indented. The next line is blank. + + Inline markup is supported, e.g. *emphasis*, **strong**, ``literal + text``, footnotes [1]_, _`targets`, and `references + <http://www.python.org/>`_. + Substitution Definitions ------------------------ -- cgit v1.2.1 From 8caecfa4637c4690054d994722b629f5dba32721 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Tue, 11 Oct 2005 17:51:38 +0000 Subject: disallow targets inside substitution definitions git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3933 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_parsers/test_rst/test_substitutions.py | 15 +++++++++++++++ test/test_transforms/test_substitutions.py | 24 ++++++++++++++++++++++++ 2 files changed, 39 insertions(+) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_substitutions.py b/test/test_parsers/test_rst/test_substitutions.py index f949ce187..7210819b0 100755 --- a/test/test_parsers/test_rst/test_substitutions.py +++ b/test/test_parsers/test_rst/test_substitutions.py @@ -255,6 +255,21 @@ No blank line after. <comment xml:space="preserve"> | """], +["""\ +Substitution definition with a target: + +.. |target| replace:: _`target` +""", +"""\ +<document source="test data"> + <paragraph> + Substitution definition with a target: + <system_message level="2" line="3" source="test data" type="WARNING"> + <paragraph> + Substitution definitions may not contain targets. + <literal_block xml:space="preserve"> + .. |target| replace:: _`target` +"""], ] diff --git a/test/test_transforms/test_substitutions.py b/test/test_transforms/test_substitutions.py index 723f01473..8a09fe109 100755 --- a/test/test_transforms/test_substitutions.py +++ b/test/test_transforms/test_substitutions.py @@ -236,6 +236,30 @@ u"""\ <substitution_definition ltrim="1" names="TM"> \u2122 """], +["""\ +Substitution definition with a target: + +.. |target| replace:: _`target` + +Make sure this substitution definition is not registered: |target| +""", +"""\ +<document source="test data"> + <paragraph> + Substitution definition with a target: + <system_message level="2" line="3" source="test data" type="WARNING"> + <paragraph> + Substitution definitions may not contain targets. + <literal_block xml:space="preserve"> + .. |target| replace:: _`target` + <paragraph> + Make sure this substitution definition is not registered: \n\ + <problematic ids="id2" refid="id1"> + |target| + <system_message backrefs="id2" ids="id1" level="3" line="5" source="test data" type="ERROR"> + <paragraph> + Undefined substitution referenced: "target". +"""], ]) -- cgit v1.2.1 From 8ca484acd7f7fbc2990475a22fb1089b022e5571 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Tue, 11 Oct 2005 19:34:52 +0000 Subject: added Node.deepcopy(); fixed bug with doubly-indirect substitutions git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3935 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_nodes.py | 22 ++++++++ test/test_transforms/test_substitutions.py | 88 +++++++++++++++--------------- 2 files changed, 65 insertions(+), 45 deletions(-) (limited to 'test') diff --git a/test/test_nodes.py b/test/test_nodes.py index 42a64ad49..4471b3a15 100755 --- a/test/test_nodes.py +++ b/test/test_nodes.py @@ -242,6 +242,28 @@ class MiscTests(unittest.TestCase): def not_in_testlist(self, x): return x not in self.testlist + def test_copy(self): + grandchild = nodes.Text('rawsource') + child = nodes.emphasis('rawsource', grandchild, att='child') + e = nodes.Element('rawsource', child, att='e') + # Shallow copy: + e_copy = e.copy() + self.assert_(e is not e_copy) + # Internal attributes (like `rawsource`) are not copied. + self.assertEquals(e.rawsource, 'rawsource') + self.assertEquals(e_copy.rawsource, '') + self.assertEquals(e_copy['att'], 'e') + # Children are not copied. + self.assertEquals(len(e_copy), 0) + # Deep copy: + e_deepcopy = e.deepcopy() + self.assertEquals(e_deepcopy.rawsource, '') + self.assertEquals(e_deepcopy['att'], 'e') + # Children are copied recursively. + self.assertEquals(e_deepcopy[0][0], grandchild) + self.assert_(e_deepcopy[0][0] is not grandchild) + self.assertEquals(e_deepcopy[0]['att'], 'child') + class TreeCopyVisitorTests(unittest.TestCase): diff --git a/test/test_transforms/test_substitutions.py b/test/test_transforms/test_substitutions.py index 8a09fe109..ba98e1aa1 100755 --- a/test/test_transforms/test_substitutions.py +++ b/test/test_transforms/test_substitutions.py @@ -101,51 +101,49 @@ u"""\ <substitution_definition names="replace"> swap """], -#["""\ -#.. |l| unicode:: U+00AB .. left chevron -#.. |r| unicode:: U+00BB .. right chevron -#.. |.| replace:: |l|\ ``.``\ |r| -# -#.. Delete either of the following lines, and there is no error. -# -#Regular expression |.| will match any character -# -#.. Note:: Note that |.| matches *exactly* one character -#""", -#u"""\ -#<document source="test data"> -# <substitution_definition names="l"> -# \xab -# <substitution_definition names="r"> -# \xbb -# <substitution_definition names="."> -# <substitution_reference refname="l"> -# l -# <literal> -# . -# <substitution_reference refname="r"> -# r -# <comment xml:space="preserve"> -# Delete either of the following lines, and there is no error. -# <paragraph> -# Regular expression \n\ -# \xab -# <literal> -# . -# \xbb -# will match any character -# <note> -# <paragraph> -# Note that \n\ -# \xab -# <literal> -# . -# \xbb -# matches \n\ -# <emphasis> -# exactly -# one character -#"""], +["""\ +.. |l| unicode:: U+00AB .. left chevron +.. |r| unicode:: U+00BB .. right chevron +.. |.| replace:: |l|\ ``.``\ |r| + +.. Delete either of the following lines, and there is no error. + +Regular expression |.| will match any character + +.. Note:: Note that |.| matches *exactly* one character +""", +u"""\ +<document source="test data"> + <substitution_definition names="l"> + \xab + <substitution_definition names="r"> + \xbb + <substitution_definition names="."> + \xab + <literal> + . + \xbb + <comment xml:space="preserve"> + Delete either of the following lines, and there is no error. + <paragraph> + Regular expression \n\ + \xab + <literal> + . + \xbb + will match any character + <note> + <paragraph> + Note that \n\ + \xab + <literal> + . + \xbb + matches \n\ + <emphasis> + exactly + one character +"""], ]) totest['unicode'] = ((Substitutions,), [ -- cgit v1.2.1 From 7068fae26ee297f883adf5f884fd64b0892b2a70 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Tue, 11 Oct 2005 20:40:41 +0000 Subject: disallow anonymous hyperlink references and auto-numbered footnotes inside of substitution definitions git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3937 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_parsers/test_rst/test_substitutions.py | 28 ++++++++++++++++++++---- test/test_transforms/test_substitutions.py | 11 ++++++---- 2 files changed, 31 insertions(+), 8 deletions(-) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_substitutions.py b/test/test_parsers/test_rst/test_substitutions.py index 7210819b0..fb8af4c2d 100755 --- a/test/test_parsers/test_rst/test_substitutions.py +++ b/test/test_parsers/test_rst/test_substitutions.py @@ -256,19 +256,39 @@ No blank line after. | """], ["""\ -Substitution definition with a target: +Elements that are prohibited inside of substitution definitions: .. |target| replace:: _`target` +.. |reference| replace:: anonymous__ +.. |auto-numbered footnote| replace:: [#]_ """, """\ <document source="test data"> <paragraph> - Substitution definition with a target: - <system_message level="2" line="3" source="test data" type="WARNING"> + Elements that are prohibited inside of substitution definitions: + <system_message level="3" line="3" source="test data" type="ERROR"> <paragraph> - Substitution definitions may not contain targets. + Substitution definition contains illegal element: + <literal_block xml:space="preserve"> + <target ids="target" names="target"> + target <literal_block xml:space="preserve"> .. |target| replace:: _`target` + <system_message level="3" line="4" source="test data" type="ERROR"> + <paragraph> + Substitution definition contains illegal element: + <literal_block xml:space="preserve"> + <reference anonymous="1" name="anonymous"> + anonymous + <literal_block xml:space="preserve"> + .. |reference| replace:: anonymous__ + <system_message level="3" line="5" source="test data" type="ERROR"> + <paragraph> + Substitution definition contains illegal element: + <literal_block xml:space="preserve"> + <footnote_reference auto="1" ids="id1"> + <literal_block xml:space="preserve"> + .. |auto-numbered footnote| replace:: [#]_ """], ] diff --git a/test/test_transforms/test_substitutions.py b/test/test_transforms/test_substitutions.py index ba98e1aa1..aa3a7c6f6 100755 --- a/test/test_transforms/test_substitutions.py +++ b/test/test_transforms/test_substitutions.py @@ -235,7 +235,7 @@ u"""\ \u2122 """], ["""\ -Substitution definition with a target: +Substitution definition with an illegal element: .. |target| replace:: _`target` @@ -244,10 +244,13 @@ Make sure this substitution definition is not registered: |target| """\ <document source="test data"> <paragraph> - Substitution definition with a target: - <system_message level="2" line="3" source="test data" type="WARNING"> + Substitution definition with an illegal element: + <system_message level="3" line="3" source="test data" type="ERROR"> <paragraph> - Substitution definitions may not contain targets. + Substitution definition contains illegal element: + <literal_block xml:space="preserve"> + <target ids="target" names="target"> + target <literal_block xml:space="preserve"> .. |target| replace:: _`target` <paragraph> -- cgit v1.2.1 From c8c683761645534bb45877a851b966451f490024 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Tue, 11 Oct 2005 21:22:01 +0000 Subject: added a functional test for target footnotes for anonymous targets git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3938 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../expected/standalone_rst_html4css1.html | 266 ++++++++++--------- test/functional/expected/standalone_rst_latex.tex | 56 ++-- .../expected/standalone_rst_pseudoxml.txt | 292 +++++++++++---------- test/functional/input/data/standard.txt | 22 +- 4 files changed, 334 insertions(+), 302 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index 8a8def5e9..e14d5a72d 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -88,68 +88,68 @@ They are transformed from section titles after parsing. --> <div class="contents topic"> <p class="topic-title first"><a id="table-of-contents" name="table-of-contents">Table of Contents</a></p> <ul class="auto-toc simple"> -<li><a class="reference" href="#structural-elements" id="id27" name="id27">1   Structural Elements</a><ul class="auto-toc"> -<li><a class="reference" href="#section-title" id="id28" name="id28">1.1   Section Title</a></li> -<li><a class="reference" href="#empty-section" id="id29" name="id29">1.2   Empty Section</a></li> -<li><a class="reference" href="#transitions" id="id30" name="id30">1.3   Transitions</a></li> +<li><a class="reference" href="#structural-elements" id="id32" name="id32">1   Structural Elements</a><ul class="auto-toc"> +<li><a class="reference" href="#section-title" id="id33" name="id33">1.1   Section Title</a></li> +<li><a class="reference" href="#empty-section" id="id34" name="id34">1.2   Empty Section</a></li> +<li><a class="reference" href="#transitions" id="id35" name="id35">1.3   Transitions</a></li> </ul> </li> -<li><a class="reference" href="#body-elements" id="id31" name="id31">2   Body Elements</a><ul class="auto-toc"> -<li><a class="reference" href="#paragraphs" id="id32" name="id32">2.1   Paragraphs</a><ul class="auto-toc"> -<li><a class="reference" href="#inline-markup" id="id33" name="id33">2.1.1   Inline Markup</a></li> +<li><a class="reference" href="#body-elements" id="id36" name="id36">2   Body Elements</a><ul class="auto-toc"> +<li><a class="reference" href="#paragraphs" id="id37" name="id37">2.1   Paragraphs</a><ul class="auto-toc"> +<li><a class="reference" href="#inline-markup" id="id38" name="id38">2.1.1   Inline Markup</a></li> </ul> </li> -<li><a class="reference" href="#bullet-lists" id="id34" name="id34">2.2   Bullet Lists</a></li> -<li><a class="reference" href="#enumerated-lists" id="id35" name="id35">2.3   Enumerated Lists</a></li> -<li><a class="reference" href="#definition-lists" id="id36" name="id36">2.4   Definition Lists</a></li> -<li><a class="reference" href="#field-lists" id="id37" name="id37">2.5   Field Lists</a></li> -<li><a class="reference" href="#option-lists" id="id38" name="id38">2.6   Option Lists</a></li> -<li><a class="reference" href="#literal-blocks" id="id39" name="id39">2.7   Literal Blocks</a></li> -<li><a class="reference" href="#line-blocks" id="id40" name="id40">2.8   Line Blocks</a></li> -<li><a class="reference" href="#block-quotes" id="id41" name="id41">2.9   Block Quotes</a></li> -<li><a class="reference" href="#doctest-blocks" id="id42" name="id42">2.10   Doctest Blocks</a></li> -<li><a class="reference" href="#footnotes" id="id43" name="id43">2.11   Footnotes</a></li> -<li><a class="reference" href="#citations" id="id44" name="id44">2.12   Citations</a></li> -<li><a class="reference" href="#targets" id="id45" name="id45">2.13   Targets</a><ul class="auto-toc"> -<li><a class="reference" href="#duplicate-target-names" id="id46" name="id46">2.13.1   Duplicate Target Names</a></li> -<li><a class="reference" href="#id18" id="id47" name="id47">2.13.2   Duplicate Target Names</a></li> +<li><a class="reference" href="#bullet-lists" id="id39" name="id39">2.2   Bullet Lists</a></li> +<li><a class="reference" href="#enumerated-lists" id="id40" name="id40">2.3   Enumerated Lists</a></li> +<li><a class="reference" href="#definition-lists" id="id41" name="id41">2.4   Definition Lists</a></li> +<li><a class="reference" href="#field-lists" id="id42" name="id42">2.5   Field Lists</a></li> +<li><a class="reference" href="#option-lists" id="id43" name="id43">2.6   Option Lists</a></li> +<li><a class="reference" href="#literal-blocks" id="id44" name="id44">2.7   Literal Blocks</a></li> +<li><a class="reference" href="#line-blocks" id="id45" name="id45">2.8   Line Blocks</a></li> +<li><a class="reference" href="#block-quotes" id="id46" name="id46">2.9   Block Quotes</a></li> +<li><a class="reference" href="#doctest-blocks" id="id47" name="id47">2.10   Doctest Blocks</a></li> +<li><a class="reference" href="#footnotes" id="id48" name="id48">2.11   Footnotes</a></li> +<li><a class="reference" href="#citations" id="id49" name="id49">2.12   Citations</a></li> +<li><a class="reference" href="#targets" id="id50" name="id50">2.13   Targets</a><ul class="auto-toc"> +<li><a class="reference" href="#duplicate-target-names" id="id51" name="id51">2.13.1   Duplicate Target Names</a></li> +<li><a class="reference" href="#id20" id="id52" name="id52">2.13.2   Duplicate Target Names</a></li> </ul> </li> -<li><a class="reference" href="#directives" id="id48" name="id48">2.14   Directives</a><ul class="auto-toc"> -<li><a class="reference" href="#document-parts" id="id49" name="id49">2.14.1   Document Parts</a></li> -<li><a class="reference" href="#images" id="id50" name="id50">2.14.2   Images</a></li> -<li><a class="reference" href="#admonitions" id="id51" name="id51">2.14.3   Admonitions</a></li> -<li><a class="reference" href="#topics-sidebars-and-rubrics" id="id52" name="id52">2.14.4   Topics, Sidebars, and Rubrics</a></li> -<li><a class="reference" href="#target-footnotes" id="id53" name="id53">2.14.5   Target Footnotes</a></li> -<li><a class="reference" href="#replacement-text" id="id54" name="id54">2.14.6   Replacement Text</a></li> -<li><a class="reference" href="#compound-paragraph" id="id55" name="id55">2.14.7   Compound Paragraph</a></li> -<li><a class="reference" href="#parsed-literal-blocks" id="id56" name="id56">2.14.8   Parsed Literal Blocks</a></li> +<li><a class="reference" href="#directives" id="id53" name="id53">2.14   Directives</a><ul class="auto-toc"> +<li><a class="reference" href="#document-parts" id="id54" name="id54">2.14.1   Document Parts</a></li> +<li><a class="reference" href="#images" id="id55" name="id55">2.14.2   Images</a></li> +<li><a class="reference" href="#admonitions" id="id56" name="id56">2.14.3   Admonitions</a></li> +<li><a class="reference" href="#topics-sidebars-and-rubrics" id="id57" name="id57">2.14.4   Topics, Sidebars, and Rubrics</a></li> +<li><a class="reference" href="#target-footnotes" id="id58" name="id58">2.14.5   Target Footnotes</a></li> +<li><a class="reference" href="#replacement-text" id="id59" name="id59">2.14.6   Replacement Text</a></li> +<li><a class="reference" href="#compound-paragraph" id="id60" name="id60">2.14.7   Compound Paragraph</a></li> +<li><a class="reference" href="#parsed-literal-blocks" id="id61" name="id61">2.14.8   Parsed Literal Blocks</a></li> </ul> </li> -<li><a class="reference" href="#substitution-definitions" id="id57" name="id57">2.15   Substitution Definitions</a></li> -<li><a class="reference" href="#comments" id="id58" name="id58">2.16   Comments</a></li> -<li><a class="reference" href="#raw-text" id="id59" name="id59">2.17   Raw text</a></li> -<li><a class="reference" href="#colspanning-tables" id="id60" name="id60">2.18   Colspanning tables</a></li> -<li><a class="reference" href="#rowspanning-tables" id="id61" name="id61">2.19   Rowspanning tables</a></li> -<li><a class="reference" href="#complex-tables" id="id62" name="id62">2.20   Complex tables</a></li> -<li><a class="reference" href="#list-tables" id="id63" name="id63">2.21   List Tables</a></li> +<li><a class="reference" href="#substitution-definitions" id="id62" name="id62">2.15   Substitution Definitions</a></li> +<li><a class="reference" href="#comments" id="id63" name="id63">2.16   Comments</a></li> +<li><a class="reference" href="#raw-text" id="id64" name="id64">2.17   Raw text</a></li> +<li><a class="reference" href="#colspanning-tables" id="id65" name="id65">2.18   Colspanning tables</a></li> +<li><a class="reference" href="#rowspanning-tables" id="id66" name="id66">2.19   Rowspanning tables</a></li> +<li><a class="reference" href="#complex-tables" id="id67" name="id67">2.20   Complex tables</a></li> +<li><a class="reference" href="#list-tables" id="id68" name="id68">2.21   List Tables</a></li> </ul> </li> -<li><a class="reference" href="#error-handling" id="id64" name="id64">3   Error Handling</a></li> +<li><a class="reference" href="#error-handling" id="id69" name="id69">3   Error Handling</a></li> </ul> </div> <div class="section"> -<h1><a class="toc-backref" href="#id27" id="structural-elements" name="structural-elements">1   Structural Elements</a></h1> +<h1><a class="toc-backref" href="#id32" id="structural-elements" name="structural-elements">1   Structural Elements</a></h1> <div class="section"> -<h2 class="with-subtitle"><a class="toc-backref" href="#id28" id="section-title" name="section-title">1.1   Section Title</a></h2> +<h2 class="with-subtitle"><a class="toc-backref" href="#id33" id="section-title" name="section-title">1.1   Section Title</a></h2> <h2 class="section-subtitle" id="section-subtitle"><span class="section-subtitle">Section Subtitle</span></h2> <p>That's it, the text just above this line.</p> </div> <div class="section"> -<h2><a class="toc-backref" href="#id29" id="empty-section" name="empty-section">1.2   Empty Section</a></h2> +<h2><a class="toc-backref" href="#id34" id="empty-section" name="empty-section">1.2   Empty Section</a></h2> </div> <div class="section"> -<h2><a class="toc-backref" href="#id30" id="transitions" name="transitions">1.3   Transitions</a></h2> +<h2><a class="toc-backref" href="#id35" id="transitions" name="transitions">1.3   Transitions</a></h2> <p>Here's a transition:</p> <hr class="docutils" /> <p>It divides the section. Transitions may also occur between sections:</p> @@ -157,25 +157,25 @@ They are transformed from section titles after parsing. --> </div> <hr class="docutils" /> <div class="section"> -<h1><a class="toc-backref" href="#id31" id="body-elements" name="body-elements">2   Body Elements</a></h1> +<h1><a class="toc-backref" href="#id36" id="body-elements" name="body-elements">2   Body Elements</a></h1> <div class="section"> -<h2><a class="toc-backref" href="#id32" id="paragraphs" name="paragraphs">2.1   Paragraphs</a></h2> +<h2><a class="toc-backref" href="#id37" id="paragraphs" name="paragraphs">2.1   Paragraphs</a></h2> <p>A paragraph.</p> <div class="section"> -<h3><a class="toc-backref" href="#id33" id="inline-markup" name="inline-markup">2.1.1   Inline Markup</a></h3> +<h3><a class="toc-backref" href="#id38" id="inline-markup" name="inline-markup">2.1.1   Inline Markup</a></h3> <p>Paragraphs contain text and may contain inline markup: <em>emphasis</em>, <strong>strong emphasis</strong>, <tt class="docutils literal"><span class="pre">inline</span> <span class="pre">literals</span></tt>, standalone hyperlinks -(<a class="reference" href="http://www.python.org">http://www.python.org</a>), external hyperlinks (<a class="reference" href="http://www.python.org/">Python</a> <a class="footnote-reference" href="#id23" id="id24" name="id24">[5]</a>), internal +(<a class="reference" href="http://www.python.org">http://www.python.org</a>), external hyperlinks (<a class="reference" href="http://www.python.org/">Python</a> <a class="footnote-reference" href="#id25" id="id26" name="id26">[5]</a>), internal cross-references (<a class="reference" href="#example">example</a>), external hyperlinks with embedded URIs -(<a class="reference" href="http://www.python.org">Python web site</a>), footnote references -(manually numbered <a class="footnote-reference" href="#id6" id="id1" name="id1">[1]</a>, anonymous auto-numbered <a class="footnote-reference" href="#id9" id="id2" name="id2">[3]</a>, labeled -auto-numbered <a class="footnote-reference" href="#label" id="id3" name="id3">[2]</a>, or symbolic <a class="footnote-reference" href="#id10" id="id4" name="id4">[*]</a>), citation references -(<a class="citation-reference" href="#cit2002" id="id5" name="id5">[CIT2002]</a>), substitution references (<img alt="EXAMPLE" src="../../../docs/user/rst/images/biohazard.png" />), and <span class="target" id="inline-hyperlink-targets">inline -hyperlink targets</span> (see <a class="reference" href="#id20">Targets</a> below for a reference back to here). -Character-level inline markup is also possible (although exceedingly -ugly!) in <em>re</em><tt class="docutils literal"><span class="pre">Structured</span></tt><em>Text</em>. Problems are indicated by -<a href="#id21" name="id22"><span class="problematic" id="id22">|problematic|</span></a> text (generated by processing errors; this one is -intentional). Here is a reference to the <a class="reference" href="#doctitle">doctitle</a> and the <a class="reference" href="#subtitle">subtitle</a>.</p> +(<a class="reference" href="http://www.python.org">Python web site</a>), <a class="reference" href="http://www.python.org/">anonymous hyperlink +references</a> <a class="footnote-reference" href="#id25" id="id29" name="id29">[5]</a> (<a class="reference" href="http://docutils.sourceforge.net/">a second reference</a> <a class="footnote-reference" href="#id30" id="id31" name="id31">[6]</a>), footnote references (manually +numbered <a class="footnote-reference" href="#id8" id="id1" name="id1">[1]</a>, anonymous auto-numbered <a class="footnote-reference" href="#id11" id="id2" name="id2">[3]</a>, labeled auto-numbered +<a class="footnote-reference" href="#label" id="id3" name="id3">[2]</a>, or symbolic <a class="footnote-reference" href="#id12" id="id4" name="id4">[*]</a>), citation references (<a class="citation-reference" href="#cit2002" id="id5" name="id5">[CIT2002]</a>), +substitution references (<img alt="EXAMPLE" src="../../../docs/user/rst/images/biohazard.png" />), and <span class="target" id="inline-hyperlink-targets">inline hyperlink targets</span> +(see <a class="reference" href="#id22">Targets</a> below for a reference back to here). Character-level +inline markup is also possible (although exceedingly ugly!) in <em>re</em><tt class="docutils literal"><span class="pre">Structured</span></tt><em>Text</em>. Problems are indicated by <a href="#id23" name="id24"><span class="problematic" id="id24">|problematic|</span></a> text +(generated by processing errors; this one is intentional). Here is a +reference to the <a class="reference" href="#doctitle">doctitle</a> and the <a class="reference" href="#subtitle">subtitle</a>.</p> <p>The default role for interpreted text is <cite>Title Reference</cite>. Here are some explicit interpreted text roles: a PEP reference (<a class="reference" href="http://www.python.org/peps/pep-0287.html">PEP 287</a>); an RFC reference (<a class="reference" href="http://www.faqs.org/rfcs/rfc2822.html">RFC 2822</a>); a <sub>subscript</sub>; a <sup>superscript</sup>; @@ -193,7 +193,7 @@ live link to PEP 258 here.</p> </div> </div> <div class="section"> -<h2><a class="toc-backref" href="#id34" id="bullet-lists" name="bullet-lists">2.2   Bullet Lists</a></h2> +<h2><a class="toc-backref" href="#id39" id="bullet-lists" name="bullet-lists">2.2   Bullet Lists</a></h2> <ul> <li><p class="first">A bullet list</p> <ul class="simple"> @@ -218,7 +218,7 @@ live link to PEP 258 here.</p> </ul> </div> <div class="section"> -<h2><a class="toc-backref" href="#id35" id="enumerated-lists" name="enumerated-lists">2.3   Enumerated Lists</a></h2> +<h2><a class="toc-backref" href="#id40" id="enumerated-lists" name="enumerated-lists">2.3   Enumerated Lists</a></h2> <ol class="arabic"> <li><p class="first">Arabic numerals.</p> <ol class="loweralpha simple"> @@ -251,7 +251,7 @@ live link to PEP 258 here.</p> </ol> </div> <div class="section"> -<h2><a class="toc-backref" href="#id36" id="definition-lists" name="definition-lists">2.4   Definition Lists</a></h2> +<h2><a class="toc-backref" href="#id41" id="definition-lists" name="definition-lists">2.4   Definition Lists</a></h2> <dl class="docutils"> <dt>Term</dt> <dd>Definition</dd> @@ -266,7 +266,7 @@ live link to PEP 258 here.</p> </dl> </div> <div class="section"> -<h2><a class="toc-backref" href="#id37" id="field-lists" name="field-lists">2.5   Field Lists</a></h2> +<h2><a class="toc-backref" href="#id42" id="field-lists" name="field-lists">2.5   Field Lists</a></h2> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> @@ -290,7 +290,7 @@ doesn't get stripped away.)</p> </table> </div> <div class="section"> -<h2><a class="toc-backref" href="#id38" id="option-lists" name="option-lists">2.6   Option Lists</a></h2> +<h2><a class="toc-backref" href="#id43" id="option-lists" name="option-lists">2.6   Option Lists</a></h2> <p>For listing command-line options:</p> <table class="docutils option-list" frame="void" rules="none"> <col class="option" /> @@ -336,7 +336,7 @@ regardless of where it starts.</p> description.</p> </div> <div class="section"> -<h2><a class="toc-backref" href="#id39" id="literal-blocks" name="literal-blocks">2.7   Literal Blocks</a></h2> +<h2><a class="toc-backref" href="#id44" id="literal-blocks" name="literal-blocks">2.7   Literal Blocks</a></h2> <p>Literal blocks are indicated with a double-colon ("::") at the end of the preceding paragraph (over there <tt class="docutils literal"><span class="pre">--></span></tt>). They can be indented:</p> <pre class="literal-block"> @@ -353,7 +353,7 @@ if literal_block: </pre> </div> <div class="section"> -<h2><a class="toc-backref" href="#id40" id="line-blocks" name="line-blocks">2.8   Line Blocks</a></h2> +<h2><a class="toc-backref" href="#id45" id="line-blocks" name="line-blocks">2.8   Line Blocks</a></h2> <p>This section tests line blocks. Line blocks are body elements which consist of lines and other line blocks. Nested line blocks cause indentation.</p> @@ -412,7 +412,7 @@ the left edge of the text above it.</div> </blockquote> </div> <div class="section"> -<h2><a class="toc-backref" href="#id41" id="block-quotes" name="block-quotes">2.9   Block Quotes</a></h2> +<h2><a class="toc-backref" href="#id46" id="block-quotes" name="block-quotes">2.9   Block Quotes</a></h2> <p>Block quotes consist of indented body elements:</p> <blockquote> <p>My theory by A. Elk. Brackets Miss, brackets. This theory goes @@ -424,7 +424,7 @@ own it, and what it is too.</p> </blockquote> </div> <div class="section"> -<h2><a class="toc-backref" href="#id42" id="doctest-blocks" name="doctest-blocks">2.10   Doctest Blocks</a></h2> +<h2><a class="toc-backref" href="#id47" id="doctest-blocks" name="doctest-blocks">2.10   Doctest Blocks</a></h2> <pre class="doctest-block"> >>> print 'Python-specific usage examples; begun with ">>>"' Python-specific usage examples; begun with ">>>" @@ -433,11 +433,11 @@ Python-specific usage examples; begun with ">>>" </pre> </div> <div class="section"> -<h2><a class="toc-backref" href="#id43" id="footnotes" name="footnotes">2.11   Footnotes</a></h2> -<table class="docutils footnote" frame="void" id="id6" rules="none"> +<h2><a class="toc-backref" href="#id48" id="footnotes" name="footnotes">2.11   Footnotes</a></h2> +<table class="docutils footnote" frame="void" id="id8" rules="none"> <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> -<tr><td class="label"><a name="id6">[1]</a></td><td><em>(<a class="fn-backref" href="#id1">1</a>, <a class="fn-backref" href="#id7">2</a>, <a class="fn-backref" href="#id19">3</a>)</em> <p>A footnote contains body elements, consistently indented by at +<tr><td class="label"><a name="id8">[1]</a></td><td><em>(<a class="fn-backref" href="#id1">1</a>, <a class="fn-backref" href="#id9">2</a>, <a class="fn-backref" href="#id21">3</a>)</em> <p>A footnote contains body elements, consistently indented by at least 3 spaces.</p> <p class="last">This is the footnote's second paragraph.</p> </td></tr> @@ -446,107 +446,107 @@ least 3 spaces.</p> <table class="docutils footnote" frame="void" id="label" rules="none"> <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> -<tr><td class="label"><a name="label">[2]</a></td><td><em>(<a class="fn-backref" href="#id3">1</a>, <a class="fn-backref" href="#id8">2</a>)</em> Footnotes may be numbered, either manually (as in <a class="footnote-reference" href="#id6" id="id7" name="id7">[1]</a>) or +<tr><td class="label"><a name="label">[2]</a></td><td><em>(<a class="fn-backref" href="#id3">1</a>, <a class="fn-backref" href="#id10">2</a>)</em> Footnotes may be numbered, either manually (as in <a class="footnote-reference" href="#id8" id="id9" name="id9">[1]</a>) or automatically using a "#"-prefixed label. This footnote has a label so it can be referred to from multiple places, both as a -footnote reference (<a class="footnote-reference" href="#label" id="id8" name="id8">[2]</a>) and as a hyperlink reference +footnote reference (<a class="footnote-reference" href="#label" id="id10" name="id10">[2]</a>) and as a hyperlink reference (<a class="reference" href="#label">label</a>).</td></tr> </tbody> </table> -<table class="docutils footnote" frame="void" id="id9" rules="none"> +<table class="docutils footnote" frame="void" id="id11" rules="none"> <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> -<tr><td class="label"><a class="fn-backref" href="#id2" name="id9">[3]</a></td><td><p class="first">This footnote is numbered automatically and anonymously using a +<tr><td class="label"><a class="fn-backref" href="#id2" name="id11">[3]</a></td><td><p class="first">This footnote is numbered automatically and anonymously using a label of "#" only.</p> <p>This is the second paragraph.</p> <p class="last">And this is the third paragraph.</p> </td></tr> </tbody> </table> -<table class="docutils footnote" frame="void" id="id10" rules="none"> +<table class="docutils footnote" frame="void" id="id12" rules="none"> <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> -<tr><td class="label"><a class="fn-backref" href="#id4" name="id10">[*]</a></td><td>Footnotes may also use symbols, specified with a "*" label. -Here's a reference to the next footnote: <a class="footnote-reference" href="#id12" id="id11" name="id11">[†]</a>.</td></tr> +<tr><td class="label"><a class="fn-backref" href="#id4" name="id12">[*]</a></td><td>Footnotes may also use symbols, specified with a "*" label. +Here's a reference to the next footnote: <a class="footnote-reference" href="#id14" id="id13" name="id13">[†]</a>.</td></tr> </tbody> </table> -<table class="docutils footnote" frame="void" id="id12" rules="none"> +<table class="docutils footnote" frame="void" id="id14" rules="none"> <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> -<tr><td class="label"><a class="fn-backref" href="#id11" name="id12">[†]</a></td><td>This footnote shows the next symbol in the sequence.</td></tr> +<tr><td class="label"><a class="fn-backref" href="#id13" name="id14">[†]</a></td><td>This footnote shows the next symbol in the sequence.</td></tr> </tbody> </table> -<table class="docutils footnote" frame="void" id="id13" rules="none"> +<table class="docutils footnote" frame="void" id="id15" rules="none"> <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> -<tr><td class="label"><a name="id13">[4]</a></td><td>Here's an unreferenced footnote, with a reference to a -nonexistent footnote: <a href="#id73" name="id74"><span class="problematic" id="id74"><span id="id14"></span>[5]_</span></a>.</td></tr> +<tr><td class="label"><a name="id15">[4]</a></td><td>Here's an unreferenced footnote, with a reference to a +nonexistent footnote: <a href="#id78" name="id79"><span class="problematic" id="id79"><span id="id16"></span>[5]_</span></a>.</td></tr> </tbody> </table> </div> <div class="section"> -<h2><a class="toc-backref" href="#id44" id="citations" name="citations">2.12   Citations</a></h2> +<h2><a class="toc-backref" href="#id49" id="citations" name="citations">2.12   Citations</a></h2> <table class="docutils citation" frame="void" id="cit2002" rules="none"> <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> -<tr><td class="label"><a name="cit2002">[CIT2002]</a></td><td><em>(<a class="fn-backref" href="#id5">1</a>, <a class="fn-backref" href="#id15">2</a>)</em> Citations are text-labeled footnotes. They may be +<tr><td class="label"><a name="cit2002">[CIT2002]</a></td><td><em>(<a class="fn-backref" href="#id5">1</a>, <a class="fn-backref" href="#id17">2</a>)</em> Citations are text-labeled footnotes. They may be rendered separately and differently from footnotes.</td></tr> </tbody> </table> -<p>Here's a reference to the above, <a class="citation-reference" href="#cit2002" id="id15" name="id15">[CIT2002]</a>, and a <a href="#id75" name="id76"><span class="problematic" id="id76"><span id="id16"></span>[nonexistent]_</span></a> +<p>Here's a reference to the above, <a class="citation-reference" href="#cit2002" id="id17" name="id17">[CIT2002]</a>, and a <a href="#id80" name="id81"><span class="problematic" id="id81"><span id="id18"></span>[nonexistent]_</span></a> citation.</p> </div> <div class="section"> -<h2><a class="toc-backref" href="#id45" id="targets" name="targets"><span id="another-target"></span>2.13   Targets</a></h2> +<h2><a class="toc-backref" href="#id50" id="targets" name="targets"><span id="another-target"></span>2.13   Targets</a></h2> <p id="example">This paragraph is pointed to by the explicit "example" target. A reference can be found under <a class="reference" href="#inline-markup">Inline Markup</a>, above. <a class="reference" href="#inline-hyperlink-targets">Inline hyperlink targets</a> are also possible.</p> <p>Section headers are implicit targets, referred to by name. See -<a class="reference" href="#id20">Targets</a>, which is a subsection of <a class="reference" href="#body-elements">Body Elements</a>.</p> +<a class="reference" href="#id22">Targets</a>, which is a subsection of <a class="reference" href="#body-elements">Body Elements</a>.</p> <p>Explicit external targets are interpolated into references such as -"<a class="reference" href="http://www.python.org/">Python</a> <a class="footnote-reference" href="#id23" id="id25" name="id25">[5]</a>".</p> -<p>Targets may be indirect and anonymous. Thus <a class="reference" href="#id20">this phrase</a> may also -refer to the <a class="reference" href="#id20">Targets</a> section.</p> -<p>Here's a <a href="#id77" name="id78"><span class="problematic" id="id78">`hyperlink reference without a target`_</span></a>, which generates an +"<a class="reference" href="http://www.python.org/">Python</a> <a class="footnote-reference" href="#id25" id="id27" name="id27">[5]</a>".</p> +<p>Targets may be indirect and anonymous. Thus <a class="reference" href="#id22">this phrase</a> may also +refer to the <a class="reference" href="#id22">Targets</a> section.</p> +<p>Here's a <a href="#id82" name="id83"><span class="problematic" id="id83">`hyperlink reference without a target`_</span></a>, which generates an error.</p> <div class="section"> -<h3><a class="toc-backref" href="#id46" id="duplicate-target-names" name="duplicate-target-names">2.13.1   Duplicate Target Names</a></h3> +<h3><a class="toc-backref" href="#id51" id="duplicate-target-names" name="duplicate-target-names">2.13.1   Duplicate Target Names</a></h3> <p>Duplicate names in section headers or other implicit targets will generate "info" (level-1) system messages. Duplicate names in explicit targets will generate "warning" (level-2) system messages.</p> </div> <div class="section"> -<h3><a class="toc-backref" href="#id47" id="id18" name="id18">2.13.2   Duplicate Target Names</a></h3> +<h3><a class="toc-backref" href="#id52" id="id20" name="id20">2.13.2   Duplicate Target Names</a></h3> <p>Since there are two "Duplicate Target Names" section headers, we cannot uniquely refer to either of them by name. If we try to (like -this: <a href="#id79" name="id80"><span class="problematic" id="id80">`Duplicate Target Names`_</span></a>), an error is generated.</p> +this: <a href="#id84" name="id85"><span class="problematic" id="id85">`Duplicate Target Names`_</span></a>), an error is generated.</p> </div> </div> <div class="section"> -<h2><a class="toc-backref" href="#id48" id="directives" name="directives">2.14   Directives</a></h2> +<h2><a class="toc-backref" href="#id53" id="directives" name="directives">2.14   Directives</a></h2> <div class="contents local topic"> <ul class="auto-toc simple"> -<li><a class="reference" href="#document-parts" id="id65" name="id65">2.14.1   Document Parts</a></li> -<li><a class="reference" href="#images" id="id66" name="id66">2.14.2   Images</a></li> -<li><a class="reference" href="#admonitions" id="id67" name="id67">2.14.3   Admonitions</a></li> -<li><a class="reference" href="#topics-sidebars-and-rubrics" id="id68" name="id68">2.14.4   Topics, Sidebars, and Rubrics</a></li> -<li><a class="reference" href="#target-footnotes" id="id69" name="id69">2.14.5   Target Footnotes</a></li> -<li><a class="reference" href="#replacement-text" id="id70" name="id70">2.14.6   Replacement Text</a></li> -<li><a class="reference" href="#compound-paragraph" id="id71" name="id71">2.14.7   Compound Paragraph</a></li> -<li><a class="reference" href="#parsed-literal-blocks" id="id72" name="id72">2.14.8   Parsed Literal Blocks</a></li> +<li><a class="reference" href="#document-parts" id="id70" name="id70">2.14.1   Document Parts</a></li> +<li><a class="reference" href="#images" id="id71" name="id71">2.14.2   Images</a></li> +<li><a class="reference" href="#admonitions" id="id72" name="id72">2.14.3   Admonitions</a></li> +<li><a class="reference" href="#topics-sidebars-and-rubrics" id="id73" name="id73">2.14.4   Topics, Sidebars, and Rubrics</a></li> +<li><a class="reference" href="#target-footnotes" id="id74" name="id74">2.14.5   Target Footnotes</a></li> +<li><a class="reference" href="#replacement-text" id="id75" name="id75">2.14.6   Replacement Text</a></li> +<li><a class="reference" href="#compound-paragraph" id="id76" name="id76">2.14.7   Compound Paragraph</a></li> +<li><a class="reference" href="#parsed-literal-blocks" id="id77" name="id77">2.14.8   Parsed Literal Blocks</a></li> </ul> </div> <p>These are just a sample of the many reStructuredText Directives. For others, please see <a class="reference" href="http://docutils.sourceforge.net/docs/ref/rst/directives.html">http://docutils.sourceforge.net/docs/ref/rst/directives.html</a>.</p> <div class="section"> -<h3><a class="toc-backref" href="#id65" id="document-parts" name="document-parts">2.14.1   Document Parts</a></h3> +<h3><a class="toc-backref" href="#id70" id="document-parts" name="document-parts">2.14.1   Document Parts</a></h3> <p>An example of the "contents" directive can be seen above this section (a local, untitled table of <a class="reference" href="#contents">contents</a>) and at the beginning of the document (a document-wide <a class="reference" href="#table-of-contents">table of contents</a>).</p> </div> <div class="section"> -<h3><a class="toc-backref" href="#id66" id="images" name="images">2.14.2   Images</a></h3> +<h3><a class="toc-backref" href="#id71" id="images" name="images">2.14.2   Images</a></h3> <p>An image directive (also clickable -- a hyperlink reference):</p> <a class="reference image-reference" href="#directives"><img alt="../../../docs/user/rst/images/title.png" class="class1 class2" src="../../../docs/user/rst/images/title.png" /></a> <p>Image with multiple IDs:</p> @@ -614,7 +614,7 @@ document (a document-wide <a class="reference" href="#table-of-contents">table o <img alt="../../../docs/user/rst/images/biohazard.png" src="../../../docs/user/rst/images/biohazard.png" style="height: 3cm;" /> </div> <div class="section"> -<h3><a class="toc-backref" href="#id67" id="admonitions" name="admonitions">2.14.3   Admonitions</a></h3> +<h3><a class="toc-backref" href="#id72" id="admonitions" name="admonitions">2.14.3   Admonitions</a></h3> <div class="attention"> <p class="first admonition-title">Attention!</p> <p class="last">Directives at large.</p> @@ -663,7 +663,7 @@ Reader discretion is strongly advised.</p> </div> </div> <div class="section"> -<h3><a class="toc-backref" href="#id68" id="topics-sidebars-and-rubrics" name="topics-sidebars-and-rubrics">2.14.4   Topics, Sidebars, and Rubrics</a></h3> +<h3><a class="toc-backref" href="#id73" id="topics-sidebars-and-rubrics" name="topics-sidebars-and-rubrics">2.14.4   Topics, Sidebars, and Rubrics</a></h3> <div class="sidebar"> <p class="first sidebar-title">Sidebar Title</p> <p class="sidebar-subtitle">Optional Subtitle</p> @@ -680,20 +680,26 @@ background color.</p> <p class="rubric">This is a rubric</p> </div> <div class="section"> -<h3><a class="toc-backref" href="#id69" id="target-footnotes" name="target-footnotes">2.14.5   Target Footnotes</a></h3> -<table class="docutils footnote" frame="void" id="id23" rules="none"> +<h3><a class="toc-backref" href="#id74" id="target-footnotes" name="target-footnotes">2.14.5   Target Footnotes</a></h3> +<table class="docutils footnote" frame="void" id="id25" rules="none"> +<colgroup><col class="label" /><col /></colgroup> +<tbody valign="top"> +<tr><td class="label"><a name="id25">[5]</a></td><td><em>(<a class="fn-backref" href="#id26">1</a>, <a class="fn-backref" href="#id27">2</a>, <a class="fn-backref" href="#id28">3</a>, <a class="fn-backref" href="#id29">4</a>)</em> <a class="reference" href="http://www.python.org/">http://www.python.org/</a></td></tr> +</tbody> +</table> +<table class="docutils footnote" frame="void" id="id30" rules="none"> <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> -<tr><td class="label"><a name="id23">[5]</a></td><td><em>(<a class="fn-backref" href="#id24">1</a>, <a class="fn-backref" href="#id25">2</a>, <a class="fn-backref" href="#id26">3</a>)</em> <a class="reference" href="http://www.python.org/">http://www.python.org/</a></td></tr> +<tr><td class="label"><a class="fn-backref" href="#id31" name="id30">[6]</a></td><td><a class="reference" href="http://docutils.sourceforge.net/">http://docutils.sourceforge.net/</a></td></tr> </tbody> </table> </div> <div class="section"> -<h3><a class="toc-backref" href="#id70" id="replacement-text" name="replacement-text">2.14.6   Replacement Text</a></h3> -<p>I recommend you try <a class="reference" href="http://www.python.org/">Python, <em>the</em> best language around</a> <a class="footnote-reference" href="#id23" id="id26" name="id26">[5]</a>.</p> +<h3><a class="toc-backref" href="#id75" id="replacement-text" name="replacement-text">2.14.6   Replacement Text</a></h3> +<p>I recommend you try <a class="reference" href="http://www.python.org/">Python, <em>the</em> best language around</a> <a class="footnote-reference" href="#id25" id="id28" name="id28">[5]</a>.</p> </div> <div class="section"> -<h3><a class="toc-backref" href="#id71" id="compound-paragraph" name="compound-paragraph">2.14.7   Compound Paragraph</a></h3> +<h3><a class="toc-backref" href="#id76" id="compound-paragraph" name="compound-paragraph">2.14.7   Compound Paragraph</a></h3> <div class="some-class compound"> <p class="compound-first">Compound 1, paragraph 1.</p> <p class="compound-middle">Compound 1, paragraph 2.</p> @@ -761,23 +767,23 @@ paragraph.</td> </div> </div> <div class="section"> -<h3><a class="toc-backref" href="#id72" id="parsed-literal-blocks" name="parsed-literal-blocks">2.14.8   Parsed Literal Blocks</a></h3> +<h3><a class="toc-backref" href="#id77" id="parsed-literal-blocks" name="parsed-literal-blocks">2.14.8   Parsed Literal Blocks</a></h3> <pre class="literal-block"> This is a parsed literal block. This line is indented. The next line is blank. Inline markup is supported, e.g. <em>emphasis</em>, <strong>strong</strong>, <tt class="docutils literal"><span class="pre">literal</span> -<span class="pre">text</span></tt>, footnotes <a class="footnote-reference" href="#id6" id="id19" name="id19">[1]</a>, <span class="target" id="id20">targets</span>, and <a class="reference" href="http://www.python.org/">references</a>. +<span class="pre">text</span></tt>, footnotes <a class="footnote-reference" href="#id8" id="id21" name="id21">[1]</a>, <span class="target" id="id22">targets</span>, and <a class="reference" href="http://www.python.org/">references</a>. </pre> </div> </div> <div class="section"> -<h2><a class="toc-backref" href="#id57" id="substitution-definitions" name="substitution-definitions">2.15   Substitution Definitions</a></h2> +<h2><a class="toc-backref" href="#id62" id="substitution-definitions" name="substitution-definitions">2.15   Substitution Definitions</a></h2> <p>An inline image (<img alt="EXAMPLE" src="../../../docs/user/rst/images/biohazard.png" />) example:</p> <p>(Substitution definitions are not visible in the HTML source.)</p> </div> <div class="section"> -<h2><a class="toc-backref" href="#id58" id="comments" name="comments">2.16   Comments</a></h2> +<h2><a class="toc-backref" href="#id63" id="comments" name="comments">2.16   Comments</a></h2> <p>Here's one:</p> <!-- Comments begin with two dots and a space. Anything may follow, except for the syntax of footnotes, hyperlink @@ -787,13 +793,13 @@ Double-dashes - - "- -" - - must be escaped somehow in HTML output. --> <p>(View the HTML source to see the comment.)</p> </div> <div class="section"> -<h2><a class="toc-backref" href="#id59" id="raw-text" name="raw-text">2.17   Raw text</a></h2> +<h2><a class="toc-backref" href="#id64" id="raw-text" name="raw-text">2.17   Raw text</a></h2> <p>This does not necessarily look nice, because there may be missing white space.</p> <p>It's just there to freeze the behavior.</p> A test.Second test.<div class="myclass">Another test with myclass set.</div><p>This is the <span class="myrawroleclass">fourth test</span> with myrawroleclass set.</p> Fifth test in HTML.<br />Line two.</div> <div class="section"> -<h2><a class="toc-backref" href="#id60" id="colspanning-tables" name="colspanning-tables">2.18   Colspanning tables</a></h2> +<h2><a class="toc-backref" href="#id65" id="colspanning-tables" name="colspanning-tables">2.18   Colspanning tables</a></h2> <p>This table has a cell spanning two columns:</p> <table border="1" class="docutils"> <colgroup> @@ -831,7 +837,7 @@ Fifth test in HTML.<br />Line two.</div> </table> </div> <div class="section"> -<h2><a class="toc-backref" href="#id61" id="rowspanning-tables" name="rowspanning-tables">2.19   Rowspanning tables</a></h2> +<h2><a class="toc-backref" href="#id66" id="rowspanning-tables" name="rowspanning-tables">2.19   Rowspanning tables</a></h2> <p>Here's a table with cells spanning several rows:</p> <table border="1" class="docutils"> <colgroup> @@ -864,7 +870,7 @@ cell.</td> </table> </div> <div class="section"> -<h2><a class="toc-backref" href="#id62" id="complex-tables" name="complex-tables">2.20   Complex tables</a></h2> +<h2><a class="toc-backref" href="#id67" id="complex-tables" name="complex-tables">2.20   Complex tables</a></h2> <p>Here's a complex table, which should test all features.</p> <table border="1" class="docutils"> <colgroup> @@ -913,7 +919,7 @@ empty: <tt class="docutils literal"><span class="pre">--></span></tt></td> </table> </div> <div class="section"> -<h2><a class="toc-backref" href="#id63" id="list-tables" name="list-tables">2.21   List Tables</a></h2> +<h2><a class="toc-backref" href="#id68" id="list-tables" name="list-tables">2.21   List Tables</a></h2> <p>Here's a list table exercising all features:</p> <table border="1" class="test docutils"> <caption>list table with integral header</caption> @@ -947,7 +953,7 @@ crunchy, now would it?</td> </div> </div> <div class="section"> -<h1><a class="toc-backref" href="#id64" id="error-handling" name="error-handling">3   Error Handling</a></h1> +<h1><a class="toc-backref" href="#id69" id="error-handling" name="error-handling">3   Error Handling</a></h1> <p>Any errors caught during processing will generate system messages.</p> <p>There should be five messages in the following, auto-generated section, "Docutils System Messages":</p> @@ -955,20 +961,20 @@ section, "Docutils System Messages":</p> </div> <div class="system-messages section"> <h1><a>Docutils System Messages</a></h1> -<div class="system-message" id="id21"> -<p class="system-message-title">System Message: <a name="id21">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 100); <em><a href="#id22">backlink</a></em></p> +<div class="system-message" id="id23"> +<p class="system-message-title">System Message: <a name="id23">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 100); <em><a href="#id24">backlink</a></em></p> Undefined substitution referenced: "problematic".</div> -<div class="system-message" id="id73"> -<p class="system-message-title">System Message: <a name="id73">ERROR/3</a> (<tt class="docutils">functional/input/standalone_rst_html4css1.txt</tt>, line 354); <em><a href="#id74">backlink</a></em></p> +<div class="system-message" id="id78"> +<p class="system-message-title">System Message: <a name="id78">ERROR/3</a> (<tt class="docutils">functional/input/standalone_rst_html4css1.txt</tt>, line 358); <em><a href="#id79">backlink</a></em></p> Unknown target name: "5".</div> -<div class="system-message" id="id75"> -<p class="system-message-title">System Message: <a name="id75">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 363); <em><a href="#id76">backlink</a></em></p> +<div class="system-message" id="id80"> +<p class="system-message-title">System Message: <a name="id80">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 367); <em><a href="#id81">backlink</a></em></p> Unknown target name: "nonexistent".</div> -<div class="system-message" id="id77"> -<p class="system-message-title">System Message: <a name="id77">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 390); <em><a href="#id78">backlink</a></em></p> +<div class="system-message" id="id82"> +<p class="system-message-title">System Message: <a name="id82">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 394); <em><a href="#id83">backlink</a></em></p> Unknown target name: "hyperlink reference without a target".</div> -<div class="system-message" id="id79"> -<p class="system-message-title">System Message: <a name="id79">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 403); <em><a href="#id80">backlink</a></em></p> +<div class="system-message" id="id84"> +<p class="system-message-title">System Message: <a name="id84">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 407); <em><a href="#id85">backlink</a></em></p> Duplicate target name, cannot be used as a unique reference: "duplicate target names".</div> </div> </div> diff --git a/test/functional/expected/standalone_rst_latex.tex b/test/functional/expected/standalone_rst_latex.tex index 0a5aec391..4f318f90a 100644 --- a/test/functional/expected/standalone_rst_latex.tex +++ b/test/functional/expected/standalone_rst_latex.tex @@ -178,7 +178,7 @@ reStructuredText construct. \begin{list}{}{} \item {} \href{\#duplicate-target-names}{2.13.1~~~Duplicate Target Names} -\item {} \href{\#id18}{2.13.2~~~Duplicate Target Names} +\item {} \href{\#id20}{2.13.2~~~Duplicate Target Names} \end{list} @@ -298,17 +298,16 @@ A paragraph. Paragraphs contain text and may contain inline markup: \emph{emphasis}, \textbf{strong emphasis}, \texttt{inline literals}, standalone hyperlinks -(\href{http://www.python.org}{http://www.python.org}), external hyperlinks (\href{http://www.python.org/}{Python}\raisebox{.5em}[0em]{\scriptsize\hyperlink{id23}{5}}), internal +(\href{http://www.python.org}{http://www.python.org}), external hyperlinks (\href{http://www.python.org/}{Python}\raisebox{.5em}[0em]{\scriptsize\hyperlink{id25}{5}}), internal cross-references (\href{\#example}{example}), external hyperlinks with embedded URIs -(\href{http://www.python.org}{Python web site}), footnote references -(manually numbered\raisebox{.5em}[0em]{\scriptsize\hyperlink{id6}{1}}, anonymous auto-numbered\raisebox{.5em}[0em]{\scriptsize\hyperlink{id9}{3}}, labeled -auto-numbered\raisebox{.5em}[0em]{\scriptsize\hyperlink{label}{2}}, or symbolic\raisebox{.5em}[0em]{\scriptsize\hyperlink{id10}{*}}), citation references -([\hyperlink{cit2002}{CIT2002}]), substitution references (\includegraphics{../../../docs/user/rst/images/biohazard.png}), and \hypertarget{inline-hyperlink-targets}{inline -hyperlink targets} (see \href{\#id20}{Targets} below for a reference back to here). -Character-level inline markup is also possible (although exceedingly -ugly!) in \emph{re}\texttt{Structured}\emph{Text}. Problems are indicated by -{\color{red}\bfseries{}{\textbar}problematic{\textbar}} text (generated by processing errors; this one is -intentional). Here is a reference to the \href{\#doctitle}{doctitle} and the \href{\#subtitle}{subtitle}. +(\href{http://www.python.org}{Python web site}), \href{http://www.python.org/}{anonymous hyperlink +references}\raisebox{.5em}[0em]{\scriptsize\hyperlink{id25}{5}} (\href{http://docutils.sourceforge.net/}{a second reference}\raisebox{.5em}[0em]{\scriptsize\hyperlink{id30}{6}}), footnote references (manually +numbered\raisebox{.5em}[0em]{\scriptsize\hyperlink{id8}{1}}, anonymous auto-numbered\raisebox{.5em}[0em]{\scriptsize\hyperlink{id11}{3}}, labeled auto-numbered\raisebox{.5em}[0em]{\scriptsize\hyperlink{label}{2}}, or symbolic\raisebox{.5em}[0em]{\scriptsize\hyperlink{id12}{*}}), citation references ([\hyperlink{cit2002}{CIT2002}]), +substitution references (\includegraphics{../../../docs/user/rst/images/biohazard.png}), and \hypertarget{inline-hyperlink-targets}{inline hyperlink targets} +(see \href{\#id22}{Targets} below for a reference back to here). Character-level +inline markup is also possible (although exceedingly ugly!) in \emph{re}\texttt{Structured}\emph{Text}. Problems are indicated by {\color{red}\bfseries{}{\textbar}problematic{\textbar}} text +(generated by processing errors; this one is intentional). Here is a +reference to the \href{\#doctitle}{doctitle} and the \href{\#subtitle}{subtitle}. The default role for interpreted text is \titlereference{Title Reference}. Here are some explicit interpreted text roles: a PEP reference (\href{http://www.python.org/peps/pep-0287.html}{PEP 287}); an @@ -725,20 +724,20 @@ Python-specific usage examples; begun with ">>>" \hypertarget{footnotes}{} \pdfbookmark[1]{2.11~~~Footnotes}{footnotes} \subsection*{2.11~~~Footnotes} -\begin{figure}[b]\hypertarget{id6}$^{1}$ +\begin{figure}[b]\hypertarget{id8}$^{1}$ A footnote contains body elements, consistently indented by at least 3 spaces. This is the footnote's second paragraph. \end{figure} \begin{figure}[b]\hypertarget{label}$^{2}$ -Footnotes may be numbered, either manually (as in\raisebox{.5em}[0em]{\scriptsize\hyperlink{id6}{1}}) or +Footnotes may be numbered, either manually (as in\raisebox{.5em}[0em]{\scriptsize\hyperlink{id8}{1}}) or automatically using a ``{\#}''-prefixed label. This footnote has a label so it can be referred to from multiple places, both as a footnote reference (\raisebox{.5em}[0em]{\scriptsize\hyperlink{label}{2}}) and as a hyperlink reference (\href{\#label}{label}). \end{figure} -\begin{figure}[b]\hypertarget{id9}$^{3}$ +\begin{figure}[b]\hypertarget{id11}$^{3}$ This footnote is numbered automatically and anonymously using a label of ``{\#}'' only. @@ -746,14 +745,14 @@ This is the second paragraph. And this is the third paragraph. \end{figure} -\begin{figure}[b]\hypertarget{id10}$^{*}$ +\begin{figure}[b]\hypertarget{id12}$^{*}$ Footnotes may also use symbols, specified with a ``*'' label. -Here's a reference to the next footnote:\raisebox{.5em}[0em]{\scriptsize\hyperlink{id12}{{\dag}}}. +Here's a reference to the next footnote:\raisebox{.5em}[0em]{\scriptsize\hyperlink{id14}{{\dag}}}. \end{figure} -\begin{figure}[b]\hypertarget{id12}$^{{\dag}}$ +\begin{figure}[b]\hypertarget{id14}$^{{\dag}}$ This footnote shows the next symbol in the sequence. \end{figure} -\begin{figure}[b]\hypertarget{id13}$^{4}$ +\begin{figure}[b]\hypertarget{id15}$^{4}$ Here's an unreferenced footnote, with a reference to a nonexistent footnote:{\color{red}\bfseries{}{[}5{]}{\_}}. \end{figure} @@ -786,13 +785,13 @@ reference can be found under \href{\#inline-markup}{Inline Markup}, above. \href hyperlink targets} are also possible. Section headers are implicit targets, referred to by name. See -\href{\#id20}{Targets}, which is a subsection of \href{\#body-elements}{Body Elements}. +\href{\#id22}{Targets}, which is a subsection of \href{\#body-elements}{Body Elements}. Explicit external targets are interpolated into references such as -``\href{http://www.python.org/}{Python}\raisebox{.5em}[0em]{\scriptsize\hyperlink{id23}{5}}''. +``\href{http://www.python.org/}{Python}\raisebox{.5em}[0em]{\scriptsize\hyperlink{id25}{5}}''. -Targets may be indirect and anonymous. Thus \href{\#id20}{this phrase} may also -refer to the \href{\#id20}{Targets} section. +Targets may be indirect and anonymous. Thus \href{\#id22}{this phrase} may also +refer to the \href{\#id22}{Targets} section. Here's a {\color{red}\bfseries{}`hyperlink reference without a target`{\_}}, which generates an error. @@ -811,8 +810,8 @@ explicit targets will generate ``warning'' (level-2) system messages. %___________________________________________________________________________ -\hypertarget{id18}{} -\pdfbookmark[2]{2.13.2~~~Duplicate Target Names}{id18} +\hypertarget{id20}{} +\pdfbookmark[2]{2.13.2~~~Duplicate Target Names}{id20} \subsubsection*{2.13.2~~~Duplicate Target Names} Since there are two ``Duplicate Target Names'' section headers, we @@ -1109,9 +1108,12 @@ This is a topic. \hypertarget{target-footnotes}{} \pdfbookmark[2]{2.14.5~~~Target Footnotes}{target-footnotes} \subsubsection*{2.14.5~~~Target Footnotes} -\begin{figure}[b]\hypertarget{id23}$^{5}$ +\begin{figure}[b]\hypertarget{id25}$^{5}$ \href{http://www.python.org/}{http://www.python.org/} \end{figure} +\begin{figure}[b]\hypertarget{id30}$^{6}$ +\href{http://docutils.sourceforge.net/}{http://docutils.sourceforge.net/} +\end{figure} %___________________________________________________________________________ @@ -1120,7 +1122,7 @@ This is a topic. \pdfbookmark[2]{2.14.6~~~Replacement Text}{replacement-text} \subsubsection*{2.14.6~~~Replacement Text} -I recommend you try \href{http://www.python.org/}{Python, \emph{the} best language around}\raisebox{.5em}[0em]{\scriptsize\hyperlink{id23}{5}}. +I recommend you try \href{http://www.python.org/}{Python, \emph{the} best language around}\raisebox{.5em}[0em]{\scriptsize\hyperlink{id25}{5}}. %___________________________________________________________________________ @@ -1207,7 +1209,7 @@ This~is~a~parsed~literal~block.~\\ ~~~~This~line~is~indented.~~The~next~line~is~blank.~\\ ~\\ Inline~markup~is~supported,~e.g.~\emph{emphasis},~\textbf{strong},~\texttt{literal~\\ -text},~footnotes\raisebox{.5em}[0em]{\scriptsize\hyperlink{id6}{1}},~\hypertarget{id20}{targets},~and~\href{http://www.python.org/}{references}. +text},~footnotes\raisebox{.5em}[0em]{\scriptsize\hyperlink{id8}{1}},~\hypertarget{id22}{targets},~and~\href{http://www.python.org/}{references}. }\end{quote} diff --git a/test/functional/expected/standalone_rst_pseudoxml.txt b/test/functional/expected/standalone_rst_pseudoxml.txt index ac3fc98a7..6af1c9ded 100644 --- a/test/functional/expected/standalone_rst_pseudoxml.txt +++ b/test/functional/expected/standalone_rst_pseudoxml.txt @@ -91,244 +91,244 @@ <bullet_list classes="auto-toc"> <list_item> <paragraph> - <reference ids="id27" refid="structural-elements"> + <reference ids="id32" refid="structural-elements"> <generated classes="sectnum"> 1    Structural Elements <bullet_list classes="auto-toc"> <list_item> <paragraph> - <reference ids="id28" refid="section-title"> + <reference ids="id33" refid="section-title"> <generated classes="sectnum"> 1.1    Section Title <list_item> <paragraph> - <reference ids="id29" refid="empty-section"> + <reference ids="id34" refid="empty-section"> <generated classes="sectnum"> 1.2    Empty Section <list_item> <paragraph> - <reference ids="id30" refid="transitions"> + <reference ids="id35" refid="transitions"> <generated classes="sectnum"> 1.3    Transitions <list_item> <paragraph> - <reference ids="id31" refid="body-elements"> + <reference ids="id36" refid="body-elements"> <generated classes="sectnum"> 2    Body Elements <bullet_list classes="auto-toc"> <list_item> <paragraph> - <reference ids="id32" refid="paragraphs"> + <reference ids="id37" refid="paragraphs"> <generated classes="sectnum"> 2.1    Paragraphs <bullet_list classes="auto-toc"> <list_item> <paragraph> - <reference ids="id33" refid="inline-markup"> + <reference ids="id38" refid="inline-markup"> <generated classes="sectnum"> 2.1.1    Inline Markup <list_item> <paragraph> - <reference ids="id34" refid="bullet-lists"> + <reference ids="id39" refid="bullet-lists"> <generated classes="sectnum"> 2.2    Bullet Lists <list_item> <paragraph> - <reference ids="id35" refid="enumerated-lists"> + <reference ids="id40" refid="enumerated-lists"> <generated classes="sectnum"> 2.3    Enumerated Lists <list_item> <paragraph> - <reference ids="id36" refid="definition-lists"> + <reference ids="id41" refid="definition-lists"> <generated classes="sectnum"> 2.4    Definition Lists <list_item> <paragraph> - <reference ids="id37" refid="field-lists"> + <reference ids="id42" refid="field-lists"> <generated classes="sectnum"> 2.5    Field Lists <list_item> <paragraph> - <reference ids="id38" refid="option-lists"> + <reference ids="id43" refid="option-lists"> <generated classes="sectnum"> 2.6    Option Lists <list_item> <paragraph> - <reference ids="id39" refid="literal-blocks"> + <reference ids="id44" refid="literal-blocks"> <generated classes="sectnum"> 2.7    Literal Blocks <list_item> <paragraph> - <reference ids="id40" refid="line-blocks"> + <reference ids="id45" refid="line-blocks"> <generated classes="sectnum"> 2.8    Line Blocks <list_item> <paragraph> - <reference ids="id41" refid="block-quotes"> + <reference ids="id46" refid="block-quotes"> <generated classes="sectnum"> 2.9    Block Quotes <list_item> <paragraph> - <reference ids="id42" refid="doctest-blocks"> + <reference ids="id47" refid="doctest-blocks"> <generated classes="sectnum"> 2.10    Doctest Blocks <list_item> <paragraph> - <reference ids="id43" refid="footnotes"> + <reference ids="id48" refid="footnotes"> <generated classes="sectnum"> 2.11    Footnotes <list_item> <paragraph> - <reference ids="id44" refid="citations"> + <reference ids="id49" refid="citations"> <generated classes="sectnum"> 2.12    Citations <list_item> <paragraph> - <reference ids="id45" refid="targets"> + <reference ids="id50" refid="targets"> <generated classes="sectnum"> 2.13    Targets <bullet_list classes="auto-toc"> <list_item> <paragraph> - <reference ids="id46" refid="duplicate-target-names"> + <reference ids="id51" refid="duplicate-target-names"> <generated classes="sectnum"> 2.13.1    Duplicate Target Names <list_item> <paragraph> - <reference ids="id47" refid="id18"> + <reference ids="id52" refid="id20"> <generated classes="sectnum"> 2.13.2    Duplicate Target Names <list_item> <paragraph> - <reference ids="id48" refid="directives"> + <reference ids="id53" refid="directives"> <generated classes="sectnum"> 2.14    Directives <bullet_list classes="auto-toc"> <list_item> <paragraph> - <reference ids="id49" refid="document-parts"> + <reference ids="id54" refid="document-parts"> <generated classes="sectnum"> 2.14.1    Document Parts <list_item> <paragraph> - <reference ids="id50" refid="images"> + <reference ids="id55" refid="images"> <generated classes="sectnum"> 2.14.2    Images <list_item> <paragraph> - <reference ids="id51" refid="admonitions"> + <reference ids="id56" refid="admonitions"> <generated classes="sectnum"> 2.14.3    Admonitions <list_item> <paragraph> - <reference ids="id52" refid="topics-sidebars-and-rubrics"> + <reference ids="id57" refid="topics-sidebars-and-rubrics"> <generated classes="sectnum"> 2.14.4    Topics, Sidebars, and Rubrics <list_item> <paragraph> - <reference ids="id53" refid="target-footnotes"> + <reference ids="id58" refid="target-footnotes"> <generated classes="sectnum"> 2.14.5    Target Footnotes <list_item> <paragraph> - <reference ids="id54" refid="replacement-text"> + <reference ids="id59" refid="replacement-text"> <generated classes="sectnum"> 2.14.6    Replacement Text <list_item> <paragraph> - <reference ids="id55" refid="compound-paragraph"> + <reference ids="id60" refid="compound-paragraph"> <generated classes="sectnum"> 2.14.7    Compound Paragraph <list_item> <paragraph> - <reference ids="id56" refid="parsed-literal-blocks"> + <reference ids="id61" refid="parsed-literal-blocks"> <generated classes="sectnum"> 2.14.8    Parsed Literal Blocks <list_item> <paragraph> - <reference ids="id57" refid="substitution-definitions"> + <reference ids="id62" refid="substitution-definitions"> <generated classes="sectnum"> 2.15    Substitution Definitions <list_item> <paragraph> - <reference ids="id58" refid="comments"> + <reference ids="id63" refid="comments"> <generated classes="sectnum"> 2.16    Comments <list_item> <paragraph> - <reference ids="id59" refid="raw-text"> + <reference ids="id64" refid="raw-text"> <generated classes="sectnum"> 2.17    Raw text <list_item> <paragraph> - <reference ids="id60" refid="colspanning-tables"> + <reference ids="id65" refid="colspanning-tables"> <generated classes="sectnum"> 2.18    Colspanning tables <list_item> <paragraph> - <reference ids="id61" refid="rowspanning-tables"> + <reference ids="id66" refid="rowspanning-tables"> <generated classes="sectnum"> 2.19    Rowspanning tables <list_item> <paragraph> - <reference ids="id62" refid="complex-tables"> + <reference ids="id67" refid="complex-tables"> <generated classes="sectnum"> 2.20    Complex tables <list_item> <paragraph> - <reference ids="id63" refid="list-tables"> + <reference ids="id68" refid="list-tables"> <generated classes="sectnum"> 2.21    List Tables <list_item> <paragraph> - <reference ids="id64" refid="error-handling"> + <reference ids="id69" refid="error-handling"> <generated classes="sectnum"> 3    Error Handling <section ids="structural-elements" names="structural\ elements"> - <title auto="1" refid="id27"> + <title auto="1" refid="id32"> <generated classes="sectnum"> 1    Structural Elements <section ids="section-title" names="section\ title"> - <title auto="1" refid="id28"> + <title auto="1" refid="id33"> <generated classes="sectnum"> 1.1    Section Title @@ -337,12 +337,12 @@ <paragraph> That's it, the text just above this line. <section ids="empty-section" names="empty\ section"> - <title auto="1" refid="id29"> + <title auto="1" refid="id34"> <generated classes="sectnum"> 1.2    Empty Section <section ids="transitions" names="transitions"> - <title auto="1" refid="id30"> + <title auto="1" refid="id35"> <generated classes="sectnum"> 1.3    Transitions @@ -353,19 +353,19 @@ It divides the section. Transitions may also occur between sections: <transition> <section ids="body-elements" names="body\ elements"> - <title auto="1" refid="id31"> + <title auto="1" refid="id36"> <generated classes="sectnum"> 2    Body Elements <section ids="paragraphs" names="paragraphs"> - <title auto="1" refid="id32"> + <title auto="1" refid="id37"> <generated classes="sectnum"> 2.1    Paragraphs <paragraph> A paragraph. <section ids="inline-markup" names="inline\ markup"> - <title auto="1" refid="id33"> + <title auto="1" refid="id38"> <generated classes="sectnum"> 2.1.1    Inline Markup @@ -387,7 +387,7 @@ <reference name="Python" refuri="http://www.python.org/"> Python - <footnote_reference auto="1" ids="id24" refid="id23"> + <footnote_reference auto="1" ids="id26" refid="id25"> 5 ), internal cross-references ( @@ -397,53 +397,67 @@ ( <reference name="Python web site" refuri="http://www.python.org"> Python web site - ), footnote references - (manually numbered - <footnote_reference ids="id1" refid="id6"> + ), + <reference anonymous="1" name="anonymous hyperlink references" refuri="http://www.python.org/"> + anonymous hyperlink + references + + <footnote_reference auto="1" ids="id29" refid="id25"> + 5 + ( + <reference anonymous="1" name="a second reference" refuri="http://docutils.sourceforge.net/"> + a second reference + + <footnote_reference auto="1" ids="id31" refid="id30"> + 6 + ), footnote references (manually + numbered + <footnote_reference ids="id1" refid="id8"> 1 , anonymous auto-numbered - <footnote_reference auto="1" ids="id2" refid="id9"> + <footnote_reference auto="1" ids="id2" refid="id11"> 3 - , labeled - auto-numbered + , labeled auto-numbered <footnote_reference auto="1" ids="id3" refid="label"> 2 , or symbolic - <footnote_reference auto="*" ids="id4" refid="id10"> + <footnote_reference auto="*" ids="id4" refid="id12"> * - ), citation references - ( + ), citation references ( <citation_reference ids="id5" refid="cit2002"> CIT2002 - ), substitution references ( + ), + substitution references ( <image alt="EXAMPLE" uri="../../../docs/user/rst/images/biohazard.png"> ), and <target ids="inline-hyperlink-targets" names="inline\ hyperlink\ targets"> - inline - hyperlink targets - (see - <reference name="Targets" refid="id20"> + inline hyperlink targets + + (see + <reference name="Targets" refid="id22"> Targets - below for a reference back to here). - Character-level inline markup is also possible (although exceedingly - ugly!) in + below for a reference back to here). Character-level + inline markup is also possible (although exceedingly ugly!) in <emphasis> re <literal> Structured <emphasis> Text - . Problems are indicated by - <problematic ids="id22" refid="id21"> + . Problems are indicated by + <problematic ids="id24" refid="id23"> |problematic| - text (generated by processing errors; this one is - intentional). Here is a reference to the + text + (generated by processing errors; this one is intentional). Here is a + reference to the <reference name="doctitle" refid="doctitle"> doctitle and the <reference name="subtitle" refid="subtitle"> subtitle . + <target anonymous="1" ids="id6" refuri="http://www.python.org/"> + <target anonymous="1" ids="id7" refuri="http://docutils.sourceforge.net/"> <paragraph> The default role for interpreted text is <title_reference> @@ -490,7 +504,7 @@ option was supplied, there should be a live link to PEP 258 here. <section ids="bullet-lists" names="bullet\ lists"> - <title auto="1" refid="id34"> + <title auto="1" refid="id39"> <generated classes="sectnum"> 2.2    Bullet Lists @@ -534,7 +548,7 @@ <comment xml:space="preserve"> Even if this item contains a target and a comment. <section ids="enumerated-lists" names="enumerated\ lists"> - <title auto="1" refid="id35"> + <title auto="1" refid="id40"> <generated classes="sectnum"> 2.3    Enumerated Lists @@ -583,7 +597,7 @@ <paragraph> iv <section ids="definition-lists" names="definition\ lists"> - <title auto="1" refid="id36"> + <title auto="1" refid="id41"> <generated classes="sectnum"> 2.4    Definition Lists @@ -621,7 +635,7 @@ <paragraph> Definition <section ids="field-lists" names="field\ lists"> - <title auto="1" refid="id37"> + <title auto="1" refid="id42"> <generated classes="sectnum"> 2.5    Field Lists @@ -655,7 +669,7 @@ about credits but just for ensuring that the class attribute doesn't get stripped away.) <section ids="option-lists" names="option\ lists"> - <title auto="1" refid="id38"> + <title auto="1" refid="id43"> <generated classes="sectnum"> 2.6    Option Lists @@ -768,7 +782,7 @@ There must be at least two spaces between the option and the description. <section ids="literal-blocks" names="literal\ blocks"> - <title auto="1" refid="id39"> + <title auto="1" refid="id44"> <generated classes="sectnum"> 2.7    Literal Blocks @@ -790,7 +804,7 @@ > > Why didn't I think of that? <section ids="line-blocks" names="line\ blocks"> - <title auto="1" refid="id40"> + <title auto="1" refid="id45"> <generated classes="sectnum"> 2.8    Line Blocks @@ -868,7 +882,7 @@ <line> Singing... <section ids="block-quotes" names="block\ quotes"> - <title auto="1" refid="id41"> + <title auto="1" refid="id46"> <generated classes="sectnum"> 2.9    Block Quotes @@ -884,7 +898,7 @@ <attribution> Anne Elk (Miss) <section ids="doctest-blocks" names="doctest\ blocks"> - <title auto="1" refid="id42"> + <title auto="1" refid="id47"> <generated classes="sectnum"> 2.10    Doctest Blocks @@ -894,11 +908,11 @@ >>> print '(cut and pasted from interactive Python sessions)' (cut and pasted from interactive Python sessions) <section ids="footnotes" names="footnotes"> - <title auto="1" refid="id43"> + <title auto="1" refid="id48"> <generated classes="sectnum"> 2.11    Footnotes - <footnote backrefs="id1 id7 id19" ids="id6" names="1"> + <footnote backrefs="id1 id9 id21" ids="id8" names="1"> <label> 1 <paragraph> @@ -906,25 +920,25 @@ least 3 spaces. <paragraph> This is the footnote's second paragraph. - <footnote auto="1" backrefs="id3 id8" ids="label" names="label"> + <footnote auto="1" backrefs="id3 id10" ids="label" names="label"> <label> 2 <paragraph> Footnotes may be numbered, either manually (as in - <footnote_reference ids="id7" refid="id6"> + <footnote_reference ids="id9" refid="id8"> 1 ) or automatically using a "#"-prefixed label. This footnote has a label so it can be referred to from multiple places, both as a footnote reference ( - <footnote_reference auto="1" ids="id8" refid="label"> + <footnote_reference auto="1" ids="id10" refid="label"> 2 ) and as a hyperlink reference ( <reference name="label" refid="label"> label ). - <footnote auto="1" backrefs="id2" ids="id9" names="3"> + <footnote auto="1" backrefs="id2" ids="id11" names="3"> <label> 3 <paragraph> @@ -934,35 +948,35 @@ This is the second paragraph. <paragraph> And this is the third paragraph. - <footnote auto="*" backrefs="id4" ids="id10"> + <footnote auto="*" backrefs="id4" ids="id12"> <label> * <paragraph> Footnotes may also use symbols, specified with a "*" label. Here's a reference to the next footnote: - <footnote_reference auto="*" ids="id11" refid="id12"> + <footnote_reference auto="*" ids="id13" refid="id14"> † . - <footnote auto="*" backrefs="id11" ids="id12"> + <footnote auto="*" backrefs="id13" ids="id14"> <label> † <paragraph> This footnote shows the next symbol in the sequence. - <footnote ids="id13" names="4"> + <footnote ids="id15" names="4"> <label> 4 <paragraph> Here's an unreferenced footnote, with a reference to a nonexistent footnote: - <problematic ids="id74 id14" refid="id73"> + <problematic ids="id79 id16" refid="id78"> [5]_ . <section ids="citations" names="citations"> - <title auto="1" refid="id44"> + <title auto="1" refid="id49"> <generated classes="sectnum"> 2.12    Citations - <citation backrefs="id5 id15" ids="cit2002" names="cit2002"> + <citation backrefs="id5 id17" ids="cit2002" names="cit2002"> <label> CIT2002 <paragraph> @@ -970,16 +984,16 @@ rendered separately and differently from footnotes. <paragraph> Here's a reference to the above, - <citation_reference ids="id15" refid="cit2002"> + <citation_reference ids="id17" refid="cit2002"> CIT2002 , and a - <problematic ids="id76 id16" refid="id75"> + <problematic ids="id81 id18" refid="id80"> [nonexistent]_ citation. <target refid="another-target"> <section dupnames="targets" ids="targets another-target" names="another\ target"> - <title auto="1" refid="id45"> + <title auto="1" refid="id50"> <generated classes="sectnum"> 2.13    Targets @@ -996,7 +1010,7 @@ are also possible. <paragraph> Section headers are implicit targets, referred to by name. See - <reference name="Targets" refid="id20"> + <reference name="Targets" refid="id22"> Targets , which is a subsection of <reference name="Body Elements" refid="body-elements"> @@ -1008,28 +1022,28 @@ <reference name="Python" refuri="http://www.python.org/"> Python - <footnote_reference auto="1" ids="id25" refid="id23"> + <footnote_reference auto="1" ids="id27" refid="id25"> 5 ". <target ids="python" names="python" refuri="http://www.python.org/"> <paragraph> Targets may be indirect and anonymous. Thus - <reference anonymous="1" name="this phrase" refid="id20"> + <reference anonymous="1" name="this phrase" refid="id22"> this phrase may also refer to the - <reference name="Targets" refid="id20"> + <reference name="Targets" refid="id22"> Targets section. - <target anonymous="1" ids="id17" refid="id20"> + <target anonymous="1" ids="id19" refid="id22"> <paragraph> Here's a - <problematic ids="id78" refid="id77"> + <problematic ids="id83" refid="id82"> `hyperlink reference without a target`_ , which generates an error. <section dupnames="duplicate\ target\ names" ids="duplicate-target-names"> - <title auto="1" refid="id46"> + <title auto="1" refid="id51"> <generated classes="sectnum"> 2.13.1    Duplicate Target Names @@ -1037,8 +1051,8 @@ Duplicate names in section headers or other implicit targets will generate "info" (level-1) system messages. Duplicate names in explicit targets will generate "warning" (level-2) system messages. - <section dupnames="duplicate\ target\ names" ids="id18"> - <title auto="1" refid="id47"> + <section dupnames="duplicate\ target\ names" ids="id20"> + <title auto="1" refid="id52"> <generated classes="sectnum"> 2.13.2    Duplicate Target Names @@ -1046,11 +1060,11 @@ Since there are two "Duplicate Target Names" section headers, we cannot uniquely refer to either of them by name. If we try to (like this: - <problematic ids="id80" refid="id79"> + <problematic ids="id85" refid="id84"> `Duplicate Target Names`_ ), an error is generated. <section ids="directives" names="directives"> - <title auto="1" refid="id48"> + <title auto="1" refid="id53"> <generated classes="sectnum"> 2.14    Directives @@ -1058,49 +1072,49 @@ <bullet_list classes="auto-toc"> <list_item> <paragraph> - <reference ids="id65" refid="document-parts"> + <reference ids="id70" refid="document-parts"> <generated classes="sectnum"> 2.14.1    Document Parts <list_item> <paragraph> - <reference ids="id66" refid="images"> + <reference ids="id71" refid="images"> <generated classes="sectnum"> 2.14.2    Images <list_item> <paragraph> - <reference ids="id67" refid="admonitions"> + <reference ids="id72" refid="admonitions"> <generated classes="sectnum"> 2.14.3    Admonitions <list_item> <paragraph> - <reference ids="id68" refid="topics-sidebars-and-rubrics"> + <reference ids="id73" refid="topics-sidebars-and-rubrics"> <generated classes="sectnum"> 2.14.4    Topics, Sidebars, and Rubrics <list_item> <paragraph> - <reference ids="id69" refid="target-footnotes"> + <reference ids="id74" refid="target-footnotes"> <generated classes="sectnum"> 2.14.5    Target Footnotes <list_item> <paragraph> - <reference ids="id70" refid="replacement-text"> + <reference ids="id75" refid="replacement-text"> <generated classes="sectnum"> 2.14.6    Replacement Text <list_item> <paragraph> - <reference ids="id71" refid="compound-paragraph"> + <reference ids="id76" refid="compound-paragraph"> <generated classes="sectnum"> 2.14.7    Compound Paragraph <list_item> <paragraph> - <reference ids="id72" refid="parsed-literal-blocks"> + <reference ids="id77" refid="parsed-literal-blocks"> <generated classes="sectnum"> 2.14.8    Parsed Literal Blocks @@ -1111,7 +1125,7 @@ http://docutils.sourceforge.net/docs/ref/rst/directives.html . <section ids="document-parts" names="document\ parts"> - <title auto="1" refid="id65"> + <title auto="1" refid="id70"> <generated classes="sectnum"> 2.14.1    Document Parts @@ -1126,7 +1140,7 @@ table of contents ). <section ids="images" names="images"> - <title auto="1" refid="id66"> + <title auto="1" refid="id71"> <generated classes="sectnum"> 2.14.2    Images @@ -1227,7 +1241,7 @@ An image 3 cm high: <image height="3cm" uri="../../../docs/user/rst/images/biohazard.png"> <section ids="admonitions" names="admonitions"> - <title auto="1" refid="id67"> + <title auto="1" refid="id72"> <generated classes="sectnum"> 2.14.3    Admonitions @@ -1277,7 +1291,7 @@ You can make up your own admonition too. <target ids="docutils" names="docutils" refuri="http://docutils.sourceforge.net/"> <section ids="topics-sidebars-and-rubrics" names="topics,\ sidebars,\ and\ rubrics"> - <title auto="1" refid="id68"> + <title auto="1" refid="id73"> <generated classes="sectnum"> 2.14.4    Topics, Sidebars, and Rubrics @@ -1302,18 +1316,24 @@ <rubric> This is a rubric <section ids="target-footnotes" names="target\ footnotes"> - <title auto="1" refid="id69"> + <title auto="1" refid="id74"> <generated classes="sectnum"> 2.14.5    Target Footnotes - <footnote auto="1" backrefs="id24 id25 id26" ids="id23" names="TARGET_NOTE:\ id23"> + <footnote auto="1" backrefs="id26 id27 id28 id29" ids="id25" names="TARGET_NOTE:\ id25"> <label> 5 <paragraph> <reference refuri="http://www.python.org/"> http://www.python.org/ + <footnote auto="1" backrefs="id31" ids="id30" names="TARGET_NOTE:\ id30"> + <label> + 6 + <paragraph> + <reference refuri="http://docutils.sourceforge.net/"> + http://docutils.sourceforge.net/ <section ids="replacement-text" names="replacement\ text"> - <title auto="1" refid="id70"> + <title auto="1" refid="id75"> <generated classes="sectnum"> 2.14.6    Replacement Text @@ -1325,7 +1345,7 @@ the best language around - <footnote_reference auto="1" ids="id26" refid="id23"> + <footnote_reference auto="1" ids="id28" refid="id25"> 5 . <substitution_definition names="Python"> @@ -1334,7 +1354,7 @@ the best language around <section ids="compound-paragraph" names="compound\ paragraph"> - <title auto="1" refid="id71"> + <title auto="1" refid="id76"> <generated classes="sectnum"> 2.14.7    Compound Paragraph @@ -1420,7 +1440,7 @@ <paragraph> Compound 7, another paragraph. <section ids="parsed-literal-blocks" names="parsed\ literal\ blocks"> - <title auto="1" refid="id72"> + <title auto="1" refid="id77"> <generated classes="sectnum"> 2.14.8    Parsed Literal Blocks @@ -1439,10 +1459,10 @@ literal text , footnotes - <footnote_reference ids="id19" refid="id6"> + <footnote_reference ids="id21" refid="id8"> 1 , - <target ids="id20" names="targets"> + <target ids="id22" names="targets"> targets , and <reference name="references" refuri="http://www.python.org/"> @@ -1450,7 +1470,7 @@ <target ids="references" names="references" refuri="http://www.python.org/"> . <section ids="substitution-definitions" names="substitution\ definitions"> - <title auto="1" refid="id57"> + <title auto="1" refid="id62"> <generated classes="sectnum"> 2.15    Substitution Definitions @@ -1463,7 +1483,7 @@ <paragraph> (Substitution definitions are not visible in the HTML source.) <section ids="comments" names="comments"> - <title auto="1" refid="id58"> + <title auto="1" refid="id63"> <generated classes="sectnum"> 2.16    Comments @@ -1478,7 +1498,7 @@ <paragraph> (View the HTML source to see the comment.) <section ids="raw-text" names="raw\ text"> - <title auto="1" refid="id59"> + <title auto="1" refid="id64"> <generated classes="sectnum"> 2.17    Raw text @@ -1502,7 +1522,7 @@ <raw format="latex" xml:space="preserve"> Fifth test in LaTeX.\\Line two. <section ids="colspanning-tables" names="colspanning\ tables"> - <title auto="1" refid="id60"> + <title auto="1" refid="id65"> <generated classes="sectnum"> 2.18    Colspanning tables @@ -1573,7 +1593,7 @@ <paragraph> True <section ids="rowspanning-tables" names="rowspanning\ tables"> - <title auto="1" refid="id61"> + <title auto="1" refid="id66"> <generated classes="sectnum"> 2.19    Rowspanning tables @@ -1625,7 +1645,7 @@ <paragraph> body row 3 <section ids="complex-tables" names="complex\ tables"> - <title auto="1" refid="id62"> + <title auto="1" refid="id67"> <generated classes="sectnum"> 2.20    Complex tables @@ -1710,7 +1730,7 @@ --> <entry> <section ids="list-tables" names="list\ tables"> - <title auto="1" refid="id63"> + <title auto="1" refid="id68"> <generated classes="sectnum"> 2.21    List Tables @@ -1767,7 +1787,7 @@ <paragraph> On a stick! <section ids="error-handling" names="error\ handling"> - <title auto="1" refid="id64"> + <title auto="1" refid="id69"> <generated classes="sectnum"> 3    Error Handling @@ -1781,18 +1801,18 @@ <section classes="system-messages"> <title> Docutils System Messages - <system_message backrefs="id22" ids="id21" level="3" line="100" source="functional/input/data/standard.txt" type="ERROR"> + <system_message backrefs="id24" ids="id23" level="3" line="100" source="functional/input/data/standard.txt" type="ERROR"> <paragraph> Undefined substitution referenced: "problematic". - <system_message backrefs="id74" ids="id73" level="3" line="354" source="functional/input/standalone_rst_html4css1.txt" type="ERROR"> + <system_message backrefs="id79" ids="id78" level="3" line="358" source="functional/input/standalone_rst_html4css1.txt" type="ERROR"> <paragraph> Unknown target name: "5". - <system_message backrefs="id76" ids="id75" level="3" line="363" source="functional/input/data/standard.txt" type="ERROR"> + <system_message backrefs="id81" ids="id80" level="3" line="367" source="functional/input/data/standard.txt" type="ERROR"> <paragraph> Unknown target name: "nonexistent". - <system_message backrefs="id78" ids="id77" level="3" line="390" source="functional/input/data/standard.txt" type="ERROR"> + <system_message backrefs="id83" ids="id82" level="3" line="394" source="functional/input/data/standard.txt" type="ERROR"> <paragraph> Unknown target name: "hyperlink reference without a target". - <system_message backrefs="id80" ids="id79" level="3" line="403" source="functional/input/data/standard.txt" type="ERROR"> + <system_message backrefs="id85" ids="id84" level="3" line="407" source="functional/input/data/standard.txt" type="ERROR"> <paragraph> Duplicate target name, cannot be used as a unique reference: "duplicate target names". diff --git a/test/functional/input/data/standard.txt b/test/functional/input/data/standard.txt index ccb5ddbeb..ea904eaec 100644 --- a/test/functional/input/data/standard.txt +++ b/test/functional/input/data/standard.txt @@ -99,15 +99,19 @@ Paragraphs contain text and may contain inline markup: *emphasis*, **strong emphasis**, ``inline literals``, standalone hyperlinks (http://www.python.org), external hyperlinks (Python_), internal cross-references (example_), external hyperlinks with embedded URIs -(`Python web site <http://www.python.org>`__), footnote references -(manually numbered [1]_, anonymous auto-numbered [#]_, labeled -auto-numbered [#label]_, or symbolic [*]_), citation references -([CIT2002]_), substitution references (|example|), and _`inline -hyperlink targets` (see Targets_ below for a reference back to here). -Character-level inline markup is also possible (although exceedingly -ugly!) in *re*\ ``Structured``\ *Text*. Problems are indicated by -|problematic| text (generated by processing errors; this one is -intentional). Here is a reference to the doctitle_ and the subtitle_. +(`Python web site <http://www.python.org>`__), `anonymous hyperlink +references`__ (`a second reference`__), footnote references (manually +numbered [1]_, anonymous auto-numbered [#]_, labeled auto-numbered +[#label]_, or symbolic [*]_), citation references ([CIT2002]_), +substitution references (|example|), and _`inline hyperlink targets` +(see Targets_ below for a reference back to here). Character-level +inline markup is also possible (although exceedingly ugly!) in *re*\ +``Structured``\ *Text*. Problems are indicated by |problematic| text +(generated by processing errors; this one is intentional). Here is a +reference to the doctitle_ and the subtitle_. + +__ http://www.python.org/ +__ http://docutils.sourceforge.net/ The default role for interpreted text is `Title Reference`. Here are some explicit interpreted text roles: a PEP reference (:PEP:`287`); an -- cgit v1.2.1 From c6e1fdb5efb32575f69e1c0c68cb6715ac896a85 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Tue, 11 Oct 2005 21:36:06 +0000 Subject: removed more internal state (`document.anonymous_refs` and `document.anonymous_targets`) git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3939 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms/test_hyperlinks.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'test') diff --git a/test/test_transforms/test_hyperlinks.py b/test/test_transforms/test_hyperlinks.py index 1b84a18c4..cef12a4f1 100755 --- a/test/test_transforms/test_hyperlinks.py +++ b/test/test_transforms/test_hyperlinks.py @@ -281,6 +281,36 @@ __ ztarget_ Indirect hyperlink target (id="id2") refers to target "ztarget", which is a duplicate, and cannot be used as a unique reference. """], ["""\ +The next anonymous hyperlink reference is parsed (and discarded) at +some point, but nonetheless anonymous hyperlink references and targets +match in this snippet. + +.. |invalid| replace:: anonymous__ + +hyperlink__ + +__ URL +""", +"""\ +<document source="test data"> + <paragraph> + The next anonymous hyperlink reference is parsed (and discarded) at + some point, but nonetheless anonymous hyperlink references and targets + match in this snippet. + <system_message level="3" line="5" source="test data" type="ERROR"> + <paragraph> + Substitution definition contains illegal element: + <literal_block xml:space="preserve"> + <reference anonymous="1" name="anonymous"> + anonymous + <literal_block xml:space="preserve"> + .. |invalid| replace:: anonymous__ + <paragraph> + <reference anonymous="1" name="hyperlink" refuri="URL"> + hyperlink + <target anonymous="1" ids="id1" refuri="URL"> +"""], +["""\ An `embedded uri <http://direct>`_. Another reference to the same `embedded URI`_. -- cgit v1.2.1 From 5da7532801abf44378d5422760ab68a84bc39fbc Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Tue, 11 Oct 2005 23:00:39 +0000 Subject: removed references to default.css; to-do: update PEP writer (-> pep.css) and then docs/user/tools.txt git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3940 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/DocutilsTestSupport.py | 4 ---- 1 file changed, 4 deletions(-) (limited to 'test') diff --git a/test/DocutilsTestSupport.py b/test/DocutilsTestSupport.py index ea1672d1b..6947c4478 100644 --- a/test/DocutilsTestSupport.py +++ b/test/DocutilsTestSupport.py @@ -767,8 +767,6 @@ class HtmlWriterPublishPartsTestCase(WriterPublishTestCase): standard_content_type_template + standard_generator_template % docutils.__version__) standard_meta_value = standard_html_meta_value % 'utf-8' - standard_stylesheet_value = ('<link rel="stylesheet" href="default.css" ' - 'type="text/css" />\n') standard_html_prolog = """\ <?xml version="1.0" encoding="%s" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> @@ -782,8 +780,6 @@ class HtmlWriterPublishPartsTestCase(WriterPublishTestCase): del parts['body'] # remove standard portions: parts['meta'] = parts['meta'].replace(self.standard_meta_value, '') - if parts['stylesheet'] == self.standard_stylesheet_value: - del parts['stylesheet'] parts['html_head'] = parts['html_head'].replace( self.standard_html_meta_value, '...') parts['html_prolog'] = parts['html_prolog'].replace( -- cgit v1.2.1 From b4e10620d3e91babd7b976a694ddc68ba3824777 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Fri, 28 Oct 2005 15:10:06 +0000 Subject: test for non-breaking space git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3959 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_parsers/test_rst/test_enumerated_lists.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_enumerated_lists.py b/test/test_parsers/test_rst/test_enumerated_lists.py index 6824efdbb..b8ab093e5 100755 --- a/test/test_parsers/test_rst/test_enumerated_lists.py +++ b/test/test_parsers/test_rst/test_enumerated_lists.py @@ -650,13 +650,19 @@ Nested enumerated lists: <paragraph> Item 3. """], -["""\ +[u"""\ A. Einstein was a great influence on B. Physicist, who was a colleague of C. Chemist. They all worked in Princeton, NJ. + +Using a non-breaking space as a workaround: + +A.\u00a0Einstein was a great influence on +B. Physicist, who was a colleague of +C. Chemist. They all worked in +Princeton, NJ. """, -# @@@ I think this is the correct result, but I'm not certain: """\ <document source="test data"> <enumerated_list enumtype="upperalpha" prefix="" suffix="."> @@ -672,6 +678,13 @@ Princeton, NJ. <paragraph> C. Chemist. They all worked in Princeton, NJ. + <paragraph> + Using a non-breaking space as a workaround: + <paragraph> + A.\xa0Einstein was a great influence on + B. Physicist, who was a colleague of + C. Chemist. They all worked in + Princeton, NJ. """], ["""\ 1. Item one: line 1, -- cgit v1.2.1 From 5eaa35732246484d010b80d2848eba8cd77158d8 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Fri, 28 Oct 2005 16:12:56 +0000 Subject: added the "container" element & directive, a generic container git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3963 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_html4css1.html | 4 ++++ test/functional/expected/standalone_rst_pseudoxml.txt | 5 +++++ test/functional/input/standalone_rst_html4css1.txt | 6 ++++++ 3 files changed, 15 insertions(+) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index e14d5a72d..a781aa784 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -958,6 +958,10 @@ crunchy, now would it?</td> <p>There should be five messages in the following, auto-generated section, "Docutils System Messages":</p> <!-- section should be added by Docutils automatically --> +<div class="custom container"> +<p>paragraph 1</p> +<p>paragraph 2</p> +</div> </div> <div class="system-messages section"> <h1><a>Docutils System Messages</a></h1> diff --git a/test/functional/expected/standalone_rst_pseudoxml.txt b/test/functional/expected/standalone_rst_pseudoxml.txt index 6af1c9ded..22c8f4bde 100644 --- a/test/functional/expected/standalone_rst_pseudoxml.txt +++ b/test/functional/expected/standalone_rst_pseudoxml.txt @@ -1798,6 +1798,11 @@ section, "Docutils System Messages": <comment xml:space="preserve"> section should be added by Docutils automatically + <container classes="custom"> + <paragraph> + paragraph 1 + <paragraph> + paragraph 2 <section classes="system-messages"> <title> Docutils System Messages diff --git a/test/functional/input/standalone_rst_html4css1.txt b/test/functional/input/standalone_rst_html4css1.txt index 05f0287d0..4b1e2fdda 100644 --- a/test/functional/input/standalone_rst_html4css1.txt +++ b/test/functional/input/standalone_rst_html4css1.txt @@ -5,3 +5,9 @@ .. include:: data/table_complex.txt .. include:: data/list_table.txt .. include:: data/errors.txt + +.. container:: custom + + paragraph 1 + + paragraph 2 -- cgit v1.2.1 From d92350b57c08a3f642a8a2e6147eb999769180f7 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sat, 29 Oct 2005 12:28:44 +0000 Subject: converted latin1 files to utf8; removed unnecessary -*- coding -*- tags; made some source files ASCII only git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3968 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_writers/test_docutils_xml.py | 3 +-- test/test_writers/test_html4css1.py | 1 - test/test_writers/test_html4css1_misc.py | 7 ++++--- 3 files changed, 5 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/test_writers/test_docutils_xml.py b/test/test_writers/test_docutils_xml.py index eeb5bc94a..c51d71379 100755 --- a/test/test_writers/test_docutils_xml.py +++ b/test/test_writers/test_docutils_xml.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- # Author: Felix Wiemann # Contact: Felix_Wiemann@ososo.de @@ -24,7 +23,7 @@ Test ---------- -Test. äöü€""" +Test. \xc3\xa4\xc3\xb6\xc3\xbc\xe2\x82\xac""" xmldecl = '<?xml version="1.0" encoding="iso-8859-1"?>\n' doctypedecl = '<!DOCTYPE document PUBLIC "+//IDN docutils.sourceforge.net//DTD Docutils Generic//EN//XML" "http://docutils.sourceforge.net/docs/ref/docutils.dtd">\n' generatedby = '<!-- Generated by Docutils %s -->\n' % docutils.__version__ diff --git a/test/test_writers/test_html4css1.py b/test/test_writers/test_html4css1.py index 1df84de15..7d87ee324 100755 --- a/test/test_writers/test_html4css1.py +++ b/test/test_writers/test_html4css1.py @@ -1,5 +1,4 @@ #! /usr/bin/env python -# -*- coding: utf-8 -*- # Author: reggie dugard # Contact: reggie@users.sourceforge.net diff --git a/test/test_writers/test_html4css1_misc.py b/test/test_writers/test_html4css1_misc.py index ab728be13..8b63d6f1c 100755 --- a/test/test_writers/test_html4css1_misc.py +++ b/test/test_writers/test_html4css1_misc.py @@ -1,5 +1,4 @@ #! /usr/bin/env python -# -*- coding: utf-8 -*- # Author: Felix Wiemann # Contact: Felix_Wiemann@ososo.de @@ -25,9 +24,11 @@ class EncodingTestCase(DocutilsTestSupport.StandardTestCase): 'stylesheet': '', '_disable_config': 1,} result = core.publish_string( - 'äöü€', writer_name='html4css1', + 'EUR = \xe2\x82\xac', writer_name='html4css1', settings_overrides=settings_overrides) - self.assert_(result.find('\xe4\xf6\xfc€') != -1) + # Encoding a euro sign with latin1 doesn't work, so the + # xmlcharrefreplcae handler is used. + self.assert_(result.find('EUR = €') != -1) if __name__ == '__main__': -- cgit v1.2.1 From f50fd0893b3d46828d2acc46d8aa5c2bfcd9079f Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sat, 29 Oct 2005 12:39:13 +0000 Subject: changed the HTML rendering of the "Authors" bibliographic field git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3971 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_html4css1.html | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index a781aa784..a898da047 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -6,9 +6,7 @@ <meta name="generator" content="Docutils 0.3.10: http://docutils.sourceforge.net/" /> <title>reStructuredText Test Document - - - + @@ -39,12 +37,10 @@ A1B 2C3
    - - - - - - + + -- cgit v1.2.1 From f9f81d1faa5dc25f320f3eec244dd46182dbc9c0 Mon Sep 17 00:00:00 2001 From: wiemann Date: Fri, 11 Nov 2005 16:03:42 +0000 Subject: simplified test git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@4043 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms/test_docinfo.py | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) (limited to 'test') diff --git a/test/test_transforms/test_docinfo.py b/test/test_transforms/test_docinfo.py index d14d2c48f..b2b968391 100755 --- a/test/test_transforms/test_docinfo.py +++ b/test/test_transforms/test_docinfo.py @@ -305,32 +305,22 @@ totest['bibliographic_field_lists'] = ((DocInfo,), [ ["""\ .. RCS keyword extraction. -:Status: $""" + """RCSfile: test_docinfo.py,v $ +:Status: (some text) $""" + """RCSfile: test_docinfo.py,v $ (more text) :Date: (some text) $""" + """Date: 2002/10/08 01:34:23 $ (more text) -:Version: $""" + """Revision: 1.1 $ (still more text) - -RCS keyword 'RCSfile' doesn't change unless the file name changes, -so it's safe. The 'Date' keyword changes every time the file is -checked in to CVS, so the test's expected output text has to be -derived (hacked) in parallel in order to stay in sync. +:Version: (some text) $""" + """Revision: 1.1 $ (more text) """, """\ - test_docinfo.py + (some text) test_docinfo.py (more text) - (some text) %s (more text) + (some text) 2002-10-08 (more text) - 1.1 (still more text) + (some text) 1.1 (more text) RCS keyword extraction. - - RCS keyword 'RCSfile' doesn't change unless the file name changes, - so it's safe. The 'Date' keyword changes every time the file is - checked in to CVS, so the test's expected output text has to be - derived (hacked) in parallel in order to stay in sync. -""" % (('$' 'Date: 2002/10/08 01:34:23 $')[7:17].replace('/', '-'),)], +"""], ]) -- cgit v1.2.1 From 0a2380fb0d3ed4244b6b6b05f6b3fb1236556652 Mon Sep 17 00:00:00 2001 From: wiemann Date: Fri, 11 Nov 2005 16:10:03 +0000 Subject: fixed Subversion Date keyword parsing git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@4044 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms/test_docinfo.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'test') diff --git a/test/test_transforms/test_docinfo.py b/test/test_transforms/test_docinfo.py index b2b968391..b77c568ff 100755 --- a/test/test_transforms/test_docinfo.py +++ b/test/test_transforms/test_docinfo.py @@ -307,6 +307,7 @@ totest['bibliographic_field_lists'] = ((DocInfo,), [ :Status: (some text) $""" + """RCSfile: test_docinfo.py,v $ (more text) :Date: (some text) $""" + """Date: 2002/10/08 01:34:23 $ (more text) +:Date: (some text) $""" + """Date: 2005-03-26T16:21:28.693201Z $ (more text) :Version: (some text) $""" + """Revision: 1.1 $ (more text) """, """\ @@ -316,6 +317,8 @@ totest['bibliographic_field_lists'] = ((DocInfo,), [ (some text) test_docinfo.py (more text) (some text) 2002-10-08 (more text) + + (some text) 2005-03-26 (more text) (some text) 1.1 (more text) -- cgit v1.2.1 From 733eed7d7052687ac904b32406d7359aa01bfb70 Mon Sep 17 00:00:00 2001 From: wiemann Date: Sun, 13 Nov 2005 23:07:31 +0000 Subject: make alltests runnable with "unittestgui.py alltests.suite" git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@4045 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/alltests.py | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) (limited to 'test') diff --git a/test/alltests.py b/test/alltests.py index 9c5d8b0aa..c6a44e003 100755 --- a/test/alltests.py +++ b/test/alltests.py @@ -68,25 +68,27 @@ def pformat(suite): indent -= step return '\n'.join(output) +def suite(): + path, script = os.path.split(sys.argv[0]) + suite = package_unittest.loadTestModules(path, 'test_', packages=1) + sys.stdout.flush() + return suite # must redirect stderr *before* first import of unittest sys.stdout = sys.stderr = Tee('alltests.out') import package_unittest -print ('Testing Docutils %s [%s] with Python %s on %s at %s' - % (docutils.__version__, docutils.__version_details__, - sys.version.split()[0], - time.strftime('%Y-%m-%d'), time.strftime('%H:%M:%S'))) -sys.stdout.flush() -path, script = os.path.split(sys.argv[0]) -suite = package_unittest.loadTestModules(path, 'test_', packages=1) -sys.stdout.flush() - -package_unittest.main(suite) -#if package_unittest.verbosity > 1: -# print >>sys.stderr, pformat(suite) # check the test suite -finish = time.time() - -print 'Elapsed time: %.3f seconds' % (finish - start) +if __name__ == '__main__': + suite = suite() + print ('Testing Docutils %s [%s] with Python %s on %s at %s' + % (docutils.__version__, docutils.__version_details__, + sys.version.split()[0], + time.strftime('%Y-%m-%d'), time.strftime('%H:%M:%S'))) + sys.stdout.flush() + package_unittest.main(suite) + #if package_unittest.verbosity > 1: + # print >>sys.stderr, pformat(suite) # check the test suite + finish = time.time() + print 'Elapsed time: %.3f seconds' % (finish - start) -- cgit v1.2.1 From 510a5a30f076bb454fb0d301820a17fe489f0662 Mon Sep 17 00:00:00 2001 From: wiemann Date: Fri, 18 Nov 2005 19:23:52 +0000 Subject: moved container test to the end of standard.txt test data file; implemented container for latex2e git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@4076 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../expected/standalone_rst_html4css1.html | 88 +++++++++--------- test/functional/expected/standalone_rst_latex.tex | 49 ++++++---- .../expected/standalone_rst_pseudoxml.txt | 101 ++++++++++++--------- test/functional/input/data/standard.txt | 9 ++ test/functional/input/standalone_rst_html4css1.txt | 6 -- 5 files changed, 142 insertions(+), 111 deletions(-) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index a898da047..f95d99cb9 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -125,13 +125,14 @@ They are transformed from section titles after parsing. -->
  • 2.15   Substitution Definitions
  • 2.16   Comments
  • 2.17   Raw text
  • -
  • 2.18   Colspanning tables
  • -
  • 2.19   Rowspanning tables
  • -
  • 2.20   Complex tables
  • -
  • 2.21   List Tables
  • +
  • 2.18   Container
  • +
  • 2.19   Colspanning tables
  • +
  • 2.20   Rowspanning tables
  • +
  • 2.21   Complex tables
  • +
  • 2.22   List Tables
  • -
  • 3   Error Handling
  • +
  • 3   Error Handling
  • @@ -476,7 +477,7 @@ Here's a reference to the next footnote:
    +nonexistent footnote: [5]_.
    list table with integral header
    Contact: goodger@users.sourceforge.net
    Author:Me
    Author:Myself
    Author:I
    Authors:Me +
    Myself +
    I
    Organization: humankind
    Date:
    [4]Here's an unreferenced footnote, with a reference to a -nonexistent footnote: [5]_.
    @@ -489,7 +490,7 @@ nonexistent footnote: [CIT2002], and a [nonexistent]_ +

    Here's a reference to the above, [CIT2002], and a [nonexistent]_ citation.

    @@ -503,7 +504,7 @@ hyperlink targets are also possible.

    "Python [5]".

    Targets may be indirect and anonymous. Thus this phrase may also refer to the Targets section.

    -

    Here's a `hyperlink reference without a target`_, which generates an +

    Here's a `hyperlink reference without a target`_, which generates an error.

    2.13.1   Duplicate Target Names

    @@ -515,34 +516,34 @@ explicit targets will generate "warning" (level-2) system messages.

    2.13.2   Duplicate Target Names

    Since there are two "Duplicate Target Names" section headers, we cannot uniquely refer to either of them by name. If we try to (like -this: `Duplicate Target Names`_), an error is generated.

    +this: `Duplicate Target Names`_), an error is generated.

    2.14   Directives

    These are just a sample of the many reStructuredText Directives. For others, please see http://docutils.sourceforge.net/docs/ref/rst/directives.html.

    -

    2.14.1   Document Parts

    +

    2.14.1   Document Parts

    An example of the "contents" directive can be seen above this section (a local, untitled table of contents) and at the beginning of the document (a document-wide table of contents).

    -

    2.14.2   Images

    +

    2.14.2   Images

    An image directive (also clickable -- a hyperlink reference):

    ../../../docs/user/rst/images/title.png

    Image with multiple IDs:

    @@ -610,7 +611,7 @@ document (a document-wide table o ../../../docs/user/rst/images/biohazard.png
    -

    2.14.3   Admonitions

    +

    2.14.3   Admonitions

    Attention!

    Directives at large.

    @@ -659,7 +660,7 @@ Reader discretion is strongly advised.

    -

    2.14.4   Topics, Sidebars, and Rubrics

    +

    2.14.4   Topics, Sidebars, and Rubrics

    -

    2.14.5   Target Footnotes

    +

    2.14.5   Target Footnotes

    @@ -691,11 +692,11 @@ background color.

    -

    2.14.7   Compound Paragraph

    +

    2.14.7   Compound Paragraph

    Compound 1, paragraph 1.

    Compound 1, paragraph 2.

    @@ -763,7 +764,7 @@ paragraph.
    -

    2.14.8   Parsed Literal Blocks

    +

    2.14.8   Parsed Literal Blocks

     This is a parsed literal block.
         This line is indented.  The next line is blank.
    @@ -795,7 +796,14 @@ Double-dashes - - "- -" - - must be escaped somehow in HTML output. -->
     A test.Second test.
    Another test with myclass set.

    This is the fourth test with myrawroleclass set.

    Fifth test in HTML.
    Line two.
    -

    2.18   Colspanning tables

    +

    2.18   Container

    +
    +

    paragraph 1

    +

    paragraph 2

    +
    +
    +
    +

    2.19   Colspanning tables

    This table has a cell spanning two columns:

    @@ -833,7 +841,7 @@ Fifth test in HTML.
    Line two.
    -

    2.19   Rowspanning tables

    +

    2.20   Rowspanning tables

    Here's a table with cells spanning several rows:

    @@ -866,7 +874,7 @@ cell.
    -

    2.20   Complex tables

    +

    2.21   Complex tables

    Here's a complex table, which should test all features.

    @@ -915,7 +923,7 @@ empty: -->
    -

    2.21   List Tables

    +

    2.22   List Tables

    Here's a list table exercising all features:

    @@ -949,32 +957,28 @@ crunchy, now would it?
    -

    3   Error Handling

    +

    3   Error Handling

    Any errors caught during processing will generate system messages.

    There should be five messages in the following, auto-generated section, "Docutils System Messages":

    -
    -

    paragraph 1

    -

    paragraph 2

    -

    Docutils System Messages

    System Message: ERROR/3 (functional/input/data/standard.txt, line 100); backlink

    Undefined substitution referenced: "problematic".
    -
    -

    System Message: ERROR/3 (functional/input/standalone_rst_html4css1.txt, line 358); backlink

    +
    +

    System Message: ERROR/3 (functional/input/standalone_rst_html4css1.txt, line 358); backlink

    Unknown target name: "5".
    -
    -

    System Message: ERROR/3 (functional/input/data/standard.txt, line 367); backlink

    +
    +

    System Message: ERROR/3 (functional/input/data/standard.txt, line 367); backlink

    Unknown target name: "nonexistent".
    -
    -

    System Message: ERROR/3 (functional/input/data/standard.txt, line 394); backlink

    +
    +

    System Message: ERROR/3 (functional/input/data/standard.txt, line 394); backlink

    Unknown target name: "hyperlink reference without a target".
    -
    -

    System Message: ERROR/3 (functional/input/data/standard.txt, line 407); backlink

    +
    +

    System Message: ERROR/3 (functional/input/data/standard.txt, line 407); backlink

    Duplicate target name, cannot be used as a unique reference: "duplicate target names".
    diff --git a/test/functional/expected/standalone_rst_latex.tex b/test/functional/expected/standalone_rst_latex.tex index 4f318f90a..42cb057a9 100644 --- a/test/functional/expected/standalone_rst_latex.tex +++ b/test/functional/expected/standalone_rst_latex.tex @@ -208,9 +208,11 @@ reStructuredText construct. \item {} \href{\#raw-text}{2.17~~~Raw text} -\item {} \href{\#colspanning-tables}{2.18~~~Colspanning tables} +\item {} \href{\#container}{2.18~~~Container} -\item {} \href{\#rowspanning-tables}{2.19~~~Rowspanning tables} +\item {} \href{\#colspanning-tables}{2.19~~~Colspanning tables} + +\item {} \href{\#rowspanning-tables}{2.20~~~Rowspanning tables} \end{list} @@ -885,9 +887,9 @@ A right-aligned image: {\hfill\includegraphics{../../../docs/user/rst/images/biohazard.png}} A figure directive: -\begin{figure}[htbp]\begin{center} +\begin{figure}[htbp]\begin{flushright} -\includegraphics{../../../docs/user/rst/images/biohazard.png} +\includegraphics[width=50]{../../../docs/user/rst/images/biohazard.png} \caption{A figure is an image with a caption and/or a legend:}{\small \begin{longtable}[c]{|p{0.16\locallinewidth}|p{0.56\locallinewidth}|} \hline @@ -912,31 +914,31 @@ Well it is, isn't it? \end{longtable} This paragraph is also part of the legend. -}\end{center}\end{figure} +}\end{flushright}\end{figure} This paragraph might flow around the figure... A centered figure: -\begin{figure}[htbp]\begin{center} +\begin{figure}[htbp]\begin{flushcenter} -\includegraphics{../../../docs/user/rst/images/biohazard.png} +\includegraphics[width=50]{../../../docs/user/rst/images/biohazard.png} \caption{This is the caption.}{\small This is the legend. The legend may consist of several paragraphs. -}\end{center}\end{figure} +}\end{flushcenter}\end{figure} This paragraph might flow around the figure... A left-aligned figure: -\begin{figure}[htbp]\begin{center} +\begin{figure}[htbp]\begin{flushleft} -\includegraphics{../../../docs/user/rst/images/biohazard.png} +\includegraphics[width=50]{../../../docs/user/rst/images/biohazard.png} \caption{This is the caption.}{\small This is the legend. The legend may consist of several paragraphs. -}\end{center}\end{figure} +}\end{flushleft}\end{figure} This paragraph might flow around the figure... @@ -944,15 +946,15 @@ Now widths: An image 2 em wide: -\includegraphics{../../../docs/user/rst/images/biohazard.png} +\includegraphics[width=2em]{../../../docs/user/rst/images/biohazard.png} An image 2 em wide and 30 pixel high: -\includegraphics{../../../docs/user/rst/images/biohazard.png} +\includegraphics[width=2em]{../../../docs/user/rst/images/biohazard.png} An image occupying 70{\%} of the line width: -\includegraphics{../../../docs/user/rst/images/biohazard.png} +\includegraphics[width=70%]{../../../docs/user/rst/images/biohazard.png} An image 3 cm high: @@ -1253,11 +1255,22 @@ A test.Second test.Another test with myclass set. This is the fourth test with myrawroleclass set. Fifth test in LaTeX.\\Line two. +%___________________________________________________________________________ + +\hypertarget{container}{} +\pdfbookmark[1]{2.18~~~Container}{container} +\subsection*{2.18~~~Container} + +paragraph 1 + +paragraph 2 + + %___________________________________________________________________________ \hypertarget{colspanning-tables}{} -\pdfbookmark[1]{2.18~~~Colspanning tables}{colspanning-tables} -\subsection*{2.18~~~Colspanning tables} +\pdfbookmark[1]{2.19~~~Colspanning tables}{colspanning-tables} +\subsection*{2.19~~~Colspanning tables} This table has a cell spanning two columns: @@ -1316,8 +1329,8 @@ True %___________________________________________________________________________ \hypertarget{rowspanning-tables}{} -\pdfbookmark[1]{2.19~~~Rowspanning tables}{rowspanning-tables} -\subsection*{2.19~~~Rowspanning tables} +\pdfbookmark[1]{2.20~~~Rowspanning tables}{rowspanning-tables} +\subsection*{2.20~~~Rowspanning tables} Here's a table with cells spanning several rows: diff --git a/test/functional/expected/standalone_rst_pseudoxml.txt b/test/functional/expected/standalone_rst_pseudoxml.txt index 22c8f4bde..edce5591d 100644 --- a/test/functional/expected/standalone_rst_pseudoxml.txt +++ b/test/functional/expected/standalone_rst_pseudoxml.txt @@ -294,31 +294,37 @@ Raw text - + 2.18    - Colspanning tables + Container - + 2.19    - Rowspanning tables + Colspanning tables - + 2.20    - Complex tables + Rowspanning tables - + 2.21    + Complex tables + + + + + 2.22    List Tables - + 3    Error Handling @@ -968,7 +974,7 @@ Here's an unreferenced footnote, with a reference to a nonexistent footnote: - + [5]_ .
    @@ -987,7 +993,7 @@ CIT2002 , and a - + [nonexistent]_ citation. @@ -1038,7 +1044,7 @@ Here's a - + `hyperlink reference without a target`_ , which generates an error. @@ -1060,7 +1066,7 @@ Since there are two "Duplicate Target Names" section headers, we cannot uniquely refer to either of them by name. If we try to (like this: - + `Duplicate Target Names`_ ), an error is generated.
    @@ -1072,49 +1078,49 @@ - + 2.14.1    Document Parts - + 2.14.2    Images - + 2.14.3    Admonitions - + 2.14.4    Topics, Sidebars, and Rubrics - + 2.14.5    Target Footnotes - + 2.14.6    Replacement Text - + 2.14.7    Compound Paragraph - + 2.14.8    Parsed Literal Blocks @@ -1125,7 +1131,7 @@ http://docutils.sourceforge.net/docs/ref/rst/directives.html .
    - + <title auto="1" refid="id71"> <generated classes="sectnum"> 2.14.1    Document Parts @@ -1140,7 +1146,7 @@ table of contents ). <section ids="images" names="images"> - <title auto="1" refid="id71"> + <title auto="1" refid="id72"> <generated classes="sectnum"> 2.14.2    Images @@ -1241,7 +1247,7 @@ An image 3 cm high: <image height="3cm" uri="../../../docs/user/rst/images/biohazard.png"> <section ids="admonitions" names="admonitions"> - <title auto="1" refid="id72"> + <title auto="1" refid="id73"> <generated classes="sectnum"> 2.14.3    Admonitions @@ -1291,7 +1297,7 @@ You can make up your own admonition too. <target ids="docutils" names="docutils" refuri="http://docutils.sourceforge.net/"> <section ids="topics-sidebars-and-rubrics" names="topics,\ sidebars,\ and\ rubrics"> - <title auto="1" refid="id73"> + <title auto="1" refid="id74"> <generated classes="sectnum"> 2.14.4    Topics, Sidebars, and Rubrics @@ -1316,7 +1322,7 @@ <rubric> This is a rubric <section ids="target-footnotes" names="target\ footnotes"> - <title auto="1" refid="id74"> + <title auto="1" refid="id75"> <generated classes="sectnum"> 2.14.5    Target Footnotes @@ -1333,7 +1339,7 @@ <reference refuri="http://docutils.sourceforge.net/"> http://docutils.sourceforge.net/ <section ids="replacement-text" names="replacement\ text"> - <title auto="1" refid="id75"> + <title auto="1" refid="id76"> <generated classes="sectnum"> 2.14.6    Replacement Text @@ -1354,7 +1360,7 @@ the best language around <section ids="compound-paragraph" names="compound\ paragraph"> - <title auto="1" refid="id76"> + <title auto="1" refid="id77"> <generated classes="sectnum"> 2.14.7    Compound Paragraph @@ -1440,7 +1446,7 @@ <paragraph> Compound 7, another paragraph. <section ids="parsed-literal-blocks" names="parsed\ literal\ blocks"> - <title auto="1" refid="id77"> + <title auto="1" refid="id78"> <generated classes="sectnum"> 2.14.8    Parsed Literal Blocks @@ -1521,10 +1527,20 @@ Fifth test in HTML.<br />Line two. <raw format="latex" xml:space="preserve"> Fifth test in LaTeX.\\Line two. - <section ids="colspanning-tables" names="colspanning\ tables"> + <section ids="container" names="container"> <title auto="1" refid="id65"> <generated classes="sectnum"> 2.18    + Container + <container classes="custom"> + <paragraph> + paragraph 1 + <paragraph> + paragraph 2 + <section ids="colspanning-tables" names="colspanning\ tables"> + <title auto="1" refid="id66"> + <generated classes="sectnum"> + 2.19    Colspanning tables <paragraph> This table has a cell spanning two columns: @@ -1593,9 +1609,9 @@ <paragraph> True <section ids="rowspanning-tables" names="rowspanning\ tables"> - <title auto="1" refid="id66"> + <title auto="1" refid="id67"> <generated classes="sectnum"> - 2.19    + 2.20    Rowspanning tables <paragraph> Here's a table with cells spanning several rows: @@ -1645,9 +1661,9 @@ <paragraph> body row 3 <section ids="complex-tables" names="complex\ tables"> - <title auto="1" refid="id67"> + <title auto="1" refid="id68"> <generated classes="sectnum"> - 2.20    + 2.21    Complex tables <paragraph> Here's a complex table, which should test all features. @@ -1730,9 +1746,9 @@ --> <entry> <section ids="list-tables" names="list\ tables"> - <title auto="1" refid="id68"> + <title auto="1" refid="id69"> <generated classes="sectnum"> - 2.21    + 2.22    List Tables <paragraph> Here's a list table exercising all features: @@ -1787,7 +1803,7 @@ <paragraph> On a stick! <section ids="error-handling" names="error\ handling"> - <title auto="1" refid="id69"> + <title auto="1" refid="id70"> <generated classes="sectnum"> 3    Error Handling @@ -1798,26 +1814,21 @@ section, "Docutils System Messages": <comment xml:space="preserve"> section should be added by Docutils automatically - <container classes="custom"> - <paragraph> - paragraph 1 - <paragraph> - paragraph 2 <section classes="system-messages"> <title> Docutils System Messages <system_message backrefs="id24" ids="id23" level="3" line="100" source="functional/input/data/standard.txt" type="ERROR"> <paragraph> Undefined substitution referenced: "problematic". - <system_message backrefs="id79" ids="id78" level="3" line="358" source="functional/input/standalone_rst_html4css1.txt" type="ERROR"> + <system_message backrefs="id80" ids="id79" level="3" line="358" source="functional/input/standalone_rst_html4css1.txt" type="ERROR"> <paragraph> Unknown target name: "5". - <system_message backrefs="id81" ids="id80" level="3" line="367" source="functional/input/data/standard.txt" type="ERROR"> + <system_message backrefs="id82" ids="id81" level="3" line="367" source="functional/input/data/standard.txt" type="ERROR"> <paragraph> Unknown target name: "nonexistent". - <system_message backrefs="id83" ids="id82" level="3" line="394" source="functional/input/data/standard.txt" type="ERROR"> + <system_message backrefs="id84" ids="id83" level="3" line="394" source="functional/input/data/standard.txt" type="ERROR"> <paragraph> Unknown target name: "hyperlink reference without a target". - <system_message backrefs="id85" ids="id84" level="3" line="407" source="functional/input/data/standard.txt" type="ERROR"> + <system_message backrefs="id86" ids="id85" level="3" line="407" source="functional/input/data/standard.txt" type="ERROR"> <paragraph> Duplicate target name, cannot be used as a unique reference: "duplicate target names". diff --git a/test/functional/input/data/standard.txt b/test/functional/input/data/standard.txt index ea904eaec..c3e12d199 100644 --- a/test/functional/input/data/standard.txt +++ b/test/functional/input/data/standard.txt @@ -731,3 +731,12 @@ This is the :raw-role:`fourth test` with myrawroleclass set. .. raw:: latex Fifth test in LaTeX.\\Line two. + +Container +--------- + +.. container:: custom + + paragraph 1 + + paragraph 2 diff --git a/test/functional/input/standalone_rst_html4css1.txt b/test/functional/input/standalone_rst_html4css1.txt index 4b1e2fdda..05f0287d0 100644 --- a/test/functional/input/standalone_rst_html4css1.txt +++ b/test/functional/input/standalone_rst_html4css1.txt @@ -5,9 +5,3 @@ .. include:: data/table_complex.txt .. include:: data/list_table.txt .. include:: data/errors.txt - -.. container:: custom - - paragraph 1 - - paragraph 2 -- cgit v1.2.1 From ced6843a40a4b84b50b10c1106edfe80e088fbaa Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sat, 19 Nov 2005 23:48:04 +0000 Subject: allow escaped colons inside of fields git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@4083 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_parsers/test_rst/test_field_lists.py | 50 ++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_field_lists.py b/test/test_parsers/test_rst/test_field_lists.py index 4bda460bf..2e715770c 100755 --- a/test/test_parsers/test_rst/test_field_lists.py +++ b/test/test_parsers/test_rst/test_field_lists.py @@ -454,8 +454,7 @@ Nested field lists on one line: <paragraph> should generate warning. """], -["""\ -Some edge cases: +[r"""Some edge cases: :Empty: :Author: Me @@ -468,6 +467,21 @@ No blank line before this paragraph. Field: marker is missing its open-colon. :Field marker is missing its close-colon. + +:Field\: names\: with\: colons\:: are possible. + +:\\Field\ names with backslashes\\: are possible, too. + +:\\: A backslash. + +:Not a\\\: field list. + +:Not a \: field list either. + +:\: Not a field list either. + +:\: + A definition list, not a field list. """, """\ <document source="test data"> @@ -497,6 +511,38 @@ Field: marker is missing its open-colon. Field: marker is missing its open-colon. <paragraph> :Field marker is missing its close-colon. + <field_list> + <field> + <field_name> + Field: names: with: colons: + <field_body> + <paragraph> + are possible. + <field> + <field_name> + \\Field names with backslashes\\ + <field_body> + <paragraph> + are possible, too. + <field> + <field_name> + \\ + <field_body> + <paragraph> + A backslash. + <paragraph> + :Not a\\: field list. + <paragraph> + :Not a : field list either. + <paragraph> + :: Not a field list either. + <definition_list> + <definition_list_item> + <term> + :: + <definition> + <paragraph> + A definition list, not a field list. """], ] -- cgit v1.2.1 From 9a06f1b58bf466eba15dc5b9ebfe1ed4c326f576 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sun, 20 Nov 2005 19:54:07 +0000 Subject: added functional test for left-aligned figure git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@4088 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/standalone_rst_html4css1.html | 6 ++++++ test/functional/expected/standalone_rst_latex.tex | 6 ++++++ test/functional/expected/standalone_rst_pseudoxml.txt | 7 +++++++ test/functional/input/data/standard.txt | 11 +++++++++++ 4 files changed, 30 insertions(+) (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index f95d99cb9..dd19f2710 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -579,6 +579,12 @@ document (a document-wide <a class="reference" href="#table-of-contents">table o <p>This paragraph is also part of the legend.</p> </div> </div> +<div align="left" class="figclass1 figclass2 figure"> +<img alt="reStructuredText, the markup syntax" class="class1 class2" src="../../../docs/user/rst/images/biohazard.png" style="width: 50px;" /> +<p class="caption">A left-aligned figure.</p> +<div class="legend"> +This is the legend.</div> +</div> <p>This paragraph might flow around the figure...</p> <p>A centered figure:</p> <div align="center" class="figure"> diff --git a/test/functional/expected/standalone_rst_latex.tex b/test/functional/expected/standalone_rst_latex.tex index 42cb057a9..ba5b63bb0 100644 --- a/test/functional/expected/standalone_rst_latex.tex +++ b/test/functional/expected/standalone_rst_latex.tex @@ -915,6 +915,12 @@ Well it is, isn't it? This paragraph is also part of the legend. }\end{flushright}\end{figure} +\begin{figure}[htbp]\begin{flushleft} + +\includegraphics[width=50]{../../../docs/user/rst/images/biohazard.png} +\caption{A left-aligned figure.}{\small +This is the legend. +}\end{flushleft}\end{figure} This paragraph might flow around the figure... diff --git a/test/functional/expected/standalone_rst_pseudoxml.txt b/test/functional/expected/standalone_rst_pseudoxml.txt index edce5591d..e416c12ab 100644 --- a/test/functional/expected/standalone_rst_pseudoxml.txt +++ b/test/functional/expected/standalone_rst_pseudoxml.txt @@ -1204,6 +1204,13 @@ Well it is, isn't it? <paragraph> This paragraph is also part of the legend. + <figure align="left" classes="figclass1 figclass2"> + <image alt="reStructuredText, the markup syntax" classes="class1 class2" uri="../../../docs/user/rst/images/biohazard.png" width="50"> + <caption> + A left-aligned figure. + <legend> + <paragraph> + This is the legend. <paragraph> This paragraph might flow around the figure... <paragraph> diff --git a/test/functional/input/data/standard.txt b/test/functional/input/data/standard.txt index c3e12d199..a0d1570ed 100644 --- a/test/functional/input/data/standard.txt +++ b/test/functional/input/data/standard.txt @@ -474,6 +474,17 @@ A figure directive: This paragraph is also part of the legend. +.. figure:: ../../../docs/user/rst/images/biohazard.png + :figclass: figclass1 figclass2 + :class: class1 class2 + :alt: reStructuredText, the markup syntax + :align: left + :width: 50 + + A left-aligned figure. + + This is the legend. + This paragraph might flow around the figure... A centered figure: -- cgit v1.2.1 From 579928eeb2451d0681415f274e6349d855fd35f6 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Wed, 30 Nov 2005 00:06:38 +0000 Subject: removed unnecessary stylesheet_path settings git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@4118 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/tests/dangerous.py | 1 - test/functional/tests/field_name_limit.py | 1 - test/functional/tests/pep_html.py | 2 -- test/functional/tests/standalone_rst_html4css1.py | 3 +-- 4 files changed, 1 insertion(+), 6 deletions(-) (limited to 'test') diff --git a/test/functional/tests/dangerous.py b/test/functional/tests/dangerous.py index b2faca07a..620a927ba 100644 --- a/test/functional/tests/dangerous.py +++ b/test/functional/tests/dangerous.py @@ -10,4 +10,3 @@ writer_name = "html" # Settings settings_overrides['file_insertion_enabled'] = 0 settings_overrides['raw_enabled'] = 0 -settings_overrides['stylesheet_path'] = "../docutils/writers/support/html4css1.css" diff --git a/test/functional/tests/field_name_limit.py b/test/functional/tests/field_name_limit.py index 27c5c296e..db79d4c67 100644 --- a/test/functional/tests/field_name_limit.py +++ b/test/functional/tests/field_name_limit.py @@ -10,4 +10,3 @@ writer_name = "html" # Settings settings_overrides['field_name_limit'] = 0 # no limit settings_overrides['docinfo_xform'] = 0 -settings_overrides['stylesheet_path'] = "../docutils/writers/support/html4css1.css" diff --git a/test/functional/tests/pep_html.py b/test/functional/tests/pep_html.py index 5a292b207..00e127ba7 100644 --- a/test/functional/tests/pep_html.py +++ b/test/functional/tests/pep_html.py @@ -8,8 +8,6 @@ parser_name = "rst" writer_name = "pep_html" # Settings -settings_overrides['stylesheet_path'] = ( - "../docutils/writers/support/pep_html/pep.css") settings_overrides['python_home'] = "http://www.python.org" settings_overrides['pep_home'] = "http://www.python.org/peps" settings_overrides['no_random'] = 1 diff --git a/test/functional/tests/standalone_rst_html4css1.py b/test/functional/tests/standalone_rst_html4css1.py index 874deada5..c34298eab 100644 --- a/test/functional/tests/standalone_rst_html4css1.py +++ b/test/functional/tests/standalone_rst_html4css1.py @@ -7,5 +7,4 @@ test_destination = "standalone_rst_html4css1.html" # Keyword parameters passed to publish_file. writer_name = "html4css1" -# Settings. -settings_overrides['stylesheet_path'] = "../docutils/writers/support/html4css1.css" +# Settings: settings_overrides['setting'] = value -- cgit v1.2.1 From ac71c958c50062334eab3f20045afe1a247e2d99 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Wed, 30 Nov 2005 23:52:13 +0000 Subject: updated expected functional test files git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@4119 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/dangerous.html | 2 +- test/functional/expected/field_name_limit.html | 2 +- test/functional/expected/pep_html.html | 2 +- test/functional/expected/standalone_rst_html4css1.html | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/functional/expected/dangerous.html b/test/functional/expected/dangerous.html index 8eb626e62..c6d403a23 100644 --- a/test/functional/expected/dangerous.html +++ b/test/functional/expected/dangerous.html @@ -5,7 +5,7 @@ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="generator" content="Docutils 0.3.10: http://docutils.sourceforge.net/" /> <title> - +
    diff --git a/test/functional/expected/field_name_limit.html b/test/functional/expected/field_name_limit.html index 81bc6dc3a..c4539909a 100644 --- a/test/functional/expected/field_name_limit.html +++ b/test/functional/expected/field_name_limit.html @@ -5,7 +5,7 @@ - +
    diff --git a/test/functional/expected/pep_html.html b/test/functional/expected/pep_html.html index 277b2e6ca..444fa5d3c 100644 --- a/test/functional/expected/pep_html.html +++ b/test/functional/expected/pep_html.html @@ -10,7 +10,7 @@ to templates. DO NOT USE THIS HTML FILE AS YOUR TEMPLATE! PEP 100 -- Test PEP - +
    list table with integral header
    - +
    -- cgit v1.2.1 From 620f3f7758d2d4723b0024a33026c3a1020fc560 Mon Sep 17 00:00:00 2001 From: goodger Date: Thu, 1 Dec 2005 03:02:02 +0000 Subject: revert revision 4119 git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@4121 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/functional/expected/dangerous.html | 2 +- test/functional/expected/field_name_limit.html | 2 +- test/functional/expected/pep_html.html | 2 +- test/functional/expected/standalone_rst_html4css1.html | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/functional/expected/dangerous.html b/test/functional/expected/dangerous.html index c6d403a23..8eb626e62 100644 --- a/test/functional/expected/dangerous.html +++ b/test/functional/expected/dangerous.html @@ -5,7 +5,7 @@ - +
    diff --git a/test/functional/expected/field_name_limit.html b/test/functional/expected/field_name_limit.html index c4539909a..81bc6dc3a 100644 --- a/test/functional/expected/field_name_limit.html +++ b/test/functional/expected/field_name_limit.html @@ -5,7 +5,7 @@ - +
    diff --git a/test/functional/expected/pep_html.html b/test/functional/expected/pep_html.html index 444fa5d3c..277b2e6ca 100644 --- a/test/functional/expected/pep_html.html +++ b/test/functional/expected/pep_html.html @@ -10,7 +10,7 @@ to templates. DO NOT USE THIS HTML FILE AS YOUR TEMPLATE! PEP 100 -- Test PEP - +
    - +
    -- cgit v1.2.1 From 61fff66ccbdf0463f131340e2349e7042eb568a6 Mon Sep 17 00:00:00 2001 From: goodger Date: Sat, 3 Dec 2005 02:11:03 +0000 Subject: set sys.path to pick up the right Docutils git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@4131 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/DocutilsTestSupport.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/DocutilsTestSupport.py b/test/DocutilsTestSupport.py index 6947c4478..5ad3673d4 100644 --- a/test/DocutilsTestSupport.py +++ b/test/DocutilsTestSupport.py @@ -43,6 +43,10 @@ __docformat__ = 'reStructuredText' import sys import os + +testroot = os.path.abspath(os.path.dirname(__file__) or os.curdir) +sys.path.insert(1, os.path.normpath(os.path.join(testroot, '..'))) + import unittest import docutils_difflib import inspect @@ -75,9 +79,6 @@ except: StringList.__repr__ = StringList.__str__ -testroot = os.path.abspath(os.path.dirname(__file__) or os.curdir) - - class DevNull: """Output sink.""" -- cgit v1.2.1 From 7e720ee65bc79a0430adb825f3deae4c93424959 Mon Sep 17 00:00:00 2001 From: goodger Date: Sat, 3 Dec 2005 02:13:12 +0000 Subject: corrected order of imports git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@4132 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/alltests.py | 1 + test/test_dependencies.py | 2 +- test/test_functional.py | 2 +- test/test_io.py | 1 + test/test_language.py | 11 ++++++----- test/test_nodes.py | 1 + test/test_publisher.py | 4 +--- test/test_settings.py | 1 + test/test_transforms/test___init__.py | 1 + test/test_transforms/test_expose_internals.py | 2 +- test/test_transforms/test_transitions.py | 2 +- test/test_transforms/test_writer_aux.py | 2 +- 12 files changed, 17 insertions(+), 13 deletions(-) (limited to 'test') diff --git a/test/alltests.py b/test/alltests.py index c6a44e003..edf1ac7ad 100755 --- a/test/alltests.py +++ b/test/alltests.py @@ -22,6 +22,7 @@ start = time.time() import sys import os from types import UnicodeType +import DocutilsTestSupport # must be imported before docutils import docutils diff --git a/test/test_dependencies.py b/test/test_dependencies.py index c9f00518d..46e8ff846 100755 --- a/test/test_dependencies.py +++ b/test/test_dependencies.py @@ -13,9 +13,9 @@ Test module for the --record-dependencies option. import os.path import unittest import sys +import DocutilsTestSupport # must be imported before docutils import docutils.core import docutils.utils -import DocutilsTestSupport class RecordDependenciesTests(unittest.TestCase): diff --git a/test/test_functional.py b/test/test_functional.py index e52d41422..1cebc2462 100755 --- a/test/test_functional.py +++ b/test/test_functional.py @@ -17,9 +17,9 @@ import os import os.path import unittest import difflib +import DocutilsTestSupport # must be imported before docutils import docutils import docutils.core -import DocutilsTestSupport datadir = 'functional' diff --git a/test/test_io.py b/test/test_io.py index e65b05c6c..b82911e44 100755 --- a/test/test_io.py +++ b/test/test_io.py @@ -11,6 +11,7 @@ Test module for io.py. """ import unittest +import DocutilsTestSupport # must be imported before docutils from docutils import io diff --git a/test/test_language.py b/test/test_language.py index 79509b46a..0571275e7 100755 --- a/test/test_language.py +++ b/test/test_language.py @@ -17,20 +17,21 @@ import sys import os import re from types import UnicodeType +import DocutilsTestSupport # must be imported before docutils import docutils.languages import docutils.parsers.rst.languages from docutils.parsers.rst import states, directives, roles -from DocutilsTestSupport import CustomTestSuite, CustomTestCase + reference_language = 'en' -class LanguageTestSuite(CustomTestSuite): +class LanguageTestSuite(DocutilsTestSupport.CustomTestSuite): language_module_pattern = re.compile('^([a-z]{2,3}(_[a-z]{2,8})*)\.py$') def __init__(self, languages=None): - CustomTestSuite.__init__(self) + DocutilsTestSupport.CustomTestSuite.__init__(self) if languages: self.languages = languages else: @@ -56,7 +57,7 @@ class LanguageTestSuite(CustomTestSuite): id=language+'.py', language=language) -class LanguageTestCase(CustomTestCase): +class LanguageTestCase(DocutilsTestSupport.CustomTestCase): test_methods = ['test_labels', 'test_bibliographic_fields', 'test_directives', 'test_roles'] @@ -66,7 +67,7 @@ class LanguageTestCase(CustomTestCase): self.ref = docutils.languages.get_language(reference_language) self.language = kwargs['language'] del kwargs['language'] # only wanted here - CustomTestCase.__init__(self, *args, **kwargs) + DocutilsTestSupport.CustomTestCase.__init__(self, *args, **kwargs) def _xor(self, ref_dict, l_dict): """ diff --git a/test/test_nodes.py b/test/test_nodes.py index 4471b3a15..5467c5490 100755 --- a/test/test_nodes.py +++ b/test/test_nodes.py @@ -12,6 +12,7 @@ Test module for nodes.py. import unittest from types import ClassType +import DocutilsTestSupport # must be imported before docutils from DocutilsTestSupport import nodes, utils debug = 0 diff --git a/test/test_publisher.py b/test/test_publisher.py index 545822bc6..708c3ef87 100755 --- a/test/test_publisher.py +++ b/test/test_publisher.py @@ -12,12 +12,10 @@ Test the `Publisher` facade and the ``publish_*`` convenience functions. import pickle from types import StringType, DictType - +import DocutilsTestSupport # must be imported before docutils import docutils from docutils import core, nodes, io -import DocutilsTestSupport - test_document = """\ Test Document diff --git a/test/test_settings.py b/test/test_settings.py index 4226af580..157cb71e1 100755 --- a/test/test_settings.py +++ b/test/test_settings.py @@ -17,6 +17,7 @@ import pprint import warnings import unittest from types import StringType +import DocutilsTestSupport # must be imported before docutils from docutils import frontend, utils from docutils.writers import html4css1, pep_html from docutils.parsers import rst diff --git a/test/test_transforms/test___init__.py b/test/test_transforms/test___init__.py index a126d8854..30e60afd3 100755 --- a/test/test_transforms/test___init__.py +++ b/test/test_transforms/test___init__.py @@ -10,6 +10,7 @@ Test module for transforms/__init__.py. """ +from __init__ import DocutilsTestSupport # must be imported before docutils from docutils import transforms, utils import unittest diff --git a/test/test_transforms/test_expose_internals.py b/test/test_transforms/test_expose_internals.py index db19d2a0a..69193246a 100755 --- a/test/test_transforms/test_expose_internals.py +++ b/test/test_transforms/test_expose_internals.py @@ -11,8 +11,8 @@ Test module for universal.ExposeInternals transform. """ +from __init__ import DocutilsTestSupport # must be imported before docutils from docutils.transforms.universal import ExposeInternals -from __init__ import DocutilsTestSupport from docutils.parsers.rst import Parser def suite(): diff --git a/test/test_transforms/test_transitions.py b/test/test_transforms/test_transitions.py index e450ddff7..098c8bba3 100755 --- a/test/test_transforms/test_transitions.py +++ b/test/test_transforms/test_transitions.py @@ -10,8 +10,8 @@ Test module for misc.Transitions transform. """ +from __init__ import DocutilsTestSupport # must be imported before docutils from docutils.transforms.misc import Transitions -from __init__ import DocutilsTestSupport from docutils.parsers.rst import Parser def suite(): diff --git a/test/test_transforms/test_writer_aux.py b/test/test_transforms/test_writer_aux.py index 34b723241..5ec040a69 100755 --- a/test/test_transforms/test_writer_aux.py +++ b/test/test_transforms/test_writer_aux.py @@ -10,8 +10,8 @@ Test module for writer_aux transforms. """ +from __init__ import DocutilsTestSupport # must be imported before docutils from docutils.transforms import writer_aux -from __init__ import DocutilsTestSupport from docutils.parsers.rst import Parser def suite(): -- cgit v1.2.1 From 2ee75a675d5c74d75b587b2d28de459436ac25e6 Mon Sep 17 00:00:00 2001 From: goodger Date: Tue, 6 Dec 2005 01:06:33 +0000 Subject: Fixed bugs: list items with blank first lines; block quote attributions with indented second lines. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@4147 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_parsers/test_rst/test_block_quotes.py | 4 ++ .../test_parsers/test_rst/test_enumerated_lists.py | 66 ++++++++++++++++++++++ 2 files changed, 70 insertions(+) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_block_quotes.py b/test/test_parsers/test_rst/test_block_quotes.py index b94fa8588..dd7561723 100755 --- a/test/test_parsers/test_rst/test_block_quotes.py +++ b/test/test_parsers/test_rst/test_block_quotes.py @@ -191,6 +191,8 @@ Paragraph. -- Attribution line one and line two + +Paragraph. """, """\ @@ -210,6 +212,8 @@ Paragraph. Attribution line one and line two + + Paragraph. """], ["""\ Paragraph. diff --git a/test/test_parsers/test_rst/test_enumerated_lists.py b/test/test_parsers/test_rst/test_enumerated_lists.py index b8ab093e5..0375b33e9 100755 --- a/test/test_parsers/test_rst/test_enumerated_lists.py +++ b/test/test_parsers/test_rst/test_enumerated_lists.py @@ -834,6 +834,72 @@ x z. x """], +["""\ +3-space indent, with a trailing space: + +1. \n\ + foo + +3-space indent, no trailing space: + +1. + foo + +2-space indent: + +1. + foo + +1-space indent: + +1. + foo + +0-space indent, not a list item: + +1. +foo + +No item content: + +1. +""", +"""\ + + + 3-space indent, with a trailing space: + + + + foo + + 3-space indent, no trailing space: + + + + foo + + 2-space indent: + + + + foo + + 1-space indent: + + + + foo + + 0-space indent, not a list item: + + 1. + foo + + No item content: + + +"""], ] -- cgit v1.2.1 From e571eb6f3616063e8cc1096b3451aa6f3e659858 Mon Sep 17 00:00:00 2001 From: goodger Date: Wed, 7 Dec 2005 23:46:30 +0000 Subject: added East Asian double-width character support; thanks to Frank Bennett for inspiration on ``docutils.utils.east_asian_column_width()`` git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@4152 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_parsers/test_rst/test_east_asian_text.py | 324 +++++++++++++++++++++ 1 file changed, 324 insertions(+) create mode 100755 test/test_parsers/test_rst/test_east_asian_text.py (limited to 'test') diff --git a/test/test_parsers/test_rst/test_east_asian_text.py b/test/test_parsers/test_rst/test_east_asian_text.py new file mode 100755 index 000000000..1ac27743e --- /dev/null +++ b/test/test_parsers/test_rst/test_east_asian_text.py @@ -0,0 +1,324 @@ +#! /usr/bin/env python +# -*- coding: utf-8 -*- + +# Author: David Goodger +# Contact: goodger@python.org +# Revision: $Revision$ +# Date: $Date$ +# Copyright: This module has been placed in the public domain. + +""" +Tests for East Asian text with double-width characters. +""" + +from __init__ import DocutilsTestSupport + +import unicodedata +try: + east_asian_width = unicodedata.east_asian_width +except AttributeError: + east_asian_width = None + +def suite(): + s = DocutilsTestSupport.ParserTestSuite() + s.generateTests(totest) + return s + +totest = {} + +if not east_asian_width: + print ('test_east_asian_text.py tests skipped; ' + 'Python 2.4 or higher required.') +else: + totest['double-width'] = [ +[u"""\ +タイトル1 +========= + +タイトル2 +======== +""", +u"""\ + +
    + + タイトル1 + <section ids="id2" names="タイトル2"> + <title> + タイトル2 + <system_message level="2" line="5" source="test data" type="WARNING"> + <paragraph> + Title underline too short. + <literal_block xml:space="preserve"> + タイトル2 + ======== +"""], +[ur""" ++-----------------------+ +| * ヒョウ:ダイ1ギョウ | +| * ダイ2ギョウ | ++-----------------------+ +| \* ダイ1ギョウ | +| * ダイ2ギョウ | ++-----------------------+ +""", +u"""\ +<document source="test data"> + <table> + <tgroup cols="1"> + <colspec colwidth="23"> + <tbody> + <row> + <entry> + <bullet_list bullet="*"> + <list_item> + <paragraph> + ヒョウ:ダイ1ギョウ + <list_item> + <paragraph> + ダイ2ギョウ + <row> + <entry> + <paragraph> + * ダイ1ギョウ + * ダイ2ギョウ +"""], +[u"""\ +Complex spanning pattern (no edge knows all rows/cols): + ++--------+---------------------+ +| 北西・ | 北・北æ±ã‚»ãƒ« | +| 西セル +--------------+------+ +| | 真ん中ã®ã‚»ãƒ« | æ±ãƒ» | ++--------+--------------+ å—æ± | +| å—西・å—セル | セル | ++-----------------------+------+ +""", +u"""\ +<document source="test data"> + <paragraph> + Complex spanning pattern (no edge knows all rows/cols): + <table> + <tgroup cols="3"> + <colspec colwidth="8"> + <colspec colwidth="14"> + <colspec colwidth="6"> + <tbody> + <row> + <entry morerows="1"> + <paragraph> + 北西・ + 西セル + <entry morecols="1"> + <paragraph> + 北・北æ±ã‚»ãƒ« + <row> + <entry> + <paragraph> + 真ん中ã®ã‚»ãƒ« + <entry morerows="1"> + <paragraph> + æ±ãƒ» + å—æ± + セル + <row> + <entry morecols="1"> + <paragraph> + å—西・å—セル +"""], +[u"""\ +========= ========= +ダイ1ラン ダイ2ラン +========= ========= + +======== ========= +ダイ1ラン ダイ2ラン +======== ========= +""", +u"""\ +<document source="test data"> + <table> + <tgroup cols="2"> + <colspec colwidth="9"> + <colspec colwidth="9"> + <tbody> + <row> + <entry> + <paragraph> + ダイ1ラン + <entry> + <paragraph> + ダイ2ラン + <system_message level="3" line="5" source="test data" type="ERROR"> + <paragraph> + Malformed table. + Text in column margin at line offset 1. + <literal_block xml:space="preserve"> + ======== ========= + ダイ1ラン ダイ2ラン + ======== ========= +"""], +[u"""\ +Some ambiguous-width characters: + += =================================== +© copyright sign +® registered sign +« left pointing guillemet +» right pointing guillemet +– en-dash +— em-dash +‘ single turned comma quotation mark +’ single comma quotation mark +‚ low single comma quotation mark +“ double turned comma quotation mark +†double comma quotation mark +„ low double comma quotation mark +† dagger +‡ double dagger +… ellipsis +â„¢ trade mark sign +⇔ left-right double arrow += =================================== +""", +u"""\ +<document source="test data"> + <paragraph> + Some ambiguous-width characters: + <table> + <tgroup cols="2"> + <colspec colwidth="1"> + <colspec colwidth="35"> + <tbody> + <row> + <entry> + <paragraph> + \xa9 + <entry> + <paragraph> + copyright sign + <row> + <entry> + <paragraph> + \xae + <entry> + <paragraph> + registered sign + <row> + <entry> + <paragraph> + \xab + <entry> + <paragraph> + left pointing guillemet + <row> + <entry> + <paragraph> + \xbb + <entry> + <paragraph> + right pointing guillemet + <row> + <entry> + <paragraph> + \\u2013 + <entry> + <paragraph> + en-dash + <row> + <entry> + <paragraph> + \\u2014 + <entry> + <paragraph> + em-dash + <row> + <entry> + <paragraph> + \\u2018 + <entry> + <paragraph> + single turned comma quotation mark + <row> + <entry> + <paragraph> + \\u2019 + <entry> + <paragraph> + single comma quotation mark + <row> + <entry> + <paragraph> + \\u201a + <entry> + <paragraph> + low single comma quotation mark + <row> + <entry> + <paragraph> + \\u201c + <entry> + <paragraph> + double turned comma quotation mark + <row> + <entry> + <paragraph> + \\u201d + <entry> + <paragraph> + double comma quotation mark + <row> + <entry> + <paragraph> + \\u201e + <entry> + <paragraph> + low double comma quotation mark + <row> + <entry> + <paragraph> + \\u2020 + <entry> + <paragraph> + dagger + <row> + <entry> + <paragraph> + \\u2021 + <entry> + <paragraph> + double dagger + <row> + <entry> + <paragraph> + \\u2026 + <entry> + <paragraph> + ellipsis + <row> + <entry> + <paragraph> + \\u2122 + <entry> + <paragraph> + trade mark sign + <row> + <entry> + <paragraph> + \\u21d4 + <entry> + <paragraph> + left-right double arrow +"""], +] +''' +[u"""\ +""", +u"""\ +"""], +''' + + +if __name__ == '__main__': + import unittest + unittest.main(defaultTest='suite') -- cgit v1.2.1 From 118dd3d2aa36cf563590197e28830c1a905f9cd8 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Thu, 8 Dec 2005 04:43:13 +0000 Subject: merged branches/s5 changes r4011:4155 into trunk/docutils git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@4156 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../expected/standalone_rst_html4css1.html | 2 +- .../expected/standalone_rst_s5_html_1.html | 148 ++++++ .../expected/standalone_rst_s5_html_2.html | 144 ++++++ test/functional/expected/ui/default/blank.gif | Bin 0 -> 49 bytes test/functional/expected/ui/default/framing.css | 25 + test/functional/expected/ui/default/iepngfix.htc | 42 ++ test/functional/expected/ui/default/opera.css | 8 + test/functional/expected/ui/default/outline.css | 21 + test/functional/expected/ui/default/pretty.css | 122 +++++ test/functional/expected/ui/default/print.css | 33 ++ test/functional/expected/ui/default/s5-core.css | 11 + test/functional/expected/ui/default/slides.css | 10 + test/functional/expected/ui/default/slides.js | 559 +++++++++++++++++++++ test/functional/expected/ui/small-black/blank.gif | Bin 0 -> 49 bytes .../functional/expected/ui/small-black/framing.css | 24 + .../expected/ui/small-black/iepngfix.htc | 42 ++ test/functional/expected/ui/small-black/opera.css | 8 + .../functional/expected/ui/small-black/outline.css | 21 + test/functional/expected/ui/small-black/pretty.css | 118 +++++ test/functional/expected/ui/small-black/print.css | 33 ++ .../functional/expected/ui/small-black/s5-core.css | 11 + test/functional/expected/ui/small-black/slides.css | 10 + test/functional/expected/ui/small-black/slides.js | 559 +++++++++++++++++++++ test/functional/input/standalone_rst_s5_html.txt | 126 +++++ test/functional/tests/standalone_rst_s5_html_1.py | 44 ++ test/functional/tests/standalone_rst_s5_html_2.py | 7 + test/test_functional.py | 50 +- .../test_rst/test_directives/test_target_notes.py | 64 +++ test/test_transforms/test_target_notes.py | 84 ++++ 29 files changed, 2310 insertions(+), 16 deletions(-) create mode 100644 test/functional/expected/standalone_rst_s5_html_1.html create mode 100644 test/functional/expected/standalone_rst_s5_html_2.html create mode 100644 test/functional/expected/ui/default/blank.gif create mode 100644 test/functional/expected/ui/default/framing.css create mode 100644 test/functional/expected/ui/default/iepngfix.htc create mode 100644 test/functional/expected/ui/default/opera.css create mode 100644 test/functional/expected/ui/default/outline.css create mode 100644 test/functional/expected/ui/default/pretty.css create mode 100644 test/functional/expected/ui/default/print.css create mode 100644 test/functional/expected/ui/default/s5-core.css create mode 100644 test/functional/expected/ui/default/slides.css create mode 100644 test/functional/expected/ui/default/slides.js create mode 100644 test/functional/expected/ui/small-black/blank.gif create mode 100644 test/functional/expected/ui/small-black/framing.css create mode 100644 test/functional/expected/ui/small-black/iepngfix.htc create mode 100644 test/functional/expected/ui/small-black/opera.css create mode 100644 test/functional/expected/ui/small-black/outline.css create mode 100644 test/functional/expected/ui/small-black/pretty.css create mode 100644 test/functional/expected/ui/small-black/print.css create mode 100644 test/functional/expected/ui/small-black/s5-core.css create mode 100644 test/functional/expected/ui/small-black/slides.css create mode 100644 test/functional/expected/ui/small-black/slides.js create mode 100644 test/functional/input/standalone_rst_s5_html.txt create mode 100755 test/functional/tests/standalone_rst_s5_html_1.py create mode 100755 test/functional/tests/standalone_rst_s5_html_2.py create mode 100755 test/test_parsers/test_rst/test_directives/test_target_notes.py create mode 100755 test/test_transforms/test_target_notes.py (limited to 'test') diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html index dd19f2710..6f2fbb49c 100644 --- a/test/functional/expected/standalone_rst_html4css1.html +++ b/test/functional/expected/standalone_rst_html4css1.html @@ -970,7 +970,7 @@ section, "Docutils System Messages":</p> <!-- section should be added by Docutils automatically --> </div> <div class="system-messages section"> -<h1><a>Docutils System Messages</a></h1> +<h1>Docutils System Messages</h1> <div class="system-message" id="id23"> <p class="system-message-title">System Message: <a name="id23">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 100); <em><a href="#id24">backlink</a></em></p> Undefined substitution referenced: "problematic".</div> diff --git a/test/functional/expected/standalone_rst_s5_html_1.html b/test/functional/expected/standalone_rst_s5_html_1.html new file mode 100644 index 000000000..bbface42e --- /dev/null +++ b/test/functional/expected/standalone_rst_s5_html_1.html @@ -0,0 +1,148 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<meta name="generator" content="Docutils 0.3.10: http://docutils.sourceforge.net/" /> +<meta name="version" content="S5 1.1" /> +<title>Slide Shows + + + + + + + + + + + + + + + + +
    +
    +
    + + +
    +
    +
    +

    Slide Shows

    +
    +++ + + + + + +
    Author:David Goodger
    Date:2005-11-28
    + + + + + + + +

    This is a test. This is only a test. If this were a real slide +show, there would be a projector handy.

    +

    Let's test the S5/HTML writer!

    +
      +
    • Use the arrow keys to navigate.
    • +
    • Click the "Ø" button to switch between presentation & +handout/outline modes.
    • +
    +
    +In presentation mode, mouse over to the lower right-hand corner to +display the controls.
    + +
    +
    +

    Introduction

    +
      +
    • reStructuredText

      Uses normal reStructuredText as input.

      +
    • +
    • One section per slide

      Each first-level section is converted into a single slide.

      +
    • +
    • (X)HTML output

      Presentations can be viewed using any modern graphical web browser. +The browser must support CSS, JavaScript, and XHTML. S5 even works +with IE!

      +
    • +
    • Themes

      A variety of themes are available.

      +
    • +
    • rst2s5.py

      The front-end tool to generate S5 slide shows.

      +
    • +
    +
    +
    +

    Features (1)

    +

    A flush-left paragraph

    +

    A centered paragraph

    +

    A flush-right paragraph

    +

    Some colours: black [black], gray, silver, +white [white], maroon, red, +magenta, fuchsia, pink, +orange, yellow, lime, green, +olive, teal, cyan, aqua, +blue, navy, purple

    +
    +
    +

    Features (2)

    +

    Some incremental text.

    +
      +
    • tiny (class & role name: "tiny", e.g. ":tiny:`text`")

      +
    • +
    • small ("small")

      +
    • +
    • normal (unstyled)

      +
    • +
    • big ("big")

      +
    • +
    • huge ("huge")

      +
    • +
    +
    +
    +

    Checklist

    +
      +
    • The document title should be duplicated on each slide in the footer +(except for the first slide, slide0, where the entire footer is +disabled).
    • +
    • The footer also contains a second line, "Location • Date"
    • +
    • There's no table of contents on the first slide (the directive is +disabled).
    • +
    • Handout material is not displayed in presentation mode.
    • +
    • The theme directories should be created, and the theme files copied +over.
    • +
    +
    +
    + + diff --git a/test/functional/expected/standalone_rst_s5_html_2.html b/test/functional/expected/standalone_rst_s5_html_2.html new file mode 100644 index 000000000..31d5e8750 --- /dev/null +++ b/test/functional/expected/standalone_rst_s5_html_2.html @@ -0,0 +1,144 @@ + + + + + + + +Slide Shows + + + + + + + + + + + + + + +
    +
    +
    + + +
    +
    +
    +

    Slide Shows

    + +++ + + + + + +
    Author:David Goodger
    Date:2005-11-28
    + + + + + + + +

    This is a test. This is only a test. If this were a real slide +show, there would be a projector handy.

    +

    Let's test the S5/HTML writer!

    +
      +
    • Use the arrow keys to navigate.
    • +
    • Click the "Ø" button to switch between presentation & +handout/outline modes.
    • +
    +
    +In presentation mode, mouse over to the lower right-hand corner to +display the controls.
    + +
    +
    +

    Introduction

    +
      +
    • reStructuredText

      Uses normal reStructuredText as input.

      +
    • +
    • One section per slide

      Each first-level section is converted into a single slide.

      +
    • +
    • (X)HTML output

      Presentations can be viewed using any modern graphical web browser. +The browser must support CSS, JavaScript, and XHTML. S5 even works +with IE!

      +
    • +
    • Themes

      A variety of themes are available.

      +
    • +
    • rst2s5.py

      The front-end tool to generate S5 slide shows.

      +
    • +
    +
    +
    +

    Features (1)

    +

    A flush-left paragraph

    +

    A centered paragraph

    +

    A flush-right paragraph

    +

    Some colours: black [black], gray, silver, +white [white], maroon, red, +magenta, fuchsia, pink, +orange, yellow, lime, green, +olive, teal, cyan, aqua, +blue, navy, purple

    +
    +
    +

    Features (2)

    +

    Some incremental text.

    +
      +
    • tiny (class & role name: "tiny", e.g. ":tiny:`text`")

      +
    • +
    • small ("small")

      +
    • +
    • normal (unstyled)

      +
    • +
    • big ("big")

      +
    • +
    • huge ("huge")

      +
    • +
    +
    +
    +

    Checklist

    +
      +
    • The document title should be duplicated on each slide in the footer +(except for the first slide, slide0, where the entire footer is +disabled).
    • +
    • The footer also contains a second line, "Location • Date"
    • +
    • There's no table of contents on the first slide (the directive is +disabled).
    • +
    • Handout material is not displayed in presentation mode.
    • +
    • The theme directories should be created, and the theme files copied +over.
    • +
    +
    +
    + + diff --git a/test/functional/expected/ui/default/blank.gif b/test/functional/expected/ui/default/blank.gif new file mode 100644 index 000000000..75b945d25 Binary files /dev/null and b/test/functional/expected/ui/default/blank.gif differ diff --git a/test/functional/expected/ui/default/framing.css b/test/functional/expected/ui/default/framing.css new file mode 100644 index 000000000..c4727f303 --- /dev/null +++ b/test/functional/expected/ui/default/framing.css @@ -0,0 +1,25 @@ +/* This file has been placed in the public domain. */ +/* The following styles size, place, and layer the slide components. + Edit these if you want to change the overall slide layout. + The commented lines can be uncommented (and modified, if necessary) + to help you with the rearrangement process. */ + +/* target = 1024x768 */ + +div#header, div#footer, .slide {width: 100%; top: 0; left: 0;} +div#header {position: fixed; top: 0; height: 3em; z-index: 1;} +div#footer {top: auto; bottom: 0; height: 2.5em; z-index: 5;} +.slide {top: 0; width: 92%; padding: 2.5em 4% 4%; z-index: 2;} +div#controls {left: 50%; bottom: 0; width: 50%; z-index: 100;} +div#controls form {position: absolute; bottom: 0; right: 0; width: 100%; + margin: 0;} +#currentSlide {position: absolute; width: 10%; left: 45%; bottom: 1em; + z-index: 10;} +html>body #currentSlide {position: fixed;} + +/* +div#header {background: #FCC;} +div#footer {background: #CCF;} +div#controls {background: #BBD;} +div#currentSlide {background: #FFC;} +*/ diff --git a/test/functional/expected/ui/default/iepngfix.htc b/test/functional/expected/ui/default/iepngfix.htc new file mode 100644 index 000000000..9f3d628b5 --- /dev/null +++ b/test/functional/expected/ui/default/iepngfix.htc @@ -0,0 +1,42 @@ + + + + + \ No newline at end of file diff --git a/test/functional/expected/ui/default/opera.css b/test/functional/expected/ui/default/opera.css new file mode 100644 index 000000000..c9d1148be --- /dev/null +++ b/test/functional/expected/ui/default/opera.css @@ -0,0 +1,8 @@ +/* This file has been placed in the public domain. */ +/* DO NOT CHANGE THESE unless you really want to break Opera Show */ +.slide { + visibility: visible !important; + position: static !important; + page-break-before: always; +} +#slide0 {page-break-before: avoid;} diff --git a/test/functional/expected/ui/default/outline.css b/test/functional/expected/ui/default/outline.css new file mode 100644 index 000000000..cb3588d5a --- /dev/null +++ b/test/functional/expected/ui/default/outline.css @@ -0,0 +1,21 @@ +/* This file has been placed in the public domain. */ +/* Don't change this unless you want the layout stuff to show up in the + outline view! */ + +.layout div, #footer *, #controlForm * {display: none;} +#footer, #controls, #controlForm, #navLinks, #toggle { + display: block; visibility: visible; margin: 0; padding: 0;} +#toggle {float: right; padding: 0.5em;} +html>body #toggle {position: fixed; top: 0; right: 0;} + +/* making the outline look pretty-ish */ + +#slide0 h1, #slide0 h2, #slide0 h3, #slide0 h4 {border: none; margin: 0;} +#slide0 h1 {padding-top: 1.5em;} +.slide h1 {margin: 1.5em 0 0.75em; padding-top: 0.25em; + border-top: 1px solid #888; border-bottom: 1px solid #AAA;} +#toggle {border: 1px solid; border-width: 0 0 1px 1px; background: #FFF;} + +.handout {border-left: solid #BBB; padding-left: 0.5em;} + +.print-block, .print-inline {display: none;} diff --git a/test/functional/expected/ui/default/pretty.css b/test/functional/expected/ui/default/pretty.css new file mode 100644 index 000000000..f83ca2bf5 --- /dev/null +++ b/test/functional/expected/ui/default/pretty.css @@ -0,0 +1,122 @@ +/* This file has been placed in the public domain. */ +/* Following are the presentation styles -- edit away! */ + +html, body {margin: 0; padding: 0;} +body {background: white; color: black;} +/* Replace the background style above with the style below (and again for + div#header) for a graphic: */ +/* background: white url(bodybg.gif) -16px 0 no-repeat; */ +:link, :visited {text-decoration: none; color: #00C;} +#controls :active {color: #88A !important;} +#controls :focus {outline: 1px dotted #227;} +h1, h2, h3, h4 {font-size: 100%; margin: 0; padding: 0; font-weight: inherit;} + +blockquote {padding: 0 2em 0.5em; margin: 0 1.5em 0.5em;} +blockquote p {margin: 0;} + +kbd {font-weight: bold; font-size: 1em;} +sup {font-size: smaller; line-height: 1px;} + +.slide pre {padding: 0; margin: 0 0 0.5em 0; font-size: 90%;} +.slide ul ul li {list-style: square;} +.slide img.leader {display: block; margin: 0 auto;} +.slide tt {font-size: 90%;} + +div#header, div#footer {background: #005; color: #AAB; font-family: sans-serif;} +/* background: #005 url(bodybg.gif) -16px 0 no-repeat; */ +div#footer {font-size: 0.5em; font-weight: bold; padding: 1em 0;} +#footer h1 {display: block; padding: 0 1em;} +#footer h2 {display: block; padding: 0.8em 1em 0;} + +.slide {font-size: 1.2em;} +.slide h1 {position: absolute; top: 0.45em; z-index: 1; + margin: 0; padding-left: 0.7em; white-space: nowrap; + font: bold 150% sans-serif; color: #DDE; background: #005;} +.slide h2 {font: bold 120%/1em sans-serif; padding-top: 0.5em;} +.slide h3 {font: bold 100% sans-serif; padding-top: 0.5em;} +h1 abbr {font-variant: small-caps;} + +div#controls {position: absolute; left: 50%; bottom: 0; + width: 50%; text-align: right; font: bold 0.9em sans-serif;} +html>body div#controls {position: fixed; padding: 0 0 1em 0; top: auto;} +div#controls form {position: absolute; bottom: 0; right: 0; width: 100%; + margin: 0; padding: 0;} +#controls #navLinks a {padding: 0; margin: 0 0.5em; + background: #005; border: none; color: #779; cursor: pointer;} +#controls #navList {height: 1em;} +#controls #navList #jumplist {position: absolute; bottom: 0; right: 0; + background: #DDD; color: #227;} + +#currentSlide {text-align: center; font-size: 0.5em; color: #449; + font-family: sans-serif; font-weight: bold;} + +#slide0 {padding-top: 1.5em} +#slide0 h1 {position: static; margin: 1em 0 0; padding: 0; color: #000; + font: bold 2em sans-serif; white-space: normal; background: transparent;} +#slide0 h2 {font: bold italic 1em sans-serif; margin: 0.25em;} +#slide0 h3 {margin-top: 1.5em; font-size: 1.5em;} +#slide0 h4 {margin-top: 0; font-size: 1em;} + +ul.urls {list-style: none; display: inline; margin: 0;} +.urls li {display: inline; margin: 0;} +.external {border-bottom: 1px dotted gray;} +html>body .external {border-bottom: none;} +.external:after {content: " \274F"; font-size: smaller; color: #77B;} + +.incremental, .incremental *, .incremental *:after {visibility: visible; + color: white; border: 0;} +img.incremental {visibility: hidden;} +.slide .current {color: green;} + +.print-block, .print-inline {display: none;} + +.huge {font-family: sans-serif; font-weight: bold; font-size: 150%;} +.big {font-family: sans-serif; font-weight: bold; font-size: 120%;} +.small {font-size: 75%;} +.tiny {font-size: 50%;} +.huge tt, .big tt, .small tt, .tiny tt {font-size: 115%;} +.huge pre, .big pre, .small pre, .tiny pre {font-size: 115%;} + +.maroon {color: maroon;} +.red {color: red;} +.magenta {color: magenta;} +.fuchsia {color: fuchsia;} +.pink {color: #FAA;} +.orange {color: orange;} +.yellow {color: yellow;} +.lime {color: lime;} +.green {color: green;} +.olive {color: olive;} +.teal {color: teal;} +.cyan {color: cyan;} +.aqua {color: aqua;} +.blue {color: blue;} +.navy {color: navy;} +.purple {color: purple;} +.black {color: black;} +.gray {color: gray;} +.silver {color: silver;} +.white {color: white;} + +.left {text-align: left ! important;} +.center {text-align: center ! important;} +.right {text-align: right ! important;} + +.borderless, .borderless td {border: 0;} + +.animation {position: relative; margin: 1em 0; padding: 0;} +.animation img {position: absolute;} + +/* Docutils-specific overrides */ + +.slide table.docinfo {margin: 1em 0 0.5em 2em;} + +pre.literal-block, pre.doctest-block {background-color: white;} + +tt.docutils {background-color: white;} + +/* diagnostics */ +/* +li:after {content: " [" attr(class) "]"; color: #F88;} +div:before {content: "[" attr(class) "]"; color: #F88;} +*/ diff --git a/test/functional/expected/ui/default/print.css b/test/functional/expected/ui/default/print.css new file mode 100644 index 000000000..76e6352ee --- /dev/null +++ b/test/functional/expected/ui/default/print.css @@ -0,0 +1,33 @@ +/* This file has been placed in the public domain. */ +/* The following rule is necessary to have all slides appear in print! + DO NOT REMOVE IT! */ +.slide, ul {page-break-inside: avoid; visibility: visible !important;} +h1 {page-break-after: avoid;} + +body {font-size: 12pt; background: white;} +* {color: black;} + +#slide0 h1 {font-size: 200%; border: none; margin: 0.5em 0 0.25em;} +#slide0 h3 {margin: 0; padding: 0;} +#slide0 h4 {margin: 0 0 0.5em; padding: 0;} +#slide0 {margin-bottom: 3em;} + +h1 {border-top: 2pt solid gray; border-bottom: 1px dotted silver;} +.extra {background: transparent !important;} +div.extra, pre.extra, .example {font-size: 10pt; color: #333;} +ul.extra a {font-weight: bold;} +p.example {display: none;} + +#header {display: none;} +#footer h1 {margin: 0; border-bottom: 1px solid; color: gray; + font-style: italic;} +#footer h2, #controls {display: none;} + +.handout {border-left: solid #BBB; padding-left: 0.5em;} + +.print-block {display: block !important;} +.print-inline {display: inline !important;} + +/* The following rule keeps the layout stuff out of print. + Remove at your own risk! */ +.layout, .layout * {display: none !important;} diff --git a/test/functional/expected/ui/default/s5-core.css b/test/functional/expected/ui/default/s5-core.css new file mode 100644 index 000000000..6965f5e8f --- /dev/null +++ b/test/functional/expected/ui/default/s5-core.css @@ -0,0 +1,11 @@ +/* This file has been placed in the public domain. */ +/* Do not edit or override these styles! + The system will likely break if you do. */ + +div#header, div#footer, div#controls, .slide {position: absolute;} +html>body div#header, html>body div#footer, + html>body div#controls, html>body .slide {position: fixed;} +.handout {display: none;} +.layout {display: block;} +.slide, .hideme, .incremental {visibility: hidden;} +#slide0 {visibility: visible;} diff --git a/test/functional/expected/ui/default/slides.css b/test/functional/expected/ui/default/slides.css new file mode 100644 index 000000000..82bdc0ee0 --- /dev/null +++ b/test/functional/expected/ui/default/slides.css @@ -0,0 +1,10 @@ +/* This file has been placed in the public domain. */ + +/* required to make the slide show run at all */ +@import url(s5-core.css); + +/* sets basic placement and size of slide components */ +@import url(framing.css); + +/* styles that make the slides look good */ +@import url(pretty.css); diff --git a/test/functional/expected/ui/default/slides.js b/test/functional/expected/ui/default/slides.js new file mode 100644 index 000000000..cc4ddfa1e --- /dev/null +++ b/test/functional/expected/ui/default/slides.js @@ -0,0 +1,559 @@ +// S5 v1.1 slides.js -- released into the Public Domain +// Modified for Docutils (http://docutils.sf.net) by David Goodger +// $Revision: 4117 $ +// +// Please see http://www.meyerweb.com/eric/tools/s5/credits.html for +// information about all the wonderful and talented contributors to this code! + +var undef; +var slideCSS = ''; +var snum = 0; +var smax = 1; +var slideIDs = new Array(); +var incpos = 0; +var number = undef; +var s5mode = true; +var defaultView = 'slideshow'; +var controlVis = 'visible'; + +var isIE = navigator.appName == 'Microsoft Internet Explorer' ? 1 : 0; +var isOp = navigator.userAgent.indexOf('Opera') > -1 ? 1 : 0; +var isGe = navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('Safari') < 1 ? 1 : 0; + +function hasClass(object, className) { + if (!object.className) return false; + return (object.className.search('(^|\\s)' + className + '(\\s|$)') != -1); +} + +function hasValue(object, value) { + if (!object) return false; + return (object.search('(^|\\s)' + value + '(\\s|$)') != -1); +} + +function removeClass(object,className) { + if (!object) return; + object.className = object.className.replace(new RegExp('(^|\\s)'+className+'(\\s|$)'), RegExp.$1+RegExp.$2); +} + +function addClass(object,className) { + if (!object || hasClass(object, className)) return; + if (object.className) { + object.className += ' '+className; + } else { + object.className = className; + } +} + +function GetElementsWithClassName(elementName,className) { + var allElements = document.getElementsByTagName(elementName); + var elemColl = new Array(); + for (var i = 0; i< allElements.length; i++) { + if (hasClass(allElements[i], className)) { + elemColl[elemColl.length] = allElements[i]; + } + } + return elemColl; +} + +function isParentOrSelf(element, id) { + if (element == null || element.nodeName=='BODY') return false; + else if (element.id == id) return true; + else return isParentOrSelf(element.parentNode, id); +} + +function nodeValue(node) { + var result = ""; + if (node.nodeType == 1) { + var children = node.childNodes; + for (var i = 0; i < children.length; ++i) { + result += nodeValue(children[i]); + } + } + else if (node.nodeType == 3) { + result = node.nodeValue; + } + return(result); +} + +function slideLabel() { + var slideColl = GetElementsWithClassName('*','slide'); + var list = document.getElementById('jumplist'); + smax = slideColl.length; + for (var n = 0; n < smax; n++) { + var obj = slideColl[n]; + + var did = 'slide' + n.toString(); + if (obj.getAttribute('id')) { + slideIDs[n] = obj.getAttribute('id'); + } + else { + obj.setAttribute('id',did); + slideIDs[n] = did; + } + if (isOp) continue; + + var otext = ''; + var menu = obj.firstChild; + if (!menu) continue; // to cope with empty slides + while (menu && menu.nodeType == 3) { + menu = menu.nextSibling; + } + if (!menu) continue; // to cope with slides with only text nodes + + var menunodes = menu.childNodes; + for (var o = 0; o < menunodes.length; o++) { + otext += nodeValue(menunodes[o]); + } + list.options[list.length] = new Option(n + ' : ' + otext, n); + } +} + +function currentSlide() { + var cs; + var footer_nodes; + var vis = 'visible'; + if (document.getElementById) { + cs = document.getElementById('currentSlide'); + footer_nodes = document.getElementById('footer').childNodes; + } else { + cs = document.currentSlide; + footer = document.footer.childNodes; + } + cs.innerHTML = '' + snum + '<\/span> ' + + '\/<\/span> ' + + '' + (smax-1) + '<\/span>'; + if (snum == 0) { + vis = 'hidden'; + } + cs.style.visibility = vis; + for (var i = 0; i < footer_nodes.length; i++) { + if (footer_nodes[i].nodeType == 1) { + footer_nodes[i].style.visibility = vis; + } + } +} + +function go(step) { + if (document.getElementById('slideProj').disabled || step == 0) return; + var jl = document.getElementById('jumplist'); + var cid = slideIDs[snum]; + var ce = document.getElementById(cid); + if (incrementals[snum].length > 0) { + for (var i = 0; i < incrementals[snum].length; i++) { + removeClass(incrementals[snum][i], 'current'); + removeClass(incrementals[snum][i], 'incremental'); + } + } + if (step != 'j') { + snum += step; + lmax = smax - 1; + if (snum > lmax) snum = lmax; + if (snum < 0) snum = 0; + } else + snum = parseInt(jl.value); + var nid = slideIDs[snum]; + var ne = document.getElementById(nid); + if (!ne) { + ne = document.getElementById(slideIDs[0]); + snum = 0; + } + if (step < 0) {incpos = incrementals[snum].length} else {incpos = 0;} + if (incrementals[snum].length > 0 && incpos == 0) { + for (var i = 0; i < incrementals[snum].length; i++) { + if (hasClass(incrementals[snum][i], 'current')) + incpos = i + 1; + else + addClass(incrementals[snum][i], 'incremental'); + } + } + if (incrementals[snum].length > 0 && incpos > 0) + addClass(incrementals[snum][incpos - 1], 'current'); + ce.style.visibility = 'hidden'; + ne.style.visibility = 'visible'; + jl.selectedIndex = snum; + currentSlide(); + number = 0; +} + +function goTo(target) { + if (target >= smax || target == snum) return; + go(target - snum); +} + +function subgo(step) { + if (step > 0) { + removeClass(incrementals[snum][incpos - 1],'current'); + removeClass(incrementals[snum][incpos], 'incremental'); + addClass(incrementals[snum][incpos],'current'); + incpos++; + } else { + incpos--; + removeClass(incrementals[snum][incpos],'current'); + addClass(incrementals[snum][incpos], 'incremental'); + addClass(incrementals[snum][incpos - 1],'current'); + } +} + +function toggle() { + var slideColl = GetElementsWithClassName('*','slide'); + var slides = document.getElementById('slideProj'); + var outline = document.getElementById('outlineStyle'); + if (!slides.disabled) { + slides.disabled = true; + outline.disabled = false; + s5mode = false; + fontSize('1em'); + for (var n = 0; n < smax; n++) { + var slide = slideColl[n]; + slide.style.visibility = 'visible'; + } + } else { + slides.disabled = false; + outline.disabled = true; + s5mode = true; + fontScale(); + for (var n = 0; n < smax; n++) { + var slide = slideColl[n]; + slide.style.visibility = 'hidden'; + } + slideColl[snum].style.visibility = 'visible'; + } +} + +function showHide(action) { + var obj = GetElementsWithClassName('*','hideme')[0]; + switch (action) { + case 's': obj.style.visibility = 'visible'; break; + case 'h': obj.style.visibility = 'hidden'; break; + case 'k': + if (obj.style.visibility != 'visible') { + obj.style.visibility = 'visible'; + } else { + obj.style.visibility = 'hidden'; + } + break; + } +} + +// 'keys' code adapted from MozPoint (http://mozpoint.mozdev.org/) +function keys(key) { + if (!key) { + key = event; + key.which = key.keyCode; + } + if (key.which == 84) { + toggle(); + return; + } + if (s5mode) { + switch (key.which) { + case 10: // return + case 13: // enter + if (window.event && isParentOrSelf(window.event.srcElement, 'controls')) return; + if (key.target && isParentOrSelf(key.target, 'controls')) return; + if(number != undef) { + goTo(number); + break; + } + case 32: // spacebar + case 34: // page down + case 39: // rightkey + case 40: // downkey + if(number != undef) { + go(number); + } else if (!incrementals[snum] || incpos >= incrementals[snum].length) { + go(1); + } else { + subgo(1); + } + break; + case 33: // page up + case 37: // leftkey + case 38: // upkey + if(number != undef) { + go(-1 * number); + } else if (!incrementals[snum] || incpos <= 0) { + go(-1); + } else { + subgo(-1); + } + break; + case 36: // home + goTo(0); + break; + case 35: // end + goTo(smax-1); + break; + case 67: // c + showHide('k'); + break; + } + if (key.which < 48 || key.which > 57) { + number = undef; + } else { + if (window.event && isParentOrSelf(window.event.srcElement, 'controls')) return; + if (key.target && isParentOrSelf(key.target, 'controls')) return; + number = (((number != undef) ? number : 0) * 10) + (key.which - 48); + } + } + return false; +} + +function clicker(e) { + number = undef; + var target; + if (window.event) { + target = window.event.srcElement; + e = window.event; + } else target = e.target; + if (target.getAttribute('href') != null || hasValue(target.rel, 'external') || isParentOrSelf(target, 'controls') || isParentOrSelf(target,'embed') || isParentOrSelf(target,'object')) return true; + if (!e.which || e.which == 1) { + if (!incrementals[snum] || incpos >= incrementals[snum].length) { + go(1); + } else { + subgo(1); + } + } +} + +function findSlide(hash) { + var target = document.getElementById(hash); + if (target) { + for (var i = 0; i < slideIDs.length; i++) { + if (target.id == slideIDs[i]) return i; + } + } + return null; +} + +function slideJump() { + if (window.location.hash == null || window.location.hash == '') { + currentSlide(); + return; + } + if (window.location.hash == null) return; + var dest = null; + dest = findSlide(window.location.hash.slice(1)); + if (dest == null) { + dest = 0; + } + go(dest - snum); +} + +function fixLinks() { + var thisUri = window.location.href; + thisUri = thisUri.slice(0, thisUri.length - window.location.hash.length); + var aelements = document.getElementsByTagName('A'); + for (var i = 0; i < aelements.length; i++) { + var a = aelements[i].href; + var slideID = a.match('\#.+'); + if ((slideID) && (slideID[0].slice(0,1) == '#')) { + var dest = findSlide(slideID[0].slice(1)); + if (dest != null) { + if (aelements[i].addEventListener) { + aelements[i].addEventListener("click", new Function("e", + "if (document.getElementById('slideProj').disabled) return;" + + "go("+dest+" - snum); " + + "if (e.preventDefault) e.preventDefault();"), true); + } else if (aelements[i].attachEvent) { + aelements[i].attachEvent("onclick", new Function("", + "if (document.getElementById('slideProj').disabled) return;" + + "go("+dest+" - snum); " + + "event.returnValue = false;")); + } + } + } + } +} + +function externalLinks() { + if (!document.getElementsByTagName) return; + var anchors = document.getElementsByTagName('a'); + for (var i=0; i' + + '