docutils-0.11/0000755000175000017500000000000012173162603013762 5ustar engelbertengelbertdocutils-0.11/MANIFEST.in0000644000175000017500000000044511344150064015520 0ustar engelbertengelbertinclude *.txt include *.py include setup.cfg include MANIFEST include MANIFEST.in recursive-include docutils * recursive-include docs * recursive-include extras * recursive-include licenses * recursive-include test * recursive-include tools * recursive-exclude * .cvsignore *.pyc *~ .DS_Store docutils-0.11/test/0000755000175000017500000000000012173162603014741 5ustar engelbertengelbertdocutils-0.11/test/test_command_line.py0000644000175000017500000000273012153360646021006 0ustar engelbertengelbert#! /usr/bin/env python # .. coding: utf-8 # $Id: test_command_line.py 7668 2013-06-04 12:46:30Z milde $ # Author: Günter Milde # Copyright: This module has been placed in the public domain. """ Test module for the command line. """ import unittest import sys, codecs import DocutilsTestSupport # must be imported before docutils import docutils.core # determine/guess the encoding of the standard input: try: import locale # module missing in Jython locale_encoding = locale.getlocale()[1] or locale.getdefaultlocale()[1] except ImportError: locale_encoding = None argv_encoding = locale_encoding or 'ascii' try: codecs.lookup(argv_encoding) except LookupError: argv_encoding = 'ascii' class CommandLineEncodingTests(unittest.TestCase): def test_sys_argv_decoding(self): if argv_encoding == 'ascii': # cannot test return sys.argv.append('--source-url=test.txt') # pure ASCII argument if sys.version_info < (3,0): sys.argv.append(u'--title=Dornröschen'.encode(argv_encoding)) else: sys.argv.append(u'--title=Dornröschen') publisher = docutils.core.Publisher() publisher.process_command_line() self.assertEqual(publisher.settings.source_url, 'test.txt') self.assertEqual(publisher.settings.title, u'Dornröschen') sys.argv.pop() # --title sys.argv.pop() # --source-url if __name__ == '__main__': unittest.main() docutils-0.11/test/data/0000755000175000017500000000000012173162603015652 5ustar engelbertengelbertdocutils-0.11/test/data/csv_data.txt0000644000175000017500000000001110126762313020167 0ustar engelbertengelbertfoo, bar docutils-0.11/test/data/csv_dep.txt0000644000175000017500000000004610126762313020036 0ustar engelbertengelbert.. csv-table:: :file: csv_data.txt docutils-0.11/test/data/include.txt0000644000175000017500000000002310126762313020031 0ustar engelbertengelbertSome include text. docutils-0.11/test/data/config_error_handler.txt0000644000175000017500000000004707724660237022603 0ustar engelbertengelbert[general] error_encoding: ascii:strict docutils-0.11/test/data/config_2.txt0000644000175000017500000000021310134577006020077 0ustar engelbertengelbert# Test config file (new format) [general] generator: no [html4css1 writer] footnote-references: superscript stylesheet-path: test.css docutils-0.11/test/data/ham.css0000644000175000017500000000005211116564105017125 0ustar engelbertengelbertdl.docutils dd { margin-bottom: 0.5em } docutils-0.11/test/data/config_old.txt0000644000175000017500000000041210215337625020516 0ustar engelbertengelbert# Test config file (old format) [options] source-link: 1 datestamp: %Y-%m-%d %H:%M UTC generator: 1 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 docutils-0.11/test/data/full-template.txt0000644000175000017500000000167610413121674021176 0ustar engelbertengelberthead_prefix = """\ %(head_prefix)s""" head = """\ %(head)s""" stylesheet = """\ %(stylesheet)s""" body_prefix = """\ %(body_prefix)s""" body_pre_docinfo = """\ %(body_pre_docinfo)s""" docinfo = """\ %(docinfo)s""" body = """\ %(body)s""" body_suffix = """\ %(body_suffix)s""" head_prefix = """\ %(head_prefix)s""" head = """\ %(head)s""" stylesheet = """\ %(stylesheet)s""" body_prefix = """\ %(body_prefix)s""" body_pre_docinfo = """\ %(body_pre_docinfo)s""" docinfo = """\ %(docinfo)s""" body = """\ %(body)s""" body_suffix = """\ %(body_suffix)s""" title = """\ %(title)s""" subtitle = """\ %(subtitle)s""" header = """\ %(header)s""" footer = """\ %(footer)s""" meta = """\ %(meta)s""" fragment = """\ %(fragment)s""" html_prolog = """\ %(html_prolog)s""" html_head = """\ %(html_head)s""" html_title = """\ %(html_title)s""" html_subtitle = """\ %(html_subtitle)s""" html_body = """\ %(html_body)s""" docutils-0.11/test/data/config_list.txt0000644000175000017500000000046311662733056020726 0ustar engelbertengelbert[general] expose_internals: a strip-classes: spam strip-elements-with-classes: sugar, flour [html4css1 writer] expose_internals: b:c:d strip-classes: pan, fun, strip-elements-with-classes: milk [pep_html writer] expose_internals: e strip-classes: parrot strip-elements-with-classes: safran docutils-0.11/test/data/raw.txt0000644000175000017500000000000010126762313017172 0ustar engelbertengelbertdocutils-0.11/test/data/ham.tex0000644000175000017500000000004111173315160017131 0ustar engelbertengelbert\newcommand{\ham}{wonderful ham} docutils-0.11/test/data/latin1.txt0000644000175000017500000000000611656261702017604 0ustar engelbertengelbertGre docutils-0.11/test/data/config_list_2.txt0000644000175000017500000000013711662733056021145 0ustar engelbertengelbert[general] expose_internals: f strip-classes: ham, eggs strip-elements-with-classes: eggs,salt docutils-0.11/test/data/stylesheet.txt0000644000175000017500000000000010126762313020572 0ustar engelbertengelbertdocutils-0.11/test/data/dependencies.txt0000644000175000017500000000130311672233402021035 0ustar engelbertengelbertTest input for test_dependencies. Docutils can write a list of files required to generate the output like included files or embedded stylesheets. This is particularly useful in conjunction with programs like ``make``. Included files are recorded: .. include:: include.txt .. raw:: HTML :file: raw.txt Dependencies are recorded only once: .. include:: include.txt Image files are only recorded, if actually accessed (to extract the size or if embedded in the output document): .. image:: test.jpg .. figure:: ../docs/user/rst/images/title.png :figwidth: image Scaled images without given size are recorded by the html writer: .. image:: ../docs/user/rst/images/biohazard.png :scale: 50 % docutils-0.11/test/data/config_1.txt0000644000175000017500000000061510525660651020107 0ustar engelbertengelbert# Test config file (new format) [general] source-link: on datestamp: %Y-%m-%d %H:%M UTC generator: true raw-enabled: off [restructuredtext parser] trim-footnote-reference-space: 1 tab-width = 8 [html4css1 writer] stylesheet-path: stylesheets/default.css [pep_html writer] template: pep-html-template stylesheet-path: stylesheets/pep.css python-home: http://www.python.org no-random: yes docutils-0.11/test/local_dummy_lang.py0000644000175000017500000001234612016623750020630 0ustar engelbertengelbert# $Id: local_dummy_lang.py 7504 2012-08-27 07:55:20Z grubert $ # Author: David Goodger # Copyright: This module has been placed in the public domain. # New language mappings are welcome. Before doing a new translation, please # read . Two files must be # translated for each language: one in docutils/languages, the other in # docutils/parsers/rst/languages. """ English-language mappings for language-dependent features of Docutils. """ __docformat__ = 'reStructuredText' labels = { # fixed: language-dependent 'author': 'dummy Author', 'authors': 'dummy Authors', 'organization': 'dummy Organization', 'address': 'dummy Address', 'contact': 'dummy Contact', 'version': 'dummy Version', 'revision': 'dummy Revision', 'status': 'dummy Status', 'date': 'dummy Date', 'copyright': 'dummy Copyright', 'dedication': 'dummy Dedication', 'abstract': 'dummy Abstract', 'attention': 'dummy Attention!', 'caution': 'dummy Caution!', 'danger': 'dummy !DANGER!', 'error': 'dummy Error', 'hint': 'dummy Hint', 'important': 'dummy Important', 'note': 'dummy Note', 'tip': 'dummy Tip', 'warning': 'dummy Warning', 'contents': 'dummy Contents'} """Mapping of node class name to label text.""" bibliographic_fields = { # language-dependent: fixed 'dummy author': 'author', 'dummy authors': 'authors', 'dummy organization': 'organization', 'dummy address': 'address', 'dummy contact': 'contact', 'dummy version': 'version', 'dummy revision': 'revision', 'dummy status': 'status', 'dummy date': 'date', 'dummy copyright': 'copyright', 'dummy dedication': 'dedication', 'dummy abstract': 'abstract'} """English (lowcased) to canonical name mapping for bibliographic fields.""" author_separators = [';', ','] """List of separator strings for the 'Authors' bibliographic field. Tried in order.""" directives = { # language-dependent: fixed 'dummy attention': 'attention', 'dummy caution': 'caution', 'dummy code': 'code', 'dummy code-block': 'code', 'dummy sourcecode': 'code', 'dummy danger': 'danger', 'dummy error': 'error', 'dummy hint': 'hint', 'dummy important': 'important', 'dummy note': 'note', 'dummy tip': 'tip', 'dummy warning': 'warning', 'dummy admonition': 'admonition', 'dummy sidebar': 'sidebar', 'dummy topic': 'topic', 'dummy line-block': 'line-block', 'dummy parsed-literal': 'parsed-literal', 'dummy rubric': 'rubric', 'dummy epigraph': 'epigraph', 'dummy highlights': 'highlights', 'dummy pull-quote': 'pull-quote', 'dummy compound': 'compound', 'dummy container': 'container', #'dummy questions': 'questions', 'dummy table': 'table', 'dummy csv-table': 'csv-table', 'dummy list-table': 'list-table', #'dummy qa': 'questions', #'dummy faq': 'questions', 'dummy meta': 'meta', 'dummy math': 'math', #'dummy imagemap': 'imagemap', 'dummy image': 'image', 'dummy figure': 'figure', 'dummy include': 'include', 'dummy raw': 'raw', 'dummy replace': 'replace', 'dummy unicode': 'unicode', 'dummy date': 'date', 'dummy class': 'class', 'dummy role': 'role', 'dummy default-role': 'default-role', 'dummy title': 'title', 'dummy contents': 'contents', 'dummy sectnum': 'sectnum', 'dummy section-numbering': 'sectnum', 'dummy header': 'header', 'dummy footer': 'footer', #'dummy footnotes': 'footnotes', #'dummy citations': 'citations', 'dummy target-notes': 'target-notes', 'dummy restructuredtext-test-directive': 'restructuredtext-test-directive'} """English name to registered (in directives/__init__.py) directive name mapping.""" roles = { # language-dependent: fixed 'dummy abbreviation': 'abbreviation', 'dummy ab': 'abbreviation', 'dummy acronym': 'acronym', 'dummy ac': 'acronym', 'dummy code': 'code', 'dummy index': 'index', 'dummy i': 'index', 'dummy subscript': 'subscript', 'dummy sub': 'subscript', 'dummy superscript': 'superscript', 'dummy sup': 'superscript', 'dummy title-reference': 'title-reference', 'dummy title': 'title-reference', 'dummy t': 'title-reference', 'dummy pep-reference': 'pep-reference', 'dummy pep': 'pep-reference', 'dummy rfc-reference': 'rfc-reference', 'dummy rfc': 'rfc-reference', 'dummy emphasis': 'emphasis', 'dummy strong': 'strong', 'dummy literal': 'literal', 'dummy math': 'math', 'dummy named-reference': 'named-reference', 'dummy anonymous-reference': 'anonymous-reference', 'dummy footnote-reference': 'footnote-reference', 'dummy citation-reference': 'citation-reference', 'dummy substitution-reference': 'substitution-reference', 'dummy target': 'target', 'dummy uri-reference': 'uri-reference', 'dummy uri': 'uri-reference', 'dummy url': 'uri-reference', 'dummy raw': 'raw',} """Mapping of English role names to canonical role names for interpreted text. """ docutils-0.11/test/test_parsers/0000755000175000017500000000000012173162603017457 5ustar engelbertengelbertdocutils-0.11/test/test_parsers/__init__.py0000644000175000017500000000046210254646615021602 0ustar engelbertengelbertimport os import os.path import sys sys.path.insert(0, os.path.abspath(os.path.dirname(__file__))) 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) docutils-0.11/test/test_parsers/test_rst/0000755000175000017500000000000012173162603021326 5ustar engelbertengelbertdocutils-0.11/test/test_parsers/test_rst/test_inline_markup.py0000755000175000017500000012625012153360646025612 0ustar engelbertengelbert#! /usr/bin/env python # -*- coding: utf-8 -*- # $Id: test_inline_markup.py 7668 2013-06-04 12:46:30Z milde $ # Author: David Goodger # Copyright: This module has been placed in the public domain. """ Tests for inline markup in docutils/parsers/rst/states.py. Interpreted text tests are in a separate module, test_interpreted.py. """ from __init__ import DocutilsTestSupport def suite(): s = DocutilsTestSupport.ParserTestSuite() s.generateTests(totest) return s totest = {} totest['emphasis'] = [ ["""\ *emphasis* """, """\ emphasis """], [u"""\ l'*emphasis* with the *emphasis*' apostrophe. l\u2019*emphasis* with the *emphasis*\u2019 apostrophe. """, u"""\ l\' emphasis with the \n\ emphasis \' apostrophe. l\u2019 emphasis with the \n\ emphasis \u2019 apostrophe. """], ["""\ *emphasized sentence across lines* """, """\ emphasized sentence across lines """], ["""\ *emphasis without closing asterisk """, """\ * emphasis without closing asterisk Inline emphasis start-string without end-string. """], [r"""some punctuation is allowed around inline markup, e.g. /*emphasis*/, -*emphasis*-, and :*emphasis*: (delimiters), (*emphasis*), [*emphasis*], <*emphasis*>, {*emphasis*} (open/close pairs) *emphasis*., *emphasis*,, *emphasis*!, and *emphasis*\ (closing delimiters), but not )*emphasis*(, ]*emphasis*[, >*emphasis*>, }*emphasis*{ (close/open pairs), (*), [*], '*' or '"*"' ("quoted" start-string), x*2* or 2*x* (alphanumeric char before), \*args or * (escaped, whitespace behind start-string), or *the\* *stars\* *inside* (escaped, whitespace before end-string). However, '*args' will trigger a warning and may be problematic. what about *this**? """, """\ some punctuation is allowed around inline markup, e.g. / emphasis /, - emphasis -, and : emphasis : (delimiters), ( emphasis ), [ emphasis ], < emphasis >, { emphasis } (open/close pairs) emphasis ., \n\ emphasis ,, \n\ emphasis !, and \n\ emphasis (closing delimiters), but not )*emphasis*(, ]*emphasis*[, >*emphasis*>, }*emphasis*{ (close/open pairs), (*), [*], '*' or '"*"' ("quoted" start-string), x*2* or 2*x* (alphanumeric char before), *args or * (escaped, whitespace behind start-string), or \n\ the* *stars* *inside (escaped, whitespace before end-string). However, ' * args' will trigger a warning and may be problematic. Inline emphasis start-string without end-string. what about \n\ this* ? """], [u"""\ Quotes around inline markup: '*emphasis*' "*emphasis*" Straight, ‘*emphasis*’ “*emphasis*” English, ..., « *emphasis* » ‹ *emphasis* › « *emphasis* » ‹ *emphasis* › « *emphasis* » ‹ *emphasis* › French, „*emphasis*“ ‚*emphasis*‘ »*emphasis*« ›*emphasis*‹ German, Czech, ..., „*emphasis*” «*emphasis*» Romanian, “*emphasis*„ ‘*emphasis*‚ Greek, 「*emphasis*」 『*emphasis*』traditional Chinese, ”*emphasis*” ’*emphasis*’ »*emphasis*» ›*emphasis*› Swedish, Finnish, „*emphasis*” ‚*emphasis*’ Polish, „*emphasis*” »*emphasis*« ’*emphasis*’ Hungarian, """, u"""\ Quotes around inline markup: \' emphasis \' " emphasis " Straight, \u2018 emphasis \u2019 \u201c emphasis \u201d English, ..., \xab\u202f emphasis \u202f\xbb \u2039\u202f emphasis \u202f\u203a \xab\xa0 emphasis \xa0\xbb \u2039\xa0 emphasis \xa0\u203a \xab\u2005 emphasis \u2005\xbb \u2039\u2005 emphasis \u2005\u203a French, \u201e emphasis \u201c \u201a emphasis \u2018 \xbb emphasis \xab \u203a emphasis \u2039 German, Czech, ..., \u201e emphasis \u201d \xab emphasis \xbb Romanian, \u201c emphasis \u201e \u2018 emphasis \u201a Greek, \u300c emphasis \u300d \u300e emphasis \u300ftraditional Chinese, \u201d emphasis \u201d \u2019 emphasis \u2019 \xbb emphasis \xbb \u203a emphasis \u203a Swedish, Finnish, \u201e emphasis \u201d \u201a emphasis \u2019 Polish, \u201e emphasis \u201d \xbb emphasis \xab \u2019 emphasis \u2019 Hungarian, """], [r""" Emphasized asterisk: *\** Emphasized double asterisk: *\*** """, """\ Emphasized asterisk: \n\ * Emphasized double asterisk: \n\ ** """], ] totest['strong'] = [ ["""\ **strong** """, """\ strong """], [u"""\ l'**strong** and l\u2019**strong** with apostrophe """, u"""\ l' strong and l\u2019 strong with apostrophe """], [u"""\ quoted '**strong**', quoted "**strong**", quoted \u2018**strong**\u2019, quoted \u201c**strong**\u201d, quoted \xab**strong**\xbb """, u"""\ quoted ' strong ', quoted " strong ", quoted \u2018 strong \u2019, quoted \u201c strong \u201d, quoted \xab strong \xbb """], [r""" (**strong**) but not (**) or '(** ' or x**2 or \**kwargs or ** (however, '**kwargs' will trigger a warning and may be problematic) """, """\ ( strong ) but not (**) or '(** ' or x**2 or **kwargs or ** (however, ' ** kwargs' will trigger a warning and may be problematic) Inline strong start-string without end-string. """], ["""\ Strong asterisk: ***** Strong double asterisk: ****** """, """\ Strong asterisk: \n\ * Strong double asterisk: \n\ ** """], ["""\ **strong without closing asterisks """, """\ ** strong without closing asterisks Inline strong start-string without end-string. """], ] totest['literal'] = [ ["""\ ``literal`` """, """\ literal """], [r""" ``\literal`` """, """\ \\literal """], [r""" ``lite\ral`` """, """\ lite\\ral """], [r""" ``literal\`` """, """\ literal\\ """], [u"""\ l'``literal`` and l\u2019``literal`` with apostrophe """, u"""\ l' literal and l\u2019 literal with apostrophe """], [u"""\ quoted '``literal``', quoted "``literal``", quoted \u2018``literal``\u2019, quoted \u201c``literal``\u201d, quoted \xab``literal``\xbb """, u"""\ quoted ' literal ', quoted " literal ", quoted \u2018 literal \u2019, quoted \u201c literal \u201d, quoted \xab literal \xbb """], [u"""\ ``'literal'`` with quotes, ``"literal"`` with quotes, ``\u2018literal\u2019`` with quotes, ``\u201cliteral\u201d`` with quotes, ``\xabliteral\xbb`` with quotes """, u"""\ 'literal' with quotes, \n\ "literal" with quotes, \u2018literal\u2019 with quotes, \n\ \u201cliteral\u201d with quotes, \xabliteral\xbb with quotes """], [r""" ``literal ``TeX quotes'' & \backslash`` but not "``" or `` (however, ``standalone TeX quotes'' will trigger a warning and may be problematic) """, """\ literal ``TeX quotes'' & \\backslash but not "``" or `` (however, \n\ `` standalone TeX quotes'' will trigger a warning and may be problematic) Inline literal start-string without end-string. """], ["""\ Find the ```interpreted text``` in this paragraph! """, """\ Find the \n\ `interpreted text` in this paragraph! """], ["""\ ``literal without closing backquotes """, """\ `` literal without closing backquotes Inline literal start-string without end-string. """], [r""" Python ``list``\s use square bracket syntax. """, """\ Python \n\ list s use square bracket syntax. """], ] totest['references'] = [ ["""\ ref_ """, """\ ref """], [u"""\ l'ref_ and l\u2019ref_ with apostrophe """, u"""\ l' ref and l\u2019 ref with apostrophe """], [u"""\ quoted 'ref_', quoted "ref_", quoted \u2018ref_\u2019, quoted \u201cref_\u201d, quoted \xabref_\xbb, but not 'ref ref'_, "ref ref"_, \u2018ref ref\u2019_, \u201cref ref\u201d_, or \xabref ref\xbb_ """, u"""\ quoted ' ref ', quoted " ref ", quoted \u2018 ref \u2019, quoted \u201c ref \u201d, quoted \xab ref \xbb, but not 'ref ref'_, "ref ref"_, \u2018ref ref\u2019_, \u201cref ref\u201d_, or \xabref ref\xbb_ """], ["""\ ref__ """, """\ ref """], [u"""\ l'ref__ and l\u2019ref__ with apostrophe """, u"""\ l' ref and l\u2019 ref with apostrophe """], [u"""\ quoted 'ref__', quoted "ref__", quoted \u2018ref__\u2019, quoted \u201cref__\u201d, quoted \xabref__\xbb, but not 'ref ref'__, "ref ref"__, \u2018ref ref\u2019__, \u201cref ref\u201d__, or \xabref ref\xbb__ """, u"""\ quoted ' ref ', quoted " ref ", quoted \u2018 ref \u2019, quoted \u201c ref \u201d, quoted \xab ref \xbb, but not 'ref ref'__, "ref ref"__, \u2018ref ref\u2019__, \u201cref ref\u201d__, or \xabref ref\xbb__ """], ["""\ ref_, r_, r_e-f_, -ref_, and anonymousref__, but not _ref_ or __attr__ or object.__attr__ """, """\ ref , \n\ r , \n\ r_e-f , - ref , and \n\ anonymousref , but not _ref_ or __attr__ or object.__attr__ """], ] totest['phrase_references'] = [ ["""\ `phrase reference`_ """, """\ phrase reference """], [u"""\ l'`phrase reference`_ and l\u2019`phrase reference`_ with apostrophe """, u"""\ l' phrase reference and l\u2019 phrase reference with apostrophe """], [u"""\ quoted '`phrase reference`_', quoted "`phrase reference`_", quoted \u2018`phrase reference`_\u2019, quoted \u201c`phrase reference`_\u201d, quoted \xab`phrase reference`_\xbb """, u"""\ quoted ' phrase reference ', quoted " phrase reference ", quoted \u2018 phrase reference \u2019, quoted \u201c phrase reference \u201d, quoted \xab phrase reference \xbb """], [u"""\ `'phrase reference'`_ with quotes, `"phrase reference"`_ with quotes, `\u2018phrase reference\u2019`_ with quotes, `\u201cphrase reference\u201d`_ with quotes, `\xabphrase reference\xbb`_ with quotes """, u"""\ 'phrase reference' with quotes, \n\ "phrase reference" with quotes, \u2018phrase reference\u2019 with quotes, \u201cphrase reference\u201d with quotes, \xabphrase reference\xbb with quotes """], ["""\ `anonymous reference`__ """, """\ anonymous reference """], [u"""\ l'`anonymous reference`__ and l\u2019`anonymous reference`__ with apostrophe """, u"""\ l' anonymous reference and l\u2019 anonymous reference with apostrophe """], [u"""\ quoted '`anonymous reference`__', quoted "`anonymous reference`__", quoted \u2018`anonymous reference`__\u2019, quoted \u201c`anonymous reference`__\u201d, quoted \xab`anonymous reference`__\xbb """, u"""\ quoted ' anonymous reference ', quoted " anonymous reference ", quoted \u2018 anonymous reference \u2019, quoted \u201c anonymous reference \u201d, quoted \xab anonymous reference \xbb """], [u"""\ `'anonymous reference'`__ with quotes, `"anonymous reference"`__ with quotes, `\u2018anonymous reference\u2019`__ with quotes, `\u201canonymous reference\u201d`__ with quotes, `\xabanonymous reference\xbb`__ with quotes """, u"""\ 'anonymous reference' with quotes, \n\ "anonymous reference" with quotes, \u2018anonymous reference\u2019 with quotes, \u201canonymous reference\u201d with quotes, \xabanonymous reference\xbb with quotes """], ["""\ `phrase reference across lines`_ """, """\ phrase reference across lines """], ["""\ `phrase\`_ reference`_ """, """\ phrase`_ reference """], ["""\ Invalid phrase reference: :role:`phrase reference`_ """, """\ Invalid phrase reference: :role:`phrase reference`_ Mismatch: both interpreted text role prefix and reference suffix. """], ["""\ Invalid phrase reference: `phrase reference`:role:_ """, """\ Invalid phrase reference: `phrase reference`:role:_ Mismatch: both interpreted text role suffix and reference suffix. """], ["""\ `phrase reference_ without closing backquote """, """\ ` phrase \n\ reference without closing backquote Inline interpreted text or phrase reference start-string without end-string. """], ["""\ `anonymous phrase reference__ without closing backquote """, """\ ` anonymous phrase \n\ reference without closing backquote Inline interpreted text or phrase reference start-string without end-string. """], ] totest['embedded_URIs'] = [ ["""\ `phrase reference `_ """, """\ phrase reference """], ["""\ `anonymous reference `__ """, """\ anonymous reference """], ["""\ `embedded URI on next line `__ """, """\ embedded URI on next line """], ["""\ `embedded URI across lines `__ """, """\ embedded URI across lines """], ["""\ `embedded URI with whitespace `__ """, """\ embedded URI with whitespace """], ["""\ `embedded email address `__ `embedded email address broken across lines `__ """, """\ embedded email address embedded email address broken across lines """], [r""" `embedded URI with too much whitespace < http://example.com/ long/path /and /whitespace >`__ `embedded URI with too much whitespace at end `__ `embedded URI with no preceding whitespace`__ `escaped URI \`__ See `HTML Anchors: \`_. """, """\ embedded URI with too much whitespace < http://example.com/ long/path /and /whitespace > embedded URI with too much whitespace at end embedded URI with no preceding whitespace escaped URI See \n\ HTML Anchors: . """], ["""\ Relative URIs' reference text can be omitted: ``_ ``__ """, """\ Relative URIs' reference text can be omitted: reference anonymous """], ["""\ Escape trailing low-line char in URIs: ``_ ``__ """, """\ Escape trailing low-line char in URIs: reference_ anonymous_ """], ] totest['embedded_aliases'] = [ ["""\ `phrase reference `_ """, """\ phrase reference """], ["""\ `anonymous reference `__ """, """\ anonymous reference """], ["""\ `embedded alias on next line `__ """, """\ embedded alias on next line """], ["""\ `embedded alias across lines `__ """, """\ embedded alias across lines """], ["""\ `embedded alias with whitespace `__ """, """\ embedded alias with whitespace """], [r""" `embedded alias with too much whitespace < alias_ >`__ `embedded alias with no preceding whitespace`__ """, """\ embedded alias with too much whitespace < alias_ > embedded alias with no preceding whitespace """], ] totest['inline_targets'] = [ ["""\ _`target` Here is _`another target` in some text. And _`yet another target`, spanning lines. _`Here is a TaRgeT` with case and spacial difficulties. """, """\ target Here is \n\ another target in some text. And \n\ yet another target , spanning lines. Here is a TaRgeT with case and spacial difficulties. """], [u"""\ l'_`target1` and l\u2019_`target2` with apostrophe """, u"""\ l' target1 and l\u2019 target2 with apostrophe """], [u"""\ quoted '_`target1`', quoted "_`target2`", quoted \u2018_`target3`\u2019, quoted \u201c_`target4`\u201d, quoted \xab_`target5`\xbb """, u"""\ quoted ' target1 ', quoted " target2 ", quoted \u2018 target3 \u2019, quoted \u201c target4 \u201d, quoted \xab target5 \xbb """], [u"""\ _`'target1'` with quotes, _`"target2"` with quotes, _`\u2018target3\u2019` with quotes, _`\u201ctarget4\u201d` with quotes, _`\xabtarget5\xbb` with quotes """, u"""\ 'target1' with quotes, \n\ "target2" with quotes, \u2018target3\u2019 with quotes, \n\ \u201ctarget4\u201d with quotes, \xabtarget5\xbb with quotes """], ["""\ But this isn't a _target; targets require backquotes. And _`this`_ is just plain confusing. """, """\ But this isn't a _target; targets require backquotes. And \n\ _` this`_ is just plain confusing. Inline target start-string without end-string. """], ["""\ _`inline target without closing backquote """, """\ _` inline target without closing backquote Inline target start-string without end-string. """], ] totest['footnote_reference'] = [ ["""\ [1]_ """, """\ 1 """], ["""\ [#]_ """, """\ """], ["""\ [#label]_ """, """\ """], ["""\ [*]_ """, """\ """], ["""\ Adjacent footnote refs are not possible: [*]_[#label]_ [#]_[2]_ [1]_[*]_ """, """\ Adjacent footnote refs are not possible: [*]_[#label]_ [#]_[2]_ [1]_[*]_ """], ] totest['citation_reference'] = [ ["""\ [citation]_ """, """\ citation """], ["""\ [citation]_ and [cit-ation]_ and [cit.ation]_ and [CIT1]_ but not [CIT 1]_ """, """\ citation and \n\ cit-ation and \n\ cit.ation and \n\ CIT1 but not [CIT 1]_ """], ["""\ Adjacent citation refs are not possible: [citation]_[CIT1]_ """, """\ Adjacent citation refs are not possible: [citation]_[CIT1]_ """], ] totest['substitution_references'] = [ ["""\ |subref| """, """\ subref """], ["""\ |subref|_ and |subref|__ """, """\ subref and \n\ subref """], ["""\ |substitution reference| """, """\ substitution reference """], ["""\ |substitution reference| """, """\ substitution reference """], ["""\ |substitution reference without closing verbar """, """\ | substitution reference without closing verbar Inline substitution_reference start-string without end-string. """], ["""\ first | then || and finally ||| """, """\ first | then || and finally ||| """], ] totest['standalone_hyperlink'] = [ ["""\ http://www.standalone.hyperlink.com http:/one-slash-only.absolute.path [http://example.com] (http://example.com) http://[1080:0:0:0:8:800:200C:417A]/IPv6address.html http://[3ffe:2a00:100:7031::1] (the final "]" is ambiguous in text) http://[3ffe:2a00:100:7031::1]/ mailto:someone@somewhere.com news:comp.lang.python An email address in a sentence: someone@somewhere.com. ftp://ends.with.a.period. (a.question.mark@end?) """, """\ http://www.standalone.hyperlink.com http:/one-slash-only.absolute.path [ http://example.com ] ( http://example.com ) < http://example.com > http://[1080:0:0:0:8:800:200C:417A]/IPv6address.html http://[3ffe:2a00:100:7031::1 ] (the final "]" is ambiguous in text) http://[3ffe:2a00:100:7031::1]/ mailto:someone@somewhere.com news:comp.lang.python An email address in a sentence: \n\ someone@somewhere.com . ftp://ends.with.a.period . ( a.question.mark@end ?) """], [r""" Valid URLs with escaped markup characters: http://example.com/\*content\*/whatever http://example.com/\*content*/whatever """, """\ 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. """, """\ 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['markup recognition rules'] = [ ["""\ __This__ should be left alone. """, """\ __This__ should be left alone. """], [r""" Character-level m\ *a*\ **r**\ ``k``\ `u`:title:\p with backslash-escaped whitespace, including new\ lines. """, """\ Character-level m a r k u p with backslash-escaped whitespace, including newlines. """], [u"""\ text-*separated*\u2010*by*\u2011*various*\u2012*dashes*\u2013*and*\u2014*hyphens*. \u00bf*punctuation*? \u00a1*examples*!\u00a0*\u00a0no-break-space\u00a0*. """, u"""\ text- separated \u2010 by \u2011 various \u2012 dashes \u2013 and \u2014 hyphens . \xbf punctuation ? \xa1 examples !\xa0 \u00a0no-break-space\u00a0 . """], # Whitespace characters: # \u180e*MONGOLIAN VOWEL SEPARATOR*\u180e, fails in Python 2.4 [u"""\ text separated by *newline* or *space* or one of \xa0*NO-BREAK SPACE*\xa0, \u1680*OGHAM SPACE MARK*\u1680, \u2000*EN QUAD*\u2000, \u2001*EM QUAD*\u2001, \u2002*EN SPACE*\u2002, \u2003*EM SPACE*\u2003, \u2004*THREE-PER-EM SPACE*\u2004, \u2005*FOUR-PER-EM SPACE*\u2005, \u2006*SIX-PER-EM SPACE*\u2006, \u2007*FIGURE SPACE*\u2007, \u2008*PUNCTUATION SPACE*\u2008, \u2009*THIN SPACE*\u2009, \u200a*HAIR SPACE*\u200a, \u202f*NARROW NO-BREAK SPACE*\u202f, \u205f*MEDIUM MATHEMATICAL SPACE*\u205f, \u3000*IDEOGRAPHIC SPACE*\u3000, \u2028*LINE SEPARATOR*\u2028 """, u"""\ text separated by newline \n\ or \n\ space or one of \xa0 NO-BREAK SPACE \xa0, \u1680 OGHAM SPACE MARK \u1680, \u2000 EN QUAD \u2000, \u2001 EM QUAD \u2001, \u2002 EN SPACE \u2002, \u2003 EM SPACE \u2003, \u2004 THREE-PER-EM SPACE \u2004, \u2005 FOUR-PER-EM SPACE \u2005, \u2006 SIX-PER-EM SPACE \u2006, \u2007 FIGURE SPACE \u2007, \u2008 PUNCTUATION SPACE \u2008, \u2009 THIN SPACE \u2009, \u200a HAIR SPACE \u200a, \u202f NARROW NO-BREAK SPACE \u202f, \u205f MEDIUM MATHEMATICAL SPACE \u205f, \u3000 IDEOGRAPHIC SPACE \u3000, LINE SEPARATOR """], # « * » ‹ * › « * » ‹ * › « * » ‹ * › French, [u"""\ "Quoted" markup start-string (matched openers & closers) -> no markup: '*' "*" (*) <*> [*] {*} ⁅*⁆ Some international quoting styles: ‘*’ “*” English, ..., „*“ ‚*‘ »*« ›*‹ German, Czech, ..., „*” «*» Romanian, “*„ ‘*‚ Greek, 「*」 『*』traditional Chinese, ”*” ’*’ »*» ›*› Swedish, Finnish, „*” ‚*’ Polish, „*” »*« ’*’ Hungarian, But this is „*’ emphasized »*‹. """, u"""\ "Quoted" markup start-string (matched openers & closers) -> no markup: '*' "*" (*) <*> [*] {*} ⁅*⁆ Some international quoting styles: ‘*’ “*” English, ..., „*“ ‚*‘ »*« ›*‹ German, Czech, ..., „*” «*» Romanian, “*„ ‘*‚ Greek, 「*」 『*』traditional Chinese, ”*” ’*’ »*» ›*› Swedish, Finnish, „*” ‚*’ Polish, „*” »*« ’*’ Hungarian, But this is „ ’ emphasized » ‹. """], ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') docutils-0.11/test/test_parsers/test_rst/test_enumerated_lists.py0000755000175000017500000004776610600306272026330 0ustar engelbertengelbert#! /usr/bin/env python # $Id: test_enumerated_lists.py 5033 2007-03-21 19:51:22Z wiemann $ # Author: David Goodger # 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['enumerated_lists'] = [ ["""\ 1. Item one. 2. Item two. 3. Item three. """, """\ Item one. Item two. Item three. """], ["""\ No blank lines betwen items: 1. Item one. 2. Item two. 3. Item three. """, """\ No blank lines betwen items: Item one. Item two. Item three. """], ["""\ 1. empty item above, no blank line """, """\ 1. empty item above, no blank line """], ["""\ Scrambled: 3. Item three. 2. Item two. 1. Item one. 3. Item three. 2. Item two. 1. Item one. """, """\ Scrambled: Item three. Enumerated list start value not ordinal-1: "3" (ordinal 3) Item two. Enumerated list start value not ordinal-1: "2" (ordinal 2) Item one. 3. Item three. 2. Item two. 1. Item one. """], ["""\ Skipping item 3: 1. Item 1. 2. Item 2. 4. Item 4. """, """\ Skipping item 3: Item 1. Enumerated list ends without a blank line; unexpected unindent. 2. Item 2. 4. Item 4. """], ["""\ Start with non-ordinal-1: 0. Item zero. 1. Item one. 2. Item two. 3. Item three. And again: 2. Item two. 3. Item three. """, """\ Start with non-ordinal-1: Item zero. Item one. Item two. Item three. Enumerated list start value not ordinal-1: "0" (ordinal 0) And again: Item two. Item three. Enumerated list start value not ordinal-1: "2" (ordinal 2) """], ["""\ 1. Item one: line 1, line 2. 2. Item two: line 1, line 2. 3. Item three: paragraph 1, line 1, line 2. Paragraph 2. """, """\ Item one: line 1, line 2. Item two: line 1, line 2. Item three: paragraph 1, line 1, line 2. Paragraph 2. """], ["""\ Different enumeration sequences: 1. Item 1. 2. Item 2. 3. Item 3. A. Item A. B. Item B. C. Item C. a. Item a. b. Item b. c. Item c. I. Item I. II. Item II. III. Item III. i. Item i. ii. Item ii. iii. Item iii. """, """\ Different enumeration sequences: Item 1. Item 2. Item 3. Item A. Item B. Item C. Item a. Item b. Item c. Item I. Item II. Item III. Item i. Item ii. Item iii. """], ["""\ Bad Roman numerals: i. i ii. ii iii. iii iiii. iiii second line (LCD) is an acronym made up of Roman numerals (livid) is a word made up of Roman numerals (CIVIL) is another such word (I) I (IVXLCDM) IVXLCDM """, """\ Bad Roman numerals: i ii iii iiii. iiii second line (LCD) is an acronym made up of Roman numerals (livid) is a word made up of Roman numerals (CIVIL) is another such word I (IVXLCDM) IVXLCDM """], ["""\ Potentially ambiguous cases: A. Item A. B. Item B. C. Item C. I. Item I. II. Item II. III. Item III. a. Item a. b. Item b. c. Item c. i. Item i. ii. Item ii. iii. Item iii. Phew! Safe! """, """\ Potentially ambiguous cases: Item A. Item B. Item C. Item I. Item II. Item III. Item a. Item b. Item c. Item i. Item ii. Item iii. Phew! Safe! """], ["""\ Definitely ambiguous: A. Item A. B. Item B. C. Item C. D. Item D. E. Item E. F. Item F. G. Item G. H. Item H. I. Item I. II. Item II. III. Item III. a. Item a. b. Item b. c. Item c. d. Item d. e. Item e. f. Item f. g. Item g. h. Item h. i. Item i. ii. Item ii. iii. Item iii. """, """\ Definitely ambiguous: Item A. Item B. Item C. Item D. Item E. Item F. Item G. Item H. Enumerated list ends without a blank line; unexpected unindent. Item I. Item II. Item III. Item a. Item b. Item c. Item d. Item e. Item f. Item g. Item h. Enumerated list ends without a blank line; unexpected unindent. Item i. Item ii. Item iii. """], ["""\ Different enumeration formats: 1. Item 1. 2. Item 2. 3. Item 3. 1) Item 1). 2) Item 2). 3) Item 3). (1) Item (1). (2) Item (2). (3) Item (3). """, """\ Different enumeration formats: Item 1. Item 2. Item 3. Item 1). Item 2). Item 3). Item (1). Item (2). Item (3). """], ["""\ Nested enumerated lists: 1. Item 1. A) Item A). B) Item B). C) Item C). 2. Item 2. (a) Item (a). I) Item I). II) Item II). III) Item III). (b) Item (b). (c) Item (c). (i) Item (i). (ii) Item (ii). (iii) Item (iii). 3. Item 3. """, """\ Nested enumerated lists: Item 1. Item A). Item B). Item C). Item 2. Item (a). Item I). Item II). Item III). Item (b). Item (c). Item (i). Item (ii). Item (iii). 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. """, """\ Einstein was a great influence on Physicist, who was a colleague of Enumerated list ends without a blank line; unexpected unindent. C. Chemist. They all worked in Princeton, NJ. Using a non-breaking space as a workaround: 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, line 2. 2. Item two: line 1, line 2. 3. Item three: paragraph 1, line 1, line 2. Paragraph 2. """, """\ Item one: line 1, line 2. Item two: line 1, Enumerated list ends without a blank line; unexpected unindent. line 2. Block quote ends without a blank line; unexpected unindent. Item three: paragraph 1, line 1, Enumerated list start value not ordinal-1: "3" (ordinal 3) Enumerated list ends without a blank line; unexpected unindent. line 2. 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. """], ["""\ z. 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: """], ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') docutils-0.11/test/test_parsers/test_rst/__init__.py0000644000175000017500000000046210254646615023451 0ustar engelbertengelbertimport os import os.path import sys sys.path.insert(0, os.path.abspath(os.path.dirname(__file__))) 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) docutils-0.11/test/test_parsers/test_rst/test_paragraphs.py0000755000175000017500000000246110434150472025074 0ustar engelbertengelbert#! /usr/bin/env python # $Id: test_paragraphs.py 4564 2006-05-21 20:44:42Z wiemann $ # Author: David Goodger # 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['paragraphs'] = [ ["""\ A paragraph. """, """\ A paragraph. """], ["""\ Paragraph 1. Paragraph 2. """, """\ Paragraph 1. Paragraph 2. """], ["""\ Line 1. Line 2. Line 3. """, """\ Line 1. Line 2. Line 3. """], ["""\ Paragraph 1, Line 1. Line 2. Line 3. Paragraph 2, Line 1. Line 2. Line 3. """, """\ Paragraph 1, Line 1. Line 2. Line 3. Paragraph 2, Line 1. Line 2. Line 3. """], ["""\ A. Einstein was a really smart dude. """, """\ A. Einstein was a really smart dude. """], ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') docutils-0.11/test/test_parsers/test_rst/test_TableParser.py0000755000175000017500000001372412153360646025162 0ustar engelbertengelbert#! /usr/bin/env python # coding: utf-8 # $Id: test_TableParser.py 7668 2013-06-04 12:46:30Z milde $ # Author: David Goodger # Copyright: This module has been placed in the public domain. """ Tests for states.py. """ from __init__ import DocutilsTestSupport def suite(): s = DocutilsTestSupport.GridTableParserTestSuite() s.generateTests(totest) return s totest = {} totest['grid_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.'])]])], # Combining chars in grid tables still fail # [u"""\ # +--------------+------------------+ # | A tāble w̅ith | comb̲ining chars. | # +--------------+------------------+ # """, # [(0, 0, 2, 15, [u'A table with']), # (0, 15, 2, 30, [u'combining chars.'])], # ([14, 14], # [], # [[(0, 0, 1, [u'A table with']), # (0, 0, 1, [u'combining chars.'])]])], ["""\ +--------------+-------------+ | 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 ' '(table lines 3 and 5); only one allowed.', 'TableMarkupError: Multiple head/body row separators ' '(table lines 3 and 5); only one allowed.'], ["""\ +-------------------------------------+ | | +-------------------------------------+ """, [(0, 0, 2, 38, [''])], ([37], [], [[(0, 0, 1, [''])]])], ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') docutils-0.11/test/test_parsers/test_rst/test_east_asian_text.py0000755000175000017500000002223211703370411026112 0ustar engelbertengelbert#! /usr/bin/env python # -*- coding: utf-8 -*- # $Id: test_east_asian_text.py 7313 2012-01-11 20:28:57Z milde $ # Author: David Goodger # 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 from docutils._compat import b 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="6" source="test data" type="ERROR"> <paragraph> Malformed table. Text in column margin in table line 2. <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 = =================================== """, b("""\ <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 """).decode('raw_unicode_escape')], ] ''' [u"""\ """, u"""\ """], ''' if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_definition_lists.py�����������������������������������0000755�0001750�0001750�00000026157�10434150472�026322� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_definition_lists.py 4564 2006-05-21 20:44:42Z wiemann $ # Author: David Goodger <goodger@python.org> # 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['definition_lists'] = [ ["""\ term definition """, """\ <document source="test data"> <definition_list> <definition_list_item> <term> term <definition> <paragraph> definition """], ["""\ term definition paragraph """, """\ <document source="test data"> <definition_list> <definition_list_item> <term> term <definition> <paragraph> definition <paragraph> paragraph """], ["""\ term definition no blank line """, """\ <document source="test data"> <definition_list> <definition_list_item> <term> term <definition> <paragraph> definition <system_message level="2" line="3" source="test data" type="WARNING"> <paragraph> Definition list ends without a blank line; unexpected unindent. <paragraph> no blank line """], ["""\ A paragraph:: A literal block without a blank line first? """, """\ <document source="test data"> <definition_list> <definition_list_item> <term> A paragraph:: <definition> <system_message level="1" line="2" source="test data" type="INFO"> <paragraph> Blank line missing before literal block (after the "::")? Interpreted as a definition list item. <paragraph> A literal block without a blank line first? """], ["""\ this is not a term; a term may only be one line long this is not a definition """, """\ <document source="test data"> <paragraph> this is not a term; a term may only be one line long <system_message level="3" line="3" source="test data" type="ERROR"> <paragraph> Unexpected indentation. <block_quote> <paragraph> this is not a definition """], ["""\ term 1 definition 1 term 2 definition 2 """, """\ <document source="test data"> <definition_list> <definition_list_item> <term> term 1 <definition> <paragraph> definition 1 <definition_list_item> <term> term 2 <definition> <paragraph> definition 2 """], ["""\ term 1 definition 1 (no blank line below) term 2 definition 2 """, """\ <document source="test data"> <definition_list> <definition_list_item> <term> term 1 <definition> <paragraph> definition 1 (no blank line below) <definition_list_item> <term> term 2 <definition> <paragraph> definition 2 """], ["""\ term 1 definition 1 (no blank line below) term 2 definition 2 No blank line after the definition list. """, """\ <document source="test data"> <definition_list> <definition_list_item> <term> term 1 <definition> <paragraph> definition 1 (no blank line below) <definition_list_item> <term> term 2 <definition> <paragraph> definition 2 <system_message level="2" line="5" source="test data" type="WARNING"> <paragraph> Definition list ends without a blank line; unexpected unindent. <paragraph> No blank line after the definition list. """], ["""\ term 1 definition 1 term 1a definition 1a term 1b definition 1b term 2 definition 2 paragraph """, """\ <document source="test data"> <definition_list> <definition_list_item> <term> term 1 <definition> <paragraph> definition 1 <definition_list> <definition_list_item> <term> term 1a <definition> <paragraph> definition 1a <definition_list_item> <term> term 1b <definition> <paragraph> definition 1b <definition_list_item> <term> term 2 <definition> <paragraph> definition 2 <paragraph> paragraph """], ["""\ Term : classifier The ' : ' indicates a classifier in definition list item terms only. """, """\ <document source="test data"> <definition_list> <definition_list_item> <term> Term <classifier> classifier <definition> <paragraph> The ' : ' indicates a classifier in definition list item terms only. """], ["""\ Term: not a classifier Because there's no space before the colon. Term :not a classifier Because there's no space after the colon. Term \: not a classifier Because the colon is escaped. """, """\ <document source="test data"> <definition_list> <definition_list_item> <term> Term: not a classifier <definition> <paragraph> Because there's no space before the colon. <definition_list_item> <term> Term :not a classifier <definition> <paragraph> Because there's no space after the colon. <definition_list_item> <term> Term : not a classifier <definition> <paragraph> Because the colon is escaped. """], ["""\ ``Term : not a classifier`` Because the ' : ' is inside an inline literal. """, """\ <document source="test data"> <definition_list> <definition_list_item> <term> <literal> Term : not a classifier <definition> <paragraph> Because the ' : ' is inside an inline literal. """], ["""\ Term `with *inline ``text **errors : classifier `with *errors ``too Definition `with *inline ``text **markup errors. """, """\ <document source="test data"> <definition_list> <definition_list_item> <term> Term \n\ <problematic ids="id2" refid="id1"> ` with \n\ <problematic ids="id4" refid="id3"> * inline \n\ <problematic ids="id6" refid="id5"> `` text \n\ <problematic ids="id8" refid="id7"> ** errors <classifier> classifier \n\ <problematic ids="id10" refid="id9"> ` with \n\ <problematic ids="id12" refid="id11"> * errors \n\ <problematic ids="id14" refid="id13"> `` too <definition> <system_message backrefs="id2" ids="id1" level="2" line="1" source="test data" type="WARNING"> <paragraph> Inline interpreted text or phrase reference start-string without end-string. <system_message backrefs="id4" ids="id3" level="2" line="1" source="test data" type="WARNING"> <paragraph> Inline emphasis start-string without end-string. <system_message backrefs="id6" ids="id5" level="2" line="1" source="test data" type="WARNING"> <paragraph> Inline literal start-string without end-string. <system_message backrefs="id8" ids="id7" level="2" line="1" source="test data" type="WARNING"> <paragraph> Inline strong start-string without end-string. <system_message backrefs="id10" ids="id9" level="2" line="1" source="test data" type="WARNING"> <paragraph> Inline interpreted text or phrase reference start-string without end-string. <system_message backrefs="id12" ids="id11" level="2" line="1" source="test data" type="WARNING"> <paragraph> Inline emphasis start-string without end-string. <system_message backrefs="id14" ids="id13" level="2" line="1" source="test data" type="WARNING"> <paragraph> Inline literal start-string without end-string. <paragraph> Definition \n\ <problematic ids="id16" refid="id15"> ` with \n\ <problematic ids="id18" refid="id17"> * inline \n\ <problematic ids="id20" refid="id19"> `` text \n\ <problematic ids="id22" refid="id21"> ** markup errors. <system_message backrefs="id16" ids="id15" level="2" line="2" source="test data" type="WARNING"> <paragraph> Inline interpreted text or phrase reference start-string without end-string. <system_message backrefs="id18" ids="id17" level="2" line="2" source="test data" type="WARNING"> <paragraph> Inline emphasis start-string without end-string. <system_message backrefs="id20" ids="id19" level="2" line="2" source="test data" type="WARNING"> <paragraph> Inline literal start-string without end-string. <system_message backrefs="id22" ids="id21" level="2" line="2" source="test data" type="WARNING"> <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__': import unittest unittest.main(defaultTest='suite') �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_citations.py������������������������������������������0000755�0001750�0001750�00000010207�10755254773�024755� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_citations.py 5510 2008-02-15 09:23:07Z grubert $ # Author: David Goodger <goodger@python.org> # 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['citations'] = [ ["""\ .. [citation] This is a citation. """, """\ <document source="test data"> <citation ids="citation" names="citation"> <label> citation <paragraph> This is a citation. """], ["""\ .. [citation1234] This is a citation with year. """, """\ <document source="test data"> <citation ids="citation1234" names="citation1234"> <label> citation1234 <paragraph> This is a citation with year. """], ["""\ .. [citation] This is a citation on multiple lines. """, """\ <document source="test data"> <citation ids="citation" names="citation"> <label> citation <paragraph> This is a citation on multiple lines. """], ["""\ .. [citation1] This is a citation on multiple lines with more space. .. [citation2] This is a citation on multiple lines with less space. """, """\ <document source="test data"> <citation ids="citation1" names="citation1"> <label> citation1 <paragraph> This is a citation on multiple lines with more space. <citation ids="citation2" names="citation2"> <label> citation2 <paragraph> This is a citation on multiple lines with less space. """], ["""\ .. [citation] This is a citation on multiple lines whose block starts on line 2. """, """\ <document source="test data"> <citation ids="citation" names="citation"> <label> citation <paragraph> This is a citation on multiple lines whose block starts on line 2. """], ["""\ .. [citation] That was an empty citation. """, """\ <document source="test data"> <citation ids="citation" names="citation"> <label> citation <paragraph> That was an empty citation. """], ["""\ .. [citation] No blank line. """, """\ <document source="test data"> <citation ids="citation" names="citation"> <label> citation <system_message level="2" line="2" source="test data" type="WARNING"> <paragraph> Explicit markup ends without a blank line; unexpected unindent. <paragraph> No blank line. """], ["""\ .. [citation label with spaces] this isn't a citation .. [*citationlabelwithmarkup*] this isn't a citation """, """\ <document source="test data"> <comment xml:space="preserve"> [citation label with spaces] this isn't a citation <comment xml:space="preserve"> [*citationlabelwithmarkup*] this isn't a citation """], [""" isolated internals : ``.-_``. .. [citation.withdot] one dot .. [citation-withdot] one hyphen .. [citation_withunderscore] one underscore .. [citation:with:colons] two colons .. [citation+withplus] one plus """, """<document source="test data"> <paragraph> isolated internals : \n\ <literal> .-_ . <citation ids="citation-withdot" names="citation.withdot"> <label> citation.withdot <paragraph> one dot <citation ids="id1" names="citation-withdot"> <label> citation-withdot <paragraph> one hyphen <citation ids="citation-withunderscore" names="citation_withunderscore"> <label> citation_withunderscore <paragraph> one underscore <citation ids="citation-with-colons" names="citation:with:colons"> <label> citation:with:colons <paragraph> two colons <citation ids="citation-withplus" names="citation+withplus"> <label> citation+withplus <paragraph> one plus """], ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/includes/��������������������������������������������������0000755�0001750�0001750�00000000000�12173162603�023134� 5����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/includes/include9.txt��������������������������������������0000644�0001750�0001750�00000000113�07607426742�025421� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������In ../includes/include9.txt. .. include:: ../test_directives/include2.txt �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_substitutions.py��������������������������������������0000755�0001750�0001750�00000021263�10434150472�025704� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_substitutions.py 4564 2006-05-21 20:44:42Z wiemann $ # Author: David Goodger <goodger@python.org> # 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['substitution_definitions'] = [ ["""\ Here's an image substitution definition: .. |symbol| image:: symbol.png """, """\ <document source="test data"> <paragraph> Here's an image substitution definition: <substitution_definition names="symbol"> <image alt="symbol" uri="symbol.png"> """], ["""\ Embedded directive starts on the next line: .. |symbol| image:: symbol.png """, """\ <document source="test data"> <paragraph> Embedded directive starts on the next line: <substitution_definition names="symbol"> <image alt="symbol" uri="symbol.png"> """], ["""\ Trailing spaces should not be significant: .. |symbol| image:: \n\ symbol.png """, """\ <document source="test data"> <paragraph> Trailing spaces should not be significant: <substitution_definition names="symbol"> <image alt="symbol" uri="symbol.png"> """], ["""\ Here's a series of substitution definitions: .. |symbol 1| image:: symbol1.png .. |SYMBOL 2| image:: symbol2.png :height: 50 :width: 100 .. |symbol 3| image:: symbol3.png """, """\ <document source="test data"> <paragraph> Here's a series of substitution definitions: <substitution_definition names="symbol\ 1"> <image alt="symbol 1" uri="symbol1.png"> <substitution_definition names="SYMBOL\ 2"> <image alt="SYMBOL 2" height="50" uri="symbol2.png" width="100"> <substitution_definition names="symbol\ 3"> <image alt="symbol 3" uri="symbol3.png"> """], ["""\ .. |very long substitution text, split across lines| image:: symbol.png """, """\ <document source="test data"> <substitution_definition names="very\ long\ substitution\ text,\ split\ across\ lines"> <image alt="very long substitution text, split across lines" uri="symbol.png"> """], ["""\ .. |symbol 1| image:: symbol.png Followed by a block quote. """, """\ <document source="test data"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Error in "image" directive: no content permitted. <literal_block xml:space="preserve"> image:: symbol.png \n\ Followed by a block quote. <system_message level="2" line="1" source="test data" type="WARNING"> <paragraph> Substitution definition "symbol 1" empty or invalid. <literal_block xml:space="preserve"> .. |symbol 1| image:: symbol.png \n\ Followed by a block quote. """], ["""\ .. |symbol 1| image:: symbol.png Followed by a paragraph. .. |symbol 2| image:: symbol.png .. Followed by a block quote. """, """\ <document source="test data"> <substitution_definition names="symbol\ 1"> <image alt="symbol 1" uri="symbol.png"> <paragraph> Followed by a paragraph. <substitution_definition names="symbol\ 2"> <image alt="symbol 2" uri="symbol.png"> <comment xml:space="preserve"> <block_quote> <paragraph> Followed by a block quote. """], [u"""\ Substitutions support case differences: .. |eacute| replace:: \u00E9 .. |Eacute| replace:: \u00C9 """, u"""\ <document source="test data"> <paragraph> Substitutions support case differences: <substitution_definition names="eacute"> \u00E9 <substitution_definition names="Eacute"> \u00C9 """], ["""\ Raw substitution, backslashes should be preserved: .. |alpha| raw:: latex $\\\\alpha$ """, """\ <document source="test data"> <paragraph> Raw substitution, backslashes should be preserved: <substitution_definition names="alpha"> <raw format="latex" xml:space="preserve"> $\\\\alpha$ """], ["""\ Here are some duplicate substitution definitions: .. |symbol| image:: symbol.png .. |symbol| image:: symbol.png """, """\ <document source="test data"> <paragraph> Here are some duplicate substitution definitions: <substitution_definition dupnames="symbol"> <image alt="symbol" uri="symbol.png"> <system_message level="3" line="4" source="test data" type="ERROR"> <paragraph> Duplicate substitution definition name: "symbol". <substitution_definition names="symbol"> <image alt="symbol" uri="symbol.png"> """], ["""\ Here are some bad cases: .. |symbol| image:: symbol.png No blank line after. .. |empty| .. |unknown| directive:: symbol.png .. |invalid 1| there's no directive here .. |invalid 2| there's no directive here With some block quote text, line 1. And some more, line 2. .. |invalid 3| there's no directive here .. | bad name | bad data .. | """, """\ <document source="test data"> <paragraph> Here are some bad cases: <substitution_definition names="symbol"> <image alt="symbol" uri="symbol.png"> <system_message level="2" line="4" source="test data" type="WARNING"> <paragraph> Explicit markup ends without a blank line; unexpected unindent. <paragraph> No blank line after. <system_message level="2" line="6" source="test data" type="WARNING"> <paragraph> Substitution definition "empty" missing contents. <literal_block xml:space="preserve"> .. |empty| <system_message level="1" line="8" source="test data" type="INFO"> <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> Unknown directive type "directive". <literal_block xml:space="preserve"> directive:: symbol.png <system_message level="2" line="8" source="test data" type="WARNING"> <paragraph> Substitution definition "unknown" empty or invalid. <literal_block xml:space="preserve"> .. |unknown| directive:: symbol.png <system_message level="2" line="10" source="test data" type="WARNING"> <paragraph> Substitution definition "invalid 1" empty or invalid. <literal_block xml:space="preserve"> .. |invalid 1| there's no directive here <system_message level="2" line="11" source="test data" type="WARNING"> <paragraph> Substitution definition "invalid 2" empty or invalid. <literal_block xml:space="preserve"> .. |invalid 2| there's no directive here With some block quote text, line 1. And some more, line 2. <system_message level="2" line="15" source="test data" type="WARNING"> <paragraph> Substitution definition "invalid 3" empty or invalid. <literal_block xml:space="preserve"> .. |invalid 3| there's no directive here <comment xml:space="preserve"> | bad name | bad data <comment xml:space="preserve"> | """], ["""\ Elements that are prohibited inside of substitution definitions: .. |target| replace:: _`target` .. |reference| replace:: anonymous__ .. |auto-numbered footnote| replace:: [#]_ """, """\ <document source="test data"> <paragraph> Elements that are prohibited inside of substitution definitions: <system_message level="3" line="3" source="test data" type="ERROR"> <paragraph> 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:: [#]_ """], ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_bullet_lists.py���������������������������������������0000755�0001750�0001750�00000007477�10440651315�025464� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_bullet_lists.py 4593 2006-06-04 21:38:21Z wiemann $ # Author: David Goodger <goodger@python.org> # 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['bullet_lists'] = [ ["""\ - item """, """\ <document source="test data"> <bullet_list bullet="-"> <list_item> <paragraph> item """], ["""\ * item 1 * item 2 """, """\ <document source="test data"> <bullet_list bullet="*"> <list_item> <paragraph> item 1 <list_item> <paragraph> item 2 """], ["""\ No blank line between: + item 1 + item 2 """, """\ <document source="test data"> <paragraph> No blank line between: <bullet_list bullet="+"> <list_item> <paragraph> item 1 <list_item> <paragraph> item 2 """], ["""\ - item 1, para 1. item 1, para 2. - item 2 """, """\ <document source="test data"> <bullet_list bullet="-"> <list_item> <paragraph> item 1, para 1. <paragraph> item 1, para 2. <list_item> <paragraph> item 2 """], ["""\ - item 1, line 1 item 1, line 2 - item 2 """, """\ <document source="test data"> <bullet_list bullet="-"> <list_item> <paragraph> item 1, line 1 item 1, line 2 <list_item> <paragraph> item 2 """], ["""\ Different bullets: - item 1 + item 2 * item 3 - item 4 """, """\ <document source="test data"> <paragraph> Different bullets: <bullet_list bullet="-"> <list_item> <paragraph> item 1 <bullet_list bullet="+"> <list_item> <paragraph> item 2 <bullet_list bullet="*"> <list_item> <paragraph> item 3 <system_message level="2" line="8" source="test data" type="WARNING"> <paragraph> Bullet list ends without a blank line; unexpected unindent. <bullet_list bullet="-"> <list_item> <paragraph> item 4 """], ["""\ - item no blank line """, """\ <document source="test data"> <bullet_list bullet="-"> <list_item> <paragraph> item <system_message level="2" line="2" source="test data" type="WARNING"> <paragraph> Bullet list ends without a blank line; unexpected unindent. <paragraph> no blank line """], ["""\ - empty item above """, """\ <document source="test data"> <bullet_list bullet="-"> <list_item> <paragraph> empty item above """], ["""\ - empty item above, no blank line """, """\ <document source="test data"> <bullet_list bullet="-"> <list_item> <system_message level="2" line="2" source="test data" type="WARNING"> <paragraph> Bullet list ends without a blank line; unexpected unindent. <paragraph> empty item above, no blank line """], [u"""\ Unicode bullets: \u2022 BULLET \u2023 TRIANGULAR BULLET \u2043 HYPHEN BULLET """, u"""\ <document source="test data"> <paragraph> Unicode bullets: <bullet_list bullet="\u2022"> <list_item> <paragraph> BULLET <bullet_list bullet="\u2023"> <list_item> <paragraph> TRIANGULAR BULLET <bullet_list bullet="\u2043"> <list_item> <paragraph> HYPHEN BULLET """], ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_tables.py���������������������������������������������0000755�0001750�0001750�00000111160�11703370411�024210� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_tables.py 7313 2012-01-11 20:28:57Z milde $ # Author: David Goodger <goodger@python.org> # Copyright: This module has been placed in the public domain. """ Tests for states.py. """ import os from __init__ import DocutilsTestSupport def suite(): s = DocutilsTestSupport.ParserTestSuite() s.generateTests(totest) return s mydir = 'test_parsers/test_rst/' include2 = os.path.join(mydir, 'test_directives/include2.txt') totest = {} totest['grid_tables'] = [ ["""\ +-------------------------------------+ | A table with one cell and one line. | +-------------------------------------+ """, """\ <document source="test data"> <table> <tgroup cols="1"> <colspec colwidth="37"> <tbody> <row> <entry> <paragraph> A table with one cell and one line. """], ["""\ +-----------------------+ | A table with one cell | | and two lines. | +-----------------------+ """, """\ <document source="test data"> <table> <tgroup cols="1"> <colspec colwidth="23"> <tbody> <row> <entry> <paragraph> A table with one cell and two lines. """], ["""\ +-----------------------+ | A malformed table. | +-----------------------+ """, """\ <document source="test data"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Malformed table. <literal_block xml:space="preserve"> +-----------------------+ | A malformed table. | +-----------------------+ """], ["""\ +------------------------+ | A well-formed | table. | +------------------------+ +------------------------+ | This +----------+ too! | +------------------------+ """, """\ <document source="test data"> <table> <tgroup cols="1"> <colspec colwidth="24"> <tbody> <row> <entry> <paragraph> A well-formed | table. <table> <tgroup cols="1"> <colspec colwidth="24"> <tbody> <row> <entry> <paragraph> This +----------+ too! """], ["""\ +--------------+--------------+ | A table with | two columns. | +--------------+--------------+ """, """\ <document source="test data"> <table> <tgroup cols="2"> <colspec colwidth="14"> <colspec colwidth="14"> <tbody> <row> <entry> <paragraph> A table with <entry> <paragraph> two columns. """], ["""\ +--------------+ | A table with | +--------------+ | two rows. | +--------------+ """, """\ <document source="test data"> <table> <tgroup cols="1"> <colspec colwidth="14"> <tbody> <row> <entry> <paragraph> A table with <row> <entry> <paragraph> two rows. """], ["""\ +--------------+-------------+ | A table with | two columns | +--------------+-------------+ | and | two rows. | +--------------+-------------+ """, """\ <document source="test data"> <table> <tgroup cols="2"> <colspec colwidth="14"> <colspec colwidth="13"> <tbody> <row> <entry> <paragraph> A table with <entry> <paragraph> two columns <row> <entry> <paragraph> and <entry> <paragraph> two rows. """], ["""\ +--------------+---------------+ | A table with | two columns, | +--------------+---------------+ | two rows, and a column span. | +------------------------------+ """, """\ <document source="test data"> <table> <tgroup cols="2"> <colspec colwidth="14"> <colspec colwidth="15"> <tbody> <row> <entry> <paragraph> A table with <entry> <paragraph> two columns, <row> <entry morecols="1"> <paragraph> two rows, and a column span. """], ["""\ +--------------------------+ | A table with three rows, | +------------+-------------+ | and two | columns. | +------------+-------------+ | First and last rows | | contains column spans. | +--------------------------+ """, """\ <document source="test data"> <table> <tgroup cols="2"> <colspec colwidth="12"> <colspec colwidth="13"> <tbody> <row> <entry morecols="1"> <paragraph> A table with three rows, <row> <entry> <paragraph> and two <entry> <paragraph> columns. <row> <entry morecols="1"> <paragraph> First and last rows contains column spans. """], ["""\ +--------------+--------------+ | A table with | two columns, | +--------------+ and a row | | two rows, | span. | +--------------+--------------+ """, """\ <document source="test data"> <table> <tgroup cols="2"> <colspec colwidth="14"> <colspec colwidth="14"> <tbody> <row> <entry> <paragraph> A table with <entry morerows="1"> <paragraph> two columns, and a row span. <row> <entry> <paragraph> two rows, """], ["""\ +------------+-------------+---------------+ | A table | two rows in | and row spans | | with three +-------------+ to left and | | columns, | the middle, | right. | +------------+-------------+---------------+ """, """\ <document source="test data"> <table> <tgroup cols="3"> <colspec colwidth="12"> <colspec colwidth="13"> <colspec colwidth="15"> <tbody> <row> <entry morerows="1"> <paragraph> A table with three columns, <entry> <paragraph> two rows in <entry morerows="1"> <paragraph> and row spans to left and right. <row> <entry> <paragraph> the middle, """], ["""\ Complex spanning pattern (no edge knows all rows/cols): +-----------+-------------------------+ | W/NW cell | N/NE cell | | +-------------+-----------+ | | Middle cell | E/SE cell | +-----------+-------------+ | | S/SE cell | | +-------------------------+-----------+ """, """\ <document source="test data"> <paragraph> Complex spanning pattern (no edge knows all rows/cols): <table> <tgroup cols="3"> <colspec colwidth="11"> <colspec colwidth="13"> <colspec colwidth="11"> <tbody> <row> <entry morerows="1"> <paragraph> W/NW cell <entry morecols="1"> <paragraph> N/NE cell <row> <entry> <paragraph> Middle cell <entry morerows="1"> <paragraph> E/SE cell <row> <entry morecols="1"> <paragraph> S/SE cell """], ["""\ +------------------------+------------+----------+----------+ | Header row, column 1 | Header 2 | Header 3 | Header 4 | +========================+============+==========+==========+ | 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. | +------------------------+------------+---------------------+ """, """\ <document source="test data"> <table> <tgroup cols="4"> <colspec colwidth="24"> <colspec colwidth="12"> <colspec colwidth="10"> <colspec colwidth="10"> <thead> <row> <entry> <paragraph> Header row, column 1 <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. <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 """], ["""\ +-----------------+--------+ | A simple table | cell 2 | +-----------------+--------+ | cell 3 | cell 4 | +-----------------+--------+ No blank line after table. """, """\ <document source="test data"> <table> <tgroup cols="2"> <colspec colwidth="17"> <colspec colwidth="8"> <tbody> <row> <entry> <paragraph> A simple table <entry> <paragraph> cell 2 <row> <entry> <paragraph> cell 3 <entry> <paragraph> cell 4 <system_message level="2" line="6" source="test data" type="WARNING"> <paragraph> Blank line required after table. <paragraph> No blank line after table. """], ["""\ +-----------------+--------+ | A simple table | cell 2 | +-----------------+--------+ | cell 3 | cell 4 | +-----------------+--------+ Unexpected indent and no blank line after table. """, """\ <document source="test data"> <table> <tgroup cols="2"> <colspec colwidth="17"> <colspec colwidth="8"> <tbody> <row> <entry> <paragraph> A simple table <entry> <paragraph> cell 2 <row> <entry> <paragraph> cell 3 <entry> <paragraph> cell 4 <system_message level="3" line="6" source="test data" type="ERROR"> <paragraph> Unexpected indentation. <system_message level="2" line="6" source="test data" type="WARNING"> <paragraph> Blank line required after table. <block_quote> <paragraph> Unexpected indent and no blank line after table. """], ["""\ +--------------+-------------+ | A bad table. | | +--------------+ | | Cells must be rectangles. | +----------------------------+ """, """\ <document source="test data"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Malformed table. Malformed table; parse incomplete. <literal_block xml:space="preserve"> +--------------+-------------+ | A bad table. | | +--------------+ | | Cells must be rectangles. | +----------------------------+ """], ["""\ +------------------------------+ | This table contains another. | | | | +-------------------------+ | | | A table within a table. | | | +-------------------------+ | +------------------------------+ """, """\ <document source="test data"> <table> <tgroup cols="1"> <colspec colwidth="30"> <tbody> <row> <entry> <paragraph> This table contains another. <table> <tgroup cols="1"> <colspec colwidth="25"> <tbody> <row> <entry> <paragraph> A table within a table. """], ["""\ +------------------+--------+ | A simple table | | +------------------+--------+ | with empty cells | | +------------------+--------+ """, """\ <document source="test data"> <table> <tgroup cols="2"> <colspec colwidth="18"> <colspec colwidth="8"> <tbody> <row> <entry> <paragraph> A simple table <entry> <row> <entry> <paragraph> with empty cells <entry> """], [("""\ +------------------------------------------------------------------------------+ | .. include:: | %s +------------------------------------------------------------------------------+ | (The first cell of this table may expand | | to accommodate long filesystem paths.) | +------------------------------------------------------------------------------+ """) % ('\n'.join(['| %-70s |' % include2[part * 70 : (part + 1) * 70] for part in range(len(include2) // 70 + 1)])), """\ <document source="test data"> <table> <tgroup cols="1"> <colspec colwidth="78"> <tbody> <row> <entry> <paragraph> Here are some paragraphs that can appear at any level. <paragraph> This file (include2.txt) is used by <literal> test_include.py . <row> <entry> <paragraph> (The first cell of this table may expand to accommodate long filesystem paths.) """], [("""\ Something before. +------------------------------------------------------------------------------+ | .. include:: | %s +------------------------------------------------------------------------------+ Something afterwards. And more. """) % ('\n'.join(['| %-70s |' % include2[part * 70 : (part + 1) * 70] for part in range(len(include2) // 70 + 1)])), """\ <document source="test data"> <paragraph> Something before. <table> <tgroup cols="1"> <colspec colwidth="78"> <tbody> <row> <entry> <paragraph> Here are some paragraphs that can appear at any level. <paragraph> This file (include2.txt) is used by <literal> test_include.py . <paragraph> Something afterwards. <paragraph> And more. """], ] totest['simple_tables'] = [ ["""\ ============ ============ A table with two columns. ============ ============ Paragraph. """, """\ <document source="test data"> <table> <tgroup cols="2"> <colspec colwidth="12"> <colspec colwidth="12"> <tbody> <row> <entry> <paragraph> A table with <entry> <paragraph> two columns. <paragraph> Paragraph. """], ["""\ ============ ============ A table with two columns and two rows. ============ ============ """, """\ <document source="test data"> <table> <tgroup cols="2"> <colspec colwidth="12"> <colspec colwidth="12"> <tbody> <row> <entry> <paragraph> A table with <entry> <paragraph> two columns <row> <entry> <paragraph> and <entry> <paragraph> two rows. """], ["""\ ============ ============== A table with two columns, two rows, and a column span. ============================ """, """\ <document source="test data"> <table> <tgroup cols="2"> <colspec colwidth="12"> <colspec colwidth="14"> <tbody> <row> <entry> <paragraph> A table with <entry> <paragraph> two columns, <row> <entry morecols="1"> <paragraph> two rows, and a column span. """], ["""\ == =========== =========== 1 A table with three rows, -- ------------------------ 2 and three columns. 3 First and third rows contain column spans. This row is a multi-line row, and overflows to the right. -- ------------------------ 4 One last row. == =========== =========== """, """\ <document source="test data"> <table> <tgroup cols="3"> <colspec colwidth="2"> <colspec colwidth="11"> <colspec colwidth="44"> <tbody> <row> <entry> <paragraph> 1 <entry morecols="1"> <paragraph> A table with three rows, <row> <entry> <paragraph> 2 <entry> <paragraph> and three <entry> <paragraph> columns. <row> <entry> <paragraph> 3 <entry morecols="1"> <paragraph> First and third rows contain column spans. <paragraph> This row is a multi-line row, and overflows to the right. <row> <entry> <paragraph> 4 <entry> <paragraph> One last <entry> <paragraph> row. """], ["""\ ======= ========= ======== A table with three columns. ================== ======== """, """\ <document source="test data"> <table> <tgroup cols="3"> <colspec colwidth="7"> <colspec colwidth="9"> <colspec colwidth="8"> <tbody> <row> <entry morecols="1"> <paragraph> A table with three <entry> <paragraph> columns. """], ["""\ ============== ====== A simple table with no bottom border """, """\ <document source="test data"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Malformed table. No bottom table border found. <literal_block xml:space="preserve"> ============== ====== A simple table with no bottom border """], ["""\ ============== ====== A simple table cell 2 cell 3 cell 4 ============== ====== No blank line after table. """, """\ <document source="test data"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Malformed table. No bottom table border found or no blank line after table bottom. <literal_block xml:space="preserve"> ============== ====== A simple table cell 2 cell 3 cell 4 ============== ====== <system_message level="2" line="5" source="test data" type="WARNING"> <paragraph> Blank line required after table. <paragraph> No blank line after table. """], ["""\ ============== ====== A simple table cell 2 ============== ====== cell 3 cell 4 ============== ====== No blank line after table. """, """\ <document source="test data"> <table> <tgroup cols="2"> <colspec colwidth="14"> <colspec colwidth="6"> <thead> <row> <entry> <paragraph> A simple table <entry> <paragraph> cell 2 <tbody> <row> <entry> <paragraph> cell 3 <entry> <paragraph> cell 4 <system_message level="2" line="6" source="test data" type="WARNING"> <paragraph> Blank line required after table. <paragraph> No blank line after table. """], ["""\ ============== ====== A simple table cell 2 cell 3 cell 4 ============== ====== Unexpected indent and no blank line after table. """, """\ <document source="test data"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Malformed table. No bottom table border found or no blank line after table bottom. <literal_block xml:space="preserve"> ============== ====== A simple table cell 2 cell 3 cell 4 ============== ====== <system_message level="2" line="5" source="test data" type="WARNING"> <paragraph> Blank line required after table. <block_quote> <paragraph> Unexpected indent and no blank line after table. """], ["""\ ============== ====== A bad table cell 2 cell 3 cell 4 ============ ======== """, """\ <document source="test data"> <system_message level="3" line="4" source="test data" type="ERROR"> <paragraph> Malformed table. Column span alignment problem in table line 4. <literal_block xml:space="preserve"> ============== ====== A bad table cell 2 cell 3 cell 4 ============ ======== """], ["""\ ======== ========= A bad table cell 2 cell 3 cell 4 ======== ========= """, """\ <document source="test data"> <system_message level="3" line="2" source="test data" type="ERROR"> <paragraph> Malformed table. Text in column margin in table line 2. <literal_block xml:space="preserve"> ======== ========= A bad table cell 2 cell 3 cell 4 ======== ========= """], ["""\ == ============================ 1 This table contains another. 2 ======= ====== ======== A table within a table. ======= ====== ======== The outer table does have to have at least two columns though. == ============================ """, """\ <document source="test data"> <table> <tgroup cols="2"> <colspec colwidth="2"> <colspec colwidth="28"> <tbody> <row> <entry> <paragraph> 1 <entry> <paragraph> This table contains another. <row> <entry> <paragraph> 2 <entry> <table> <tgroup cols="3"> <colspec colwidth="7"> <colspec colwidth="6"> <colspec colwidth="8"> <tbody> <row> <entry> <paragraph> A table <entry> <paragraph> within <entry> <paragraph> a table. <paragraph> The outer table does have to have at least two columns though. """], ["""\ ================ ====== A simple table with empty cells ================ ====== """, """\ <document source="test data"> <table> <tgroup cols="2"> <colspec colwidth="16"> <colspec colwidth="6"> <tbody> <row> <entry> <paragraph> A simple table <entry> <row> <entry> <paragraph> with empty cells <entry> """], ["""\ ============== ======== A table with ============== ======== centered cells. ============== ======== """, """\ <document source="test data"> <table> <tgroup cols="2"> <colspec colwidth="14"> <colspec colwidth="8"> <thead> <row> <entry> <paragraph> A table <entry> <paragraph> with <tbody> <row> <entry> <paragraph> centered <entry> <paragraph> cells. """], ["""\ ============== ====== A simple table this text extends to the right cell 3 the bottom border below is too long ============== ======== """, """\ <document source="test data"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Malformed table. Bottom/header table border does not match top border. <literal_block xml:space="preserve"> ============== ====== A simple table this text extends to the right cell 3 the bottom border below is too long ============== ======== """], ["""\ ============ ================= A table with row separators. ------------ ----------------- Blank line before. ------------ ----------------- Blank lines before and after. ------------ ----------------- Blank line after. ============ ================= """, """\ <document source="test data"> <table> <tgroup cols="2"> <colspec colwidth="12"> <colspec colwidth="17"> <tbody> <row> <entry> <paragraph> A table with <entry> <paragraph> row separators. <row> <entry> <paragraph> Blank line <entry> <paragraph> before. <row> <entry> <paragraph> Blank lines <entry> <paragraph> before and after. <row> <entry> <paragraph> Blank line <entry> <paragraph> after. """], ["""\ ============ ==================== A table with many row separators. ------------ -------------------- ------------ -------------------- ------------ -------------------- ============ ==================== """, """\ <document source="test data"> <table> <tgroup cols="2"> <colspec colwidth="12"> <colspec colwidth="20"> <tbody> <row> <entry> <paragraph> A table with <entry> <paragraph> many row separators. <row> <entry> <entry> <row> <entry> <entry> <row> <entry> <entry> """], ["""\ == =========== =========== 1 Span columns 2 & 3 -- ------------------------ 2 Span columns 2 & 3 ------------------------ 3 == =========== =========== == =========== =========== 1 Span cols 1&2 but not 3 --------------- ----------- 2 Span cols 1&2 but not 3 --------------- 3 no spans here == =========== =========== == =========== =========== 1 Not a span Not a span ----------- ----------- 2 == =========== =========== """, """\ <document source="test data"> <system_message level="3" line="4" source="test data" type="ERROR"> <paragraph> Malformed table. Text in column margin in table line 4. <literal_block xml:space="preserve"> == =========== =========== 1 Span columns 2 & 3 -- ------------------------ 2 Span columns 2 & 3 ------------------------ 3 == =========== =========== <system_message level="3" line="13" source="test data" type="ERROR"> <paragraph> Malformed table. Column span incomplete in table line 5. <literal_block xml:space="preserve"> == =========== =========== 1 Span cols 1&2 but not 3 --------------- ----------- 2 Span cols 1&2 but not 3 --------------- 3 no spans here == =========== =========== <table> <tgroup cols="3"> <colspec colwidth="2"> <colspec colwidth="11"> <colspec colwidth="11"> <tbody> <row> <entry> <paragraph> 1 <entry> <system_message level="4" line="19" source="test data" type="SEVERE"> <paragraph> Unexpected section title. <literal_block xml:space="preserve"> Not a span ----------- <entry> <system_message level="4" line="19" source="test data" type="SEVERE"> <paragraph> Unexpected section title. <literal_block xml:space="preserve"> Not a span ----------- <row> <entry> <paragraph> 2 <entry> <entry> """], ["""\ ========= ===================================================================== Inclusion .. include:: %s Note The first row of this table may expand to accommodate long filesystem paths. ========= ===================================================================== """ % ('\n'.join([' %-65s' % include2[part * 65 : (part + 1) * 65] for part in range(len(include2) // 65 + 1)])), """\ <document source="test data"> <table> <tgroup cols="2"> <colspec colwidth="9"> <colspec colwidth="69"> <tbody> <row> <entry> <paragraph> Inclusion <entry> <paragraph> Here are some paragraphs that can appear at any level. <paragraph> This file (include2.txt) is used by <literal> test_include.py . <row> <entry> <paragraph> Note <entry> <paragraph> The first row of this table may expand to accommodate long filesystem paths. """], ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_transitions.py����������������������������������������0000755�0001750�0001750�00000012234�10434150472�025320� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_transitions.py 4564 2006-05-21 20:44:42Z wiemann $ # Author: David Goodger <goodger@python.org> # Copyright: This module has been placed in the public domain. """ Tests for transition markers. """ from __init__ import DocutilsTestSupport def suite(): s = DocutilsTestSupport.ParserTestSuite() s.generateTests(totest) return s totest = {} # See DocutilsTestSupport.ParserTestSuite.generateTests for a # description of the 'totest' data structure. totest['transitions'] = [ ["""\ Test transition markers. -------- Paragraph """, """\ <document source="test data"> <paragraph> Test transition markers. <transition> <paragraph> Paragraph """], ["""\ Section 1 ========= First text division of section 1. -------- Second text division of section 1. Section 2 --------- Paragraph 2 in section 2. """, """\ <document source="test data"> <section ids="section-1" names="section\ 1"> <title> Section 1 <paragraph> First text division of section 1. <transition> <paragraph> Second text division of section 1. <section ids="section-2" names="section\ 2"> <title> Section 2 <paragraph> Paragraph 2 in section 2. """], ["""\ -------- 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"> <transition> <paragraph> A section or document may not begin with a transition. <paragraph> The DTD specifies that two transitions may not be adjacent: <transition> <transition> <transition> <paragraph> The DTD also specifies that a section or document may not end with a transition. <transition> """], ["""\ Test unexpected transition markers. Block quote. -------- Paragraph. """, """\ <document source="test data"> <paragraph> Test unexpected transition markers. <block_quote> <paragraph> Block quote. <system_message level="4" line="5" source="test data" type="SEVERE"> <paragraph> Unexpected section title or transition. <literal_block xml:space="preserve"> -------- <paragraph> Paragraph. """], ["""\ Short transition marker. --- Paragraph """, """\ <document source="test data"> <paragraph> Short transition marker. <paragraph> --- <paragraph> Paragraph """], ["""\ 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 <transition> <paragraph> The next transition is legal: <transition> <section ids="section-2" names="section\ 2"> <title> Section 2 <transition> """], ["""\ A paragraph, two transitions, and a blank line. ---------- ---------- """, """\ <document source="test data"> <paragraph> A paragraph, two transitions, and a blank line. <transition> <transition> """], ["""\ A paragraph and two transitions. ---------- ---------- """, # the same: """\ <document source="test data"> <paragraph> A paragraph and two transitions. <transition> <transition> """], ["""\ ---------- Document beginning with a transition. """, """\ <document source="test data"> <transition> <paragraph> Document beginning with a transition. """], ["""\ 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. """], ["""\ Section 1 ========= ---------- ---------- ---------- Section 2 ========= Some text. """, """\ <document source="test data"> <section ids="section-1" names="section\ 1"> <title> Section 1 <transition> <transition> <transition> <section ids="section-2" names="section\ 2"> <title> Section 2 <paragraph> Some text. """], ["""\ ---------- ---------- ---------- """, """\ <document source="test data"> <transition> <transition> <transition> """], ["""\ A paragraph. ---------- """, """\ <document source="test data"> <paragraph> A paragraph. <transition> """], ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_option_lists.py���������������������������������������0000755�0001750�0001750�00000047623�11635160103�025477� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_option_lists.py 7128 2011-09-17 18:00:35Z grubert $ # Author: David Goodger <goodger@python.org> # 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['option_lists'] = [ ["""\ Short options: -a option -a -b file option -b -c name option -c """, """\ <document source="test data"> <paragraph> Short options: <option_list> <option_list_item> <option_group> <option> <option_string> -a <description> <paragraph> option -a <option_list_item> <option_group> <option> <option_string> -b <option_argument delimiter=" "> file <description> <paragraph> option -b <option_list_item> <option_group> <option> <option_string> -c <option_argument delimiter=" "> name <description> <paragraph> option -c """], ["""\ Long options: --aaaa option --aaaa --bbbb=file option --bbbb --cccc name option --cccc --d-e-f-g option --d-e-f-g --h_i_j_k option --h_i_j_k """, """\ <document source="test data"> <paragraph> Long options: <option_list> <option_list_item> <option_group> <option> <option_string> --aaaa <description> <paragraph> option --aaaa <option_list_item> <option_group> <option> <option_string> --bbbb <option_argument delimiter="="> file <description> <paragraph> option --bbbb <option_list_item> <option_group> <option> <option_string> --cccc <option_argument delimiter=" "> name <description> <paragraph> option --cccc <option_list_item> <option_group> <option> <option_string> --d-e-f-g <description> <paragraph> option --d-e-f-g <option_list_item> <option_group> <option> <option_string> --h_i_j_k <description> <paragraph> option --h_i_j_k """], ["""\ Old GNU-style options: +a option +a +b file option +b +c name option +c """, """\ <document source="test data"> <paragraph> Old GNU-style options: <option_list> <option_list_item> <option_group> <option> <option_string> +a <description> <paragraph> option +a <option_list_item> <option_group> <option> <option_string> +b <option_argument delimiter=" "> file <description> <paragraph> option +b <option_list_item> <option_group> <option> <option_string> +c <option_argument delimiter=" "> name <description> <paragraph> option +c """], ["""\ VMS/DOS-style options: /A option /A /B file option /B /CCC option /CCC /DDD string option /DDD /EEE=int option /EEE """, """\ <document source="test data"> <paragraph> VMS/DOS-style options: <option_list> <option_list_item> <option_group> <option> <option_string> /A <description> <paragraph> option /A <option_list_item> <option_group> <option> <option_string> /B <option_argument delimiter=" "> file <description> <paragraph> option /B <option_list_item> <option_group> <option> <option_string> /CCC <description> <paragraph> option /CCC <option_list_item> <option_group> <option> <option_string> /DDD <option_argument delimiter=" "> string <description> <paragraph> option /DDD <option_list_item> <option_group> <option> <option_string> /EEE <option_argument delimiter="="> int <description> <paragraph> option /EEE """], ["""\ Mixed short, long, and VMS/DOS options: -a option -a --bbbb=file option -bbbb /C option /C --dddd name option --dddd -e string option -e /F file option /F """, """\ <document source="test data"> <paragraph> Mixed short, long, and VMS/DOS options: <option_list> <option_list_item> <option_group> <option> <option_string> -a <description> <paragraph> option -a <option_list_item> <option_group> <option> <option_string> --bbbb <option_argument delimiter="="> file <description> <paragraph> option -bbbb <option_list_item> <option_group> <option> <option_string> /C <description> <paragraph> option /C <option_list_item> <option_group> <option> <option_string> --dddd <option_argument delimiter=" "> name <description> <paragraph> option --dddd <option_list_item> <option_group> <option> <option_string> -e <option_argument delimiter=" "> string <description> <paragraph> option -e <option_list_item> <option_group> <option> <option_string> /F <option_argument delimiter=" "> file <description> <paragraph> option /F """], ["""\ Aliased options: -a, --aaaa, /A option -a, --aaaa, /A -b file, --bbbb=file, /B file option -b, --bbbb, /B """, """\ <document source="test data"> <paragraph> Aliased options: <option_list> <option_list_item> <option_group> <option> <option_string> -a <option> <option_string> --aaaa <option> <option_string> /A <description> <paragraph> option -a, --aaaa, /A <option_list_item> <option_group> <option> <option_string> -b <option_argument delimiter=" "> file <option> <option_string> --bbbb <option_argument delimiter="="> file <option> <option_string> /B <option_argument delimiter=" "> file <description> <paragraph> option -b, --bbbb, /B """], ["""\ Multiple lines in descriptions, aligned: -a option -a, line 1 line 2 -b file option -b, line 1 line 2 """, """\ <document source="test data"> <paragraph> Multiple lines in descriptions, aligned: <option_list> <option_list_item> <option_group> <option> <option_string> -a <description> <paragraph> option -a, line 1 line 2 <option_list_item> <option_group> <option> <option_string> -b <option_argument delimiter=" "> file <description> <paragraph> option -b, line 1 line 2 """], ["""\ Multiple lines in descriptions, not aligned: -a option -a, line 1 line 2 -b file option -b, line 1 line 2 """, """\ <document source="test data"> <paragraph> Multiple lines in descriptions, not aligned: <option_list> <option_list_item> <option_group> <option> <option_string> -a <description> <paragraph> option -a, line 1 line 2 <option_list_item> <option_group> <option> <option_string> -b <option_argument delimiter=" "> file <description> <paragraph> option -b, line 1 line 2 """], ["""\ Descriptions begin on next line: -a option -a, line 1 line 2 -b file option -b, line 1 line 2 """, """\ <document source="test data"> <paragraph> Descriptions begin on next line: <option_list> <option_list_item> <option_group> <option> <option_string> -a <description> <paragraph> option -a, line 1 line 2 <option_list_item> <option_group> <option> <option_string> -b <option_argument delimiter=" "> file <description> <paragraph> option -b, line 1 line 2 """], ["""\ Multiple body elements in descriptions: -a option -a, para 1 para 2 -b file option -b, para 1 para 2 """, """\ <document source="test data"> <paragraph> Multiple body elements in descriptions: <option_list> <option_list_item> <option_group> <option> <option_string> -a <description> <paragraph> option -a, para 1 <paragraph> para 2 <option_list_item> <option_group> <option> <option_string> -b <option_argument delimiter=" "> file <description> <paragraph> option -b, para 1 <paragraph> para 2 """], ["""\ --option empty item above, no blank line """, """\ <document source="test data"> <paragraph> --option empty item above, no blank line """], ["""\ An option list using equals: --long1=arg1 Description 1 --long2=arg2 Description 2 An option list using spaces: --long1 arg1 Description 1 --long2 arg2 Description 2 An option list using mixed delimiters: --long1=arg1 Description 1 --long2 arg2 Description 2 An option list using mixed delimiters in one line: --long1=arg1, --long2 arg2 Description """, """\ <document source="test data"> <paragraph> An option list using equals: <option_list> <option_list_item> <option_group> <option> <option_string> --long1 <option_argument delimiter="="> arg1 <description> <paragraph> Description 1 <option_list_item> <option_group> <option> <option_string> --long2 <option_argument delimiter="="> arg2 <description> <paragraph> Description 2 <paragraph> An option list using spaces: <option_list> <option_list_item> <option_group> <option> <option_string> --long1 <option_argument delimiter=" "> arg1 <description> <paragraph> Description 1 <option_list_item> <option_group> <option> <option_string> --long2 <option_argument delimiter=" "> arg2 <description> <paragraph> Description 2 <paragraph> An option list using mixed delimiters: <option_list> <option_list_item> <option_group> <option> <option_string> --long1 <option_argument delimiter="="> arg1 <description> <paragraph> Description 1 <option_list_item> <option_group> <option> <option_string> --long2 <option_argument delimiter=" "> arg2 <description> <paragraph> Description 2 <paragraph> An option list using mixed delimiters in one line: <option_list> <option_list_item> <option_group> <option> <option_string> --long1 <option_argument delimiter="="> arg1 <option> <option_string> --long2 <option_argument delimiter=" "> arg2 <description> <paragraph> Description """], ["""\ Some edge cases: --option=arg arg too many arguments --option=arg,arg not supported (yet?) --option=arg=arg too many arguments --option arg arg too many arguments -a letter arg2 too many arguments /A letter arg2 too many arguments --option= argument missing --=argument option missing -- everything missing - this should be a bullet list item These next ones should be simple paragraphs: -1 --option --1 -1 and this one too. """, """\ <document source="test data"> <paragraph> Some edge cases: <paragraph> --option=arg arg too many arguments <paragraph> --option=arg,arg not supported (yet?) <paragraph> --option=arg=arg too many arguments <paragraph> --option arg arg too many arguments <paragraph> -a letter arg2 too many arguments <paragraph> /A letter arg2 too many arguments <paragraph> --option= argument missing <paragraph> --=argument option missing <paragraph> -- everything missing <bullet_list bullet="-"> <list_item> <paragraph> this should be a bullet list item <paragraph> These next ones should be simple paragraphs: <paragraph> -1 <paragraph> --option <paragraph> --1 <paragraph> -1 and this one too. """], ["""\ Complex optargs: --source-url=<URL> Use the supplied <URL> verbatim. --output-encoding=<name[:handler]>, -o<name[:handler]> Specify the text encoding for output. --af=<filter1[=parameter1:parameter2:...],filter2,...> Setup a chain of audio filters. Option argument containing delimiter ``=``. -f <[path]filename> Send output to file. -d <src dest> Use diff from <src> to <dest>. --bogus=<x y z> Bogus 3D coordinates. """, """\ <document source="test data"> <paragraph> Complex optargs: <option_list> <option_list_item> <option_group> <option> <option_string> --source-url <option_argument delimiter="="> <URL> <description> <paragraph> Use the supplied <URL> verbatim. <option_list_item> <option_group> <option> <option_string> --output-encoding <option_argument delimiter="="> <name[:handler]> <option> <option_string> -o <option_argument delimiter=""> <name[:handler]> <description> <paragraph> Specify the text encoding for output. <option_list_item> <option_group> <option> <option_string> --af <option_argument delimiter="="> <filter1[=parameter1:parameter2:...],filter2,...> <description> <paragraph> Setup a chain of audio filters. Option argument containing delimiter \n\ <literal> = . <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>. <option_list_item> <option_group> <option> <option_string> --bogus <option_argument delimiter="="> <x y z> <description> <paragraph> Bogus 3D coordinates. """], ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') �������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_SimpleTableParser.py����������������������������������0000755�0001750�0001750�00000006436�11703370411�026325� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # .. coding: utf-8 # $Id: test_SimpleTableParser.py 7313 2012-01-11 20:28:57Z milde $ # Author: David Goodger <goodger@python.org> # Copyright: This module has been placed in the public domain. """ Tests for states.py. """ from __init__ import DocutilsTestSupport def suite(): s = DocutilsTestSupport.SimpleTableParserTestSuite() s.generateTests(totest) return s totest = {} totest['simple_tables'] = [ ["""\ ============ ============ A table with two columns. ============ ============ """, ([12, 12], [], [[[0, 0, 1, ['A table with']], [0, 0, 1, ['two columns.']]]])], [u"""\ ============ =============== A tāble w̅ith comb̲ining chars ============ =============== """, ([12, 15], [], [[[0, 0, 1, [u'A ta\u0304ble w\u0305ith']], [0, 0, 1, [u'comb\u0332ining chars']]]])], ["""\ ============ ============ A table with two columns and two rows. ============ ============ """, ([12, 12], [], [[[0, 0, 1, ['A table with']], [0, 0, 1, ['two columns']]], [[0, 0, 2, ['and']], [0, 0, 2, ['two rows.']]]])], ["""\ ====================================== The last row might stick into the margin second row. ====================================== """, ([40], [], [[[0, 0, 1, ['The last row might stick into the margin']]], [[0, 0, 2, ['second row.']]]])], ["""\ ========== =========== A table with four rows, ----------------------- and two columns. First and last rows contain column spans. ======================= """, ([10, 11], [], [[[0, 1, 1, ['A table with four rows,']]], [[0, 0, 3, ['and two']], [0, 0, 3, ['columns.']]], [[0, 0, 4, ['First and']], [0, 0, 4, ['last rows']]], [[0, 1, 5, ['contain column spans.']]]])], ["""\ ======= ===== ====== A bad table cell 2 cell 3 cell 4 ============ ====== """, 'TableMarkupError: Text in column margin in table line 2.'], ["""\ ====== ===== ====== row one Another bad table ====== ===== ====== """, 'TableMarkupError: Text in column margin in table line 3.'], ["""\ =========== ================ A table with two header rows, ----------------------------- the first with a span. =========== ================ Two body rows, the second with a span. ============================= """, ([11, 16], [[[0, 1, 1, ['A table with two header rows,']]], [[0, 0, 3, ['the first']], [0, 0, 3, ['with a span.']]]], [[[0, 0, 5, ['Two body']], [0, 0, 5, ['rows,']]], [[0, 1, 6, ['the second with a span.']]]])], ["""\ ============ ============= A table with two head/body ============ ============= row separators. ============ ============= That's bad. ============ ============= """, 'TableMarkupError: Multiple head/body row separators ' '(table lines 3 and 5); only one allowed.'], ["""\ ============ ============ ============ ============ """, ([12, 12], [], [[[0, 0, 1, []], [0, 0, 1, []]]])], # ["""\ # ============== ========== # Table with row separators # ============== ========== # and blank # -------------- ---------- # entries # -------------- ---------- # in first # -------------- ---------- # columns. # ============== ========== # """, # ''] ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_doctest_blocks.py�������������������������������������0000755�0001750�0001750�00000002554�10434150472�025751� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_doctest_blocks.py 4564 2006-05-21 20:44:42Z wiemann $ # Author: David Goodger <goodger@python.org> # 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['doctest_blocks'] = [ ["""\ Paragraph. >>> print "Doctest block." Doctest block. Paragraph. """, """\ <document source="test data"> <paragraph> Paragraph. <doctest_block xml:space="preserve"> >>> print "Doctest block." Doctest block. <paragraph> Paragraph. """], ["""\ Paragraph. >>> print " Indented output." Indented output. """, """\ <document source="test data"> <paragraph> Paragraph. <doctest_block xml:space="preserve"> >>> print " Indented output." Indented output. """], ["""\ Paragraph. >>> print " Indented block & output." Indented block & output. """, """\ <document source="test data"> <paragraph> Paragraph. <block_quote> <doctest_block xml:space="preserve"> >>> print " Indented block & output." Indented block & output. """], ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') ����������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_literal_blocks.py�������������������������������������0000755�0001750�0001750�00000015421�10434150472�025735� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_literal_blocks.py 4564 2006-05-21 20:44:42Z wiemann $ # Author: David Goodger <goodger@python.org> # 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['indented_literal_blocks'] = [ ["""\ A paragraph:: A literal block. """, """\ <document source="test data"> <paragraph> A paragraph: <literal_block xml:space="preserve"> A literal block. """], ["""\ A paragraph with a space after the colons:: \n\ A literal block. """, """\ <document source="test data"> <paragraph> A paragraph with a space after the colons: <literal_block xml:space="preserve"> A literal block. """], ["""\ A paragraph:: A literal block. Another paragraph:: Another literal block. With two blank lines following. A final paragraph. """, """\ <document source="test data"> <paragraph> A paragraph: <literal_block xml:space="preserve"> A literal block. <paragraph> Another paragraph: <literal_block xml:space="preserve"> Another literal block. With two blank lines following. <paragraph> A final paragraph. """], ["""\ A paragraph on more than one line:: A literal block. """, """\ <document source="test data"> <paragraph> A paragraph on more than one line: <literal_block xml:space="preserve"> A literal block. """], ["""\ A paragraph on more than one line:: A literal block with no blank line above. """, """\ <document source="test data"> <paragraph> A paragraph on more than one line: <system_message level="3" line="4" source="test data" type="ERROR"> <paragraph> Unexpected indentation. <literal_block xml:space="preserve"> A literal block with no blank line above. """], ["""\ A paragraph:: A literal block. no blank line """, """\ <document source="test data"> <paragraph> A paragraph: <literal_block xml:space="preserve"> A literal block. <system_message level="2" line="4" source="test data" type="WARNING"> <paragraph> Literal block ends without a blank line; unexpected unindent. <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: :: A literal block. """, """\ <document source="test data"> <paragraph> A paragraph: <literal_block xml:space="preserve"> A literal block. """], ["""\ A paragraph: :: A literal block. """, """\ <document source="test data"> <paragraph> A paragraph: <literal_block xml:space="preserve"> A literal block. """], ["""\ A paragraph: :: A literal block. """, """\ <document source="test data"> <system_message level="1" line="2" source="test data" type="INFO"> <paragraph> Possible title underline, too short for the title. Treating it as ordinary text because it's so short. <paragraph> A paragraph: <literal_block xml:space="preserve"> A literal block. """], ["""\ A paragraph: :: A literal block. """, """\ <document source="test data"> <paragraph> A paragraph: <literal_block xml:space="preserve"> A literal block. """], ["""\ A paragraph:: Not a literal block. """, """\ <document source="test data"> <paragraph> A paragraph: <system_message level="2" line="3" source="test data" type="WARNING"> <paragraph> Literal block expected; none found. <paragraph> Not a literal block. """], ["""\ A paragraph:: A wonky literal block. Literal line 2. Literal line 3. """, """\ <document source="test data"> <paragraph> A paragraph: <literal_block xml:space="preserve"> A wonky literal block. Literal line 2. \n\ Literal line 3. """], ["""\ EOF, even though a literal block is indicated:: """, """\ <document source="test data"> <paragraph> EOF, even though a literal block is indicated: <system_message level="2" line="2" source="test data" type="WARNING"> <paragraph> Literal block expected; none found. """], ] totest['quoted_literal_blocks'] = [ ["""\ A paragraph:: > A literal block. """, """\ <document source="test data"> <paragraph> A paragraph: <literal_block xml:space="preserve"> > A literal block. """], ["""\ A paragraph:: > A literal block. """, """\ <document source="test data"> <paragraph> A paragraph: <literal_block xml:space="preserve"> > A literal block. """], ["""\ A paragraph:: > A literal block. > Line 2. """, """\ <document source="test data"> <paragraph> A paragraph: <literal_block xml:space="preserve"> > A literal block. > Line 2. """], ["""\ A paragraph:: > A literal block. Indented line. """, """\ <document source="test data"> <paragraph> A paragraph: <literal_block xml:space="preserve"> > A literal block. <system_message level="3" line="4" source="test data" type="ERROR"> <paragraph> Unexpected indentation. <block_quote> <paragraph> Indented line. """], ["""\ A paragraph:: > A literal block. Text. """, """\ <document source="test data"> <paragraph> A paragraph: <literal_block xml:space="preserve"> > A literal block. <system_message level="3" line="4" source="test data" type="ERROR"> <paragraph> Inconsistent literal block quoting. <paragraph> Text. """], ["""\ A paragraph:: > A literal block. $ Inconsistent line. """, """\ <document source="test data"> <paragraph> A paragraph: <literal_block xml:space="preserve"> > A literal block. <system_message level="3" line="4" source="test data" type="ERROR"> <paragraph> Inconsistent literal block quoting. <paragraph> $ Inconsistent line. """], ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_targets.py��������������������������������������������0000755�0001750�0001750�00000032705�11603172505�024421� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_targets.py 7062 2011-06-30 22:14:29Z milde $ # Author: David Goodger <goodger@python.org> # 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['targets'] = [ ["""\ .. _target: (Internal hyperlink target.) """, """\ <document source="test data"> <target ids="target" names="target"> <paragraph> (Internal hyperlink target.) """], ["""\ .. _optional space before colon : """, """\ <document source="test data"> <target ids="optional-space-before-colon" names="optional\ space\ before\ colon"> """], ["""\ External hyperlink targets: .. _one-liner: http://structuredtext.sourceforge.net .. _starts-on-this-line: http:// structuredtext. sourceforge.net .. _entirely-below: http://structuredtext. sourceforge.net .. _not-indirect: uri\\_ """, """\ <document source="test data"> <paragraph> External hyperlink targets: <target ids="one-liner" names="one-liner" refuri="http://structuredtext.sourceforge.net"> <target ids="starts-on-this-line" names="starts-on-this-line" refuri="http://structuredtext.sourceforge.net"> <target ids="entirely-below" names="entirely-below" refuri="http://structuredtext.sourceforge.net"> <target ids="not-indirect" names="not-indirect" refuri="uri_"> """], ["""\ Indirect hyperlink targets: .. _target1: reference_ .. _target2: `phrase-link reference`_ """, """\ <document source="test data"> <paragraph> Indirect hyperlink targets: <target ids="target1" names="target1" refname="reference"> <target ids="target2" names="target2" refname="phrase-link reference"> """], ["""\ .. _a long target name: .. _`a target name: including a colon (quoted)`: .. _a target name\: including a colon (escaped): """, """\ <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: No matching backquote. .. _`: No matching backquote either. """, """\ <document source="test data"> <comment xml:space="preserve"> _`target: No matching backquote. <system_message level="2" line="1" source="test data" type="WARNING"> <paragraph> malformed hyperlink target. <comment xml:space="preserve"> _`: No matching backquote either. <system_message level="2" line="2" source="test data" type="WARNING"> <paragraph> malformed hyperlink target. """], ["""\ .. _a very long target name, split across lines: .. _`and another, with backquotes`: """, """\ <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"> """], ["""\ External hyperlink: .. _target: http://www.python.org/ """, """\ <document source="test data"> <paragraph> External hyperlink: <target ids="target" names="target" refuri="http://www.python.org/"> """], ["""\ .. _email: jdoe@example.com .. _multi-line email: jdoe @example.com """, """\ <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"> """], ["""\ Malformed target: .. __malformed: no good Target beginning with an underscore: .. _`_target`: OK """, """\ <document source="test data"> <paragraph> Malformed target: <comment xml:space="preserve"> __malformed: no good <system_message level="2" line="3" source="test data" type="WARNING"> <paragraph> malformed hyperlink target. <paragraph> Target beginning with an underscore: <target ids="target" names="_target" refuri="OK"> """], ["""\ Duplicate external targets (different URIs): .. _target: first .. _target: second """, """\ <document source="test data"> <paragraph> Duplicate external targets (different URIs): <target dupnames="target" ids="target" refuri="first"> <system_message backrefs="id1" level="2" line="5" source="test data" type="WARNING"> <paragraph> Duplicate explicit target name: "target". <target dupnames="target" ids="id1" refuri="second"> """], ["""\ Duplicate external targets (same URIs): .. _target: first .. _target: first """, """\ <document source="test data"> <paragraph> Duplicate external targets (same URIs): <target ids="target" names="target" refuri="first"> <system_message backrefs="id1" level="1" line="5" source="test data" type="INFO"> <paragraph> Duplicate explicit target name: "target". <target dupnames="target" ids="id1" refuri="first"> """], ["""\ Duplicate implicit targets. Title ===== Paragraph. Title ===== Paragraph. """, """\ <document source="test data"> <paragraph> Duplicate implicit targets. <section dupnames="title" ids="title"> <title> Title <paragraph> Paragraph. <section dupnames="title" ids="id1"> <title> Title <system_message backrefs="id1" level="1" line="9" source="test data" type="INFO"> <paragraph> Duplicate implicit target name: "title". <paragraph> Paragraph. """], ["""\ Duplicate implicit/explicit targets. Title ===== .. _title: Paragraph. """, """\ <document source="test data"> <paragraph> Duplicate implicit/explicit targets. <section dupnames="title" ids="title"> <title> Title <system_message backrefs="id1" level="1" line="6" source="test data" type="INFO"> <paragraph> Duplicate implicit target name: "title". <target ids="id1" names="title"> <paragraph> Paragraph. """], ["""\ Duplicate implicit/directive targets. Title ===== .. target-notes:: :name: title """, """\ <document source="test data"> <paragraph> Duplicate implicit/directive targets. <section dupnames="title" ids="title"> <title> Title <pending ids="id1" names="title"> <system_message backrefs="id1" level="1" line="4" source="test data" type="INFO"> <paragraph> Duplicate implicit target name: "title". .. internal attributes: .transform: docutils.transforms.references.TargetNotes .details: """], ["""\ Duplicate explicit targets. .. _title: First. .. _title: Second. .. _title: Third. """, """\ <document source="test data"> <paragraph> Duplicate explicit targets. <target dupnames="title" ids="title"> <paragraph> First. <system_message backrefs="id1" level="2" line="7" source="test data" type="WARNING"> <paragraph> Duplicate explicit target name: "title". <target dupnames="title" ids="id1"> <paragraph> Second. <system_message backrefs="id2" level="2" line="11" source="test data" type="WARNING"> <paragraph> Duplicate explicit target name: "title". <target dupnames="title" ids="id2"> <paragraph> Third. """], ["""\ Duplicate explicit/directive targets. .. _title: First. .. rubric:: this is a title too :name: title """, """\ <document source="test data"> <paragraph> Duplicate explicit/directive targets. <target dupnames="title" ids="title"> <paragraph> First. <rubric dupnames="title" ids="id1"> this is a title too <system_message backrefs="id1" level="2" line="9" source="test data" type="WARNING"> <paragraph> Duplicate explicit target name: "title". """], ["""\ Duplicate targets: Target ====== Implicit section header target. .. [TARGET] Citation target. .. [#target] Autonumber-labeled footnote target. .. _target: Explicit internal target. .. _target: Explicit_external_target .. rubric:: directive with target :name: Target """, """\ <document source="test data"> <paragraph> Duplicate targets: <section dupnames="target" ids="target"> <title> Target <paragraph> Implicit section header target. <citation dupnames="target" ids="id1"> <label> TARGET <system_message backrefs="id1" level="1" line="8" source="test data" type="INFO"> <paragraph> Duplicate implicit target name: "target". <paragraph> Citation target. <footnote auto="1" dupnames="target" ids="id2"> <system_message backrefs="id2" level="2" line="10" source="test data" type="WARNING"> <paragraph> Duplicate explicit target name: "target". <paragraph> Autonumber-labeled footnote target. <system_message backrefs="id3" level="2" line="12" source="test data" type="WARNING"> <paragraph> Duplicate explicit target name: "target". <target dupnames="target" ids="id3"> <paragraph> Explicit internal target. <system_message backrefs="id4" level="2" line="16" source="test data" type="WARNING"> <paragraph> Duplicate explicit target name: "target". <target dupnames="target" ids="id4" refuri="Explicit_external_target"> <rubric dupnames="target" ids="id5"> directive with target <system_message backrefs="id5" level="2" line="4" source="test data" type="WARNING"> <paragraph> Duplicate explicit target name: "target". """], ["""\ .. _unescaped colon at end:: no good .. _:: no good either .. _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. <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"> """], ] totest['anonymous_targets'] = [ ["""\ Anonymous external hyperlink target: .. __: http://w3c.org/ """, """\ <document source="test data"> <paragraph> Anonymous external hyperlink target: <target anonymous="1" ids="id1" refuri="http://w3c.org/"> """], ["""\ Anonymous external hyperlink target: __ http://w3c.org/ """, """\ <document source="test data"> <paragraph> Anonymous external hyperlink target: <target anonymous="1" ids="id1" refuri="http://w3c.org/"> """], ["""\ Anonymous indirect hyperlink target: .. __: reference_ """, """\ <document source="test data"> <paragraph> Anonymous indirect hyperlink target: <target anonymous="1" ids="id1" refname="reference"> """], ["""\ 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" ids="id1" refuri="uri_"> <target anonymous="1" ids="id2" refuri="thisURIendswithanunderscore_"> """], ["""\ Anonymous indirect hyperlink targets: __ reference_ __ `a very long reference`_ """, """\ <document source="test data"> <paragraph> Anonymous indirect hyperlink targets: <target anonymous="1" ids="id1" refname="reference"> <target anonymous="1" ids="id2" refname="a very long reference"> """], ["""\ Mixed anonymous & named indirect hyperlink targets: __ reference_ .. __: reference_ __ reference_ .. _target1: reference_ no blank line .. _target2: reference_ __ reference_ .. __: reference_ __ reference_ no blank line """, """\ <document source="test data"> <paragraph> Mixed anonymous & named indirect hyperlink targets: <target anonymous="1" ids="id1" refname="reference"> <target anonymous="1" ids="id2" refname="reference"> <target anonymous="1" ids="id3" refname="reference"> <target ids="target1" names="target1" refname="reference"> <system_message level="2" line="7" source="test data" type="WARNING"> <paragraph> Explicit markup ends without a blank line; unexpected unindent. <paragraph> no blank line <target ids="target2" names="target2" refname="reference"> <target anonymous="1" ids="id4" refname="reference"> <target anonymous="1" ids="id5" refname="reference"> <target anonymous="1" ids="id6" refname="reference"> <system_message level="2" line="13" source="test data" type="WARNING"> <paragraph> Explicit markup ends without a blank line; unexpected unindent. <paragraph> no blank line """], ["""\ .. _ """, """\ <document source="test data"> <comment xml:space="preserve"> _ """], ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') �����������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_interpreted_fr.py�������������������������������������0000644�0001750�0001750�00000002444�11555377264�025775� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_interpreted.py 6424 2010-09-18 10:43:52Z smerten $ # Author: David Goodger <goodger@python.org> # Copyright: This module has been placed in the public domain. """ Tests for interpreted text in docutils/parsers/rst/states.py. Test not default/fallback language french. """ from __init__ import DocutilsTestSupport def suite(): s = DocutilsTestSupport.ParserTestSuite(suite_settings={'language_code':'fr'}) s.generateTests(totest) return s totest = {} totest['basics'] = [ ["""\ Simple explicit roles and english fallbacks: :acronym:`acronym`, :exp:`superscript`, :ind:`subscript`, :titre:`title reference`. """, """\ <document source="test data"> <paragraph> Simple explicit roles and english fallbacks: <acronym> acronym , <superscript> superscript , <subscript> subscript , <title_reference> title reference . <system_message level="1" line="1" source="test data" type="INFO"> <paragraph> No role entry for "acronym" in module "docutils.parsers.rst.languages.fr". Using English fallback for role "acronym". """], ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_section_headers.py������������������������������������0000755�0001750�0001750�00000047704�11466520626�026124� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- #! /usr/bin/env python # $Id: test_section_headers.py 6476 2010-11-10 13:43:50Z milde $ # Author: David Goodger <goodger@python.org> # 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['section_headers'] = [ ["""\ Title ===== Paragraph. """, """\ <document source="test data"> <section ids="title" names="title"> <title> Title <paragraph> Paragraph. """], ["""\ Title ===== Paragraph (no blank line). """, """\ <document source="test data"> <section ids="title" names="title"> <title> Title <paragraph> Paragraph (no blank line). """], ["""\ Paragraph. Title ===== Paragraph. """, """\ <document source="test data"> <paragraph> Paragraph. <section ids="title" names="title"> <title> Title <paragraph> Paragraph. """], ["""\ Test unexpected section titles. Title ===== Paragraph. ----- Title ----- Paragraph. """, """\ <document source="test data"> <paragraph> Test unexpected section titles. <block_quote> <system_message level="4" line="4" source="test data" type="SEVERE"> <paragraph> Unexpected section title. <literal_block xml:space="preserve"> Title ===== <paragraph> Paragraph. <system_message level="4" line="7" source="test data" type="SEVERE"> <paragraph> Unexpected section title or transition. <literal_block xml:space="preserve"> ----- <system_message level="4" line="9" source="test data" type="SEVERE"> <paragraph> Unexpected section title. <literal_block xml:space="preserve"> Title ----- <paragraph> Paragraph. """], ["""\ Title ==== Test short underline. """, """\ <document source="test data"> <section ids="title" names="title"> <title> Title <system_message level="2" line="2" source="test data" type="WARNING"> <paragraph> Title underline too short. <literal_block xml:space="preserve"> Title ==== <paragraph> Test short underline. """], [u"""\ à with combining varia ====================== Do not count combining chars in title column width. """, u"""\ <document source="test data"> <section ids="a-with-combining-varia" names="a\u0300\ with\ combining\ varia"> <title> à with combining varia <paragraph> Do not count combining chars in title column width. """], ["""\ ===== Title ===== Test overline title. """, """\ <document source="test data"> <section ids="title" names="title"> <title> Title <paragraph> Test overline title. """], ["""\ ======= Title ======= Test overline title with inset. """, """\ <document source="test data"> <section ids="title" names="title"> <title> Title <paragraph> Test overline title with inset. """], ["""\ ======================== Test Missing Underline """, """\ <document source="test data"> <system_message level="4" line="1" source="test data" type="SEVERE"> <paragraph> Incomplete section title. <literal_block xml:space="preserve"> ======================== Test Missing Underline """], ["""\ ======================== Test Missing Underline """, """\ <document source="test data"> <system_message level="4" line="1" source="test data" type="SEVERE"> <paragraph> Missing matching underline for section title overline. <literal_block xml:space="preserve"> ======================== Test Missing Underline """], ["""\ ======= Title Test missing underline, with paragraph. """, """\ <document source="test data"> <system_message level="4" line="1" source="test data" type="SEVERE"> <paragraph> Missing matching underline for section title overline. <literal_block xml:space="preserve"> ======= Title <paragraph> Test missing underline, with paragraph. """], ["""\ ======= Long Title ======= Test long title and space normalization. """, """\ <document source="test data"> <section ids="long-title" names="long\ title"> <title> Long Title <system_message level="2" line="1" source="test data" type="WARNING"> <paragraph> Title overline too short. <literal_block xml:space="preserve"> ======= Long Title ======= <paragraph> Test long title and space normalization. """], ["""\ ======= Title ------- Paragraph. """, """\ <document source="test data"> <system_message level="4" line="1" source="test data" type="SEVERE"> <paragraph> Title overline & underline mismatch. <literal_block xml:space="preserve"> ======= Title ------- <paragraph> Paragraph. """], ["""\ ======================== ======================== Test missing titles; blank line in-between. ======================== ======================== """, """\ <document source="test data"> <transition> <transition> <paragraph> Test missing titles; blank line in-between. <transition> <transition> """], ["""\ ======================== ======================== Test missing titles; nothing in-between. ======================== ======================== """, """\ <document source="test data"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Invalid section title or transition marker. <literal_block xml:space="preserve"> ======================== ======================== <paragraph> Test missing titles; nothing in-between. <system_message level="3" line="6" source="test data" type="ERROR"> <paragraph> Invalid section title or transition marker. <literal_block xml:space="preserve"> ======================== ======================== """], ["""\ .. Test return to existing, highest-level section (Title 3). Title 1 ======= Paragraph 1. Title 2 ------- Paragraph 2. Title 3 ======= Paragraph 3. Title 4 ------- 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"> <title> Title 1 <paragraph> Paragraph 1. <section ids="title-2" names="title\ 2"> <title> Title 2 <paragraph> Paragraph 2. <section ids="title-3" names="title\ 3"> <title> Title 3 <paragraph> Paragraph 3. <section ids="title-4" names="title\ 4"> <title> Title 4 <paragraph> Paragraph 4. """], ["""\ Test return to existing, highest-level section (Title 3, with overlines). ======= Title 1 ======= Paragraph 1. ------- Title 2 ------- Paragraph 2. ======= Title 3 ======= Paragraph 3. ------- Title 4 ------- 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"> <title> Title 1 <paragraph> Paragraph 1. <section ids="title-2" names="title\ 2"> <title> Title 2 <paragraph> Paragraph 2. <section ids="title-3" names="title\ 3"> <title> Title 3 <paragraph> Paragraph 3. <section ids="title-4" names="title\ 4"> <title> Title 4 <paragraph> Paragraph 4. """], ["""\ Test return to existing, higher-level section (Title 4). Title 1 ======= Paragraph 1. Title 2 ------- Paragraph 2. Title 3 ``````` Paragraph 3. Title 4 ------- Paragraph 4. """, """\ <document source="test data"> <paragraph> Test return to existing, higher-level section (Title 4). <section ids="title-1" names="title\ 1"> <title> Title 1 <paragraph> Paragraph 1. <section ids="title-2" names="title\ 2"> <title> Title 2 <paragraph> Paragraph 2. <section ids="title-3" names="title\ 3"> <title> Title 3 <paragraph> Paragraph 3. <section ids="title-4" names="title\ 4"> <title> Title 4 <paragraph> Paragraph 4. """], ["""\ Test bad subsection order (Title 4). Title 1 ======= Paragraph 1. Title 2 ------- Paragraph 2. Title 3 ======= Paragraph 3. Title 4 ``````` Paragraph 4. """, """\ <document source="test data"> <paragraph> Test bad subsection order (Title 4). <section ids="title-1" names="title\ 1"> <title> Title 1 <paragraph> Paragraph 1. <section ids="title-2" names="title\ 2"> <title> Title 2 <paragraph> Paragraph 2. <section ids="title-3" names="title\ 3"> <title> Title 3 <paragraph> Paragraph 3. <system_message level="4" line="15" source="test data" type="SEVERE"> <paragraph> Title level inconsistent: <literal_block xml:space="preserve"> Title 4 ``````` <paragraph> Paragraph 4. """], ["""\ Test bad subsection order (Title 4, with overlines). ======= Title 1 ======= Paragraph 1. ------- Title 2 ------- Paragraph 2. ======= Title 3 ======= Paragraph 3. ``````` Title 4 ``````` Paragraph 4. """, """\ <document source="test data"> <paragraph> Test bad subsection order (Title 4, with overlines). <section ids="title-1" names="title\ 1"> <title> Title 1 <paragraph> Paragraph 1. <section ids="title-2" names="title\ 2"> <title> Title 2 <paragraph> Paragraph 2. <section ids="title-3" names="title\ 3"> <title> Title 3 <paragraph> Paragraph 3. <system_message level="4" line="19" source="test data" type="SEVERE"> <paragraph> Title level inconsistent: <literal_block xml:space="preserve"> ``````` Title 4 ``````` <paragraph> Paragraph 4. """], ["""\ Title containing *inline* ``markup`` ==================================== Paragraph. """, """\ <document source="test data"> <section ids="title-containing-inline-markup" names="title\ containing\ inline\ markup"> <title> Title containing \n\ <emphasis> inline \n\ <literal> markup <paragraph> Paragraph. """], ["""\ 1. Numbered Title ================= Paragraph. """, """\ <document source="test data"> <section ids="numbered-title" names="1.\ numbered\ title"> <title> 1. Numbered Title <paragraph> Paragraph. """], ["""\ 1. Item 1. 2. Item 2. 3. Numbered Title ================= Paragraph. """, """\ <document source="test data"> <enumerated_list enumtype="arabic" prefix="" suffix="."> <list_item> <paragraph> Item 1. <list_item> <paragraph> Item 2. <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"> <title> 3. Numbered Title <paragraph> Paragraph. """], ["""\ ABC === Short title. """, """\ <document source="test data"> <section ids="abc" names="abc"> <title> ABC <paragraph> Short title. """], ["""\ ABC == Underline too short. """, """\ <document source="test data"> <system_message level="1" line="2" source="test data" type="INFO"> <paragraph> Possible title underline, too short for the title. Treating it as ordinary text because it's so short. <paragraph> ABC == <paragraph> Underline too short. """], ["""\ == ABC == Over & underline too short. """, """\ <document source="test data"> <system_message level="1" line="1" source="test data" type="INFO"> <paragraph> Possible incomplete section title. Treating the overline as ordinary text because it's so short. <paragraph> == ABC == <paragraph> Over & underline too short. """], ["""\ == ABC Overline too short, no underline. """, """\ <document source="test data"> <system_message level="1" line="1" source="test data" type="INFO"> <paragraph> Possible incomplete section title. Treating the overline as ordinary text because it's so short. <paragraph> == ABC <paragraph> Overline too short, no underline. """], ["""\ == ABC """, """\ <document source="test data"> <system_message level="1" line="1" source="test data" type="INFO"> <paragraph> Possible incomplete section title. Treating the overline as ordinary text because it's so short. <paragraph> == ABC """], ["""\ == Not a title: a definition list item. """, """\ <document source="test data"> <system_message level="1" line="1" source="test data" type="INFO"> <paragraph> Possible incomplete section title. Treating the overline as ordinary text because it's so short. <definition_list> <definition_list_item> <term> == <definition> <paragraph> Not a title: a definition list item. """], ["""\ == Not a title: a definition list item. -- Another definition list item. It's in a different list, but that's an acceptable limitation given that this will probably never happen in real life. The next line will trigger a warning: == """, """\ <document source="test data"> <system_message level="1" line="1" source="test data" type="INFO"> <paragraph> Possible incomplete section title. Treating the overline as ordinary text because it's so short. <definition_list> <definition_list_item> <term> == <definition> <paragraph> Not a title: a definition list item. <system_message level="2" line="3" source="test data" type="WARNING"> <paragraph> Definition list ends without a blank line; unexpected unindent. <system_message level="1" line="3" source="test data" type="INFO"> <paragraph> Possible incomplete section title. Treating the overline as ordinary text because it's so short. <definition_list> <definition_list_item> <term> -- <definition> <paragraph> Another definition list item. It's in a different list, but that's an acceptable limitation given that this will probably never happen in real life. <paragraph> The next line will trigger a warning: <system_message level="2" line="9" source="test data" type="WARNING"> <paragraph> Definition list ends without a blank line; unexpected unindent. <paragraph> == """], ["""\ Paragraph == ABC == Over & underline too short. """, """\ <document source="test data"> <paragraph> Paragraph <block_quote> <system_message level="1" line="3" source="test data" type="INFO"> <paragraph> Unexpected possible title overline or transition. Treating it as ordinary text because it's so short. <paragraph> == ABC == <paragraph> Over & underline too short. """], ["""\ Paragraph ABC == Underline too short. """, """\ <document source="test data"> <paragraph> Paragraph <block_quote> <paragraph> ABC == <paragraph> Underline too short. """], ["""\ ... ... ... --- ... ... ... """, """\ <document source="test data"> <system_message level="1" line="1" source="test data" type="INFO"> <paragraph> Possible incomplete section title. Treating the overline as ordinary text because it's so short. <section dupnames="..." ids="id1"> <title> ... <system_message level="1" line="4" source="test data" type="INFO"> <paragraph> Possible incomplete section title. Treating the overline as ordinary text because it's so short. <section dupnames="..." ids="id2"> <title> ... <system_message backrefs="id2" level="1" line="5" source="test data" type="INFO"> <paragraph> Duplicate implicit target name: "...". <system_message level="1" line="7" source="test data" type="INFO"> <paragraph> Possible incomplete section title. Treating the overline as ordinary text because it's so short. <system_message level="1" line="7" source="test data" type="INFO"> <paragraph> Possible incomplete section title. Treating the overline as ordinary text because it's so short. <section dupnames="..." ids="id3"> <title> ... <system_message backrefs="id3" level="1" line="8" source="test data" type="INFO"> <paragraph> Duplicate implicit target name: "...". <paragraph> ... """], ["""\ .. Hi .. ... Yo ... Ho """, """\ <document source="test data"> <comment xml:space="preserve"> <system_message level="2" line="2" source="test data" type="WARNING"> <paragraph> Explicit markup ends without a blank line; unexpected unindent. <section ids="hi" names="hi"> <title> Hi <section ids="yo" names="yo"> <title> Yo <paragraph> Ho """], ["""\ Empty Section ============= """, """\ <document source="test data"> <section ids="empty-section" names="empty\ section"> <title> Empty Section """], ["""\ === One === The bubble-up parser strategy conflicts with short titles (<= 3 char-long over- & underlines). === Two === The parser currently contains a work-around kludge. Without it, the parser ends up in an infinite loop. """, """\ <document source="test data"> <section ids="one" names="one"> <title> One <paragraph> The bubble-up parser strategy conflicts with short titles (<= 3 char-long over- & underlines). <section ids="two" names="two"> <title> Two <paragraph> The parser currently contains a work-around kludge. Without it, the parser ends up in an infinite loop. """], ["""\ """, """\ <document source="test data"> """], ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') ������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_functions.py������������������������������������������0000755�0001750�0001750�00000002021�11712713765�024756� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_functions.py 7337 2012-02-03 08:16:53Z milde $ # Author: David Goodger <goodger@python.org> # Copyright: This module has been placed in the public domain. """ Tests for states.py. """ import unittest from __init__ import DocutilsTestSupport states = DocutilsTestSupport.states class FuctionTests(unittest.TestCase): escaped = r'escapes: \*one, \\*two, \\\*three' nulled = 'escapes: \x00*one, \x00\\*two, \x00\\\x00*three' unescaped = r'escapes: *one, \*two, \*three' def test_escape2null(self): nulled = states.escape2null(self.escaped) self.assertEqual(nulled, self.nulled) nulled = states.escape2null(self.escaped + '\\') self.assertEqual(nulled, self.nulled + '\x00') def test_unescape(self): unescaped = states.unescape(self.nulled) self.assertEqual(unescaped, self.unescaped) restored = states.unescape(self.nulled, 1) self.assertEqual(restored, self.escaped) if __name__ == '__main__': unittest.main() ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_block_quotes.py���������������������������������������0000755�0001750�0001750�00000015011�10434150472�025431� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_block_quotes.py 4564 2006-05-21 20:44:42Z wiemann $ # Author: David Goodger <goodger@python.org> # 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['block_quotes'] = [ ["""\ Line 1. Line 2. Indented. """, """\ <document source="test data"> <paragraph> Line 1. Line 2. <block_quote> <paragraph> Indented. """], ["""\ Line 1. Line 2. Indented 1. Indented 2. """, """\ <document source="test data"> <paragraph> Line 1. Line 2. <block_quote> <paragraph> Indented 1. <block_quote> <paragraph> Indented 2. """], ["""\ Line 1. Line 2. Unexpectedly indented. """, """\ <document source="test data"> <paragraph> Line 1. Line 2. <system_message level="3" line="3" source="test data" type="ERROR"> <paragraph> Unexpected indentation. <block_quote> <paragraph> Unexpectedly indented. """], ["""\ Line 1. Line 2. Indented. no blank line """, """\ <document source="test data"> <paragraph> Line 1. Line 2. <block_quote> <paragraph> Indented. <system_message level="2" line="5" source="test data" type="WARNING"> <paragraph> Block quote ends without a blank line; unexpected unindent. <paragraph> 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. """, """\ <document source="test data"> <paragraph> Here is a paragraph. <block_quote> <block_quote> <paragraph> Indent 8 spaces. <paragraph> Indent 4 spaces. <paragraph> Is this correct? Should it generate a warning? Yes, it is correct, no warning necessary. """], ["""\ Paragraph. Block quote. -- Attribution Paragraph. Block quote. --Attribution """, """\ <document source="test data"> <paragraph> Paragraph. <block_quote> <paragraph> Block quote. <attribution> Attribution <paragraph> Paragraph. <block_quote> <paragraph> Block quote. <attribution> Attribution """], [u"""\ Alternative: true em-dash. Block quote. \u2014 Attribution Alternative: three hyphens. Block quote. --- Attribution """, """\ <document source="test data"> <paragraph> Alternative: true em-dash. <block_quote> <paragraph> Block quote. <attribution> Attribution <paragraph> Alternative: three hyphens. <block_quote> <paragraph> Block quote. <attribution> Attribution """], ["""\ Paragraph. Block quote. -- Attribution line one and line two Paragraph. Block quote. -- Attribution line one and line two Paragraph. """, """\ <document source="test data"> <paragraph> Paragraph. <block_quote> <paragraph> Block quote. <attribution> Attribution line one and line two <paragraph> Paragraph. <block_quote> <paragraph> Block quote. <attribution> Attribution line one and line two <paragraph> Paragraph. """], ["""\ Paragraph. Block quote 1. -- Attribution 1 Block quote 2. --Attribution 2 """, """\ <document source="test data"> <paragraph> Paragraph. <block_quote> <paragraph> Block quote 1. <attribution> Attribution 1 <block_quote> <paragraph> Block quote 2. <attribution> Attribution 2 """], ["""\ Paragraph. Block quote 1. -- Attribution 1 Block quote 2. """, """\ <document source="test data"> <paragraph> Paragraph. <block_quote> <paragraph> Block quote 1. <attribution> Attribution 1 <block_quote> <paragraph> Block quote 2. """], ["""\ Unindented paragraph. Block quote 1. -- Attribution 1 Block quote 2. .. Block quote 3. """, """\ <document source="test data"> <paragraph> Unindented paragraph. <block_quote> <paragraph> Block quote 1. <attribution> Attribution 1 <block_quote> <paragraph> Block quote 2. <comment xml:space="preserve"> <block_quote> <paragraph> Block quote 3. """], ["""\ Paragraph. -- Not an attribution Paragraph. Block quote. \-- Not an attribution Paragraph. Block quote. -- Not an attribution line one and line two and line three """, """\ <document source="test data"> <paragraph> Paragraph. <block_quote> <paragraph> -- Not an attribution <paragraph> Paragraph. <block_quote> <paragraph> Block quote. <paragraph> -- Not an attribution <paragraph> Paragraph. <block_quote> <paragraph> Block quote. <definition_list> <definition_list_item> <term> -- Not an attribution line one <definition> <definition_list> <definition_list_item> <term> and line two <definition> <paragraph> and line three """], ["""\ Paragraph. -- Not a valid attribution Block quote 1. --Attribution 1 --Invalid attribution Block quote 2. --Attribution 2 """, """\ <document source="test data"> <paragraph> Paragraph. <block_quote> <paragraph> -- Not a valid attribution <paragraph> Block quote 1. <attribution> Attribution 1 <block_quote> <paragraph> --Invalid attribution <paragraph> Block quote 2. <attribution> Attribution 2 """], ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_field_lists.py����������������������������������������0000755�0001750�0001750�00000032205�10434150472�025244� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_field_lists.py 4564 2006-05-21 20:44:42Z wiemann $ # Author: David Goodger <goodger@python.org> # 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['field_lists'] = [ ["""\ One-liners: :Author: Me :Version: 1 :Date: 2001-08-11 :Parameter i: integer """, """\ <document source="test data"> <paragraph> One-liners: <field_list> <field> <field_name> Author <field_body> <paragraph> Me <field> <field_name> Version <field_body> <paragraph> 1 <field> <field_name> Date <field_body> <paragraph> 2001-08-11 <field> <field_name> Parameter i <field_body> <paragraph> integer """], ["""\ One-liners, no blank lines: :Author: Me :Version: 1 :Date: 2001-08-11 :Parameter i: integer """, """\ <document source="test data"> <paragraph> One-liners, no blank lines: <field_list> <field> <field_name> Author <field_body> <paragraph> Me <field> <field_name> Version <field_body> <paragraph> 1 <field> <field_name> Date <field_body> <paragraph> 2001-08-11 <field> <field_name> Parameter i <field_body> <paragraph> integer """], ["""\ :field: empty item above, no blank line """, """\ <document source="test data"> <field_list> <field> <field_name> field <field_body> <system_message level="2" line="2" source="test data" type="WARNING"> <paragraph> Field list ends without a blank line; unexpected unindent. <paragraph> empty item above, no blank line """], ["""\ Field bodies starting on the next line: :Author: Me :Version: 1 :Date: 2001-08-11 :Parameter i: integer """, """\ <document source="test data"> <paragraph> Field bodies starting on the next line: <field_list> <field> <field_name> Author <field_body> <paragraph> Me <field> <field_name> Version <field_body> <paragraph> 1 <field> <field_name> Date <field_body> <paragraph> 2001-08-11 <field> <field_name> Parameter i <field_body> <paragraph> integer """], ["""\ One-paragraph, multi-liners: :Authors: Me, Myself, and I :Version: 1 or so :Date: 2001-08-11 (Saturday) :Parameter i: counter (integer) """, """\ <document source="test data"> <paragraph> One-paragraph, multi-liners: <field_list> <field> <field_name> Authors <field_body> <paragraph> Me, Myself, and I <field> <field_name> Version <field_body> <paragraph> 1 or so <field> <field_name> Date <field_body> <paragraph> 2001-08-11 (Saturday) <field> <field_name> Parameter i <field_body> <paragraph> counter (integer) """], ["""\ One-paragraph, multi-liners, not lined up: :Authors: Me, Myself, and I :Version: 1 or so :Date: 2001-08-11 (Saturday) :Parameter i: counter (integer) """, """\ <document source="test data"> <paragraph> One-paragraph, multi-liners, not lined up: <field_list> <field> <field_name> Authors <field_body> <paragraph> Me, Myself, and I <field> <field_name> Version <field_body> <paragraph> 1 or so <field> <field_name> Date <field_body> <paragraph> 2001-08-11 (Saturday) <field> <field_name> Parameter i <field_body> <paragraph> counter (integer) """], ["""\ Multiple body elements: :Authors: - Me - Myself - I :Abstract: This is a field list item's body, containing multiple elements. Here's a literal block:: def f(x): return x**2 + x Even nested field lists are possible: :Date: 2001-08-11 :Day: Saturday :Time: 15:07 """, """\ <document source="test data"> <paragraph> Multiple body elements: <field_list> <field> <field_name> Authors <field_body> <bullet_list bullet="-"> <list_item> <paragraph> Me <list_item> <paragraph> Myself <list_item> <paragraph> I <field> <field_name> Abstract <field_body> <paragraph> This is a field list item's body, containing multiple elements. <paragraph> Here's a literal block: <literal_block xml:space="preserve"> def f(x): return x**2 + x <paragraph> Even nested field lists are possible: <field_list> <field> <field_name> Date <field_body> <paragraph> 2001-08-11 <field> <field_name> Day <field_body> <paragraph> Saturday <field> <field_name> Time <field_body> <paragraph> 15:07 """], ["""\ Nested field lists on one line: :field1: :field2: :field3: body :field4: :field5: :field6: body :field7: body :field8: body :field9: body line 1 body line 2 """, """\ <document source="test data"> <paragraph> Nested field lists on one line: <field_list> <field> <field_name> field1 <field_body> <field_list> <field> <field_name> field2 <field_body> <field_list> <field> <field_name> field3 <field_body> <paragraph> body <field> <field_name> field4 <field_body> <field_list> <field> <field_name> field5 <field_body> <field_list> <field> <field_name> field6 <field_body> <paragraph> body <field> <field_name> field7 <field_body> <paragraph> body <field> <field_name> field8 <field_body> <paragraph> body <field> <field_name> field9 <field_body> <paragraph> body line 1 body line 2 """], ["""\ :Parameter i j k: multiple arguments """, """\ <document source="test data"> <field_list> <field> <field_name> Parameter i j k <field_body> <paragraph> multiple arguments """], ["""\ :Field *name* `with` **inline** ``markup``: inline markup in field name is parsed. """, """\ <document source="test data"> <field_list> <field> <field_name> Field \n\ <emphasis> name \n\ <title_reference> with \n\ <strong> inline \n\ <literal> markup <field_body> <paragraph> inline markup in field name is parsed. """], ["""\ :Field name with *bad inline markup: should generate warning. """, """\ <document source="test data"> <field_list> <field> <field_name> Field name with \n\ <problematic ids="id2" refid="id1"> * bad inline markup <field_body> <system_message backrefs="id2" ids="id1" level="2" line="1" source="test data" type="WARNING"> <paragraph> Inline emphasis start-string without end-string. <paragraph> should generate warning. """], [r"""Some edge cases: :Empty: :Author: Me No blank line before this paragraph. : Field: marker must not begin with whitespace. :Field : marker must not end with whitespace. 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"> <paragraph> Some edge cases: <field_list> <field> <field_name> Empty <field_body> <field> <field_name> Author <field_body> <paragraph> Me <system_message level="2" line="5" source="test data" type="WARNING"> <paragraph> Field list ends without a blank line; unexpected unindent. <paragraph> No blank line before this paragraph. <paragraph> : Field: marker must not begin with whitespace. <paragraph> :Field : marker must not end with whitespace. <paragraph> 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. """], ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_line_blocks.py����������������������������������������0000755�0001750�0001750�00000017073�12123055732�025235� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_line_blocks.py 7638 2013-03-22 13:25:46Z milde $ # Author: David Goodger <goodger@python.org> # 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> """], ["""\ 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 ids="id2" refid="id1"> | This is not <problematic ids="id4" refid="id3"> | a line block <system_message backrefs="id2" ids="id1" level="2" line="1" source="test data" type="WARNING"> <paragraph> Inline substitution_reference start-string without end-string. <system_message backrefs="id4" ids="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 ids="id6" refid="id5"> | incomplete line block. <system_message backrefs="id6" ids="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 ids="id2" refid="id1"> * may not <line> wrap* over several lines. <system_message backrefs="id2" ids="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. """], ["""\ System messages can appear in place of lines: | `uff <test1>`_ | `uff <test2>`_ """, """\ <document source="test data"> <paragraph> System messages can appear in place of lines: <line_block> <line> <reference name="uff" refuri="test1"> uff <target dupnames="uff" ids="uff" refuri="test1"> <system_message backrefs="id1" level="2" line="3" source="test data" type="WARNING"> <paragraph> Duplicate explicit target name: "uff". <line> <reference name="uff" refuri="test2"> uff <target dupnames="uff" ids="id1" refuri="test2"> """], ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/�������������������������������������������0000755�0001750�0001750�00000000000�12173162603�024526� 5����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/include13.txt������������������������������0000644�0001750�0001750�00000000246�10575333504�027064� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������In include13.txt (but before header) From: me To: you In include13.txt (between header and signature) ------- -- mork of ork In include13.txt (after signature) ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/test_title.py������������������������������0000755�0001750�0001750�00000001160�10627410160�027255� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_title.py 5174 2007-05-31 00:01:52Z wiemann $ # Author: Lea Wiemann <LeWiemann@gmail.com> # Copyright: This module has been placed in the public domain. """ Tests for the 'title' directive. """ from __init__ import DocutilsTestSupport def suite(): s = DocutilsTestSupport.ParserTestSuite() s.generateTests(totest) return s totest = {} totest['title'] = [ ["""\ .. title:: This is the document title. """, """\ <document source="test data" title="This is the document title."> """], ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/test_code.py�������������������������������0000644�0001750�0001750�00000012751�12024637300�027053� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_code.py 7514 2012-09-14 14:27:12Z milde $ # Author: Guenter Milde # Copyright: This module has been placed in the public domain. """ Test the 'code' directive in parsers/rst/directives/body.py. """ from __init__ import DocutilsTestSupport from docutils.utils.code_analyzer import with_pygments def suite(): s = DocutilsTestSupport.ParserTestSuite() if not with_pygments: del(totest['code-parsing']) s.generateTests(totest) return s totest = {} totest['code'] = [ ["""\ .. code:: This is a code block. """, """\ <document source="test data"> <literal_block classes="code" xml:space="preserve"> This is a code block. """], ["""\ .. code:: :class: testclass :name: without argument This is a code block with generic options. """, """\ <document source="test data"> <literal_block classes="code testclass" ids="without-argument" names="without\ argument" xml:space="preserve"> This is a code block with generic options. """], ["""\ .. code:: text :class: testclass This is a code block with text. """, """\ <document source="test data"> <literal_block classes="code text testclass" xml:space="preserve"> This is a code block with text. """], ["""\ .. code:: :number-lines: This is a code block with text. """, """\ <document source="test data"> <literal_block classes="code" xml:space="preserve"> <inline classes="ln"> 1 \n\ This is a code block with text. """], ["""\ .. code:: :number-lines: 30 This is a code block with text. """, """\ <document source="test data"> <literal_block classes="code" xml:space="preserve"> <inline classes="ln"> 30 \n\ This is a code block with text. """], ["""\ .. code:: """, """\ <document source="test data"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Content block expected for the "code" directive; none found. <literal_block xml:space="preserve"> .. code:: """], ] totest['code-parsing'] = [ ["""\ .. code:: python :class: testclass print 'hello world' # to stdout """, """\ <document source="test data"> <literal_block classes="code python testclass" xml:space="preserve"> \n\ <inline classes="keyword"> print \n\ <inline classes="literal string"> 'hello world' \n\ <inline classes="comment"> # to stdout """], ["""\ .. code:: python :class: testclass :name: my_function :number-lines: 7 def my_function(): '''Test the lexer. ''' # and now for something completely different print 8/2 """, """\ <document source="test data"> <literal_block classes="code python testclass" ids="my-function" names="my_function" xml:space="preserve"> <inline classes="ln"> 7 \n\ <inline classes="keyword"> def \n\ <inline classes="name function"> my_function <inline classes="punctuation"> (): \n\ <inline classes="ln"> 8 \n\ \n\ <inline classes="literal string doc"> \'\'\'Test the lexer. <inline classes="ln"> 9 \n\ <inline classes="literal string doc"> \'\'\' \n\ <inline classes="ln"> 10 \n\ \n\ <inline classes="ln"> 11 \n\ \n\ <inline classes="comment"> # and now for something completely different \n\ <inline classes="ln"> 12 \n\ \n\ <inline classes="keyword"> print \n\ <inline classes="literal number integer"> 8 <inline classes="operator"> / <inline classes="literal number integer"> 2 """], ["""\ .. code:: latex :class: testclass hello \emph{world} % emphasize """, """\ <document source="test data"> <literal_block classes="code latex testclass" xml:space="preserve"> hello \n\ <inline classes="keyword"> \\emph <inline classes="name builtin"> { world <inline classes="name builtin"> } \n\ <inline classes="comment"> % emphasize"""], ["""\ .. code:: rst :number-lines: This is a code block with text. """, """\ <document source="test data"> <literal_block classes="code rst" xml:space="preserve"> <inline classes="ln"> 1 \n\ This is a code block with text. """], ["""\ .. code:: s-lang % abc.sl autoload("abc_mode", "abc"); """, """\ <document source="test data"> <system_message level="2" line="1" source="test data" type="WARNING"> <paragraph> Cannot analyze code. No Pygments lexer found for "s-lang". <literal_block xml:space="preserve"> .. code:: s-lang \n\ % abc.sl autoload("abc_mode", "abc"); """], ["""\ Place the language name in a class argument to avoid the no-lexer warning: .. code:: :class: s-lang % abc.sl autoload("abc_mode", "abc"); """, """\ <document source="test data"> <paragraph> Place the language name in a class argument to avoid the no-lexer warning: <literal_block classes="code s-lang" xml:space="preserve"> % abc.sl autoload("abc_mode", "abc"); """], ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') �����������������������docutils-0.11/test/test_parsers/test_rst/test_directives/test_code_long.py��������������������������0000644�0001750�0001750�00000004556�11674114075�030107� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_code_long.py 7267 2011-12-20 14:14:21Z milde $ # Author: Guenter Milde # Copyright: This module has been placed in the public domain. """ Test the 'code' directive in body.py with syntax_highlight = 'long'. """ from __init__ import DocutilsTestSupport from docutils.utils.code_analyzer import with_pygments def suite(): s = DocutilsTestSupport.ParserTestSuite(suite_settings={'syntax_highlight':'long'}) if with_pygments: s.generateTests(totest) return s totest = {} totest['code-parsing-long'] = [ ["""\ .. code:: python :number-lines: 7 def my_function(): '''Test the lexer. ''' # and now for something completely different print 8/2 """, """\ <document source="test data"> <literal_block classes="code python" xml:space="preserve"> <inline classes="ln"> 7 \n\ <inline classes="keyword"> def \n\ <inline classes="name function"> my_function <inline classes="punctuation"> (): \n\ <inline classes="ln"> 8 \n\ \n\ <inline classes="literal string doc"> \'\'\'Test the lexer. <inline classes="ln"> 9 \n\ <inline classes="literal string doc"> \'\'\' \n\ <inline classes="ln"> 10 \n\ \n\ <inline classes="ln"> 11 \n\ \n\ <inline classes="comment"> # and now for something completely different \n\ <inline classes="ln"> 12 \n\ \n\ <inline classes="keyword"> print \n\ <inline classes="literal number integer"> 8 <inline classes="operator"> / <inline classes="literal number integer"> 2 """], ["""\ .. code:: latex hello \emph{world} % emphasize """, """\ <document source="test data"> <literal_block classes="code latex" xml:space="preserve"> hello \n\ <inline classes="keyword"> \\emph <inline classes="name builtin"> { world <inline classes="name builtin"> } \n\ <inline classes="comment"> % emphasize"""], ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') ��������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/test_contents.py���������������������������0000755�0001750�0001750�00000014142�11164743725�030012� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_contents.py 5889 2009-04-01 20:00:21Z gbrandl $ # Author: David Goodger <goodger@python.org> # Copyright: This module has been placed in the public domain. """ Tests for parts.py contents directive. """ from __init__ import DocutilsTestSupport def suite(): s = DocutilsTestSupport.ParserTestSuite() s.generateTests(totest) return s totest = {} totest['contents'] = [ ["""\ .. contents:: """, """\ <document source="test data"> <topic classes="contents" ids="contents" names="contents"> <title> Contents <pending> .. internal attributes: .transform: docutils.transforms.parts.Contents .details: """], ["""\ .. contents:: Table of Contents """, """\ <document source="test data"> <topic classes="contents" ids="table-of-contents" names="table\ of\ contents"> <title> Table of Contents <pending> .. internal attributes: .transform: docutils.transforms.parts.Contents .details: """], ["""\ .. contents:: Table of Contents """, """\ <document source="test data"> <topic classes="contents" ids="table-of-contents" names="table\ of\ contents"> <title> Table of Contents <pending> .. internal attributes: .transform: docutils.transforms.parts.Contents .details: """], ["""\ .. contents:: Table of Contents """, """\ <document source="test data"> <topic classes="contents" ids="table-of-contents" names="table\ of\ contents"> <title> Table of Contents <pending> .. internal attributes: .transform: docutils.transforms.parts.Contents .details: """], ["""\ .. contents:: *Table* of ``Contents`` """, """\ <document source="test data"> <topic classes="contents" ids="table-of-contents" names="table\ of\ contents"> <title> <emphasis> Table of <literal> Contents <pending> .. internal attributes: .transform: docutils.transforms.parts.Contents .details: """], ["""\ .. contents:: :depth: 2 :local: """, """\ <document source="test data"> <topic classes="contents local" ids="contents" names="contents"> <pending> .. internal attributes: .transform: docutils.transforms.parts.Contents .details: depth: 2 local: None """], ["""\ .. contents:: :local: arg """, """\ <document source="test data"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Error in "contents" directive: invalid option value: (option: "local"; value: 'arg') no argument is allowed; "arg" supplied. <literal_block xml:space="preserve"> .. contents:: :local: arg """], ["""\ .. contents:: Table of Contents :local: :depth: 2 :backlinks: none """, """\ <document source="test data"> <topic classes="contents local" ids="table-of-contents" names="table\ of\ contents"> <title> Table of Contents <pending> .. internal attributes: .transform: docutils.transforms.parts.Contents .details: backlinks: None depth: 2 local: None """], ["""\ .. contents:: :depth: two """, """\ <document source="test data"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Error in "contents" directive: invalid option value: (option: "depth"; value: 'two') %s. <literal_block xml:space="preserve"> .. contents:: :depth: two """ % DocutilsTestSupport.exception_data(int, "two")[1][0]], ["""\ .. contents:: :width: 2 """, """\ <document source="test data"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Error in "contents" directive: unknown option: "width". <literal_block xml:space="preserve"> .. contents:: :width: 2 """], ["""\ .. contents:: :backlinks: no way! """, """\ <document source="test data"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Error in "contents" directive: invalid option value: (option: "backlinks"; value: 'no way!') "no way!" unknown; choose from "top", "entry", or "none". <literal_block xml:space="preserve"> .. contents:: :backlinks: no way! """], ["""\ .. contents:: :backlinks: """, """\ <document source="test data"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Error in "contents" directive: invalid option value: (option: "backlinks"; value: None) must supply an argument; choose from "top", "entry", or "none". <literal_block xml:space="preserve"> .. 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: """], ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/test_meta.py�������������������������������0000755�0001750�0001750�00000013670�10455266150�027102� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_meta.py 4667 2006-07-12 21:40:56Z wiemann $ # Author: David Goodger <goodger@python.org> # Copyright: This module has been placed in the public domain. """ Tests for html meta directives. """ from __init__ import DocutilsTestSupport def suite(): s = DocutilsTestSupport.ParserTestSuite() s.generateTests(totest) return s totest = {} totest['meta'] = [ ["""\ .. meta:: :description: The reStructuredText plaintext markup language :keywords: plaintext,markup language """, """\ <document source="test data"> <pending> .. internal attributes: .transform: docutils.transforms.components.Filter .details: component: 'writer' format: 'html' nodes: <meta content="The reStructuredText plaintext markup language" name="description"> <pending> .. internal attributes: .transform: docutils.transforms.components.Filter .details: component: 'writer' format: 'html' nodes: <meta content="plaintext,markup language" name="keywords"> """], ["""\ .. meta:: :description lang=en: An amusing story :description lang=fr: Un histoire amusant """, """\ <document source="test data"> <pending> .. internal attributes: .transform: docutils.transforms.components.Filter .details: component: 'writer' format: 'html' nodes: <meta content="An amusing story" lang="en" name="description"> <pending> .. internal attributes: .transform: docutils.transforms.components.Filter .details: component: 'writer' format: 'html' nodes: <meta content="Un histoire amusant" lang="fr" name="description"> """], ["""\ .. meta:: :http-equiv=Content-Type: text/html; charset=ISO-8859-1 """, """\ <document source="test data"> <pending> .. internal attributes: .transform: docutils.transforms.components.Filter .details: component: 'writer' format: 'html' nodes: <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type"> """], ["""\ .. meta:: :name: content over multiple lines """, """\ <document source="test data"> <pending> .. internal attributes: .transform: docutils.transforms.components.Filter .details: component: 'writer' format: 'html' nodes: <meta content="content over multiple lines" name="name"> """], ["""\ Paragraph .. meta:: :name: content """, """\ <document source="test data"> <paragraph> Paragraph <pending> .. internal attributes: .transform: docutils.transforms.components.Filter .details: component: 'writer' format: 'html' nodes: <meta content="content" name="name"> """], ["""\ .. meta:: """, """\ <document source="test data"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Content block expected for the "meta" directive; none found. <literal_block xml:space="preserve"> .. meta:: """], ["""\ .. meta:: :empty: """, """\ <document source="test data"> <system_message level="1" line="2" source="test data" type="INFO"> <paragraph> No content for meta tag "empty". <literal_block xml:space="preserve"> :empty: """], ["""\ .. meta:: not a field list """, """\ <document source="test data"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Invalid meta directive. <literal_block xml:space="preserve"> .. meta:: not a field list """], ["""\ .. meta:: :name: content not a field :name: content """, """\ <document source="test data"> <pending> .. internal attributes: .transform: docutils.transforms.components.Filter .details: component: 'writer' format: 'html' nodes: <meta content="content" name="name"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Invalid meta directive. <literal_block xml:space="preserve"> .. meta:: :name: content not a field :name: content """], ["""\ .. meta:: :name: content :name: content not a field """, """\ <document source="test data"> <pending> .. internal attributes: .transform: docutils.transforms.components.Filter .details: component: 'writer' format: 'html' nodes: <meta content="content" name="name"> <pending> .. internal attributes: .transform: docutils.transforms.components.Filter .details: component: 'writer' format: 'html' nodes: <meta content="content" name="name"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Invalid meta directive. <literal_block xml:space="preserve"> .. meta:: :name: content :name: content not a field """], ["""\ .. meta:: :name notattval: content """, """\ <document source="test data"> <system_message level="3" line="2" source="test data" type="ERROR"> <paragraph> Error parsing meta tag attribute "notattval": missing "=". <literal_block xml:space="preserve"> :name notattval: content """], ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') ������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/test_images.py�����������������������������0000755�0001750�0001750�00000026115�12115117661�027414� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_images.py 7621 2013-03-04 13:20:49Z milde $ # Author: David Goodger <goodger@python.org> # Copyright: This module has been placed in the public domain. """ Tests for images.py image directives. """ from __init__ import DocutilsTestSupport from docutils.nodes import reprunicode def suite(): s = DocutilsTestSupport.ParserTestSuite() s.generateTests(totest) return s totest = {} totest['images'] = [ ["""\ .. image:: picture.png """, """\ <document source="test data"> <image uri="picture.png"> """], ["""\ .. image:: """, """\ <document source="test data"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Error in "image" directive: 1 argument(s) required, 0 supplied. <literal_block xml:space="preserve"> .. image:: """], ["""\ .. image:: one two three.png """, """\ <document source="test data"> <image uri="onetwothree.png"> """], ["""\ .. image:: picture.png :height: 100 :width: 200 :scale: 50 """, """\ <document source="test data"> <image height="100" scale="50" uri="picture.png" width="200"> """], ["""\ .. image:: picture.png :height: 100 :width: 200 :scale: 50 """, """\ <document source="test data"> <image height="100" scale="50" uri="picture.png" width="200"> """], ["""\ .. image:: :height: 100 :width: 200 :scale: 50 """, """\ <document source="test data"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Error in "image" directive: 1 argument(s) required, 0 supplied. <literal_block xml:space="preserve"> .. image:: :height: 100 :width: 200 :scale: 50 """], # If there are multiple lines in the link block, they are stripped of # leading and trailing whitespace and joined together: ["""\ .. image:: a/very/long/path/to/ picture.png :height: 100 :width: 200 :scale: 50 """, """\ <document source="test data"> <image height="100" scale="50" uri="a/very/long/path/to/picture.png" width="200"> """], # The following two misspellings were detected in Docutils <= 0.8 # (the option block was started by any line starting with a colon # which led to problems with named roles in other directives): ["""\ .. image:: picture.png :scale 50 """, """\ <document source="test data"> <image uri="picture.png:scale50"> """], ["""\ .. image:: picture.png :: 50 """, """\ <document source="test data"> <image uri="picture.png::50"> """], # a missing leading colon went undetected also in Docutils <= 0.8: ["""\ .. image:: picture.png scale: 50 """, """\ <document source="test data"> <image uri="picture.pngscale:50"> """], ["""\ .. 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 :width: 20mc """, """\ <document source="test data"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Error in "image" directive: invalid option value: (option: "width"; value: \'20mc\') 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: 20mc """], ["""\ .. image:: picture.png :height: 100 :width: 200 :scale: 50 :alt: Alternate text for the picture """, """\ <document source="test data"> <image alt="Alternate text for the picture" height="100" scale="50" uri="picture.png" width="200"> """], ["""\ .. image:: picture.png :scale: -50 """, """\ <document source="test data"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Error in "image" directive: invalid option value: (option: "scale"; value: '-50') negative value; must be positive or zero. <literal_block xml:space="preserve"> .. image:: picture.png :scale: -50 """], ["""\ .. image:: picture.png :scale: """, """\ <document source="test data"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Error in "image" directive: invalid option value: (option: "scale"; value: None) %s. <literal_block xml:space="preserve"> .. image:: picture.png :scale: """ % DocutilsTestSupport.exception_data(int, None)[1][0]], ["""\ .. image:: picture.png :height: 100 :scale 50 """, """\ <document source="test data"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Error in "image" directive: invalid option block. <literal_block xml:space="preserve"> .. image:: picture.png :height: 100 :scale 50 """], ["""\ .. image:: picture.png :sale: 50 """, """\ <document source="test data"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Error in "image" directive: unknown option: "sale". <literal_block xml:space="preserve"> .. image:: picture.png :sale: 50 """], ["""\ .. image:: picture.png :scale is: 50 """, """\ <document source="test data"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Error in "image" directive: invalid option data: extension option field name may not contain multiple words. <literal_block xml:space="preserve"> .. image:: picture.png :scale is: 50 """], ["""\ .. image:: picture.png :scale: fifty """, """\ <document source="test data"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Error in "image" directive: invalid option value: (option: "scale"; value: 'fifty') %s. <literal_block xml:space="preserve"> .. image:: picture.png :scale: fifty """ % DocutilsTestSupport.exception_data(int, "fifty")[1][0]], ["""\ .. image:: picture.png :scale: 50 :scale: 50 """, """\ <document source="test data"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Error in "image" directive: invalid option data: duplicate option "scale". <literal_block xml:space="preserve"> .. image:: picture.png :scale: 50 :scale: 50 """], ["""\ .. image:: picture.png :alt: (Empty "alt" option.) """, """\ <document source="test data"> <image alt="" uri="picture.png"> <paragraph> (Empty "alt" option.) """], ["""\ .. image:: picture.png :target: bigpicture.png :name: fig:pix """, """\ <document source="test data"> <reference refuri="bigpicture.png"> <image ids="fig-pix" names="fig:pix" uri="picture.png"> """], ["""\ .. image:: picture.png :target: indirect_ """, """\ <document source="test data"> <reference name="indirect" refname="indirect"> <image uri="picture.png"> """], ["""\ .. image:: picture.png :target: a/multi/ line/uri .. image:: picture.png :target: `a multi line internal reference`_ """, """\ <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"> <image uri="picture.png"> """], ["""\ .. image:: picture.png :target: """, """\ <document source="test data"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Error in "image" directive: invalid option value: (option: "target"; value: None) argument required but none supplied. <literal_block xml:space="preserve"> .. 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 """], [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: %s) "\xe4" unknown; choose from "top", "middle", "bottom", "left", "center", or "right". <literal_block xml:space="preserve"> .. image:: picture.png :align: \xe4 """ % repr(reprunicode(u'\xe4'))], [""" .. image:: test.png :target: Uppercase_ .. _Uppercase: http://docutils.sourceforge.net/ """, """\ <document source="test data"> <reference name="Uppercase" refname="uppercase"> <image uri="test.png"> <target ids="uppercase" names="uppercase" refuri="http://docutils.sourceforge.net/"> """], ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/test_code_none.py��������������������������0000644�0001750�0001750�00000003230�11660414555�030074� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_code_none.py 7221 2011-11-15 07:49:01Z milde $ # Author: Guenter Milde # Copyright: This module has been placed in the public domain. """ Test the 'code' directive in body.py with syntax_highlight = 'none'. """ from __init__ import DocutilsTestSupport def suite(): s = DocutilsTestSupport.ParserTestSuite(suite_settings={'syntax_highlight':'none'}) s.generateTests(totest) return s totest = {} totest['code-parsing-none'] = [ ["""\ .. code:: This is a code block. """, """\ <document source="test data"> <literal_block classes="code" xml:space="preserve"> This is a code block. """], ["""\ .. code:: python :number-lines: 7 def my_function(): '''Test the lexer. ''' # and now for something completely different print 8/2 """, """\ <document source="test data"> <literal_block classes="code python" xml:space="preserve"> <inline classes="ln"> 7 \n\ def my_function(): <inline classes="ln"> 8 \n\ \'\'\'Test the lexer. <inline classes="ln"> 9 \n\ \'\'\' <inline classes="ln"> 10 \n\ \n\ <inline classes="ln"> 11 \n\ # and now for something completely different <inline classes="ln"> 12 \n\ print 8/2 """], ["""\ .. code:: latex hello \emph{world} % emphasize """, """\ <document source="test data"> <literal_block classes="code latex" xml:space="preserve"> hello \\emph{world} % emphasize """], ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/test_rubrics.py����������������������������0000755�0001750�0001750�00000003346�11603172505�027620� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_rubrics.py 7062 2011-06-30 22:14:29Z milde $ # Author: David Goodger <goodger@python.org> # Copyright: This module has been placed in the public domain. """ Tests for the "rubric" directive. """ from __init__ import DocutilsTestSupport def suite(): s = DocutilsTestSupport.ParserTestSuite() s.generateTests(totest) return s totest = {} totest['rubrics'] = [ ["""\ .. rubric:: This is a rubric """, """\ <document source="test data"> <rubric> This is a rubric """], ["""\ .. rubric:: .. rubric:: A rubric has no content Invalid content """, """\ <document source="test data"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Error in "rubric" directive: 1 argument(s) required, 0 supplied. <literal_block xml:space="preserve"> .. rubric:: <system_message level="3" line="2" source="test data" type="ERROR"> <paragraph> Error in "rubric" directive: no content permitted. <literal_block xml:space="preserve"> .. rubric:: A rubric has no content \n\ Invalid content """], ["""\ .. rubric:: A rubric followed by a block quote .. Block quote """, """\ <document source="test data"> <rubric> A rubric followed by a block quote <comment xml:space="preserve"> <block_quote> <paragraph> Block quote """], ["""\ .. rubric:: A Rubric :class: foo bar :name: Foo Rubric """, """\ <document source="test data"> <rubric classes="foo bar" ids="foo-rubric" names="foo\ rubric"> A Rubric """], ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/include12.txt������������������������������0000644�0001750�0001750�00000000251�10575333504�027057� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������In include12.txt (but before "start here") .. start here In include12.txt (after "start here", before "stop here") .. stop here In include12.txt (after "stop here") �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/__init__.py��������������������������������0000644�0001750�0001750�00000000462�10254646615�026651� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������import os import os.path import sys sys.path.insert(0, os.path.abspath(os.path.dirname(__file__))) 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) ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/include_literal.txt������������������������0000644�0001750�0001750�00000000146�11271134532�030425� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Literal included this should **not** be *marked* `up`. <- leading raw tab. Newlines are normalized. ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/test_unknown.py����������������������������0000755�0001750�0001750�00000004530�10434150472�027642� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_unknown.py 4564 2006-05-21 20:44:42Z wiemann $ # Author: David Goodger <goodger@python.org> # Copyright: This module has been placed in the public domain. """ Tests for unknown directives. """ from __init__ import DocutilsTestSupport def suite(): s = DocutilsTestSupport.ParserTestSuite() s.generateTests(totest) return s totest = {} totest['unknown'] = [ ["""\ .. reStructuredText-unknown-directive:: .. reStructuredText-unknown-directive:: argument .. reStructuredText-unknown-directive:: block """, """\ <document source="test data"> <system_message level="1" line="1" source="test data" type="INFO"> <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> Unknown directive type "reStructuredText-unknown-directive". <literal_block xml:space="preserve"> .. reStructuredText-unknown-directive:: <system_message level="1" line="3" source="test data" type="INFO"> <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> Unknown directive type "reStructuredText-unknown-directive". <literal_block xml:space="preserve"> .. reStructuredText-unknown-directive:: argument <system_message level="1" line="5" source="test data" type="INFO"> <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> Unknown directive type "reStructuredText-unknown-directive". <literal_block xml:space="preserve"> .. reStructuredText-unknown-directive:: block """], ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') ������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/include10.txt������������������������������0000644�0001750�0001750�00000001670�11365262441�027062� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������.. |bad| unicode:: 0x11111111 hi ----- indent error hi ----- .. include:: <nonexistent> .. note:: .. admonition:: without title .. epigraph:: .. highlights:: .. pull-quote:: .. date:: not a definition list: as a term may only be one line long. .. admonition:: without title and content following a blank line section underline too short ----- ============== ====== A simple table cell 2 ============== ====== cell 3 cell 4 ============== ====== No blank line after table. .. |empty| unicode:: .. topic:: .. rubric:: .. rubric:: A rubric has no content .. _`target: No matching backquote. .. __malformed: no good A literal block:: with no blank line above. :: > A literal block. $ with inconsistent quoting. :unknown-role:`role` and *unbalanced `inline **markup :PEP:`-1` .. unknown:: directive (info still reported with wrong line) ============== ====== A simple table with no bottom border ������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/test_sectnum.py����������������������������0000755�0001750�0001750�00000002065�10627410160�027617� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_sectnum.py 5174 2007-05-31 00:01:52Z wiemann $ # Author: Lea Wiemann <LeWiemann@gmail.com> # Copyright: This module has been placed in the public domain. """ Tests for the 'sectnum' directive. """ from __init__ import DocutilsTestSupport def suite(): s = DocutilsTestSupport.ParserTestSuite() s.generateTests(totest) return s totest = {} totest['sectnum'] = [ ["""\ .. sectnum:: """, """\ <document source="test data"> <pending> .. internal attributes: .transform: docutils.transforms.parts.SectNum .details: """], ["""\ .. sectnum:: :depth: 23 :start: 42 :prefix: A Prefix :suffix: A Suffix """, """\ <document source="test data"> <pending> .. internal attributes: .transform: docutils.transforms.parts.SectNum .details: depth: 23 prefix: 'A Prefix' start: 42 suffix: 'A Suffix' """], ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/includes/����������������������������������0000755�0001750�0001750�00000000000�12173162603�026334� 5����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/includes/sibling/��������������������������0000755�0001750�0001750�00000000000�12173162603�027763� 5����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/includes/sibling/include7.txt��������������0000644�0001750�0001750�00000000041�07607426742�032246� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������In includes/sibling/include7.txt �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/includes/more/�����������������������������0000755�0001750�0001750�00000000000�12173162603�027276� 5����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/includes/more/include6.txt�����������������0000644�0001750�0001750�00000000104�07607427457�031564� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������In includes/more/include6.txt .. include:: ../sibling/include7.txt ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/includes/include5.txt����������������������0000644�0001750�0001750�00000000071�07566321757�030624� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������In includes/include5.txt .. include:: more/include6.txt �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/includes/include4.txt����������������������0000644�0001750�0001750�00000000064�07566321757�030625� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������In includes/include4.txt .. include:: include5.txt ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/test_class.py������������������������������0000755�0001750�0001750�00000002072�10627410160�027244� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_class.py 5174 2007-05-31 00:01:52Z wiemann $ # Author: Lea Wiemann <LeWiemann@gmail.com> # Copyright: This module has been placed in the public domain. """ Tests for the 'class' directive. """ from __init__ import DocutilsTestSupport def suite(): s = DocutilsTestSupport.ParserTestSuite() s.generateTests(totest) return s totest = {} totest['class'] = [ ["""\ .. class:: class1 class2 """, """\ <document source="test data"> <pending> .. internal attributes: .transform: docutils.transforms.misc.ClassAttribute .details: class: ['class1', 'class2'] directive: 'class' """], ["""\ .. class:: class1 class2 The classes are applied to this paragraph. And this one. """, """\ <document source="test data"> <paragraph classes="class1 class2"> The classes are applied to this paragraph. <paragraph classes="class1 class2"> And this one. """], ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/test_tables.py�����������������������������0000755�0001750�0001750�00000074054�12145363551�027432� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_tables.py 7664 2013-05-17 08:16:41Z milde $ # Author: David Goodger <goodger@python.org> # Copyright: This module has been placed in the public domain. """ Tests for tables.py directives. """ from __init__ import DocutilsTestSupport import os, sys import csv from docutils.parsers.rst.directives import tables def suite(): s = DocutilsTestSupport.ParserTestSuite() s.generateTests(totest) return s mydir = 'test_parsers/test_rst/test_directives/' 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') unichr_exception = DocutilsTestSupport.exception_data( unichr, int("9999999999999", 16))[0] if isinstance(unichr_exception, OverflowError): unichr_exception_string = 'code too large (%s)' % unichr_exception else: unichr_exception_string = str(unichr_exception) # some error messages changed in Python 3.3: csv_eod_error_str = 'unexpected end of data' if sys.version_info < (3,2,4) and not (# backport to 2.7.4 sys.version_info[:2] == (2,7) and sys.version_info[2] > 3): csv_eod_error_str = 'newline inside string' csv_unknown_url = "'bogus.csv'" if sys.version_info < (3,3,2): csv_unknown_url = "bogus.csv" def null_bytes(): import csv csv_data = open(utf_16_csv, 'rb').read() csv_data = unicode(csv_data, 'latin1').splitlines() reader = csv.reader([tables.CSVTable.encode_for_csv(line + '\n') for line in csv_data]) reader.next() null_bytes_exception = DocutilsTestSupport.exception_data(null_bytes)[0] totest = {} totest['table'] = [ ["""\ .. table:: Truth table for "not" :class: custom :name: tab:truth.not ===== ===== A not A ===== ===== False True True False ===== ===== """, """\ <document source="test data"> <table classes="custom" ids="tab-truth-not" names="tab:truth.not"> <title> 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 """], ["""\ .. table:: ========== ========== Table without a title ========== ========== """, """\ <document source="test data"> <table> <tgroup cols="2"> <colspec colwidth="10"> <colspec colwidth="10"> <tbody> <row> <entry> <paragraph> Table <entry> <paragraph> without <row> <entry> <paragraph> a <entry> <paragraph> title """], ["""\ .. table:: title with an *error ====== ===== Simple table ====== ===== """, """\ <document source="test data"> <table> <title> title with an \n\ <problematic ids="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" ids="id1" level="2" line="1" source="test data" type="WARNING"> <paragraph> Inline emphasis start-string without end-string. """], ["""\ .. table:: Not a table. This is a paragraph. """, """\ <document source="test data"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Error parsing content block for the "table" directive: exactly one table expected. <literal_block xml:space="preserve"> .. table:: Not a table. \n\ This is a paragraph. """], ["""\ .. table:: empty """, """\ <document source="test data"> <system_message level="2" line="1" source="test data" type="WARNING"> <paragraph> Content block expected for the "table" directive; none found. <literal_block xml:space="preserve"> .. table:: empty """], ] totest['csv-table'] = [ ["""\ .. 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!" "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" 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! """], ["""\ .. 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> """], [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 """, """\ <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:: 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 \n\ 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 \n\ some, csv, data """], ["""\ .. 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 \n\ 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 \n\ <problematic ids="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" ids="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 """], # note that this output is rewritten below for certain python versions ["""\ .. 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: %s. <literal_block xml:space="preserve"> .. csv-table:: bad URL :url: bogus.csv """ % csv_unknown_url], ["""\ .. 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 \n\ 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') %s. <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> 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 \n\ some, csv, data """ % DocutilsTestSupport.exception_data(int, "y")[1][0]], ["""\ .. 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') %s. <literal_block xml:space="preserve"> .. csv-table:: bad delimiter :delim: U+9999999999999 """ % unichr_exception_string], ["""\ .. 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: %s <literal_block xml:space="preserve"> .. csv-table:: bad CSV data \n\ "bad", \"csv, data """ % csv_eod_error_str], ["""\ .. 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: %s <literal_block xml:space="preserve"> .. csv-table:: bad CSV header data :header: "bad", \"csv, data \n\ good, csv, data """ % csv_eod_error_str], ["""\ .. 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: %s <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.) """ % (null_bytes_exception, 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? """], ["""\ .. 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'] = [ ["""\ .. list-table:: list table with integral header :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! """, """\ <document source="test data"> <table> <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! """], ["""\ .. 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 """], ["""\ .. 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 """], ["""\ .. list-table:: empty """, """\ <document source="test data"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> The "list-table" directive is empty; content required. <literal_block xml:space="preserve"> .. list-table:: empty """], ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/test_test_directives.py��������������������0000755�0001750�0001750�00000013373�10434150472�031350� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_test_directives.py 4564 2006-05-21 20:44:42Z wiemann $ # Author: David Goodger <goodger@python.org> # Copyright: This module has been placed in the public domain. """ Tests for misc.py test directives. """ from __init__ import DocutilsTestSupport def suite(): s = DocutilsTestSupport.ParserTestSuite() s.generateTests(totest) return s totest = {} totest['test_directives'] = [ ["""\ .. reStructuredText-test-directive:: Paragraph. """, """\ <document source="test data"> <system_message level="1" line="1" source="test data" type="INFO"> <paragraph> Directive processed. Type="reStructuredText-test-directive", arguments=[], options={}, content: None <paragraph> Paragraph. """], ["""\ .. reStructuredText-test-directive :: An optional space before the "::". """, """\ <document source="test data"> <system_message level="1" line="1" source="test data" type="INFO"> <paragraph> Directive processed. Type="reStructuredText-test-directive", arguments=[], options={}, content: None <paragraph> An optional space before the "::". """], ["""\ .. reStructuredText-test-directive:: argument Paragraph. """, """\ <document source="test data"> <system_message level="1" line="1" source="test data" type="INFO"> <paragraph> Directive processed. Type="reStructuredText-test-directive", arguments=['argument'], options={}, content: None <paragraph> Paragraph. """], ["""\ .. reStructuredText-test-directive:: argument :option: value Paragraph. """, """\ <document source="test data"> <system_message level="1" line="1" source="test data" type="INFO"> <paragraph> Directive processed. Type="reStructuredText-test-directive", arguments=['argument'], options={'option': 'value'}, content: None <paragraph> Paragraph. """], ["""\ .. reStructuredText-test-directive:: :option: value Paragraph. """, """\ <document source="test data"> <system_message level="1" line="1" source="test data" type="INFO"> <paragraph> Directive processed. Type="reStructuredText-test-directive", arguments=[], options={'option': 'value'}, content: None <paragraph> Paragraph. """], ["""\ .. reStructuredText-test-directive:: :option: Paragraph. """, """\ <document source="test data"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Error in "reStructuredText-test-directive" directive: invalid option value: (option: "option"; value: None) argument required but none supplied. <literal_block xml:space="preserve"> .. reStructuredText-test-directive:: :option: <paragraph> Paragraph. """], ["""\ .. reStructuredText-test-directive:: Directive block contains one paragraph, with a blank line before. Paragraph. """, """\ <document source="test data"> <system_message level="1" line="1" source="test data" type="INFO"> <paragraph> Directive processed. Type="reStructuredText-test-directive", arguments=[], options={}, content: <literal_block xml:space="preserve"> Directive block contains one paragraph, with a blank line before. <paragraph> Paragraph. """], ["""\ .. reStructuredText-test-directive:: Directive block contains one paragraph, with two blank lines before. Paragraph. """, """\ <document source="test data"> <system_message level="1" line="1" source="test data" type="INFO"> <paragraph> Directive processed. Type="reStructuredText-test-directive", arguments=[], options={}, content: <literal_block xml:space="preserve"> Directive block contains one paragraph, with two blank lines before. <paragraph> Paragraph. """], ["""\ .. reStructuredText-test-directive:: Directive block contains one paragraph, no blank line before. Paragraph. """, """\ <document source="test data"> <system_message level="1" line="1" source="test data" type="INFO"> <paragraph> Directive processed. Type="reStructuredText-test-directive", arguments=['Directive block contains one paragraph, no blank line before.'], options={}, content: None <paragraph> Paragraph. """], ["""\ .. reStructuredText-test-directive:: block no blank line. Paragraph. """, """\ <document source="test data"> <system_message level="1" line="1" source="test data" type="INFO"> <paragraph> Directive processed. Type="reStructuredText-test-directive", arguments=['block'], options={}, content: None <system_message level="2" line="3" source="test data" type="WARNING"> <paragraph> Explicit markup ends without a blank line; unexpected unindent. <paragraph> no blank line. <paragraph> Paragraph. """], ["""\ .. reStructuredText-test-directive:: argument :option: * value1 * value2 Paragraph. """, """\ <document source="test data"> <system_message level="1" line="1" source="test data" type="INFO"> <paragraph> Directive processed. Type="reStructuredText-test-directive", arguments=['argument'], options={'option': '* value1\\n* value2'}, content: None <paragraph> Paragraph. """], ["""\ .. reStructuredText-test-directive:: Directive \\block \\*contains* \\\\backslashes. """, """\ <document source="test data"> <system_message level="1" line="1" source="test data" type="INFO"> <paragraph> Directive processed. Type="reStructuredText-test-directive", arguments=[], options={}, content: <literal_block xml:space="preserve"> Directive \\block \\*contains* \\\\backslashes. """], ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/test_math.py�������������������������������0000644�0001750�0001750�00000002720�11603172505�027070� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_math.py 7062 2011-06-30 22:14:29Z milde $ # Author: Guenter Milde <milde@users.sf.net> # Copyright: This module has been placed in the public domain. """ Tests for the 'math' directive. """ from __init__ import DocutilsTestSupport def suite(): s = DocutilsTestSupport.ParserTestSuite() s.generateTests(totest) return s totest = {} totest['argument'] = [ ["""\ .. math:: y = f(x) """, """\ <document source="test data"> <math_block xml:space="preserve"> y = f(x) """], ] totest['content'] = [ ["""\ .. math:: 1+1=2 """, """\ <document source="test data"> <math_block xml:space="preserve"> 1+1=2 """], ] totest['options'] = [ ["""\ .. math:: :class: new :name: eq:Eulers law e^i*2*\pi = 1 """, """\ <document source="test data"> <math_block classes="new" ids="eq-eulers-law" names="eq:eulers\ law" xml:space="preserve"> e^i*2*\pi = 1 """], ] totest['argument_and_content'] = [ ["""\ .. math:: y = f(x) 1+1=2 """, """\ <document source="test data"> <math_block xml:space="preserve"> y = f(x) <math_block xml:space="preserve"> 1+1=2 """], ] totest['content with blank line'] = [ ["""\ .. math:: 1+1=2 E = mc^2 """, """\ <document source="test data"> <math_block xml:space="preserve"> 1+1=2 <math_block xml:space="preserve"> E = mc^2 """], ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') ������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/test_figures.py����������������������������0000755�0001750�0001750�00000016204�11603172505�027610� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_figures.py 7062 2011-06-30 22:14:29Z milde $ # Author: David Goodger <goodger@python.org> # Copyright: This module has been placed in the public domain. """ Tests for images.py figure directives. """ from __init__ import DocutilsTestSupport def suite(): s = DocutilsTestSupport.ParserTestSuite() s.generateTests(totest) return s totest = {} totest['figures'] = [ ["""\ .. figure:: picture.png """, """\ <document source="test data"> <figure> <image uri="picture.png"> """], ["""\ .. figure:: picture.png A picture with a caption. """, """\ <document source="test data"> <figure> <image uri="picture.png"> <caption> A picture with a caption. """], ["""\ .. figure:: picture.png - A picture with an invalid caption. """, """\ <document source="test data"> <figure> <image uri="picture.png"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Figure caption must be a paragraph or empty comment. <literal_block xml:space="preserve"> .. figure:: picture.png \n\ - A picture with an invalid caption. """], ["""\ .. figure:: picture.png .. A picture with a legend but no caption. """, """\ <document source="test data"> <figure> <image uri="picture.png"> <legend> <paragraph> A picture with a legend but no caption. """], ["""\ .. Figure:: picture.png :height: 100 :width: 200 :scale: 50 A picture with image options and a caption. """, """\ <document source="test data"> <figure> <image height="100" scale="50" uri="picture.png" width="200"> <caption> A picture with image options and a caption. """], ["""\ .. Figure:: picture.png :height: 100 :alt: alternate text :width: 200 :scale: 50 :figwidth: 300 :figclass: class1 class2 :name: fig:pix A picture with image options on individual lines, and this caption. """, """\ <document source="test data"> <figure classes="class1 class2" width="300px"> <image alt="alternate text" height="100" ids="fig-pix" names="fig:pix" scale="50" uri="picture.png" width="200"> <caption> 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. """], ["""\ .. figure:: picture.png :align: top A figure with wrong alignment. """, """\ <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: '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. .. figure:: picture.png """, """\ <document source="test data"> <paragraph> This figure lacks a caption. It may still have a "Figure 1."-style caption appended in the output. <figure> <image uri="picture.png"> """], ["""\ .. figure:: picture.png A picture with a caption and a legend. +-----------------------+-----------------------+ | Symbol | Meaning | +=======================+=======================+ | .. image:: tent.png | Campground | +-----------------------+-----------------------+ | .. image:: waves.png | Lake | +-----------------------+-----------------------+ | .. image:: peak.png | Mountain | +-----------------------+-----------------------+ """, """\ <document source="test data"> <figure> <image uri="picture.png"> <caption> A picture with a caption and a legend. <legend> <table> <tgroup cols="2"> <colspec colwidth="23"> <colspec colwidth="23"> <thead> <row> <entry> <paragraph> Symbol <entry> <paragraph> Meaning <tbody> <row> <entry> <image uri="tent.png"> <entry> <paragraph> Campground <row> <entry> <image uri="waves.png"> <entry> <paragraph> Lake <row> <entry> <image uri="peak.png"> <entry> <paragraph> Mountain """], ["""\ .. figure:: picture.png .. A picture with a legend but no caption. (The empty comment replaces the caption, which must be a single paragraph.) """, """\ <document source="test data"> <figure> <image uri="picture.png"> <legend> <paragraph> A picture with a legend but no caption. (The empty comment replaces the caption, which must be a single paragraph.) """], ["""\ Testing for line-leaks: .. figure:: picture.png A picture with a caption. .. figure:: picture.png A picture with a caption. .. figure:: picture.png A picture with a caption. .. figure:: picture.png .. figure:: picture.png .. figure:: picture.png .. figure:: picture.png A picture with a caption. .. figure:: picture.png .. figure:: picture.png A picture with a caption. .. figure:: picture.png """, """\ <document source="test data"> <paragraph> Testing for line-leaks: <figure> <image uri="picture.png"> <caption> A picture with a caption. <figure> <image uri="picture.png"> <caption> A picture with a caption. <figure> <image uri="picture.png"> <caption> A picture with a caption. <figure> <image uri="picture.png"> <figure> <image uri="picture.png"> <figure> <image uri="picture.png"> <figure> <image uri="picture.png"> <caption> A picture with a caption. <figure> <image uri="picture.png"> <figure> <image uri="picture.png"> <caption> A picture with a caption. <figure> <image uri="picture.png"> """], ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/test_admonitions.py������������������������0000755�0001750�0001750�00000011676�11714550403�030500� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_admonitions.py 7348 2012-02-08 19:46:11Z milde $ # Author: David Goodger <goodger@python.org> # Copyright: This module has been placed in the public domain. """ Tests for admonitions.py directives. """ from __init__ import DocutilsTestSupport def suite(): s = DocutilsTestSupport.ParserTestSuite() s.generateTests(totest) return s totest = {} totest['admonitions'] = [ ["""\ .. Attention:: Directives at large. .. Note:: :name: mynote :class: testnote Admonitions support the generic "name" and "class" options. .. Tip:: 15% if the service is good. .. Hint:: It's bigger than a bread box. - .. WARNING:: Strong prose may provoke extreme mental exertion. Reader discretion is strongly advised. - .. Error:: Does not compute. .. Caution:: Don't take any wooden nickels. .. DANGER:: Mad scientist at work! .. Important:: - Wash behind your ears. - Clean up your room. - Call your mother. - Back up your data. """, """\ <document source="test data"> <attention> <paragraph> Directives at large. <note classes="testnote" ids="mynote" names="mynote"> <paragraph> Admonitions support the generic "name" and "class" options. <tip> <paragraph> 15% if the service is good. <hint> <paragraph> It's bigger than a bread box. <bullet_list bullet="-"> <list_item> <warning> <paragraph> Strong prose may provoke extreme mental exertion. Reader discretion is strongly advised. <list_item> <error> <paragraph> Does not compute. <caution> <paragraph> Don't take any wooden nickels. <danger> <paragraph> Mad scientist at work! <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:: One-line notes. .. note:: One after the other. .. note:: No blank lines in-between. """, """\ <document source="test data"> <note> <paragraph> One-line notes. <note> <paragraph> One after the other. <note> <paragraph> No blank lines in-between. """], ["""\ .. note:: Content before options is possible too. :class: mynote .. note:: :strong:`a role is not an option`. :name: role not option .. note:: a role is :strong:`not an option`, even if its starts a line. """, """\ <document source="test data"> <note classes="mynote"> <paragraph> Content before options is possible too. <note ids="role-not-option" names="role\ not\ option"> <paragraph> <strong> a role is not an option . <note> <paragraph> a role is <strong> not an option , even if its starts a line. """], ["""\ .. note:: """, """\ <document source="test data"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Content block expected for the "note" directive; none found. <literal_block xml:space="preserve"> .. note:: """], ["""\ .. admonition:: Admonition This is a generic admonition. """, """\ <document source="test data"> <admonition classes="admonition-admonition"> <title> Admonition <paragraph> This is a generic admonition. """], ["""\ .. admonition:: And, by the way... You can make up your own admonition too. """, """\ <document source="test data"> <admonition classes="admonition-and-by-the-way"> <title> And, by the way... <paragraph> You can make up your own admonition too. """], ["""\ .. admonition:: Admonition :class: emergency :name: reference name Test the "class" override. """, """\ <document source="test data"> <admonition classes="emergency" ids="reference-name" names="reference\ name"> <title> Admonition <paragraph> Test the "class" override. """], ["""\ .. admonition:: Generic admonitions require a title. """, """\ <document source="test data"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Error in "admonition" directive: 1 argument(s) required, 0 supplied. <literal_block xml:space="preserve"> .. admonition:: Generic admonitions require a title. """], ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') ������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/test_compound.py���������������������������0000755�0001750�0001750�00000005127�11605102276�027772� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_compound.py 7072 2011-07-06 15:52:30Z milde $ # Author: David Goodger <goodger@python.org> # 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:: :name: interesting :class: log 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 classes="log" ids="interesting" names="interesting"> <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:: content may start on same line second paragraph """, """\ <document source="test data"> <compound> <paragraph> content may start on same line <paragraph> second paragraph """], ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/test_topics.py�����������������������������0000755�0001750�0001750�00000011703�11603172505�027444� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_topics.py 7062 2011-06-30 22:14:29Z milde $ # Author: David Goodger <goodger@python.org> # Copyright: This module has been placed in the public domain. """ Tests for the "topic" directive. """ from __init__ import DocutilsTestSupport def suite(): s = DocutilsTestSupport.ParserTestSuite() s.generateTests(totest) return s totest = {} totest['topics'] = [ ["""\ .. topic:: """, """\ <document source="test data"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Error in "topic" directive: 1 argument(s) required, 0 supplied. <literal_block xml:space="preserve"> .. topic:: """], ["""\ .. topic:: Title """, """\ <document source="test data"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Content block expected for the "topic" directive; none found. <literal_block xml:space="preserve"> .. topic:: Title """], ["""\ .. topic:: Title Body. """, """\ <document source="test data"> <topic> <title> Title <paragraph> Body. """], ["""\ .. topic:: With Options :class: custom :name: my point Body. """, """\ <document source="test data"> <topic classes="custom" ids="my-point" names="my\ point"> <title> With Options <paragraph> Body. """], ["""\ .. topic:: Title Body. """, """\ <document source="test data"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Error in "topic" directive: 1 argument(s) required, 0 supplied. <literal_block xml:space="preserve"> .. topic:: \n\ Title \n\ Body. """], ["""\ .. topic:: Title Body. """, """\ <document source="test data"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Content block expected for the "topic" directive; none found. <literal_block xml:space="preserve"> .. topic:: Title Body. """], ["""\ .. topic:: Title Body. """, """\ <document source="test data"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Error in "topic" directive: 1 argument(s) required, 0 supplied. <literal_block xml:space="preserve"> .. topic:: \n\ Title Body. """], ["""\ .. topic:: Title .. topic:: Nested Body. """, """\ <document source="test data"> <topic> <title> Title <system_message level="3" line="3" source="test data" type="ERROR"> <paragraph> The "topic" directive may not be used within topics or body elements. <literal_block xml:space="preserve"> .. topic:: Nested \n\ Body. """], ["""\ .. topic:: Title .. topic:: Nested Body. More. """, """\ <document source="test data"> <topic> <title> Title <system_message level="3" line="3" source="test data" type="ERROR"> <paragraph> The "topic" directive may not be used within topics or body elements. <literal_block xml:space="preserve"> .. topic:: Nested \n\ Body. <system_message level="2" line="6" source="test data" type="WARNING"> <paragraph> Explicit markup ends without a blank line; unexpected unindent. <paragraph> More. """], ["""\ .. topic:: Title .. topic:: Nested Body. More. More. """, """\ <document source="test data"> <topic> <title> Title <system_message level="3" line="3" source="test data" type="ERROR"> <paragraph> The "topic" directive may not be used within topics or body elements. <literal_block xml:space="preserve"> .. topic:: Nested \n\ Body. <paragraph> More. <paragraph> More. """], ["""\ .. topic:: First Body .. topic:: Second Body. """, """\ <document source="test data"> <topic> <title> First <paragraph> Body <topic> <title> Second <paragraph> Body. """], ["""\ .. sidebar:: Title :subtitle: Outer .. topic:: Nested Body. More. More. """, """\ <document source="test data"> <sidebar> <title> Title <subtitle> Outer <topic> <title> Nested <paragraph> Body. <paragraph> More. <paragraph> More. """], ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') �������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/test_replace.py����������������������������0000755�0001750�0001750�00000007504�11556643726�027601� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_replace.py 7021 2011-04-29 23:20:54Z grubert $ # Author: David Goodger <goodger@python.org> # Copyright: This module has been placed in the public domain. """ Tests for misc.py "replace" directive. """ from __init__ import DocutilsTestSupport def suite(): s = DocutilsTestSupport.ParserTestSuite() s.generateTests(totest) return s totest = {} totest['replace'] = [ ["""\ Test the |name| directive. .. |name| replace:: "**replace**" """, """\ <document source="test data"> <paragraph> Test the \n\ <substitution_reference refname="name"> name directive. <substitution_definition names="name"> " <strong> replace " """], ["""\ .. |name| replace:: paragraph 1 paragraph 2 """, """\ <document source="test data"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Error in "replace" directive: may contain a single paragraph only. <system_message level="2" line="1" source="test data" type="WARNING"> <paragraph> Substitution definition "name" empty or invalid. <literal_block xml:space="preserve"> .. |name| replace:: paragraph 1 paragraph 2 """], ["""\ .. |name| replace:: """, """\ <document source="test data"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Content block expected for the "replace" directive; none found. <literal_block xml:space="preserve"> replace:: <system_message level="2" line="1" source="test data" type="WARNING"> <paragraph> Substitution definition "name" empty or invalid. <literal_block xml:space="preserve"> .. |name| replace:: """], ["""\ .. |Python| replace:: Python, *the* best language around .. _Python: http://www.python.org/ I recommend you try |Python|_. """, """\ <document source="test data"> <substitution_definition names="Python"> Python, <emphasis> the best language around <target ids="python" names="python" refuri="http://www.python.org/"> <paragraph> I recommend you try <reference refname="python"> <substitution_reference refname="Python"> Python . """], ["""\ .. |name| replace:: *error in **inline ``markup """, """\ <document source="test data"> <system_message ids="id1" level="2" line="1" source="test data" type="WARNING"> <paragraph> Inline emphasis start-string without end-string. <system_message ids="id3" level="2" line="1" source="test data" type="WARNING"> <paragraph> Inline strong start-string without end-string. <system_message ids="id5" level="2" line="1" source="test data" type="WARNING"> <paragraph> Inline literal start-string without end-string. <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Substitution definition contains illegal element: <literal_block xml:space="preserve"> <problematic ids="id2" refid="id1"> * <literal_block xml:space="preserve"> .. |name| replace:: *error in **inline ``markup """], ["""\ .. replace:: not valid outside of a substitution definition """, """\ <document source="test data"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Invalid context: the "replace" directive can only be used within a substitution definition. <literal_block xml:space="preserve"> .. replace:: not valid outside of a substitution definition """], ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/test_decorations.py������������������������0000755�0001750�0001750�00000003467�10455266150�030471� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_decorations.py 4667 2006-07-12 21:40:56Z wiemann $ # Author: David Goodger <goodger@python.org> # 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"> <system_message level="3" line="1" source="test data" type="ERROR"> <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') ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/test_parsed_literals.py��������������������0000755�0001750�0001750�00000003254�11605102276�031322� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_parsed_literals.py 7072 2011-07-06 15:52:30Z milde $ # Author: Lea Wiemann <LeWiemann@gmail.com> # Copyright: This module has been placed in the public domain. """ Tests for the body.py 'parsed-literal' directive. """ from __init__ import DocutilsTestSupport def suite(): s = DocutilsTestSupport.ParserTestSuite() s.generateTests(totest) return s totest = {} totest['parsed_literals'] = [ ["""\ .. parsed-literal:: This is a parsed literal block. It may contain *inline markup spanning lines.* """, """\ <document source="test data"> <literal_block xml:space="preserve"> This is a parsed literal block. It may contain \n\ <emphasis> inline markup spanning lines. """], ["""\ .. parsed-literal:: :class: myliteral :name: example: parsed This is a parsed literal block with options. """, """\ <document source="test data"> <literal_block classes="myliteral" ids="example-parsed" names="example:\ parsed" xml:space="preserve"> This is a parsed literal block with options. """], ["""\ .. parsed-literal:: content may start on same line """, """\ <document source="test data"> <literal_block xml:space="preserve"> content may start on same line """], ["""\ .. parsed-literal:: """, """\ <document source="test data"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Content block expected for the "parsed-literal" directive; none found. <literal_block xml:space="preserve"> .. parsed-literal:: """], ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/test_replace_fr.py�������������������������0000644�0001750�0001750�00000003320�11556643726�030255� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_replace.py 4667 2006-07-12 21:40:56Z wiemann $ # Author: David Goodger <goodger@python.org> # Copyright: This module has been placed in the public domain. """ Tests for misc.py "replace" directive. Test in french (not default/fallback language). """ from __init__ import DocutilsTestSupport def suite(): s = DocutilsTestSupport.ParserTestSuite(suite_settings={'language_code':'fr'}) s.generateTests(totest) return s totest = {} totest['replace'] = [ ["""\ Test directive containing french role exposant (superscript). .. |Na+| remplace:: Na\ :exp:`+` Le |Na+| est l'ion sodium. """, """\ <document source="test data"> <paragraph> Test directive containing french role exposant (superscript). <substitution_definition names="Na+"> Na <superscript> + <paragraph> Le \n\ <substitution_reference refname="Na+"> Na+ est l\'ion sodium. """], ["""\ Test directive containing english role superscript. .. |Na+| remplace:: Na\ :sup:`+` Le |Na+| est l'ion sodium. """, """\ <document source="test data"> <paragraph> Test directive containing english role superscript. <system_message level="1" line="3" source="test data" type="INFO"> <paragraph> No role entry for "sup" in module "docutils.parsers.rst.languages.fr". Using English fallback for role "sup". <substitution_definition names="Na+"> Na <superscript> + <paragraph> Le \n\ <substitution_reference refname="Na+"> Na+ est l\'ion sodium."""], ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/include2.txt�������������������������������0000644�0001750�0001750�00000000161�07701625121�026772� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Here are some paragraphs that can appear at any level. This file (include2.txt) is used by ``test_include.py``. ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/utf-16.csv���������������������������������0000644�0001750�0001750�00000000602�10121136756�026264� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������"�T�r�e�a�t�"�,� �"�Q�u�a�n�t�i�t�y�"�,� �"�D�e�s�c�r�i�p�t�i�o�n�"� �"�A�l�b�a�t�r���"�,� �2�.�9�9�,� �"��O�n� �a� �!�"� �"�C�r�u�n�c�h�y� �F�r�o�g�"�,� �1�.�4�9�,� �"�I�f� �w�e� �t�o�o�k� �t�h�e� �b��n�e�s� �o�u�t�,� �i�t� �w�o�u�l�d�n �t� �b�e� �c�r�u�n�c�h�y�,� �n�o�w� �w�o�u�l�d� �i�t�?�"� �"�G�a�n�n�e�t� �R�i�p�p�l�e�"�,� �1�.�9�9�,� �"��O�n� �a� �?�"� ������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/test_unicode.py����������������������������0000755�0001750�0001750�00000012457�11164743725�027612� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_unicode.py 5889 2009-04-01 20:00:21Z gbrandl $ # Author: David Goodger <goodger@python.org> # Copyright: This module has been placed in the public domain. """ Tests for misc.py "unicode" directive. """ from __init__ import DocutilsTestSupport def suite(): s = DocutilsTestSupport.ParserTestSuite() s.generateTests(totest) return s unichr_exception = DocutilsTestSupport.exception_data( unichr, int("111111111111111111", 16))[0] if isinstance(unichr_exception, OverflowError): unichr_exception_string = 'code too large (%s)' % unichr_exception else: unichr_exception_string = str(unichr_exception) totest = {} totest['unicode'] = [ [""" Insert an em-dash (|mdash|), a copyright symbol (|copy|), a non-breaking space (|nbsp|), a backwards-not-equals (|bne|), and a captial omega (|Omega|). .. |mdash| unicode:: 0x02014 .. |copy| unicode:: \\u00A9 .. |nbsp| unicode::   .. |bne| unicode:: U0003D U020E5 .. |Omega| unicode:: U+003A9 """, u"""\ <document source="test data"> <paragraph> Insert an em-dash ( <substitution_reference refname="mdash"> mdash ), a copyright symbol ( <substitution_reference refname="copy"> copy ), a non-breaking space ( <substitution_reference refname="nbsp"> nbsp ), a backwards-not-equals ( <substitution_reference refname="bne"> bne ), and a captial omega ( <substitution_reference refname="Omega"> Omega ). <substitution_definition names="mdash"> \u2014 <substitution_definition names="copy"> \u00A9 <substitution_definition names="nbsp"> \u00A0 <substitution_definition names="bne"> = \u20e5 <substitution_definition names="Omega"> \u03a9 """], [""" Bad input: .. |empty| unicode:: .. |empty too| unicode:: .. comment doesn't count as content .. |not hex| unicode:: 0xHEX .. |not all hex| unicode:: UABCX .. unicode:: not in a substitution definition """, """\ <document source="test data"> <paragraph> Bad input: <system_message level="3" line="4" source="test data" type="ERROR"> <paragraph> Error in "unicode" directive: 1 argument(s) required, 0 supplied. <literal_block xml:space="preserve"> unicode:: <system_message level="2" line="4" source="test data" type="WARNING"> <paragraph> Substitution definition "empty" empty or invalid. <literal_block xml:space="preserve"> .. |empty| unicode:: <system_message level="2" line="5" source="test data" type="WARNING"> <paragraph> 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"> 0xHEX <substitution_definition names="not\ all\ hex"> UABCX <system_message level="3" line="8" source="test data" type="ERROR"> <paragraph> Invalid context: the "unicode" directive can only be used within a substitution definition. <literal_block xml:space="preserve"> .. unicode:: not in a substitution definition """], [""" Testing comments and extra text. Copyright |copy| 2003, |BogusMegaCorp (TM)|. .. |copy| unicode:: 0xA9 .. copyright sign .. |BogusMegaCorp (TM)| unicode:: BogusMegaCorp U+2122 .. with trademark sign """, u"""\ <document source="test data"> <paragraph> Testing comments and extra text. <paragraph> Copyright <substitution_reference refname="copy"> copy 2003, <substitution_reference refname="BogusMegaCorp (TM)"> BogusMegaCorp (TM) . <substitution_definition names="copy"> \u00A9 <substitution_definition names="BogusMegaCorp\ (TM)"> BogusMegaCorp \u2122 """], [""" .. |too big for int| unicode:: 0x111111111111111111 .. |too big for unicode| unicode:: 0x11111111 """, """\ <document source="test data"> <system_message level="3" line="2" source="test data" type="ERROR"> <paragraph> Invalid character code: 0x111111111111111111 ValueError: %s <literal_block xml:space="preserve"> unicode:: 0x111111111111111111 <system_message level="2" line="2" source="test data" type="WARNING"> <paragraph> Substitution definition "too big for int" empty or invalid. <literal_block xml:space="preserve"> .. |too big for int| unicode:: 0x111111111111111111 <system_message level="3" line="3" source="test data" type="ERROR"> <paragraph> Invalid character code: 0x11111111 %s <literal_block xml:space="preserve"> unicode:: 0x11111111 <system_message level="2" line="3" source="test data" type="WARNING"> <paragraph> Substitution definition "too big for unicode" empty or invalid. <literal_block xml:space="preserve"> .. |too big for unicode| unicode:: 0x11111111 """ % (unichr_exception_string, DocutilsTestSupport.exception_data(unichr, int("11111111", 16))[2])] ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/test_default_role.py�����������������������0000755�0001750�0001750�00000003416�10434150472�030612� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_default_role.py 4564 2006-05-21 20:44:42Z wiemann $ # Author: David Goodger <goodger@python.org> # 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`. """, """\ <document source="test data"> <paragraph> This is a \n\ <subscript> subscript . """], ["""\ Must define a custom role before using it. .. default-role:: custom """, """\ <document source="test data"> <paragraph> Must define a custom role before using it. <system_message level="1" line="3" source="test data" type="INFO"> <paragraph> No role entry for "custom" in module "docutils.parsers.rst.languages.en". Trying "custom" as canonical role name. <system_message level="3" line="3" source="test data" type="ERROR"> <paragraph> Unknown interpreted text role "custom". <literal_block xml:space="preserve"> .. default-role:: custom """], ["""\ .. role:: custom .. default-role:: custom This text uses the `default role`. .. default-role:: Returned the `default role` to its standard default. """, """\ <document source="test data"> <paragraph> This text uses the \n\ <inline classes="custom"> default role . <paragraph> Returned the \n\ <title_reference> default role to its standard default. """], ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/test_role.py�������������������������������0000755�0001750�0001750�00000014005�11445113750�027103� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_role.py 6424 2010-09-18 10:43:52Z smerten $ # Author: David Goodger <goodger@python.org> # Copyright: This module has been placed in the public domain. """ Tests for misc.py "role" directive. """ from __init__ import DocutilsTestSupport def suite(): s = DocutilsTestSupport.ParserTestSuite() s.generateTests(totest) return s totest = {} totest['role'] = [ ["""\ .. role:: custom .. role:: special :custom:`interpreted` and :special:`interpreted` """, """\ <document source="test data"> <paragraph> <inline classes="custom"> interpreted and \n\ <inline classes="special"> interpreted """], ["""\ .. role:: custom :class: custom-class .. role:: special :class: special-class :custom:`interpreted` and :special:`interpreted` """, """\ <document source="test data"> <paragraph> <inline classes="custom-class"> interpreted and \n\ <inline classes="special-class"> interpreted """], ["""\ Must define :custom:`interpreted` before using it. .. role:: custom Now that it's defined, :custom:`interpreted` works. """, """\ <document source="test data"> <paragraph> Must define <problematic ids="id2" refid="id1"> :custom:`interpreted` before using it. <system_message level="1" line="1" source="test data" type="INFO"> <paragraph> No role entry for "custom" in module "docutils.parsers.rst.languages.en". Trying "custom" as canonical role name. <system_message backrefs="id2" ids="id1" level="3" line="1" source="test data" type="ERROR"> <paragraph> Unknown interpreted text role "custom". <paragraph> Now that it's defined, \n\ <inline classes="custom"> interpreted works. """], ["""\ .. role:: custom(emphasis) :custom:`text` """, """\ <document source="test data"> <paragraph> <emphasis classes="custom"> text """], ["""\ .. role:: custom ( emphasis ) :custom:`text` """, """\ <document source="test data"> <paragraph> <emphasis classes="custom"> text """], ["""\ .. role:: custom(emphasis) :class: special :custom:`text` """, """\ <document source="test data"> <paragraph> <emphasis classes="special"> text """], ["""\ .. role:: custom(unknown-role) """, """\ <document source="test data"> <system_message level="1" line="1" source="test data" type="INFO"> <paragraph> No role entry for "unknown-role" in module "docutils.parsers.rst.languages.en". Trying "unknown-role" as canonical role name. <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Unknown interpreted text role "unknown-role". <literal_block xml:space="preserve"> .. role:: custom(unknown-role) """], ["""\ .. role:: custom :class: 1 """, """\ <document source="test data"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Error in "role" directive: invalid option value: (option: "class"; value: '1') cannot make "1" into a class name. <literal_block xml:space="preserve"> .. role:: custom :class: 1 """], ["""\ .. role:: 1 """, """\ <document source="test data"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Invalid argument for "role" directive: cannot make "1" into a class name. <literal_block xml:space="preserve"> .. role:: 1 """], ["""\ .. role:: (error) """, """\ <document source="test data"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> "role" directive arguments not valid role names: "(error)". <literal_block xml:space="preserve"> .. role:: (error) """], ["""\ .. role:: """, """\ <document source="test data"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> "role" directive requires arguments on the first line. <literal_block xml:space="preserve"> .. role:: """], ["""\ Test ---- .. role:: fileref(emphasis) Testing a :fileref:`role` in a nested parse. """, """\ <document source="test data"> <section ids="test" names="test"> <title> Test <paragraph> Testing a \n\ <emphasis classes="fileref"> role in a nested parse. """], ["""\ .. role:: custom .. role:: special Empty :custom:`\ ` and empty `\ `:special: """, """\ <document source="test data"> <paragraph> Empty <inline classes="custom"> and empty <inline classes="special"> """], ] 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 classes="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 classes="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 ids="id2" refid="id1"> :raw:`role` directly. <system_message backrefs="id2" ids="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 unittest.main(defaultTest='suite') ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/include1.txt�������������������������������0000644�0001750�0001750�00000000103�07546461603�026777� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Inclusion 1 ----------- This file is used by ``test_include.py``. �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/raw1.txt�����������������������������������0000644�0001750�0001750�00000000062�07546461603�026151� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������<p>This file is used by <tt>test_raw.py</tt>.</p> ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/empty.txt����������������������������������0000644�0001750�0001750�00000000000�10206505134�026406� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/test_raw.py��������������������������������0000755�0001750�0001750�00000011571�11731735075�026750� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_raw.py 7384 2012-03-19 22:59:09Z milde $ # Author: David Goodger <goodger@python.org> # Copyright: This module has been placed in the public domain. """ Tests for misc.py "raw" directive. """ import os.path import sys from __init__ import DocutilsTestSupport from docutils._compat import b def suite(): s = DocutilsTestSupport.ParserTestSuite() s.generateTests(totest) return s mydir = 'test_parsers/test_rst/test_directives/' 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) utf_16_error_str = ("UnicodeDecodeError: 'ascii' codec can't decode byte 0xfe " "in position 0: ordinal not in range(128)") if sys.version_info < (3,0): utf_16_error_str = ("UnicodeError: Unable to decode input data. " "Tried the following encodings: 'ascii'.\n" " (%s)" % utf_16_error_str) totest = {} totest['raw'] = [ ["""\ .. raw:: html <span>This is some plain old raw text.</span> """, """\ <document source="test data"> <raw format="html" xml:space="preserve"> <span>This is some plain old raw text.</span> """], ["""\ .. raw:: html :file: %s """ % raw1, """\ <document source="test data"> <raw format="html" source="%s" xml:space="preserve"> <p>This file is used by <tt>test_raw.py</tt>.</p> """ % DocutilsTestSupport.utils.relative_path(None, raw1)], ["""\ .. raw:: html :file: rawfile.html :url: http://example.org/ """, """\ <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 "raw" directive. <literal_block xml:space="preserve"> .. raw:: html :file: rawfile.html :url: http://example.org/ """], ["""\ .. raw:: html :file: rawfile.html <p>Can't have both content and file attribute.</p> """, """\ <document source="test data"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> "raw" directive may not both specify an external file and have content. <literal_block xml:space="preserve"> .. raw:: html :file: rawfile.html <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.} \\] """], ["""\ .. raw:: html :file: %s :encoding: utf-16 """ % utf_16_file_rel, b("""\ <document source="test data"> <raw format="html" source="%s" xml:space="preserve"> "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).decode('raw_unicode_escape')], ["""\ Raw input file is UTF-16-encoded, and is not valid ASCII. .. raw:: html :file: %s :encoding: ascii """ % utf_16_file_rel, """\ <document source="test data"> <paragraph> 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: %s <literal_block xml:space="preserve"> .. raw:: html :file: %s :encoding: ascii """ % (utf_16_error_str, utf_16_file_rel)], [u"""\ .. raw:: html :encoding: utf-8 Should the parser complain becau\xdfe there is no :file:? BUG? """, """\ <document source="test data"> <raw format="html" xml:space="preserve"> Should the parser complain becau\xdfe there is no :file:? BUG? """], ["""\ .. raw:: html """, """\ <document source="test data"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Content block expected for the "raw" directive; none found. <literal_block xml:space="preserve"> .. raw:: html """], ["""\ .. raw:: html :file: non-existent.file """, """\ <document source="test data"> <system_message level="4" line="1" source="test data" type="SEVERE"> <paragraph> Problems with "raw" directive path: InputError: [Errno 2] No such file or directory: 'non-existent.file'. <literal_block xml:space="preserve"> .. raw:: html :file: non-existent.file """], # note that this output is rewritten below for certain python versions ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') ���������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/test_block_quotes.py�����������������������0000755�0001750�0001750�00000003054�10627410160�030632� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_block_quotes.py 5174 2007-05-31 00:01:52Z wiemann $ # Author: Lea Wiemann <LeWiemann@gmail.com> # Copyright: This module has been placed in the public domain. """ Tests for the block quote directives "epigraph", "highlights", and "pull-quote". """ from __init__ import DocutilsTestSupport def suite(): s = DocutilsTestSupport.ParserTestSuite() s.generateTests(totest) return s generic_tests = [ ["""\ .. %(type)s:: This is a block quote. -- Attribution This is another block quote. -- Another Attribution, Second Line """, """\ <document source="test data"> <block_quote classes="%(type)s"> <paragraph> This is a block quote. <attribution> Attribution <block_quote classes="%(type)s"> <paragraph> This is another block quote. <attribution> Another Attribution, Second Line """], # TODO: Add class option. ["""\ .. %(type)s:: """, """\ <document source="test data"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Content block expected for the "%(type)s" directive; none found. <literal_block xml:space="preserve"> .. %(type)s:: """], ] totest = {} for block_quote_type in ('epigraph', 'highlights', 'pull-quote'): totest[block_quote_type] = [ [text % {'type': block_quote_type} for text in pair] for pair in generic_tests] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/include 11.txt�����������������������������0000644�0001750�0001750�00000000012�10215427137�027106� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������some text ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/test_line_blocks.py������������������������0000755�0001750�0001750�00000004045�11603172505�030430� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_line_blocks.py 7062 2011-06-30 22:14:29Z milde $ # Author: David Goodger <goodger@python.org> # 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:: :class: linear :name: cit:short This is a line block with options. """, """\ <document source="test data"> <line_block classes="linear" ids="cit-short" names="cit:short"> <line> This is a line block with options. """], ["""\ .. line-block:: Inline markup *may not span multiple lines* of a line block. """, """\ <document source="test data"> <line_block> <line> Inline markup \n\ <problematic ids="id2" refid="id1"> * may not span <line_block> <line> multiple lines* of a line block. <system_message backrefs="id2" ids="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="3" line="1" source="test data" type="ERROR"> <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') �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/test_container.py��������������������������0000755�0001750�0001750�00000003514�11603172505�030126� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_container.py 7062 2011-06-30 22:14:29Z milde $ # Author: David Goodger <goodger@python.org> # Copyright: This module has been placed in the public domain. """ Tests for the 'container' directive from body.py. """ from __init__ import DocutilsTestSupport def suite(): s = DocutilsTestSupport.ParserTestSuite() s.generateTests(totest) return s totest = {} totest['container'] = [ ["""\ .. container:: "container" is a generic element, an extension mechanism for users & applications. Containers may contain arbitrary body elements. """, """\ <document source="test data"> <container> <paragraph> "container" is a generic element, an extension mechanism for users & applications. <paragraph> Containers may contain arbitrary body elements. """], ["""\ .. container:: custom Some text. """, """\ <document source="test data"> <container classes="custom"> <paragraph> Some text. """], ["""\ .. container:: one two three four Multiple classes. Multi-line argument. Multiple paragraphs in the container. """, """\ <document source="test data"> <container classes="one two three four"> <paragraph> Multiple classes. <paragraph> Multi-line argument. <paragraph> Multiple paragraphs in the container. """], ["""\ .. container:: :name: my name The name argument allows hyperlinks to `my name`_. """, """\ <document source="test data"> <container ids="my-name" names="my\ name"> <paragraph> The name argument allows hyperlinks to <reference name="my name" refname="my name"> my name . """], ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/include8.txt�������������������������������0000644�0001750�0001750�00000000067�07607426742�027022� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������In include8.txt .. include:: ../includes/include9.txt �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/test_date.py�������������������������������0000755�0001750�0001750�00000003205�12012307054�027050� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_date.py 7491 2012-08-13 23:30:52Z milde $ # Author: David Goodger <goodger@python.org> # Copyright: This module has been placed in the public domain. """ Tests for the misc.py "date" directive. """ from __init__ import DocutilsTestSupport import time from docutils.utils.error_reporting import locale_encoding def suite(): s = DocutilsTestSupport.ParserTestSuite() s.generateTests(totest) return s totest = {} totest['date'] = [ ["""\ .. |date| date:: Today's date is |date|. """, """\ <document source="test data"> <substitution_definition names="date"> %s <paragraph> Today's date is \n\ <substitution_reference refname="date"> date . """ % time.strftime('%Y-%m-%d')], ["""\ .. |date| date:: %a, %d %b %Y """, """\ <document source="test data"> <substitution_definition names="date"> %s """ % time.strftime('%a, %d %b %Y')], ["""\ .. date:: """, """\ <document source="test data"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Invalid context: the "date" directive can only be used within a substitution definition. <literal_block xml:space="preserve"> .. date:: """], ] # some locales return non-ASCII characters for names of days or months if locale_encoding in ['utf8', 'utf-8', 'latin-1']: totest['decode date'] = [ [u"""\ .. |date| date:: t\xc3glich """, u"""\ <document source="test data"> <substitution_definition names="date"> t\xc3glich """], ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/test_include.py����������������������������0000755�0001750�0001750�00000070241�12024637300�027565� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_include.py 7514 2012-09-14 14:27:12Z milde $ # Author: David Goodger <goodger@python.org> # Copyright: This module has been placed in the public domain. """ Tests for misc.py "include" directive. """ import os.path import sys from __init__ import DocutilsTestSupport from docutils.parsers.rst import states from docutils._compat import b from docutils.utils.code_analyzer import with_pygments def suite(): s = DocutilsTestSupport.ParserTestSuite() if not with_pygments: del(totest['include-code']) s.generateTests(totest) return s # prepend this directory (relative to the test root): def mydir(path): return os.path.join('test_parsers/test_rst/test_directives/', path) # make `path` relative with utils.relative_path(): def reldir(path): return DocutilsTestSupport.utils.relative_path(None, path) include1 = mydir('include1.txt') include2 = mydir('include2.txt') include3 = mydir('include3.txt') include8 = mydir('include8.txt') include10 = mydir('include10.txt') include11 = mydir('include 11.txt') include12 = mydir('include12.txt') include13 = mydir('include13.txt') include_literal = mydir('include_literal.txt') utf_16_file = mydir('utf-16.csv') utf_16_error_str = ("UnicodeDecodeError: 'ascii' codec can't decode byte 0xfe " "in position 0: ordinal not in range(128)") if sys.version_info < (3,0): utf_16_error_str = ("UnicodeError: Unable to decode input data. " "Tried the following encodings: 'ascii'.\n" " (%s)" % utf_16_error_str) nonexistent = os.path.join(os.path.dirname(states.__file__), 'include', 'nonexistent') nonexistent_rel = DocutilsTestSupport.utils.relative_path( os.path.join(DocutilsTestSupport.testroot, 'dummy'), nonexistent) # Different error for path with 8bit chars with locale == C or None: try: open(u'\u043c\u0438\u0440.txt') except UnicodeEncodeError: errstr_8bit_path = u"""\ Cannot encode input file path "\u043c\u0438\u0440.txt" (wrong locale?).\ """ except: errstr_8bit_path = u"""\ InputError: [Errno 2] No such file or directory: '\u043c\u0438\u0440.txt'.\ """ totest = {} totest['include'] = [ ["""\ Include Test ============ .. include:: %s A paragraph. """ % include1, """\ <document source="test data"> <section ids="include-test" names="include\ test"> <title> Include Test <section ids="inclusion-1" names="inclusion\ 1"> <title> Inclusion 1 <paragraph> This file is used by \n\ <literal> test_include.py . <paragraph> A paragraph. """], ["""\ Include Test ============ .. include:: %s :literal: :class: test :name: my name A paragraph. """ % include1, """\ <document source="test data"> <section ids="include-test" names="include\ test"> <title> Include Test <literal_block classes="test" ids="my-name" names="my\ name" source="%s" xml:space="preserve"> Inclusion 1 ----------- \n\ This file is used by ``test_include.py``. <paragraph> A paragraph. """ % reldir(include1)], ["""\ Literal include, add line numbers .. include:: %s :literal: :number-lines: """ % include1, """\ <document source="test data"> <paragraph> Literal include, add line numbers <literal_block source="%s" xml:space="preserve"> <inline classes="ln"> 1 \n\ Inclusion 1 <inline classes="ln"> 2 \n\ ----------- <inline classes="ln"> 3 \n\ \n\ <inline classes="ln"> 4 \n\ This file is used by ``test_include.py``. """ % reldir(include1)], ["""\ Include code .. include:: %s :code: :class: test :name: my name """ % include1, """\ <document source="test data"> <paragraph> Include code <literal_block classes="code test" ids="my-name" names="my\ name" source="%s" xml:space="preserve"> Inclusion 1 ----------- \n\ This file is used by ``test_include.py``. """ % reldir(include1)], ["""\ Include code, add line numbers .. include:: %s :code: :number-lines: """ % include1, """\ <document source="test data"> <paragraph> Include code, add line numbers <literal_block classes="code" source="%s" xml:space="preserve"> <inline classes="ln"> 1 \n\ Inclusion 1 <inline classes="ln"> 2 \n\ ----------- <inline classes="ln"> 3 \n\ \n\ <inline classes="ln"> 4 \n\ This file is used by ``test_include.py``. """ % reldir(include1)], ["""\ Let's test the parse context. This paragraph is in a block quote. .. include:: %s The included paragraphs should also be in the block quote. """ % include2, """\ <document source="test data"> <paragraph> Let's test the parse context. <block_quote> <paragraph> This paragraph is in a block quote. <paragraph> Here are some paragraphs that can appear at any level. <paragraph> This file (include2.txt) is used by <literal> test_include.py . <paragraph> The included paragraphs should also be in the block quote. """], ["""\ Include Test ============ .. include:: nonexistent.txt A paragraph. """, """\ <document source="test data"> <section ids="include-test" names="include\ test"> <title> Include Test <system_message level="4" line="4" source="test data" type="SEVERE"> <paragraph> Problems with "include" directive path: InputError: [Errno 2] No such file or directory: 'nonexistent.txt'. <literal_block xml:space="preserve"> .. include:: nonexistent.txt <paragraph> A paragraph. """], ["""\ Include Test ============ .. include:: %s .. include:: %s A paragraph. """ % (include1, include1), """\ <document source="test data"> <section ids="include-test" names="include\ test"> <title> Include Test <section dupnames="inclusion\ 1" ids="inclusion-1"> <title> Inclusion 1 <paragraph> This file is used by <literal> test_include.py . <section dupnames="inclusion\ 1" ids="id1"> <title> Inclusion 1 <system_message backrefs="id1" level="1" line="2" source="%s" type="INFO"> <paragraph> Duplicate implicit target name: "inclusion 1". <paragraph> This file is used by <literal> test_include.py . <paragraph> A paragraph. """ % reldir(include1)], ["""\ Include Test ============ .. include:: %s ---------- .. include:: %s A paragraph. """ % (include1, include1), """\ <document source="test data"> <section ids="include-test" names="include\ test"> <title> Include Test <section dupnames="inclusion\ 1" ids="inclusion-1"> <title> Inclusion 1 <paragraph> This file is used by \n\ <literal> test_include.py . <transition> <section dupnames="inclusion\ 1" ids="id1"> <title> Inclusion 1 <system_message backrefs="id1" level="1" line="2" source="%s" type="INFO"> <paragraph> Duplicate implicit target name: "inclusion 1". <paragraph> This file is used by \n\ <literal> test_include.py . <paragraph> A paragraph. """ % reldir(include1)], ["""\ In test data .. include:: %s """ % include3, """\ <document source="test data"> <paragraph> In test data <paragraph> In include3.txt <paragraph> In includes/include4.txt <paragraph> In includes/include5.txt <paragraph> In includes/more/include6.txt <paragraph> In includes/sibling/include7.txt """], ["""\ In test data Section ======= (Section contents in nested parse; slice of input_lines ViewList.) .. include:: %s """ % include3, """\ <document source="test data"> <paragraph> In test data <section ids="section" names="section"> <title> Section <paragraph> (Section contents in nested parse; slice of input_lines ViewList.) <paragraph> In include3.txt <paragraph> In includes/include4.txt <paragraph> In includes/include5.txt <paragraph> In includes/more/include6.txt <paragraph> In includes/sibling/include7.txt """], ["""\ Testing relative includes: .. include:: %s """ % include8, """\ <document source="test data"> <paragraph> Testing relative includes: <paragraph> In include8.txt <paragraph> In ../includes/include9.txt. <paragraph> Here are some paragraphs that can appear at any level. <paragraph> This file (include2.txt) is used by <literal> test_include.py . """], ["""\ Encoding: .. include:: %s :encoding: utf-16 """ % reldir(utf_16_file), b("""\ <document source="test data"> <paragraph> Encoding: <paragraph> "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?" """).decode('raw_unicode_escape')], ["""\ Include file is UTF-16-encoded, and is not valid ASCII. .. include:: %s :encoding: ascii """ % reldir(utf_16_file), """\ <document source="test data"> <paragraph> 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: %s <literal_block xml:space="preserve"> .. include:: %s :encoding: ascii """ % (utf_16_error_str, reldir(utf_16_file))], [u"""\ cyrillic filename: .. include:: \u043c\u0438\u0440.txt """, u"""\ <document source="test data"> <paragraph> cyrillic filename: <system_message level="4" line="3" source="test data" type="SEVERE"> <paragraph> Problems with "include" directive path: %s <literal_block xml:space="preserve"> .. include:: \u043c\u0438\u0440.txt """ % errstr_8bit_path], ["""\ Testing errors in included file: .. include:: %s """ % include10, """\ <document source="test data"> <paragraph> Testing errors in included file: <system_message level="3" line="1" source="%(source)s" type="ERROR"> <paragraph> Invalid character code: 0x11111111 %(unichr_exception)s <literal_block xml:space="preserve"> unicode:: 0x11111111 <system_message level="2" line="1" source="%(source)s" type="WARNING"> <paragraph> Substitution definition "bad" empty or invalid. <literal_block xml:space="preserve"> .. |bad| unicode:: 0x11111111 <section dupnames="hi" ids="hi"> <title> hi <block_quote> <paragraph> indent <system_message level="2" line="7" source="%(source)s" type="WARNING"> <paragraph> Block quote ends without a blank line; unexpected unindent. <paragraph> error <section dupnames="hi" ids="id1"> <title> hi <system_message backrefs="id1" level="1" line="10" source="%(source)s" type="INFO"> <paragraph> Duplicate implicit target name: "hi". <system_message level="4" line="12" source="%(source)s" type="SEVERE"> <paragraph> Problems with "include" directive path: InputError: [Errno 2] No such file or directory: '%(nonexistent)s'. <literal_block xml:space="preserve"> .. include:: <nonexistent> <system_message level="3" line="14" source="%(source)s" type="ERROR"> <paragraph> Content block expected for the "note" directive; none found. <literal_block xml:space="preserve"> .. note:: <system_message level="3" line="16" source="%(source)s" type="ERROR"> <paragraph> Content block expected for the "admonition" directive; none found. <literal_block xml:space="preserve"> .. admonition:: without title <system_message level="3" line="19" source="%(source)s" type="ERROR"> <paragraph> Content block expected for the "epigraph" directive; none found. <literal_block xml:space="preserve"> .. epigraph:: <system_message level="3" line="21" source="%(source)s" type="ERROR"> <paragraph> Content block expected for the "highlights" directive; none found. <literal_block xml:space="preserve"> .. highlights:: <system_message level="3" line="23" source="%(source)s" type="ERROR"> <paragraph> Content block expected for the "pull-quote" directive; none found. <literal_block xml:space="preserve"> .. pull-quote:: <system_message level="3" line="25" source="%(source)s" type="ERROR"> <paragraph> Invalid context: the "date" directive can only be used within a substitution definition. <literal_block xml:space="preserve"> .. date:: <paragraph> not a definition list: <system_message level="3" line="29" source="%(source)s" type="ERROR"> <paragraph> Unexpected indentation. <block_quote> <paragraph> as a term may only be one line long. <system_message level="3" line="31" source="%(source)s" type="ERROR"> <paragraph> Error in "admonition" directive: 1 argument(s) required, 0 supplied. <literal_block xml:space="preserve"> .. admonition:: without title and content following a blank line <section ids="section-underline-too-short" names="section\ underline\ too\ short"> <title> section underline too short <system_message level="2" line="36" source="%(source)s" type="WARNING"> <paragraph> Title underline too short. <literal_block xml:space="preserve"> section underline too short ----- <table> <tgroup cols="2"> <colspec colwidth="14"> <colspec colwidth="6"> <thead> <row> <entry> <paragraph> A simple table <entry> <paragraph> cell 2 <tbody> <row> <entry> <paragraph> cell 3 <entry> <paragraph> cell 4 <system_message level="2" line="43" source="%(source)s" type="WARNING"> <paragraph> Blank line required after table. <paragraph> No blank line after table. <system_message level="3" line="45" source="%(source)s" type="ERROR"> <paragraph> Error in "unicode" directive: 1 argument(s) required, 0 supplied. <literal_block xml:space="preserve"> unicode:: <system_message level="2" line="45" source="%(source)s" type="WARNING"> <paragraph> Substitution definition "empty" empty or invalid. <literal_block xml:space="preserve"> .. |empty| unicode:: <system_message level="3" line="47" source="%(source)s" type="ERROR"> <paragraph> Error in "topic" directive: 1 argument(s) required, 0 supplied. <literal_block xml:space="preserve"> .. topic:: <system_message level="3" line="49" source="%(source)s" type="ERROR"> <paragraph> Error in "rubric" directive: 1 argument(s) required, 0 supplied. <literal_block xml:space="preserve"> .. rubric:: <rubric> A rubric has no content <comment xml:space="preserve"> _`target: No matching backquote. <system_message level="2" line="52" source="%(source)s" type="WARNING"> <paragraph> malformed hyperlink target. <comment xml:space="preserve"> __malformed: no good <system_message level="2" line="53" source="%(source)s" type="WARNING"> <paragraph> malformed hyperlink target. <definition_list> <definition_list_item> <term> A literal block:: <definition> <system_message level="1" line="57" source="%(source)s" type="INFO"> <paragraph> Blank line missing before literal block (after the "::")? Interpreted as a definition list item. <paragraph> with no blank line above. <literal_block xml:space="preserve"> > A literal block. <system_message level="3" line="61" source="%(source)s" type="ERROR"> <paragraph> Inconsistent literal block quoting. <paragraph> $ with inconsistent quoting. <paragraph> <problematic ids="id3" refid="id2"> :unknown-role:`role` and <problematic ids="id5" refid="id4"> * unbalanced <problematic ids="id7" refid="id6"> ` inline <problematic ids="id9" refid="id8"> ** markup <system_message level="1" line="63" source="%(source)s" type="INFO"> <paragraph> No role entry for "unknown-role" in module "docutils.parsers.rst.languages.en". Trying "unknown-role" as canonical role name. <system_message backrefs="id3" ids="id2" level="3" line="63" source="%(source)s" type="ERROR"> <paragraph> Unknown interpreted text role "unknown-role". <system_message backrefs="id5" ids="id4" level="2" line="63" source="%(source)s" type="WARNING"> <paragraph> Inline emphasis start-string without end-string. <system_message backrefs="id7" ids="id6" level="2" line="63" source="%(source)s" type="WARNING"> <paragraph> Inline interpreted text or phrase reference start-string without end-string. <system_message backrefs="id9" ids="id8" level="2" line="63" source="%(source)s" type="WARNING"> <paragraph> Inline strong start-string without end-string. <paragraph> <problematic ids="id11" refid="id10"> :PEP:`-1` <system_message backrefs="id11" ids="id10" level="3" line="68" source="%(source)s" type="ERROR"> <paragraph> PEP number must be a number from 0 to 9999; "-1" is invalid. <system_message level="1" line="66" source="%(source)s" type="INFO"> <paragraph> No directive entry for "unknown" in module "docutils.parsers.rst.languages.en". Trying "unknown" as canonical directive name. <system_message level="3" line="70" source="%(source)s" type="ERROR"> <paragraph> Unknown directive type "unknown". <literal_block xml:space="preserve"> .. unknown:: directive (info still reported with wrong line) <system_message level="3" line="72" source="%(source)s" type="ERROR"> <paragraph> Malformed table. No bottom table border found. <literal_block xml:space="preserve"> ============== ====== A simple table with no bottom border """ % {'source': reldir(include10), 'nonexistent': reldir(nonexistent), 'unichr_exception': DocutilsTestSupport.exception_data(unichr, int("11111111", 16))[2] }], ["""\ Include file with whitespace in the path: .. include:: %s """ % reldir(include11), """\ <document source="test data"> <paragraph> Include file with whitespace in the path: <paragraph> some text """], ["""\ Standard include data file: .. include:: <isogrk4.txt> """, b("""\ <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 """).decode('raw_unicode_escape')], ["""\ Nonexistent standard include data file: .. include:: <nonexistent> """, """\ <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: InputError: [Errno 2] No such file or directory: '%s'. <literal_block xml:space="preserve"> .. include:: <nonexistent> """ % nonexistent_rel], ["""\ Include start-line/end-line Test .. include:: %s :start-line: 3 :end-line: 4 """ % include2, """\ <document source="test data"> <paragraph> Include start-line/end-line Test <paragraph> This file (include2.txt) is used by """], ["""\ Include start-line/end-line + start-after Test .. include:: %s :start-line: 2 :end-line: 5 :start-after: here Text search is limited to the specified lines. """ % include12, """\ <document source="test data"> <paragraph> Include start-line/end-line + start-after Test <paragraph> In include12.txt (after "start here", before "stop here") <paragraph> Text search is limited to the specified lines. """], ["""\ Include start-after/end-before Test .. include:: %s :start-after: .. start here :end-before: .. stop here A paragraph. """ % include12, """\ <document source="test data"> <paragraph> Include start-after/end-before Test <paragraph> In include12.txt (after "start here", before "stop here") <paragraph> A paragraph. """], ["""\ Include start-after/end-before Test, single option variant .. include:: %s :end-before: .. start here .. include:: %s :start-after: .. stop here A paragraph. """ % (include12, include12), """\ <document source="test data"> <paragraph> Include start-after/end-before Test, single option variant <paragraph> In include12.txt (but before "start here") <paragraph> In include12.txt (after "stop here") <paragraph> A paragraph. """], ["""\ Include start-after/end-before multi-line test. .. include:: %s :start-after: From: me To: you :end-before: ------- -- mork of ork .. include:: %s :start-after: From: me To: you :end-before: ------- -- mork of ork A paragraph. """ % (include13, include13), """\ <document source="test data"> <paragraph> Include start-after/end-before multi-line test. <system_message level="4" line="3" source="test data" type="SEVERE"> <paragraph> Problem with "end-before" option of "include" directive: Text not found. <literal_block xml:space="preserve"> .. include:: %s :start-after: From: me To: you :end-before: ------- -- mork of ork <paragraph> In include13.txt (between header and signature) <paragraph> A paragraph. """ % include13], ["""\ Error handling test; "end-before" error handling tested in previous test. .. include:: %s :start-after: bad string :end-before: mork of ork """ % include13, """\ <document source="test data"> <paragraph> Error handling test; "end-before" error handling tested in previous test. <system_message level="4" line="3" source="test data" type="SEVERE"> <paragraph> Problem with "start-after" option of "include" directive: Text not found. <literal_block xml:space="preserve"> .. include:: %s :start-after: bad string :end-before: mork of ork """ % include13], ["""\ TAB expansion with literal include: .. include:: %s :literal: """ % include_literal, """\ <document source="test data"> <paragraph> TAB expansion with literal include: <literal_block source="%s" xml:space="preserve"> Literal included this should **not** be *marked* `up`. <- leading raw tab. Newlines are normalized. """ % include_literal], ["""\ Custom TAB expansion with literal include: .. include:: %s :literal: :tab-width: 2 """ % include_literal, """\ <document source="test data"> <paragraph> Custom TAB expansion with literal include: <literal_block source="%s" xml:space="preserve"> Literal included this should **not** be *marked* `up`. <- leading raw tab. Newlines are normalized. """ % include_literal], ["""\ No TAB expansion with literal include: .. include:: %s :literal: :tab-width: -1 """ % include_literal, """\ <document source="test data"> <paragraph> No TAB expansion with literal include: <literal_block source="%s" xml:space="preserve"> Literal included this should **not** be *marked* `up`. \t<- leading raw tab. Newlines are normalized. """ % include_literal], ] totest['include-code'] = [ ["""\ Included code .. include:: %s :code: rst """ % include1, """\ <document source="test data"> <paragraph> Included code <literal_block classes="code rst" source="%s" xml:space="preserve"> <inline classes="generic heading"> Inclusion 1 \n\ <inline classes="generic heading"> ----------- \n\ \n\ This file is used by \n\ <inline classes="literal string"> ``test_include.py`` . """ % reldir(include1)], ["""\ Included code .. include:: %s :code: rst :number-lines: """ % include1, """\ <document source="test data"> <paragraph> Included code <literal_block classes="code rst" source="%s" xml:space="preserve"> <inline classes="ln"> 1 \n\ <inline classes="generic heading"> Inclusion 1 \n\ <inline classes="ln"> 2 \n\ <inline classes="generic heading"> ----------- \n\ <inline classes="ln"> 3 \n\ \n\ <inline classes="ln"> 4 \n\ This file is used by \n\ <inline classes="literal string"> ``test_include.py`` . """ % reldir(include1)], ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/test_sidebars.py���������������������������0000755�0001750�0001750�00000003561�11603172505�027742� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_sidebars.py 7062 2011-06-30 22:14:29Z milde $ # Author: David Goodger <goodger@python.org> # 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:: Margin Notes :subtitle: with options :class: margin :name: note:Options Body. """, """\ <document source="test data"> <sidebar classes="margin" ids="note-options" names="note:options"> <title> Margin Notes <subtitle> with options <paragraph> 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') �����������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/test_target_notes.py�����������������������0000755�0001750�0001750�00000003265�11603172505�030645� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_target_notes.py 7062 2011-06-30 22:14:29Z milde $ # Author: David Goodger <goodger@python.org> # Copyright: This module has been placed in the public domain. """ Tests for the target-notes directives. """ from __init__ import DocutilsTestSupport def suite(): s = DocutilsTestSupport.ParserTestSuite() s.generateTests(totest) return s totest = {} totest['target-notes'] = [ ["""\ .. target-notes:: """, """\ <document source="test data"> <pending> .. internal attributes: .transform: docutils.transforms.references.TargetNotes .details: """], ["""\ .. target-notes:: :class: custom """, """\ <document source="test data"> <pending> .. internal attributes: .transform: docutils.transforms.references.TargetNotes .details: class: ['custom'] """], ["""\ .. target-notes:: :class: custom :name: targets """, """\ <document source="test data"> <pending ids="targets" names="targets"> .. internal attributes: .transform: docutils.transforms.references.TargetNotes .details: class: ['custom'] """], ["""\ .. target-notes:: :class: """, """\ <document source="test data"> <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Error in "target-notes" directive: invalid option value: (option: "class"; value: None) argument required but none supplied. <literal_block xml:space="preserve"> .. target-notes:: :class: """], ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_directives/include3.txt�������������������������������0000644�0001750�0001750�00000000064�07566322044�027004� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������In include3.txt .. include:: includes/include4.txt ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_footnotes.py������������������������������������������0000755�0001750�0001750�00000022350�10434150472�024763� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_footnotes.py 4564 2006-05-21 20:44:42Z wiemann $ # Author: David Goodger <goodger@python.org> # 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['footnotes'] = [ ["""\ .. [1] This is a footnote. """, """\ <document source="test data"> <footnote ids="id1" names="1"> <label> 1 <paragraph> This is a footnote. """], ["""\ .. [1] This is a footnote on multiple lines. """, """\ <document source="test data"> <footnote ids="id1" names="1"> <label> 1 <paragraph> This is a footnote on multiple lines. """], ["""\ .. [1] This is a footnote on multiple lines with more space. .. [2] This is a footnote on multiple lines with less space. """, """\ <document source="test data"> <footnote ids="id1" names="1"> <label> 1 <paragraph> This is a footnote on multiple lines with more space. <footnote ids="id2" names="2"> <label> 2 <paragraph> This is a footnote on multiple lines with less space. """], ["""\ .. [1] This is a footnote on multiple lines whose block starts on line 2. """, """\ <document source="test data"> <footnote ids="id1" names="1"> <label> 1 <paragraph> This is a footnote on multiple lines whose block starts on line 2. """], ["""\ .. [1] That was an empty footnote. """, """\ <document source="test data"> <footnote ids="id1" names="1"> <label> 1 <paragraph> That was an empty footnote. """], ["""\ .. [1] No blank line. """, """\ <document source="test data"> <footnote ids="id1" names="1"> <label> 1 <system_message level="2" line="2" source="test data" type="WARNING"> <paragraph> Explicit markup ends without a blank line; unexpected unindent. <paragraph> No blank line. """], ] totest['auto_numbered_footnotes'] = [ ["""\ [#]_ is the first auto-numbered footnote reference. [#]_ is the second auto-numbered footnote reference. .. [#] Auto-numbered footnote 1. .. [#] Auto-numbered footnote 2. .. [#] Auto-numbered footnote 3. [#]_ is the third auto-numbered footnote reference. """, """\ <document source="test data"> <paragraph> <footnote_reference auto="1" ids="id1"> is the first auto-numbered footnote reference. <footnote_reference auto="1" ids="id2"> is the second auto-numbered footnote reference. <footnote auto="1" ids="id3"> <paragraph> Auto-numbered footnote 1. <footnote auto="1" ids="id4"> <paragraph> Auto-numbered footnote 2. <footnote auto="1" ids="id5"> <paragraph> Auto-numbered footnote 3. <paragraph> <footnote_reference auto="1" ids="id6"> is the third auto-numbered footnote reference. """], ["""\ [#third]_ is a reference to the third auto-numbered footnote. .. [#first] First auto-numbered footnote. .. [#second] Second auto-numbered footnote. .. [#third] Third auto-numbered footnote. [#second]_ is a reference to the second auto-numbered footnote. [#first]_ is a reference to the first auto-numbered footnote. [#third]_ is another reference to the third auto-numbered footnote. Here are some internal cross-references to the targets generated by the footnotes: first_, second_, third_. """, """\ <document source="test data"> <paragraph> <footnote_reference auto="1" ids="id1" refname="third"> is a reference to the third auto-numbered footnote. <footnote auto="1" ids="first" names="first"> <paragraph> First auto-numbered footnote. <footnote auto="1" ids="second" names="second"> <paragraph> Second auto-numbered footnote. <footnote auto="1" ids="third" names="third"> <paragraph> Third auto-numbered footnote. <paragraph> <footnote_reference auto="1" ids="id2" refname="second"> is a reference to the second auto-numbered footnote. <footnote_reference auto="1" ids="id3" refname="first"> is a reference to the first auto-numbered footnote. <footnote_reference auto="1" ids="id4" refname="third"> is another reference to the third auto-numbered footnote. <paragraph> Here are some internal cross-references to the targets generated by the footnotes: \n\ <reference name="first" refname="first"> first , \n\ <reference name="second" refname="second"> second , \n\ <reference name="third" refname="third"> third . """], ["""\ Mixed anonymous and labelled auto-numbered footnotes: [#four]_ should be 4, [#]_ should be 1, [#]_ should be 3, [#]_ is one too many, [#two]_ should be 2, and [#six]_ doesn't exist. .. [#] Auto-numbered footnote 1. .. [#two] Auto-numbered footnote 2. .. [#] Auto-numbered footnote 3. .. [#four] Auto-numbered footnote 4. .. [#five] Auto-numbered footnote 5. .. [#five] Auto-numbered footnote 5 again (duplicate). """, """\ <document source="test data"> <paragraph> Mixed anonymous and labelled auto-numbered footnotes: <paragraph> <footnote_reference auto="1" ids="id1" refname="four"> should be 4, \n\ <footnote_reference auto="1" ids="id2"> should be 1, <footnote_reference auto="1" ids="id3"> should be 3, \n\ <footnote_reference auto="1" ids="id4"> is one too many, <footnote_reference auto="1" ids="id5" refname="two"> should be 2, and \n\ <footnote_reference auto="1" ids="id6" refname="six"> doesn't exist. <footnote auto="1" ids="id7"> <paragraph> Auto-numbered footnote 1. <footnote auto="1" ids="two" names="two"> <paragraph> Auto-numbered footnote 2. <footnote auto="1" ids="id8"> <paragraph> Auto-numbered footnote 3. <footnote auto="1" ids="four" names="four"> <paragraph> Auto-numbered footnote 4. <footnote auto="1" dupnames="five" ids="five"> <paragraph> Auto-numbered footnote 5. <footnote auto="1" dupnames="five" ids="id9"> <system_message backrefs="id9" level="2" line="12" source="test data" type="WARNING"> <paragraph> Duplicate explicit target name: "five". <paragraph> Auto-numbered footnote 5 again (duplicate). """], ["""\ Mixed manually-numbered, anonymous auto-numbered, and labelled auto-numbered footnotes: [#four]_ should be 4, [#]_ should be 2, [1]_ is 1, [3]_ is 3, [#]_ should be 6, [#]_ is one too many, [#five]_ should be 5, and [#six]_ doesn't exist. .. [1] Manually-numbered footnote 1. .. [#] Auto-numbered footnote 2. .. [#four] Auto-numbered footnote 4. .. [3] Manually-numbered footnote 3 .. [#five] Auto-numbered footnote 5. .. [#five] Auto-numbered footnote 5 again (duplicate). .. [#] Auto-numbered footnote 6. """, """\ <document source="test data"> <paragraph> Mixed manually-numbered, anonymous auto-numbered, and labelled auto-numbered footnotes: <paragraph> <footnote_reference auto="1" ids="id1" refname="four"> should be 4, \n\ <footnote_reference auto="1" ids="id2"> should be 2, <footnote_reference ids="id3" refname="1"> 1 is 1, \n\ <footnote_reference ids="id4" refname="3"> 3 is 3, <footnote_reference auto="1" ids="id5"> should be 6, \n\ <footnote_reference auto="1" ids="id6"> is one too many, <footnote_reference auto="1" ids="id7" refname="five"> should be 5, and \n\ <footnote_reference auto="1" ids="id8" refname="six"> doesn't exist. <footnote ids="id9" names="1"> <label> 1 <paragraph> Manually-numbered footnote 1. <footnote auto="1" ids="id10"> <paragraph> Auto-numbered footnote 2. <footnote auto="1" ids="four" names="four"> <paragraph> Auto-numbered footnote 4. <footnote ids="id11" names="3"> <label> 3 <paragraph> Manually-numbered footnote 3 <footnote auto="1" dupnames="five" ids="five"> <paragraph> Auto-numbered footnote 5. <footnote auto="1" dupnames="five" ids="id12"> <system_message backrefs="id12" level="2" line="14" source="test data" type="WARNING"> <paragraph> Duplicate explicit target name: "five". <paragraph> Auto-numbered footnote 5 again (duplicate). <footnote auto="1" ids="id13"> <paragraph> Auto-numbered footnote 6. """], ] totest['auto_symbol_footnotes'] = [ ["""\ .. [*] This is an auto-symbol footnote. """, """\ <document source="test data"> <footnote auto="*" ids="id1"> <paragraph> This is an auto-symbol footnote. """], ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_interpreted.py����������������������������������������0000755�0001750�0001750�00000024134�12024637300�025267� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_interpreted.py 7514 2012-09-14 14:27:12Z milde $ # Author: David Goodger <goodger@python.org> # Copyright: This module has been placed in the public domain. """ Tests for interpreted text in docutils/parsers/rst/states.py. """ from __init__ import DocutilsTestSupport from docutils.utils.code_analyzer import with_pygments def suite(): s = DocutilsTestSupport.ParserTestSuite() if not with_pygments: del(totest['code-parsing']) s.generateTests(totest) return s totest = {} totest['basics'] = [ ["""\ `interpreted` """, """\ <document source="test data"> <paragraph> <title_reference> interpreted """], ["""\ :title:`interpreted` """, """\ <document source="test data"> <paragraph> <title_reference> interpreted """], ["""\ `interpreted`:title: """, """\ <document source="test data"> <paragraph> <title_reference> interpreted """], ["""\ `interpreted \`title`` """, """\ <document source="test data"> <paragraph> <title_reference> interpreted `title` """], ["""\ :title:`:not-role: interpreted` """, """\ <document source="test data"> <paragraph> <title_reference> :not-role: interpreted """], ["""\ `interpreted` but not \\`interpreted` [`] or ({[`] or [`]}) or ` """, """\ <document source="test data"> <paragraph> <title_reference> interpreted but not `interpreted` [`] or ({[`] or [`]}) or ` """], ["""\ `interpreted`-text `interpreted`: text `interpreted`:text `text`'s interpreted """, """\ <document source="test data"> <paragraph> <title_reference> interpreted -text \n\ <title_reference> interpreted : text \n\ <title_reference> interpreted :text \n\ <title_reference> text 's interpreted """], ["""\ `interpreted without closing backquote """, """\ <document source="test data"> <paragraph> <problematic ids="id2" refid="id1"> ` interpreted without closing backquote <system_message backrefs="id2" ids="id1" level="2" line="1" source="test data" type="WARNING"> <paragraph> Inline interpreted text or phrase reference start-string without end-string. """], ["""\ `interpreted`:not a role if it contains whitespace: """, """\ <document source="test data"> <paragraph> <title_reference> interpreted :not a role if it contains whitespace: """], ["""\ :title:`` (empty interpteted text not recognized) """, """\ <document source="test data"> <paragraph> :title:`` (empty interpteted text not recognized) """], ["""\ :title:`\ ` (interpteted text containing empty string) """, """\ <document source="test data"> <paragraph> <title_reference> (interpteted text containing empty string) """], ["""\ `\ `:title: (interpteted text containing empty string (postfix)) """, """\ <document source="test data"> <paragraph> <title_reference> (interpteted text containing empty string (postfix)) """], ["""\ :title:`\ non-empty` """, """\ <document source="test data"> <paragraph> <title_reference> non-empty """], ["""\ :title:`\ ` (trailing unquoted space) """, """\ <document source="test data"> <paragraph> :title: <problematic ids="id2" refid="id1"> ` ` (trailing unquoted space) <system_message backrefs="id2" ids="id1" level="2" line="1" source="test data" type="WARNING"> <paragraph> Inline interpreted text or phrase reference start-string without end-string. """], ["""\ Explicit roles for standard inline markup: :emphasis:`emphasis`, :strong:`strong`, :literal:`inline literal text`. """, """\ <document source="test data"> <paragraph> Explicit roles for standard inline markup: <emphasis> emphasis , <strong> strong , <literal> inline literal text . """], ["""\ Simple explicit roles: :ab:`abbreviation`, :ac:`acronym`, :sup:`superscript`, :sub:`subscript`, :title:`title reference`. """, """\ <document source="test data"> <paragraph> Simple explicit roles: <abbreviation> abbreviation , <acronym> acronym , <superscript> superscript , <subscript> subscript , <title_reference> title reference . """], ] totest['code'] = [ ["""\ Code role for inline code snippets: :code:`$\alpha = \int_0^\infty f(x) dx$`. """, """\ <document source="test data"> <paragraph> Code role for inline code snippets: <literal classes="code"> $\x07lpha = \\int_0^\\infty f(x) dx$ . """], ] totest['code-parsing'] = [ ["""\ .. role:: tex(code) :language: latex Custom role based on code role: :tex:`$\alpha = f(x)$`. """, """\ <document source="test data"> <paragraph> Custom role based on code role: <literal classes="code tex latex"> <inline classes="literal string"> $ <inline classes="name builtin"> \x07lpha \n\ <inline classes="operator"> = <inline classes="name builtin"> f <inline classes="operator"> ( <inline classes="name builtin"> x <inline classes="operator"> ) <inline classes="literal string"> $ . """], ["""\ Custom role based on code role: .. role:: python(code) :language: python :class: testclass Python code :python:`print("The end")`. """, """\ <document source="test data"> <paragraph> Custom role based on code role: <paragraph> Python code \n\ <literal classes="code testclass python"> <inline classes="keyword"> print <inline classes="punctuation"> ( <inline classes="literal string"> "The end" <inline classes="punctuation"> ) . """], ] totest['references'] = [ ["""\ :PEP:`0` """, """\ <document source="test data"> <paragraph> <reference refuri="http://www.python.org/dev/peps/pep-0000"> PEP 0 """], ["""\ :PEP:`-1` """, """\ <document source="test data"> <paragraph> <problematic ids="id2" refid="id1"> :PEP:`-1` <system_message backrefs="id2" ids="id1" level="3" line="1" source="test data" type="ERROR"> <paragraph> PEP number must be a number from 0 to 9999; "-1" is invalid. """], ["""\ :RFC:`2822` """, """\ <document source="test data"> <paragraph> <reference refuri="http://www.faqs.org/rfcs/rfc2822.html"> RFC 2822 """], ["""\ :RFC:`0` """, """\ <document source="test data"> <paragraph> <problematic ids="id2" refid="id1"> :RFC:`0` <system_message backrefs="id2" ids="id1" level="3" line="1" source="test data" type="ERROR"> <paragraph> RFC number must be a number greater than or equal to 1; "0" is invalid. """], ] totest['unknown_roles'] = [ ["""\ :role:`interpreted` """, """\ <document source="test data"> <paragraph> <problematic ids="id2" refid="id1"> :role:`interpreted` <system_message level="1" line="1" source="test data" type="INFO"> <paragraph> No role entry for "role" in module "docutils.parsers.rst.languages.en". Trying "role" as canonical role name. <system_message backrefs="id2" ids="id1" level="3" line="1" source="test data" type="ERROR"> <paragraph> Unknown interpreted text role "role". """], ["""\ `interpreted`:role: """, """\ <document source="test data"> <paragraph> <problematic ids="id2" refid="id1"> `interpreted`:role: <system_message level="1" line="1" source="test data" type="INFO"> <paragraph> No role entry for "role" in module "docutils.parsers.rst.languages.en". Trying "role" as canonical role name. <system_message backrefs="id2" ids="id1" level="3" line="1" source="test data" type="ERROR"> <paragraph> Unknown interpreted text role "role". """], ["""\ :role:`interpreted`:role: """, """\ <document source="test data"> <paragraph> <problematic ids="id2" refid="id1"> :role:`interpreted`:role: <system_message backrefs="id2" ids="id1" level="2" line="1" source="test data" type="WARNING"> <paragraph> Multiple roles in interpreted text (both prefix and suffix present; only one allowed). """], ["""\ :very.long-role_name:`interpreted` """, """\ <document source="test data"> <paragraph> <problematic ids="id2" refid="id1"> :very.long-role_name:`interpreted` <system_message level="1" line="1" source="test data" type="INFO"> <paragraph> No role entry for "very.long-role_name" in module "docutils.parsers.rst.languages.en". Trying "very.long-role_name" as canonical role name. <system_message backrefs="id2" ids="id1" level="3" line="1" source="test data" type="ERROR"> <paragraph> Unknown interpreted text role "very.long-role_name". """], ["""\ :restructuredtext-unimplemented-role:`interpreted` """, """\ <document source="test data"> <paragraph> <problematic ids="id2" refid="id1"> :restructuredtext-unimplemented-role:`interpreted` <system_message level="1" line="1" source="test data" type="INFO"> <paragraph> No role entry for "restructuredtext-unimplemented-role" in module "docutils.parsers.rst.languages.en". Trying "restructuredtext-unimplemented-role" as canonical role name. <system_message backrefs="id2" ids="id1" level="3" line="1" source="test data" type="ERROR"> <paragraph> Interpreted text role "restructuredtext-unimplemented-role" not implemented. """], ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_comments.py�������������������������������������������0000755�0001750�0001750�00000014703�10434150472�024573� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_comments.py 4564 2006-05-21 20:44:42Z wiemann $ # Author: David Goodger <goodger@python.org> # 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['comments'] = [ ["""\ .. A comment Paragraph. """, """\ <document source="test data"> <comment xml:space="preserve"> A comment <paragraph> Paragraph. """], ["""\ .. A comment block. Paragraph. """, """\ <document source="test data"> <comment xml:space="preserve"> A comment block. <paragraph> Paragraph. """], ["""\ .. A comment consisting of multiple lines starting on the line after the explicit markup start. """, """\ <document source="test data"> <comment xml:space="preserve"> A comment consisting of multiple lines starting on the line after the explicit markup start. """], ["""\ .. A comment. .. Another. Paragraph. """, """\ <document source="test data"> <comment xml:space="preserve"> A comment. <comment xml:space="preserve"> Another. <paragraph> Paragraph. """], ["""\ .. A comment no blank line Paragraph. """, """\ <document source="test data"> <comment xml:space="preserve"> A comment <system_message level="2" line="2" source="test data" type="WARNING"> <paragraph> Explicit markup ends without a blank line; unexpected unindent. <paragraph> no blank line <paragraph> Paragraph. """], ["""\ .. A comment. .. Another. no blank line Paragraph. """, """\ <document source="test data"> <comment xml:space="preserve"> A comment. <comment xml:space="preserve"> Another. <system_message level="2" line="3" source="test data" type="WARNING"> <paragraph> Explicit markup ends without a blank line; unexpected unindent. <paragraph> no blank line <paragraph> Paragraph. """], ["""\ .. A comment:: Paragraph. """, """\ <document source="test data"> <comment xml:space="preserve"> A comment:: <paragraph> Paragraph. """], ["""\ .. comment:: The extra newline before the comment text prevents the parser from recognizing a directive. """, """\ <document source="test data"> <comment xml:space="preserve"> comment:: <paragraph> The extra newline before the comment text prevents the parser from recognizing a directive. """], ["""\ .. _comment: http://example.org The extra newline before the comment text prevents the parser from recognizing a hyperlink target. """, """\ <document source="test data"> <comment xml:space="preserve"> _comment: http://example.org <paragraph> The extra newline before the comment text prevents the parser from recognizing a hyperlink target. """], ["""\ .. [comment] Not a citation. The extra newline before the comment text prevents the parser from recognizing a citation. """, """\ <document source="test data"> <comment xml:space="preserve"> [comment] Not a citation. <paragraph> The extra newline before the comment text prevents the parser from recognizing a citation. """], ["""\ .. |comment| image:: bogus.png The extra newline before the comment text prevents the parser from recognizing a substitution definition. """, """\ <document source="test data"> <comment xml:space="preserve"> |comment| image:: bogus.png <paragraph> The extra newline before the comment text prevents the parser from recognizing a substitution definition. """], ["""\ .. Next is an empty comment, which serves to end this comment and prevents the following block quote being swallowed up. .. A block quote. """, """\ <document source="test data"> <comment xml:space="preserve"> Next is an empty comment, which serves to end this comment and prevents the following block quote being swallowed up. <comment xml:space="preserve"> <block_quote> <paragraph> A block quote. """], ["""\ term 1 definition 1 .. a comment term 2 definition 2 """, """\ <document source="test data"> <definition_list> <definition_list_item> <term> term 1 <definition> <paragraph> definition 1 <comment xml:space="preserve"> a comment <definition_list_item> <term> term 2 <definition> <paragraph> definition 2 """], ["""\ term 1 definition 1 .. a comment term 2 definition 2 """, """\ <document source="test data"> <definition_list> <definition_list_item> <term> term 1 <definition> <paragraph> definition 1 <comment xml:space="preserve"> a comment <definition_list> <definition_list_item> <term> term 2 <definition> <paragraph> definition 2 """], ["""\ + bullet paragraph 1 bullet paragraph 2 .. comment between bullet paragraphs 2 and 3 bullet paragraph 3 """, """\ <document source="test data"> <bullet_list bullet="+"> <list_item> <paragraph> bullet paragraph 1 <paragraph> bullet paragraph 2 <comment xml:space="preserve"> comment between bullet paragraphs 2 and 3 <paragraph> bullet paragraph 3 """], ["""\ + bullet paragraph 1 .. comment between bullet paragraphs 1 (leader) and 2 bullet paragraph 2 """, """\ <document source="test data"> <bullet_list bullet="+"> <list_item> <paragraph> bullet paragraph 1 <comment xml:space="preserve"> comment between bullet paragraphs 1 (leader) and 2 <paragraph> bullet paragraph 2 """], ["""\ + bullet .. trailing comment """, """\ <document source="test data"> <bullet_list bullet="+"> <list_item> <paragraph> bullet <comment xml:space="preserve"> trailing comment """], ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') �������������������������������������������������������������docutils-0.11/test/test_parsers/test_rst/test_outdenting.py�����������������������������������������0000755�0001750�0001750�00000003721�10434150472�025124� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_outdenting.py 4564 2006-05-21 20:44:42Z wiemann $ # Author: David Goodger <goodger@python.org> # 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['outdenting'] = [ ["""\ Anywhere a paragraph would have an effect on the current indentation level, a comment or list item should also. + bullet This paragraph ends the bullet list item before a block quote. Block quote. """, """\ <document source="test data"> <paragraph> Anywhere a paragraph would have an effect on the current indentation level, a comment or list item should also. <bullet_list bullet="+"> <list_item> <paragraph> bullet <paragraph> This paragraph ends the bullet list item before a block quote. <block_quote> <paragraph> Block quote. """], ["""\ + bullet .. Comments swallow up all indented text following. (Therefore this is not a) block quote. - bullet If we want a block quote after this bullet list item, we need to use an empty comment: .. Block quote. """, """\ <document source="test data"> <bullet_list bullet="+"> <list_item> <paragraph> bullet <comment xml:space="preserve"> Comments swallow up all indented text following. \n\ (Therefore this is not a) block quote. <bullet_list bullet="-"> <list_item> <paragraph> bullet <paragraph> If we want a block quote after this bullet list item, we need to use an empty comment: <comment xml:space="preserve"> <block_quote> <paragraph> Block quote. """], ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') �����������������������������������������������docutils-0.11/test/test_parsers/test_parser.py������������������������������������������������������0000644�0001750�0001750�00000002241�11771146137�022372� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_parser.py 7463 2012-06-22 19:49:51Z milde $ # Author: Stefan Rank <strank(AT)strank(DOT)info> # Copyright: This module has been placed in the public domain. """ Tests for basic functionality of parser classes. """ import sys import unittest import DocutilsTestSupport # must be imported before docutils import docutils from docutils import parsers, utils, frontend from docutils._compat import b class RstParserTests(unittest.TestCase): def test_inputrestrictions(self): parser_class = parsers.get_parser_class('rst') parser = parser_class() document = utils.new_document('test data', frontend.OptionParser( components=(parser, )).get_default_values()) if sys.version_info < (3,): # supplying string input is supported, but only if ascii-decodable self.assertRaises(UnicodeDecodeError, parser.parse, b('hol%s' % chr(224)), document) else: # input must be unicode at all times self.assertRaises(TypeError, parser.parse, b('hol'), document) if __name__ == '__main__': unittest.main() ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_parsers/test_get_parser_class.py��������������������������������������������0000644�0001750�0001750�00000001561�12016623750�024414� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_get_parser_class.py 7504 2012-08-27 07:55:20Z grubert $ # Author: grubert abadger1999 # Maintainer: docutils-develop@lists.sourceforge.net # Copyright: This module has been placed in the public domain. """ test get_parser_class """ from __init__ import DocutilsTestSupport from docutils.parsers import get_parser_class class GetParserClassTestCase(DocutilsTestSupport.StandardTestCase): def test_registered_parser(self): rdr = get_parser_class('rst') # raises ImportError on failure def test_bogus_parser(self): self.assertRaises(ImportError, get_parser_class, 'nope') def test_local_parser(self): # requires local-parser.py in test directory (testroot) wr = get_parser_class('local-parser') if __name__ == '__main__': import unittest unittest.main() �����������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_writers/��������������������������������������������������������������������0000755�0001750�0001750�00000000000�12173162603�017477� 5����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_writers/test_odt.py���������������������������������������������������������0000755�0001750�0001750�00000014445�11712713765�021722� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env python # $Id: test_odt.py 7337 2012-02-03 08:16:53Z milde $ # Author: Dave Kuhlman <dkuhlman@rexx.com> # Copyright: This module has been placed in the public domain. """ Tests for docutils odtwriter. Instructions for adding a new test: 1. Add a new method to class DocutilsOdtTestCase (below) named test_odt_xxxx, where xxxx describes your new feature. See test_odt_basic for an example. 2. Add a new input reST (.txt) file in test/functional/input. This file should contain the smallest amount of reST that tests your new feature. Name this file odt_xxxx.txt. 3. Convert your input reST (.txt) file to an ODF (.odt) file using rst2odt.py. Place this ODF (.odt) file in test/functional/expected. Name this file odt_xxxx.odt. You can also pass parameter save_output_name='filename' to method process_test() in order to produce expected output. See and modify variable TEMP_FILE_PATH for destination. 4. Run your test. Your new test should pass. 5. If any other tests fail, that's a possible regression. """ import sys import os import StringIO import zipfile from xml.dom import minidom import tempfile from __init__ import DocutilsTestSupport import docutils import docutils.core from docutils._compat import BytesIO # # Globals TEMP_FILE_PATH = '/tmp' INPUT_PATH = 'functional/input/' EXPECTED_PATH = 'functional/expected/' class DocutilsOdtTestCase(DocutilsTestSupport.StandardTestCase): # # Check to see if we can import the needed XML library. # Report failure if we cannot. def check_import(self): WhichElementTree = '' try: # 1. Try to use lxml. #from lxml import etree #WhichElementTree = 'lxml' raise ImportError('Ignoring lxml') except ImportError, e: try: # 2. Try to use ElementTree from the Python standard library. from xml.etree import ElementTree as etree WhichElementTree = 'elementtree' except ImportError, e: try: # 3. Try to use a version of ElementTree installed as a separate # product. from elementtree import ElementTree as etree WhichElementTree = 'elementtree' except ImportError, e: s1 = '\nSkipped test of odf_odt writer. ' \ 'In order to test odf_odt writer ' \ 'must install either a version of Python containing ' \ 'ElementTree (Python version >=2.5) or ' \ 'install ElementTree.\n\n' #self.fail(s1) sys.stderr.write(s1) return WhichElementTree def process_test(self, input_filename, expected_filename, save_output_name=None, settings_overrides=None): if not self.check_import(): return # Test that xmlcharrefreplace is the default output encoding # error handler. input_file = open(INPUT_PATH + input_filename, 'rb') expected_file = open(EXPECTED_PATH + expected_filename, 'rb') input = input_file.read() expected = expected_file.read() input_file.close() expected_file.close() if settings_overrides is None: settings_overrides={ } result = docutils.core.publish_string( source=input, reader_name='standalone', writer_name='odf_odt', settings_overrides=settings_overrides) ## msg = 'file length not equal: expected length: %d actual length: %d' % ( ## len(expected), len(result), ) ## self.assertEqual(str(len(result)), str(len(expected))) if save_output_name: filename = '%s%s%s' % (TEMP_FILE_PATH, os.sep, save_output_name,) outfile = open(filename, 'w') outfile.write(result) outfile.close() content1 = self.extract_file(result, 'content.xml') content2 = self.extract_file(expected, 'content.xml') msg = 'content.xml not equal: expected len: %d actual len: %d' % ( len(content2), len(content1), ) self.assertEqual(content1, content2, msg) def extract_file(self, payload, filename): payloadfile = BytesIO() payloadfile.write(payload) payloadfile.seek(0) zfile = zipfile.ZipFile(payloadfile, 'r') content1 = zfile.read(filename) doc = minidom.parseString(content1) #content2 = doc.toprettyxml(indent=' ') content2 = doc.toxml() return content2 def assertEqual(self, first, second, msg=None): if msg is None: msg2 = msg else: sep = '+' * 60 msg1 = '\n%s\nresult:\n%s\n%s\nexpected:\n%s\n%s' % ( sep, first, sep, second, sep, ) #msg2 = '%s\n%s' % (msg1, msg, ) msg2 = '%s' % (msg, ) DocutilsTestSupport.StandardTestCase.assertEqual(self, first, second, msg2) # # Unit test methods # # All test methods should be named "test_odt_xxxx", where # xxxx is replaced with a name for the new test. # See instructions above in module doc-string. # def test_odt_basic(self): self.process_test('odt_basic.txt', 'odt_basic.odt', #save_output_name='odt_basic.odt' ) def test_odt_tables1(self): self.process_test('odt_tables1.txt', 'odt_tables1.odt', #save_output_name='odt_tables1.odt' ) def test_odt_custom_headfoot(self): settings_overrides = { 'custom_header': 'Page %p% of %P%', 'custom_footer': 'Title: %t% Date: %d3% Time: %t4%', } self.process_test('odt_custom_headfoot.txt', 'odt_custom_headfoot.odt', settings_overrides=settings_overrides, #save_output_name='odt_custom_headfoot.odt' ) # # Template for new tests. # Also add functional/input/odt_xxxx.txt and # functional/expected/odt_xxxx.odt # Replace all xxxx with name of your test. # ## def test_odt_xxxx(self): ## self.process_test('odt_xxxx.txt', 'odt_xxxx.odt') # ----------------------------------------------------------------- if __name__ == '__main__': import unittest unittest.main() ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/test_writers/test_get_writer_class.py��������������������������������������������0000644�0001750�0001750�00000001647�12142141314�024450� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env python # $Id: test_get_writer_class.py 7660 2013-05-07 09:01:00Z milde $ # Author: grubert # Maintainer: docutils-develop@lists.sourceforge.net # Copyright: This module has been placed in the public domain. """ test get_writer_class """ from __init__ import DocutilsTestSupport from docutils.writers import get_writer_class class GetWriterClassTestCase(DocutilsTestSupport.StandardTestCase): #tests = ( ('manpage', 1), ('nope', 0), ('dummy-writer', 1)) def test_registered_writer(self): wr = get_writer_class('manpage') # raises ImportError on failure def test_bogus_writer(self): self.assertRaises(ImportError, get_writer_class, 'nope') def test_local_writer(self): # requires local-writer.py in test directory (testroot) wr = get_writer_class('local-writer') if __name__ == '__main__': import unittest unittest.main() �����������������������������������������������������������������������������������������docutils-0.11/test/test_writers/test_s5.py����������������������������������������������������������0000755�0001750�0001750�00000010366�11763213420�021446� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env python # $Id: test_s5.py 7437 2012-06-04 20:14:08Z milde $ # Author: David Goodger <goodger@python.org> # Copyright: This module has been placed in the public domain. """ Tests for the S5/HTML writer. """ import os from __init__ import DocutilsTestSupport def suite(): settings = {'stylesheet_path': '/test.css', 'embed_stylesheet': 0,} s = DocutilsTestSupport.PublishTestSuite('s5', suite_settings=settings) s.generateTests(totest_1) settings['hidden_controls'] = 0 settings['view_mode'] = 'outline' s.generateTests(totest_2) return s interpolations = {'version': DocutilsTestSupport.docutils.__version__} totest_1 = {} totest_2 = {} totest_1['basics'] = [ ["""\ ============ Show Title ============ Title slide First Slide =========== Slide text. """, """\ <?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 %(version)s: http://docutils.sourceforge.net/" /> <meta name="version" content="S5 1.1" /> <title>Show Title

Show Title

Title slide

First Slide

Slide text.

""" % interpolations] ] totest_2['settings'] = [ ["""\ ================== Bogus Slide Show ================== We're just checking the settings """, """\ Bogus Slide Show

Bogus Slide Show

We're just checking the settings

""" % interpolations] ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') docutils-0.11/test/test_writers/test_html4css1_misc.py0000755000175000017500000001651012120720070023741 0ustar engelbertengelbert#! /usr/bin/env python # coding: utf-8 # $Id: test_html4css1_misc.py 7630 2013-03-15 22:27:04Z milde $ # Authors: Lea Wiemann, Dmitry Shachnev, Günter Milde # Maintainer: docutils-develop@lists.sourceforge.net # Copyright: This module has been placed in the public domain. """ Miscellaneous HTML writer tests. """ from __init__ import DocutilsTestSupport from docutils import core from docutils._compat import b 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': True,} result = core.publish_string( u'EUR = \u20ac', writer_name='html4css1', settings_overrides=settings_overrides) # Encoding a euro sign with latin1 doesn't work, so the # xmlcharrefreplace handler is used. self.assertIn(b('EUR = €'), result) class SettingsTestCase(DocutilsTestSupport.StandardTestCase): data = 'test' def test_default_stylesheet(self): # default style sheet, embedded mysettings = {'_disable_config': True,} styles = core.publish_parts(self.data, writer_name='html4css1', settings_overrides=mysettings)['stylesheet'] self.assertIn('Default cascading style sheet ' 'for the HTML output of Docutils.', styles) def test_default_stylesheet_linked(self): # default style sheet, linked mysettings = {'_disable_config': True, 'embed_stylesheet': False} styles = core.publish_parts(self.data, writer_name='html4css1', settings_overrides=mysettings)['stylesheet'] self.assertIn('docutils/writers/html4css1/html4css1.css', styles) def test_math_stylesheet_linked(self): # default + math style sheet, linked mysettings = {'_disable_config': True, 'embed_stylesheet': False, 'stylesheet_path': 'html4css1.css, math.css'} styles = core.publish_parts(self.data, writer_name='html4css1', settings_overrides=mysettings)['stylesheet'] self.assertIn('docutils/writers/html4css1/html4css1.css', styles) self.assertIn('docutils/writers/html4css1/math.css', styles) def test_custom_stylesheet_linked(self): # default + custom style sheet, linked mysettings = {'_disable_config': True, 'embed_stylesheet': False, 'stylesheet_path': 'html4css1.css, ' 'data/ham.css'} styles = core.publish_parts(self.data, writer_name='html4css1', settings_overrides=mysettings)['stylesheet'] self.assertIn('docutils/writers/html4css1/html4css1.css', styles) self.assertIn('href="data/ham.css"', styles) def test_custom_stylesheet_dir(self): mysettings = {'_disable_config': True, 'embed_stylesheet': False, 'stylesheet_dirs': ('../docutils/writers/html4css1/', 'data'), 'stylesheet_path': 'html4css1.css, ham.css'} styles = core.publish_parts(self.data, writer_name='html4css1', settings_overrides=mysettings)['stylesheet'] self.assertIn('docutils/writers/html4css1/html4css1.css', styles) self.assertIn('href="data/ham.css"', styles) def test_custom_stylesheet_dir_embedded(self): mysettings = {'_disable_config': True, 'embed_stylesheet': True, 'stylesheet_dirs': ('../docutils/writers/html4css1/', 'data'), 'stylesheet_path': 'ham.css'} styles = core.publish_parts(self.data, writer_name='html4css1', settings_overrides=mysettings)['stylesheet'] self.assertIn('dl.docutils dd {\n margin-bottom: 0.5em }', styles) class MathTestCase(DocutilsTestSupport.StandardTestCase): """Attention: This class tests the current implementation of maths support which is open to change in future Docutils releases. """ mathjax_script = ' .. csv-table:: :file: /etc/passwd .. csv-table:: :url: file:///etc/passwd .. figure:: picture.png :figwidth: image docutils-0.11/test/functional/expected/0000755000175000017500000000000012173162603020704 5ustar engelbertengelbertdocutils-0.11/test/functional/expected/standalone_rst_latex.tex0000644000175000017500000016066412141711510025650 0ustar engelbertengelbert\documentclass[a4paper]{article} % generated by Docutils \usepackage{fixltx2e} % LaTeX patches, \textsubscript \usepackage{cmap} % fix search and cut-and-paste in Acrobat \usepackage{ifthen} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{amsmath} \usepackage[british,french,ngerman,english]{babel} % Prevent side-effects if French hyphenation patterns are not loaded: \frenchbsetup{StandardLayout} \AtBeginDocument{\selectlanguage{english}\noextrasfrench} % basic code highlight: \providecommand*\DUrolecomment[1]{\textcolor[rgb]{0.40,0.40,0.40}{#1}} \providecommand*\DUroledeleted[1]{\textcolor[rgb]{0.40,0.40,0.40}{#1}} \providecommand*\DUrolekeyword[1]{\textbf{#1}} \providecommand*\DUrolestring[1]{\textit{#1}} \usepackage{color} \usepackage{float} % float configuration \floatplacement{figure}{H} % place figures here definitely \usepackage{graphicx} \usepackage{multirow} \usepackage{pifont} \setcounter{secnumdepth}{0} \usepackage{longtable,ltcaption,array} \setlength{\extrarowheight}{2pt} \newlength{\DUtablewidth} % internal use in tables \usepackage{tabularx} \usepackage{textcomp} % text symbol macros %%% Custom LaTeX preamble % PDF Standard Fonts \usepackage{mathptmx} % Times \usepackage[scaled=.90]{helvet} \usepackage{courier} %%% User specified packages and stylesheets %%% Fallback definitions for Docutils-specific commands % providelength (provide a length variable and set default, if it is new) \providecommand*{\DUprovidelength}[2]{ \ifthenelse{\isundefined{#1}}{\newlength{#1}\setlength{#1}{#2}}{} } % abstract title \providecommand*{\DUtitleabstract}[1]{\centerline{\textbf{#1}}} % admonition (specially marked topic) \providecommand{\DUadmonition}[2][class-arg]{% % try \DUadmonition#1{#2}: \ifcsname DUadmonition#1\endcsname% \csname DUadmonition#1\endcsname{#2}% \else \begin{center} \fbox{\parbox{0.9\textwidth}{#2}} \end{center} \fi } \makeatletter \@namedef{DUrolealign-center}{\centering} \makeatother % dedication topic \providecommand{\DUtopicdedication}[1]{\begin{center}#1\end{center}} % docinfo (width of docinfo table) \DUprovidelength{\DUdocinfowidth}{0.9\textwidth} % error admonition title \providecommand*{\DUtitleerror}[1]{\DUtitle{\color{red}#1}} % fieldlist environment \ifthenelse{\isundefined{\DUfieldlist}}{ \newenvironment{DUfieldlist}% {\quote\description} {\enddescription\endquote} }{} % numeric or symbol footnotes with hyperlinks \providecommand*{\DUfootnotemark}[3]{% \raisebox{1em}{\hypertarget{#1}{}}% \hyperlink{#2}{\textsuperscript{#3}}% } \providecommand{\DUfootnotetext}[4]{% \begingroup% \renewcommand{\thefootnote}{% \protect\raisebox{1em}{\protect\hypertarget{#1}{}}% \protect\hyperlink{#2}{#3}}% \footnotetext{#4}% \endgroup% } % inline markup (custom roles) % \DUrole{#1}{#2} tries \DUrole#1{#2} \providecommand*{\DUrole}[2]{% \ifcsname DUrole#1\endcsname% \csname DUrole#1\endcsname{#2}% \else% backwards compatibility: try \docutilsrole#1{#2} \ifcsname docutilsrole#1\endcsname% \csname docutilsrole#1\endcsname{#2}% \else% #2% \fi% \fi% } % legend environment \ifthenelse{\isundefined{\DUlegend}}{ \newenvironment{DUlegend}{\small}{} }{} % lineblock environment \DUprovidelength{\DUlineblockindent}{2.5em} \ifthenelse{\isundefined{\DUlineblock}}{ \newenvironment{DUlineblock}[1]{% \list{}{\setlength{\partopsep}{\parskip} \addtolength{\partopsep}{\baselineskip} \setlength{\topsep}{0pt} \setlength{\itemsep}{0.15\baselineskip} \setlength{\parsep}{0pt} \setlength{\leftmargin}{#1}} \raggedright } {\endlist} }{} % optionlist environment \providecommand*{\DUoptionlistlabel}[1]{\bf #1 \hfill} \DUprovidelength{\DUoptionlistindent}{3cm} \ifthenelse{\isundefined{\DUoptionlist}}{ \newenvironment{DUoptionlist}{% \list{}{\setlength{\labelwidth}{\DUoptionlistindent} \setlength{\rightmargin}{1cm} \setlength{\leftmargin}{\rightmargin} \addtolength{\leftmargin}{\labelwidth} \addtolength{\leftmargin}{\labelsep} \renewcommand{\makelabel}{\DUoptionlistlabel}} } {\endlist} }{} % rubric (informal heading) \providecommand*{\DUrubric}[2][class-arg]{% \subsubsection*{\centering\textit{\textmd{#2}}}} % sidebar (text outside the main text flow) \providecommand{\DUsidebar}[2][class-arg]{% \begin{center} \colorbox[gray]{0.80}{\parbox{0.9\textwidth}{#2}} \end{center} } % subtitle (for topic/sidebar) \providecommand*{\DUsubtitle}[2][class-arg]{\par\emph{#2}\smallskip} % title for topics, admonitions, unsupported section levels, and sidebar \providecommand*{\DUtitle}[2][class-arg]{% % call \DUtitle#1{#2} if it exists: \ifcsname DUtitle#1\endcsname% \csname DUtitle#1\endcsname{#2}% \else \smallskip\noindent\textbf{#2}\smallskip% \fi } % titlereference role \providecommand*{\DUroletitlereference}[1]{\textsl{#1}} % topic (quote with heading) \providecommand{\DUtopic}[2][class-arg]{% \ifcsname DUtopic#1\endcsname% \csname DUtopic#1\endcsname{#2}% \else \begin{quote}#2\end{quote} \fi } % transition (break, fancybreak, anonymous section) \providecommand*{\DUtransition}[1][class-arg]{% \hspace*{\fill}\hrulefill\hspace*{\fill} \vskip 0.5\baselineskip } % hyperlinks: \ifthenelse{\isundefined{\hypersetup}}{ \usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref} \urlstyle{same} % normal text font (alternatives: tt, rm, sf) }{} \hypersetup{ pdftitle={reStructuredText Test Document}, pdfauthor={David Goodger;Me;Myself;I} } %%% Title Data \title{\phantomsection% reStructuredText Test Document% \label{restructuredtext-test-document}% \label{doctitle}% \\ % subtitle% \large{Examples of Syntax Constructs}% \label{examples-of-syntax-constructs}% \label{subtitle}} \author{} \date{} %%% Body \begin{document} \maketitle % Docinfo \begin{center} \begin{tabularx}{\DUdocinfowidth}{lX} \textbf{Author}: & David Goodger \\ \textbf{Address}: & {\raggedright 123 Example Street\\ Example, EX Canada\\ A1B 2C3 } \\ \textbf{Contact}: & \href{mailto:goodger@python.org}{goodger@python.org} \\ \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} \DUtopic[dedication]{ \DUtitle[dedication]{Dedication} For Docutils users \& co-developers. } \DUtopic[abstract]{ \DUtitle[abstract]{Abstract} 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): \pagebreak[4] % start ToC on new page \phantomsection\label{table-of-contents} \pdfbookmark[1]{Table of Contents}{table-of-contents} \renewcommand{\contentsname}{Table of Contents} \tableofcontents \section{1~~~Structural Elements% \label{structural-elements}% } \subsection{1.1~~~Section Title% \label{section-title}% } \subsubsection*{Section Subtitle} Lone subsections are converted to a section subtitle by a transform activated with the \texttt{-{}-section-subtitles} command line option or the \texttt{sectsubtitle-xform} configuration value. \subsection{1.2~~~Empty Section% \label{empty-section}% } \subsection{1.3~~~Transitions% \label{transitions}% } Here’s a transition: %___________________________________________________________________________ \DUtransition It divides the section. Transitions may also occur between sections: %___________________________________________________________________________ \DUtransition \section{2~~~Body Elements% \label{body-elements}% } \subsection{2.1~~~Paragraphs% \label{paragraphs}% } A paragraph. \subsubsection{2.1.1~~~Inline Markup% \label{inline-markup}% } Paragraphs contain text and may contain inline markup: \emph{emphasis}, \textbf{strong emphasis}, \texttt{inline literals}, standalone hyperlinks (\url{http://www.python.org}), external hyperlinks (\href{http://www.python.org/}{Python}\DUfootnotemark{id30}{id29}{5}), internal cross-references (\hyperref[example]{example}), external hyperlinks with embedded URIs (\href{http://www.python.org}{Python web site}), \href{http://www.python.org/}{anonymous hyperlink references}\DUfootnotemark{id38}{id29}{5} (\href{http://docutils.sourceforge.net/}{a second reference}\DUfootnotemark{id40}{id39}{8}), footnote references (manually numbered\DUfootnotemark{id1}{id8}{1}, anonymous auto-numbered\DUfootnotemark{id2}{id12}{3}, labeled auto-numbered\DUfootnotemark{id3}{label}{2}, or symbolic\DUfootnotemark{id4}{id13}{*}), citation references (\hyperlink{cit2002}{[CIT2002]}), substitution references (\includegraphics{../../../docs/user/rst/images/biohazard.png}), and % \phantomsection\label{inline-hyperlink-targets}inline hyperlink targets (see \hyperref[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 % \raisebox{1em}{\hypertarget{id28}{}}\hyperlink{id27}{\textbf{\color{red}|problematic|}} text (generated by processing errors; this one is intentional). Here is a reference to the \hyperref[doctitle]{doctitle} and the \hyperref[subtitle]{subtitle}. The default role for interpreted text is \DUroletitlereference{Title Reference}. Here are some explicit interpreted text roles: a PEP reference (\href{http://www.python.org/dev/peps/pep-0287}{PEP 287}); an RFC reference (\href{http://www.faqs.org/rfcs/rfc2822.html}{RFC 2822}); an abbreviation (\DUrole{abbreviation}{abb.}), an acronym (\DUrole{acronym}{reST}), code (\texttt{\DUrole{code}{print \textquotedbl{}hello world\textquotedbl{}}}); a \textsubscript{subscript}; a \textsuperscript{superscript} and explicit roles for \DUroletitlereference{Docutils}’ \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. \subsection{2.2~~~Bullet Lists% \label{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. \item This nested list should be compacted by the HTML writer. % \phantomsection\label{target} % Even if this item contains a target and a comment. \end{itemize} \end{itemize} \subsection{2.3~~~Enumerated Lists% \label{enumerated-lists}% } \newcounter{listcnt0} \begin{list}{\arabic{listcnt0}.} { \usecounter{listcnt0} \setlength{\rightmargin}{\leftmargin} } \item Arabic numerals. \newcounter{listcnt1} \begin{list}{\alph{listcnt1})} { \usecounter{listcnt1} \setlength{\rightmargin}{\leftmargin} } \item lower alpha) \newcounter{listcnt2} \begin{list}{(\roman{listcnt2})} { \usecounter{listcnt2} \setlength{\rightmargin}{\leftmargin} } \item (lower roman) \newcounter{listcnt3} \begin{list}{\Alph{listcnt3}.} { \usecounter{listcnt3} \setlength{\rightmargin}{\leftmargin} } \item upper alpha. \newcounter{listcnt4} \begin{list}{\Roman{listcnt4})} { \usecounter{listcnt4} \setlength{\rightmargin}{\leftmargin} } \item upper roman) \end{list} \end{list} \end{list} \end{list} \item Lists that don’t start at 1: \setcounter{listcnt1}{0} \begin{list}{\arabic{listcnt1}.} { \usecounter{listcnt1} \addtocounter{listcnt1}{2} \setlength{\rightmargin}{\leftmargin} } \item Three \item Four \end{list} \setcounter{listcnt1}{0} \begin{list}{\Alph{listcnt1}.} { \usecounter{listcnt1} \addtocounter{listcnt1}{2} \setlength{\rightmargin}{\leftmargin} } \item C \item D \end{list} \setcounter{listcnt1}{0} \begin{list}{\roman{listcnt1}.} { \usecounter{listcnt1} \addtocounter{listcnt1}{2} \setlength{\rightmargin}{\leftmargin} } \item iii \item iv \end{list} \end{list} \subsection{2.4~~~Definition Lists% \label{definition-lists}% } % \begin{description} \item[{Term}] \leavevmode Definition \item[{Term}] \leavevmode (\textbf{classifier}) Definition paragraph 1. Definition paragraph 2. \item[{Term}] \leavevmode Definition \item[{Term}] \leavevmode (\textbf{classifier one}) (\textbf{classifier two}) Definition \end{description} \subsection{2.5~~~Field Lists% \label{field-lists}% } % \begin{DUfieldlist} \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. \item[{credits:}] \DUrole{credits}{This paragraph has the \DUroletitlereference{credits} class set. (This is actually not about credits but just for ensuring that the class attribute doesn’t get stripped away.)} \end{DUfieldlist} \subsection{2.6~~~Option Lists% \label{option-lists}% } For listing command-line options: % \begin{DUoptionlist} \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{DUoptionlist} There must be at least two spaces between the option and the description. \subsection{2.7~~~Literal Blocks% \label{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{quote}{\ttfamily \raggedright \noindent if~literal\_block:\\ ~~~~text~=~'is~left~as-is'\\ ~~~~spaces\_and\_linebreaks~=~'are~preserved'\\ ~~~~markup\_processing~=~None } \end{quote} Or they can be quoted without indentation: % \begin{quote}{\ttfamily \raggedright \noindent >{}>~Great~idea!\\ >\\ >~Why~didn't~I~think~of~that? } \end{quote} \subsection{2.8~~~Line Blocks% \label{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. \begin{DUlineblock}{0em} \item[] This is a line block. It ends with a blank line. \item[] \begin{DUlineblock}{\DUlineblockindent} \item[] New lines begin with a vertical bar (“|”). \item[] Line breaks and initial indent are significant, and preserved. \item[] \begin{DUlineblock}{\DUlineblockindent} \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{DUlineblock} \item[] The left edge of a continuation line need not be aligned with the left edge of the text above it. \end{DUlineblock} \end{DUlineblock} \begin{DUlineblock}{0em} \item[] This is a second line block. \item[] \item[] Blank lines are permitted internally, but they must begin with a “|”. \end{DUlineblock} Another line block, surrounded by paragraphs: \begin{DUlineblock}{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 \item[] They don’t fall in the lap of no-one \end{DUlineblock} Take it away, Eric the Orchestra Leader! % \begin{quote} \begin{DUlineblock}{0em} \item[] A one, two, a one two three four \item[] \item[] Half a bee, philosophically, \item[] \begin{DUlineblock}{\DUlineblockindent} \item[] must, \emph{ipso facto}, half not be. \end{DUlineblock} \item[] But half the bee has got to be, \item[] \begin{DUlineblock}{\DUlineblockindent} \item[] \emph{vis a vis} its entity. D’you see? \item[] \end{DUlineblock} \item[] But can a bee be said to be \item[] \begin{DUlineblock}{\DUlineblockindent} \item[] or not to be an entire bee, \item[] \begin{DUlineblock}{\DUlineblockindent} \item[] when half the bee is not a bee, \item[] \begin{DUlineblock}{\DUlineblockindent} \item[] due to some ancient injury? \item[] \end{DUlineblock} \end{DUlineblock} \end{DUlineblock} \item[] Singing… \end{DUlineblock} \end{quote} A line block, like the following poem by Christian Morgenstern, can also be centre-aligned: \begin{DUlineblock}{0em} \foreignlanguage{ngerman}{\DUrole{align-center}{ \item[] \textbf{Die Trichter} \item[] \item[] Zwei Trichter wandeln durch die Nacht. \item[] Durch ihres Rumpfs verengten Schacht \item[] fließt weißes Mondlicht \item[] still und heiter \item[] auf ~ ihren \item[] Waldweg \item[] u. s. \item[] w. \item[] }} \end{DUlineblock} \subsection{2.9~~~Block Quotes% \label{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. \nopagebreak \raggedleft —Anne Elk (Miss) \end{quote} The language of a quote (like any other object) can be specified by a class attribute: % % \begin{quote} \foreignlanguage{french}{ ReStructuredText est un langage de balisage léger utilisé notamment dans la documentation du langage Python. } \end{quote} \subsection{2.10~~~Doctest Blocks% \label{doctest-blocks}% } % \begin{quote}{\ttfamily \raggedright \noindent >{}>{}>~print~'Python-specific~usage~examples;~begun~with~\textquotedbl{}>{}>{}>\textquotedbl{}'\\ Python-specific~usage~examples;~begun~with~\textquotedbl{}>{}>{}>\textquotedbl{}\\ >{}>{}>~print~'(cut~and~pasted~from~interactive~Python~sessions)'\\ (cut~and~pasted~from~interactive~Python~sessions) } \end{quote} \subsection{2.11~~~Footnotes% \label{footnotes}% } % \DUfootnotetext{id8}{id1}{1}{% A footnote contains body elements, consistently indented by at least 3 spaces. This is the footnote’s second paragraph. } % \DUfootnotetext{label}{id3}{2}{\phantomsection\label{label}% Footnotes may be numbered, either manually (as in\DUfootnotemark{id9}{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 (\DUfootnotemark{id10}{label}{2}) and as a \hyperref[label]{hyperlink reference}. } % \DUfootnotetext{id12}{id2}{3}{% This footnote is numbered automatically and anonymously using a label of “\#” only. This is the second paragraph. And this is the third paragraph. } % \DUfootnotetext{id13}{id4}{*}{% Footnotes may also use symbols, specified with a “*” label. Here’s a reference to the next footnote:\DUfootnotemark{id14}{id15}{†}. } % \DUfootnotetext{id15}{id14}{†}{% This footnote shows the next symbol in the sequence. } % \DUfootnotetext{id16}{id16}{4}{% Here’s an unreferenced footnote, with a reference to a nonexistent footnote:% \raisebox{1em}{\hypertarget{id46}{}}% \raisebox{1em}{\hypertarget{id17}{}}\hyperlink{id45}{\textbf{\color{red}{[}5{]}\_}}. } \subsection{2.12~~~Citations% \label{citations}% } \begin{figure}[b]\raisebox{1em}{\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 % \raisebox{1em}{\hypertarget{id48}{}}% \raisebox{1em}{\hypertarget{id19}{}}\hyperlink{id47}{\textbf{\color{red}{[}nonexistent{]}\_}} citation. \subsection{2.13~~~Targets% \label{targets}% \label{another-target}% } \phantomsection\label{example} This paragraph is pointed to by the explicit “example” target. A reference can be found under \hyperref[inline-markup]{Inline Markup}, above. \hyperref[inline-hyperlink-targets]{Inline hyperlink targets} are also possible. Section headers are implicit targets, referred to by name. See \hyperref[targets]{Targets}, which is a subsection of \hyperref[body-elements]{Body Elements}. Explicit external targets are interpolated into references such as “\href{http://www.python.org/}{Python}\DUfootnotemark{id31}{id29}{5}”. Targets may be indirect and anonymous. Thus \hyperref[targets]{this phrase} may also refer to the \hyperref[targets]{Targets} section. Here’s a % \raisebox{1em}{\hypertarget{id50}{}}\hyperlink{id49}{\textbf{\color{red}`hyperlink reference without a target`\_}}, which generates an error. \subsubsection{2.13.1~~~Duplicate Target Names% \label{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. \subsubsection{2.13.2~~~Duplicate Target Names% \label{id21}% } 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: % \raisebox{1em}{\hypertarget{id52}{}}\hyperlink{id51}{\textbf{\color{red}`Duplicate Target Names`\_}}), an error is generated. \subsection{2.14~~~Directives% \label{directives}% } \phantomsection\label{contents} These are just a sample of the many reStructuredText Directives. For others, please see \url{http://docutils.sourceforge.net/docs/ref/rst/directives.html}. \subsubsection{2.14.1~~~Document Parts% \label{document-parts}% } An example of the “contents” directive can be seen above this section (a local, untitled table of \hyperref[contents]{contents}) and at the beginning of the document (a document-wide \hyperref[table-of-contents]{table of contents}). \subsubsection{2.14.2~~~Images and Figures% \label{images-and-figures}% } An image directive (also clickable – a hyperlink reference): \hyperref[directives]{\includegraphics{../../../docs/user/rst/images/title.png}} Image with multiple IDs: \includegraphics{../../../docs/user/rst/images/title.png} \phantomsection\label{image-target-3}\label{image-target-2}\label{image-target-1} A centered image: \noindent\makebox[\textwidth][c]{\includegraphics{../../../docs/user/rst/images/biohazard.png}} A left-aligned image: \noindent{\includegraphics{../../../docs/user/rst/images/biohazard.png}\hfill} This paragraph might flow around the image. The specific behavior depends upon the style sheet and the browser or rendering software used. A right-aligned image: \noindent{\hfill\includegraphics{../../../docs/user/rst/images/biohazard.png}} This paragraph might flow around the image. The specific behavior depends upon the style sheet and the browser or rendering software used. For inline images see \hyperref[substitution-definitions]{Substitution Definitions}. Image size: An image 2 em wide: \includegraphics[width=2em]{../../../docs/user/rst/images/biohazard.png} An image 2 em wide and 15 pixel high: \includegraphics[height=15px,width=2em]{../../../docs/user/rst/images/biohazard.png} An image occupying 50\% of the line width: \includegraphics[width=0.500\linewidth]{../../../docs/user/rst/images/title.png} An image 2 cm high: \includegraphics[height=2cm]{../../../docs/user/rst/images/biohazard.png} A \emph{figure} is an image with a caption and/or a legend. With page-based output media, figures might float to a different position if this helps the page layout. \begin{figure} \noindent\makebox[\textwidth][c]{\includegraphics[width=258bp]{../../../docs/user/rst/images/title.png}} \caption{Plaintext markup syntax and parser system.} \begin{DUlegend} \setlength{\DUtablewidth}{\linewidth} \begin{longtable*}[c]{|p{0.156\DUtablewidth}|p{0.563\DUtablewidth}|} \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{DUlegend} \end{figure} A left-aligned figure: \begin{figure} % align = "left" \noindent\makebox[\textwidth][c]{\includegraphics[width=40px]{../../../docs/user/rst/images/biohazard.png}} \caption{This is the caption.} \begin{DUlegend} This is the legend. The legend may consist of several paragraphs. \end{DUlegend} \end{figure} This paragraph might flow around the figure. The specific behavior depends upon the style sheet and the browser or rendering software used. A centered figure: \begin{figure} \noindent\makebox[\textwidth][c]{\includegraphics[width=40px]{../../../docs/user/rst/images/biohazard.png}} \caption{This is the caption.} \begin{DUlegend} This is the legend. The legend may consist of several paragraphs. \end{DUlegend} \end{figure} This paragraph might flow around the figure. The specific behavior depends upon the style sheet and the browser or rendering software used. A right-aligned figure: \begin{figure} % align = "right" \noindent\makebox[\textwidth][c]{\includegraphics[width=40px]{../../../docs/user/rst/images/biohazard.png}} \caption{This is the caption.} \begin{DUlegend} This is the legend. The legend may consist of several paragraphs. \end{DUlegend} \end{figure} This paragraph might flow around the figure. The specific behavior depends upon the style sheet and the browser or rendering software used. \subsubsection{2.14.3~~~Admonitions% \label{admonitions}% } \DUadmonition[attention]{ \DUtitle[attention]{Attention!} Directives at large. } \DUadmonition[caution]{ \DUtitle[caution]{Caution!} Don’t take any wooden nickels. } \DUadmonition[danger]{ \DUtitle[danger]{!DANGER!} Mad scientist at work! } \DUadmonition[error]{ \DUtitle[error]{Error} Does not compute. } \DUadmonition[hint]{ \DUtitle[hint]{Hint} It’s bigger than a bread box. } \DUadmonition[important]{ \DUtitle[important]{Important} % \begin{itemize} \item Wash behind your ears. \item Clean up your room. \item Call your mother. \item Back up your data. \end{itemize} } \DUadmonition[note]{ \DUtitle[note]{Note} This is a note. } \DUadmonition[tip]{ \DUtitle[tip]{Tip} 15\% if the service is good. } \DUadmonition[warning]{ \DUtitle[warning]{Warning} Strong prose may provoke extreme mental exertion. Reader discretion is strongly advised. } \DUadmonition[admonition-and-by-the-way]{ \DUtitle[admonition-and-by-the-way]{And, by the way…} You can make up your own admonition too. } \subsubsection{2.14.4~~~Topics, Sidebars, and Rubrics% \label{topics-sidebars-and-rubrics}% } \emph{Sidebars} are like miniature, parallel documents. \DUsidebar{ \DUtitle[title]{Sidebar Title} \DUsubtitle[sidebar]{Optional Subtitle} This is a sidebar. It is for text outside the flow of the main text. \DUrubric{This is a rubric inside a sidebar} Sidebars often appear beside the main text with a border and a different background or font color. } A \emph{topic} is like a block quote with a title, or a self-contained section with no subsections. \DUtopic[]{ \DUtitle[title]{Topic Title} This is a topic. } A \emph{rubric} is like an informal heading that doesn’t correspond to the document’s structure. It is typically highlighted in red (hence the name). \DUrubric{This is a rubric} Topics and rubrics can be used at places where a \hyperref[section-title]{section title} is not allowed (e.g. inside a directive). \subsubsection{2.14.5~~~Target Footnotes% \label{target-footnotes}% } % \DUfootnotetext{id29}{id30}{5}{% \url{http://www.python.org/} } % \DUfootnotetext{id33}{id34}{6}{% \url{http://pygments.org/} } % \DUfootnotetext{id35}{id36}{7}{% \url{ftp://ftp.ams.org/ams/doc/amsmath/short-math-guide.pdf} } % \DUfootnotetext{id39}{id40}{8}{% \url{http://docutils.sourceforge.net/} } % \DUfootnotetext{id41}{id42}{9}{% \url{A:DOS\\path\\} } \subsubsection{2.14.6~~~Replacement Text% \label{replacement-text}% } I recommend you try \href{http://www.python.org/}{Python, \emph{the} best language around}\DUfootnotemark{id32}{id29}{5}. \subsubsection{2.14.7~~~Compound Paragraph% \label{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. 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). Compound 6, block 2 in compound 5. Compound 6, another paragraph. Compound 5, block 3 (a paragraph). Compound 7, with a table inside: \setlength{\DUtablewidth}{\linewidth} \begin{longtable*}[c]{|p{0.249\DUtablewidth}|p{0.249\DUtablewidth}|p{0.249\DUtablewidth}|} \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. \subsubsection{2.14.8~~~Parsed Literal Blocks% \label{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\DUfootnotemark{id22}{id8}{1},~% \phantomsection\label{hyperlink-targets}hyperlink~targets,~and~\href{http://www.python.org/}{references}. } \end{quote} \subsubsection{2.14.9~~~Code% \label{code}% } Blocks of source code can be set with the \DUroletitlereference{code} directive. If the code language is specified, the content is parsed and tagged by the \href{http://pygments.org/}{Pygments}\DUfootnotemark{id34}{id33}{6} syntax highlighter and can be formatted with a style sheet. (Code parsing is turned off using the \texttt{syntax-highlight} config setting in the test conversions in order to get identical results with/without installed Pygments highlighter.) % \begin{quote}{\ttfamily \raggedright \noindent print~'This~is~Python~code.' } \end{quote} The \texttt{:number-lines:} option (with optional start value) generates line numbers: % \begin{quote}{\ttfamily \raggedright \noindent \DUrole{ln}{~8~}\#~print~integers~from~0~to~9:\\ \DUrole{ln}{~9~}for~i~in~range(10):\\ \DUrole{ln}{10~}~~~~print~i } \end{quote} For inline code snippets, there is the \DUroletitlereference{code} role, which can be used directly (the code will not be parsed/tagged, as the language is not known) or as base for special code roles, e.g. the LaTeX code in the next paragraph. Docutils uses LaTeX syntax for math directives and roles: \texttt{\DUrole{code}{\DUrole{tex}{\textbackslash{}alpha = f(x)}}} prints $\alpha = f(x)$. The \texttt{:code:} option of the \DUroletitlereference{include} directive sets the included content as a code block, here the rst file \texttt{header\_footer.txt} with line numbers: % \begin{quote}{\ttfamily \raggedright \noindent \DUrole{ln}{1~}..~header::~Document~header\\ \DUrole{ln}{2~}..~footer::~Document~footer } \end{quote} \subsection{2.15~~~Substitution Definitions% \label{substitution-definitions}% } An inline image (\includegraphics{../../../docs/user/rst/images/biohazard.png}) example: (Substitution definitions are not visible in the HTML source.) \subsection{2.16~~~Comments% \label{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. % % Comments may contain non-ASCII characters: ä ö ü æ ø å (View the HTML source to see the comment.) \subsection{2.17~~~Raw text% \label{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. \DUrole{myclass}{Another test with myclass set.} This is the \DUrole{myrawroleclass}{fourth test} with myrawroleclass set. Fifth test in LaTeX.\\Line two. \subsection{2.18~~~Container% \label{container}% } paragraph 1 paragraph 2 % currently not implemented in LaTeX: % .. include:: data/header_footer.txt \subsection{2.19~~~Colspanning tables% \label{colspanning-tables}% } This table has a cell spanning two columns: \setlength{\DUtablewidth}{\linewidth} \begin{longtable*}[c]{|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|p{0.086\DUtablewidth}|} \hline \multicolumn{2}{|p{0.15\DUtablewidth}|}{\textbf{% Inputs }} & \textbf{% Output } \\ \hline \textbf{% A } & \textbf{% B } & \textbf{% A or B } \\ \hline \endfirsthead \hline \multicolumn{2}{|p{0.15\DUtablewidth}|}{\textbf{% Inputs }} & \textbf{% Output } \\ \hline \textbf{% A } & \textbf{% B } & \textbf{% A or B } \\ \hline \endhead \multicolumn{3}{c}{\hfill ... continued on next page} \\ \endfoot \endlastfoot False & False & False \\ \hline True & False & True \\ \hline False & True & True \\ \hline True & True & True \\ \hline \end{longtable*} \subsection{2.20~~~Rowspanning tables% \label{rowspanning-tables}% } Here’s a table with cells spanning several rows: \setlength{\DUtablewidth}{\linewidth} \begin{longtable*}[c]{|p{0.296\DUtablewidth}|p{0.156\DUtablewidth}|p{0.226\DUtablewidth}|} \hline \textbf{% Header row, column 1 (header rows optional) } & \textbf{% Header 2 } & \textbf{% Header 3 } \\ \hline \endfirsthead \hline \textbf{% Header row, column 1 (header rows optional) } & \textbf{% Header 2 } & \textbf{% Header 3 } \\ \hline \endhead \multicolumn{3}{c}{\hfill ... continued on next page} \\ \endfoot \endlastfoot body row 1, column 1 & column 2 & column 3 \\ \hline body row 2 & \multirow{2}{0.16\DUtablewidth}{% Cells may span rows. } & \multirow{2}{0.23\DUtablewidth}{% Another rowspanning cell. } \\ \cline{1-1} body row 3 & \\ \hline \end{longtable*} \subsection{2.21~~~Custom Roles% \label{custom-roles}% } % \begin{itemize} \item A role based on an existing role. \texttt{\DUrole{custom}{one}} \texttt{\DUrole{custom}{two}} \texttt{\DUrole{custom}{three}} \item A new role. \DUrole{customnew}{one two three} \item A role with class attribute. \DUrole{special}{interpreted text} \item A language-switching role: Let’s count in German \foreignlanguage{ngerman}{eins zwei drei}. \item A role with multiple class attributes, styled with raw directives: \newcommand{\DUrolegreen}[1]{\textcolor{green}{#1}} \newcommand{\DUrolesc}[1]{\textsc{#1}} The following works in most browsers but does not validate (\texttt{ } \end{quote} \foreignlanguage{british}{\DUrole{green}{\DUrole{sc}{British colourful text in small-caps}}}. \end{itemize} \subsection{2.22~~~Mathematics% \label{mathematics}% } Docutils supports inline math with the prefix or postfix \texttt{:math:} role specificator, $n! + \sin(x_n^2)$ and $A_\text{c} = \frac{\pi}{4} d^2$, as well as displayed math via the \DUroletitlereference{math} directive: % \begin{equation*} f(\epsilon) = \frac{1}{1 + \exp\left(\frac{\varepsilon}{k_\text{B}T}\right)} \end{equation*} Content may start on the first line of the directive, e.g. % \begin{equation*} N = \frac{\text{number of apples}}{7} \end{equation*} Equations can be labeled with a reference name using the \texttt{:name:} option. See \hyperref[eq-m]{eq:M} and \hyperref[eq-schrodinger]{eq:schrödinger} below. The determinant of the matrix % \begin{equation*} \mathbf{M} = \left(\begin{matrix}a&b\\c&d\end{matrix}\right) \phantomsection \label{eq-m} \end{equation*} is $|\mathbf{M}| = ad - bc$. More than one display math block can be put in one math directive. For example, the following sum and integral with limits: % \begin{equation*} \int_0^1 x^n dx = \frac{1}{n + 1} \end{equation*}% \begin{equation*} \sum_{n=1}^m n = \frac{m(m+1)}{2} \end{equation*} LaTeX-supported Unicode math symbols can be used in math roles and directives: The Schrödinger equation % \begin{equation*} i\hbar \frac{\partial }{\partial t}\Psi = \hat{H}\Psi , \phantomsection \label{eq-schrodinger} \end{equation*} with the \emph{wave function} $\Psi $, describes how the quantum state of a physical system changes in time. % \begin{description} \item[{Math-Accents:}] \leavevmode \setlength{\DUtablewidth}{\linewidth} \begin{longtable*}[c]{p{0.315\DUtablewidth}p{0.315\DUtablewidth}p{0.315\DUtablewidth}} $\acute{a}$ \texttt{\textbackslash{}acute\{a\}} & $\dot{t}$ \texttt{\textbackslash{}dot\{t\}} & $\hat{\gamma}$ \texttt{\textbackslash{}hat\{\textbackslash{}gamma\}} \\ $\grave{a}$ \texttt{\textbackslash{}grave\{a\}} & $\ddot{t}$ \texttt{\textbackslash{}ddot\{t\}} & $\tilde{\alpha}$ \texttt{\textbackslash{}tilde\{\textbackslash{}alpha\}} \\ $\breve{x}$ \texttt{\textbackslash{}breve\{x\}} & $\dddot{t}$ \texttt{\textbackslash{}dddot\{t\}} & $\vec{\imath}$ \texttt{\textbackslash{}vec\{\textbackslash{}imath\}} \\ $\check{a}$ \texttt{\textbackslash{}check\{a\}} & $\bar{a}$ \texttt{\textbackslash{}bar\{a\}} & $\vec{R}$ \texttt{\textbackslash{}vec\{R\}} \\ \end{longtable*} \end{description} % \widetilde{xxx} % \widehat{xxx} Modulation Transfer Function: % \begin{equation*} \text{MTF} = \left|\frac{\mathcal{F}\{s(x)\}} {\mathcal{F}\{ s(x)\} |_{\omega _{x}=0}}\right| = \mathrm{abs}\left(\frac {\int _{-\infty }^{\infty }s(x) \mathrm{e}^{\mathrm{i}\omega _{x}x}\mathrm{d}{x}} {\int _{-\infty }^{\infty }s(x)\mathrm{d}{x}} \right). \end{equation*} Math split over two lines: If a double backslash is detected outside a \texttt{\textbackslash{}begin\{...\} \textbackslash{}end\{...\}} pair, the math code is wrapped in an \href{ftp://ftp.ams.org/ams/doc/amsmath/short-math-guide.pdf}{AMSmath}\DUfootnotemark{id36}{id35}{7} \texttt{align} environment: % \begin{align*} s_{\mathrm{out}}(x) & = s_{\mathrm{in}}(x') * s_\delta (x-x') \\ & = \int s_{\mathrm{in}}(x')s_\delta (x-x')\mathrm{d}x' \end{align*} Cases (“manually”, with \texttt{matrix} environment): % \begin{equation*} \mathrm{sgn}(x) = \left\{\begin{matrix} -1 & x<0\\ 1 & x>0 \end{matrix}\right. \end{equation*} Cases with the \href{ftp://ftp.ams.org/ams/doc/amsmath/short-math-guide.pdf}{AMSmath}\DUfootnotemark{id37}{id35}{7} \texttt{cases} environment (not (yet) supported by HTML writers with \texttt{-{}-math-output=MathML}): % \begin{equation*} \mathrm{sgn}(x) = \begin{cases} -1 & x<0\\ 1 & x>0 \end{cases} \end{equation*} \section{3~~~Tests for the LaTeX writer% \label{tests-for-the-latex-writer}% } Test syntax elements which may cause trouble for the LaTeX writer but might not need to be tested with other writers (e.g. the HTML writer). \subsection{3.1~~~Custom Roles in LaTeX% \label{custom-roles-in-latex}% } % \begin{itemize} \item Role names and class arguments are converted to conform to the regular expression \texttt{{[}a-z{]}{[}-a-z0-9{]}*} (letters are downcased, accents and similar decoration is stripped, non-conforming characters are replaced by a hyphen). Class arguments may contain numbers and hyphens, which need special treatment in LaTeX command names. \DUrole{large}{\DUrole{custom4}{\DUrole{small-caps}{\DUrole{custom-role}{\DUrole{custom-role}{Interpreted Text}}}}} \item With LaTeX, roles can be styled within the document using the \DUroletitlereference{raw} directive. \newcommand{\DUrolelarge}[1]{{\large #1}} \makeatletter \@namedef{DUrolesmall-caps}{\textsc} \@namedef{DUrolecustom4}{\textbf} \makeatother \DUrole{large}{\DUrole{custom4}{\DUrole{small-caps}{\DUrole{custom-role}{\DUrole{custom-role}{Interpreted Text}}}}} in large, bold, small-caps. \item Custom roles can be based on standard roles: This is a \emph{\DUrole{custom-emphasis}{customized emphasis text role}} This is a \texttt{\DUrole{custom-literal}{customized literal text role}} This is a \textbf{\DUrole{custom-strong}{customized strong text role}} This is a \textsubscript{\DUrole{custom-subscript}{customized subscript text role}} This is a \textsuperscript{\DUrole{custom-superscript}{customized superscript text role}} This is a \DUroletitlereference{\DUrole{custom-title-reference}{customized title-reference text role}} \end{itemize} \subsection{3.2~~~More Tables% \label{more-tables}% } A multicolumn table with multi-paragraph rowspanning cells: \setlength{\DUtablewidth}{\linewidth} \begin{longtable*}[c]{|p{0.133\DUtablewidth}|p{0.179\DUtablewidth}|p{0.179\DUtablewidth}|p{0.110\DUtablewidth}|p{0.121\DUtablewidth}|p{0.145\DUtablewidth}|} \hline test & \textbf{bold hd} & \multicolumn{3}{p{0.41\DUtablewidth}|}{ multicolumn 1 With a second paragraph } & \emph{emph hd} \\ \hline \multicolumn{2}{|p{0.31\DUtablewidth}|}{ multicolumn 2 With a second paragraph } & cell & cell & cell & cell \\ \hline cell & \multicolumn{2}{p{0.36\DUtablewidth}|}{ multicolumn 3 (one line, but very very very very very looooong) } & cell & cell & cell \\ \hline cell & cell & cell & \multicolumn{3}{p{0.38\DUtablewidth}|}{ Short multicolumn 4 } \\ \hline \end{longtable*} A table with multirow header % \begin{quote} \setlength{\DUtablewidth}{\linewidth} \begin{longtable*}[c]{|p{0.156\DUtablewidth}|p{0.238\DUtablewidth}|} \hline \multirow{2}{0.16\DUtablewidth}{% \textbf{% XXX }} & \textbf{% Variable Summary } \\ \cline{2-2} & \textbf{% Description } \\ \hline \endfirsthead \hline \multirow{2}{0.16\DUtablewidth}{% \textbf{% XXX }} & \textbf{% Variable Summary } \\ \cline{2-2} & \textbf{% Description } \\ \hline \endhead \multicolumn{2}{c}{\hfill ... continued on next page} \\ \endfoot \endlastfoot \multicolumn{2}{|p{0.39\DUtablewidth}|}{ multirow header breaks latex } \\ \hline \end{longtable*} \end{quote} % This file is used by the standalone_rst_latex test. \subsection{3.3~~~Option lists% \label{id23}% } The LaTeX-2e description environment is used for definition lists. The definition is continued on the same line as the term, this should not happen if a option-list is at the top of the definition. If the option list is not at the first element in the definition, it is contained in a quote % \begin{quote} % \begin{DUoptionlist} \item[-{}-help] show help \item[-v] verbose \end{DUoptionlist} \end{quote} % \begin{description} \item[{In a definition list:}] \leavevmode % \begin{DUoptionlist} \item[-{}-help] show help \item[-v] verbose \end{DUoptionlist} \end{description} \subsection{3.4~~~Monospaced non-alphanumeric characters% \label{monospaced-non-alphanumeric-characters}% } These are all ASCII characters except a-zA-Z0-9 and space: \texttt{!!!\textquotedbl{}\textquotedbl{}\textquotedbl{}\#\#\#\$\$\$\%\%\%\&\&\&'{}'{}'((()))***+++,{},{},-{}-{}-...///:::} \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. \subsection{3.5~~~Non-ASCII characters% \label{non-ascii-characters}% } Punctuation and footnote symbols \setlength{\DUtablewidth}{\linewidth} \begin{longtable*}[c]{|p{0.028\DUtablewidth}|p{0.424\DUtablewidth}|} \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 † & dagger \\ \hline ‡ & double dagger \\ \hline \ding{169} & black diamond suit \\ \hline \ding{170} & black heart suit \\ \hline $\spadesuit$ & black spade suit \\ \hline $\clubsuit$ & black club suit \\ \hline … & ellipsis \\ \hline ™ & trade mark sign \\ \hline $\Leftrightarrow$ & left-right double arrow \\ \hline \end{longtable*} The \DUroletitlereference{Latin-1 extended} Unicode block \setlength{\DUtablewidth}{\linewidth} \begin{longtable*}[c]{|p{0.051\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|} \hline % & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \\ \hline 160 & & ¡ & ¢ & £ & & ¥ & ¦ & § & ¨ & © \\ \hline 170 & ª & « & ¬ & \- & ® & ¯ & ° & ± & ² & ³ \\ \hline 180 & ´ & µ & ¶ & · & ¸ & ¹ & º & » & ¼ & ½ \\ \hline 190 & ¾ & ¿ & À & Á & Â & Ã & Ä & Å & Æ & Ç \\ \hline 200 & È & É & Ê & Ë & Ì & Í & Î & Ï & Ð & Ñ \\ \hline 210 & Ò & Ó & Ô & Õ & Ö & × & Ø & Ù & Ú & Û \\ \hline 220 & Ü & Ý & Þ & ß & à & á & â & ã & ä & å \\ \hline 230 & æ & ç & è & é & ê & ë & ì & í & î & ï \\ \hline 240 & ð & ñ & ò & ó & ô & õ & ö & ÷ & ø & ù \\ \hline 250 & ú & û & ü & ý & þ & ÿ & & & & \\ \hline \end{longtable*} % \begin{itemize} \item The following line should not be wrapped, because it uses no-break spaces (\textbackslash{}u00a0): 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 \item Line wrapping with/without breakpoints marked by soft hyphens (\textbackslash{}u00ad): pdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-sch pdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrisch \item The currency sign (\textbackslash{}u00a4) is not supported by all fonts (some have an Euro sign at its place). You might see an error like: % \begin{quote}{\ttfamily \raggedright \noindent !~Package~textcomp~Error:~Symbol~\textbackslash{}textcurrency~not~provided~by\\ (textcomp)~~~~~~~~~~~~~~~~font~family~ptm~in~TS1~encoding.\\ (textcomp)~~~~~~~~~~~~~~~~Default~family~used~instead. } \end{quote} (which in case of font family ptm is a false positive). Add either % \begin{DUfieldlist} \item[{warn:}] turn the error in a warning, use the default symbol (bitmap), or \item[{force,almostfull:}] use the symbol provided by the font at the users risk, \end{DUfieldlist} to the document options or use a different font package. \end{itemize} \subsection{3.6~~~Encoding special chars% \label{encoding-special-chars}% } The LaTeX Info pages lists under “2.18 Special Characters” % \begin{quote} The following characters play a special role in LaTeX and are called “special printing characters”, or simply “special characters”. % \begin{quote} \# \$ \% \& \textasciitilde{} \_ \textasciicircum{} \textbackslash{} \{ \} \end{quote} \end{quote} The special chars verbatim: % \begin{quote}{\ttfamily \raggedright \noindent \#~\$~\%~\&~\textasciitilde{}~\_~\textasciicircum{}~\textbackslash{}~\{~\} } \end{quote} However also \emph{square brackets} {[}{]} need special care. % \begin{quote} item and all the other commands with optional arguments check if the token right after the macro name is an opening bracket. In that case the contents between that bracket and the following closing bracket on the same grouping level are taken as the optional argument. What makes this unintuitive is the fact that the square brackets aren’t grouping characters themselves, so in your last example item{[}{[}…{]}{]} the optional argument consists of {[}… (without the closing bracket). \end{quote} Compare the items in the following lists: % \begin{itemize} \item simple item \item {[}bracketed{]} item \end{itemize} % \begin{description} \item[{simple}] \leavevmode description term \item[{{[}bracketed{]}}] \leavevmode description term \end{description} The OT1 font-encoding has different characters for the less-than, greater-than and bar, < | >, except for typewriter font \DUroletitlereference{cmtt}: % \begin{quote}{\ttfamily \raggedright \noindent <~|~> } \end{quote} \subsection{3.7~~~Hyperlinks and -targets% \label{hyperlinks-and-targets}% } In LaTeX, we must set an explicit anchor (\texttt{\textbackslash{}phantomsection}) for a % \phantomsection\label{hypertarget-in-plain-text}hypertarget in plain text or in a figure but not in a longtable or caption: \setlength{\DUtablewidth}{\linewidth} \begin{longtable}[c]{|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|} \caption{Table with % \label{hypertarget-in-table-title}hypertarget in table title.}\\ \hline False & True & None \\ \hline \end{longtable} \label{table-label} \begin{figure} \phantomsection\label{figure-label} \noindent\makebox[\textwidth][c]{\includegraphics{../../../docs/user/rst/images/biohazard.png}} \caption{Figure with % \label{hypertarget-in-figure-caption}hypertarget in figure caption.} \begin{DUlegend} Legend with % \phantomsection\label{hypertarget-in-figure-legend}hypertarget in figure legend. \end{DUlegend} \end{figure} \includegraphics{../../../docs/user/rst/images/biohazard.png} \phantomsection\label{image-label} See \hyperref[hypertarget-in-plain-text]{hypertarget in plain text}, \hyperref[table-label]{table label}, \hyperref[hypertarget-in-table-title]{hypertarget in table title}, \hyperref[figure-label]{figure label}, \hyperref[hypertarget-in-figure-caption]{hypertarget in figure caption}, \hyperref[hypertarget-in-figure-legend]{hypertarget in figure legend}, and \hyperref[image-label]{image label}. \subsection{3.8~~~External references% \label{external-references}% } Long URLs should be wrapped in the PDF. This can be achieved with the url command which is used by the LaTeX writer whenever the content (name) of a reference node equals the link URL. % \begin{description} \item[{Example:}] \leavevmode a long URL that should wrap in the output \url{http://docutils.sourceforge.net/docs/user/latex.html\#id79} \end{description} If the argument contains any “\%”, “\#”, or “\textasciicircum{}\textasciicircum{}”, or ends with \texttt{\textbackslash{}}, it can’t be used in the argument to another command. The argument must not contain unbalanced braces. The characters \textasciicircum{}, \{, \}, and \texttt{\textbackslash{}} are invalid in a “http:” or “ftp:” URL and not recognized as part of it: \begin{DUlineblock}{0em} \item[] \url{http://www.example.org}/strange\textasciicircum{}\textasciicircum{}name \item[] \url{http://www.example.org}\textbackslash{}using\textbackslash{}DOS\textbackslash{}paths\textbackslash{} \item[] \url{http://www.example.org/XML}/strange\{n\}ame \end{DUlineblock} They can, however be used in paths and/or filenames. Handling by the LaTeX writer: % \begin{itemize} \item \texttt{\#}, \texttt{\textbackslash{}} and \texttt{\%} are escaped: \begin{DUlineblock}{0em} \item[] \href{http://www.w3.org/XML/Schema\#dev}{URL with \#} \url{http://www.w3.org/XML/Schema\#dev} \item[] \href{http://www.w3.org/XML/Schema\%dev}{URL with \%} \url{http://example.org/Schema\%dev} \item[] \href{A:DOS\\path\\}{file with DOS path}\DUfootnotemark{id42}{id41}{9} \url{A:DOS\\path\\}\DUfootnotemark{id43}{id41}{9} \end{DUlineblock} \DUadmonition[note]{ \DUtitle[note]{Note} These URLs are typeset inside a LaTeX command without error. \begin{DUlineblock}{0em} \item[] \url{http://www.w3.org/XML/Schema\#dev} \item[] \url{http://example.org/Schema\%dev} \item[] \url{A:DOS\\path\\}\DUfootnotemark{id44}{id41}{9} \end{DUlineblock} } \end{itemize} % \begin{itemize} \item \textasciicircum{}\textasciicircum{} LaTeX’s special syntax for characters results in “strange” replacements (both with href and url). A warning is given. \href{../strange^^name}{file with \textasciicircum{}\textasciicircum{}}: \url{../strange^^name} \item Unbalanced braces, \{ or \}, will fail (both with href and url): % \begin{quote}{\ttfamily \raggedright \noindent `file~with~\{~<../strange\{name>`\_\_\\ `<../strange\{name>`\_\_ } \end{quote} while balanced braces are suported: \begin{DUlineblock}{0em} \item[] \url{../strange{n}ame} \item[] \url{../st{r}ange{n}ame} \item[] \url{../{st{r}ange{n}ame}} \end{DUlineblock} \end{itemize} \subsection{3.9~~~Section titles with \hyperref[inline-markup]{inline markup}% \label{section-titles-with-inline-markup}% } \subsubsection{3.9.1~~~\emph{emphasized}, H\textsubscript{2}O and $x^2$% \label{emphasized-h2o-and-x-2}% } \subsubsection{3.9.2~~~Substitutions work% \label{substitutions-fail}% } \subsection{3.10~~~Deeply nested sections% \label{deeply-nested-sections}% } In LaTeX and HTML, \subsubsection{3.10.1~~~Level 3% \label{level-3}% } nested sections \paragraph{3.10.1.1~~~level 4% \label{level-4}% } reach at some level \subparagraph{3.10.1.1.1~~~level 5% \label{level-5}% } (depending on the document class) \DUtitle[sectionVI]{3.10.1.1.1.1~~~level 6% \label{level-6}% } an unsupported level. % unusual combinations (from newlatex, for interactive testing) % .. include:: data/latex.txt % Preface for System Messages: \section{4~~~Error Handling% \label{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]{\color{red}Docutils System Messages% } \DUadmonition[system-message]{ \DUtitle[system-message]{system-message} \raisebox{1em}{\hypertarget{id27}{}} {\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~104 \hyperlink{id28}{ Undefined substitution referenced: \textquotedbl{}problematic\textquotedbl{}. }} \DUadmonition[system-message]{ \DUtitle[system-message]{system-message} \raisebox{1em}{\hypertarget{id45}{}} {\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~391 \hyperlink{id46}{ Unknown target name: \textquotedbl{}5\textquotedbl{}. }} \DUadmonition[system-message]{ \DUtitle[system-message]{system-message} \raisebox{1em}{\hypertarget{id47}{}} {\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~400 \hyperlink{id48}{ Unknown target name: \textquotedbl{}nonexistent\textquotedbl{}. }} \DUadmonition[system-message]{ \DUtitle[system-message]{system-message} \raisebox{1em}{\hypertarget{id49}{}} {\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~427 \hyperlink{id50}{ Unknown target name: \textquotedbl{}hyperlink reference without a target\textquotedbl{}. }} \DUadmonition[system-message]{ \DUtitle[system-message]{system-message} \raisebox{1em}{\hypertarget{id51}{}} {\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~440 \hyperlink{id52}{ Duplicate target name, cannot be used as a unique reference: \textquotedbl{}duplicate target names\textquotedbl{}. }} \end{document} docutils-0.11/test/functional/expected/standalone_rst_s5_html_2.html0000644000175000017500000001417112063411436026471 0ustar engelbertengelbert 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, although it does appear in the handout/outline.
  • Handout material is not displayed in presentation mode.
  • The theme directories should be created, and the theme files copied over.
docutils-0.11/test/functional/expected/xetex-cyrillic.tex0000644000175000017500000000355712076016516024410 0ustar engelbertengelbert\documentclass[a4paper,russian]{article} % generated by Docutils % rubber: set program xelatex \usepackage[no-sscript]{xltxtra} % loads fixltx2e, metalogo, xunicode, fontspec % \defaultfontfeatures{Scale=MatchLowercase} \usepackage{ifthen} \usepackage{polyglossia} \setdefaultlanguage{russian} \setotherlanguages{english} \setcounter{secnumdepth}{0} %%% Custom LaTeX preamble % Linux Libertine (free, wide coverage, not only for Linux) \setmainfont{Linux Libertine O} \setsansfont{Linux Biolinum O} \setmonofont[HyphenChar=None,Scale=MatchLowercase]{DejaVu Sans Mono} %%% User specified packages and stylesheets %%% Fallback definitions for Docutils-specific commands % titlereference role \providecommand*{\DUroletitlereference}[1]{\textsl{#1}} % hyperlinks: \ifthenelse{\isundefined{\hypersetup}}{ \usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue,unicode=false]{hyperref} \urlstyle{same} % normal text font (alternatives: tt, rm, sf) }{} %%% Body \begin{document} \section{Заголовок% \label{id1}% } первый пример: «Здравствуй, мир!» \section{Title% \label{title}% } \foreignlanguage{english}{first example: “Hello world”.} \section{Notes% \label{notes}% } \foreignlanguage{english}{This example tests rendering of Latin and Cyrillic characters by the LaTeX and XeTeX writers. Check the compiled PDF for garbage characters in text and bookmarks.} \foreignlanguage{english}{To work around a problem with Cyrillic in PDF-bookmarks in \DUroletitlereference{hyperref} versions older than v6.79g 2009/11/20, the test caller \texttt{latex\_cyrillic.py} sets \texttt{hyperref\_options} to \texttt{'unicode=true'} while \texttt{xetex\_cyrillic.py} sets it to \texttt{'unicode=false'}. The recommended option for current (2011-08-24) hyperref versions is \texttt{'pdfencoding=auto'}.} \end{document} docutils-0.11/test/functional/expected/math_output_html.html0000644000175000017500000002737312114425204025175 0ustar engelbertengelbert Mathematics

Mathematics

Docutils supports inline math with the prefix or postfix :math: role specificator, n! + sin(x2n) and Ac = (π)/(4)d2 , as well as displayed math via the math directive:

f(ϵ) = (1)/(1 + exp(ε)/(kBT))

Content may start on the first line of the directive, e.g.

N = (number of apples)/(7)

Equations can be labeled with a reference name using the :name: option. See eq:M and eq:schrödinger below.

The determinant of the matrix

M =  a b c d

is |M| = ad − bc .

More than one display math block can be put in one math directive. For example, the following sum and integral with limits:

10xndx = (1)/(n + 1)
mn = 1n = (m(m + 1))/(2)

LaTeX-supported Unicode math symbols can be used in math roles and directives:

The Schrödinger equation

i()/(t)Ψ = Ψ, 

with the wave function Ψ , describes how the quantum state of a physical system changes in time.

Math-Accents:
\acute{a} \dot{t} γ̂ \hat{\gamma}
\grave{a} \ddot{t} α̃ \tilde{\alpha}
\breve{x} t⃛ \dddot{t} ı⃗ \vec{\imath}
\check{a} a \bar{a} R⃗ \vec{R}

Modulation Transfer Function:

MTF = ||(ℱ{s(x)})/(ℱ{s(x)}|ωx = 0)|| =  abs( − ∞s(x)eiωxxdx)/( − ∞s(x)dx).

Math split over two lines: If a double backslash is detected outside a \begin{...} \end{...} pair, the math code is wrapped in an AMSmath align environment:

sout(x)  = sin(x’)*sδ(x − x’)  = sin(x’)sδ(x − x’)dx

Cases ("manually", with matrix environment):

sgn(x) =   − 1 x < 0 1 x > 0

Cases with the AMSmath cases environment (not (yet) supported by HTML writers with --math-output=MathML):

sgn(x) =   − 1  x < 0        1  x > 0 
docutils-0.11/test/functional/expected/cyrillic.tex0000644000175000017500000000341312076016516023244 0ustar engelbertengelbert\documentclass[a4paper,russian]{article} % generated by Docutils \usepackage{fixltx2e} % LaTeX patches, \textsubscript \usepackage{cmap} % fix search and cut-and-paste in Acrobat \usepackage{ifthen} \usepackage[T1,T2A]{fontenc} \usepackage[utf8]{inputenc} \usepackage[english,russian]{babel} \setcounter{secnumdepth}{0} %%% Custom LaTeX preamble % PDF Standard Fonts \usepackage{mathptmx} % Times \usepackage[scaled=.90]{helvet} \usepackage{courier} %%% User specified packages and stylesheets \usepackage{cmlgc} %%% Fallback definitions for Docutils-specific commands % titlereference role \providecommand*{\DUroletitlereference}[1]{\textsl{#1}} % hyperlinks: \ifthenelse{\isundefined{\hypersetup}}{ \usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue,unicode=true]{hyperref} \urlstyle{same} % normal text font (alternatives: tt, rm, sf) }{} %%% Body \begin{document} \section{Заголовок% \label{id1}% } первый пример: «Здравствуй, мир!» \section{Title% \label{title}% } \foreignlanguage{english}{first example: “Hello world”.} \section{Notes% \label{notes}% } \foreignlanguage{english}{This example tests rendering of Latin and Cyrillic characters by the LaTeX and XeTeX writers. Check the compiled PDF for garbage characters in text and bookmarks.} \foreignlanguage{english}{To work around a problem with Cyrillic in PDF-bookmarks in \DUroletitlereference{hyperref} versions older than v6.79g 2009/11/20, the test caller \texttt{latex\_cyrillic.py} sets \texttt{hyperref\_options} to \texttt{'unicode=true'} while \texttt{xetex\_cyrillic.py} sets it to \texttt{'unicode=false'}. The recommended option for current (2011-08-24) hyperref versions is \texttt{'pdfencoding=auto'}.} \end{document} docutils-0.11/test/functional/expected/math_output_mathml.xhtml0000644000175000017500000002406512063411436025703 0ustar engelbertengelbert Mathematics

Mathematics

Docutils supports inline math with the prefix or postfix :math: role specificator, n!+sin(xn2) and Ac= π 4d2, as well as displayed math via the math directive:

f(ϵ)= 1 1+exp ε kBT

Content may start on the first line of the directive, e.g.

N= number of apples 7

Equations can be labeled with a reference name using the :name: option. See eq:M and eq:schrödinger below.

The determinant of the matrix

M= a b c d

is | M|=ad-bc.

More than one display math block can be put in one math directive. For example, the following sum and integral with limits:

01xndx= 1 n+1
n=1mn= m(m+1) 2

LaTeX-supported Unicode math symbols can be used in math roles and directives:

The Schrödinger equation

i tΨ= H^Ψ,

with the wave function Ψ, describes how the quantum state of a physical system changes in time.

Math-Accents:
a´ \acute{a} t˙ \dot{t} γ^ \hat{\gamma}
a` \grave{a} t¨ \ddot{t} α˜ \tilde{\alpha}
x˘ \breve{x} t \dddot{t} ı \vec{\imath}
aˇ \check{a} a¯ \bar{a} R \vec{R}

Modulation Transfer Function:

MTF= {s(x)} {s(x)}| ω x=0=abs - s(x)e iω xxd x - s(x)d x.

Math split over two lines: If a double backslash is detected outside a \begin{...} \end{...} pair, the math code is wrapped in an AMSmath align environment:

s out(x) =s in(x')*sδ(x-x') =s in(x')sδ(x-x')dx'

Cases ("manually", with matrix environment):

sgn(x)= -1 x<0 1 x>0

Cases with the AMSmath cases environment (not (yet) supported by HTML writers with --math-output=MathML):

System Message: ERROR/3 (functional/input/data/math.txt, line 107)

Environment not supported! Supported environment: "matrix".

\mathrm{sgn}(x) = \begin{cases}
                    -1 & x<0\\
                     1 & x>0
                  \end{cases}
docutils-0.11/test/functional/expected/math_output_mathjax.html0000644000175000017500000001351312063411436025661 0ustar engelbertengelbert Mathematics

Mathematics

Docutils supports inline math with the prefix or postfix :math: role specificator, \(n! + \sin(x_n^2)\) and \(A_\text{c} = \frac{\pi}{4} d^2\) , as well as displayed math via the math directive:

\begin{equation*} f(\epsilon) = \frac{1}{1 + \exp\left(\frac{\varepsilon}{k_\text{B}T}\right)} \end{equation*}

Content may start on the first line of the directive, e.g.

\begin{equation*} N = \frac{\text{number of apples}}{7} \end{equation*}

Equations can be labeled with a reference name using the :name: option. See eq:M and eq:schrödinger below.

The determinant of the matrix

\begin{equation*} \mathbf{M} = \left(\begin{matrix}a&b\\c&d\end{matrix}\right) \end{equation*}

is \(|\mathbf{M}| = ad - bc\) .

More than one display math block can be put in one math directive. For example, the following sum and integral with limits:

\begin{equation*} \int_0^1 x^n dx = \frac{1}{n + 1} \end{equation*}
\begin{equation*} \sum_{n=1}^m n = \frac{m(m+1)}{2} \end{equation*}

LaTeX-supported Unicode math symbols can be used in math roles and directives:

The Schrödinger equation

\begin{equation*} i\hbar \frac{\partial }{\partial t}\Psi = \hat{H}\Psi , \end{equation*}

with the wave function \(\Psi \) , describes how the quantum state of a physical system changes in time.

Math-Accents:
\(\acute{a}\) \acute{a} \(\dot{t}\) \dot{t} \(\hat{\gamma}\) \hat{\gamma}
\(\grave{a}\) \grave{a} \(\ddot{t}\) \ddot{t} \(\tilde{\alpha}\) \tilde{\alpha}
\(\breve{x}\) \breve{x} \(\dddot{t}\) \dddot{t} \(\vec{\imath}\) \vec{\imath}
\(\check{a}\) \check{a} \(\bar{a}\) \bar{a} \(\vec{R}\) \vec{R}

Modulation Transfer Function:

\begin{equation*} \text{MTF} = \left|\frac{\mathcal{F}\{s(x)\}} {\mathcal{F}\{ s(x)\} |_{\omega _{x}=0}}\right| = \mathrm{abs}\left(\frac {\int _{-\infty }^{\infty }s(x) \mathrm{e}^{\mathrm{i}\omega _{x}x}\mathrm{d}{x}} {\int _{-\infty }^{\infty }s(x)\mathrm{d}{x}} \right). \end{equation*}

Math split over two lines: If a double backslash is detected outside a \begin{...} \end{...} pair, the math code is wrapped in an AMSmath align environment:

\begin{align*} s_{\mathrm{out}}(x) & = s_{\mathrm{in}}(x') * s_\delta (x-x') \\ & = \int s_{\mathrm{in}}(x')s_\delta (x-x')\mathrm{d}x' \end{align*}

Cases ("manually", with matrix environment):

\begin{equation*} \mathrm{sgn}(x) = \left\{\begin{matrix} -1 & x<0\\ 1 & x>0 \end{matrix}\right. \end{equation*}

Cases with the AMSmath cases environment (not (yet) supported by HTML writers with --math-output=MathML):

\begin{equation*} \mathrm{sgn}(x) = \begin{cases} -1 & x<0\\ 1 & x>0 \end{cases} \end{equation*}
docutils-0.11/test/functional/expected/standalone_rst_pseudoxml.txt0000644000175000017500000027131712024637300026574 0ustar engelbertengelbert 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@python.org"> goodger@python.org <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"> <raw format="latex" xml:space="preserve"> \pagebreak[4] % start ToC on new page <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="id34" refid="structural-elements"> <generated classes="sectnum"> 1    Structural Elements <bullet_list classes="auto-toc"> <list_item> <paragraph> <reference ids="id35" refid="section-title"> <generated classes="sectnum"> 1.1    Section Title <list_item> <paragraph> <reference ids="id36" refid="empty-section"> <generated classes="sectnum"> 1.2    Empty Section <list_item> <paragraph> <reference ids="id37" refid="transitions"> <generated classes="sectnum"> 1.3    Transitions <list_item> <paragraph> <reference ids="id38" refid="body-elements"> <generated classes="sectnum"> 2    Body Elements <bullet_list classes="auto-toc"> <list_item> <paragraph> <reference ids="id39" refid="paragraphs"> <generated classes="sectnum"> 2.1    Paragraphs <bullet_list classes="auto-toc"> <list_item> <paragraph> <reference ids="id40" refid="inline-markup"> <generated classes="sectnum"> 2.1.1    Inline Markup <list_item> <paragraph> <reference ids="id41" refid="bullet-lists"> <generated classes="sectnum"> 2.2    Bullet Lists <list_item> <paragraph> <reference ids="id42" refid="enumerated-lists"> <generated classes="sectnum"> 2.3    Enumerated Lists <list_item> <paragraph> <reference ids="id43" refid="definition-lists"> <generated classes="sectnum"> 2.4    Definition Lists <list_item> <paragraph> <reference ids="id44" refid="field-lists"> <generated classes="sectnum"> 2.5    Field Lists <list_item> <paragraph> <reference ids="id45" refid="option-lists"> <generated classes="sectnum"> 2.6    Option Lists <list_item> <paragraph> <reference ids="id46" refid="literal-blocks"> <generated classes="sectnum"> 2.7    Literal Blocks <list_item> <paragraph> <reference ids="id47" refid="line-blocks"> <generated classes="sectnum"> 2.8    Line Blocks <list_item> <paragraph> <reference ids="id48" refid="block-quotes"> <generated classes="sectnum"> 2.9    Block Quotes <list_item> <paragraph> <reference ids="id49" refid="doctest-blocks"> <generated classes="sectnum"> 2.10    Doctest Blocks <list_item> <paragraph> <reference ids="id50" refid="footnotes"> <generated classes="sectnum"> 2.11    Footnotes <list_item> <paragraph> <reference ids="id51" refid="citations"> <generated classes="sectnum"> 2.12    Citations <list_item> <paragraph> <reference ids="id52" refid="targets"> <generated classes="sectnum"> 2.13    Targets <bullet_list classes="auto-toc"> <list_item> <paragraph> <reference ids="id53" refid="duplicate-target-names"> <generated classes="sectnum"> 2.13.1    Duplicate Target Names <list_item> <paragraph> <reference ids="id54" refid="id21"> <generated classes="sectnum"> 2.13.2    Duplicate Target Names <list_item> <paragraph> <reference ids="id55" refid="directives"> <generated classes="sectnum"> 2.14    Directives <bullet_list classes="auto-toc"> <list_item> <paragraph> <reference ids="id56" refid="document-parts"> <generated classes="sectnum"> 2.14.1    Document Parts <list_item> <paragraph> <reference ids="id57" refid="images-and-figures"> <generated classes="sectnum"> 2.14.2    Images and Figures <list_item> <paragraph> <reference ids="id58" refid="admonitions"> <generated classes="sectnum"> 2.14.3    Admonitions <list_item> <paragraph> <reference ids="id59" refid="topics-sidebars-and-rubrics"> <generated classes="sectnum"> 2.14.4    Topics, Sidebars, and Rubrics <list_item> <paragraph> <reference ids="id60" refid="target-footnotes"> <generated classes="sectnum"> 2.14.5    Target Footnotes <list_item> <paragraph> <reference ids="id61" refid="replacement-text"> <generated classes="sectnum"> 2.14.6    Replacement Text <list_item> <paragraph> <reference ids="id62" refid="compound-paragraph"> <generated classes="sectnum"> 2.14.7    Compound Paragraph <list_item> <paragraph> <reference ids="id63" refid="parsed-literal-blocks"> <generated classes="sectnum"> 2.14.8    Parsed Literal Blocks <list_item> <paragraph> <reference ids="id64" refid="code"> <generated classes="sectnum"> 2.14.9    Code <list_item> <paragraph> <reference ids="id65" refid="substitution-definitions"> <generated classes="sectnum"> 2.15    Substitution Definitions <list_item> <paragraph> <reference ids="id66" refid="comments"> <generated classes="sectnum"> 2.16    Comments <list_item> <paragraph> <reference ids="id67" refid="raw-text"> <generated classes="sectnum"> 2.17    Raw text <list_item> <paragraph> <reference ids="id68" refid="container"> <generated classes="sectnum"> 2.18    Container <list_item> <paragraph> <reference ids="id69" refid="colspanning-tables"> <generated classes="sectnum"> 2.19    Colspanning tables <list_item> <paragraph> <reference ids="id70" refid="rowspanning-tables"> <generated classes="sectnum"> 2.20    Rowspanning tables <list_item> <paragraph> <reference ids="id71" refid="complex-tables"> <generated classes="sectnum"> 2.21    Complex tables <list_item> <paragraph> <reference ids="id72" refid="list-tables"> <generated classes="sectnum"> 2.22    List Tables <list_item> <paragraph> <reference ids="id73" refid="error-handling"> <generated classes="sectnum"> 3    Error Handling <section ids="structural-elements" names="structural\ elements"> <title auto="1" refid="id34"> <generated classes="sectnum"> 1    Structural Elements <section ids="section-title" names="section\ title"> <title auto="1" refid="id35"> <generated classes="sectnum"> 1.1    Section Title <subtitle ids="section-subtitle" names="section\ subtitle"> Section Subtitle <paragraph> Lone subsections are converted to a section subtitle by a transform activated with the <literal> --section-subtitles command line option or the <literal> sectsubtitle-xform configuration value. <section ids="empty-section" names="empty\ section"> <title auto="1" refid="id36"> <generated classes="sectnum"> 1.2    Empty Section <section ids="transitions" names="transitions"> <title auto="1" refid="id37"> <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="id38"> <generated classes="sectnum"> 2    Body Elements <section ids="paragraphs" names="paragraphs"> <title auto="1" refid="id39"> <generated classes="sectnum"> 2.1    Paragraphs <paragraph> A paragraph. <section ids="inline-markup" names="inline\ markup"> <title auto="1" refid="id40"> <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="id26" refid="id25"> 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 ), <reference anonymous="1" name="anonymous hyperlink references" refuri="http://www.python.org/"> anonymous hyperlink references <footnote_reference auto="1" ids="id31" refid="id25"> 5 ( <reference anonymous="1" name="a second reference" refuri="http://docutils.sourceforge.net/"> a second reference <footnote_reference auto="1" ids="id33" refid="id32"> 7 ), footnote references (manually numbered <footnote_reference ids="id1" refid="id8"> 1 , anonymous auto-numbered <footnote_reference auto="1" ids="id2" refid="id12"> 3 , labeled auto-numbered <footnote_reference auto="1" ids="id3" refid="label"> 2 , or symbolic <footnote_reference auto="*" ids="id4" refid="id13"> * ), 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="id24" refid="id23"> |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 . <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> Title Reference . Here are some explicit interpreted text roles: a PEP reference ( <reference refuri="http://www.python.org/dev/peps/pep-0287"> PEP 287 ); an RFC reference ( <reference refuri="http://www.faqs.org/rfcs/rfc2822.html"> RFC 2822 ); an abbreviation ( <abbreviation> abb. ), an acronym ( <acronym> reST ), code ( <literal classes="code"> print "hello world" ); a <subscript> subscript ; a <superscript> superscript and explicit roles for <title_reference> Docutils ' <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="id41"> <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="id42"> <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 <system_message level="1" line="8" source="functional/input/data/standard.txt" type="INFO"> <paragraph> Enumerated list start value not ordinal-1: "3" (ordinal 3) <enumerated_list enumtype="upperalpha" prefix="" start="3" suffix="."> <list_item> <paragraph> C <list_item> <paragraph> D <system_message level="1" line="8" source="functional/input/data/standard.txt" type="INFO"> <paragraph> Enumerated list start value not ordinal-1: "C" (ordinal 3) <enumerated_list enumtype="lowerroman" prefix="" start="3" suffix="."> <list_item> <paragraph> iii <list_item> <paragraph> iv <system_message level="1" line="8" source="functional/input/data/standard.txt" type="INFO"> <paragraph> Enumerated list start value not ordinal-1: "iii" (ordinal 3) <section ids="definition-lists" names="definition\ lists"> <title auto="1" refid="id43"> <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="id44"> <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="id45"> <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="id46"> <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="id47"> <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... <paragraph> A line block, like the following poem by Christian Morgenstern, can also be centre-aligned: <line_block classes="language-de align-center"> <line> <strong> Die Trichter <line> <line> Zwei Trichter wandeln durch die Nacht. <line> Durch ihres Rumpfs verengten Schacht <line> fließt weißes Mondlicht <line> still und heiter <line> auf   ihren <line> Waldweg <line> u. s. <line> w. <line> <section ids="block-quotes" names="block\ quotes"> <title auto="1" refid="id48"> <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) <paragraph> The language of a quote (like any other object) can be specified by a class attribute: <comment xml:space="preserve"> <block_quote classes="language-fr"> <paragraph> ReStructuredText est un langage de balisage léger utilisé notamment dans la documentation du langage Python. <section ids="doctest-blocks" names="doctest\ blocks"> <title auto="1" refid="id49"> <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="id50"> <generated classes="sectnum"> 2.11    Footnotes <footnote backrefs="id1 id9 id22" ids="id8" 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 id10" ids="label" names="label"> <label> 2 <paragraph> Footnotes may be numbered, either manually (as in <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="id10" refid="label"> 2 ) and as a <reference anonymous="1" name="hyperlink reference" refid="label"> hyperlink reference . <target anonymous="1" ids="id11" refid="label"> <footnote auto="1" backrefs="id2" ids="id12" 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="id13"> <label> * <paragraph> Footnotes may also use symbols, specified with a "*" label. Here's a reference to the next footnote: <footnote_reference auto="*" ids="id14" refid="id15"> † . <footnote auto="*" backrefs="id14" ids="id15"> <label> † <paragraph> This footnote shows the next symbol in the sequence. <footnote ids="id16" names="4"> <label> 4 <paragraph> Here's an unreferenced footnote, with a reference to a nonexistent footnote: <problematic ids="id84 id17" refid="id83"> [5]_ . <section ids="citations" names="citations"> <title auto="1" refid="id51"> <generated classes="sectnum"> 2.12    Citations <citation backrefs="id5 id18" 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="id18" refid="cit2002"> CIT2002 , and a <problematic ids="id86 id19" refid="id85"> [nonexistent]_ citation. <target refid="another-target"> <section ids="targets another-target" names="targets another\ target"> <title auto="1" refid="id52"> <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="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="targets"> this phrase may also refer to the <reference name="Targets" refid="targets"> Targets section. <target anonymous="1" ids="id20" refid="targets"> <paragraph> Here's a <problematic ids="id88" refid="id87"> `hyperlink reference without a target`_ , which generates an error. <section dupnames="duplicate\ target\ names" ids="duplicate-target-names"> <title auto="1" refid="id53"> <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="id21"> <title auto="1" refid="id54"> <generated classes="sectnum"> 2.13.2    Duplicate Target Names <system_message backrefs="id21" level="1" line="438" source="functional/input/data/standard.txt" type="INFO"> <paragraph> Duplicate implicit target name: "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="id90" refid="id89"> `Duplicate Target Names`_ ), an error is generated. <section ids="directives" names="directives"> <title auto="1" refid="id55"> <generated classes="sectnum"> 2.14    Directives <topic classes="contents local" ids="contents" names="contents"> <bullet_list classes="auto-toc"> <list_item> <paragraph> <reference ids="id74" refid="document-parts"> <generated classes="sectnum"> 2.14.1    Document Parts <list_item> <paragraph> <reference ids="id75" refid="images-and-figures"> <generated classes="sectnum"> 2.14.2    Images and Figures <list_item> <paragraph> <reference ids="id76" refid="admonitions"> <generated classes="sectnum"> 2.14.3    Admonitions <list_item> <paragraph> <reference ids="id77" refid="topics-sidebars-and-rubrics"> <generated classes="sectnum"> 2.14.4    Topics, Sidebars, and Rubrics <list_item> <paragraph> <reference ids="id78" refid="target-footnotes"> <generated classes="sectnum"> 2.14.5    Target Footnotes <list_item> <paragraph> <reference ids="id79" refid="replacement-text"> <generated classes="sectnum"> 2.14.6    Replacement Text <list_item> <paragraph> <reference ids="id80" refid="compound-paragraph"> <generated classes="sectnum"> 2.14.7    Compound Paragraph <list_item> <paragraph> <reference ids="id81" refid="parsed-literal-blocks"> <generated classes="sectnum"> 2.14.8    Parsed Literal Blocks <list_item> <paragraph> <reference ids="id82" refid="code"> <generated classes="sectnum"> 2.14.9    Code <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="id74"> <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-and-figures" names="images\ and\ figures"> <title auto="1" refid="id75"> <generated classes="sectnum"> 2.14.2    Images and Figures <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> Image with multiple IDs: <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"> <paragraph> A centered image: <image align="center" uri="../../../docs/user/rst/images/biohazard.png"> <paragraph> A left-aligned image: <image align="left" uri="../../../docs/user/rst/images/biohazard.png"> <paragraph> This paragraph might flow around the image. The specific behavior depends upon the style sheet and the browser or rendering software used. <paragraph> A right-aligned image: <image align="right" uri="../../../docs/user/rst/images/biohazard.png"> <paragraph> This paragraph might flow around the image. The specific behavior depends upon the style sheet and the browser or rendering software used. <paragraph> For inline images see <reference name="Substitution Definitions" refid="substitution-definitions"> Substitution Definitions . <paragraph> Image size: <paragraph> An image 2 em wide: <image uri="../../../docs/user/rst/images/biohazard.png" width="2em"> <paragraph> An image 2 em wide and 15 pixel high: <image height="15px" uri="../../../docs/user/rst/images/biohazard.png" width="2em"> <paragraph> An image occupying 50% of the line width: <image uri="../../../docs/user/rst/images/title.png" width="50%"> <paragraph> An image 2 cm high: <image height="2cm" uri="../../../docs/user/rst/images/biohazard.png"> <paragraph> A <emphasis> figure is an image with a caption and/or a legend. With page-based output media, figures might float to a different position if this helps the page layout. <figure classes="figclass1 figclass2"> <image alt="reStructuredText, the markup syntax" classes="class1 class2" uri="../../../docs/user/rst/images/title.png" width="258"> <caption> Plaintext markup syntax and parser system. <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. <paragraph> A left-aligned figure: <figure align="left" classes="figclass1 figclass2" width="70%"> <image alt="reStructuredText, the markup syntax" classes="class1 class2" uri="../../../docs/user/rst/images/biohazard.png" width="40px"> <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> The specific behavior depends upon the style sheet and the browser or rendering software used. <paragraph> A centered figure: <figure align="center"> <image uri="../../../docs/user/rst/images/biohazard.png" width="40px"> <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> The specific behavior depends upon the style sheet and the browser or rendering software used. <paragraph> A right-aligned figure: <figure align="right"> <image uri="../../../docs/user/rst/images/biohazard.png" width="40px"> <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. The specific behavior depends upon the style sheet and the browser or rendering software used. <section ids="admonitions" names="admonitions"> <title auto="1" refid="id76"> <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. <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="id77"> <generated classes="sectnum"> 2.14.4    Topics, Sidebars, and Rubrics <paragraph> <emphasis> Sidebars are like miniature, parallel documents. <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 appear beside the main text with a border and a different background or font color. <paragraph> A <emphasis> topic is like a block quote with a title, or a self-contained section with no subsections. <topic> <title> Topic Title <paragraph> This is a topic. <paragraph> A <emphasis> rubric is like an informal heading that doesn't correspond to the document's structure. It is typically highlighted in red (hence the name). <rubric> This is a rubric <paragraph> Topics and rubrics can be used at places where a <reference name="section title" refid="section-title"> section title is not allowed (e.g. inside a directive). <section ids="target-footnotes" names="target\ footnotes"> <title auto="1" refid="id78"> <generated classes="sectnum"> 2.14.5    Target Footnotes <footnote auto="1" backrefs="id26 id27 id28 id31" ids="id25" names="TARGET_NOTE:\ id25"> <label> 5 <paragraph> <reference refuri="http://www.python.org/"> http://www.python.org/ <footnote auto="1" backrefs="id30" ids="id29" names="TARGET_NOTE:\ id29"> <label> 6 <paragraph> <reference refuri="http://pygments.org/"> http://pygments.org/ <footnote auto="1" backrefs="id33" ids="id32" names="TARGET_NOTE:\ id32"> <label> 7 <paragraph> <reference refuri="http://docutils.sourceforge.net/"> http://docutils.sourceforge.net/ <section ids="replacement-text" names="replacement\ text"> <title auto="1" refid="id79"> <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="id28" refid="id25"> 5 . <substitution_definition names="Python"> Python, <emphasis> the best language around <section ids="compound-paragraph" names="compound\ paragraph"> <title auto="1" refid="id80"> <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. This is just to test that it works at all; the results don't have to be meaningful. <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="parsed-literal-blocks" names="parsed\ literal\ blocks"> <title auto="1" refid="id81"> <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="id22" refid="id8"> 1 , <target ids="hyperlink-targets" names="hyperlink\ targets"> hyperlink targets , and <reference name="references" refuri="http://www.python.org/"> references <target ids="references" names="references" refuri="http://www.python.org/"> . <section ids="code" names="code"> <title auto="1" refid="id82"> <generated classes="sectnum"> 2.14.9    Code <paragraph> Blocks of source code can be set with the <title_reference> code directive. If the code language is specified, the content is parsed and tagged by the <reference name="Pygments" refuri="http://pygments.org/"> Pygments <footnote_reference auto="1" ids="id30" refid="id29"> 6 syntax highlighter and can be formatted with a style sheet. (Code parsing is turned off using the <literal> syntax-highlight config setting in the test conversions in order to get identical results with/without installed Pygments highlighter.) <literal_block classes="code python" xml:space="preserve"> print 'This is Python code.' <paragraph> The <literal> :number-lines: option (with optional start value) generates line numbers: <literal_block classes="code python" xml:space="preserve"> <inline classes="ln"> 8 # print integers from 0 to 9: <inline classes="ln"> 9 for i in range(10): <inline classes="ln"> 10 print i <paragraph> For inline code snippets, there is the <title_reference> code role, which can be used directly (the code will not be parsed/tagged, as the language is not known) or as base for special code roles, e.g. the LaTeX code in the next paragraph. <paragraph> Docutils uses LaTeX syntax for math directives and roles: <literal classes="code tex"> \alpha = f(x) prints <math> \alpha = f(x) . <paragraph> The <literal> :code: option of the <title_reference> include directive sets the included content as a code block, here the rst file <literal> header_footer.txt with line numbers: <literal_block classes="code rst" source="functional/input/data/header_footer.txt" xml:space="preserve"> <inline classes="ln"> 1 .. header:: Document header <inline classes="ln"> 2 .. footer:: Document footer <target ids="pygments" names="pygments" refuri="http://pygments.org/"> <section ids="substitution-definitions" names="substitution\ definitions"> <title auto="1" refid="id65"> <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="id66"> <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. Comments may contain non-ASCII characters: ä ö ü æ ø å <paragraph> (View the HTML source to see the comment.) <section ids="raw-text" names="raw\ text"> <title auto="1" refid="id67"> <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="container" names="container"> <title auto="1" refid="id68"> <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="id69"> <generated classes="sectnum"> 2.19    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="id70"> <generated classes="sectnum"> 2.20    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"> <paragraph> Another rowspanning cell. <row> <entry> <paragraph> body row 3 <section ids="complex-tables" names="complex\ tables"> <title auto="1" refid="id71"> <generated classes="sectnum"> 2.21    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="id72"> <generated classes="sectnum"> 2.22    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="id73"> <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="id24" ids="id23" level="3" line="104" source="functional/input/data/standard.txt" type="ERROR"> <paragraph> Undefined substitution referenced: "problematic". <system_message backrefs="id84" ids="id83" level="3" line="391" source="functional/input/data/standard.txt" type="ERROR"> <paragraph> Unknown target name: "5". <system_message backrefs="id86" ids="id85" level="3" line="400" source="functional/input/data/standard.txt" type="ERROR"> <paragraph> Unknown target name: "nonexistent". <system_message backrefs="id88" ids="id87" level="3" line="427" source="functional/input/data/standard.txt" type="ERROR"> <paragraph> Unknown target name: "hyperlink reference without a target". <system_message backrefs="id90" ids="id89" level="3" line="440" source="functional/input/data/standard.txt" type="ERROR"> <paragraph> Duplicate target name, cannot be used as a unique reference: "duplicate target names". <system_message level="1" line="163" source="functional/input/data/standard.txt" type="INFO"> <paragraph> Hyperlink target "target" is not referenced. <system_message level="1" line="405" source="functional/input/data/standard.txt" type="INFO"> <paragraph> Hyperlink target "another-target" is not referenced. <system_message level="1" line="473" source="functional/input/data/standard.txt" type="INFO"> <paragraph> Hyperlink target "image-target-1" is not referenced. <system_message level="1" line="474" source="functional/input/data/standard.txt" type="INFO"> <paragraph> Hyperlink target "image-target-2" is not referenced. <system_message level="1" line="475" source="functional/input/data/standard.txt" type="INFO"> <paragraph> Hyperlink target "image-target-3" is not referenced. <system_message level="1" line="632" source="functional/input/data/standard.txt" type="INFO"> <paragraph> Hyperlink target "docutils" is not referenced. <system_message level="1" line="753" source="functional/input/data/standard.txt" type="INFO"> <paragraph> Hyperlink target "hyperlink targets" is not referenced. �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������docutils-0.11/test/functional/expected/compact_lists.html�������������������������������������������0000644�0001750�0001750�00000003362�12063411436�024441� 0����������������������������������������������������������������������������������������������������ustar �engelbert�����������������������engelbert��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?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.11: http://docutils.sourceforge.net/" /> <title>
  • This is an ordinary simple bullet list.
  • It should be made compact (<p> & </p> tags omitted).

  • This is a bullet list that is not simple.

    There are multiple paragraphs in some items.

  • It should not be made compact.

  • Even though some items may have only one paragraph.


  • This is a simple bullet list, but class="open" is set.

  • It should not be made compact.


  • This is a bullet list that is not simple.

    There are multiple paragraphs in some items.

  • However, the class="compact" setting will cause all first paragraph's <p> & </p> tags to be omitted.
  • Items with multiple paragraphs will not appear changed.
  • Items may have one paragraph, or multiple.

    Items with multiple paragraphs will still be followed by vertical whitespace because of the later paragraphs.

  • The effect is interesting.
docutils-0.11/test/functional/expected/odt_tables1.odt0000644000175000017500000002576212014257243023630 0ustar engelbertengelbertPKtA^2 ''mimetypeapplication/vnd.oasis.opendocument.textPKtA_€Z content.xml][o6}ϯ /[`l拌L]؇ Zmb$8Ǘd[8(J5L,}G~<:[Z-Bba@qE)8إɂ@"1 ,%FBYu|l..F$]`"$Zѱ=XhpDz1{aYX" ˷{Wl Wh /#4.ۑ-!ۼ6X_I/x`kⵒ]Di R4լvd=!lE,P8{] `oSPzߦr|6IR6bbV4Hʢ\9mgjey2IkP:}[l =C8;} pz1gY_~lP O!N( ϻۼ`|<;\ CD3p_8)wTʟ }c=~h~ɗ/2hhe)aDp~I8. cmdP8ȖDzN8䍦L&FxIVl r0@QT2ѧ ϲZ4Di!+˲8X@ICK"2q)^oJfv>l Ðmdʠh'qivDr<-xY-exp9b<*<ݒ5yLw]% /ěn[ӷ@W>ݿS0vE-( 'vY!{3qJВ<Γp8ܣ/WS (؀w;̆(U̩wa^畷.L8ɏ::^t"F?ӧ'g!=v-e)JΕ"Olw?KCnG) [Q0TMKǹ a:~QON OQ>-f9XK$Myy}(J+ͩk6fa6f1l:2tUv!Ue6w5A7wNV ('yYG%ȧiޤu&45uk RBvwQpܕ`ݺ]]C/ǭN@kLk;[]=2XTcjg Ә"p^뼚kEz{J:'e؅5.gTq^nWm{:ܶm{:ܶgUb.Um3 um+5O+rin?0I2"vlh:nÈP?Y=K|nr҂<|ANN 谓vrNN ~ItXKU= Cod;`ͳʩ\I- xqvR3NV@yTJȾO2m~dM22Ӻ$S$S$S$SCI&QM T]b5jDC7BL!2Xk4p7+̪]W՘.jU+ZB{tż~>]ci4gih$ Sd)7=f . KBDq0By̙D@=xm͊DsY s ` N$"n79Eaw4CJ:=g:JU^'ЉaCà à PàVFz|De fge/{Ji޼R))6O `0E*\dI` E!{tKb)h9QyAC.a=(~>SSi- \0ňP:*S;t:\ҙP:vҔNu*e]"tJHS=?(7ıxcX~+nD",v4(ALRtwvg9Vz߼mZ &vVӖPy#IB Z\X`-S'߄fd˶qA Hy0Y~M]H˞nI-tϱ|1)WKkp_W:C:߮p/MUܡpS EMnS$.FMvgˬ9aVzum5/|%)!|/PO'$%?()vQz6k pߵ< `]uxH(]>Tm'6UFkR,o#eB.ߛRZsR+jq~yqJLUHxPPKtA6X SMETA-INF/manifest.xmlM -= ѱ% MZ4M[L-ޱL,NumxvDYj5'T$IQBB?{@RzUmF:+mٹ:j.60XSAsWp Z,.> ӜoʲN:Hp2R'muPKtAm=meta.xmlj oi{5x ysR;*= ]DHD3}\뺬FE4atʠ(\ǃu J{|ȭ=ͯ. ԣDv{\\, bAf[#1/9;& lﰾs=D9v<{8:ܩ8άO{|>O󉋎Sm6OS`!IVk.l,d 181{)ͷ[؊l9\]Kog%za"ub<"D9525۽BBHߌ>Ku:T [> Z>'|_o.+Vc¼?a>š(mZt䴬 A9B"Sۮ3Nx&O/ M{\ӂR hFX+@&դX_'jJ"95"hTd!U&gk5 ^ li>37׀X8ț}D;:t6 Q~\cdCIY?{=3 ]"QMm$9IwLk* 8ص2%$C1Ӽ@ؑ˚2ӿŌ9ҧ )5ؼS0Ď* 2'CS% Z) ?C`ēC+ Ĭ#YG:?IUL)SDb$ovXhGnxSG7.+$ռjzʳ^}5"vI)tN$\:2E \y jE+ӊVO+ZZ!vɪ 3dEE8U|:3ZXѽu=/uںVeZYʢlJL\oRe^SӊnZUwSɪL%z*YuJ d݈J,ӗY'Z-HI:$Qk59riqG<&K6{J[GO%&[m^k1ݦroeU~BYndYiCU u.$ >яQ| G6zIIgӦ28G'͊y=kaLvx[>5LQoG<6;:o8dh@y4{{UIVL<߬Ǐ6MB5$7#mM ȏ`h>˹|;_c|OhJ?qo5eu_| ؄ 7jP'SK&k}5}p?C`Q`h5UH('uIQơ& TO=9V9 !W)VU}ШivJuGh:^u7W$u FBqs(Ԋ ~ ]4FfOvdFW(+YNfL-ZG0!gJFE\k`(i]h`kdQ2H̷ڶYjS|Y4}d>rYnw> uǼkG)vi,?2NH';=&Y{yDu=IG;IFfу3S}&}RY>2;pGuj'鳘lٶHgNljҧUw|h>+m0}Rپ>ۚ)n]\wYLZ-u&,[8.,n]^mv_L4VؼLɭ5ݎ۞ IV4}&m5%>>V^;e<"d%UĶٝ@ZKF]}(~ti _cpO6߱#~/ ëxt`.V-`ni[I6KbyX>,6is^9ox)u(-ՒOt_*Tqܻ@j='WO+V Tbxq:*Z?'PI۶dضY,Z NțTr 'm1:1أ6 Jv*Cϐs)+# u:GڕN}]-3 ı>˴WZՀ]/W8-el\w}0\DE_bį-yp%ֻc$)[+bVw;3]pEy֩pTQMM&$ݯexFEȟIƋgaײ3!ٞ`?Ncl2/P<ׇ#-R[r1}ZϾcrIEˀ{xvj;3 e=<{@8|Ue=<{$ހ.2૞^Yo)aD{xo|mˀoz x՞iEmm=){6g\=E\k tdzsG_)ІЛ\ WScG^_ְ=!uTs6 |ْ*4 &1S ֚- =oMuR/ZZmOe["ڧWIݢքnOoZZkOm["ڧYkbבZHPǮ_x"xzj*ݬsKa72 Xmz\KcV>uoA+sգ+sG1DŽ~^=2=2?`Z_vhh2XslG n\'`Wo!T1^w+\ DtEǫׇgT,']Syz&?w}xOy|>>>5ybh/up?gܗ@$O̯!|z>.@>@>^A>A; W' R77})S_ ӯHˏҝ{E]~1Bjpp}=STtӴgN^)31E7:{zf_Ϝ}=QxsG0Nd 3IxL3<]lL3@Ϥd//WrJ^+9x%J؛`b &`b &`b &`b &F&*w7lfT/3R̨gfF<23*陙Q)ǑJazffTϣ_\87Wͨ_fF8=33*铙Q)ĽJyefT33R>̨Gnfw7?2oF<23*陙Q)ǑJazffT/3R̨gfFIs%ئu@ oH,iuD QD |l.Op".2QR#R'ՐRCq[\+l-ϋ`''b7R1" =EgDEkir`w1Oh ᔊA!D ިzB9LH5]6B ^,=z`Pum^f32Q-v|ЋS2/ JUmm`4f댱XD'Fp6McWUsJ85p*Sa06ōbfZ3$!)fduӟ5)&Zt/#Uj ܊˱ۘ=g?.#1PZ5>)YYaFo;z gY;;!NC0vө kЧb?U'4NK&>ϓ%f3uJR(d5BĩܐmMjgL:f~->==6U e iżtH>a @wŞ O_|ԲBĦȵG~(q4w"< ǩ8<' abi pt{7J 'ҒUH(C4Uw^_ITD ?Ak hӌ$%sYd \@{ʻ2+9FȨU"hy9B:钺DRQPKtA5&FsR# settings.xmlZ[SH~WPyWˬRTakIkO#t\~Ls%|GJs^ԫ 0rr=[W׻y$i5CktK]^zudd \n\]OѲ's75&Wdv~jR]__Wӷ˥1l @vCvUK~͙wwTYjbzTQ?@dTz[0{W=mE{|l|c1('Muݎظ:f/~L7_vy}^Bg}9erze(IΨiˆ™G ā 8b1!!\W\|)"[%͵QYŷ-"t$F-L.2l&_5*yM&D8OhRUbHEgʻT?WEKV/ `hѝ D>^XcnL&L4WGl%_1Z[w}>t'QWydQűUJL.LiwnK*ݩ=We VY uLeǎVa<)Vv|`: _$%)#[sI}`lmlV.,fk>z@ZOsրd))tc?t ߶@ԮwkQFDtzw{Fì%W]౯ߙЗ/Xc;g= b 騢 BXw:al >JM)SJ@X7<XdEKF-QjYـ$_sbڰXop9Wl@٫b(HDQ+-;!OGYLhU:%n׮r%_/ )P06CbSO>T~hg-wPKtA^2 ''mimetypePKtA_€Z Mcontent.xmlPKtA6X S META-INF/manifest.xmlPKtAm= meta.xmlPKtA9^3w_  styles.xmlPKtA5&FsR# %settings.xmlPKZ*docutils-0.11/test/functional/expected/ui/0000755000175000017500000000000012173162603021321 5ustar engelbertengelbertdocutils-0.11/test/functional/expected/ui/default/0000755000175000017500000000000012173162603022745 5ustar engelbertengelbertdocutils-0.11/test/functional/expected/ui/default/pretty.css0000644000175000017500000001044010347413143025004 0ustar engelbertengelbert/* 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-left: 0; margin-right: 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;} .slide-display {display: inline ! important;} .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;} .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;} */ docutils-0.11/test/functional/expected/ui/default/s5-core.css0000644000175000017500000000070310345734741024743 0ustar engelbertengelbert/* 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;} docutils-0.11/test/functional/expected/ui/default/print.css0000644000175000017500000000146210347555440024624 0ustar engelbertengelbert/* 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;} #header {display: none;} #footer h1 {margin: 0; border-bottom: 1px solid; color: gray; font-style: italic;} #footer h2, #controls {display: none;} .print {display: inline ! important;} /* The following rule keeps the layout stuff out of print. Remove at your own risk! */ .layout, .layout * {display: none !important;} docutils-0.11/test/functional/expected/ui/default/slides.css0000644000175000017500000000043310345734741024751 0ustar engelbertengelbert/* 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); docutils-0.11/test/functional/expected/ui/default/outline.css0000644000175000017500000000121010347555440025136 0ustar engelbertengelbert/* 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;} #toggle {border: 1px solid; border-width: 0 0 1px 1px; background: #FFF;} .outline {display: inline ! important;} docutils-0.11/test/functional/expected/ui/default/opera.css0000644000175000017500000000040510345734741024573 0ustar engelbertengelbert/* 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;} docutils-0.11/test/functional/expected/ui/default/blank.gif0000644000175000017500000000006110345734741024527 0ustar engelbertengelbertGIF89a!,T;docutils-0.11/test/functional/expected/ui/default/framing.css0000644000175000017500000000175310345734741025117 0ustar engelbertengelbert/* 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;} */ docutils-0.11/test/functional/expected/ui/default/iepngfix.htc0000644000175000017500000000224610345734741025271 0ustar engelbertengelbert docutils-0.11/test/functional/expected/ui/default/slides.js0000644000175000017500000003667010357271726024613 0ustar engelbertengelbert// S5 v1.1 slides.js -- released into the Public Domain // Modified for Docutils (http://docutils.sf.net) by David Goodger // // 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.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' + '\n') def visit_footer(self, node): self.context.append(len(self.body)) def depart_footer(self, node): start = self.context.pop() footer = [self.starttag(node, 'div', CLASS='footer'), '\n'] footer.extend(self.body[start:]) footer.append('\n\n') self.footer.extend(footer) self.body_suffix[:0] = footer del self.body[start:] def visit_footnote(self, node): self.body.append(self.starttag(node, 'table', CLASS='docutils footnote', frame="void", rules="none")) self.body.append('\n' '\n' '') self.footnote_backrefs(node) def footnote_backrefs(self, node): backlinks = [] backrefs = node['backrefs'] if self.settings.footnote_backlinks and backrefs: if len(backrefs) == 1: self.context.append('') self.context.append('') self.context.append('' % backrefs[0]) else: i = 1 for backref in backrefs: backlinks.append('%s' % (backref, i)) i += 1 self.context.append('(%s) ' % ', '.join(backlinks)) self.context += ['', ''] else: self.context.append('') self.context += ['', ''] # If the node does not only consist of a label. if len(node) > 1: # If there are preceding backlinks, we do not set class # 'first', because we need to retain the top-margin. if not backlinks: node[1]['classes'].append('first') node[-1]['classes'].append('last') def depart_footnote(self, node): self.body.append('\n' '\n\n') def visit_footnote_reference(self, node): href = '#' + node['refid'] format = self.settings.footnote_references if format == 'brackets': suffix = '[' self.context.append(']') else: assert format == 'superscript' suffix = '' self.context.append('') self.body.append(self.starttag(node, 'a', suffix, CLASS='footnote-reference', href=href)) def depart_footnote_reference(self, node): self.body.append(self.context.pop() + '') def visit_generated(self, node): pass def depart_generated(self, node): pass def visit_header(self, node): self.context.append(len(self.body)) def depart_header(self, node): start = self.context.pop() header = [self.starttag(node, 'div', CLASS='header')] header.extend(self.body[start:]) header.append('\n
\n\n') self.body_prefix.extend(header) self.header.extend(header) del self.body[start:] def visit_image(self, node): atts = {} uri = node['uri'] # place SVG and SWF images in an element types = {'.svg': 'image/svg+xml', '.swf': 'application/x-shockwave-flash'} ext = os.path.splitext(uri)[1].lower() if ext in ('.svg', '.swf'): atts['data'] = uri atts['type'] = types[ext] else: atts['src'] = uri atts['alt'] = node.get('alt', uri) # image size if 'width' in node: atts['width'] = node['width'] if 'height' in node: atts['height'] = node['height'] if 'scale' in node: if (PIL and not ('width' in node and 'height' in node) and self.settings.file_insertion_enabled): imagepath = urllib.url2pathname(uri) try: img = PIL.Image.open( imagepath.encode(sys.getfilesystemencoding())) except (IOError, UnicodeEncodeError): pass # TODO: warn? else: self.settings.record_dependencies.add( imagepath.replace('\\', '/')) if 'width' not in atts: atts['width'] = str(img.size[0]) if 'height' not in atts: atts['height'] = str(img.size[1]) del img for att_name in 'width', 'height': if att_name in atts: match = re.match(r'([0-9.]+)(\S*)$', atts[att_name]) assert match atts[att_name] = '%s%s' % ( float(match.group(1)) * (float(node['scale']) / 100), match.group(2)) style = [] for att_name in 'width', 'height': if att_name in atts: if re.match(r'^[0-9.]+$', atts[att_name]): # Interpret unitless values as pixels. atts[att_name] += 'px' style.append('%s: %s;' % (att_name, atts[att_name])) del atts[att_name] if style: atts['style'] = ' '.join(style) if (isinstance(node.parent, nodes.TextElement) or (isinstance(node.parent, nodes.reference) and not isinstance(node.parent.parent, nodes.TextElement))): # Inline context or surrounded by .... suffix = '' else: suffix = '\n' if 'align' in node: atts['class'] = 'align-%s' % node['align'] self.context.append('') if ext in ('.svg', '.swf'): # place in an object element, # do NOT use an empty tag: incorrect rendering in browsers self.body.append(self.starttag(node, 'object', suffix, **atts) + node.get('alt', uri) + '' + suffix) else: self.body.append(self.emptytag(node, 'img', suffix, **atts)) def depart_image(self, node): self.body.append(self.context.pop()) def visit_inline(self, node): self.body.append(self.starttag(node, 'span', '')) def depart_inline(self, node): self.body.append('') def visit_label(self, node): # Context added in footnote_backrefs. self.body.append(self.starttag(node, 'td', '%s[' % self.context.pop(), CLASS='label')) def depart_label(self, node): # Context added in footnote_backrefs. self.body.append(']%s%s' % (self.context.pop(), self.context.pop())) def visit_legend(self, node): self.body.append(self.starttag(node, 'div', CLASS='legend')) def depart_legend(self, node): self.body.append('\n') def visit_line(self, node): self.body.append(self.starttag(node, 'div', suffix='', CLASS='line')) if not len(node): self.body.append('
') def depart_line(self, node): self.body.append('\n') def visit_line_block(self, node): self.body.append(self.starttag(node, 'div', CLASS='line-block')) def depart_line_block(self, node): self.body.append('\n') def visit_list_item(self, node): self.body.append(self.starttag(node, 'li', '')) if len(node): node[0]['classes'].append('first') def depart_list_item(self, node): self.body.append('\n') def visit_literal(self, node): # special case: "code" role classes = node.get('classes', []) if 'code' in classes: # filter 'code' from class arguments node['classes'] = [cls for cls in classes if cls != 'code'] self.body.append(self.starttag(node, 'code', '')) return self.body.append( self.starttag(node, 'tt', '', CLASS='docutils literal')) text = node.astext() for token in self.words_and_spaces.findall(text): if token.strip(): # Protect text like "--an-option" and the regular expression # ``[+]?(\d+(\.\d*)?|\.\d+)`` from bad line wrapping if self.sollbruchstelle.search(token): self.body.append('%s' % self.encode(token)) else: self.body.append(self.encode(token)) elif token in ('\n', ' '): # Allow breaks at whitespace: self.body.append(token) else: # Protect runs of multiple spaces; the last space can wrap: self.body.append(' ' * (len(token) - 1) + ' ') self.body.append('') # Content already processed: raise nodes.SkipNode def depart_literal(self, node): # skipped unless literal element is from "code" role: self.body.append('') def visit_literal_block(self, node): self.body.append(self.starttag(node, 'pre', CLASS='literal-block')) def depart_literal_block(self, node): self.body.append('\n\n') def visit_math(self, node, math_env=''): # If the method is called from visit_math_block(), math_env != ''. # As there is no native HTML math support, we provide alternatives: # LaTeX and MathJax math_output modes simply wrap the content, # HTML and MathML math_output modes also convert the math_code. if self.math_output not in ('mathml', 'html', 'mathjax', 'latex'): self.document.reporter.error( 'math-output format "%s" not supported ' 'falling back to "latex"'% self.math_output) self.math_output = 'latex' # # HTML container tags = {# math_output: (block, inline, class-arguments) 'mathml': ('div', '', ''), 'html': ('div', 'span', 'formula'), 'mathjax': ('div', 'span', 'math'), 'latex': ('pre', 'tt', 'math'), } tag = tags[self.math_output][math_env == ''] clsarg = tags[self.math_output][2] # LaTeX container wrappers = {# math_mode: (inline, block) 'mathml': (None, None), 'html': ('$%s$', u'\\begin{%s}\n%s\n\\end{%s}'), 'mathjax': ('\(%s\)', u'\\begin{%s}\n%s\n\\end{%s}'), 'latex': (None, None), } wrapper = wrappers[self.math_output][math_env != ''] # get and wrap content math_code = node.astext().translate(unichar2tex.uni2tex_table) if wrapper and math_env: math_code = wrapper % (math_env, math_code, math_env) elif wrapper: math_code = wrapper % math_code # settings and conversion if self.math_output in ('latex', 'mathjax'): math_code = self.encode(math_code) if self.math_output == 'mathjax' and not self.math_header: if self.math_output_options: self.mathjax_url = self.math_output_options[0] self.math_header = [self.mathjax_script % self.mathjax_url] elif self.math_output == 'html': if self.math_output_options and not self.math_header: self.math_header = [self.stylesheet_call( utils.find_file_in_dirs(s, self.settings.stylesheet_dirs)) for s in self.math_output_options[0].split(',')] # TODO: fix display mode in matrices and fractions math2html.DocumentParameters.displaymode = (math_env != '') math_code = math2html.math2html(math_code) elif self.math_output == 'mathml': self.doctype = self.doctype_mathml self.content_type = self.content_type_mathml try: mathml_tree = parse_latex_math(math_code, inline=not(math_env)) math_code = ''.join(mathml_tree.xml()) except SyntaxError, err: err_node = self.document.reporter.error(err, base_node=node) self.visit_system_message(err_node) self.body.append(self.starttag(node, 'p')) self.body.append(u','.join(err.args)) self.body.append('

\n') self.body.append(self.starttag(node, 'pre', CLASS='literal-block')) self.body.append(self.encode(math_code)) self.body.append('\n\n') self.depart_system_message(err_node) raise nodes.SkipNode # append to document body if tag: self.body.append(self.starttag(node, tag, suffix='\n'*bool(math_env), CLASS=clsarg)) self.body.append(math_code) if math_env: self.body.append('\n') if tag: self.body.append('\n' % tag) # Content already processed: raise nodes.SkipNode def depart_math(self, node): pass # never reached def visit_math_block(self, node): # print node.astext().encode('utf8') math_env = pick_math_environment(node.astext()) self.visit_math(node, math_env=math_env) def depart_math_block(self, node): pass # never reached def visit_meta(self, node): meta = self.emptytag(node, 'meta', **node.non_default_attributes()) self.add_meta(meta) def depart_meta(self, node): pass def add_meta(self, tag): self.meta.append(tag) self.head.append(tag) def visit_option(self, node): if self.context[-1]: self.body.append(', ') self.body.append(self.starttag(node, 'span', '', CLASS='option')) def depart_option(self, node): self.body.append('') self.context[-1] += 1 def visit_option_argument(self, node): self.body.append(node.get('delimiter', ' ')) self.body.append(self.starttag(node, 'var', '')) def depart_option_argument(self, node): self.body.append('') def visit_option_group(self, node): atts = {} if ( self.settings.option_limit and len(node.astext()) > self.settings.option_limit): atts['colspan'] = 2 self.context.append('\n ') else: self.context.append('') self.body.append( self.starttag(node, 'td', CLASS='option-group', **atts)) self.body.append('') self.context.append(0) # count number of options def depart_option_group(self, node): self.context.pop() self.body.append('\n') self.body.append(self.context.pop()) def visit_option_list(self, node): self.body.append( self.starttag(node, 'table', CLASS='docutils option-list', frame="void", rules="none")) self.body.append('\n' '\n' '\n') def depart_option_list(self, node): self.body.append('\n\n') def visit_option_list_item(self, node): self.body.append(self.starttag(node, 'tr', '')) def depart_option_list_item(self, node): self.body.append('\n') def visit_option_string(self, node): pass def depart_option_string(self, node): pass def visit_organization(self, node): self.visit_docinfo_item(node, 'organization') def depart_organization(self, node): self.depart_docinfo_item() def should_be_compact_paragraph(self, node): """ Determine if the

tags around paragraph ``node`` can be omitted. """ if (isinstance(node.parent, nodes.document) or isinstance(node.parent, nodes.compound)): # Never compact paragraphs in document or compound. return False for key, value in node.attlist(): if (node.is_not_default(key) and not (key == 'classes' and value in ([], ['first'], ['last'], ['first', 'last']))): # Attribute which needs to survive. return False first = isinstance(node.parent[0], nodes.label) # skip label for child in node.parent.children[first:]: # only first paragraph can be compact if isinstance(child, nodes.Invisible): continue if child is node: break return False parent_length = len([n for n in node.parent if not isinstance( n, (nodes.Invisible, nodes.label))]) if ( self.compact_simple or self.compact_field_list or self.compact_p and parent_length == 1): return True return False def visit_paragraph(self, node): if self.should_be_compact_paragraph(node): self.context.append('') else: self.body.append(self.starttag(node, 'p', '')) self.context.append('

\n') def depart_paragraph(self, node): self.body.append(self.context.pop()) def visit_problematic(self, node): if node.hasattr('refid'): self.body.append('' % node['refid']) self.context.append('') else: self.context.append('') self.body.append(self.starttag(node, 'span', '', CLASS='problematic')) def depart_problematic(self, node): self.body.append('') self.body.append(self.context.pop()) def visit_raw(self, node): if 'html' in node.get('format', '').split(): t = isinstance(node.parent, nodes.TextElement) and 'span' or 'div' if node['classes']: self.body.append(self.starttag(node, t, suffix='')) self.body.append(node.astext()) if node['classes']: self.body.append('' % t) # Keep non-HTML raw text out of output: raise nodes.SkipNode def visit_reference(self, node): atts = {'class': 'reference'} if 'refuri' in node: atts['href'] = node['refuri'] if ( self.settings.cloak_email_addresses and atts['href'].startswith('mailto:')): atts['href'] = self.cloak_mailto(atts['href']) self.in_mailto = True atts['class'] += ' external' else: assert 'refid' in node, \ 'References must have "refuri" or "refid" attribute.' atts['href'] = '#' + node['refid'] atts['class'] += ' internal' if not isinstance(node.parent, nodes.TextElement): assert len(node) == 1 and isinstance(node[0], nodes.image) atts['class'] += ' image-reference' self.body.append(self.starttag(node, 'a', '', **atts)) def depart_reference(self, node): self.body.append('') if not isinstance(node.parent, nodes.TextElement): self.body.append('\n') self.in_mailto = False def visit_revision(self, node): self.visit_docinfo_item(node, 'revision', meta=False) def depart_revision(self, node): self.depart_docinfo_item() def visit_row(self, node): self.body.append(self.starttag(node, 'tr', '')) node.column = 0 def depart_row(self, node): self.body.append('\n') def visit_rubric(self, node): self.body.append(self.starttag(node, 'p', '', CLASS='rubric')) def depart_rubric(self, node): self.body.append('

\n') def visit_section(self, node): self.section_level += 1 self.body.append( self.starttag(node, 'div', CLASS='section')) def depart_section(self, node): self.section_level -= 1 self.body.append('\n') def visit_sidebar(self, node): self.body.append( self.starttag(node, 'div', CLASS='sidebar')) self.set_first_last(node) self.in_sidebar = True def depart_sidebar(self, node): self.body.append('\n') self.in_sidebar = False def visit_status(self, node): self.visit_docinfo_item(node, 'status', meta=False) def depart_status(self, node): self.depart_docinfo_item() def visit_strong(self, node): self.body.append(self.starttag(node, 'strong', '')) def depart_strong(self, node): self.body.append('
') def visit_subscript(self, node): self.body.append(self.starttag(node, 'sub', '')) def depart_subscript(self, node): self.body.append('') def visit_substitution_definition(self, node): """Internal only.""" raise nodes.SkipNode def visit_substitution_reference(self, node): self.unimplemented_visit(node) def visit_subtitle(self, node): if isinstance(node.parent, nodes.sidebar): self.body.append(self.starttag(node, 'p', '', CLASS='sidebar-subtitle')) self.context.append('

\n') elif isinstance(node.parent, nodes.document): self.body.append(self.starttag(node, 'h2', '', CLASS='subtitle')) self.context.append('\n') self.in_document_title = len(self.body) elif isinstance(node.parent, nodes.section): tag = 'h%s' % (self.section_level + self.initial_header_level - 1) self.body.append( self.starttag(node, tag, '', CLASS='section-subtitle') + self.starttag({}, 'span', '', CLASS='section-subtitle')) self.context.append('\n' % tag) def depart_subtitle(self, node): self.body.append(self.context.pop()) if self.in_document_title: self.subtitle = self.body[self.in_document_title:-1] self.in_document_title = 0 self.body_pre_docinfo.extend(self.body) self.html_subtitle.extend(self.body) del self.body[:] def visit_superscript(self, node): self.body.append(self.starttag(node, 'sup', '')) def depart_superscript(self, node): self.body.append('') def visit_system_message(self, node): self.body.append(self.starttag(node, 'div', CLASS='system-message')) self.body.append('

') backref_text = '' if len(node['backrefs']): backrefs = node['backrefs'] if len(backrefs) == 1: backref_text = ('; backlink' % backrefs[0]) else: i = 1 backlinks = [] for backref in backrefs: backlinks.append('%s' % (backref, i)) i += 1 backref_text = ('; backlinks: %s' % ', '.join(backlinks)) if node.hasattr('line'): line = ', line %s' % node['line'] else: line = '' self.body.append('System Message: %s/%s ' '(%s%s)%s

\n' % (node['type'], node['level'], self.encode(node['source']), line, backref_text)) def depart_system_message(self, node): self.body.append('\n') def visit_table(self, node): self.context.append(self.compact_p) self.compact_p = True classes = ' '.join(['docutils', self.settings.table_style]).strip() self.body.append( self.starttag(node, 'table', CLASS=classes, border="1")) def depart_table(self, node): self.compact_p = self.context.pop() self.body.append('\n') def visit_target(self, node): if not ('refuri' in node or 'refid' in node or 'refname' in node): self.body.append(self.starttag(node, 'span', '', CLASS='target')) self.context.append('') else: self.context.append('') def depart_target(self, node): self.body.append(self.context.pop()) def visit_tbody(self, node): self.write_colspecs() self.body.append(self.context.pop()) # '\n' or '' self.body.append(self.starttag(node, 'tbody', valign='top')) def depart_tbody(self, node): self.body.append('\n') def visit_term(self, node): self.body.append(self.starttag(node, 'dt', '')) def depart_term(self, node): """ Leave the end tag to `self.visit_definition()`, in case there's a classifier. """ pass def visit_tgroup(self, node): # Mozilla needs : self.body.append(self.starttag(node, 'colgroup')) # Appended by thead or tbody: self.context.append('\n') node.stubs = [] def depart_tgroup(self, node): pass def visit_thead(self, node): self.write_colspecs() self.body.append(self.context.pop()) # '\n' # There may or may not be a ; this is for to use: self.context.append('') self.body.append(self.starttag(node, 'thead', valign='bottom')) def depart_thead(self, node): self.body.append('\n') def visit_title(self, node): """Only 6 section levels are supported by HTML.""" check_id = 0 # TODO: is this a bool (False) or a counter? close_tag = '

\n' if isinstance(node.parent, nodes.topic): self.body.append( self.starttag(node, 'p', '', CLASS='topic-title first')) elif isinstance(node.parent, nodes.sidebar): self.body.append( self.starttag(node, 'p', '', CLASS='sidebar-title')) elif isinstance(node.parent, nodes.Admonition): self.body.append( self.starttag(node, 'p', '', CLASS='admonition-title')) elif isinstance(node.parent, nodes.table): self.body.append( self.starttag(node, 'caption', '')) close_tag = '\n' elif isinstance(node.parent, nodes.document): self.body.append(self.starttag(node, 'h1', '', CLASS='title')) close_tag = '\n' self.in_document_title = len(self.body) else: assert isinstance(node.parent, nodes.section) h_level = self.section_level + self.initial_header_level - 1 atts = {} if (len(node.parent) >= 2 and isinstance(node.parent[1], nodes.subtitle)): atts['CLASS'] = 'with-subtitle' self.body.append( self.starttag(node, 'h%s' % h_level, '', **atts)) atts = {} if node.hasattr('refid'): atts['class'] = 'toc-backref' atts['href'] = '#' + node['refid'] if atts: self.body.append(self.starttag({}, 'a', '', **atts)) close_tag = '\n' % (h_level) else: close_tag = '\n' % (h_level) self.context.append(close_tag) def depart_title(self, node): self.body.append(self.context.pop()) if self.in_document_title: self.title = self.body[self.in_document_title:-1] self.in_document_title = 0 self.body_pre_docinfo.extend(self.body) self.html_title.extend(self.body) del self.body[:] def visit_title_reference(self, node): self.body.append(self.starttag(node, 'cite', '')) def depart_title_reference(self, node): self.body.append('') def visit_topic(self, node): self.body.append(self.starttag(node, 'div', CLASS='topic')) self.topic_classes = node['classes'] def depart_topic(self, node): self.body.append('\n') self.topic_classes = [] def visit_transition(self, node): self.body.append(self.emptytag(node, 'hr', CLASS='docutils')) def depart_transition(self, node): pass def visit_version(self, node): self.visit_docinfo_item(node, 'version', meta=False) def depart_version(self, node): self.depart_docinfo_item() def unimplemented_visit(self, node): raise NotImplementedError('visiting unimplemented node type: %s' % node.__class__.__name__) class SimpleListChecker(nodes.GenericNodeVisitor): """ Raise `nodes.NodeFound` if non-simple list item is encountered. Here "simple" means a list item containing nothing other than a single paragraph, a simple list, or a paragraph followed by a simple list. """ def default_visit(self, node): raise nodes.NodeFound def visit_bullet_list(self, node): pass def visit_enumerated_list(self, node): pass def visit_list_item(self, node): children = [] for child in node.children: if not isinstance(child, nodes.Invisible): children.append(child) if (children and isinstance(children[0], nodes.paragraph) and (isinstance(children[-1], nodes.bullet_list) or isinstance(children[-1], nodes.enumerated_list))): children.pop() if len(children) <= 1: return else: raise nodes.NodeFound def visit_paragraph(self, node): raise nodes.SkipNode def invisible_visit(self, node): """Invisible nodes should be ignored.""" raise nodes.SkipNode visit_comment = invisible_visit visit_substitution_definition = invisible_visit visit_target = invisible_visit visit_pending = invisible_visit docutils-0.11/docutils/writers/html4css1/html4css1.css0000644000175000017500000001530512111441607023465 0ustar engelbertengelbert/* :Author: David Goodger (goodger@python.org) :Id: $Id: html4css1.css 7614 2013-02-21 15:55:51Z milde $ :Copyright: This stylesheet has been placed in the public domain. Default cascading style sheet for the HTML output of Docutils. See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to customize this style sheet. */ /* used to remove borders from tables and images */ .borderless, table.borderless td, table.borderless th { border: 0 } table.borderless td, table.borderless th { /* Override padding for "table.docutils td" with "! important". The right padding separates the table cells. */ padding: 0 0.5em 0 0 ! important } .first { /* Override more specific margin styles with "! important". */ margin-top: 0 ! important } .last, .with-subtitle { margin-bottom: 0 ! important } .hidden { display: none } a.toc-backref { text-decoration: none ; color: black } blockquote.epigraph { margin: 2em 5em ; } dl.docutils dd { margin-bottom: 0.5em } object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] { overflow: hidden; } /* Uncomment (and remove this text!) to get bold-faced definition list terms dl.docutils dt { font-weight: bold } */ div.abstract { margin: 2em 5em } div.abstract p.topic-title { font-weight: bold ; text-align: center } div.admonition, div.attention, div.caution, div.danger, div.error, div.hint, div.important, div.note, div.tip, div.warning { margin: 2em ; border: medium outset ; padding: 1em } div.admonition p.admonition-title, div.hint p.admonition-title, div.important p.admonition-title, div.note p.admonition-title, div.tip p.admonition-title { font-weight: bold ; font-family: sans-serif } div.attention p.admonition-title, div.caution p.admonition-title, div.danger p.admonition-title, div.error p.admonition-title, div.warning p.admonition-title, .code .error { color: red ; font-weight: bold ; font-family: sans-serif } /* Uncomment (and remove this text!) to get reduced vertical space in compound paragraphs. div.compound .compound-first, div.compound .compound-middle { margin-bottom: 0.5em } div.compound .compound-last, div.compound .compound-middle { margin-top: 0.5em } */ div.dedication { margin: 2em 5em ; text-align: center ; font-style: italic } div.dedication p.topic-title { font-weight: bold ; font-style: normal } div.figure { margin-left: 2em ; margin-right: 2em } div.footer, div.header { clear: both; font-size: smaller } div.line-block { display: block ; margin-top: 1em ; margin-bottom: 1em } div.line-block div.line-block { margin-top: 0 ; margin-bottom: 0 ; margin-left: 1.5em } div.sidebar { margin: 0 0 0.5em 1em ; border: medium outset ; padding: 1em ; background-color: #ffffee ; width: 40% ; float: right ; clear: right } div.sidebar p.rubric { font-family: sans-serif ; font-size: medium } div.system-messages { margin: 5em } div.system-messages h1 { color: red } div.system-message { border: medium outset ; padding: 1em } div.system-message p.system-message-title { color: red ; font-weight: bold } div.topic { margin: 2em } h1.section-subtitle, h2.section-subtitle, h3.section-subtitle, h4.section-subtitle, h5.section-subtitle, h6.section-subtitle { margin-top: 0.4em } h1.title { text-align: center } h2.subtitle { text-align: center } hr.docutils { width: 75% } img.align-left, .figure.align-left, object.align-left { clear: left ; float: left ; margin-right: 1em } img.align-right, .figure.align-right, object.align-right { clear: right ; float: right ; margin-left: 1em } img.align-center, .figure.align-center, object.align-center { display: block; margin-left: auto; margin-right: auto; } .align-left { text-align: left } .align-center { clear: both ; text-align: center } .align-right { text-align: right } /* reset inner alignment in figures */ div.align-right { text-align: inherit } /* div.align-center * { */ /* text-align: left } */ ol.simple, ul.simple { margin-bottom: 1em } ol.arabic { list-style: decimal } ol.loweralpha { list-style: lower-alpha } ol.upperalpha { list-style: upper-alpha } ol.lowerroman { list-style: lower-roman } ol.upperroman { list-style: upper-roman } p.attribution { text-align: right ; margin-left: 50% } p.caption { font-style: italic } p.credits { font-style: italic ; font-size: smaller } p.label { white-space: nowrap } p.rubric { font-weight: bold ; font-size: larger ; color: maroon ; text-align: center } p.sidebar-title { font-family: sans-serif ; font-weight: bold ; font-size: larger } p.sidebar-subtitle { font-family: sans-serif ; font-weight: bold } p.topic-title { font-weight: bold } pre.address { margin-bottom: 0 ; margin-top: 0 ; font: inherit } pre.literal-block, pre.doctest-block, pre.math, pre.code { margin-left: 2em ; margin-right: 2em } pre.code .ln { color: grey; } /* line numbers */ pre.code, code { background-color: #eeeeee } pre.code .comment, code .comment { color: #5C6576 } pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold } pre.code .literal.string, code .literal.string { color: #0C5404 } pre.code .name.builtin, code .name.builtin { color: #352B84 } pre.code .deleted, code .deleted { background-color: #DEB0A1} pre.code .inserted, code .inserted { background-color: #A3D289} span.classifier { font-family: sans-serif ; font-style: oblique } span.classifier-delimiter { font-family: sans-serif ; font-weight: bold } span.interpreted { font-family: sans-serif } span.option { white-space: nowrap } span.pre { white-space: pre } span.problematic { color: red } span.section-subtitle { /* font-size relative to parent (h1..h6 element) */ font-size: 80% } table.citation { border-left: solid 1px gray; margin-left: 1px } table.docinfo { margin: 2em 4em } table.docutils { margin-top: 0.5em ; margin-bottom: 0.5em } table.footnote { border-left: solid 1px black; margin-left: 1px } table.docutils td, table.docutils th, table.docinfo td, table.docinfo th { padding-left: 0.5em ; padding-right: 0.5em ; vertical-align: top } table.docutils th.field-name, table.docinfo th.docinfo-name { font-weight: bold ; text-align: left ; white-space: nowrap ; padding-left: 0 } /* "booktabs" style (no vertical lines) */ table.docutils.booktabs { border: 0px; border-top: 2px solid; border-bottom: 2px solid; border-collapse: collapse; } table.docutils.booktabs * { border: 0px; } table.docutils.booktabs th { border-bottom: thin solid; text-align: left; } h1 tt.docutils, h2 tt.docutils, h3 tt.docutils, h4 tt.docutils, h5 tt.docutils, h6 tt.docutils { font-size: 100% } ul.auto-toc { list-style-type: none } docutils-0.11/docutils/writers/xetex/0000755000175000017500000000000012173162603020444 5ustar engelbertengelbertdocutils-0.11/docutils/writers/xetex/__init__.py0000644000175000017500000001215512153360646022566 0ustar engelbertengelbert#!/usr/bin/env python # -*- coding: utf-8 -*- # :Author: Günter Milde # :Revision: $Revision: 7668 $ # :Date: $Date: 2013-06-04 14:46:30 +0200 (Tue, 04 Jun 2013) $ # :Copyright: © 2010 Günter Milde. # :License: Released under the terms of the `2-Clause BSD license`_, in short: # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. # This file is offered as-is, without any warranty. # # .. _2-Clause BSD license: http://www.spdx.org/licenses/BSD-2-Clause """ XeLaTeX document tree Writer. A variant of Docutils' standard 'latex2e' writer producing output suited for processing with XeLaTeX (http://tug.org/xetex/). """ __docformat__ = 'reStructuredText' import os import os.path import re import docutils from docutils import frontend, nodes, utils, writers, languages from docutils.writers import latex2e class Writer(latex2e.Writer): """A writer for Unicode-based LaTeX variants (XeTeX, LuaTeX)""" supported = ('xetex','xelatex','luatex') """Formats this writer supports.""" default_template = 'xelatex.tex' default_preamble = '\n'.join([ r'% Linux Libertine (free, wide coverage, not only for Linux)', r'\setmainfont{Linux Libertine O}', r'\setsansfont{Linux Biolinum O}', r'\setmonofont[HyphenChar=None,Scale=MatchLowercase]{DejaVu Sans Mono}', ]) config_section = 'xetex writer' config_section_dependencies = ('writers', 'latex2e writer') settings_spec = frontend.filter_settings_spec( latex2e.Writer.settings_spec, 'font_encoding', template=('Template file. Default: "%s".' % default_template, ['--template'], {'default': default_template, 'metavar': ''}), latex_preamble=('Customization by LaTeX code in the preamble. ' 'Default: select PDF standard fonts (Times, Helvetica, Courier).', ['--latex-preamble'], {'default': default_preamble}), ) def __init__(self): latex2e.Writer.__init__(self) self.settings_defaults.update({'fontencoding': ''}) # use default (EU1 or EU2) self.translator_class = XeLaTeXTranslator class Babel(latex2e.Babel): """Language specifics for XeTeX. Use `polyglossia` instead of `babel` and adapt settings. """ language_codes = latex2e.Babel.language_codes.copy() # Additionally supported or differently named languages: language_codes.update({ # code Polyglossia-name comment 'cop': 'coptic', 'de': 'german', # new spelling (de_1996) 'de-1901': 'ogerman', # old spelling 'dv': 'divehi', # Maldivian 'dsb': 'lsorbian', 'el-polyton': 'polygreek', 'fa': 'farsi', 'grc': 'ancientgreek', 'hsb': 'usorbian', 'sh-Cyrl': 'serbian', # Serbo-Croatian, Cyrillic script 'sh-Latn': 'croatian', # Serbo-Croatian, Latin script 'sq': 'albanian', 'sr': 'serbian', # Cyrillic script (sr-Cyrl) 'th': 'thai', 'vi': 'vietnamese', # zh-Latn: ??? # Chinese Pinyin }) # normalize (downcase) keys language_codes = dict([(k.lower(), v) for (k,v) in language_codes.items()]) # Languages without Polyglossia support: for key in ('af', # 'afrikaans', 'de-AT', # 'naustrian', 'de-AT-1901', # 'austrian', 'fr-CA', # 'canadien', 'grc-ibycus', # 'ibycus', (Greek Ibycus encoding) 'sr-Latn', # 'serbian script=latin' ): del(language_codes[key.lower()]) def __init__(self, language_code, reporter): self.language_code = language_code self.reporter = reporter self.language = self.language_name(language_code) self.otherlanguages = {} self.warn_msg = 'Language "%s" not supported by XeTeX (polyglossia).' self.quote_index = 0 self.quotes = ('"', '"') # language dependent configuration: # double quotes are "active" in some languages (e.g. German). self.literal_double_quote = u'"' # TODO: use \textquotedbl def __call__(self): setup = [r'\usepackage{polyglossia}', r'\setdefaultlanguage{%s}' % self.language] if self.otherlanguages: setup.append(r'\setotherlanguages{%s}' % ','.join(sorted(self.otherlanguages.keys()))) return '\n'.join(setup) class XeLaTeXTranslator(latex2e.LaTeXTranslator): def __init__(self, document): self.is_xetex = True # typeset with XeTeX or LuaTeX engine latex2e.LaTeXTranslator.__init__(self, document, Babel) if self.latex_encoding == 'utf8': self.requirements.pop('_inputenc', None) else: self.requirements['_inputenc'] = (r'\XeTeXinputencoding %s ' % self.latex_encoding) docutils-0.11/docutils/writers/s5_html/0000755000175000017500000000000012173162603020662 5ustar engelbertengelbertdocutils-0.11/docutils/writers/s5_html/__init__.py0000644000175000017500000003420612012427175023000 0ustar engelbertengelbert# $Id: __init__.py 7494 2012-08-14 10:54:53Z milde $ # Authors: Chris Liechti ; # David Goodger # Copyright: This module has been placed in the public domain. """ S5/HTML Slideshow Writer. """ __docformat__ = 'reStructuredText' import sys import os import re import docutils from docutils import frontend, nodes, utils from docutils.writers import html4css1 from docutils.parsers.rst import directives from docutils._compat import b themes_dir_path = utils.relative_path( os.path.join(os.getcwd(), 'dummy'), os.path.join(os.path.dirname(__file__), 'themes')) def find_theme(name): # Where else to look for a theme? # Check working dir? Destination dir? Config dir? Plugins dir? path = os.path.join(themes_dir_path, name) if not os.path.isdir(path): raise docutils.ApplicationError( 'Theme directory not found: %r (path: %r)' % (name, path)) return path class Writer(html4css1.Writer): settings_spec = html4css1.Writer.settings_spec + ( 'S5 Slideshow Specific Options', 'For the S5/HTML writer, the --no-toc-backlinks option ' '(defined in General Docutils Options above) is the default, ' 'and should not be changed.', (('Specify an installed S5 theme by name. Overrides --theme-url. ' 'The default theme name is "default". The theme files will be ' 'copied into a "ui/" directory, in the same directory as the ' 'destination file (output HTML). Note that existing theme files ' 'will not be overwritten (unless --overwrite-theme-files is used).', ['--theme'], {'default': 'default', 'metavar': '', 'overrides': 'theme_url'}), ('Specify an S5 theme URL. The destination file (output HTML) will ' 'link to this theme; nothing will be copied. Overrides --theme.', ['--theme-url'], {'metavar': '', 'overrides': 'theme'}), ('Allow existing theme files in the ``ui/`` directory to be ' 'overwritten. The default is not to overwrite theme files.', ['--overwrite-theme-files'], {'action': 'store_true', 'validator': frontend.validate_boolean}), ('Keep existing theme files in the ``ui/`` directory; do not ' 'overwrite any. This is the default.', ['--keep-theme-files'], {'dest': 'overwrite_theme_files', 'action': 'store_false'}), ('Set the initial view mode to "slideshow" [default] or "outline".', ['--view-mode'], {'choices': ['slideshow', 'outline'], 'default': 'slideshow', 'metavar': ''}), ('Normally hide the presentation controls in slideshow mode. ' 'This is the default.', ['--hidden-controls'], {'action': 'store_true', 'default': True, 'validator': frontend.validate_boolean}), ('Always show the presentation controls in slideshow mode. ' 'The default is to hide the controls.', ['--visible-controls'], {'dest': 'hidden_controls', 'action': 'store_false'}), ('Enable the current slide indicator ("1 / 15"). ' 'The default is to disable it.', ['--current-slide'], {'action': 'store_true', 'validator': frontend.validate_boolean}), ('Disable the current slide indicator. This is the default.', ['--no-current-slide'], {'dest': 'current_slide', 'action': 'store_false'}),)) settings_default_overrides = {'toc_backlinks': 0} config_section = 's5_html writer' config_section_dependencies = ('writers', 'html4css1 writer') def __init__(self): html4css1.Writer.__init__(self) self.translator_class = S5HTMLTranslator class S5HTMLTranslator(html4css1.HTMLTranslator): s5_stylesheet_template = """\ \n""" # The script element must go in front of the link elements to # avoid a flash of unstyled content (FOUC), reproducible with # Firefox. disable_current_slide = """ \n""" layout_template = """\
\n""" #
#
#
#
default_theme = 'default' """Name of the default theme.""" base_theme_file = '__base__' """Name of the file containing the name of the base theme.""" direct_theme_files = ( 'slides.css', 'outline.css', 'print.css', 'opera.css', 'slides.js') """Names of theme files directly linked to in the output HTML""" indirect_theme_files = ( 's5-core.css', 'framing.css', 'pretty.css', 'blank.gif', 'iepngfix.htc') """Names of files used indirectly; imported or used by files in `direct_theme_files`.""" required_theme_files = indirect_theme_files + direct_theme_files """Names of mandatory theme files.""" def __init__(self, *args): html4css1.HTMLTranslator.__init__(self, *args) #insert S5-specific stylesheet and script stuff: self.theme_file_path = None self.setup_theme() view_mode = self.document.settings.view_mode control_visibility = ('visible', 'hidden')[self.document.settings .hidden_controls] self.stylesheet.append(self.s5_stylesheet_template % {'path': self.theme_file_path, 'view_mode': view_mode, 'control_visibility': control_visibility}) if not self.document.settings.current_slide: self.stylesheet.append(self.disable_current_slide) self.add_meta('\n') self.s5_footer = [] self.s5_header = [] self.section_count = 0 self.theme_files_copied = None def setup_theme(self): if self.document.settings.theme: self.copy_theme() elif self.document.settings.theme_url: self.theme_file_path = self.document.settings.theme_url else: raise docutils.ApplicationError( 'No theme specified for S5/HTML writer.') def copy_theme(self): """ Locate & copy theme files. A theme may be explicitly based on another theme via a '__base__' file. The default base theme is 'default'. Files are accumulated from the specified theme, any base themes, and 'default'. """ settings = self.document.settings path = find_theme(settings.theme) theme_paths = [path] self.theme_files_copied = {} required_files_copied = {} # This is a link (URL) in HTML, so we use "/", not os.sep: self.theme_file_path = '%s/%s' % ('ui', settings.theme) if settings._destination: dest = os.path.join( os.path.dirname(settings._destination), 'ui', settings.theme) if not os.path.isdir(dest): os.makedirs(dest) else: # no destination, so we can't copy the theme return default = False while path: for f in os.listdir(path): # copy all files from each theme if f == self.base_theme_file: continue # ... except the "__base__" file if ( self.copy_file(f, path, dest) and f in self.required_theme_files): required_files_copied[f] = 1 if default: break # "default" theme has no base theme # Find the "__base__" file in theme directory: base_theme_file = os.path.join(path, self.base_theme_file) # If it exists, read it and record the theme path: if os.path.isfile(base_theme_file): lines = open(base_theme_file).readlines() for line in lines: line = line.strip() if line and not line.startswith('#'): path = find_theme(line) if path in theme_paths: # check for duplicates (cycles) path = None # if found, use default base else: theme_paths.append(path) break else: # no theme name found path = None # use default base else: # no base theme file found path = None # use default base if not path: path = find_theme(self.default_theme) theme_paths.append(path) default = True if len(required_files_copied) != len(self.required_theme_files): # Some required files weren't found & couldn't be copied. required = list(self.required_theme_files) for f in required_files_copied.keys(): required.remove(f) raise docutils.ApplicationError( 'Theme files not found: %s' % ', '.join(['%r' % f for f in required])) files_to_skip_pattern = re.compile(r'~$|\.bak$|#$|\.cvsignore$') def copy_file(self, name, source_dir, dest_dir): """ Copy file `name` from `source_dir` to `dest_dir`. Return 1 if the file exists in either `source_dir` or `dest_dir`. """ source = os.path.join(source_dir, name) dest = os.path.join(dest_dir, name) if dest in self.theme_files_copied: return 1 else: self.theme_files_copied[dest] = 1 if os.path.isfile(source): if self.files_to_skip_pattern.search(source): return None settings = self.document.settings if os.path.exists(dest) and not settings.overwrite_theme_files: settings.record_dependencies.add(dest) else: src_file = open(source, 'rb') src_data = src_file.read() src_file.close() dest_file = open(dest, 'wb') dest_dir = dest_dir.replace(os.sep, '/') dest_file.write(src_data.replace( b('ui/default'), dest_dir[dest_dir.rfind('ui/'):].encode( sys.getfilesystemencoding()))) dest_file.close() settings.record_dependencies.add(source) return 1 if os.path.isfile(dest): return 1 def depart_document(self, node): self.head_prefix.extend([self.doctype, self.head_prefix_template % {'lang': self.settings.language_code}]) self.html_prolog.append(self.doctype) self.meta.insert(0, self.content_type % self.settings.output_encoding) self.head.insert(0, self.content_type % self.settings.output_encoding) if self.math_header: self.head.append(self.math_header) header = ''.join(self.s5_header) footer = ''.join(self.s5_footer) title = ''.join(self.html_title).replace('

', '

') layout = self.layout_template % {'header': header, 'title': title, 'footer': footer} self.fragment.extend(self.body) self.body_prefix.extend(layout) self.body_prefix.append('
\n') self.body_prefix.append( self.starttag({'classes': ['slide'], 'ids': ['slide0']}, 'div')) if not self.section_count: self.body.append('
\n') self.body_suffix.insert(0, '\n') # skip content-type meta tag with interpolated charset value: self.html_head.extend(self.head[1:]) self.html_body.extend(self.body_prefix[1:] + self.body_pre_docinfo + self.docinfo + self.body + self.body_suffix[:-1]) def depart_footer(self, node): start = self.context.pop() self.s5_footer.append('

') self.s5_footer.extend(self.body[start:]) self.s5_footer.append('

') del self.body[start:] def depart_header(self, node): start = self.context.pop() header = ['\n') del self.body[start:] self.s5_header.extend(header) def visit_section(self, node): if not self.section_count: self.body.append('\n\n') self.section_count += 1 self.section_level += 1 if self.section_level > 1: # dummy for matching div's self.body.append(self.starttag(node, 'div', CLASS='section')) else: self.body.append(self.starttag(node, 'div', CLASS='slide')) def visit_subtitle(self, node): if isinstance(node.parent, nodes.section): level = self.section_level + self.initial_header_level - 1 if level == 1: level = 2 tag = 'h%s' % level self.body.append(self.starttag(node, tag, '')) self.context.append('\n' % tag) else: html4css1.HTMLTranslator.visit_subtitle(self, node) def visit_title(self, node): html4css1.HTMLTranslator.visit_title(self, node) docutils-0.11/docutils/writers/s5_html/themes/0000755000175000017500000000000012173162603022147 5ustar engelbertengelbertdocutils-0.11/docutils/writers/s5_html/themes/big-white/0000755000175000017500000000000012173162603024026 5ustar engelbertengelbertdocutils-0.11/docutils/writers/s5_html/themes/big-white/pretty.css0000644000175000017500000000675610606454255026113 0ustar engelbertengelbert/* 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;} :link, :visited {text-decoration: none; color: #00C;} #controls :active {color: #88A !important;} #controls :focus {outline: 1px dotted #227;} 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-left: 0; margin-right: 0; font-size: 90%;} .slide ul ul li {list-style: square;} .slide img.leader {display: block; margin: 0 auto;} .slide tt {font-size: 90%;} .slide {font-size: 3em; font-family: sans-serif; font-weight: bold;} .slide h1 {padding-top: 0; z-index: 1; margin: 0; font-size: 120%;} .slide h2 {font-size: 110%;} .slide h3 {font-size: 105%;} 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; border: none; color: #005; 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: #444; font-family: sans-serif; font-weight: bold;} #slide0 h1 {position: static; margin: 0 0 0.5em; padding-top: 0.3em; top: 0; font-size: 150%; white-space: normal; background: transparent;} #slide0 h2 {font: 110%; font-style: italic; color: gray;} #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 { color: white; visibility: visible; border: 0;} img.incremental {visibility: hidden;} .slide .current {color: green;} .slide-display {display: inline ! important;} .huge {font-size: 150%;} .big {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;} .animation {position: relative; margin: 1em 0; padding: 0;} .animation img {position: absolute;} /* Docutils-specific overrides */ .slide table.docinfo {margin: 0.5em 0 0.5em 1em;} 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;} */ docutils-0.11/docutils/writers/s5_html/themes/big-white/framing.css0000644000175000017500000000161210606454255026171 0ustar engelbertengelbert/* 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#footer {display:none;} .slide {top: 0; width: 92%; padding: 0.25em 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;} */ docutils-0.11/docutils/writers/s5_html/themes/big-black/0000755000175000017500000000000012173162603023762 5ustar engelbertengelbertdocutils-0.11/docutils/writers/s5_html/themes/big-black/pretty.css0000644000175000017500000000702610606454255026036 0ustar engelbertengelbert/* This file has been placed in the public domain. */ /* Following are the presentation styles -- edit away! */ html, body {margin: 0; padding: 0;} body {background: black; color: white;} :link, :visited {text-decoration: none; color: cyan;} #controls :active {color: #888 !important;} #controls :focus {outline: 1px dotted #CCC;} 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-left: 0; margin-right: 0; font-size: 90%;} .slide ul ul li {list-style: square;} .slide img.leader {display: block; margin: 0 auto;} .slide tt {font-size: 90%;} .slide {font-size: 3em; font-family: sans-serif; font-weight: bold;} .slide h1 {padding-top: 0; z-index: 1; margin: 0; font-size: 120%;} .slide h2 {font-size: 110%;} .slide h3 {font-size: 105%;} 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; border: none; color: #888; cursor: pointer;} #controls #navList {height: 1em;} #controls #navList #jumplist {position: absolute; bottom: 0; right: 0; background: black; color: #CCC;} #currentSlide {text-align: center; font-size: 0.5em; color: #AAA; font-family: sans-serif; font-weight: bold;} #slide0 h1 {position: static; margin: 0 0 0.5em; padding-top: 0.3em; top: 0; font-size: 150%; white-space: normal; background: transparent;} #slide0 h2 {font: 110%; font-style: italic; color: gray;} #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: #FCC;} .incremental, .incremental *, .incremental *:after { color: black; visibility: visible; border: 0;} img.incremental {visibility: hidden;} .slide .current {color: lime;} .slide-display {display: inline ! important;} .huge {font-size: 150%;} .big {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;} .animation {position: relative; margin: 1em 0; padding: 0;} .animation img {position: absolute;} /* Docutils-specific overrides */ .slide table.docinfo {margin: 0.5em 0 0.5em 1em;} div.sidebar {background-color: black;} pre.literal-block, pre.doctest-block {background-color: black;} tt.docutils {background-color: black;} /* diagnostics */ /* li:after {content: " [" attr(class) "]"; color: #F88;} div:before {content: "[" attr(class) "]"; color: #F88;} */ docutils-0.11/docutils/writers/s5_html/themes/big-black/__base__0000644000175000017500000000004610606454255025421 0ustar engelbertengelbert# base theme of this theme: big-white docutils-0.11/docutils/writers/s5_html/themes/big-black/framing.css0000644000175000017500000000161710606454255026132 0ustar engelbertengelbert/* 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 {top: 0; z-index: 1;} div#footer {display:none;} .slide {top: 0; width: 92%; padding: 0.1em 4% 4%; z-index: 2;} /* list-style: none;} */ 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;} */ docutils-0.11/docutils/writers/s5_html/themes/README.txt0000644000175000017500000000045510345734741023660 0ustar engelbertengelbertExcept where otherwise noted (default/iepngfix.htc), all files in this directory have been released into the Public Domain. These files are based on files from S5 1.1, released into the Public Domain by Eric Meyer. For further details, please see http://www.meyerweb.com/eric/tools/s5/credits.html. docutils-0.11/docutils/writers/s5_html/themes/small-white/0000755000175000017500000000000012173162603024375 5ustar engelbertengelbertdocutils-0.11/docutils/writers/s5_html/themes/small-white/pretty.css0000644000175000017500000000764110606454255026454 0ustar engelbertengelbert/* 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;} :link, :visited {text-decoration: none; color: #00C;} #controls :active {color: #888 !important;} #controls :focus {outline: 1px dotted #222;} 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-left: 0; margin-right: 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#footer {font-family: sans-serif; color: #444; 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 {padding-top: 0; z-index: 1; margin: 0; font: bold 150% sans-serif;} .slide h2 {font: bold 120% 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; border: none; color: #888; cursor: pointer;} #controls #navList {height: 1em;} #controls #navList #jumplist {position: absolute; bottom: 0; right: 0; background: #DDD; color: #222;} #currentSlide {text-align: center; font-size: 0.5em; color: #444; font-family: sans-serif; font-weight: bold;} #slide0 {padding-top: 0em} #slide0 h1 {position: static; margin: 1em 0 0; padding: 0; 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 { color: white; visibility: visible; border: 0; border: 0;} img.incremental {visibility: hidden;} .slide .current {color: green;} .slide-display {display: inline ! important;} .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;} .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;} */ docutils-0.11/docutils/writers/s5_html/themes/small-white/framing.css0000644000175000017500000000165510606454255026547 0ustar engelbertengelbert/* 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#footer {top: auto; bottom: 0; height: 2.5em; z-index: 5;} .slide {top: 0; width: 92%; padding: 1em 4% 0 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;} */ docutils-0.11/docutils/writers/s5_html/themes/default/0000755000175000017500000000000012173162603023573 5ustar engelbertengelbertdocutils-0.11/docutils/writers/s5_html/themes/default/pretty.css0000644000175000017500000001044010347413017025632 0ustar engelbertengelbert/* 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-left: 0; margin-right: 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;} .slide-display {display: inline ! important;} .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;} .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;} */ docutils-0.11/docutils/writers/s5_html/themes/default/s5-core.css0000644000175000017500000000070310345734741025571 0ustar engelbertengelbert/* 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;} docutils-0.11/docutils/writers/s5_html/themes/default/print.css0000644000175000017500000000146210347430072025443 0ustar engelbertengelbert/* 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;} #header {display: none;} #footer h1 {margin: 0; border-bottom: 1px solid; color: gray; font-style: italic;} #footer h2, #controls {display: none;} .print {display: inline ! important;} /* The following rule keeps the layout stuff out of print. Remove at your own risk! */ .layout, .layout * {display: none !important;} docutils-0.11/docutils/writers/s5_html/themes/default/slides.css0000644000175000017500000000043310345734741025577 0ustar engelbertengelbert/* 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); docutils-0.11/docutils/writers/s5_html/themes/default/outline.css0000644000175000017500000000121010347430072025755 0ustar engelbertengelbert/* 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;} #toggle {border: 1px solid; border-width: 0 0 1px 1px; background: #FFF;} .outline {display: inline ! important;} docutils-0.11/docutils/writers/s5_html/themes/default/opera.css0000644000175000017500000000040510345734741025421 0ustar engelbertengelbert/* 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;} docutils-0.11/docutils/writers/s5_html/themes/default/blank.gif0000644000175000017500000000006110345734741025355 0ustar engelbertengelbertGIF89a!,T;docutils-0.11/docutils/writers/s5_html/themes/default/framing.css0000644000175000017500000000175310345734741025745 0ustar engelbertengelbert/* 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;} */ docutils-0.11/docutils/writers/s5_html/themes/default/iepngfix.htc0000644000175000017500000000224610345734741026117 0ustar engelbertengelbert docutils-0.11/docutils/writers/s5_html/themes/default/slides.js0000644000175000017500000003667010357213527025434 0ustar engelbertengelbert// S5 v1.1 slides.js -- released into the Public Domain // Modified for Docutils (http://docutils.sf.net) by David Goodger // // 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.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' + '