From a12b07e4acd82dc78b7e464c9684ae5c9e2e2015 Mon Sep 17 00:00:00 2001 From: milde Date: Mon, 4 Jun 2012 20:14:08 +0000 Subject: [PATCH] Fix [ 3527842 ]. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Under Python 3, converted tests and tools are now stored in the ``test3/`` and ``tools3/`` sub-directories and not installed in the PYTHONPATH. In order to make this work: - Make tests independent from the location of the ``test/`` directory. - Use converted sources from the ``build/`` directory for tests under Python 3. Remove functional/tests/stylesheet_path_html4css1.py made redunant by functional/tests/math_output_html.py. git-svn-id: https://docutils.svn.sourceforge.net/svnroot/docutils/trunk/docutils@7437 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- HISTORY.txt | 27 +- README.txt | 56 ++-- setup.py | 5 +- test/DocutilsTestSupport.py | 18 +- test/functional/expected/compact_lists.html | 2 +- test/functional/expected/dangerous.html | 2 +- test/functional/expected/field_name_limit.html | 2 +- test/functional/expected/math_output_html.html | 4 +- test/functional/expected/math_output_latex.html | 2 +- test/functional/expected/math_output_mathjax.html | 2 +- test/functional/expected/math_output_mathml.xhtml | 2 +- test/functional/expected/pep_html.html | 2 +- .../expected/standalone_rst_html4css1.html | 2 +- .../expected/standalone_rst_s5_html_1.html | 2 +- .../expected/standalone_rst_s5_html_2.html | 2 +- test/functional/input/data/html4css1.css | 311 +++++++++++++++++++++ test/functional/input/data/math.css | 274 ++++++++++++++++++ test/functional/tests/compact_lists.py | 4 +- test/functional/tests/dangerous.py | 3 + test/functional/tests/field_name_limit.py | 3 + test/functional/tests/math_output_html.py | 11 +- test/functional/tests/math_output_latex.py | 9 +- test/functional/tests/math_output_mathjax.py | 6 +- test/functional/tests/math_output_mathml.py | 6 +- test/functional/tests/pep_html.py | 3 + test/functional/tests/standalone_rst_html4css1.py | 6 +- test/functional/tests/standalone_rst_s5_html_1.py | 3 + test/test_dependencies.py | 7 +- test/test_writers/test_html4css1_template.py | 5 +- test/test_writers/test_s5.py | 7 +- 30 files changed, 712 insertions(+), 76 deletions(-) create mode 100644 test/functional/input/data/html4css1.css create mode 100644 test/functional/input/data/math.css diff --git a/HISTORY.txt b/HISTORY.txt index f910b0fb7..d7cb6f989 100644 --- a/HISTORY.txt +++ b/HISTORY.txt @@ -16,11 +16,28 @@ Changes Since 0.9 ================= +* docutils/setup.py + + - Fix [ 3527842 ]. Under Python 3, converted tests and tools are now + stored in the ``test3/`` and ``tools3/`` sub-directories and not + installed in the PYTHONPATH. + +* docutils/test/ + + - Make tests independent from the location of the ``test/`` directory. + - Use converted sources from the ``build/`` directory for tests under + Python 3. + * docutils/parsers/rst/directives/misc.py - - Fix [ 3525847 ] UnicodeEncodeError with locale == C and 8-bit char - in path argument of `include` directive. + - Fix [ 3525847 ]. Catch and report UnicodeEncodeError with + ``locale == C`` and 8-bit char in path argument of `include` directive. + +* docutils/test/alltests.py + - class `Tee`: catch UnicodeError when writing to "ascii" stream or + file under Python 3. + Release 0.9 (2012-05-02) ======================== @@ -125,7 +142,7 @@ Release 0.8.1 (2011-08-30) * docutils/test/ - - Apply [ 3303733 ] and [ 3365041 ] to fix tests under py3k. + - Apply [ 3303733 ] and [ 3365041 ] to fix tests under Py3k. * docutils/writers/latex2e/__init__.py @@ -226,7 +243,7 @@ Release 0.8 (2011-07-07) * docutils/io.py: - Do not close() sys.stdin, sys.stdout, or sys.stderr. Prevents - ``Exception ValueError: 'I/O operation on closed file.'`` with Python 3. + ``Exception ValueError: 'I/O operation on closed file.'`` with Python 3. Release 0.7 (2010-07-07) ======================== @@ -294,7 +311,7 @@ __ docs/user/config.html#output_encoding * setup.py: - - Python 3 support: copy test/ and tools/ to the build-dir + - Python 3 support: copy test/ and tools/ to the build-dir and convert Python sources with 2to3. diff --git a/README.txt b/README.txt index 1baadb3e5..7f942cbb1 100644 --- a/README.txt +++ b/README.txt @@ -21,9 +21,9 @@ complete details. http://www.python.org/ - Docutils is compatible with Python versions from 2.3 up to 2.6 and - version 3.1. (Support for Python 3 is new and might still have some - issues.) + Docutils is compatible with Python versions from 2.3 up to 2.7 and + versions 3.1 and 3.2. (Support for Python 3 is new and might still + have some issues.) 2. Use the latest Docutils code. Get the code from Subversion or from the snapshot: @@ -42,7 +42,7 @@ complete details. (enter admin password) ./setup.py install - Docutils will only work with Python 3, if installed with a Python + Docutils will only work with Python 3, if installed with a Python version >= 3. If your default Python version is 2.x, also call ``python3 setup.py install`` from the temporary directory. See Installation_ below for details. @@ -104,8 +104,7 @@ changes being committed to the repository): http://docutils.svn.sourceforge.net/viewvc/docutils/trunk/sandbox/?view=tar To keep up to date on the latest developments, download fresh copies -of the snapshots regularly. New functionality is being added weekly, -sometimes daily. (There's also the `Subversion repository`_.) +of the snapshots regularly. (There's also the `Subversion repository`_.) .. _Subversion repository: docs/dev/repository.html @@ -117,12 +116,17 @@ To run the code, Python 2.3 or later must already be installed. Python is available from http://www.python.org/. -The `Python Imaging Library`, or PIL, is used for some image -manipulation operations if it is installed. +Docutils uses the following packages for enhanced functionality, if they are +installed: -.. _Python Imaging Library: http://www.pythonware.com/products/pil/ -.. _Optik: http://optik.sourceforge.net/ +* The `Python Imaging Library`, or PIL, is used for some image + manipulation operations. + +* The `Pygments`_ syntax highlighter is used for content of `code` + directives and roles. +.. _Python Imaging Library: http://www.pythonware.com/products/pil/ +.. _pygments: http://pygments.org/ Project Files & Directories =========================== @@ -151,10 +155,6 @@ Project Files & Directories * docutils: The project source directory, installed as a Python package. -* extras: Directory for third-party modules that Docutils depends on - (roman.py). These are only installed if - they're not already present. - * docs: The project documentation directory. Read ``docs/index.txt`` for an overview. @@ -233,20 +233,18 @@ following: To install for a specific python version, specify the Python executable for this version. +Developing under Python 3 +------------------------- -Python 3 peculiarities ----------------------- - -If called from Python 3, setup.py, in addition to copying the sources -to the right place, will also convert them using 2to3 to Python 3 -compatible code. +Under Python 3, installing with ``setup.py`` converts the source to Python 3 +compatible code before installing. If you want to test or develop Docutils, +also run ``python3 setup.py build``. This will generate Python 3 compatible +sources, in the ``build/`` sub-directory, tests in ``tests3/``, and +developer tools in ``tools3``. -* If you want to test or develop Docutils, also run ``python3 setup.py - build``. This will generate Python 3 compatible sources, tests and - developer tools in the build directory. Do changes on the Python 2 - versions of the sources and re-run the build command. This works - incrementally, so if you change one file it will only reconvert that - file the next time you run setup.py build. +Do changes on the Python 2 versions of the sources and re-run the build +command. This works incrementally, so if you change one file it will only +reconvert that file the next time you run setup.py build. Usage @@ -310,8 +308,8 @@ Under Windows, type:: For testing with Python 3 use the converted test suite:: - cd /build//test - python alltests.py + cd /test3 + python3 alltests.py You should see a long line of periods, one for each test, and then a @@ -342,7 +340,7 @@ Windows users type these commands:: cd ..\tools python quicktest.py --version -Python 3 users must use ``build//tools/quicktest.py``. +For Python 3, the path is ``tools3/quicktest.py``. .. _open a bug report: diff --git a/setup.py b/setup.py index 8eba8ab85..30db1b93a 100755 --- a/setup.py +++ b/setup.py @@ -32,7 +32,7 @@ if sys.version_info >= (3,): 'tools/' and 'test/' dirs and run 2to3 on *.py files. """ manifest_in = """\ - exclude *.pyc *~ .DS_Store + exclude *.pyc *~ .DS_Store rst2*.py rstpep2html.py recursive-exclude * *.pyc *~ .DS_Store recursive-exclude functional/output * include functional/output/README.txt @@ -48,7 +48,7 @@ if sys.version_info >= (3,): print("copying aux dirs") loglevel = log.set_threshold(log.ERROR) for source in ['tools', 'test']: - dest = os.path.join(self.build_lib, source) + dest = source + '3' copydir_run_2to3(source, dest, template=self.manifest_in) log.set_threshold(loglevel) @@ -187,6 +187,7 @@ classifiers = [ 'License :: OSI Approved :: GNU General Public License (GPL)', 'Operating System :: OS Independent', 'Programming Language :: Python', + 'Programming Language :: Python :: 3', 'Topic :: Documentation', 'Topic :: Software Development :: Documentation', 'Topic :: Text Processing', diff --git a/test/DocutilsTestSupport.py b/test/DocutilsTestSupport.py index bbe01a807..82c3391b4 100644 --- a/test/DocutilsTestSupport.py +++ b/test/DocutilsTestSupport.py @@ -50,9 +50,15 @@ from pprint import pformat testroot = os.path.abspath(os.path.dirname(__file__) or os.curdir) os.chdir(testroot) -sys.path.insert(0, os.path.normpath(os.path.join(testroot, '..'))) +if sys.version_info >= (3,0): + sys.path.insert(0, os.path.normpath(os.path.join(testroot, + '..', 'build', 'lib'))) + sys.path.append(os.path.normpath(os.path.join(testroot, '..', + 'build', 'lib', 'extras'))) +else: + sys.path.insert(0, os.path.normpath(os.path.join(testroot, '..'))) + sys.path.append(os.path.normpath(os.path.join(testroot, '..', 'extras'))) sys.path.insert(0, testroot) -sys.path.append(os.path.normpath(os.path.join(testroot, '..', 'extras'))) try: import difflib @@ -129,13 +135,13 @@ class StandardTestCase(unittest.TestCase): # aliases for assertion methods, deprecated since Python 2.7 - failUnlessEqual = assertEquals = assertEqual + failUnlessEqual = assertEquals = assertEqual assertNotEquals = failIfEqual = assertNotEqual class CustomTestCase(StandardTestCase): - + """ Helper class, providing extended functionality over unittest.TestCase. @@ -166,7 +172,7 @@ class CustomTestCase(StandardTestCase): self.expected = expected self.run_in_debugger = run_in_debugger self.suite_settings = suite_settings.copy() or {} - + # Ring your mother. unittest.TestCase.__init__(self, method_name) @@ -791,7 +797,7 @@ class HtmlWriterPublishPartsTestCase(WriterPublishTestCase): # interpolate standard variables: expected = self.expected % {'version': docutils.__version__} self.compare_output(self.input, output, expected) - + standard_content_type_template = ('\n') standard_generator_template = ( diff --git a/test/functional/expected/compact_lists.html b/test/functional/expected/compact_lists.html index be3656a52..3d7cf51a4 100644 --- a/test/functional/expected/compact_lists.html +++ b/test/functional/expected/compact_lists.html @@ -5,7 +5,7 @@ - +
diff --git a/test/functional/expected/dangerous.html b/test/functional/expected/dangerous.html index ee5fe3c65..343f44eb1 100644 --- a/test/functional/expected/dangerous.html +++ b/test/functional/expected/dangerous.html @@ -5,7 +5,7 @@ - +
diff --git a/test/functional/expected/field_name_limit.html b/test/functional/expected/field_name_limit.html index 07a602b49..3ea746877 100644 --- a/test/functional/expected/field_name_limit.html +++ b/test/functional/expected/field_name_limit.html @@ -5,7 +5,7 @@ - +
diff --git a/test/functional/expected/math_output_html.html b/test/functional/expected/math_output_html.html index a4e812f33..25f4f4e19 100644 --- a/test/functional/expected/math_output_html.html +++ b/test/functional/expected/math_output_html.html @@ -5,8 +5,8 @@ Mathematics - - + +
diff --git a/test/functional/expected/math_output_latex.html b/test/functional/expected/math_output_latex.html index b835476db..c8605bab8 100644 --- a/test/functional/expected/math_output_latex.html +++ b/test/functional/expected/math_output_latex.html @@ -5,7 +5,7 @@ Mathematics - +
diff --git a/test/functional/expected/math_output_mathjax.html b/test/functional/expected/math_output_mathjax.html index d9c2d2080..2d8fb52f1 100644 --- a/test/functional/expected/math_output_mathjax.html +++ b/test/functional/expected/math_output_mathjax.html @@ -6,7 +6,7 @@ Mathematics - +
diff --git a/test/functional/expected/math_output_mathml.xhtml b/test/functional/expected/math_output_mathml.xhtml index cae609b82..df8b9782a 100644 --- a/test/functional/expected/math_output_mathml.xhtml +++ b/test/functional/expected/math_output_mathml.xhtml @@ -5,7 +5,7 @@ Mathematics - +
diff --git a/test/functional/expected/pep_html.html b/test/functional/expected/pep_html.html index 1c45af031..a6a2ff21e 100644 --- a/test/functional/expected/pep_html.html +++ b/test/functional/expected/pep_html.html @@ -10,7 +10,7 @@ to templates. DO NOT USE THIS HTML FILE AS YOUR TEMPLATE! PEP 100 -- Test PEP - + - +
diff --git a/test/functional/expected/standalone_rst_s5_html_1.html b/test/functional/expected/standalone_rst_s5_html_1.html index 9e72b16c1..71ee57f89 100644 --- a/test/functional/expected/standalone_rst_s5_html_1.html +++ b/test/functional/expected/standalone_rst_s5_html_1.html @@ -8,7 +8,7 @@ Slide Shows - + diff --git a/test/functional/expected/standalone_rst_s5_html_2.html b/test/functional/expected/standalone_rst_s5_html_2.html index 7c9074a5a..b62cc3161 100644 --- a/test/functional/expected/standalone_rst_s5_html_2.html +++ b/test/functional/expected/standalone_rst_s5_html_2.html @@ -8,7 +8,7 @@ Slide Shows - + diff --git a/test/functional/input/data/html4css1.css b/test/functional/input/data/html4css1.css new file mode 100644 index 000000000..bb82b3b38 --- /dev/null +++ b/test/functional/input/data/html4css1.css @@ -0,0 +1,311 @@ +/* +:Author: David Goodger (goodger@python.org) +:Id: $Id$ +: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 { + 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 { /* line numbers */ + color: grey; +} + +.code { + background-color: #eeeeee +} + +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 } + +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 } diff --git a/test/functional/input/data/math.css b/test/functional/input/data/math.css new file mode 100644 index 000000000..4f43b37e0 --- /dev/null +++ b/test/functional/input/data/math.css @@ -0,0 +1,274 @@ +/* +* math2html: convert LaTeX equations to HTML output. +* +* Copyright (C) 2009,2010 Alex Fernández +* +* 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 +* +* Based on eLyXer: convert LyX source files to HTML output. +* http://elyxer.nongnu.org/ +*/ +/* --end-- +* CSS file for LaTeX formulas. +*/ + +/* Formulas */ +.formula { + text-align: center; + font-family: "DejaVu Serif", serif; + margin: 1.2em 0; +} +span.formula { + white-space: nowrap; +} +div.formula { + padding: 0.5ex; + margin-left: auto; + margin-right: auto; +} + +/* Basic features */ +a.eqnumber { + display: inline-block; + float: right; + clear: right; + font-weight: bold; +} +span.unknown { + color: #800000; +} +span.ignored, span.arraydef { + display: none; +} +.formula i { + letter-spacing: 0.1ex; +} + +/* Alignment */ +.align-left, .align-l { + text-align: left; +} +.align-right, .align-r { + text-align: right; +} +.align-center, .align-c { + text-align: center; +} + +/* Structures */ +span.overline, span.bar { + text-decoration: overline; +} +.fraction, .fullfraction { + display: inline-block; + vertical-align: middle; + text-align: center; +} +.fraction .fraction { + font-size: 80%; + line-height: 100%; +} +span.numerator { + display: block; +} +span.denominator { + display: block; + padding: 0ex; + border-top: thin solid; +} +sup.numerator, sup.unit { + font-size: 70%; + vertical-align: 80%; +} +sub.denominator, sub.unit { + font-size: 70%; + vertical-align: -20%; +} +span.sqrt { + display: inline-block; + vertical-align: middle; + padding: 0.1ex; +} +sup.root { + font-size: 70%; + position: relative; + left: 1.4ex; +} +span.radical { + display: inline-block; + padding: 0ex; + font-size: 150%; + vertical-align: top; +} +span.root { + display: inline-block; + border-top: thin solid; + padding: 0ex; + vertical-align: middle; +} +span.symbol { + font-size: 125%; +} +span.bigsymbol { + font-size: 150%; +} +span.largesymbol { + font-size: 175%; +} +span.hugesymbol { + font-size: 200%; +} +span.scripts { + display: inline-table; + vertical-align: middle; +} +.script { + display: table-row; + text-align: left; + line-height: 150%; +} +span.limits { + display: inline-table; + vertical-align: middle; +} +.limit { + display: table-row; + line-height: 95%; +} +sup.limit, sub.limit { + line-height: 150%; +} +span.symbolover { + display: inline-block; + text-align: center; + position: relative; + float: right; + right: 100%; + bottom: 0.5em; + width: 0px; +} +span.withsymbol { + display: inline-block; +} +span.symbolunder { + display: inline-block; + text-align: center; + position: relative; + float: right; + right: 80%; + top: 0.3em; + width: 0px; +} + +/* Environments */ +span.array, span.bracketcases, span.binomial, span.environment { + display: inline-table; + text-align: center; + border-collapse: collapse; + margin: 0em; + vertical-align: middle; +} +span.arrayrow, span.binomrow { + display: table-row; + padding: 0ex; + border: 0ex; +} +span.arraycell, span.bracket, span.case, span.binomcell, span.environmentcell { + display: table-cell; + padding: 0ex 0.2ex; + line-height: 99%; + border: 0ex; +} +/* +* CSS file for LaTeX formulas, extra stuff: +* binomials, vertical braces, stackrel, fonts and colors. +*/ + +/* Inline binomials */ +span.binom { + display: inline-block; + vertical-align: middle; + text-align: center; + font-size: 80%; +} +span.binomstack { + display: block; + padding: 0em; +} + +/* Over- and underbraces */ +span.overbrace { + border-top: 2pt solid; +} +span.underbrace { + border-bottom: 2pt solid; +} + +/* Stackrel */ +span.stackrel { + display: inline-block; + text-align: center; +} +span.upstackrel { + display: block; + padding: 0em; + font-size: 80%; + line-height: 64%; + position: relative; + top: 0.15em; + +} +span.downstackrel { + display: block; + vertical-align: bottom; + padding: 0em; +} + +/* Fonts */ +span.mathsf, span.textsf { + font-style: normal; + font-family: sans-serif; +} +span.mathrm, span.textrm { + font-style: normal; + font-family: serif; +} +span.text, span.textnormal { + font-style: normal; +} +span.textipa { + color: #008080; +} +span.fraktur { + font-family: "Lucida Blackletter", eufm10, blackletter; +} +span.blackboard { + font-family: Blackboard, msbm10, serif; +} +span.scriptfont { + font-family: "Monotype Corsiva", "Apple Chancery", "URW Chancery L", cursive; + font-style: italic; +} + +/* Colors */ +span.colorbox { + display: inline-block; + padding: 5px; +} +span.fbox { + display: inline-block; + border: thin solid black; + padding: 2px; +} +span.boxed, span.framebox { + display: inline-block; + border: thin solid black; + padding: 5px; +} + diff --git a/test/functional/tests/compact_lists.py b/test/functional/tests/compact_lists.py index 3ac4c3f8b..688d786eb 100644 --- a/test/functional/tests/compact_lists.py +++ b/test/functional/tests/compact_lists.py @@ -8,4 +8,6 @@ parser_name = "rst" writer_name = "html" # Settings -#settings_overrides['key'] = +# local copy of default stylesheet: +settings_overrides['stylesheet_path'] = ( + 'functional/input/data/html4css1.css') diff --git a/test/functional/tests/dangerous.py b/test/functional/tests/dangerous.py index a17ef95d5..d2ab51c57 100644 --- a/test/functional/tests/dangerous.py +++ b/test/functional/tests/dangerous.py @@ -10,3 +10,6 @@ writer_name = "html" # Settings settings_overrides['file_insertion_enabled'] = False settings_overrides['raw_enabled'] = False +# local copy of default stylesheet: +settings_overrides['stylesheet_path'] = ( + 'functional/input/data/html4css1.css') diff --git a/test/functional/tests/field_name_limit.py b/test/functional/tests/field_name_limit.py index c7e515d05..974aaf300 100644 --- a/test/functional/tests/field_name_limit.py +++ b/test/functional/tests/field_name_limit.py @@ -10,3 +10,6 @@ writer_name = "html" # Settings settings_overrides['field_name_limit'] = 0 # no limit settings_overrides['docinfo_xform'] = False +# local copy of default stylesheet: +settings_overrides['stylesheet_path'] = ( + 'functional/input/data/html4css1.css') diff --git a/test/functional/tests/math_output_html.py b/test/functional/tests/math_output_html.py index aa3b0940d..cee7caab2 100644 --- a/test/functional/tests/math_output_html.py +++ b/test/functional/tests/math_output_html.py @@ -7,10 +7,11 @@ reader_name = "standalone" parser_name = "rst" writer_name = "html" -# Extra setting - +# Extra settings settings_overrides['math_output'] = 'HTML' -settings_overrides['stylesheet_path'] = ( - '../docutils/writers/html4css1/html4css1.css, ' - '../docutils/writers/html4css1/math.css ') +# stylesheets: +settings_overrides['stylesheet_path'] = ( + 'functional/input/data/html4css1.css,' + 'functional/input/data/math.css') + diff --git a/test/functional/tests/math_output_latex.py b/test/functional/tests/math_output_latex.py index e115b84c1..46794020b 100644 --- a/test/functional/tests/math_output_latex.py +++ b/test/functional/tests/math_output_latex.py @@ -7,7 +7,10 @@ reader_name = "standalone" parser_name = "rst" writer_name = "html" -# Extra setting - +# Settings settings_overrides['math_output'] = 'latex' - +# local copy of default stylesheet: +settings_overrides['stylesheet_path'] = ( + 'functional/input/data/html4css1.css') + + diff --git a/test/functional/tests/math_output_mathjax.py b/test/functional/tests/math_output_mathjax.py index 376b867dc..ed54669a0 100644 --- a/test/functional/tests/math_output_mathjax.py +++ b/test/functional/tests/math_output_mathjax.py @@ -7,7 +7,9 @@ reader_name = "standalone" parser_name = "rst" writer_name = "html" -# Extra setting - +# Settings settings_overrides['math_output'] = 'MathJax' +# local copy of default stylesheet: +settings_overrides['stylesheet_path'] = ( + 'functional/input/data/html4css1.css') diff --git a/test/functional/tests/math_output_mathml.py b/test/functional/tests/math_output_mathml.py index 613d0c2b9..cdcc75c45 100644 --- a/test/functional/tests/math_output_mathml.py +++ b/test/functional/tests/math_output_mathml.py @@ -7,6 +7,8 @@ reader_name = "standalone" parser_name = "rst" writer_name = "html" -# Extra setting - +# Settings settings_overrides['math_output'] = 'MathML' +# local copy of default stylesheet: +settings_overrides['stylesheet_path'] = ( + 'functional/input/data/html4css1.css') diff --git a/test/functional/tests/pep_html.py b/test/functional/tests/pep_html.py index 00e127ba7..c73ecb576 100644 --- a/test/functional/tests/pep_html.py +++ b/test/functional/tests/pep_html.py @@ -12,3 +12,6 @@ settings_overrides['python_home'] = "http://www.python.org" settings_overrides['pep_home'] = "http://www.python.org/peps" settings_overrides['no_random'] = 1 settings_overrides['cloak_email_addresses'] = 1 +# local copy of default stylesheet: +settings_overrides['stylesheet_path'] = ( + 'functional/input/data/html4css1.css') diff --git a/test/functional/tests/standalone_rst_html4css1.py b/test/functional/tests/standalone_rst_html4css1.py index 9f80e6d79..a3ac8975f 100644 --- a/test/functional/tests/standalone_rst_html4css1.py +++ b/test/functional/tests/standalone_rst_html4css1.py @@ -7,4 +7,8 @@ test_destination = "standalone_rst_html4css1.html" # Keyword parameters passed to publish_file. writer_name = "html4css1" -# Settings: settings_overrides['setting'] = value +# Settings: +# local copy of default stylesheet: +# (Test runs in ``docutils/test/``, we need relative path from there.) +settings_overrides['stylesheet_path'] = ( + 'functional/input/data/html4css1.css') diff --git a/test/functional/tests/standalone_rst_s5_html_1.py b/test/functional/tests/standalone_rst_s5_html_1.py index 9bd499186..b143ba003 100755 --- a/test/functional/tests/standalone_rst_s5_html_1.py +++ b/test/functional/tests/standalone_rst_s5_html_1.py @@ -9,6 +9,9 @@ writer_name = 's5_html' # Settings: settings_overrides['theme'] = 'small-black' +# local copy of default stylesheet: +settings_overrides['stylesheet_path'] = ( + 'functional/input/data/html4css1.css') # Extra functional tests. diff --git a/test/test_dependencies.py b/test/test_dependencies.py index 6ae933640..c48700dd3 100755 --- a/test/test_dependencies.py +++ b/test/test_dependencies.py @@ -24,7 +24,6 @@ paths = {'include': u'data/include.txt', # included rst file 'scaled-image': u'../docs/user/rst/images/biohazard.png', 'figure-image': u'../docs/user/rst/images/title.png', 'stylesheet': u'data/stylesheet.txt', - 'default-stylesheet': u'../docutils/writers/html4css1/html4css1.css', } @@ -71,11 +70,13 @@ class RecordDependenciesTests(unittest.TestCase): self.assertEqual(record, expected) def test_dependencies_html(self): - keys = ['include', 'raw', 'default-stylesheet'] + keys = ['include', 'raw'] if PIL: keys += ['figure-image', 'scaled-image'] expected = [paths[key] for key in keys] - record = self.get_record(writer_name='html') + # stylesheets are tested separately in test_stylesheet_dependencies(): + so = {'stylesheet_path': None, 'stylesheet': None} + record = self.get_record(writer_name='html', settings_overrides=so) # the order of the files is arbitrary record.sort() expected.sort() diff --git a/test/test_writers/test_html4css1_template.py b/test/test_writers/test_html4css1_template.py index 030e5a8cc..5d507506c 100755 --- a/test/test_writers/test_html4css1_template.py +++ b/test/test_writers/test_html4css1_template.py @@ -15,6 +15,7 @@ from __init__ import DocutilsTestSupport def suite(): settings = {'template': os.path.join(DocutilsTestSupport.testroot, 'data', 'full-template.txt'), + 'stylesheet_path': '/test.css', 'embed_stylesheet': 0,} s = DocutilsTestSupport.PublishTestSuite('html', suite_settings=settings) s.generateTests(totest) @@ -55,7 +56,7 @@ head = """\ stylesheet = """\ -""" +""" body_prefix = """\ @@ -112,7 +113,7 @@ head = """\ stylesheet = """\ -""" +""" body_prefix = """\ diff --git a/test/test_writers/test_s5.py b/test/test_writers/test_s5.py index 6a4100b7a..9aa3013df 100755 --- a/test/test_writers/test_s5.py +++ b/test/test_writers/test_s5.py @@ -13,7 +13,8 @@ from __init__ import DocutilsTestSupport def suite(): - settings = {'embed_stylesheet': 0,} + settings = {'stylesheet_path': '/test.css', + 'embed_stylesheet': 0,} s = DocutilsTestSupport.PublishTestSuite('s5', suite_settings=settings) s.generateTests(totest_1) settings['hidden_controls'] = 0 @@ -48,7 +49,7 @@ Slide text. Show Title - + @@ -113,7 +114,7 @@ We're just checking the settings Bogus Slide Show - + -- 2.11.4.GIT