|
From: <mi...@us...> - 2023-06-24 19:40:13
|
Revision: 9403
http://sourceforge.net/p/docutils/code/9403
Author: milde
Date: 2023-06-24 19:40:12 +0000 (Sat, 24 Jun 2023)
Log Message:
-----------
Input decoding: After detecting a BOM, leave handling it to Python's codecs.
Second part of the announced API changes:
* Don't remove ZWNBSPs in the middle of the source.
* Only remove BOM with `input_encoding`_ values None, '', 'utf-8-sig',
'utf-16', and 'utf-32'.
Modified Paths:
--------------
trunk/docutils/docutils/io.py
trunk/docutils/test/test_io.py
Modified: trunk/docutils/docutils/io.py
===================================================================
--- trunk/docutils/docutils/io.py 2023-06-23 16:55:30 UTC (rev 9402)
+++ trunk/docutils/docutils/io.py 2023-06-24 19:40:12 UTC (rev 9403)
@@ -176,10 +176,7 @@
try:
decoded = str(data, enc, self.error_handler)
self.successful_encoding = enc
- # Return decoded, removing BOM and other ZWNBSPs.
- # TODO: only remove BOM (ZWNBSP at start of data)
- # and only if 'self.encoding' is None. (API change)
- return decoded.replace('\ufeff', '')
+ return decoded
except (UnicodeError, LookupError) as err:
# keep exception instance for use outside of the "for" loop.
error = err
@@ -191,9 +188,12 @@
coding_slug = re.compile(br"coding[:=]\s*([-\w.]+)")
"""Encoding declaration pattern."""
- byte_order_marks = ((codecs.BOM_UTF8, 'utf-8'),
- (codecs.BOM_UTF16_BE, 'utf-16-be'),
- (codecs.BOM_UTF16_LE, 'utf-16-le'),)
+ byte_order_marks = ((codecs.BOM_UTF32_BE, 'utf-32'),
+ (codecs.BOM_UTF32_LE, 'utf-32'),
+ (codecs.BOM_UTF8, 'utf-8-sig'),
+ (codecs.BOM_UTF16_BE, 'utf-16'),
+ (codecs.BOM_UTF16_LE, 'utf-16'),
+ )
"""Sequence of (start_bytes, encoding) tuples for encoding detection.
The first bytes of input data are checked against the start_bytes strings.
A match indicates the given encoding."""
@@ -384,7 +384,7 @@
:Parameters:
- `source`: either a file-like object (which is read directly), or
`None` (which implies `sys.stdin` if no `source_path` given).
- - `source_path`: a path to a file, which is opened and then read.
+ - `source_path`: a path to a file, which is opened for reading.
- `encoding`: the expected text encoding of the input file.
- `error_handler`: the encoding error handler to use.
- `autoclose`: close automatically after read (except when
@@ -419,7 +419,7 @@
def read(self):
"""
- Read and decode a single file and return the data (Unicode string).
+ Read and decode a single file, return as `str`.
"""
if not self.encoding and hasattr(self.source, 'buffer'):
# read as binary data
@@ -436,7 +436,7 @@
def readlines(self):
"""
- Return lines of a single file as list of Unicode strings.
+ Return lines of a single file as list of strings.
"""
return self.read().splitlines(True)
Modified: trunk/docutils/test/test_io.py
===================================================================
--- trunk/docutils/test/test_io.py 2023-06-23 16:55:30 UTC (rev 9402)
+++ trunk/docutils/test/test_io.py 2023-06-24 19:40:12 UTC (rev 9403)
@@ -5,7 +5,7 @@
# Copyright: This module has been placed in the public domain.
"""
-Test module for io.py.
+Test module for `docutils.io`.
"""
import os.path
@@ -91,18 +91,22 @@
class InputTests(unittest.TestCase):
- def test_bom(self):
+ def test_bom_handling(self):
# Provisional:
- input = du_io.StringInput(source=b'\xef\xbb\xbf foo \xef\xbb\xbf bar')
- # Assert BOM is gone.
- # TODO: only remove BOM (ZWNBSP at start of data)
- self.assertEqual(input.read(), ' foo bar')
- # Unicode input is left unchanged:
- input = du_io.StringInput(source='\ufeff foo \ufeff bar')
- # Assert ZWNBSPs are still there.
- self.assertEqual(input.read(), '\ufeff foo \ufeff bar')
+ # default input encoding will change to UTF-8 in Docutils 0.22
+ source = '\ufeffdata\n\ufeff blah\n'
+ expected = 'data\n\ufeff blah\n' # only leading ZWNBSP removed
+ input = du_io.StringInput(source=source.encode('utf-16-be'))
+ self.assertEqual(input.read(), expected)
+ input = du_io.StringInput(source=source.encode('utf-16-le'))
+ self.assertEqual(input.read(), expected)
+ input = du_io.StringInput(source=source.encode('utf-8'))
+ self.assertEqual(input.read(), expected)
+ # With `str` input all ZWNBSPs are still there.
+ input = du_io.StringInput(source=source)
+ self.assertEqual(input.read(), source)
- def test_coding_slug(self):
+ def test_encoding_declaration(self):
input = du_io.StringInput(source=b"""\
.. -*- coding: ascii -*-
data
@@ -125,16 +129,6 @@
""")
self.assertNotEqual(input.successful_encoding, 'ascii')
- def test_bom_detection(self):
- source = '\ufeffdata\nblah\n'
- expected = 'data\nblah\n'
- input = du_io.StringInput(source=source.encode('utf-16-be'))
- self.assertEqual(input.read(), expected)
- input = du_io.StringInput(source=source.encode('utf-16-le'))
- self.assertEqual(input.read(), expected)
- input = du_io.StringInput(source=source.encode('utf-8'))
- self.assertEqual(input.read(), expected)
-
def test_readlines(self):
input = du_io.FileInput(
source_path=os.path.join(DATA_ROOT, 'include.txt'))
@@ -161,7 +155,7 @@
uniinput = du_io.Input(encoding='unicode')
# keep unicode instances as-is
self.assertEqual(uniinput.decode('ja'), 'ja')
- # raise AssertionError if data is not an unicode string
+ # raise AssertionError if data is not a `str` instance
self.assertRaises(AssertionError, uniinput.decode, b'ja')
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2023-06-24 19:40:33
|
Revision: 9404
http://sourceforge.net/p/docutils/code/9404
Author: milde
Date: 2023-06-24 19:40:30 +0000 (Sat, 24 Jun 2023)
Log Message:
-----------
Last part of the input encoding changes announced for 0.21.
Do not use the locale encoding as fallback if Python is started in `UTF-8 mode`_.
Stop using "latin1" as second fallback.
Update tests and documentation.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/RELEASE-NOTES.txt
trunk/docutils/docs/api/publisher.txt
trunk/docutils/docutils/io.py
trunk/docutils/test/test_CLI.py
trunk/docutils/test/test_io.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2023-06-24 19:40:12 UTC (rev 9403)
+++ trunk/docutils/HISTORY.txt 2023-06-24 19:40:30 UTC (rev 9404)
@@ -17,10 +17,23 @@
Changes since 0.20.1
====================
+* docutils/io.py
+
+* Simpler and more secure `input encoding`_ default behaviour:
+
+ Do not use the locale encoding as fallback if Python is started in
+ `UTF-8 mode`_. Stop using "latin1" as second fallback.
+
+ Remove BOM (U+FEFF ZWNBSP at start of data) only if the `input_encoding`_
+ configuration setting is None, '', 'utf-8-sig', 'utf-16', or 'utf-32'.
+ Do not remove other ZWNBSPs.
+
+ .. _input encoding: docs/api/publisher.html#encodings
+
* docutils/utils/roman.py
- Update to version `1.4 <https://pypi.org/project/roman/4.1/>`__.
- Fixes feature-requests:#95 (license is now ZPL 2.1).
+ - Update to version `1.4 <https://pypi.org/project/roman/4.1/>`__.
+ Fixes feature-requests:#95 (license is now ZPL 2.1).
* docutils/writers/latex2e/__init__.py
Modified: trunk/docutils/RELEASE-NOTES.txt
===================================================================
--- trunk/docutils/RELEASE-NOTES.txt 2023-06-24 19:40:12 UTC (rev 9403)
+++ trunk/docutils/RELEASE-NOTES.txt 2023-06-24 19:40:30 UTC (rev 9404)
@@ -79,17 +79,6 @@
`Input encoding`_
-----------------
-* Raise `UnicodeError` (instead of falling back to the locale encoding)
- if decoding the source with the default encoding (UTF-8) fails and
- Python is started in `UTF-8 mode`_. (Docutils 0.21)
-
- Raise `UnicodeError` (instead of falling back to "latin1") if both,
- default and locale encoding, fail. (Docutils 0.21)
-
-* Only remove BOM (U+FEFF ZWNBSP at start of data), no other ZWNBSPs.
- Only remove BOM with `input_encoding`_ values None, '', 'utf-8-sig',
- 'utf-16', and 'utf-32'. (Docutils 0.21)
-
* Change the default input encoding from ``None`` (auto-detect) to
"utf-8" in Docutils 0.22.
@@ -205,7 +194,6 @@
or "vermaning" to avoid errors in future conversions.
.. _front end tools: docs/user/tools.html
-.. _input encoding:
.. _input_encoding: docs/user/config.html#input-encoding
.. _math_output: docs/user/config.html#math-output
.. _UTF-8 mode: https://docs.python.org/3/library/os.html#utf8-mode
@@ -223,6 +211,21 @@
.. _csv-table: docs/ref/rst/directives.html#csv-table
+Release 0.21b (unpublished)
+===========================
+
+* Simpler and more secure `input encoding`_ default behaviour:
+
+ Do not use the locale encoding as fallback if Python is started in
+ `UTF-8 mode`_. Stop using "latin1" as second fallback.
+
+ Remove BOM (U+FEFF ZWNBSP at start of data) only if the `input_encoding`_
+ configuration setting is None, '', 'utf-8-sig', 'utf-16', or 'utf-32'.
+ Do not remove other ZWNBSPs.
+
+ .. _input encoding: docs/api/publisher.html#encodings
+
+
Release 0.20.1 (2023-05-17)
===========================
Modified: trunk/docutils/docs/api/publisher.txt
===================================================================
--- trunk/docutils/docs/api/publisher.txt 2023-06-24 19:40:12 UTC (rev 9403)
+++ trunk/docutils/docs/api/publisher.txt 2023-06-24 19:40:30 UTC (rev 9404)
@@ -445,25 +445,21 @@
.. important:: Details will change over the next Docutils versions.
See RELEASE-NOTES_
-The default **input encoding** is UTF-8. A different encoding can be
-specified with the `input_encoding`_ setting.
+The **input encoding** can be specified with the `input_encoding`_ setting.
-The encoding of a reStructuredText source can also be given by a
+By default, the input encoding is detected from a
`Unicode byte order mark` (BOM_) or a "magic comment" [#magic-comment]_
-similar to :PEP:`263`. This makes the input encoding both *visible* and
-*changeable* on a per-source basis.
+similar to :PEP:`263`. The fallback is "utf-8".
+The default behaviour differs from Python's `open()`:
-If the encoding is unspecified and decoding with UTF-8 fails, the locale's
-`preferred encoding`_ is used as a fallback (if it maps to a valid codec
-and differs from UTF-8).
+- An `explicit encoding declaration` ((BOM_) or a "magic comment"
+ [#magic-comment]_) in the source takes precedence over
+ the `preferred encoding`_.
+- An optional BOM_ is removed from sources.
-The default behaviour differs from Python's `open()`:
+The default will change to "utf-8" in Docutils 0.22,
+the input encoding detection will be removed in Docutils 1.0.
-- The UTF-8 encoding is tried before the `preferred encoding`_.
- (This is almost sure to fail if the actual source encoding differs.)
-- An `explicit encoding declaration` [#magic-comment]_ in the source
- takes precedence over the `preferred encoding`_.
-- An optional BOM_ is removed from UTF-8 encoded sources.
The default **output encoding** is UTF-8.
A different encoding can be specified with the `output_encoding`_ setting.
Modified: trunk/docutils/docutils/io.py
===================================================================
--- trunk/docutils/docutils/io.py 2023-06-24 19:40:12 UTC (rev 9403)
+++ trunk/docutils/docutils/io.py 2023-06-24 19:40:30 UTC (rev 9404)
@@ -125,8 +125,8 @@
Return Unicode `str` instances unchanged (nothing to decode).
If `self.encoding` is None, determine encoding from data
- or try UTF-8, locale encoding, and (as last ressort) 'latin-1'.
- The client application should call ``locale.setlocale`` at the
+ or try UTF-8 and the locale's preferred encoding.
+ The client application should call ``locale.setlocale()`` at the
beginning of processing::
locale.setlocale(locale.LC_ALL, '')
@@ -133,16 +133,7 @@
Raise UnicodeError if unsuccessful.
- Provisional:
- - Raise UnicodeError (instead of falling back to the locale
- encoding) if decoding the source with the default encoding (UTF-8)
- fails and Python is started in `UTF-8 mode`.
-
- Raise UnicodeError (instead of falling back to "latin1") if both,
- default and locale encoding, fail.
-
- - Only remove BOM (U+FEFF ZWNBSP at start of data),
- no other ZWNBSPs.
+ Provisional: encoding detection will be removed in Docutils 1.0.
"""
if self.encoding and self.encoding.lower() == 'unicode':
assert isinstance(data, str), ('input encoding is "unicode" '
@@ -157,21 +148,17 @@
else:
data_encoding = self.determine_encoding_from_data(data)
if data_encoding:
- # If the data declares its encoding (explicitly or via a BOM),
- # we believe it.
+ # `data` declares its encoding with "magic comment" or BOM,
encoding_candidates = [data_encoding]
else:
- # Apply heuristics only if no encoding is explicitly given and
- # no BOM found. Start with UTF-8, because that only matches
+ # Apply heuristics if the encoding is not specified.
+ # Start with UTF-8, because that only matches
# data that *IS* UTF-8:
encoding_candidates = ['utf-8']
- # TODO: use `locale.getpreferredlocale(do_setlocale=True)`
- # to respect UTF-8 mode (API change).
- # (Check if it is a valid encoding and not UTF-8)
- if _locale_encoding and _locale_encoding != 'utf-8':
- encoding_candidates.append(_locale_encoding)
- # TODO: don't fall back to 'latin-1' (API change).
- encoding_candidates.append('latin-1')
+ # If UTF-8 fails, fall back to the locale's preferred encoding:
+ fallback = locale.getpreferredencoding(do_setlocale=False)
+ if fallback and fallback.lower() != 'utf-8':
+ encoding_candidates.append(fallback)
for enc in encoding_candidates:
try:
decoded = str(data, enc, self.error_handler)
Modified: trunk/docutils/test/test_CLI.py
===================================================================
--- trunk/docutils/test/test_CLI.py 2023-06-24 19:40:12 UTC (rev 9403)
+++ trunk/docutils/test/test_CLI.py 2023-06-24 19:40:30 UTC (rev 9404)
@@ -57,7 +57,9 @@
del os.environ['DOCUTILSCONFIG']
sys.stdout = self.orig_stdout
sys.argv = self.orig_argv
- locale.setlocale(locale.LC_ALL, 'C') # restore default (C) locale
+ # restore default locale settings:
+ locale.setlocale(locale.LC_MESSAGES, 'C')
+ locale.setlocale(locale.LC_TIME, 'C')
def get_help_text(self, prog, entry_point):
# call entry_point function and collect help text
Modified: trunk/docutils/test/test_io.py
===================================================================
--- trunk/docutils/test/test_io.py 2023-06-24 19:40:12 UTC (rev 9403)
+++ trunk/docutils/test/test_io.py 2023-06-24 19:40:30 UTC (rev 9404)
@@ -7,9 +7,11 @@
"""
Test module for `docutils.io`.
"""
-import os.path
+import codecs
+import locale
from io import StringIO, BytesIO
+import os.path
from pathlib import Path
import sys
import unittest
@@ -24,7 +26,11 @@
# DATA_ROOT is ./test/data/ from the docutils root
DATA_ROOT = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'data')
+# normalize the preferred encoding's name:
+preferredencoding = codecs.lookup(
+ locale.getpreferredencoding(do_setlocale=False)).name
+
# Stub: Buffer with 'strict' auto-conversion of input to byte string:
class BBuf(BytesIO):
def write(self, data):
@@ -129,27 +135,6 @@
""")
self.assertNotEqual(input.successful_encoding, 'ascii')
- def test_readlines(self):
- input = du_io.FileInput(
- source_path=os.path.join(DATA_ROOT, 'include.txt'))
- data = input.readlines()
- self.assertEqual(data, ['Some include text.\n'])
-
- def test_heuristics_no_utf8(self):
- # if no encoding is given and decoding with 'utf-8' fails,
- # use either the locale encoding (if specified) or 'latin-1':
- # Provisional: the second fallback 'latin-1' will be dropped
- probed_encodings = (du_io._locale_encoding, 'latin-1') # noqa
- input = du_io.FileInput(
- source_path=os.path.join(DATA_ROOT, 'latin1.txt'))
- data = input.read()
- if input.successful_encoding not in probed_encodings:
- raise AssertionError(
- "guessed encoding '%s' differs from probed encodings %r"
- % (input.successful_encoding, probed_encodings))
- if input.successful_encoding == 'latin-1':
- self.assertEqual(data, 'Gr\xfc\xdfe\n')
-
def test_decode_unicode(self):
# With the special value "unicode" or "Unicode":
uniinput = du_io.Input(encoding='unicode')
@@ -156,7 +141,8 @@
# keep unicode instances as-is
self.assertEqual(uniinput.decode('ja'), 'ja')
# raise AssertionError if data is not a `str` instance
- self.assertRaises(AssertionError, uniinput.decode, b'ja')
+ with self.assertRaises(AssertionError):
+ uniinput.decode(b'ja')
class OutputTests(unittest.TestCase):
@@ -295,22 +281,27 @@
source_path=os.path.join(DATA_ROOT, 'utf8.txt'))
self.assertEqual(source.read(), 'Grüße\n')
- @unittest.skipIf(du_io._locale_encoding in (None, 'utf-8', 'utf8'),
+ @unittest.skipIf(preferredencoding in (None, 'ascii', 'utf-8'),
'locale encoding not set or UTF-8')
def test_fallback_no_utf8(self):
- # if decoding with 'utf-8' fails, use the locale encoding
- # (if not None) or 'latin-1'.
- # provisional: behaviour details will change in future
- # TODO: don't fall back to latin1
- # TODO: use `locale.getpreferredlocale()` (honour UTF-8 mode)?
- probed_encodings = (du_io._locale_encoding, 'latin-1') # noqa
+ # If no encoding is given and decoding with 'utf-8' fails,
+ # use the locale's preferred encoding (if not None).
+ # Provisional: the default will become 'utf-8'
+ # (without auto-detection and fallback) in Docutils 0.22.
source = du_io.FileInput(
source_path=os.path.join(DATA_ROOT, 'latin1.txt'))
data = source.read()
- self.assertTrue(source.successful_encoding in probed_encodings)
- if source.successful_encoding in ('latin-1', 'iso8859-1'):
+ successful_encoding = codecs.lookup(source.successful_encoding).name
+ self.assertEqual(successful_encoding, preferredencoding)
+ if successful_encoding == 'iso8859-1':
self.assertEqual(data, 'Grüße\n')
+ def test_readlines(self):
+ source = du_io.FileInput(
+ source_path=os.path.join(DATA_ROOT, 'include.txt'))
+ data = source.readlines()
+ self.assertEqual(data, ['Some include text.\n'])
+
if __name__ == '__main__':
unittest.main()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2023-06-24 20:50:14
|
Revision: 9405
http://sourceforge.net/p/docutils/code/9405
Author: milde
Date: 2023-06-24 20:50:08 +0000 (Sat, 24 Jun 2023)
Log Message:
-----------
Add some cross-links and a TODO comment.
Modified Paths:
--------------
trunk/docutils/docs/user/config.txt
trunk/docutils/docutils/writers/odf_odt/__init__.py
Modified: trunk/docutils/docs/user/config.txt
===================================================================
--- trunk/docutils/docs/user/config.txt 2023-06-24 19:40:30 UTC (rev 9404)
+++ trunk/docutils/docs/user/config.txt 2023-06-24 20:50:08 UTC (rev 9405)
@@ -2035,6 +2035,8 @@
~~~~~~~~~~
Specify a stylesheet URL, used verbatim.
+See section `Styles and Classes`_ in the `Odt Writer for Docutils`_
+document for details.
Default: writers/odf_odt/styles.odt in the installation directory.
@@ -2046,7 +2048,8 @@
contain a section named "Formats" that maps default style names to names
to be used in the resulting output file allowing for adhering to external
standards. For more info and the format of the configuration/mapping
-file, see the `Odt Writer for Docutils`_ document.
+file, see section `How to use custom style names`_ in the
+`Odt Writer for Docutils`_ document.
cloak-email-addresses
~~~~~~~~~~~~~~~~~~~~~
@@ -2127,7 +2130,7 @@
Specify the contents of a custom header line. For details about
custom headers and about special field character sequences, see
-section "Custom header/footers: inserting page numbers, date,
+section "`Custom header/footers`_: inserting page numbers, date,
time, etc" in the `Odt Writer for Docutils`_ document for
details.
@@ -2136,11 +2139,18 @@
Specify the contents of a custom footer line. For details about
custom footers and about special field character sequences, see
-section "Custom header/footers: inserting page numbers, date,
+section "`Custom header/footers`_: inserting page numbers, date,
time, etc" in the `Odt Writer for Docutils`_ document for
details.
+.. _custom header/footers:
+ odt.html#custom-header-footers-inserting-page-numbers-date-time-etc
+.. _how to use custom style names:
+ odt.html#how-to-use-custom-style-names
+.. _styles and classes:
+ odt.html#styles-and-classes
+
[pseudoxml writer]
------------------
Modified: trunk/docutils/docutils/writers/odf_odt/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/odf_odt/__init__.py 2023-06-24 19:40:30 UTC (rev 9404)
+++ trunk/docutils/docutils/writers/odf_odt/__init__.py 2023-06-24 20:50:08 UTC (rev 9405)
@@ -1062,6 +1062,9 @@
return self.dom_stylesheet
def setup_paper(self, root_el):
+ # TODO: only call paperconf, if it is actually used
+ # (i.e. page size removed from "styles.odt" with rst2odt_prepstyles.py
+ # cf. conditional in walk() below)?
try:
dimensions = subprocess.check_output(('paperconf', '-s'),
stderr=subprocess.STDOUT)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2023-06-24 20:50:42
|
Revision: 9406
http://sourceforge.net/p/docutils/code/9406
Author: milde
Date: 2023-06-24 20:50:32 +0000 (Sat, 24 Jun 2023)
Log Message:
-----------
Drop support for Python 3.7 and 3.8.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/README.txt
trunk/docutils/RELEASE-NOTES.txt
trunk/docutils/docs/dev/distributing.txt
trunk/docutils/docutils/io.py
trunk/docutils/setup.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2023-06-24 20:50:08 UTC (rev 9405)
+++ trunk/docutils/HISTORY.txt 2023-06-24 20:50:32 UTC (rev 9406)
@@ -17,16 +17,18 @@
Changes since 0.20.1
====================
+* Drop support for Python 3.7 and 3.8.
+
* docutils/io.py
-* Simpler and more secure `input encoding`_ default behaviour:
+ - Simpler and more secure `input encoding`_ default behaviour:
- Do not use the locale encoding as fallback if Python is started in
- `UTF-8 mode`_. Stop using "latin1" as second fallback.
+ Do not use the locale encoding as fallback if Python is started in
+ `UTF-8 mode`_. Stop using "latin1" as second fallback.
- Remove BOM (U+FEFF ZWNBSP at start of data) only if the `input_encoding`_
- configuration setting is None, '', 'utf-8-sig', 'utf-16', or 'utf-32'.
- Do not remove other ZWNBSPs.
+ Remove BOM (U+FEFF ZWNBSP at start of data) only if the `input_encoding`_
+ configuration setting is None, '', 'utf-8-sig', 'utf-16', or 'utf-32'.
+ Do not remove other ZWNBSPs.
.. _input encoding: docs/api/publisher.html#encodings
Modified: trunk/docutils/README.txt
===================================================================
--- trunk/docutils/README.txt 2023-06-24 20:50:08 UTC (rev 9405)
+++ trunk/docutils/README.txt 2023-06-24 20:50:32 UTC (rev 9406)
@@ -74,8 +74,9 @@
To run the code, Python_ must be installed.
(Python is pre-installed with most Linux distributions.)
-* Since version 0.19, Docutils requires Python 3.7 or later.
-* Docutils 0.16 to 0.18 require Python 2.7 or 3.5+.
+* Since version 0.21, Docutils requires Python 3.9 or later.
+* Docutils versions 0.19 to 0.20.1 require Python 3.7 or later.
+* Docutils versions 0.16 to 0.18 require Python 2.7 or 3.5+.
.. _Python: https://www.python.org/.
Modified: trunk/docutils/RELEASE-NOTES.txt
===================================================================
--- trunk/docutils/RELEASE-NOTES.txt 2023-06-24 20:50:08 UTC (rev 9405)
+++ trunk/docutils/RELEASE-NOTES.txt 2023-06-24 20:50:32 UTC (rev 9406)
@@ -20,8 +20,6 @@
Future changes
==============
-Drop support for Python 3.7 and 3.8 in Docutils 0.21.
-
Command line interface
----------------------
@@ -214,6 +212,8 @@
Release 0.21b (unpublished)
===========================
+* Drop support for Python 3.7 and 3.8.
+
* Simpler and more secure `input encoding`_ default behaviour:
Do not use the locale encoding as fallback if Python is started in
Modified: trunk/docutils/docs/dev/distributing.txt
===================================================================
--- trunk/docutils/docs/dev/distributing.txt 2023-06-24 20:50:08 UTC (rev 9405)
+++ trunk/docutils/docs/dev/distributing.txt 2023-06-24 20:50:32 UTC (rev 9406)
@@ -30,8 +30,8 @@
Docutils has the following dependencies:
-* Python 3.7 or later is required.
- Use ">= Python 3.7" in the dependencies.
+* Python 3.9 or later is required.
+ Use ">= Python 3.9" in the dependencies.
* Docutils may optionally make use of the PIL (`Python Imaging
Library`_ or Pillow_). If PIL is present, it is automatically
Modified: trunk/docutils/docutils/io.py
===================================================================
--- trunk/docutils/docutils/io.py 2023-06-24 20:50:08 UTC (rev 9405)
+++ trunk/docutils/docutils/io.py 2023-06-24 20:50:32 UTC (rev 9406)
@@ -32,14 +32,6 @@
_locale_encoding = (locale.getlocale()[1]
or locale.getdefaultlocale()[1])
_locale_encoding = _locale_encoding.lower()
-except ValueError as error: # OS X may set UTF-8 without language code
- # See https://bugs.python.org/issue18378 fixed in 3.8
- # and https://sourceforge.net/p/docutils/bugs/298/.
- # Drop the special case after requiring Python >= 3.8
- if "unknown locale: UTF-8" in error.args:
- _locale_encoding = "utf-8"
- else:
- _locale_encoding = None
except: # noqa any other problems determining the locale -> use None
_locale_encoding = None
try:
Modified: trunk/docutils/setup.py
===================================================================
--- trunk/docutils/setup.py 2023-06-24 20:50:08 UTC (rev 9405)
+++ trunk/docutils/setup.py 2023-06-24 20:50:32 UTC (rev 9406)
@@ -40,7 +40,7 @@
'maintainer_email': 'doc...@li...',
'license': 'public domain, Python, 2-Clause BSD, GPL 3 (see COPYING.txt)',
'platforms': 'OS-independent',
- 'python_requires': '>=3.7',
+ 'python_requires': '>=3.9',
'include_package_data': True,
'exclude_package_data': {"": ["docutils.conf"]},
'package_dir': {
@@ -100,8 +100,6 @@
'License :: OSI Approved :: GNU General Public License (GPL)',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3',
- 'Programming Language :: Python :: 3.7',
- 'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2023-06-26 11:57:18
|
Revision: 9407
http://sourceforge.net/p/docutils/code/9407
Author: milde
Date: 2023-06-26 11:57:11 +0000 (Mon, 26 Jun 2023)
Log Message:
-----------
Use "console_scripts" entry points instead of tools/rst2*.py scripts.
Update the installation of command line tools to modern standards:
Do not install scripts from the ``tools/`` directory into the binary
path. Instead, tell the installer to create and install ``rst2*``
console scripts from "entry point" definitions using functions
in `docutils.core`.
Cf. [feature-requests:88] and [patches:186].
Modified Paths:
--------------
trunk/docutils/RELEASE-NOTES.txt
trunk/docutils/setup.py
Modified: trunk/docutils/RELEASE-NOTES.txt
===================================================================
--- trunk/docutils/RELEASE-NOTES.txt 2023-06-24 20:50:32 UTC (rev 9406)
+++ trunk/docutils/RELEASE-NOTES.txt 2023-06-26 11:57:11 UTC (rev 9407)
@@ -23,34 +23,6 @@
Command line interface
----------------------
-* Docutils 0.21 will provide ``rst2*`` "console_scripts" `entry points`_
- (without the ``.py`` extension) instead of installing the
- ``rst2*.py`` `front end tools`_ in the binary PATH. [#]_
-
- You may use the ``docutils`` `generic command line front end tool`_
- as a future-proof command, for example:
-
- .. code:: diff
-
- - rst2latex.py --use-latex-abstract FAQ.txt > FAQ.tex
- + docutils --writer=latex --use-latex-abstract FAQ.txt > FAQ.tex
-
- Exceptions:
- The ``rstpep2html.py`` and ``rst2odt_prepstyles.py`` scripts
- will be retired.
-
- Use ``docutils --reader=pep --writer=pep_html`` for a PEP preview. [#]_
-
- Use ``python -m docutils.writers.odf_odt.prepstyles``
- to `strip the page size`__ from an ODT writer stylesheet.
-
- __ docs/user/odt.html#page-size
-
- .. [#] Some Linux distributions already use the short names.
- .. [#] The final rendering is done by a Sphinx-based build system
- (cf. :PEP:`676`).
-
-
* The _`command-line usage pattern` will change:
.. code:: diff
@@ -209,11 +181,27 @@
.. _csv-table: docs/ref/rst/directives.html#csv-table
-Release 0.21b (unpublished)
-===========================
+Release 0.21 (unpublished)
+==========================
* Drop support for Python 3.7 and 3.8.
+* Provide ``rst2*`` "console_scripts" `entry points`_
+ (without the ``.py`` extension) instead of installing the
+ ``rst2*.py`` `front end tools`_ in the binary PATH. [#]_
+
+ Exceptions: ``rstpep2html.py`` and ``rst2odt_prepstyles.py``:
+
+ - Use ``docutils --reader=pep --writer=pep_html`` for a PEP preview. [#]_
+ - Use ``python -m docutils.writers.odf_odt.prepstyles``
+ to `strip the page size`__ from an ODT writer stylesheet.
+
+ __ docs/user/odt.html#page-size
+
+ .. [#] Some Linux distributions already use the short names.
+ .. [#] The final rendering is done by a Sphinx-based build system
+ (cf. :PEP:`676`).
+
* Simpler and more secure `input encoding`_ default behaviour:
Do not use the locale encoding as fallback if Python is started in
@@ -1082,7 +1070,7 @@
multi-platform, multi-browser HTML slide shows.
__ docs/user/slide-shows.html
- __ docs/user/tools.html#rst2s5-py
+ __ docs/user/tools.html#rst2s5
* The newlatex2e writer is nearing completion.
Modified: trunk/docutils/setup.py
===================================================================
--- trunk/docutils/setup.py 2023-06-24 20:50:32 UTC (rev 9406)
+++ trunk/docutils/setup.py 2023-06-26 11:57:11 UTC (rev 9407)
@@ -71,22 +71,20 @@
'docutils.writers.odf_odt',
],
'entry_points': {
- 'console_scripts': ['docutils=docutils.__main__:main']
+ 'console_scripts': [
+ 'docutils = docutils.__main__:main',
+ 'rst2html = docutils.core:rst2html',
+ 'rst2html4 = docutils.core:rst2html4',
+ 'rst2html5 = docutils.core:rst2html5',
+ 'rst2latex = docutils.core:rst2latex',
+ 'rst2man = docutils.core:rst2man',
+ 'rst2odt = docutils.core:rst2odt',
+ 'rst2pseudoxml = docutils.core:rst2pseudoxml',
+ 'rst2s5 = docutils.core:rst2s5',
+ 'rst2xetex = docutils.core:rst2xetex',
+ 'rst2xml = docutils.core:rst2xml',
+ ]
},
- 'scripts': [
- 'tools/rst2html.py',
- 'tools/rst2html4.py',
- 'tools/rst2html5.py',
- 'tools/rst2s5.py',
- 'tools/rst2latex.py',
- 'tools/rst2xetex.py',
- 'tools/rst2man.py',
- 'tools/rst2xml.py',
- 'tools/rst2pseudoxml.py',
- 'tools/rstpep2html.py',
- 'tools/rst2odt.py',
- 'tools/rst2odt_prepstyles.py',
- ],
'classifiers': [
'Development Status :: 4 - Beta',
'Environment :: Console',
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2023-06-26 17:48:30
|
Revision: 9408
http://sourceforge.net/p/docutils/code/9408
Author: milde
Date: 2023-06-26 17:48:28 +0000 (Mon, 26 Jun 2023)
Log Message:
-----------
Drop the ".py" extension in command line use examples.
Update the documentation of front-end tools and usage examples
to the name change due to defining "console-script" entry points
instead of installing the "tools/rst2*.py" scripts.
Modified Paths:
--------------
trunk/docutils/BUGS.txt
trunk/docutils/FAQ.txt
trunk/docutils/docs/api/publisher.txt
trunk/docutils/docs/dev/distributing.txt
trunk/docutils/docs/dev/hacking.txt
trunk/docutils/docs/dev/todo.txt
trunk/docutils/docs/howto/cmdline-tool.txt
trunk/docutils/docs/howto/html-stylesheets.txt
trunk/docutils/docs/user/config.txt
trunk/docutils/docs/user/emacs.txt
trunk/docutils/docs/user/html.txt
trunk/docutils/docs/user/latex.txt
trunk/docutils/docs/user/links.txt
trunk/docutils/docs/user/odt.txt
trunk/docutils/docs/user/slide-shows.txt
trunk/docutils/docs/user/todo-lists.txt
trunk/docutils/docs/user/tools.txt
trunk/docutils/test/functional/expected/standalone_rst_manpage.man
trunk/docutils/test/functional/expected/standalone_rst_s5_html_1.html
trunk/docutils/test/functional/expected/standalone_rst_s5_html_2.html
trunk/docutils/test/functional/input/standalone_rst_manpage.txt
trunk/docutils/test/functional/input/standalone_rst_s5_html.txt
Modified: trunk/docutils/BUGS.txt
===================================================================
--- trunk/docutils/BUGS.txt 2023-06-26 11:57:11 UTC (rev 9407)
+++ trunk/docutils/BUGS.txt 2023-06-26 17:48:28 UTC (rev 9408)
@@ -136,7 +136,7 @@
* .. _error reporting:
- Calling rst2s5.py with a non-existent theme (``--theme
+ Calling rst2s5 with a non-existent theme (``--theme
does_not_exist``)
causes exceptions. Such errors should be handled more gracefully.
@@ -210,7 +210,7 @@
over implicit targets. But if an explicit target comes after an
implicit target with the same name, the ID of the first (implicit)
target remains based on the implicit name. Since HTML fragment
- identifiers are based on the IDs, the first target keeps the name.
+ identifiers are based on the IDs, the first target keeps the name.
For example::
.. contents::
@@ -267,7 +267,7 @@
* _`Footnote references with hyperlink targets` cause a possibly
invalid node tree and make the HTML writer crash::
- $ rst2pseudoxml.py
+ $ rst2pseudoxml
[1]_
.. _1: URI
@@ -283,7 +283,7 @@
* <reference> elements have a "name" attribute, not "names". The
attribute should be "names"; this is an inconsistency.
-
+
..
Local Variables:
mode: indented-text
Modified: trunk/docutils/FAQ.txt
===================================================================
--- trunk/docutils/FAQ.txt 2023-06-26 11:57:11 UTC (rev 9407)
+++ trunk/docutils/FAQ.txt 2023-06-26 17:48:28 UTC (rev 9408)
@@ -47,7 +47,7 @@
* a library (the "docutils" package), which `can be used by client
code`_;
-* several `front-end tools`_ (such as ``rst2html.py``, which converts
+* several `front-end tools`_ (such as ``rst2html``, which converts
reStructuredText input into HTML output);
* a `test suite`_; and
* documentation_.
@@ -781,7 +781,7 @@
http://cben-hacks.sourceforge.net/bidi/rst2html_hibidi.py.
Put them both in the same directory and make them executable.
-* Use ``rst2html_hibidi.py`` instead of ``rst2html.py``.
+* Use ``rst2html_hibidi.py`` instead of ``rst2html``.
* It infers dir attributes in the HTML from the text. It does it
hierachically, giving much better results than usual. You can still
@@ -885,23 +885,23 @@
.. list-table::
:class: borderless
-
+
* - .. image:: rst/images/title-scaling.svg
- .. image:: rst/images/biohazard.svg
* - .. image:: rst/images/biohazard.svg
- .. image:: rst/images/biohazard.svg
-
+
Use figures, if you want also captions::
-
- .. list-table::
+
+ .. list-table::
:class: borderless
-
+
* - .. figure:: rst/images/title-scaling.svg
-
+
Figure 1/1
-
+
- .. figure:: rst/images/biohazard.svg
-
+
Figure 1/2
.. _list table: docs/ref/rst/directives.html#list-table
@@ -938,7 +938,7 @@
browsers are welcome.
-Unexpected results from tools/rst2html.py: H1, H1 instead of H1, H2. Why?
+Unexpected results from ``rst2html``: H1, H1 instead of H1, H2. Why?
--------------------------------------------------------------------------
This only regards output from the `html4css1`_ writer.
@@ -967,7 +967,7 @@
Yeah, imagine me, I'm stuck at H3! No?!?
- When I run it through tools/rst2html.py, I get unexpected results
+ When I run it through ``rst2html4``, I get unexpected results
(below). I was expecting H1, H2, then H3; instead, I get H1, H1,
H2::
@@ -1053,7 +1053,6 @@
__ https://www.w3.org/TR/html53/sections.html#headings-and-sections
-
How are lists formatted in HTML?
--------------------------------
@@ -1309,7 +1308,7 @@
.. _bug tracker: https://sourceforge.net/p/docutils/bugs/
-
+
..
Local Variables:
mode: indented-text
Modified: trunk/docutils/docs/api/publisher.txt
===================================================================
--- trunk/docutils/docs/api/publisher.txt 2023-06-26 11:57:11 UTC (rev 9407)
+++ trunk/docutils/docs/api/publisher.txt 2023-06-26 17:48:28 UTC (rev 9408)
@@ -41,19 +41,16 @@
publish_cmdline()
-----------------
-Function for command-line front-end tools, like ``rst2html.py`` or
-`"console_scripts" entry points`_ like `core.rst2html()` with file I/O.
+Function for custom `command-line front-end tools`_
+(like ``tools/rst2html.py``) or "console_scripts" `entry points`_
+(like `core.rst2html()`) with file I/O.
In addition to writing the output document to a file-like object, also
returns it as `str` instance (rsp. `bytes` for binary output document
formats).
-There are several examples in the ``tools/`` directory of the Docutils
-repository. A detailed analysis of one such tool is `Inside A Docutils
-Command-Line Front-End Tool`_.
-
-.. _"console_scripts" entry points:
+.. _command-line front-end tools: ../howto/cmdline-tool.html
+.. _entry points:
https://packaging.python.org/en/latest/specifications/entry-points/
-.. _Inside A Docutils Command-Line Front-End Tool: ../howto/cmdline-tool.html
publish_file()
@@ -457,7 +454,7 @@
the `preferred encoding`_.
- An optional BOM_ is removed from sources.
-The default will change to "utf-8" in Docutils 0.22,
+The default will change to "utf-8" in Docutils 0.22,
the input encoding detection will be removed in Docutils 1.0.
Modified: trunk/docutils/docs/dev/distributing.txt
===================================================================
--- trunk/docutils/docs/dev/distributing.txt 2023-06-26 11:57:11 UTC (rev 9407)
+++ trunk/docutils/docs/dev/distributing.txt 2023-06-26 17:48:28 UTC (rev 9408)
@@ -10,8 +10,6 @@
:Date: $Date$
:Copyright: This document has been placed in the public domain.
-.. _Docutils: https://docutils.sourceforge.io/
-
.. contents::
This document describes how to create packages of Docutils (e.g. for
@@ -18,11 +16,12 @@
shipping with a Linux distribution). If you have any questions,
please direct them to the Docutils-develop_ mailing list.
-First, please download the most current `release tarball`_ and unpack
+First, please download the most current `release package`_ and unpack
it.
+.. _Docutils: https://docutils.sourceforge.io/
.. _Docutils-develop: ../user/mailing-lists.html#docutils-develop
-.. _release tarball: https://docutils.sourceforge.io/#download
+.. _release package: https://docutils.sourceforge.io/#download
Dependencies
@@ -42,13 +41,15 @@
well as included source code files (with the "code" option to the include_
directive).
-* Docutils can use the `recommonmark`_ parser to parse input in
- the Markdown format (new in 0.17).
+* Docutils can use the `pycmark`_, `myst`_, or `recommonmark`_ parsers to
+ process input in the Markdown format (since Docutils 0.19).
.. _Python Imaging Library:
https://en.wikipedia.org/wiki/Python_Imaging_Library
.. _Pillow: https://pypi.org/project/Pillow/
.. _Pygments: https://pygments.org/
+.. _pycmark: https://pypi.org/project/pycmark/
+.. _myst: https://pypi.org/project/myst-docutils
.. _recommonmark: https://pypi.org/project/recommonmark/
.. _code directives: ../ref/rst/directives.html#code
@@ -59,8 +60,8 @@
============
The Docutils Python files must be installed into the
-``site-packages/`` directory of Python. Running ``python setup.py
-install`` should do the trick, but if you want to place the files
+``site-packages/`` directory of Python. Installing with pip_
+should do the trick, but if you want to place the files
yourself, you can just install the ``docutils/`` directory of the
Docutils tarball to ``/usr/lib/python/site-packages/docutils/``. In
this case you should also compile the Python files to ``.pyc`` and/or
@@ -67,18 +68,24 @@
``.pyo`` files so that Docutils doesn't need to be recompiled every
time it's executed.
+.. _pip: https://pip.pypa.io/en/stable/
+
Executables
===========
-The executable front-end tools are located in the ``tools/`` directory
-of the Docutils tarball.
+Executable front-end tools are generated and installed in the binary PATH
+by the installer (pip_) from "console_scripts" `entry point`_ definitions.
-The ``rst2*.py`` tools are intended for end-users. You should install them
-to ``/usr/bin/``. You do not need to change the names (e.g. to
-``docutils-rst2html.py``) because the ``rst2`` prefix is unique.
+Alternatively, you may install the ``rst2*.py`` tools from the
+``tools/`` directory of the Docutils source package.
+On systems that support executable Python scripts, dropping the ``.py``
+extension is recommended.
+.. _entry point:
+ https://packaging.python.org/en/latest/specifications/entry-points/
+
Documentation
=============
Modified: trunk/docutils/docs/dev/hacking.txt
===================================================================
--- trunk/docutils/docs/dev/hacking.txt 2023-06-26 11:57:11 UTC (rev 9407)
+++ trunk/docutils/docs/dev/hacking.txt 2023-06-26 17:48:28 UTC (rev 9408)
@@ -36,7 +36,7 @@
.. _Python: https://www.python.org/
-Using the ``rst2html.py`` front-end tool, you would get an HTML output
+Using the ``rst2html`` front-end tool, you would get an HTML output
which looks like this::
[uninteresting HTML code removed]
@@ -134,7 +134,7 @@
has changed after applying the Transforms, we use the
rst2pseudoxml_ tool [#]_::
- $ rst2pseudoxml.py test.txt
+ $ rst2pseudoxml test.txt
<document source="test.txt">
<paragraph>
My
@@ -172,9 +172,9 @@
HTML writer in this case (``docutils/writers/html4css1.py``).
The writer receives the node tree and returns the output document.
-For HTML output, we can test this using the ``rst2html.py`` tool::
+For HTML output, we can test this using the ``rst2html`` tool::
- $ rst2html.py --link-stylesheet test.txt
+ $ rst2html --link-stylesheet test.txt
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
Modified: trunk/docutils/docs/dev/todo.txt
===================================================================
--- trunk/docutils/docs/dev/todo.txt 2023-06-26 11:57:11 UTC (rev 9407)
+++ trunk/docutils/docs/dev/todo.txt 2023-06-26 17:48:28 UTC (rev 9408)
@@ -99,9 +99,9 @@
http://www.catb.org/esr/reposurgeon/repository-editing.html
__ https://git.wiki.kernel.org/index.php/
Interfaces,_frontends,_and_tools#Subversion
-__ http://www.catb.org/esr/reposurgeon/repository-editing.html#conversion
+__ http://www.catb.org/esr/reposurgeon/repository-editing.html#conversion
__ http://www.catb.org/esr/reposurgeon/repository-editing.html
- #_reading_subversion_repositories
+ #_reading_subversion_repositories
Adam Turner wrote a conversion Makefile and ``.lift`` scripts that
@@ -137,12 +137,14 @@
- Get graphical installer.
- Make rst2html.py an .exe file using py2exe.
+ (Is this still required after we have "console scripts" entry points?
+ GM 2023-06-25)
* .. _GUI:
The user interface is very difficult to use for most Windows users;
you can't really expect them to use the command line. We need some
- kind of GUI that can launch rst2html.py, and save the HTML output to
+ kind of GUI that can launch ``rst2html``, and save the HTML output to
a file, and launch a browser. What's important is that we get
settings to work with the GUI. So we need some way to dynamically
generate a list of settings for the GUI. The current settings_spec
@@ -571,8 +573,8 @@
* docutils_update: Check for a ``Makefile`` in a directory, and run
``make`` if found? This would allow for variant processing on
- specific source files, such as running rst2s5.py instead of
- rst2html.py.
+ specific source files, such as running ``rst2s5`` instead of
+ ``rst2html``.
* Add a "disable table of contents" setting? The S5 writer could set
it as a default. Rationale:
@@ -662,11 +664,7 @@
.. _OpenOffice.org XML: http://xml.openoffice.org/
.. _object references: rst/alternatives.html#object-references
-See also the `Modified rst2html
-<http://www.loria.fr/~rougier/coding/article/rst2html.py>`__
-by Nicolas Rougier for a sample implementation.
-
Documentation
=============
@@ -1180,7 +1178,7 @@
- The line numbers of definition list items are wrong::
- $ rst2pseudoxml.py --expose-internal-attribute line
+ $ rst2pseudoxml --expose-internal-attribute line
1
2
3
@@ -1330,7 +1328,7 @@
.. _Another Document: another.txt
- rst2html.py --convert-links "another.txt bar.txt" foo.txt
+ rst2html --convert-links "another.txt bar.txt" foo.txt
That is, name the files for which extensions should be converted.
@@ -1340,11 +1338,11 @@
Note that in most cases, people will be able to use globs::
- rst2html.py --convert-link-extensions-for "`echo *.txt`" foo.txt
+ rst2html --convert-link-extensions-for "`echo *.txt`" foo.txt
It might be nice to be able to use multiple arguments, as in::
- rst2html.py --convert-link-extensions-for *.txt -- foo.txt
+ rst2html --convert-link-extensions-for *.txt -- foo.txt
> Handle documents only, or objects (images, etc.) also?
@@ -2827,10 +2825,10 @@
Display output on success, but keep it brief.
provide a --quiet option to suppress all non-essential output.
-
+
Consider chaining several args as input and use --output
(or redirection) for output.
-
+
-- https://clig.dev/#help
.. _partial parsing:
Modified: trunk/docutils/docs/howto/cmdline-tool.txt
===================================================================
--- trunk/docutils/docs/howto/cmdline-tool.txt 2023-06-26 11:57:11 UTC (rev 9407)
+++ trunk/docutils/docs/howto/cmdline-tool.txt 2023-06-26 17:48:28 UTC (rev 9408)
@@ -10,6 +10,12 @@
:Revision: $Revision$
:Copyright: This document has been placed in the public domain.
+.. note:: This document describes the traditional approach with
+ hand-crafted front-end scripts.
+ Since version 0.21, the package installer installs
+ front-end scripts generated from "console_scripts"
+ `entry point`_ definitions.
+
`The Docutils Publisher`_ class was set up to make building
command-line tools easy. All that's required is to choose components
and supply settings for variations. Let's take a look at a typical
@@ -65,4 +71,7 @@
That's it! `The Docutils Publisher`_ takes care of the rest.
+
+.. _entry point:
+ https://packaging.python.org/en/latest/specifications/entry-points/
.. _The Docutils Publisher: ./publisher.html
Modified: trunk/docutils/docs/howto/html-stylesheets.txt
===================================================================
--- trunk/docutils/docs/howto/html-stylesheets.txt 2023-06-26 11:57:11 UTC (rev 9407)
+++ trunk/docutils/docs/howto/html-stylesheets.txt 2023-06-26 17:48:28 UTC (rev 9408)
@@ -17,7 +17,7 @@
The default stylesheets can be found in the
``docutils/writers/html*/`` directories of the ``html4css1`` and
``html-base`` writers in the Docutils installation. Use the front-end
-command (``rst2html.py`` or ``rst2html5.py``) with the
+command (``rst2html`` or ``rst2html5``) with the
``--help`` option and look at the description of the ``--stylesheet-path``
command-line option for the exact machine-specific location.
@@ -27,7 +27,7 @@
``--stylesheet-path`` command line option (or the corresponding
settings in a configuration_ file), e.g. ::
- rst2html.py --stylesheet=html4css1.css,transition-stars.css
+ rst2html --stylesheet=html4css1.css,transition-stars.css
This is the preferable approach if you want to embed the stylesheet(s), as
this ensures that an up-to-date version of ``html4css1.css`` is embedded.
Modified: trunk/docutils/docs/user/config.txt
===================================================================
--- trunk/docutils/docs/user/config.txt 2023-06-26 11:57:11 UTC (rev 9407)
+++ trunk/docutils/docs/user/config.txt 2023-06-26 17:48:28 UTC (rev 9408)
@@ -485,7 +485,7 @@
``make`` using ``Makefile`` rules like::
ham.html: ham.txt $(shell cat hamdeps.txt)
- rst2html.py --record-dependencies=hamdeps.txt ham.txt ham.html
+ rst2html --record-dependencies=hamdeps.txt ham.txt ham.html
If the filesystem encoding differs from UTF-8, replace the ``cat``
command with a call to a converter, e.g.::
Modified: trunk/docutils/docs/user/emacs.txt
===================================================================
--- trunk/docutils/docs/user/emacs.txt 2023-06-26 11:57:11 UTC (rev 9407)
+++ trunk/docutils/docs/user/emacs.txt 2023-06-26 17:48:28 UTC (rev 9408)
@@ -589,7 +589,7 @@
When crafting documents, it is often convenient to view which data
structures docutils will parse them into. You can use to run the
- active region through ``rst2pseudoxml.py`` and have the output
+ active region through ``rst2pseudoxml`` and have the output
automatically be displayed in a new buffer.
* ``rst-compile-pdf-preview`` (``C-c C-c C-p``)
Modified: trunk/docutils/docs/user/html.txt
===================================================================
--- trunk/docutils/docs/user/html.txt 2023-06-26 11:57:11 UTC (rev 9407)
+++ trunk/docutils/docs/user/html.txt 2023-06-26 17:48:28 UTC (rev 9408)
@@ -9,7 +9,7 @@
html
----
-:front-end: rst2html.py_
+:front-end: rst2html_
`html` is an alias for the default Docutils HTML writer.
@@ -18,7 +18,7 @@
Currently, `html` is mapped to html4css1_, it will become an alias for
html5_ in Docutils 2.0.
-* Use ``get_writer_by_name('html')`` or the rst2html.py_ front end, if you
+* Use ``get_writer_by_name('html')`` or the rst2html_ front end, if you
want the output to be up-to-date automatically.
* Use a specific writer name or front end, if you depend on stability of the
@@ -30,7 +30,7 @@
---------
:aliases: html4, html_
-:front-ends: rst2html4.py, rst2html.py_
+:front-ends: rst2html4_, rst2html_
:config: `[html4css1 writer]`_
The HTML Writer module, ``docutils/writers/html4css1.py``, was the first
@@ -53,7 +53,8 @@
.. [#IE] Conformance to `CSS 2.1`_ has been added in IE 8 (2009), support
for XHTML in IE 9 (2011).
-.. _rst2html.py: tools.html#rst2html-py
+.. _rst2html: tools.html#rst2html
+.. _rst2html4: tools.html#rst2html4
.. _[html4css1 writer]: config.html#html4css1-writer
.. _html4css1.css: ../../docutils/writers/html4css1/html4css1.css
@@ -60,15 +61,14 @@
pep_html
~~~~~~~~
-:front-end: rstpep2html.py_
+:front-end: ``docutils --reader=pep --writer=pep_html``
:config: `[pep_html writer]`_
This is a special writer for the generation of `Python Enhancement
Proposals`_ (PEPs). It inherits from html4css1_ and adds some `PEP-specific
-options`_, a style sheet and template. The front-end uses also a specialised
-reader.
+options`_, a style sheet and template. It works best in combination with
+the specialised "pep_html" reader.
-.. _rstpep2html.py: tools.html#rstpep2html-py
.. _PEP-specific options:
.. _[pep_html writer]: config.html#pep-html-writer
.. _Python Enhancement Proposals: https://peps.python.org/
@@ -77,7 +77,7 @@
~~~~~~~
:alias: s5
-:front-end: rst2s5.py_
+:front-end: rst2s5_
:config: `[s5_html writer]`_
The `s5` writer inherits from html4css1_. It produces XHTML for use with
@@ -84,7 +84,7 @@
S5_, the “Simple Standards-based Slide Show System” by Eric Meyer. See
`Easy Slide Shows With reST & S5`_ for details.
-.. _rst2s5.py: tools.html#rst2s5-py
+.. _rst2s5: tools.html#rst2s5
.. _[s5_html writer]: config.html#s5-html-writer
.. _Easy Slide Shows With reST & S5: slide-shows.html
.. _S5: http://meyerweb.com/eric/tools/s5/
@@ -95,7 +95,7 @@
-----
:aliases: _`html5_polyglot`
-:front-end: rst2html5.py_
+:front-end: rst2html5_
:config: `[html5 writer]`_
The ``html5_polyglot`` writer generates `polyglot HTML`_ [#]_ output, valid
@@ -123,7 +123,7 @@
input/data/html5-features.txt
.. _html5-text-level-tags.txt: https://docutils.sourceforge.io/test/functional/
input/data/html5-text-level-tags.txt
-.. _rst2html5.py: tools.html#rst2html5-py
+.. _rst2html5: tools.html#rst2html5
.. _[html5 writer]: config.html#html5-writer
.. _minimal.css: ../../docutils/writers/html5_polyglot/minimal.css
.. _plain.css: ../../docutils/writers/html5_polyglot/plain.css
@@ -139,16 +139,16 @@
================ =========== ============== ================= ===========
name aliases `front-end`_ HTML version CSS version
================ =========== ============== ================= ===========
-html4css1_ html4, rst2html4.py, `XHTML 1 `CSS 1`_
- html_ rst2html.py Transitional`_
+html4css1_ html4, rst2html4, `XHTML 1 `CSS 1`_
+ html_ rst2html Transitional`_
-pep_html_ .. rstpep2html.py `XHTML 1 `CSS 1`_
+pep_html_ .. rstpep2html `XHTML 1 `CSS 1`_
Transitional`_
-s5_html_ s5 rst2s5.py `XHTML 1 `CSS 1`_
+s5_html_ s5 rst2s5 `XHTML 1 `CSS 1`_
Transitional`_
-html5_polyglot_ html5 rst2html5.py `HTML5`_ `CSS 3`_
+html5_polyglot_ html5 rst2html5 `HTML5`_ `CSS 3`_
================ =========== ============== ================= ===========
Modified: trunk/docutils/docs/user/latex.txt
===================================================================
--- trunk/docutils/docs/user/latex.txt 2023-06-26 11:57:11 UTC (rev 9407)
+++ trunk/docutils/docs/user/latex.txt 2023-06-26 17:48:28 UTC (rev 9408)
@@ -132,21 +132,21 @@
_`pdflatex`
Generates a PDF document directly from the LaTeX file.
Export your document with the _`LaTeX2e writer` (writer
- name "``latex``", frontend tool rst2latex.py_).
+ name "``latex``", frontend tool rst2latex_).
_`xelatex` or _`lualatex`
The `XeTeX`_ and LuaTeX_ engines work with input files in UTF-8 encoding
and system fonts. Export your document with the _`XeLaTeX writer` (writer
- name "``xetex``", frontend tool rst2xetex.py_).
+ name "``xetex``", frontend tool rst2xetex_).
-You may need to call latex two or three times to get internal references
+You may need to call LaTeX two or three times to get internal references
correct.
.. _documentoptions: config.html#documentoptions
.. _xetex: http://tug.org/xetex/
.. _luatex: http://luatex.org/
-.. _rst2latex.py: tools.html#rst2latex-py
-.. _rst2xetex.py: tools.html#rst2xetex-py
+.. _rst2latex: tools.html#rst2latex
+.. _rst2xetex: tools.html#rst2xetex
_`rubber`
The Rubber__ wrapper for LaTeX and friends can be used to automatically
@@ -173,7 +173,7 @@
* configuration settings.
-Run ``rst2latex.py --help`` to get a list of available options;
+Run ``rst2latex --help`` to get a list of available options;
see `Docutils Configuration`_ for details.
.. _Docutils Configuration: config.html
Modified: trunk/docutils/docs/user/links.txt
===================================================================
--- trunk/docutils/docs/user/links.txt 2023-06-26 11:57:11 UTC (rev 9407)
+++ trunk/docutils/docs/user/links.txt 2023-06-26 17:48:28 UTC (rev 9408)
@@ -264,7 +264,7 @@
.. _sxw2rest: https://twb.ath.cx/~twb/darcs/sxw2rest/
* xml2rst_, an XSLT stylesheet written by Stefan Merten, converts XML
- dumps of the document tree (e.g. created with rst2xml.py) back to
+ dumps of the document tree (e.g. created with ``rst2xml``) back to
reStructuredText.
.. _xml2rst: http://www.merten-home.de/FreeSoftware/xml2rst/index.html
Modified: trunk/docutils/docs/user/odt.txt
===================================================================
--- trunk/docutils/docs/user/odt.txt 2023-06-26 11:57:11 UTC (rev 9407)
+++ trunk/docutils/docs/user/odt.txt 2023-06-26 17:48:28 UTC (rev 9408)
@@ -21,7 +21,7 @@
Introduction
============
-The Docutils front end rst2odt.py_ translates reStructuredText_ into an
+The Docutils front end rst2odt_ translates reStructuredText_ into an
`OpenDocument Text`_ (.odt) file.
OpenDocument files `can be opened by most modern office software`__.
It is the native file format for LibreOffice_ Writer.
@@ -50,18 +50,18 @@
Run it from the command line as follows::
- $ rst2odt.py myinput.txt > myoutput.odt
+ $ rst2odt myinput.txt > myoutput.odt
To see usage information and to learn about command line options
that you can use, run the following::
- $ rst2odt.py --help
+ $ rst2odt --help
Examples::
- $ rst2odt.py -s -g python_comments.txt > python_comments.odt
+ $ rst2odt -s -g python_comments.txt > python_comments.odt
- $ rst2odt.py --source-url=odtwriter.txt --generator \
+ $ rst2odt --source-url=odtwriter.txt --generator \
--stylesheet=/myconfigs/styles.odt odtwriter.txt > odtwriter.odt
@@ -223,7 +223,7 @@
using ``oowriter``, and then use your copy with the
``--stylesheet=<file>`` command line option. Example::
- $ rst2odt.py --stylesheet=mystyles.odt test2.txt test2.odt
+ $ rst2odt --stylesheet=mystyles.odt test2.txt > test2.odt
Paragraph styles
@@ -647,8 +647,8 @@
2. Open your copy of ``styles.odt`` in ``oowriter``. Modify styles
in that document. Then, save it.
-3. When you run ``rst2odt.py``, use the ``--stylesheet`` command
- line option to use your custom stylesheet. Run ``rst2odt.py
+3. When you run ``rst2odt``, use the ``--stylesheet`` command
+ line option to use your custom stylesheet. Run ``rst2odt
--help`` to learn more about these options.
@@ -742,7 +742,7 @@
using the ``--stylesheet`` option in order to include your
custom style definitions. For example::
- rst2odt.py --odf-config-file=mymappingfile.ini \
+ rst2odt --odf-config-file=mymappingfile.ini \
--stylesheet=mystyles.odt mydoc.txt mydoc.odt
@@ -840,7 +840,7 @@
2. Use the command line option ``--add-syntax-highlighting``.
Example::
- $ rst2odt.py --add-syntax-highlight test.txt test.odt
+ $ rst2odt --add-syntax-highlight test.txt > test.odt
The following styles are defined in styles.odt and are used for
literal code blocks and syntax highlighting:
@@ -1078,13 +1078,13 @@
2. The page height and width settings must be absent from the stylesheet
used to generate the document.
-
+
You can use the Python script ``prepstyles.py`` distributed with
Docutils to remove the page height and width settings from a
stylesheet file ``STYLES.odt`` with ::
$ python3 -m docutils.writers.odf_odt.prepstyles STYLES.odt
-
+
(the command changed in Docutils 0.20.1).
.. warning:: If you edit your stylesheet in ``oowriter`` and then
@@ -1110,7 +1110,7 @@
following inserts a footer containing the page number and page
count::
- $ rst2odt.py --custom-odt-footer="Page %p% of %P%" f1.txt f1.odt
+ $ rst2odt --custom-odt-footer="Page %p% of %P%" f1.txt > f1.odt
Field specifiers
@@ -1184,8 +1184,8 @@
-.. _rst2odt.py:
- tools.html#rst2odt-py
+.. _rst2odt:
+ tools.html#rst2odt
.. _reStructuredText:
../ref/rst/restructuredtext.html
.. _`OpenDocument Text`:
Modified: trunk/docutils/docs/user/slide-shows.txt
===================================================================
--- trunk/docutils/docs/user/slide-shows.txt 2023-06-26 11:57:11 UTC (rev 9407)
+++ trunk/docutils/docs/user/slide-shows.txt 2023-06-26 17:48:28 UTC (rev 9408)
@@ -15,7 +15,7 @@
Docutils_/reStructuredText_ and S5_.
This document serves both as a user manual and as a usage example
- of the s5_html.py writer and the rst2s5.py front end.
+ of the s5_html.py writer and the ``rst2s5`` front end.
To view this document as a slide show see
https://docutils.sourceforge.io/docs/user/slide-shows.s5.html (or `your
@@ -69,7 +69,7 @@
.. class:: handout
- ``rst2s5.py`` is a Docutils_ front end that outputs HTML for use
+ ``rst2s5`` is a Docutils_ front end that outputs HTML for use
with S5_, a "Simple Standards-based Slide Show System" by Eric
Meyer.
@@ -115,11 +115,11 @@
A variety of themes are available. See `Example Themes`_, below.
-* ``rst2s5.py``
+* ``rst2s5``
.. class:: handout
- The front-end tool to generate S5 slide shows.
+ The console script to generate S5 slide shows.
.. topic:: Keyboard Controls
:class: handout
@@ -361,7 +361,7 @@
2. Run the command::
- rst2s5.py slides.txt slides.html
+ rst2s5 slides.txt slides.html
3. Specify an S5 theme with the ``--theme``...
[truncated message content] |
|
From: <mi...@us...> - 2023-06-26 17:48:50
|
Revision: 9409
http://sourceforge.net/p/docutils/code/9409
Author: milde
Date: 2023-06-26 17:48:39 +0000 (Mon, 26 Jun 2023)
Log Message:
-----------
Warn the user if the S5 writer cannot copy the theme files.
Print a warning if the S5 theme files cannot be copied to the
destination dir because the output destination path is unknown to the writer.
Update documentation.
Modified Paths:
--------------
trunk/docutils/docs/user/config.txt
trunk/docutils/docs/user/slide-shows.txt
trunk/docutils/docs/user/tools.txt
trunk/docutils/docutils/writers/s5_html/__init__.py
Modified: trunk/docutils/docs/user/config.txt
===================================================================
--- trunk/docutils/docs/user/config.txt 2023-06-26 17:48:28 UTC (rev 9408)
+++ trunk/docutils/docs/user/config.txt 2023-06-26 17:48:39 UTC (rev 9409)
@@ -424,7 +424,7 @@
output
------
-The name of the output destination. Use ``-`` for stdout.
+The path of the output destination. Use ``-`` for stdout.
Obsoletes the ``<destination>`` positional argument
(cf. `Future changes`_ in the RELEASE-NOTES).
Modified: trunk/docutils/docs/user/slide-shows.txt
===================================================================
--- trunk/docutils/docs/user/slide-shows.txt 2023-06-26 17:48:28 UTC (rev 9408)
+++ trunk/docutils/docs/user/slide-shows.txt 2023-06-26 17:48:39 UTC (rev 9409)
@@ -18,8 +18,8 @@
of the s5_html.py writer and the ``rst2s5`` front end.
To view this document as a slide show see
- https://docutils.sourceforge.io/docs/user/slide-shows.s5.html (or `your
- local copy <slide-shows.s5.html>`__).
+ https://docutils.sourceforge.io/docs/user/slide-shows.s5.html or `your
+ local copy <slide-shows.s5.html>`__.
.. contents::
:class: handout
@@ -69,7 +69,7 @@
.. class:: handout
- ``rst2s5`` is a Docutils_ front end that outputs HTML for use
+ rst2s5_ is a Docutils_ front end that outputs HTML for use
with S5_, a "Simple Standards-based Slide Show System" by Eric
Meyer.
@@ -115,11 +115,13 @@
A variety of themes are available. See `Example Themes`_, below.
-* ``rst2s5``
+* rst2s5_
.. class:: handout
The console script to generate S5 slide shows.
+
+ .. _rst2s5: tools.html#rst2s5
.. topic:: Keyboard Controls
:class: handout
@@ -361,17 +363,22 @@
2. Run the command::
- rst2s5 slides.txt slides.html
+ rst2s5 slides.txt --output=slides.html
-3. Specify an S5 theme with the ``--theme`` option.
+3. Optionally, specify an S5 theme with the ``--theme`` option.
.. class:: handout
Docutils will copy the S5 theme files into a ``ui/<theme>`` folder
- beside the output HTML file. A slide show can also link to an
- existing theme using the ``--theme-url`` option.
+ beside the output HTML file. [#copy-theme]_ A slide show can also link
+ to an existing theme using the ``--theme-url`` option.
+ .. [#copy-theme] Theme files can only be copied by Docutils, if the
+ output_ destination path is specified.
+
+ .. _output: config.html#output
+
Generating a Slide Show (2)
===========================
Modified: trunk/docutils/docs/user/tools.txt
===================================================================
--- trunk/docutils/docs/user/tools.txt 2023-06-26 17:48:28 UTC (rev 9408)
+++ trunk/docutils/docs/user/tools.txt 2023-06-26 17:48:39 UTC (rev 9409)
@@ -234,7 +234,7 @@
For example, to process a reStructuredText file "``slides.txt``" into
S5/HTML::
- rst2s5 slides.txt > slides.html
+ rst2s5 slides.txt --output=slides.html
Now open the "``slides.html``" file in your favorite browser, switch
to full-screen mode, and enjoy the results.
@@ -247,14 +247,15 @@
Each S5 theme consists of a directory containing several files:
stylesheets, JavaScript, and graphics. These are copied into a
-``ui/<theme>`` directory beside the generated HTML. A theme is chosen
+``ui/<theme>`` directory beside the generated HTML. [#copy-theme]_
+A theme is chosen
using the "``--theme``" option (for themes that come with Docutils) or
the "``--theme-url``" option (for themes anywhere). For example, the
"medium-black" theme can be specified as follows::
- rst2s5 --theme medium-black slides.txt > slides.html
+ rst2s5 --theme medium-black slides.txt --output=slides.html
-The theme will be copied to the ``ui/medium-black`` directory.
+The theme will be copied [#copy-theme]_ to the ``ui/medium-black`` directory.
Several themes are included with Docutils:
@@ -324,6 +325,10 @@
For details, please see `Easy Slide Shows With reStructuredText & S5
<slide-shows.html>`_.
+.. [#copy-theme] Theme files can only be copied by Docutils, if the
+ output_ destination path is specified.
+
+.. _output: config.html#output
buildhtml.py
------------
Modified: trunk/docutils/docutils/writers/s5_html/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/s5_html/__init__.py 2023-06-26 17:48:28 UTC (rev 9408)
+++ trunk/docutils/docutils/writers/s5_html/__init__.py 2023-06-26 17:48:39 UTC (rev 9409)
@@ -9,7 +9,6 @@
__docformat__ = 'reStructuredText'
-
import sys
import os
import re
@@ -154,7 +153,10 @@
html4css1.HTMLTranslator.__init__(self, *args)
# insert S5-specific stylesheet and script stuff:
self.theme_file_path = None
- self.setup_theme()
+ try:
+ self.setup_theme()
+ except docutils.ApplicationError as e:
+ self.document.reporter.warning(e)
view_mode = self.document.settings.view_mode
control_visibility = ('visible', 'hidden')[self.document.settings
.hidden_controls]
@@ -193,15 +195,15 @@
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
+ self.theme_file_path = 'ui/%s' % settings.theme
+ if not settings.output:
+ raise docutils.ApplicationError(
+ 'Output path not specified, you may need to copy'
+ ' the S5 theme files "by hand" or set the "--output" option.')
+ dest = os.path.join(
+ os.path.dirname(settings.output), 'ui', settings.theme)
+ if not os.path.isdir(dest):
+ os.makedirs(dest)
default = False
while path:
for f in os.listdir(path): # copy all files from each theme
@@ -209,7 +211,7 @@
continue # ... except the "__base__" file
if (self.copy_file(f, path, dest)
and f in self.required_theme_files):
- required_files_copied[f] = 1
+ required_files_copied[f] = True
if default:
break # "default" theme has no base theme
# Find the "__base__" file in theme directory:
@@ -249,14 +251,14 @@
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`.
+ Return True 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
+ return True
else:
- self.theme_files_copied[dest] = 1
+ self.theme_files_copied[dest] = True
if os.path.isfile(source):
if self.files_to_skip_pattern.search(source):
return None
@@ -273,9 +275,9 @@
dest_dir[dest_dir.rfind('ui/'):].encode(
sys.getfilesystemencoding())))
settings.record_dependencies.add(source)
- return 1
+ return True
if os.path.isfile(dest):
- return 1
+ return True
def depart_document(self, node):
self.head_prefix.extend([self.doctype,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2023-06-27 20:04:05
|
Revision: 9413
http://sourceforge.net/p/docutils/code/9413
Author: milde
Date: 2023-06-27 20:04:02 +0000 (Tue, 27 Jun 2023)
Log Message:
-----------
html5-writer: Don't add "footnote-reference" class for footnote references.
Since 0.18, you can use the CSS selector ``[role="doc-noteref"]``.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/RELEASE-NOTES.txt
trunk/docutils/docutils/writers/_html_base.py
trunk/docutils/test/functional/expected/footnotes_html5.html
trunk/docutils/test/functional/expected/standalone_rst_html5.html
trunk/docutils/test/test_writers/test_html5_polyglot_parts.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2023-06-27 20:03:52 UTC (rev 9412)
+++ trunk/docutils/HISTORY.txt 2023-06-27 20:04:02 UTC (rev 9413)
@@ -30,6 +30,7 @@
configuration setting is None, '', 'utf-8-sig', 'utf-16', or 'utf-32'.
Do not remove other ZWNBSPs.
+ .. _UTF-8 mode: https://docs.python.org/3/library/os.html#utf8-mode
.. _input encoding: docs/api/publisher.html#encodings
* docutils/utils/roman.py
@@ -41,7 +42,21 @@
- Fix placement of hyperlink target (label) for tables (bug #440).
+* docutils/writers/s5_html/__init__.py
+ - Warn if the S5 writer cannot copy the theme files.
+ - Programmatic customization of "theme_url__" setting no longer
+ overridden by the default for "theme__".
+
+ __ docs/user/config.html#theme-url
+ __ docs/user/config.html#theme
+
+* docutils/writers/_html_base.py
+
+ - Stop setting the "footnote-reference" class value for footnote references.
+ Since 0.18, you can use the CSS selector ``[role="doc-noteref"]``.
+
+
Release 0.20.1 (2023-05-17)
===========================
Modified: trunk/docutils/RELEASE-NOTES.txt
===================================================================
--- trunk/docutils/RELEASE-NOTES.txt 2023-06-27 20:03:52 UTC (rev 9412)
+++ trunk/docutils/RELEASE-NOTES.txt 2023-06-27 20:04:02 UTC (rev 9413)
@@ -73,12 +73,6 @@
* "html5" writer:
- - Stop setting the "footnote-reference" class value for footnote
- references in Docutils 0.21.
- Since 0.18, you can use the CSS selector
- ``[role="doc-noteref"]`` instead of ``.footnote-reference``
- (see minimal.css for examples).
-
- Move attribution behind the blockquote to comply with the `"living
standard"`__. (HTML5__ allows <cite> elements inside a blockquote.)
@@ -213,7 +207,13 @@
.. _input encoding: docs/api/publisher.html#encodings
+* "html5" writer:
+ Stop setting the "footnote-reference" class value for footnote references.
+ Use the CSS selector ``[role="doc-noteref"]`` instead of
+ ``.footnote-reference`` (see minimal.css for examples).
+
+
Release 0.20.1 (2023-05-17)
===========================
Modified: trunk/docutils/docutils/writers/_html_base.py
===================================================================
--- trunk/docutils/docutils/writers/_html_base.py 2023-06-27 20:03:52 UTC (rev 9412)
+++ trunk/docutils/docutils/writers/_html_base.py 2023-06-27 20:04:02 UTC (rev 9413)
@@ -971,7 +971,7 @@
def visit_footnote_reference(self, node):
href = '#' + node['refid']
- classes = ['footnote-reference', self.settings.footnote_references]
+ classes = [self.settings.footnote_references]
self.body.append(self.starttag(node, 'a', suffix='', classes=classes,
role='doc-noteref', href=href))
self.body.append('<span class="fn-bracket">[</span>')
Modified: trunk/docutils/test/functional/expected/footnotes_html5.html
===================================================================
--- trunk/docutils/test/functional/expected/footnotes_html5.html 2023-06-27 20:03:52 UTC (rev 9412)
+++ trunk/docutils/test/functional/expected/footnotes_html5.html 2023-06-27 20:04:02 UTC (rev 9413)
@@ -12,8 +12,8 @@
<main id="test-footnote-and-citation-rendering">
<h1 class="title">Test footnote and citation rendering</h1>
-<p>Paragraphs may contain footnote references (manually numbered<a class="footnote-reference superscript" href="#footnote-1" id="footnote-reference-1" role="doc-noteref"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></a>, anonymous auto-numbered<a class="footnote-reference superscript" href="#footnote-2" id="footnote-reference-2" role="doc-noteref"><span class="fn-bracket">[</span>3<span class="fn-bracket">]</span></a>, labeled auto-numbered<a class="footnote-reference superscript" href="#label" id="footnote-reference-3" role="doc-noteref"><span class="fn-bracket">[</span>2<span class="fn-bracket">]</span></a>, or
-symbolic<a class="footnote-reference superscript" href="#footnote-3" id="footnote-reference-4" role="doc-noteref"><span class="fn-bracket">[</span>*<span class="fn-bracket">]</span></a>) or citation references (<a class="citation-reference" href="#cit2002" id="citation-reference-1" role="doc-biblioref">[CIT2002]</a>, <a class="citation-reference" href="#du2015" id="citation-reference-2" role="doc-biblioref">[DU2015]</a>).</p>
+<p>Paragraphs may contain footnote references (manually numbered<a class="superscript" href="#footnote-1" id="footnote-reference-1" role="doc-noteref"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></a>, anonymous auto-numbered<a class="superscript" href="#footnote-2" id="footnote-reference-2" role="doc-noteref"><span class="fn-bracket">[</span>3<span class="fn-bracket">]</span></a>, labeled auto-numbered<a class="superscript" href="#label" id="footnote-reference-3" role="doc-noteref"><span class="fn-bracket">[</span>2<span class="fn-bracket">]</span></a>, or
+symbolic<a class="superscript" href="#footnote-3" id="footnote-reference-4" role="doc-noteref"><span class="fn-bracket">[</span>*<span class="fn-bracket">]</span></a>) or citation references (<a class="citation-reference" href="#cit2002" id="citation-reference-1" role="doc-biblioref">[CIT2002]</a>, <a class="citation-reference" href="#du2015" id="citation-reference-2" role="doc-biblioref">[DU2015]</a>).</p>
<aside class="footnote-list superscript">
<aside class="footnote superscript" id="footnote-1" role="doc-footnote">
<span class="label"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></span>
@@ -25,10 +25,10 @@
<aside class="footnote superscript" id="label" role="doc-footnote">
<span class="label"><span class="fn-bracket">[</span>2<span class="fn-bracket">]</span></span>
<span class="backrefs">(<a role="doc-backlink" href="#footnote-reference-3">1</a>,<a role="doc-backlink" href="#footnote-reference-6">2</a>)</span>
-<p>Footnotes may be numbered, either manually (as in<a class="footnote-reference superscript" href="#footnote-1" id="footnote-reference-5" role="doc-noteref"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></a>) or
+<p>Footnotes may be numbered, either manually (as in<a class="superscript" href="#footnote-1" id="footnote-reference-5" role="doc-noteref"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></a>) or
automatically using a "#"-prefixed label. This footnote has a
label so it can be referred to from multiple places, both as a
-footnote reference (<a class="footnote-reference superscript" href="#label" id="footnote-reference-6" role="doc-noteref"><span class="fn-bracket">[</span>2<span class="fn-bracket">]</span></a>) and as a <a class="reference internal" href="#label">hyperlink reference</a>.</p>
+footnote reference (<a class="superscript" href="#label" id="footnote-reference-6" role="doc-noteref"><span class="fn-bracket">[</span>2<span class="fn-bracket">]</span></a>) and as a <a class="reference internal" href="#label">hyperlink reference</a>.</p>
</aside>
<aside class="footnote superscript" id="footnote-2" role="doc-footnote">
<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#footnote-reference-2">3</a><span class="fn-bracket">]</span></span>
@@ -40,7 +40,7 @@
<aside class="footnote superscript" id="footnote-3" role="doc-footnote">
<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#footnote-reference-4">*</a><span class="fn-bracket">]</span></span>
<p>Footnotes may also use symbols, specified with a "*" label.
-Here's a reference to the next footnote:<a class="footnote-reference superscript" href="#footnote-4" id="footnote-reference-7" role="doc-noteref"><span class="fn-bracket">[</span>†<span class="fn-bracket">]</span></a>.</p>
+Here's a reference to the next footnote:<a class="superscript" href="#footnote-4" id="footnote-reference-7" role="doc-noteref"><span class="fn-bracket">[</span>†<span class="fn-bracket">]</span></a>.</p>
</aside>
<aside class="footnote superscript" id="footnote-4" role="doc-footnote">
<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#footnote-reference-7">†</a><span class="fn-bracket">]</span></span>
@@ -49,7 +49,7 @@
<aside class="footnote superscript" id="footnote-5" role="doc-footnote">
<span class="label"><span class="fn-bracket">[</span>4<span class="fn-bracket">]</span></span>
<p>Here's an unreferenced footnote, with a reference to a
-nonexistent footnote:<a class="footnote-reference superscript" href="#footnote-6" id="footnote-reference-8" role="doc-noteref"><span class="fn-bracket">[</span>5<span class="fn-bracket">]</span></a>.</p>
+nonexistent footnote:<a class="superscript" href="#footnote-6" id="footnote-reference-8" role="doc-noteref"><span class="fn-bracket">[</span>5<span class="fn-bracket">]</span></a>.</p>
</aside>
</aside>
<section id="citations">
@@ -73,8 +73,8 @@
<p>this footnote is missing in the standard example document.</p>
</aside>
</aside>
-<p>Footnotes may contain block elements like lists<a class="footnote-reference superscript" href="#footnote-7" id="footnote-reference-9" role="doc-noteref"><span class="fn-bracket">[</span>6<span class="fn-bracket">]</span></a><a class="footnote-reference superscript" href="#list-note" id="footnote-reference-10" role="doc-noteref"><span class="fn-bracket">[</span>7<span class="fn-bracket">]</span></a><a class="footnote-reference superscript" href="#footnote-8" id="footnote-reference-11" role="doc-noteref"><span class="fn-bracket">[</span>8<span class="fn-bracket">]</span></a>,
-admonitions<a class="footnote-reference superscript" href="#footnote-9" id="footnote-reference-12" role="doc-noteref"><span class="fn-bracket">[</span>9<span class="fn-bracket">]</span></a>, or tables<a class="footnote-reference superscript" href="#footnote-10" id="footnote-reference-13" role="doc-noteref"><span class="fn-bracket">[</span>10<span class="fn-bracket">]</span></a>.</p>
+<p>Footnotes may contain block elements like lists<a class="superscript" href="#footnote-7" id="footnote-reference-9" role="doc-noteref"><span class="fn-bracket">[</span>6<span class="fn-bracket">]</span></a><a class="superscript" href="#list-note" id="footnote-reference-10" role="doc-noteref"><span class="fn-bracket">[</span>7<span class="fn-bracket">]</span></a><a class="superscript" href="#footnote-8" id="footnote-reference-11" role="doc-noteref"><span class="fn-bracket">[</span>8<span class="fn-bracket">]</span></a>,
+admonitions<a class="superscript" href="#footnote-9" id="footnote-reference-12" role="doc-noteref"><span class="fn-bracket">[</span>9<span class="fn-bracket">]</span></a>, or tables<a class="superscript" href="#footnote-10" id="footnote-reference-13" role="doc-noteref"><span class="fn-bracket">[</span>10<span class="fn-bracket">]</span></a>.</p>
<aside class="footnote-list superscript">
<aside class="footnote superscript" id="footnote-7" role="doc-footnote">
<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#footnote-reference-9">6</a><span class="fn-bracket">]</span></span>
@@ -124,7 +124,7 @@
</table>
</aside>
</aside>
-<p>This<a class="footnote-reference superscript" href="#list-note" id="footnote-reference-14" role="doc-noteref"><span class="fn-bracket">[</span>7<span class="fn-bracket">]</span></a> is a second reference to the footnote containing
+<p>This<a class="superscript" href="#list-note" id="footnote-reference-14" role="doc-noteref"><span class="fn-bracket">[</span>7<span class="fn-bracket">]</span></a> is a second reference to the footnote containing
a bullet. list.</p>
</section>
</main>
Modified: trunk/docutils/test/functional/expected/standalone_rst_html5.html
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_html5.html 2023-06-27 20:03:52 UTC (rev 9412)
+++ trunk/docutils/test/functional/expected/standalone_rst_html5.html 2023-06-27 20:04:02 UTC (rev 9413)
@@ -190,12 +190,12 @@
<h4><a class="toc-backref" href="#toc-entry-7" role="doc-backlink"><span class="sectnum">2.1.1 </span>Inline Markup</a></h4>
<p>Paragraphs contain text and may contain inline markup: <em>emphasis</em>,
<strong>strong emphasis</strong>, <span class="docutils literal">inline literals</span>, standalone hyperlinks
-(<a class="reference external" href="http://www.python.org">http://www.python.org</a>), external hyperlinks (<a class="reference external" href="http://www.python.org/">Python</a> <a class="footnote-reference brackets" href="#footnote-7" id="footnote-reference-18" role="doc-noteref"><span class="fn-bracket">[</span>7<span class="fn-bracket">]</span></a>), internal
+(<a class="reference external" href="http://www.python.org">http://www.python.org</a>), external hyperlinks (<a class="reference external" href="http://www.python.org/">Python</a> <a class="brackets" href="#footnote-7" id="footnote-reference-18" role="doc-noteref"><span class="fn-bracket">[</span>7<span class="fn-bracket">]</span></a>), internal
cross-references (<a class="reference internal" href="#example">example</a>), external hyperlinks with embedded URIs
(<a class="reference external" href="http://www.python.org">Python web site</a>), <a class="reference external" href="http://www.python.org/">anonymous hyperlink
-references</a> <a class="footnote-reference brackets" href="#footnote-7" id="footnote-reference-26" role="doc-noteref"><span class="fn-bracket">[</span>7<span class="fn-bracket">]</span></a> (<a class="reference external" href="https://docutils.sourceforge.io/">a second reference</a> <a class="footnote-reference brackets" href="#footnote-13" id="footnote-reference-27" role="doc-noteref"><span class="fn-bracket">[</span>13<span class="fn-bracket">]</span></a>), footnote references (manually
-numbered <a class="footnote-reference brackets" href="#footnote-1" id="footnote-reference-1" role="doc-noteref"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></a>, anonymous auto-numbered <a class="footnote-reference brackets" href="#footnote-2" id="footnote-reference-2" role="doc-noteref"><span class="fn-bracket">[</span>3<span class="fn-bracket">]</span></a>, labeled auto-numbered
-<a class="footnote-reference brackets" href="#label" id="footnote-reference-3" role="doc-noteref"><span class="fn-bracket">[</span>2<span class="fn-bracket">]</span></a>, or symbolic <a class="footnote-reference brackets" href="#footnote-3" id="footnote-reference-4" role="doc-noteref"><span class="fn-bracket">[</span>*<span class="fn-bracket">]</span></a>), citation references (see <a class="citation-reference" href="#cit2002" id="citation-reference-1" role="doc-biblioref">[CIT2002]</a>),
+references</a> <a class="brackets" href="#footnote-7" id="footnote-reference-26" role="doc-noteref"><span class="fn-bracket">[</span>7<span class="fn-bracket">]</span></a> (<a class="reference external" href="https://docutils.sourceforge.io/">a second reference</a> <a class="brackets" href="#footnote-13" id="footnote-reference-27" role="doc-noteref"><span class="fn-bracket">[</span>13<span class="fn-bracket">]</span></a>), footnote references (manually
+numbered <a class="brackets" href="#footnote-1" id="footnote-reference-1" role="doc-noteref"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></a>, anonymous auto-numbered <a class="brackets" href="#footnote-2" id="footnote-reference-2" role="doc-noteref"><span class="fn-bracket">[</span>3<span class="fn-bracket">]</span></a>, labeled auto-numbered
+<a class="brackets" href="#label" id="footnote-reference-3" role="doc-noteref"><span class="fn-bracket">[</span>2<span class="fn-bracket">]</span></a>, or symbolic <a class="brackets" href="#footnote-3" id="footnote-reference-4" role="doc-noteref"><span class="fn-bracket">[</span>*<span class="fn-bracket">]</span></a>), citation references (see <a class="citation-reference" href="#cit2002" id="citation-reference-1" role="doc-biblioref">[CIT2002]</a>),
substitution references (<img alt="EXAMPLE" src="../../../docs/user/rst/images/biohazard.png" /> &
a <em>trimmed heart</em> <span class="docutils literal">(U+2665):</span>♥), and <span class="target" id="inline-hyperlink-targets">inline hyperlink targets</span>
(see <a class="reference internal" href="#targets">Targets</a> below for a reference back to here). Character-level
@@ -482,10 +482,10 @@
<aside class="footnote brackets" id="label" role="doc-footnote">
<span class="label"><span class="fn-bracket">[</span>2<span class="fn-bracket">]</span></span>
<span class="backrefs">(<a role="doc-backlink" href="#footnote-reference-3">1</a>,<a role="doc-backlink" href="#footnote-reference-6">2</a>)</span>
-<p>Footnotes may be numbered, either manually (as in <a class="footnote-reference brackets" href="#footnote-1" id="footnote-reference-5" role="doc-noteref"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></a>) or
+<p>Footnotes may be numbered, either manually (as in <a class="brackets" href="#footnote-1" id="footnote-reference-5" role="doc-noteref"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></a>) or
automatically using a "#"-prefixed label. This footnote has a
label so it can be referred to from multiple places, both as a
-footnote reference (<a class="footnote-reference brackets" href="#label" id="footnote-reference-6" role="doc-noteref"><span class="fn-bracket">[</span>2<span class="fn-bracket">]</span></a>) and as a <a class="reference internal" href="#label">hyperlink reference</a>.</p>
+footnote reference (<a class="brackets" href="#label" id="footnote-reference-6" role="doc-noteref"><span class="fn-bracket">[</span>2<span class="fn-bracket">]</span></a>) and as a <a class="reference internal" href="#label">hyperlink reference</a>.</p>
</aside>
<aside class="footnote brackets" id="footnote-2" role="doc-footnote">
<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#footnote-reference-2">3</a><span class="fn-bracket">]</span></span>
@@ -497,7 +497,7 @@
<aside class="footnote brackets" id="footnote-3" role="doc-footnote">
<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#footnote-reference-4">*</a><span class="fn-bracket">]</span></span>
<p>Footnotes may also use symbols, specified with a "*" label.
-Here's a reference to the next footnote: <a class="footnote-reference brackets" href="#footnote-4" id="footnote-reference-7" role="doc-noteref"><span class="fn-bracket">[</span>†<span class="fn-bracket">]</span></a>.</p>
+Here's a reference to the next footnote: <a class="brackets" href="#footnote-4" id="footnote-reference-7" role="doc-noteref"><span class="fn-bracket">[</span>†<span class="fn-bracket">]</span></a>.</p>
</aside>
<aside class="footnote brackets" id="footnote-4" role="doc-footnote">
<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#footnote-reference-7">†</a><span class="fn-bracket">]</span></span>
@@ -531,7 +531,7 @@
<p>Section headers are implicit targets, referred to by name. See
<a class="reference internal" href="#targets">Targets</a>, which is a subsection of <a class="reference internal" href="#body-elements">Body Elements</a>.</p>
<p>Explicit external targets are interpolated into references such as
-"<a class="reference external" href="http://www.python.org/">Python</a> <a class="footnote-reference brackets" href="#footnote-7" id="footnote-reference-19" role="doc-noteref"><span class="fn-bracket">[</span>7<span class="fn-bracket">]</span></a>".</p>
+"<a class="reference external" href="http://www.python.org/">Python</a> <a class="brackets" href="#footnote-7" id="footnote-reference-19" role="doc-noteref"><span class="fn-bracket">[</span>7<span class="fn-bracket">]</span></a>".</p>
<p>Targets may be indirect and anonymous. Thus <a class="reference internal" href="#targets">this phrase</a> may also
refer to the <a class="reference internal" href="#targets">Targets</a> section.</p>
<p>Here's a <a href="#system-message-4"><span class="problematic" id="problematic-2">`hyperlink reference without a target`_</span></a>, which generates an
@@ -567,7 +567,7 @@
</ul>
</nav>
<p>These are just a sample of the many reStructuredText Directives. For
-others, please see <a class="reference external" href="https://docutils.sourceforge.io/docs/ref/rst/directives.html">reStructuredText Directives</a> <a class="footnote-reference brackets" href="#footnote-14" id="footnote-reference-28" role="doc-noteref"><span class="fn-bracket">[</span>14<span class="fn-bracket">]</span></a>.</p>
+others, please see <a class="reference external" href="https://docutils.sourceforge.io/docs/ref/rst/directives.html">reStructuredText Directives</a> <a class="brackets" href="#footnote-14" id="footnote-reference-28" role="doc-noteref"><span class="fn-bracket">[</span>14<span class="fn-bracket">]</span></a>.</p>
<section id="document-parts">
<h4><a class="toc-backref" href="#toc-entry-54" role="doc-backlink"><span class="sectnum">2.14.1 </span>Document Parts</a></h4>
<p>An example of the "contents" directive can be seen above this section
@@ -883,7 +883,7 @@
</section>
<section id="replacement-text">
<h4><a class="toc-backref" href="#toc-entry-60" role="doc-backlink"><span class="sectnum">2.14.7 </span>Replacement Text</a></h4>
-<p>I recommend you try <a class="reference external" href="http://www.python.org/">Python, <em>the</em> best language around</a> <a class="footnote-reference brackets" href="#footnote-7" id="footnote-reference-20" role="doc-noteref"><span class="fn-bracket">[</span>7<span class="fn-bracket">]</span></a>.</p>
+<p>I recommend you try <a class="reference external" href="http://www.python.org/">Python, <em>the</em> best language around</a> <a class="brackets" href="#footnote-7" id="footnote-reference-20" role="doc-noteref"><span class="fn-bracket">[</span>7<span class="fn-bracket">]</span></a>.</p>
</section>
<section id="compound-paragraph">
<h4><a class="toc-backref" href="#toc-entry-61" role="doc-backlink"><span class="sectnum">2.14.8 </span>Compound Paragraph</a></h4>
@@ -999,12 +999,12 @@
Inline markup is supported, e.g. <em>emphasis</em>, <strong>strong</strong>, <span class="docutils literal">literal
text</span>, <sub>sub-</sub> and <sup>super</sup>scripts,
inline formulas: <span class="formula"><i>A</i> = 2<i>π</i><i>r</i><sup>2</sup></span>,
-footnotes <a class="footnote-reference brackets" href="#footnote-1" id="footnote-reference-9" role="doc-noteref"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></a>, <span class="target" id="hyperlink-targets">hyperlink targets</span>, and <a class="reference external" href="http://www.python.org/">references</a>.</pre>
+footnotes <a class="brackets" href="#footnote-1" id="footnote-reference-9" role="doc-noteref"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></a>, <span class="target" id="hyperlink-targets">hyperlink targets</span>, and <a class="reference external" href="http://www.python.org/">references</a>.</pre>
</section>
<section id="code">
<h4><a class="toc-backref" href="#toc-entry-63" role="doc-backlink"><span class="sectnum">2.14.10 </span>Code</a></h4>
<p>Blocks of source code can be set with the <cite>code</cite> directive. If the code
-language is specified, the content is parsed and tagged by the <a class="reference external" href="http://pygments.org/">Pygments</a> <a class="footnote-reference brackets" href="#footnote-8" id="footnote-reference-21" role="doc-noteref"><span class="fn-bracket">[</span>8<span class="fn-bracket">]</span></a>
+language is specified, the content is parsed and tagged by the <a class="reference external" href="http://pygments.org/">Pygments</a> <a class="brackets" href="#footnote-8" id="footnote-reference-21" role="doc-noteref"><span class="fn-bracket">[</span>8<span class="fn-bracket">]</span></a>
syntax highlighter and can be formatted with a style sheet. (Code parsing
is turned off using the <span class="docutils literal"><span class="pre">syntax-highlight</span></span> config setting in the test
conversions in order to get identical results with/without installed
@@ -1028,7 +1028,7 @@
</section>
<section id="meta">
<h4><a class="toc-backref" href="#toc-entry-64" role="doc-backlink"><span class="sectnum">2.14.11 </span>Meta</a></h4>
-<p>The <a class="reference external" href="https://docutils.sourceforge.io/docs/ref/rst/directives.html#metadata">“meta” directive</a> <a class="footnote-reference brackets" href="#footnote-15" id="footnote-reference-29" role="doc-noteref"><span class="fn-bracket">[</span>15<span class="fn-bracket">]</span></a> is used to specify metadata to be stored in,
+<p>The <a class="reference external" href="https://docutils.sourceforge.io/docs/ref/rst/directives.html#metadata">“meta” directive</a> <a class="brackets" href="#footnote-15" id="footnote-reference-29" role="doc-noteref"><span class="fn-bracket">[</span>15<span class="fn-bracket">]</span></a> is used to specify metadata to be stored in,
e.g., HTML META tags or ODT file properties.</p>
</section>
</section>
@@ -1250,7 +1250,7 @@
<li><p>Use only <a class="reference internal" href="#meta">meta</a> keywords recognized by HTML 5.
Add HTML5-compatible meta tags for docinfo items
"authors", "date", and "copyright".</p>
-<p>Add a <a class="reference external" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Viewport_meta_tag">viewport meta tag</a> <a class="footnote-reference brackets" href="#footnote-16" id="footnote-reference-30" role="doc-noteref"><span class="fn-bracket">[</span>16<span class="fn-bracket">]</span></a> to tell mobile browsers
+<p>Add a <a class="reference external" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Viewport_meta_tag">viewport meta tag</a> <a class="brackets" href="#footnote-16" id="footnote-reference-30" role="doc-noteref"><span class="fn-bracket">[</span>16<span class="fn-bracket">]</span></a> to tell mobile browsers
to use the device-width as viewport.</p>
</li>
<li><p>Set table column widths with <style="width: ...">, not "width" argument.</p></li>
@@ -1262,7 +1262,7 @@
<footer>, <aside>, <figure>, and <figcaption>.
See <span class="docutils literal">minimal.css</span> and <span class="docutils literal">responsive.css</span> for styling rule examples.</p>
<p>Change the <cite>initial_header_level</cite> setting default to "2", as browsers
-use the <a class="reference external" href="https://stackoverflow.com/questions/39547412/same-font-size-for-h1-and-h2-in-article">same style for <h1> and <h2> when nested in a <section></a> <a class="footnote-reference brackets" href="#footnote-17" id="footnote-reference-31" role="doc-noteref"><span class="fn-bracket">[</span>17<span class="fn-bracket">]</span></a>.</p>
+use the <a class="reference external" href="https://stackoverflow.com/questions/39547412/same-font-size-for-h1-and-h2-in-article">same style for <h1> and <h2> when nested in a <section></a> <a class="brackets" href="#footnote-17" id="footnote-reference-31" role="doc-noteref"><span class="fn-bracket">[</span>17<span class="fn-bracket">]</span></a>.</p>
</li>
<li><p>Use HTML5 tags <small>, <s>, <q>, <dfn>, <var>, <samp>, <kbd>,
<i>, <b>, <u>, <mark>, and <bdi> if a matching class value
@@ -1341,7 +1341,7 @@
<section id="details-disclosure-elements">
<h4><a class="toc-backref" href="#toc-entry-47" role="doc-backlink"><span class="sectnum">3.2.2 </span>Details disclosure elements</a></h4>
<p>Items of <a class="reference internal" href="#definition-lists">definition lists</a> with class argument "details" are converted
-to <a class="reference external" href="https://www.w3.org/TR/html52/interactive-elements.html#the-details-element">details</a> <a class="footnote-reference brackets" href="#footnote-9" id="footnote-reference-22" role="doc-noteref"><span class="fn-bracket">[</span>9<span class="fn-bracket">]</span></a> disclosure elements with the term becoming the "summary".</p>
+to <a class="reference external" href="https://www.w3.org/TR/html52/interactive-elements.html#the-details-element">details</a> <a class="brackets" href="#footnote-9" id="footnote-reference-22" role="doc-noteref"><span class="fn-bracket">[</span>9<span class="fn-bracket">]</span></a> disclosure elements with the term becoming the "summary".</p>
<div class="details" id="closed-details">
<details>
<summary>A summary</summary>
@@ -1440,7 +1440,7 @@
<section id="table-variants">
<h4><a class="toc-backref" href="#toc-entry-49" role="doc-backlink"><span class="sectnum">3.2.4 </span>Table Variants</a></h4>
<p>The following styles can be applied to individual tables via a class
-argument or as document wide setting with the <a class="reference external" href="https://docutils.sourceforge.io/docs/user/config.html#table-style">table-style</a> <a class="footnote-reference brackets" href="#footnote-10" id="footnote-reference-23" role="doc-noteref"><span class="fn-bracket">[</span>10<span class="fn-bracket">]</span></a> configuration
+argument or as document wide setting with the <a class="reference external" href="htt...
[truncated message content] |
|
From: <mi...@us...> - 2023-06-27 20:04:18
|
Revision: 9414
http://sourceforge.net/p/docutils/code/9414
Author: milde
Date: 2023-06-27 20:04:16 +0000 (Tue, 27 Jun 2023)
Log Message:
-----------
Use the same format for :header: option and main data in "csv-table" directive.
The separate HeaderDialect was introduced 2004-06-17 (in the sandbox)
for unknown reasons while the documentation always said
"Must use the same CSV format as the main CSV data."
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/RELEASE-NOTES.txt
trunk/docutils/docs/ref/rst/directives.txt
trunk/docutils/docutils/parsers/rst/directives/tables.py
trunk/docutils/test/test_parsers/test_rst/test_directives/test_tables.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2023-06-27 20:04:02 UTC (rev 9413)
+++ trunk/docutils/HISTORY.txt 2023-06-27 20:04:16 UTC (rev 9414)
@@ -33,6 +33,14 @@
.. _UTF-8 mode: https://docs.python.org/3/library/os.html#utf8-mode
.. _input encoding: docs/api/publisher.html#encodings
+* docutils/parsers/rst/directives/tables.py
+
+ - Use the same CSV format for the ``:header:`` option and the main data
+ of the "csv-table" directive.
+
+ - Move `parsers.rst.directives.Table.process_header_option()` to
+ `parsers.rst.directives.CSVTable`.
+
* docutils/utils/roman.py
- Update to version `1.4 <https://pypi.org/project/roman/4.1/>`__.
@@ -45,6 +53,7 @@
* docutils/writers/s5_html/__init__.py
- Warn if the S5 writer cannot copy the theme files.
+
- Programmatic customization of "theme_url__" setting no longer
overridden by the default for "theme__".
Modified: trunk/docutils/RELEASE-NOTES.txt
===================================================================
--- trunk/docutils/RELEASE-NOTES.txt 2023-06-27 20:04:02 UTC (rev 9413)
+++ trunk/docutils/RELEASE-NOTES.txt 2023-06-27 20:04:16 UTC (rev 9414)
@@ -108,18 +108,9 @@
Misc
----
-* "csv-table_" directive:
+* Remove `parsers.rst.directives.CSVTable.HeaderDialect`
+ in Docutils 0.22.
- - Use the same CSV format for the main CSV data and the :header: option
- (as specified in the documentation since addition of "csv-table_")
- in Docutils 0.21.
-
- - Move `parsers.rst.directives.Table.process_header_option()` to
- `parsers.rst.directives.CSVTable` in Docutils 0.21.
-
- - Remove `parsers.rst.directives.CSVTable.HeaderDialect`
- in Docutils 0.22.
-
* Remove the compatibility hacks `nodes.reprunicode` and `nodes.ensure_str()`
in Docutils 0.21 or later. They are not required with Python 3.x.
@@ -208,12 +199,14 @@
.. _input encoding: docs/api/publisher.html#encodings
* "html5" writer:
-
Stop setting the "footnote-reference" class value for footnote references.
- Use the CSS selector ``[role="doc-noteref"]`` instead of
- ``.footnote-reference`` (see minimal.css for examples).
+ You can use the CSS selector ``[role="doc-noteref"]``
+ since Docutils 0.18 (see minimal.css for examples).
+* Use the same CSV format for the ``:header:`` option and the main data
+ of the "csv-table_" directive.
+
Release 0.20.1 (2023-05-17)
===========================
Modified: trunk/docutils/docs/ref/rst/directives.txt
===================================================================
--- trunk/docutils/docs/ref/rst/directives.txt 2023-06-27 20:04:02 UTC (rev 9413)
+++ trunk/docutils/docs/ref/rst/directives.txt 2023-06-27 20:04:16 UTC (rev 9414)
@@ -884,7 +884,7 @@
The character used to separate data fields.
The special values "tab" and "space" are converted to the respective
whitespace characters. [#tab-expansion]_
- Defaults to ``,`` (comma).
+ Defaults to "``,``" (comma).
``encoding`` : encoding_
The text encoding of the external CSV data (file or URL).
@@ -909,13 +909,8 @@
``header`` : text_ (CSV data)
Supplemental data for the table header, added independently of and
before any ``header-rows`` from the main CSV data. Must use the
- same CSV format as the main CSV data.
+ same CSV format as the main CSV data. [#]_
- .. Important:: Currently, the header option uses a hard-coded CSV
- dialect with the backslash as escape character (interfering with
- the reStructuredText `escaping mechanism`_). This will change to
- the documented behaviour in Docutils 0.21.
-
``header-rows`` : integer_
The number of rows of CSV data to use in the table header.
Defaults to 0.
@@ -962,6 +957,9 @@
external files because hard tabs the directive content are
`converted to spaces`__ before it reaches the CVS reader.
+.. [#] Before Docutils 0.21, the header option used a hard-coded
+ CSV dialect with the backslash as escape character.
+
__ restructuredtext.html#whitespace
Modified: trunk/docutils/docutils/parsers/rst/directives/tables.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/directives/tables.py 2023-06-27 20:04:02 UTC (rev 9413)
+++ trunk/docutils/docutils/parsers/rst/directives/tables.py 2023-06-27 20:04:16 UTC (rev 9414)
@@ -54,25 +54,6 @@
messages = []
return title, messages
- def process_header_option(self):
- # Provisional
- # * Will move to CSVTable in Docutils 0.21
- # as it calls `self.HeaderDialect()` only defined in CSVTable.
- # * Will change to use the same CSV dialect as the body to get in line
- # with the specification in ref/rst/directives.txt in Docutils 0.21.
- source = self.state_machine.get_source(self.lineno - 1)
- table_head = []
- max_header_cols = 0
- if 'header' in self.options: # separate table header in option
- with warnings.catch_warnings():
- warnings.simplefilter('ignore')
- header_dialect = self.HeaderDialect()
- rows, max_header_cols = self.parse_csv_data_into_rows(
- self.options['header'].split('\n'), header_dialect,
- source)
- table_head.extend(rows)
- return table_head, max_header_cols
-
def check_table_dimensions(self, rows, header_rows, stub_columns):
if len(rows) < header_rows:
error = self.reporter.error('%s header row(s) specified but '
@@ -248,7 +229,7 @@
# did not mention a rationale (part of the discussion was in private
# mail).
# This is in conflict with the documentation, which always said:
- # ""
+ # "Must use the same CSV format as the main CSV data."
# and did not change in this aspect.
#
# Maybe it was intended to have similar escape rules for rST and CSV,
@@ -278,6 +259,18 @@
' and will be removed in Docutils 0.22.',
DeprecationWarning, stacklevel=2)
+ def process_header_option(self):
+ source = self.state_machine.get_source(self.lineno - 1)
+ table_head = []
+ max_header_cols = 0
+ if 'header' in self.options: # separate table header in option
+ rows, max_header_cols = self.parse_csv_data_into_rows(
+ self.options['header'].split('\n'),
+ self.DocutilsDialect(self.options),
+ source)
+ table_head.extend(rows)
+ return table_head, max_header_cols
+
def run(self):
try:
if (not self.state.document.settings.file_insertion_enabled
Modified: trunk/docutils/test/test_parsers/test_rst/test_directives/test_tables.py
===================================================================
--- trunk/docutils/test/test_parsers/test_rst/test_directives/test_tables.py 2023-06-27 20:04:02 UTC (rev 9413)
+++ trunk/docutils/test/test_parsers/test_rst/test_directives/test_tables.py 2023-06-27 20:04:16 UTC (rev 9414)
@@ -29,6 +29,9 @@
class ParserTestCase(unittest.TestCase):
+
+ maxDiff = None
+
def test_parser(self):
parser = Parser()
settings = get_default_settings(Parser)
@@ -40,7 +43,7 @@
document = new_document('test data', settings.copy())
parser.parse(case_input, document)
output = document.pformat()
- self.assertEqual(output, case_expected)
+ self.assertEqual(case_expected, output)
mydir = os.path.join(TEST_ROOT, 'test_parsers/test_rst/test_directives')
@@ -555,10 +558,11 @@
"""],
["""\
.. csv-table:: inline with separate header
- :header: "Treat", Quantity, "Description"
+ :delim: space
+ :header: "Treat" Quantity "Description"
:widths: 10,20,30
- "Albatross", 2.99, "On a stick!"
+ "Albatross" 2.99 "On a stick!"
""",
"""\
<document source="test data">
@@ -1094,7 +1098,7 @@
["""\
.. csv-table:: bad CSV data
- "bad", \"csv, data
+ "bad", "csv, data
""",
"""\
<document source="test data">
@@ -1109,7 +1113,7 @@
""" % csv_eod_error_str],
["""\
.. csv-table:: bad CSV header data
- :header: "bad", \"csv, data
+ :header: "bad", "csv, data
good, csv, data
""",
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2023-06-27 20:04:28
|
Revision: 9415
http://sourceforge.net/p/docutils/code/9415
Author: milde
Date: 2023-06-27 20:04:25 +0000 (Tue, 27 Jun 2023)
Log Message:
-----------
Remove compatibility hacks `nodes.reprunicode` and `nodes.ensure_str()`.
They are not required with Python 3.x.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/RELEASE-NOTES.txt
trunk/docutils/docutils/nodes.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2023-06-27 20:04:16 UTC (rev 9414)
+++ trunk/docutils/HISTORY.txt 2023-06-27 20:04:25 UTC (rev 9415)
@@ -33,6 +33,10 @@
.. _UTF-8 mode: https://docs.python.org/3/library/os.html#utf8-mode
.. _input encoding: docs/api/publisher.html#encodings
+* docutils/nodes.py
+
+ - Remove compatibility hacks `nodes.reprunicode` and `nodes.ensure_str()`.
+
* docutils/parsers/rst/directives/tables.py
- Use the same CSV format for the ``:header:`` option and the main data
Modified: trunk/docutils/RELEASE-NOTES.txt
===================================================================
--- trunk/docutils/RELEASE-NOTES.txt 2023-06-27 20:04:16 UTC (rev 9414)
+++ trunk/docutils/RELEASE-NOTES.txt 2023-06-27 20:04:25 UTC (rev 9415)
@@ -111,9 +111,6 @@
* Remove `parsers.rst.directives.CSVTable.HeaderDialect`
in Docutils 0.22.
-* Remove the compatibility hacks `nodes.reprunicode` and `nodes.ensure_str()`
- in Docutils 0.21 or later. They are not required with Python 3.x.
-
* Remove file ``install.py`` in Docutils 0.21.
See README.txt__ for alternatives.
@@ -206,7 +203,9 @@
* Use the same CSV format for the ``:header:`` option and the main data
of the "csv-table_" directive.
+* Remove the compatibility hacks `nodes.reprunicode` and `nodes.ensure_str()`.
+
Release 0.20.1 (2023-05-17)
===========================
Modified: trunk/docutils/docutils/nodes.py
===================================================================
--- trunk/docutils/docutils/nodes.py 2023-06-27 20:04:16 UTC (rev 9414)
+++ trunk/docutils/docutils/nodes.py 2023-06-27 20:04:25 UTC (rev 9415)
@@ -326,27 +326,6 @@
return None
-class reprunicode(str):
- """
- Deprecated backwards compatibility stub. Use the standard `str` instead.
- """
- def __init__(self, s):
- warnings.warn('nodes.reprunicode() is not required with Python 3'
- ' and will be removed in Docutils 0.21 or later.',
- DeprecationWarning, stacklevel=2)
- super().__init__()
-
-
-def ensure_str(s):
- """
- Deprecated backwards compatibility stub returning `s`.
- """
- warnings.warn('nodes.ensure_str() is not required with Python 3'
- ' and will be removed in Docutils 0.21 or later.',
- DeprecationWarning, stacklevel=2)
- return s
-
-
# definition moved here from `utils` to avoid circular import dependency
def unescape(text, restore_backslashes=False, respect_whitespace=False):
"""
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2023-06-27 20:04:36
|
Revision: 9416
http://sourceforge.net/p/docutils/code/9416
Author: milde
Date: 2023-06-27 20:04:33 +0000 (Tue, 27 Jun 2023)
Log Message:
-----------
Remove file ``install.py``.
Modified Paths:
--------------
trunk/docutils/MANIFEST.in
trunk/docutils/README.txt
trunk/docutils/RELEASE-NOTES.txt
Removed Paths:
-------------
trunk/docutils/install.py
Modified: trunk/docutils/MANIFEST.in
===================================================================
--- trunk/docutils/MANIFEST.in 2023-06-27 20:04:25 UTC (rev 9415)
+++ trunk/docutils/MANIFEST.in 2023-06-27 20:04:33 UTC (rev 9416)
@@ -1,7 +1,6 @@
include *.txt
include tox.ini
include docutils.conf
-include install.py
recursive-include docutils *
recursive-include docs *
recursive-include licenses *
Modified: trunk/docutils/README.txt
===================================================================
--- trunk/docutils/README.txt 2023-06-27 20:04:25 UTC (rev 9415)
+++ trunk/docutils/README.txt 2023-06-27 20:04:33 UTC (rev 9416)
@@ -245,9 +245,6 @@
* setup.py: Installation script. See "Installation" below.
-* install.py: Quick & dirty installation script. Just run it. For
- any kind of customization or help though, setup.py must be used.
-
* docutils: The project source directory, installed as a Python
package.
Modified: trunk/docutils/RELEASE-NOTES.txt
===================================================================
--- trunk/docutils/RELEASE-NOTES.txt 2023-06-27 20:04:25 UTC (rev 9415)
+++ trunk/docutils/RELEASE-NOTES.txt 2023-06-27 20:04:33 UTC (rev 9416)
@@ -111,11 +111,6 @@
* Remove `parsers.rst.directives.CSVTable.HeaderDialect`
in Docutils 0.22.
-* Remove file ``install.py`` in Docutils 0.21.
- See README.txt__ for alternatives.
-
- __ README.html#installation
-
* Remove the "rawsource" argument from `nodes.Text.__init__()`
in Docutils 2.0.
@@ -160,7 +155,6 @@
.. _literal_block_env: docs/user/config.html#literal-block-env
.. _use_latex_citations: docs/user/config.html#use-latex-citations
.. _buildhtml.py: docs/user/tools.html#buildhtml-py
-.. _csv-table: docs/ref/rst/directives.html#csv-table
Release 0.21 (unpublished)
@@ -205,7 +199,12 @@
* Remove the compatibility hacks `nodes.reprunicode` and `nodes.ensure_str()`.
+* Remove file ``install.py``. See README.txt__ for alternatives.
+.. _csv-table: docs/ref/rst/directives.html#csv-table
+__ README.html#installation
+
+
Release 0.20.1 (2023-05-17)
===========================
Deleted: trunk/docutils/install.py
===================================================================
--- trunk/docutils/install.py 2023-06-27 20:04:25 UTC (rev 9415)
+++ trunk/docutils/install.py 2023-06-27 20:04:33 UTC (rev 9416)
@@ -1,27 +0,0 @@
-#!/usr/bin/env python3
-# $Id$
-# Copyright: This file has been placed in the public domain.
-
-"""
-This is a quick & dirty installation shortcut. It is equivalent to the
-command::
-
- python setup.py install
-
-However, the shortcut lacks error checking and command-line option
-processing. If you need any kind of customization or help, please use
-one of::
-
- python setup.py install --help
- python setup.py --help
-"""
-
-from distutils import core
-from setup import do_setup
-
-if __name__ == '__main__':
- print(__doc__)
- core._setup_stop_after = 'config'
- dist = do_setup()
- dist.commands = ['install']
- dist.run_commands()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2023-06-27 20:04:57
|
Revision: 9417
http://sourceforge.net/p/docutils/code/9417
Author: milde
Date: 2023-06-27 20:04:54 +0000 (Tue, 27 Jun 2023)
Log Message:
-----------
Mark/Fix mistranslated localizations of the "admonition" directive name.
In Docutils, "admonition" is used as a generic term for
"advice"/"advisory"/"remark", not a reprimand.
Misleading translations will be removed later.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/RELEASE-NOTES.txt
trunk/docutils/docutils/parsers/rst/languages/af.py
trunk/docutils/docutils/parsers/rst/languages/da.py
trunk/docutils/docutils/parsers/rst/languages/de.py
trunk/docutils/docutils/parsers/rst/languages/en.py
trunk/docutils/docutils/parsers/rst/languages/eo.py
trunk/docutils/docutils/parsers/rst/languages/es.py
trunk/docutils/docutils/parsers/rst/languages/fi.py
trunk/docutils/docutils/parsers/rst/languages/fr.py
trunk/docutils/docutils/parsers/rst/languages/gl.py
trunk/docutils/docutils/parsers/rst/languages/it.py
trunk/docutils/docutils/parsers/rst/languages/nl.py
trunk/docutils/docutils/parsers/rst/languages/pl.py
trunk/docutils/docutils/parsers/rst/languages/pt_br.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2023-06-27 20:04:33 UTC (rev 9416)
+++ trunk/docutils/HISTORY.txt 2023-06-27 20:04:54 UTC (rev 9417)
@@ -45,6 +45,12 @@
- Move `parsers.rst.directives.Table.process_header_option()` to
`parsers.rst.directives.CSVTable`.
+* docutils/parsers/rst/languages/
+
+ Mark/Fix mistranslated localizations of the "admonition" directive name.
+ In Docutils, "admonition" is used as a generic term for
+ "advice"/"advisory"/"remark", not a reprimand.
+
* docutils/utils/roman.py
- Update to version `1.4 <https://pypi.org/project/roman/4.1/>`__.
Modified: trunk/docutils/RELEASE-NOTES.txt
===================================================================
--- trunk/docutils/RELEASE-NOTES.txt 2023-06-27 20:04:33 UTC (rev 9416)
+++ trunk/docutils/RELEASE-NOTES.txt 2023-06-27 20:04:54 UTC (rev 9417)
@@ -131,14 +131,14 @@
__ docs/ref/transforms.html
-* docutils/parsers/rst/languages/
+* Remove mistranslated localizations of the "admonition" directive name in
+ Docutils 0.22 or later.
- Fix mistranslated localizations of the "admonition" directive name in
- Docutils 0.21 (or later). In Docutils, "admonition" is used as a
- generic term for "advice"/"caveat"/"remark", not a reprimand.
- Use the English term (or specific admonitions) instead of "aanmaning",
- "ammonizione", "Ermahnung", "exhortacion", "formaning", "upomnienie",
- or "vermaning" to avoid errors in future conversions.
+ Use the English term (or specific admonitions) instead of
+ "aanmaning" (nl), "admonition" (fr), "ammonizione" (it),
+ "ermahnung" (de), "exhortación" (es), "formaning" (da), "sciigo" (eo),
+ "upomnienie" (pl), "vermaning" (af), to avoid errors in future
+ conversions.
.. _front end tools: docs/user/tools.html
.. _input_encoding: docs/user/config.html#input-encoding
Modified: trunk/docutils/docutils/parsers/rst/languages/af.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/languages/af.py 2023-06-27 20:04:33 UTC (rev 9416)
+++ trunk/docutils/docutils/parsers/rst/languages/af.py 2023-06-27 20:04:54 UTC (rev 9417)
@@ -26,7 +26,8 @@
'nota': 'note',
'tip': 'tip', # hint and tip both have the same translation: wenk
'waarskuwing': 'warning',
- 'vermaning': 'admonition', # sic! Not used in this sense in rST.
+ 'advies': 'admonition',
+ 'vermaning': 'admonition', # sic! kept for backwards compatibiltity
'kantstreep': 'sidebar',
'onderwerp': 'topic',
'lynblok': 'line-block',
Modified: trunk/docutils/docutils/parsers/rst/languages/da.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/languages/da.py 2023-06-27 20:04:33 UTC (rev 9416)
+++ trunk/docutils/docutils/parsers/rst/languages/da.py 2023-06-27 20:04:54 UTC (rev 9417)
@@ -29,7 +29,8 @@
'bemærk': 'note',
'tips': 'tip',
'advarsel': 'warning',
- 'formaning': 'admonition', # sic! Not used in this sense in rST.
+ 'varsel': 'admonition',
+ 'formaning': 'admonition', # sic! kept for backwards compatibiltity
'sidebjælke': 'sidebar',
'emne': 'topic',
'linje-blok': 'line-block',
Modified: trunk/docutils/docutils/parsers/rst/languages/de.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/languages/de.py 2023-06-27 20:04:33 UTC (rev 9416)
+++ trunk/docutils/docutils/parsers/rst/languages/de.py 2023-06-27 20:04:54 UTC (rev 9417)
@@ -27,8 +27,8 @@
'notiz': 'note',
'tipp': 'tip',
'warnung': 'warning',
- 'ermahnung': 'admonition', # sic! Not used in this sense in rST.
- # TODO: Rat(schlag), Empfehlung, Warnhinweis, ...?
+ 'warnhinweis': 'admonition',
+ 'ermahnung': 'admonition', # sic! kept for backwards compatibiltity
'kasten': 'sidebar',
'seitenkasten': 'sidebar', # kept for backwards compatibiltity
'seitenleiste': 'sidebar',
Modified: trunk/docutils/docutils/parsers/rst/languages/en.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/languages/en.py 2023-06-27 20:04:33 UTC (rev 9416)
+++ trunk/docutils/docutils/parsers/rst/languages/en.py 2023-06-27 20:04:54 UTC (rev 9417)
@@ -26,7 +26,7 @@
'note': 'note',
'tip': 'tip',
'warning': 'warning',
- 'admonition': 'admonition', # advice/caveat/remark, not reprimand
+ 'admonition': 'admonition', # advice/advisory/remark, not reprimand
'sidebar': 'sidebar',
'topic': 'topic',
'line-block': 'line-block',
Modified: trunk/docutils/docutils/parsers/rst/languages/eo.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/languages/eo.py 2023-06-27 20:04:33 UTC (rev 9416)
+++ trunk/docutils/docutils/parsers/rst/languages/eo.py 2023-06-27 20:04:54 UTC (rev 9417)
@@ -28,7 +28,8 @@
'noto': 'note',
'helpeto': 'tip',
'averto': 'warning',
- 'admono': 'admonition',
+ 'sciigo': 'admonition',
+ 'admono': 'admonition', # sic! kept for backwards compatibiltity
'flankteksto': 'sidebar',
'temo': 'topic',
'linea-bloko': 'line-block',
Modified: trunk/docutils/docutils/parsers/rst/languages/es.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/languages/es.py 2023-06-27 20:04:33 UTC (rev 9416)
+++ trunk/docutils/docutils/parsers/rst/languages/es.py 2023-06-27 20:04:54 UTC (rev 9417)
@@ -27,8 +27,9 @@
'nota': 'note',
'consejo': 'tip',
'advertencia': 'warning',
- 'exhortacion': 'admonition', # sic! Not used in this sense in rST.
- 'exhortaci\u00f3n': 'admonition',
+ 'aviso': 'admonition',
+ 'exhortacion': 'admonition', # sic! kept for backwards compatibiltity
+ 'exhortación': 'admonition', # sic! kept for backwards compatibiltity
'nota-al-margen': 'sidebar',
'tema': 'topic',
'bloque-de-lineas': 'line-block',
Modified: trunk/docutils/docutils/parsers/rst/languages/fi.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/languages/fi.py 2023-06-27 20:04:33 UTC (rev 9416)
+++ trunk/docutils/docutils/parsers/rst/languages/fi.py 2023-06-27 20:04:54 UTC (rev 9417)
@@ -27,7 +27,7 @@
'huomautus': 'note',
'neuvo': 'tip',
'varoitus': 'warning',
- 'kehotus': 'admonition',
+ 'kehotus': 'admonition', # sic! advice/advisory/remark, not reprimand
'sivupalkki': 'sidebar',
'aihe': 'topic',
'rivi': 'line-block',
Modified: trunk/docutils/docutils/parsers/rst/languages/fr.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/languages/fr.py 2023-06-27 20:04:33 UTC (rev 9416)
+++ trunk/docutils/docutils/parsers/rst/languages/fr.py 2023-06-27 20:04:54 UTC (rev 9417)
@@ -25,7 +25,8 @@
'note': 'note',
'astuce': 'tip',
'avertissement': 'warning',
- 'admonition': 'admonition', # sic! Not used in this sense in rST.
+ 'annonce': 'admonition',
+ 'admonition': 'admonition', # sic! kept for backwards compatibiltity
# suggestions: annonce, avis, indication, remarque, renseignement
# see also https://sourceforge.net/p/docutils/bugs/453/
'encadré': 'sidebar',
Modified: trunk/docutils/docutils/parsers/rst/languages/gl.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/languages/gl.py 2023-06-27 20:04:33 UTC (rev 9416)
+++ trunk/docutils/docutils/parsers/rst/languages/gl.py 2023-06-27 20:04:54 UTC (rev 9417)
@@ -19,7 +19,7 @@
directives = {
# language-dependent: fixed
- 'atenci\u00f3n': 'attention',
+ 'atención': 'attention',
'advertencia': 'caution',
'code (translation required)': 'code',
'perigo': 'danger',
@@ -29,46 +29,41 @@
'nota': 'note',
'consello': 'tip',
'aviso': 'warning',
- 'admonici\u00f3n': 'admonition',
+ 'admonición': 'admonition', # sic! advice/advisory/remark, not reprimand
'barra lateral': 'sidebar',
- 't\u00f3pico': 'topic',
- 'bloque-li\u00f1a': 'line-block',
+ 'tópico': 'topic',
+ 'bloque-liña': 'line-block',
'literal-analizado': 'parsed-literal',
- 'r\u00fabrica': 'rubric',
- 'ep\u00edgrafe': 'epigraph',
+ 'rúbrica': 'rubric',
+ 'epígrafe': 'epigraph',
'realzados': 'highlights',
- 'coller-citaci\u00f3n': 'pull-quote',
+ 'coller-citación': 'pull-quote',
'compor': 'compound',
'recipiente': 'container',
- # 'questions': 'questions',
- 't\u00e1boa': 'table',
- 't\u00e1boa-csv': 'csv-table',
- 't\u00e1boa-listaxe': 'list-table',
- # 'qa': 'questions',
- # 'faq': 'questions',
+ 'táboa': 'table',
+ 'táboa-csv': 'csv-table',
+ 'táboa-listaxe': 'list-table',
'meta': 'meta',
'math (translation required)': 'math',
- # 'imagemap': 'imagemap',
'imaxe': 'image',
'figura': 'figure',
- 'inclu\u00edr': 'include',
+ 'incluír': 'include',
'cru': 'raw',
- 'substitu\u00edr': 'replace',
+ 'substituír': 'replace',
'unicode': 'unicode',
'data': 'date',
'clase': 'class',
'regra': 'role',
'regra-predeterminada': 'default-role',
- 't\u00edtulo': 'title',
+ 'título': 'title',
'contido': 'contents',
'seccnum': 'sectnum',
- 'secci\u00f3n-numerar': 'sectnum',
+ 'sección-numerar': 'sectnum',
'cabeceira': 'header',
- 'p\u00e9 de p\u00e1xina': 'footer',
- # 'footnotes': 'footnotes',
- # 'citations': 'citations',
+ 'pé de páxina': 'footer',
'notas-destino': 'target-notes',
- 'texto restruturado-proba-directiva': 'restructuredtext-test-directive'}
+ 'texto restruturado-proba-directiva': 'restructuredtext-test-directive',
+ }
"""Galician name to registered (in directives/__init__.py) directive name
mapping."""
Modified: trunk/docutils/docutils/parsers/rst/languages/it.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/languages/it.py 2023-06-27 20:04:33 UTC (rev 9416)
+++ trunk/docutils/docutils/parsers/rst/languages/it.py 2023-06-27 20:04:54 UTC (rev 9417)
@@ -27,7 +27,8 @@
'nota': 'note',
'consiglio': 'tip',
'avvertenza': 'warning',
- 'ammonizione': 'admonition', # sic! Not used in this sense in rST.
+ 'avviso': 'admonition',
+ 'ammonizione': 'admonition', # sic! kept for backards compatibility
'riquadro': 'sidebar',
'argomento': 'topic',
'blocco-di-righe': 'line-block',
Modified: trunk/docutils/docutils/parsers/rst/languages/nl.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/languages/nl.py 2023-06-27 20:04:33 UTC (rev 9416)
+++ trunk/docutils/docutils/parsers/rst/languages/nl.py 2023-06-27 20:04:54 UTC (rev 9417)
@@ -27,7 +27,8 @@
'opmerking': 'note',
'tip': 'tip',
'waarschuwing': 'warning',
- 'aanmaning': 'admonition', # sic! Not used in this sense in rST.
+ 'advies': 'admonition',
+ 'aanmaning': 'admonition', # sic! kept for backwards compatibiltity
'katern': 'sidebar',
'onderwerp': 'topic',
'lijn-blok': 'line-block',
Modified: trunk/docutils/docutils/parsers/rst/languages/pl.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/languages/pl.py 2023-06-27 20:04:33 UTC (rev 9416)
+++ trunk/docutils/docutils/parsers/rst/languages/pl.py 2023-06-27 20:04:54 UTC (rev 9417)
@@ -27,8 +27,8 @@
'przypis': 'note',
'rada': 'tip',
'ostrze\u017cenie': 'warning',
- 'upomnienie': 'admonition', # sic! Not used in this sense in rST.
- # 'zauważenie': 'admonition', # remark
+ 'zauważenie': 'admonition', # remark
+ 'upomnienie': 'admonition', # sic! kept for backwards compatibiltity
'ramka': 'sidebar',
'temat': 'topic',
'blok-linii': 'line-block',
Modified: trunk/docutils/docutils/parsers/rst/languages/pt_br.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/languages/pt_br.py 2023-06-27 20:04:33 UTC (rev 9416)
+++ trunk/docutils/docutils/parsers/rst/languages/pt_br.py 2023-06-27 20:04:54 UTC (rev 9417)
@@ -17,25 +17,26 @@
directives = {
# language-dependent: fixed
- 'aten\u00E7\u00E3o': 'attention',
+ 'atenção': 'attention',
'cuidado': 'caution',
'code (translation required)': 'code',
'perigo': 'danger',
'erro': 'error',
- 'sugest\u00E3o': 'hint',
+ 'sugestão': 'hint',
'importante': 'important',
'nota': 'note',
'dica': 'tip',
'aviso': 'warning',
- 'exorta\u00E7\u00E3o': 'admonition',
+ 'advertência': 'admonition',
+ 'exortação': 'admonition', # sic! advice/advisory/remark, not reprimand
'barra-lateral': 'sidebar',
- 't\u00F3pico': 'topic',
+ 'tópico': 'topic',
'bloco-de-linhas': 'line-block',
'literal-interpretado': 'parsed-literal',
'rubrica': 'rubric',
- 'ep\u00EDgrafo': 'epigraph',
+ 'epígrafo': 'epigraph',
'destaques': 'highlights',
- 'cita\u00E7\u00E3o-destacada': 'pull-quote',
+ 'citação-destacada': 'pull-quote',
'compound (translation required)': 'compound',
'container (translation required)': 'container',
# 'perguntas': 'questions',
@@ -49,9 +50,9 @@
# 'imagemap': 'imagemap',
'imagem': 'image',
'figura': 'figure',
- 'inclus\u00E3o': 'include',
+ 'inclusão': 'include',
'cru': 'raw',
- 'substitui\u00E7\u00E3o': 'replace',
+ 'substituição': 'replace',
'unicode': 'unicode',
'data': 'date',
'classe': 'class',
@@ -58,14 +59,14 @@
'role (translation required)': 'role',
'default-role (translation required)': 'default-role',
'title (translation required)': 'title',
- '\u00EDndice': 'contents',
+ 'índice': 'contents',
'numsec': 'sectnum',
- 'numera\u00E7\u00E3o-de-se\u00E7\u00F5es': 'sectnum',
+ 'numeração-de-seções': 'sectnum',
'header (translation required)': 'header',
'footer (translation required)': 'footer',
# 'notas-de-rorap\u00E9': 'footnotes',
# 'cita\u00E7\u00F5es': 'citations',
- 'links-no-rodap\u00E9': 'target-notes',
+ 'links-no-rodapé': 'target-notes',
'restructuredtext-test-directive': 'restructuredtext-test-directive'}
"""Brazilian Portuguese name to registered (in directives/__init__.py)
directive name mapping."""
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2023-06-29 13:49:35
|
Revision: 9418
http://sourceforge.net/p/docutils/code/9418
Author: milde
Date: 2023-06-29 13:49:33 +0000 (Thu, 29 Jun 2023)
Log Message:
-----------
Update ODT writer configuration settings documentation.
Use the conventions of config.txt also for the ODF/ODT writer:
- one sub section per configuration setting
(also if there are 2 corresponding command line options).
- sort settings alphabetically.
- Specify default and options at end of section.
Add links to the detailled ODT writer documentation.
More concise help output. Consistent meta-variable format ``XYZ -> <xyz>``.
Modified Paths:
--------------
trunk/docutils/docs/user/config.txt
trunk/docutils/docutils/writers/odf_odt/__init__.py
Modified: trunk/docutils/docs/user/config.txt
===================================================================
--- trunk/docutils/docs/user/config.txt 2023-06-27 20:04:54 UTC (rev 9417)
+++ trunk/docutils/docs/user/config.txt 2023-06-29 13:49:33 UTC (rev 9418)
@@ -2020,137 +2020,145 @@
[odf_odt writer]
----------------
-The `ODF/ODT Writer`__ generates documents in the
+The ODF/`ODT Writer`_ generates documents in the
OpenDocument_ Text format (.odt).
The output_encoding_ setting is ignored, the output encoding is
always "UTF-8".
-__
-.. _ODT Writer for Docutils: odt.html
+.. _ODT Writer: odt.html
.. _OpenDocument: https://en.wikipedia.org/wiki/OpenDocument
-stylesheet
-~~~~~~~~~~
+add-syntax_highlighting
+~~~~~~~~~~~~~~~~~~~~~~~
-Specify a stylesheet URL, used verbatim.
-See section `Styles and Classes`_ in the `Odt Writer for Docutils`_
-document for details.
+Add syntax highlighting in literal code blocks.
+See section "`Syntax highlighting`__" in the ODT Writer documentation
+for details.
-Default: writers/odf_odt/styles.odt in the installation directory.
+Default: disabled (False).
+Options: ``--add-syntax-highlighting, --no-syntax-highlighting``.
-odf-config-file
+__ odt.html#syntax-highlighting
+
+
+create_links
+~~~~~~~~~~~~
+
+Create links.
+
+Default: disabled (False).
+Options: ``--create-links, --no-links``.
+
+
+create_sections
~~~~~~~~~~~~~~~
-Specify a configuration/mapping file relative to the current working
-directory for additional ODF options. In particular, this file may
-contain a section named "Formats" that maps default style names to names
-to be used in the resulting output file allowing for adhering to external
-standards. For more info and the format of the configuration/mapping
-file, see section `How to use custom style names`_ in the
-`Odt Writer for Docutils`_ document.
+Create sections for headers.
-cloak-email-addresses
+Default: enabled (True).
+Options: ``--create-sections, --no-sections``.
+
+
+cloak_email_addresses
~~~~~~~~~~~~~~~~~~~~~
Obfuscate email addresses to confuse harvesters while still
keeping email links usable with standards-compliant browsers.
-no-cloak-email-addresses
-~~~~~~~~~~~~~~~~~~~~~~~~
+Default: disabled (False).
+Options: ``--cloak-email-addresses, --no-cloak-email-addresses``.
-Do not obfuscate email addresses.
-table-border-thickness
-~~~~~~~~~~~~~~~~~~~~~~
+custom_header
+~~~~~~~~~~~~~
-Specify the thickness of table borders in thousands of a cm.
-Default is 35.
+Specify the contents of a custom header line.
+See section "`Custom header/footers`_" in the ODT Writer documentation
+for details.
-add-syntax-highlighting
-~~~~~~~~~~~~~~~~~~~~~~~
+Default: none ('').
+Option: ``--custom-odt-header``.
-Add syntax highlighting in literal code blocks.
-no-syntax-highlighting
-~~~~~~~~~~~~~~~~~~~~~~
+custom_footer
+~~~~~~~~~~~~~
-Do not add syntax highlighting in literal code blocks.
-(default)
+Specify the contents of a custom footer line.
+See section "`Custom header/footers`_" in the ODT Writer documentation
+for details.
-create-sections
-~~~~~~~~~~~~~~~
+Default: none ('').
+Option: ``--custom-odt-footer``.
-Create sections for headers. (default)
+.. _custom header/footers:
+ odt.html#custom-header-footers-inserting-page-numbers-date-time-etc
-no-sections
-~~~~~~~~~~~
-Do not create sections for headers.
+endnotes_end_doc
+~~~~~~~~~~~~~~~~
-create-links
-~~~~~~~~~~~~
+Generate endnotes at end of document, not footnotes at bottom of page.
-Create links.
+Default: disabled (False).
+Options: ``--endnotes-end-doc, --no-endnotes-end-doc``.
-no-links
-~~~~~~~~
-Do not create links. (default)
+generate_oowriter_toc
+~~~~~~~~~~~~~~~~~~~~~
-endnotes-end-doc
-~~~~~~~~~~~~~~~~
+Generate a native ODF table of contents, not a bullet list.
+See section "`Table of contents`__" in the ODT Writer documentation
+for details.
-Generate endnotes at end of document, not footnotes at bottom of page.
+Default: enabled (True).
+Options: ``--generate-oowriter-toc, --generate-list-toc``.
-no-endnotes-end-doc
-~~~~~~~~~~~~~~~~~~~
+__ odt.html#table-of-contents
-Generate footnotes at bottom of page, not endnotes at end of
-document. (default)
-generate-list-toc
-~~~~~~~~~~~~~~~~~
+odf_config_file
+~~~~~~~~~~~~~~~
-Generate a bullet list table of contents, not an
-ODF/``oowriter`` table of contents.
+Specify a configuration/mapping file relative to the current working
+directory for additional ODF options.
+In particular, this file may contain a mapping of default style names to
+names used in the resulting output file.
+See section `How to use custom style names`__ in the
+ODT Writer documentation for details.
-generate-oowriter-toc
-~~~~~~~~~~~~~~~~~~~~~
+Default: None.
+Option: ``--odf-config-file``.
-Generate an ODF/``oowriter`` table of contents, not a bullet
-list. (default) **Note:** ``odtwriter`` is not able to
-determine page numbers, so you will need to open the generated
-document in ``oowriter``, then right-click on the table of
-contents and select "Update" to insert page numbers.
+__ odt.html#how-to-use-custom-style-names
-custom-odt-header
-~~~~~~~~~~~~~~~~~
-Specify the contents of a custom header line. For details about
-custom headers and about special field character sequences, see
-section "`Custom header/footers`_: inserting page numbers, date,
-time, etc" in the `Odt Writer for Docutils`_ document for
-details.
+stylesheet
+~~~~~~~~~~
+Specify a stylesheet URL, used verbatim.
+See section `Styles and Classes`_ in the ODT Writer documentation
+for details.
-custom-odt-footer
-~~~~~~~~~~~~~~~~~
+Default: writers/odf_odt/styles.odt in the installation directory.
+Option: ``--stylesheet``.
-Specify the contents of a custom footer line. For details about
-custom footers and about special field character sequences, see
-section "`Custom header/footers`_: inserting page numbers, date,
-time, etc" in the `Odt Writer for Docutils`_ document for
-details.
+.. _styles and classes: odt.html#styles-and-classes
-.. _custom header/footers:
- odt.html#custom-header-footers-inserting-page-numbers-date-time-etc
-.. _how to use custom style names:
- odt.html#how-to-use-custom-style-names
-.. _styles and classes:
- odt.html#styles-and-classes
+table_border_thickness
+~~~~~~~~~~~~~~~~~~~~~~
+Specify the thickness of table borders in thousands of a centimetre.
+The `Table styles`__ section in the ODT Writer documentation describes
+alternatives for additional customisation of the table style.
+
+Default: 35 (0.35 mm).
+Option: ``--table-border-thickness``.
+
+__ odt.html#table-styles
+
+
[pseudoxml writer]
------------------
Modified: trunk/docutils/docutils/writers/odf_odt/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/odf_odt/__init__.py 2023-06-27 20:04:54 UTC (rev 9417)
+++ trunk/docutils/docutils/writers/odf_odt/__init__.py 2023-06-29 13:49:33 UTC (rev 9418)
@@ -379,7 +379,7 @@
os.path.join(os.path.dirname(__file__), default_template))
settings_spec = (
- 'ODF-Specific Options',
+ 'ODF-Specific Options.',
None,
(
('Specify a stylesheet. '
@@ -389,21 +389,11 @@
'default': default_stylesheet_path,
'dest': 'stylesheet'
}),
- ('Specify a configuration/mapping file relative to the '
- 'current working '
- 'directory for additional ODF options. '
- 'In particular, this file may contain a section named '
- '"Formats" that maps default style names to '
- 'names to be used in the resulting output file allowing for '
- 'adhering to external standards. '
- 'For more info and the format of the '
- 'configuration/mapping file, '
- 'see the odtwriter doc.',
+ ('Specify an ODF-specific configuration/mapping file '
+ 'relative to the current working directory.',
['--odf-config-file'],
{'metavar': '<file>'}),
- ('Obfuscate email addresses to confuse harvesters while still '
- 'keeping email links usable with '
- 'standards-compliant browsers.',
+ ('Obfuscate email addresses to confuse harvesters.',
['--cloak-email-addresses'],
{'default': False,
'action': 'store_true',
@@ -415,10 +405,11 @@
'action': 'store_false',
'dest': 'cloak_email_addresses',
'validator': frontend.validate_boolean}),
- ('Specify the thickness of table borders in thousands of a cm. '
+ ('Specify the thickness of table borders in thousands of a cm. '
'Default is 35.',
['--table-border-thickness'],
{'default': None,
+ 'metavar': '<int>',
'validator': frontend.validate_nonnegative_int}),
('Add syntax highlighting in literal code blocks.',
['--add-syntax-highlighting'],
@@ -427,7 +418,7 @@
'dest': 'add_syntax_highlighting',
'validator': frontend.validate_boolean}),
('Do not add syntax highlighting in '
- 'literal code blocks. (default)',
+ 'literal code blocks. (default)',
['--no-syntax-highlighting'],
{'default': False,
'action': 'store_false',
@@ -471,15 +462,14 @@
'action': 'store_false',
'dest': 'endnotes_end_doc',
'validator': frontend.validate_boolean}),
- ('Generate a bullet list table of contents, not '
- 'an ODF/oowriter table of contents.',
+ ('Generate a bullet list table of contents, '
+ 'not a native ODF table of contents.',
['--generate-list-toc'],
- {'default': True,
- 'action': 'store_false',
+ {'action': 'store_false',
'dest': 'generate_oowriter_toc',
'validator': frontend.validate_boolean}),
- ('Generate an ODF/oowriter table of contents, not '
- 'a bullet list. (default)',
+ ('Generate a native ODF table of contents, '
+ 'not a bullet list. (default)',
['--generate-oowriter-toc'],
{'default': True,
'action': 'store_true',
@@ -486,17 +476,18 @@
'dest': 'generate_oowriter_toc',
'validator': frontend.validate_boolean}),
('Specify the contents of an custom header line. '
- 'See odf_odt writer documentation for details '
+ 'See ODF/ODT writer documentation for details '
'about special field character sequences.',
['--custom-odt-header'],
{'default': '',
- 'dest': 'custom_header', }),
+ 'dest': 'custom_header',
+ 'metavar': '<custom header>'}),
('Specify the contents of an custom footer line. '
- 'See odf_odt writer documentation for details '
- 'about special field character sequences.',
+ 'See ODF/ODT writer documentation for details.',
['--custom-odt-footer'],
{'default': '',
- 'dest': 'custom_footer', }),
+ 'dest': 'custom_footer',
+ 'metavar': '<custom footer>'}),
)
)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2023-06-29 13:49:55
|
Revision: 9420
http://sourceforge.net/p/docutils/code/9420
Author: milde
Date: 2023-06-29 13:49:53 +0000 (Thu, 29 Jun 2023)
Log Message:
-----------
Documentation and test update to utils.relative_path().
Modified Paths:
--------------
trunk/docutils/docutils/utils/__init__.py
trunk/docutils/test/test_utils.py
Modified: trunk/docutils/docutils/utils/__init__.py
===================================================================
--- trunk/docutils/docutils/utils/__init__.py 2023-06-29 13:49:42 UTC (rev 9419)
+++ trunk/docutils/docutils/utils/__init__.py 2023-06-29 13:49:53 UTC (rev 9420)
@@ -479,15 +479,27 @@
"""
Build and return a path to `target`, relative to `source` (both files).
- Differences to `os.relpath()`:
+ The return value is a `str` suitable to be included in `source`
+ as a reference to `target`.
+ :Parameters:
+ `source` : path-like object or None
+ Path of a file in the start directory for the relative path
+ (the file does not need to exist).
+ The value ``None`` is replaced with "<cwd>/dummy_file".
+ `target` : path-like object
+ End point of the returned relative path.
+
+ Differences to `os.path.relpath()`:
+
* Inverse argument order.
- * `source` expects path to a FILE (while os.relpath expects a dir)!
- (Add a "dummy" file name if `source` points to a directory.)
+ * `source` expects path to a FILE
+ while `start` in `os.path.relpath()` expects a DIRECTORY.
+ (You must add a "dummy" file name if the `source` is a directory.)
* Always use Posix path separator ("/") for the output.
- * Use `os.sep` for parsing the input (ignored by `os.relpath()`).
+ * Use `os.sep` for parsing the input
+ (changing the value of `os.sep` is ignored by `os.relpath()`).
* If there is no common prefix, return the absolute path to `target`.
-
"""
source_parts = os.path.abspath(source or type(target)('dummy_file')
).split(os.sep)
Modified: trunk/docutils/test/test_utils.py
===================================================================
--- trunk/docutils/test/test_utils.py 2023-06-29 13:49:42 UTC (rev 9419)
+++ trunk/docutils/test/test_utils.py 2023-06-29 13:49:53 UTC (rev 9420)
@@ -324,16 +324,22 @@
source = os.path.join('häm', 'spam', 'fileA')
target = os.path.join('häm', 'fileB')
self.assertEqual(utils.relative_path(source, target), '../fileB')
+ source = os.path.join('häm', 'fileA')
+ target = os.path.join('..', 'spam', 'fileB')
+ self.assertEqual(utils.relative_path(source, target),
+ '../../spam/fileB')
# if source is None, default to the cwd:
target = os.path.join('eggs', 'fileB')
self.assertEqual(utils.relative_path(None, target), 'eggs/fileB')
# If there is no common prefix, return the absolute path to `target`:
- # source = '/foo/bar/fileA' # POSIX
- # TODO: how to specify an absolute path independent of the OS?
- # target = os.path.join('eggs', 'fileB')
- # self.assertEqual(utils.relative_path(source, target),
- # os.path.abspath('fileB'))
- # Correctly process unicode instances:
+ if os.sep == '/':
+ source = '/foo/bar/fileA'
+ else:
+ source = r'C:\foo\bar\fileA'
+ target = os.path.join('eggs', 'fileB')
+ self.assertEqual(utils.relative_path(source, target),
+ os.path.abspath('eggs/fileB'))
+ # Correctly process characters outside the ASCII range:
self.assertEqual(utils.relative_path('spam', 'spam'), '')
source = os.path.join('häm', 'spam', 'fileA')
target = os.path.join('häm', 'spam', 'fileB')
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2023-06-30 13:59:42
|
Revision: 9423
http://sourceforge.net/p/docutils/code/9423
Author: milde
Date: 2023-06-30 13:59:40 +0000 (Fri, 30 Jun 2023)
Log Message:
-----------
Revise image reading in HTML writers.
The HTML writers read image files for embedded images
and to determine the size of images that should be scaled.
* Use urllib to parse image URI (support for "file:" scheme).
* Warn, if scaling fails because the image cannot be read.
Adapt "record dependencies" test to suppress warning
if PIL is not installed.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/docutils/writers/_html_base.py
trunk/docutils/test/test_dependencies.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2023-06-29 13:50:25 UTC (rev 9422)
+++ trunk/docutils/HISTORY.txt 2023-06-30 13:59:40 UTC (rev 9423)
@@ -75,7 +75,11 @@
- Stop setting the "footnote-reference" class value for footnote references.
Since 0.18, you can use the CSS selector ``[role="doc-noteref"]``.
+ - Support reading/embedding images with "file:" URIs.
+ - Warn, if image scaling fails because the image file cannot be read.
+
+
Release 0.20.1 (2023-05-17)
===========================
Modified: trunk/docutils/docutils/writers/_html_base.py
===================================================================
--- trunk/docutils/docutils/writers/_html_base.py 2023-06-29 13:50:25 UTC (rev 9422)
+++ trunk/docutils/docutils/writers/_html_base.py 2023-06-30 13:59:40 UTC (rev 9423)
@@ -21,7 +21,7 @@
import os
import os.path
import re
-from urllib.request import unquote as unquote_url
+import urllib
from urllib.request import url2pathname # unquote and use local path sep
import warnings
@@ -1008,7 +1008,10 @@
def visit_image(self, node):
atts = {}
uri = node['uri']
+ uri_parts = urllib.parse.urlparse(uri)
+ imagepath = ''
mimetype = mimetypes.guess_type(uri)[0]
+ scaling_problems = []
# image size
if 'width' in node:
atts['width'] = node['width']
@@ -1015,22 +1018,34 @@
if 'height' in node:
atts['height'] = node['height']
if 'scale' in node:
- if (PIL and ('width' not in node or 'height' not in node)
- and self.settings.file_insertion_enabled):
- imagepath = url2pathname(uri)
- try:
- with PIL.Image.open(imagepath) as img:
- imgsize = img.size
- except (OSError, UnicodeEncodeError):
- pass # TODO: warn?
+ if 'width' not in node or 'height' not in node:
+ # try reading size from image file
+ if uri_parts.scheme not in ('', 'file'):
+ scaling_problems.append('Works only for local images.')
+ if not PIL:
+ scaling_problems.append('Requires Python Imaging Library.')
+ if not self.settings.file_insertion_enabled:
+ scaling_problems.append('Reading external files disabled.')
+ if not scaling_problems:
+ imagepath = url2pathname(uri_parts.path)
+ try:
+ with PIL.Image.open(imagepath) as img:
+ imgsize = img.size
+ except (OSError, UnicodeEncodeError) as err:
+ scaling_problems.append(str(err))
+ else:
+ self.settings.record_dependencies.add(
+ imagepath.replace('\\', '/'))
+ if scaling_problems:
+ self.document.reporter.warning(
+ '\n '.join([f'Cannot scale "{imagepath or uri}".']
+ + scaling_problems))
else:
- self.settings.record_dependencies.add(
- imagepath.replace('\\', '/'))
if 'width' not in atts:
atts['width'] = '%dpx' % imgsize[0]
if 'height' not in atts:
atts['height'] = '%dpx' % imgsize[1]
- del img
+ # scale provided/determined size values:
for att_name in 'width', 'height':
if att_name in atts:
match = re.match(r'([0-9.]+)(\S*)$', atts[att_name])
@@ -1059,6 +1074,16 @@
atts['class'] = 'align-%s' % node['align']
# Embed image file (embedded SVG or data URI):
if self.image_loading == 'embed':
+ if uri_parts.scheme not in ('', 'file'):
+ self.document.reporter.error(
+ f'Cannot embed remote image "{uri}"')
+ # TODO: read with urllib.request?
+ imagepath = imagepath or url2pathname(uri_parts.path)
+ # TODO: adapt relative imagepath?
+ # if not os.path.isabs(imagepath):
+ # _src, _ln = utils.get_source_line(node)
+ # dirname = os.path.dirname(_src or '')
+ # imagepath = os.path.join(dirname, imagepath)
try:
with open(url2pathname(uri), 'rb') as imagefile:
imagedata = imagefile.read()
@@ -1066,7 +1091,8 @@
self.document.reporter.error('Cannot embed image %r: %s'
% (uri, err.strerror))
else:
- self.settings.record_dependencies.add(unquote_url(uri))
+ self.settings.record_dependencies.add(
+ urllib.parse.unquote(uri))
# TODO: insert SVG as-is?
# if mimetype == 'image/svg+xml':
# read/parse, apply arguments,
Modified: trunk/docutils/test/test_dependencies.py
===================================================================
--- trunk/docutils/test/test_dependencies.py 2023-06-29 13:50:25 UTC (rev 9422)
+++ trunk/docutils/test/test_dependencies.py 2023-06-30 13:59:40 UTC (rev 9423)
@@ -78,7 +78,7 @@
expected = [paths[key] for key in keys]
record, output = self.get_record(writer_name='xml')
# the order of the files is arbitrary
- self.assertEqual(sorted(record), sorted(expected))
+ self.assertEqual(sorted(expected), sorted(record))
def test_dependencies_html(self):
keys = ['include', 'raw']
@@ -86,11 +86,13 @@
keys += ['figure-image', 'scaled-image']
expected = [paths[key] for key in keys]
# stylesheets are tested separately in test_stylesheet_dependencies():
- settings = {'stylesheet_path': None, 'stylesheet': None}
+ settings = {'stylesheet_path': None,
+ 'stylesheet': None,
+ 'report_level': 4} # drop warning if PIL is missing
record, output = self.get_record(writer_name='html5',
settings_overrides=settings)
# the order of the files is arbitrary
- self.assertEqual(sorted(record), sorted(expected),
+ self.assertEqual(sorted(expected), sorted(record),
msg='output is:\n'+output)
def test_dependencies_latex(self):
@@ -106,13 +108,13 @@
writer_name='latex',
settings_overrides=latex_settings_overwrites)
# the order of the files is arbitrary
- self.assertEqual(sorted(record), sorted(expected),
+ self.assertEqual(sorted(expected), sorted(record),
msg='output is:\n'+output)
def test_csv_dependencies(self):
csvsource = str(DATA_ROOT / 'csv_dep.txt')
record, output = self.get_record(source_path=csvsource)
- self.assertEqual(record, [relpath(DATA_ROOT / 'csv_data.txt')],
+ self.assertEqual([relpath(DATA_ROOT / 'csv_data.txt')], record,
msg='output is:\n'+output)
def test_stylesheet_dependencies(self):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2023-06-30 14:20:43
|
Revision: 9424
http://sourceforge.net/p/docutils/code/9424
Author: milde
Date: 2023-06-30 14:20:37 +0000 (Fri, 30 Jun 2023)
Log Message:
-----------
Revise image reading in ODT writer.
* Use `urllib.parse.urlparse()` to tell local image files from remote ones.
* Use context manager for file operations.
* `urllib.request.urlopen()` raises URLError, not HTTPError.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/docutils/writers/odf_odt/__init__.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2023-06-30 13:59:40 UTC (rev 9423)
+++ trunk/docutils/HISTORY.txt 2023-06-30 14:20:37 UTC (rev 9424)
@@ -60,6 +60,11 @@
- Fix placement of hyperlink target (label) for tables (bug #440).
+* docutils/writers/odf_odt/__init__.py
+
+ - Use context manager for image reading operations.
+ Catch `URLError` when `urllib.request.urlopen()` fails.
+
* docutils/writers/s5_html/__init__.py
- Warn if the S5 writer cannot copy the theme files.
Modified: trunk/docutils/docutils/writers/odf_odt/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/odf_odt/__init__.py 2023-06-30 13:59:40 UTC (rev 9423)
+++ trunk/docutils/docutils/writers/odf_odt/__init__.py 2023-06-30 14:20:37 UTC (rev 9424)
@@ -23,8 +23,9 @@
import subprocess
import tempfile
import time
+from urllib.error import URLError
+from urllib.parse import urlparse
from urllib.request import urlopen, url2pathname
-from urllib.error import HTTPError
import weakref
from xml.etree import ElementTree as etree
from xml.dom import minidom
@@ -2117,9 +2118,10 @@
def visit_image(self, node):
# Capture the image file.
- source = node.attributes['uri']
- if not (source.startswith('http:') or source.startswith('https:')):
- source = url2pathname(source)
+ source = node['uri']
+ uri_parts = urlparse(source)
+ if uri_parts.scheme in ('', 'file'):
+ source = url2pathname(uri_parts.path)
if not os.path.isabs(source):
# adapt relative paths
docsource, line = utils.get_source_line(node)
@@ -2129,7 +2131,7 @@
source = os.path.join(dirname, source)
if not self.check_file_exists(source):
self.document.reporter.warning(
- 'Cannot find image file %s.' % (source, ))
+ f'Cannot find image file "{source}".')
return
if source in self.image_dict:
filename, destination = self.image_dict[source]
@@ -2136,23 +2138,22 @@
else:
self.image_count += 1
filename = os.path.split(source)[1]
- destination = 'Pictures/1%08x%s' % (self.image_count, filename, )
- if source.startswith('http:') or source.startswith('https:'):
+ destination = 'Pictures/1%08x%s' % (self.image_count, filename)
+ if uri_parts.scheme in ('', 'file'):
+ spec = (os.path.abspath(source), destination,)
+ else:
try:
- imgfile = urlopen(source)
- content = imgfile.read()
- imgfile.close()
- imgfile2 = tempfile.NamedTemporaryFile('wb', delete=False)
+ with urlopen(source) as imgfile:
+ content = imgfile.read()
+ except URLError as err:
+ self.document.reporter.warning(
+ f'Cannot open image URL "{source}". {err}')
+ return
+ with tempfile.NamedTemporaryFile('wb',
+ delete=False) as imgfile2:
imgfile2.write(content)
- imgfile2.close()
- imgfilename = imgfile2.name
- source = imgfilename
- except HTTPError:
- self.document.reporter.warning(
- "Can't open image url %s." % (source, ))
+ source = imgfile2.name
spec = (source, destination,)
- else:
- spec = (os.path.abspath(source), destination,)
self.embedded_file_list.append(spec)
self.image_dict[source] = (source, destination,)
# Is this a figure (containing an image) or just a plain image?
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2023-07-03 12:38:57
|
Revision: 9426
http://sourceforge.net/p/docutils/code/9426
Author: milde
Date: 2023-07-03 12:38:54 +0000 (Mon, 03 Jul 2023)
Log Message:
-----------
Small documentation fixes/additions.
Remove trailing whitespace, update links.
Add comment to structure `parsers.rst.directives` source.
Expand docstring for `utils.relative_path()`.
Modified Paths:
--------------
trunk/docutils/docs/user/config.txt
trunk/docutils/docutils/parsers/rst/directives/__init__.py
trunk/docutils/docutils/utils/__init__.py
Modified: trunk/docutils/docs/user/config.txt
===================================================================
--- trunk/docutils/docs/user/config.txt 2023-06-30 14:56:47 UTC (rev 9425)
+++ trunk/docutils/docs/user/config.txt 2023-07-03 12:38:54 UTC (rev 9426)
@@ -1237,8 +1237,9 @@
A comma-separated list of paths to CSS stylesheets. Relative paths are
expanded if a matching file is found in the stylesheet_dirs__.
-If embed_stylesheet__ is False, paths are rewritten relative to the
-output HTML file.
+If embed_stylesheet__ is False, paths are rewritten relative to
+the output HTML file (if output_ or ``<destination>`` are specified)
+or the current work directory.
See also `stylesheet_path [latex writers]`_.
Also overrides "stylesheet". [#override]_
@@ -1417,8 +1418,6 @@
New in Docutils 0.18.
-.. _base64: https://en.wikipedia.org/wiki/Base64
-.. _data URI: https://en.wikipedia.org/wiki/Data_URI_scheme
.. _lazy loading attribute: https://html.spec.whatwg.org/multipage/
urls-and-fetching.html#lazy-loading-attributes
@@ -1841,9 +1840,9 @@
A comma-separated list of style files. Relative paths are expanded if a
matching file is found in the stylesheet_dirs__.
-If embed_stylesheet__ is False, paths are rewritten relative to the
-output file path. Run ``latex`` from the directory containing
-the output file.
+If embed_stylesheet__ is False, paths are rewritten relative to
+the output file (if output_ or ``<destination>`` are specified)
+or the current work directory.
See also `stylesheet_path [html writers]`_.
For files in the `TeX input path`_, the stylesheet__ option is recommended.
@@ -2074,7 +2073,7 @@
custom_header
~~~~~~~~~~~~~
-Specify the contents of a custom header line.
+Specify the contents of a custom header line.
See section "`Custom header/footers`_" in the ODT Writer documentation
for details.
@@ -2085,7 +2084,7 @@
custom_footer
~~~~~~~~~~~~~
-Specify the contents of a custom footer line.
+Specify the contents of a custom footer line.
See section "`Custom header/footers`_" in the ODT Writer documentation
for details.
@@ -2122,9 +2121,9 @@
~~~~~~~~~~~~~~~
Specify a configuration/mapping file relative to the current working
-directory for additional ODF options.
+directory for additional ODF options.
In particular, this file may contain a mapping of default style names to
-names used in the resulting output file.
+names used in the resulting output file.
See section `How to use custom style names`__ in the
ODT Writer documentation for details.
@@ -2131,7 +2130,7 @@
Default: None.
Option: ``--odf-config-file``.
-__ odt.html#how-to-use-custom-style-names
+__ odt.html#how-to-use-custom-style-names
stylesheet
@@ -2143,7 +2142,7 @@
Default: writers/odf_odt/styles.odt in the installation directory.
Option: ``--stylesheet``.
-.. _styles and classes: odt.html#styles-and-classes
+.. _styles and classes: odt.html#styles-and-classes
table_border_thickness
Modified: trunk/docutils/docutils/parsers/rst/directives/__init__.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/directives/__init__.py 2023-06-30 14:56:47 UTC (rev 9425)
+++ trunk/docutils/docutils/parsers/rst/directives/__init__.py 2023-07-03 12:38:54 UTC (rev 9426)
@@ -141,6 +141,12 @@
_directives[name] = directive
+# conversion functions for `Directive.option_spec`
+# ------------------------------------------------
+#
+# see also `parsers.rst.Directive` in ../__init__.py.
+
+
def flag(argument):
"""
Check for a valid flag option (no argument) and return ``None``.
Modified: trunk/docutils/docutils/utils/__init__.py
===================================================================
--- trunk/docutils/docutils/utils/__init__.py 2023-06-30 14:56:47 UTC (rev 9425)
+++ trunk/docutils/docutils/utils/__init__.py 2023-07-03 12:38:54 UTC (rev 9426)
@@ -493,13 +493,21 @@
Differences to `os.path.relpath()`:
* Inverse argument order.
- * `source` expects path to a FILE
- while `start` in `os.path.relpath()` expects a DIRECTORY.
- (You must add a "dummy" file name if the `source` is a directory.)
+ * `source` is assumed to be a FILE in the start directory (add a "dummy"
+ file name to obtain the path relative from a directory)
+ while `os.path.relpath()` expects a DIRECTORY as `start` argument.
* Always use Posix path separator ("/") for the output.
* Use `os.sep` for parsing the input
(changing the value of `os.sep` is ignored by `os.relpath()`).
* If there is no common prefix, return the absolute path to `target`.
+
+ Differences to `pathlib.PurePath.relative_to(other)`:
+
+ * Object oriented interface.
+ * `source` expects path to a FILE while `other` expects a DIRECTORY.
+ * No default value for `other`.
+ * Raise ValueError if relative path cannot be determined.
+ * Fails if target is not a subpath of `other` (no ".." inserted).
"""
source_parts = os.path.abspath(source or type(target)('dummy_file')
).split(os.sep)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2023-07-07 06:50:29
|
Revision: 9428
http://sourceforge.net/p/docutils/code/9428
Author: milde
Date: 2023-07-07 06:50:26 +0000 (Fri, 07 Jul 2023)
Log Message:
-----------
Small code cleanup.
* Sort import statements.
* Do not overwrite standard `io` with `docutils.io`.
* Use auxiliary variable to avoid too long lines and
multiple dereferencing of ``self.state.document.settings``.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/docutils/parsers/rst/directives/misc.py
trunk/docutils/docutils/parsers/rst/directives/tables.py
trunk/docutils/docutils/parsers/rst/languages/de.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2023-07-07 06:50:09 UTC (rev 9427)
+++ trunk/docutils/HISTORY.txt 2023-07-07 06:50:26 UTC (rev 9428)
@@ -30,6 +30,8 @@
configuration setting is None, '', 'utf-8-sig', 'utf-16', or 'utf-32'.
Do not remove other ZWNBSPs.
+ - Auto-close `FileInput.source` in case of reading/decoding errors.
+
.. _UTF-8 mode: https://docs.python.org/3/library/os.html#utf8-mode
.. _input encoding: docs/api/publisher.html#encodings
@@ -65,6 +67,8 @@
- Use context manager for image reading operations.
Catch `URLError` when `urllib.request.urlopen()` fails.
+ - Convert image URI to path if accessing a local file. Fixes bug #153.
+
* docutils/writers/s5_html/__init__.py
- Warn if the S5 writer cannot copy the theme files.
Modified: trunk/docutils/docutils/parsers/rst/directives/misc.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/directives/misc.py 2023-07-07 06:50:09 UTC (rev 9427)
+++ trunk/docutils/docutils/parsers/rst/directives/misc.py 2023-07-07 06:50:26 UTC (rev 9428)
@@ -58,8 +58,10 @@
Depending on the options, the file (or a clipping) is
converted to nodes and returned or inserted into the input stream.
"""
- if not self.state.document.settings.file_insertion_enabled:
+ settings = self.state.document.settings
+ if not settings.file_insertion_enabled:
raise self.warning('"%s" directive disabled.' % self.name)
+ tab_width = self.options.get('tab-width', settings.tab_width)
current_source = self.state.document.current_source
path = directives.path(self.arguments[0])
if path.startswith('<') and path.endswith('>'):
@@ -68,15 +70,12 @@
else:
_base = Path(current_source).parent
path = utils.relative_path(None, _base/path)
- encoding = self.options.get(
- 'encoding', self.state.document.settings.input_encoding)
- e_handler = self.state.document.settings.input_encoding_error_handler
- tab_width = self.options.get(
- 'tab-width', self.state.document.settings.tab_width)
+ encoding = self.options.get('encoding', settings.input_encoding)
+ error_handler = settings.input_encoding_error_handler
try:
include_file = io.FileInput(source_path=path,
encoding=encoding,
- error_handler=e_handler)
+ error_handler=error_handler)
except UnicodeEncodeError:
raise self.severe(f'Problems with "{self.name}" directive path:\n'
f'Cannot encode input file path "{path}" '
@@ -85,7 +84,7 @@
raise self.severe(f'Problems with "{self.name}" directive '
f'path:\n{io.error_string(error)}.')
else:
- self.state.document.settings.record_dependencies.add(path)
+ settings.record_dependencies.add(path)
# Get to-be-included content
startline = self.options.get('start-line', None)
@@ -121,7 +120,7 @@
include_lines = statemachine.string2lines(rawtext, tab_width,
convert_whitespace=True)
for i, line in enumerate(include_lines):
- if len(line) > self.state.document.settings.line_length_limit:
+ if len(line) > settings.line_length_limit:
raise self.warning('"%s": line %d exceeds the'
' line-length-limit.' % (path, i+1))
@@ -187,7 +186,7 @@
if 'parser' in self.options:
# parse into a dummy document and return created nodes
- document = utils.new_document(path, self.state.document.settings)
+ document = utils.new_document(path, settings)
document.include_log = include_log + [(path, clip_options)]
parser = self.options['parser']()
parser.parse('\n'.join(include_lines), document)
@@ -227,15 +226,14 @@
has_content = True
def run(self):
- if (not self.state.document.settings.raw_enabled
- or (not self.state.document.settings.file_insertion_enabled
- and ('file' in self.options
- or 'url' in self.options))):
+ settings = self.state.document.settings
+ if (not settings.raw_enabled
+ or (not settings.file_insertion_enabled
+ and ('file' in self.options or 'url' in self.options))):
raise self.warning('"%s" directive disabled.' % self.name)
attributes = {'format': ' '.join(self.arguments[0].lower().split())}
- encoding = self.options.get(
- 'encoding', self.state.document.settings.input_encoding)
- e_handler = self.state.document.settings.input_encoding_error_handler
+ encoding = self.options.get('encoding', settings.input_encoding)
+ error_handler = settings.input_encoding_error_handler
if self.content:
if 'file' in self.options or 'url' in self.options:
raise self.error(
@@ -253,7 +251,7 @@
try:
raw_file = io.FileInput(source_path=path,
encoding=encoding,
- error_handler=e_handler)
+ error_handler=error_handler)
except OSError as error:
raise self.severe(f'Problems with "{self.name}" directive '
f'path:\n{io.error_string(error)}.')
@@ -260,7 +258,7 @@
else:
# TODO: currently, raw input files are recorded as
# dependencies even if not used for the chosen output format.
- self.state.document.settings.record_dependencies.add(path)
+ settings.record_dependencies.add(path)
try:
text = raw_file.read()
except UnicodeError as error:
@@ -277,7 +275,7 @@
f'{io.error_string(error)}.')
raw_file = io.StringInput(source=raw_text, source_path=source,
encoding=encoding,
- error_handler=e_handler)
+ error_handler=error_handler)
try:
text = raw_file.read()
except UnicodeError as error:
Modified: trunk/docutils/docutils/parsers/rst/directives/tables.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/directives/tables.py 2023-07-07 06:50:09 UTC (rev 9427)
+++ trunk/docutils/docutils/parsers/rst/directives/tables.py 2023-07-07 06:50:26 UTC (rev 9428)
@@ -11,14 +11,15 @@
import csv
from pathlib import Path
+from urllib.request import urlopen
+from urllib.error import URLError
import warnings
-from docutils import io, nodes, statemachine, utils
-from docutils.utils import SystemMessagePropagation
+from docutils import nodes, statemachine, utils
+from docutils.io import FileInput, StringInput
from docutils.parsers.rst import Directive
from docutils.parsers.rst import directives
-from urllib.request import urlopen
-from urllib.error import URLError
+from docutils.utils import SystemMessagePropagation
def align(argument):
@@ -321,9 +322,9 @@
Get CSV data from the directive content, from an external
file, or from a URL reference.
"""
- encoding = self.options.get(
- 'encoding', self.state.document.settings.input_encoding)
- error_handler = self.state.document.settings.input_encoding_error_handler # noqa:E501
+ settings = self.state.document.settings
+ encoding = self.options.get('encoding', settings.input_encoding)
+ error_handler = settings.input_encoding_error_handler
if self.content:
# CSV data is from directive content.
if 'file' in self.options or 'url' in self.options:
@@ -348,9 +349,9 @@
_base = Path(self.state.document.current_source).parent
source = utils.relative_path(None, _base/source)
try:
- csv_file = io.FileInput(source_path=source,
- encoding=encoding,
- error_handler=error_handler)
+ csv_file = FileInput(source_path=source,
+ encoding=encoding,
+ error_handler=error_handler)
csv_data = csv_file.read().splitlines()
except OSError as error:
severe = self.reporter.severe(
@@ -360,7 +361,7 @@
line=self.lineno)
raise SystemMessagePropagation(severe)
else:
- self.state.document.settings.record_dependencies.add(source)
+ settings.record_dependencies.add(source)
elif 'url' in self.options:
source = self.options['url']
try:
@@ -373,10 +374,9 @@
nodes.literal_block(self.block_text, self.block_text),
line=self.lineno)
raise SystemMessagePropagation(severe)
- csv_file = io.StringInput(
- source=csv_text, source_path=source, encoding=encoding,
- error_handler=(self.state.document.settings.
- input_encoding_error_handler))
+ csv_file = StringInput(source=csv_text, source_path=source,
+ encoding=encoding,
+ error_handler=error_handler)
csv_data = csv_file.read().splitlines()
else:
error = self.reporter.warning(
Modified: trunk/docutils/docutils/parsers/rst/languages/de.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/languages/de.py 2023-07-07 06:50:09 UTC (rev 9427)
+++ trunk/docutils/docutils/parsers/rst/languages/de.py 2023-07-07 06:50:26 UTC (rev 9428)
@@ -17,6 +17,8 @@
directives = {
+ 'warnhinweis': 'admonition', # or, more generally, 'anmerkung'?
+ 'ermahnung': 'admonition', # sic! kept for backwards compatibiltity
'achtung': 'attention',
'vorsicht': 'caution',
'code': 'code',
@@ -27,8 +29,6 @@
'notiz': 'note',
'tipp': 'tip',
'warnung': 'warning',
- 'warnhinweis': 'admonition',
- 'ermahnung': 'admonition', # sic! kept for backwards compatibiltity
'kasten': 'sidebar',
'seitenkasten': 'sidebar', # kept for backwards compatibiltity
'seitenleiste': 'sidebar',
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gr...@us...> - 2023-08-23 12:02:43
|
Revision: 9444
http://sourceforge.net/p/docutils/code/9444
Author: grubert
Date: 2023-08-23 12:02:41 +0000 (Wed, 23 Aug 2023)
Log Message:
-----------
Add language support for georgian language (thanks to NorwayFun)
- docutils/languages/ka.py
- docutils/parsers/rst/languages/ka.py
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
Added Paths:
-----------
trunk/docutils/docutils/languages/ka.py
trunk/docutils/docutils/parsers/rst/languages/ka.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2023-08-10 11:44:20 UTC (rev 9443)
+++ trunk/docutils/HISTORY.txt 2023-08-23 12:02:41 UTC (rev 9444)
@@ -93,6 +93,11 @@
- Apply literal block patch #205. Use ``.EE`` and ``.EX`` macros.
Thanks to G. Branden Robinson (I assume).
+* Add language support for georgian language (thanks to NorwayFun)
+
+ - docutils/languages/ka.py
+ - docutils/parsers/rst/languages/ka.py
+
Release 0.20.1 (2023-05-17)
===========================
Added: trunk/docutils/docutils/languages/ka.py
===================================================================
--- trunk/docutils/docutils/languages/ka.py (rev 0)
+++ trunk/docutils/docutils/languages/ka.py 2023-08-23 12:02:41 UTC (rev 9444)
@@ -0,0 +1,58 @@
+# $Id$
+# Author: Temuri Doghonadze <temuri dot doghonadze at gmail dot com>
+# Copyright: This module has been placed in the public domain.
+
+# New language mappings are welcome. Before doing a new translation, please
+# read <https://docutils.sourceforge.io/docs/howto/i18n.html>.
+# Two files must be translated for each language: one in docutils/languages,
+# the other in docutils/parsers/rst/languages.
+
+"""
+Georgian-language mappings for language-dependent features of Docutils.
+"""
+
+__docformat__ = 'reStructuredText'
+
+labels = {
+ 'abstract': 'ანოტაცია',
+ 'address': 'მისამართი',
+ 'attention': 'ყურადღება!',
+ 'author': 'ავტორი',
+ 'authors': 'ავტორები',
+ 'caution': 'ფრთხილად!',
+ 'contact': 'კონტაქტი',
+ 'contents': 'შემცველობა',
+ 'copyright': 'საავტორო უფლებები',
+ 'danger': 'საშიშია!',
+ 'date': 'თარიღი',
+ 'dedication': 'მიძღვნა',
+ 'error': 'შეცდომა',
+ 'hint': 'რჩევა',
+ 'important': 'მნიშვნელოვანია',
+ 'note': 'შენიშვნა',
+ 'organization': 'ორგანიზაცია',
+ 'revision': 'რევიზია',
+ 'status': 'სტატუსი',
+ 'tip': 'მინიშნება',
+ 'version': 'ვერსია',
+ 'warning': 'გაფრთხილება'}
+"""Mapping of node class name to label text."""
+
+bibliographic_fields = {
+ 'ანოტაცია': 'abstract',
+ 'მისამართი': 'address',
+ 'ავტორი': 'author',
+ 'ავტორები': 'authors',
+ 'კონტაქტი': 'contact',
+ 'საავტორო უფლებები': 'copyright',
+ 'თარიღი': 'date',
+ 'მიძღვნა': 'dedication',
+ 'ორგანიზაცია': 'organization',
+ 'რევიზია': 'revision',
+ 'სტატუსი': 'status',
+ 'ვერსია': 'version'}
+"""Georgian (lowcased) to canonical name mapping for bibliographic fields."""
+
+author_separators = [';', ',']
+"""List of separator strings for the 'Authors' bibliographic field. Tried in
+order."""
Property changes on: trunk/docutils/docutils/languages/ka.py
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Added: trunk/docutils/docutils/parsers/rst/languages/ka.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/languages/ka.py (rev 0)
+++ trunk/docutils/docutils/parsers/rst/languages/ka.py 2023-08-23 12:02:41 UTC (rev 9444)
@@ -0,0 +1,90 @@
+# $Id$
+# Author: Temuri Doghonadze <tem...@gm...>
+# Copyright: This module has been placed in the public domain.
+
+# New language mappings are welcome. Before doing a new translation, please
+# read <https://docutils.sourceforge.io/docs/howto/i18n.html>.
+# Two files must be translated for each language: one in docutils/languages,
+# the other in docutils/parsers/rst/languages.
+
+"""
+Georgian-language mappings for language-dependent features of
+reStructuredText.
+"""
+
+__docformat__ = 'reStructuredText'
+
+directives = {
+ 'ხაზების-ბლოკი': 'line-block',
+ 'მეტა': 'meta',
+ 'მათემატიკა': 'math',
+ 'დამუშავებული-ლიტერალი': 'parsed-literal',
+ 'გამოყოფილი-ციტატა': 'pull-quote',
+ 'კოდი': 'code',
+ 'შერეული': 'compound',
+ 'კონტეინერი': 'container',
+ 'ცხრილი': 'table',
+ 'csv-ცხრილი': 'csv-table',
+ 'ჩამონათვალი-ცხრილი': 'list-table',
+ 'დაუმუშავებელი': 'raw',
+ 'ჩანაცვლება': 'replace',
+ 'restructuredtext-ის-სატესტო-დირექტივა': 'restructuredtext-test-directive',
+ 'სამიზნე-შენიშვნები': 'target-notes',
+ 'უნიკოდი': 'unicode',
+ 'თარიღი': 'date',
+ 'გვერდითი-პანელი': 'sidebar',
+ 'მნიშვნელოვანი': 'important',
+ 'ჩასმა': 'include',
+ 'ყურადღება': 'attention',
+ 'გამოკვეთა': 'highlights',
+ 'შენიშვნა': 'admonition',
+ 'გამოსახულება': 'image',
+ 'კლასი': 'class',
+ 'როლი': 'role',
+ 'ნაგულისხმევი-როლი': 'default-role',
+ 'სათაური': 'title',
+ 'განყ-ნომერი': 'sectnum',
+ 'განყ-ნომერი': 'sectnum',
+ 'საფრთხე': 'danger',
+ 'ფრთხილად': 'caution',
+ 'შეცდომა': 'error',
+ 'მინიშნება': 'tip',
+ 'ყურადღებით': 'warning',
+ 'აღნიშვნა': 'note',
+ 'ფიგურა': 'figure',
+ 'რუბრიკა': 'rubric',
+ 'რჩევა': 'hint',
+ 'შემცველობა': 'contents',
+ 'თემა': 'topic',
+ 'ეპიგრაფი': 'epigraph',
+ 'თავსართი': 'header',
+ 'ქვედა კოლონტიტული': 'footer',
+ }
+"""Georgian name to registered (in directives/__init__.py) directive name
+mapping."""
+
+roles = {
+ 'აკრონიმი': 'acronym',
+ 'კოდი': 'code',
+ 'ანონიმური-მიმართვა': 'anonymous-reference',
+ 'სიტყვასიტყვითი': 'literal',
+ 'მათემატიკა': 'math',
+ 'ზედა-ინდექსი': 'superscript',
+ 'მახვილი': 'emphasis',
+ 'სახელიანი-მიმართვა': 'named-reference',
+ 'ინდექსი': 'index',
+ 'ქვედა-ინდექსი': 'subscript',
+ 'სქელი-ფონტი': 'strong',
+ 'აბრევიატურა': 'abbreviation',
+ 'ჩანაცვლების-მიმართვა': 'substitution-reference',
+ 'pep-მიმართვა': 'pep-reference',
+ 'rfc-მიმართვა ': 'rfc-reference',
+ 'uri-მიმართვა': 'uri-reference',
+ 'title-მიმართვა': 'title-reference',
+ 'ქვედა-კოლონტიტულზე-მიმართვა': 'footnote-reference',
+ 'ციტატაზე-მიმართვა': 'citation-reference',
+ 'სამიზნე': 'target',
+ 'დაუმუშავებელი': 'raw',
+ }
+"""Mapping of Georgian role names to canonical role names for interpreted text.
+"""
Property changes on: trunk/docutils/docutils/parsers/rst/languages/ka.py
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2023-09-05 23:03:40
|
Revision: 9446
http://sourceforge.net/p/docutils/code/9446
Author: milde
Date: 2023-09-05 23:03:38 +0000 (Tue, 05 Sep 2023)
Log Message:
-----------
Documentation update.
Sort HISTORY entries alphabetically.
Patch number for Georgian language support.
Add Georgian to the list of supported natural laguages.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/README.txt
trunk/docutils/RELEASE-NOTES.txt
trunk/docutils/docs/dev/release.txt
trunk/docutils/docs/dev/repository.txt
trunk/docutils/setup.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2023-08-23 13:00:10 UTC (rev 9445)
+++ trunk/docutils/HISTORY.txt 2023-09-05 23:03:38 UTC (rev 9446)
@@ -35,6 +35,14 @@
.. _UTF-8 mode: https://docs.python.org/3/library/os.html#utf8-mode
.. _input encoding: docs/api/publisher.html#encodings
+* docutils/languages/, docutils/parsers/rst/languages/
+
+ - Mark/Fix mistranslated localizations of the "admonition" directive
+ name. In Docutils, "admonition" is used as a generic term for
+ "advice"/"advisory"/"remark", not a reprimand.
+
+ - Add support for Georgian language (patch #204 by Temuri Doghonadze).
+
* docutils/nodes.py
- Remove compatibility hacks `nodes.reprunicode` and `nodes.ensure_str()`.
@@ -47,12 +55,6 @@
- Move `parsers.rst.directives.Table.process_header_option()` to
`parsers.rst.directives.CSVTable`.
-* docutils/parsers/rst/languages/
-
- Mark/Fix mistranslated localizations of the "admonition" directive name.
- In Docutils, "admonition" is used as a generic term for
- "advice"/"advisory"/"remark", not a reprimand.
-
* docutils/utils/roman.py
- Update to version `1.4 <https://pypi.org/project/roman/4.1/>`__.
@@ -62,6 +64,11 @@
- Fix placement of hyperlink target (label) for tables (bug #440).
+* docutils/writers/manpage.py
+
+ - Apply literal block patch #205. Use ``.EE`` and ``.EX`` macros.
+ Thanks to G. Branden Robinson (I assume).
+
* docutils/writers/odf_odt/__init__.py
- Use context manager for image reading operations.
@@ -88,16 +95,7 @@
- Warn, if image scaling fails because the image file cannot be read.
-* docutils/writers/manpage.py
- - Apply literal block patch #205. Use ``.EE`` and ``.EX`` macros.
- Thanks to G. Branden Robinson (I assume).
-
-* Add language support for georgian language (thanks to Temuri Doghonadze)
-
- - docutils/languages/ka.py
- - docutils/parsers/rst/languages/ka.py
-
Release 0.20.1 (2023-05-17)
===========================
@@ -1109,8 +1107,8 @@
* docutils/writers/odf_odt/__init__.py
- - Command line setting `language`_ now sets the default language
- of the generated ODF document.
+ - Command line setting `language`_ now sets the default language of the
+ generated ODF document.
- The use of image directive options :width: (%), :scale:, etc now
set the width/height/size of images in the generated ODF
documents.
Modified: trunk/docutils/README.txt
===================================================================
--- trunk/docutils/README.txt 2023-08-23 13:00:10 UTC (rev 9445)
+++ trunk/docutils/README.txt 2023-09-05 23:03:38 UTC (rev 9446)
@@ -133,8 +133,9 @@
pip install -e . # editable install
pip install . # regular install
- python setup.py # regular install with setuptools
+ or do a `"manual" install`_.
+
4. Optional steps:
* `Running the test suite`_
@@ -162,6 +163,7 @@
.. _"editable" install:
https://pip.pypa.io/en/stable/topics/local-project-installs/
#editable-installs
+.. _"manual" install: docs/dev/repository.html#manual-install
GNU/Linux, BSDs, Unix, Mac OS X, etc.
Modified: trunk/docutils/RELEASE-NOTES.txt
===================================================================
--- trunk/docutils/RELEASE-NOTES.txt 2023-08-23 13:00:10 UTC (rev 9445)
+++ trunk/docutils/RELEASE-NOTES.txt 2023-09-05 23:03:38 UTC (rev 9446)
@@ -102,9 +102,9 @@
.. _reference-label: docs/user/config.html#reference-label
-
* "null" writer: output will change to the empty string in Docutils 0.22.
+
Misc
----
@@ -134,11 +134,12 @@
* Remove mistranslated localizations of the "admonition" directive name in
Docutils 0.22 or later.
- Use the English term (or specific admonitions) instead of
- "aanmaning" (nl), "admonition" (fr), "ammonizione" (it),
- "ermahnung" (de), "exhortación" (es), "formaning" (da), "sciigo" (eo),
- "upomnienie" (pl), "vermaning" (af), to avoid errors in future
- conversions.
+ Use the English term, matching translations introduced in Docutils 0.21,
+ or specific admonitions instead of "aanmaning" (nl),
+ "admonition" (fr), "ammonizione" (it), "ermahnung" (de),
+ "exhortación" (es), "formaning" (da), "sciigo" (eo),
+ "upomnienie" (pl), "vermaning" (af),
+ to avoid errors in future conversions.
.. _front end tools: docs/user/tools.html
.. _input_encoding: docs/user/config.html#input-encoding
@@ -197,10 +198,15 @@
* Use the same CSV format for the ``:header:`` option and the main data
of the "csv-table_" directive.
-* Remove the compatibility hacks `nodes.reprunicode` and `nodes.ensure_str()`.
+* Removed objects:
-* Remove file ``install.py``. See README.txt__ for alternatives.
+ - `nodes.reprunicode` and `nodes.ensure_str()`
+ (not required with Python 3),
+ `utils.Reporter.set_conditions()` (obsolete)
+ `core.Publisher.setup_option_parser()` (internal, obsolete)
+ - File ``install.py``. See README.txt__ for alternatives.
+
.. _csv-table: docs/ref/rst/directives.html#csv-table
__ README.html#installation
Modified: trunk/docutils/docs/dev/release.txt
===================================================================
--- trunk/docutils/docs/dev/release.txt 2023-08-23 13:00:10 UTC (rev 9445)
+++ trunk/docutils/docs/dev/release.txt 2023-09-05 23:03:38 UTC (rev 9446)
@@ -51,8 +51,8 @@
* Generate wheel and source-distribution::
- python3 setup.py sdist
- python3 setup.py bdist_wheel
+ python3 -m pip install build
+ python3 -m build .
* check sdist for html-files in docutils.egg-info.
* Upload wheel and source to test.pypi::
Modified: trunk/docutils/docs/dev/repository.txt
===================================================================
--- trunk/docutils/docs/dev/repository.txt 2023-08-23 13:00:10 UTC (rev 9445)
+++ trunk/docutils/docs/dev/repository.txt 2023-09-05 23:03:38 UTC (rev 9446)
@@ -147,6 +147,8 @@
__ https://pip.pypa.io/en/stable/topics/local-project-installs/
#editable-installs
+
+ .. _manual install:
2. Install "manually".
@@ -189,10 +191,8 @@
ln -s ~/projects/docutils/docutils/tools/docutils-cli.py \
/usr/local/bin/docutils
-3. Do a regular install. Repeat after any change. ::
+3. Do a regular install. Repeat after any change.
- ./setup.py install
-
.. CAUTION::
This method is **not** recommended for day-to-day development!
Modified: trunk/docutils/setup.py
===================================================================
--- trunk/docutils/setup.py 2023-08-23 13:00:10 UTC (rev 9445)
+++ trunk/docutils/setup.py 2023-09-05 23:03:38 UTC (rev 9446)
@@ -117,6 +117,7 @@
'Natural Language :: Finnish',
'Natural Language :: French',
'Natural Language :: Galician',
+ 'Natural Language :: Georgian',
'Natural Language :: German',
'Natural Language :: Hebrew',
'Natural Language :: Italian',
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gr...@us...> - 2023-09-07 08:06:04
|
Revision: 9448
http://sourceforge.net/p/docutils/code/9448
Author: grubert
Date: 2023-09-07 08:05:56 +0000 (Thu, 07 Sep 2023)
Log Message:
-----------
Updated build stystem to use Flit (cf. patch #186 by Adam Turner).
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
Added Paths:
-----------
trunk/docutils/pyproject.toml
Removed Paths:
-------------
trunk/docutils/MANIFEST.in
trunk/docutils/setup.cfg
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2023-09-06 11:10:42 UTC (rev 9447)
+++ trunk/docutils/HISTORY.txt 2023-09-07 08:05:56 UTC (rev 9448)
@@ -19,6 +19,10 @@
* Drop support for Python 3.7 and 3.8.
+* Updated build stystem to use Flit_ (cf. patch #186 by Adam Turner).
+
+ .. _Flit: https://github.com/pypa/flit/
+
* docutils/io.py
- Simpler and more secure `input encoding`_ default behaviour:
Deleted: trunk/docutils/MANIFEST.in
===================================================================
--- trunk/docutils/MANIFEST.in 2023-09-06 11:10:42 UTC (rev 9447)
+++ trunk/docutils/MANIFEST.in 2023-09-07 08:05:56 UTC (rev 9448)
@@ -1,12 +0,0 @@
-include *.txt
-include tox.ini
-include docutils.conf
-recursive-include docutils *
-recursive-include docs *
-recursive-include licenses *
-recursive-include tools *
-recursive-include test *
-exclude test/alltests.out test/record.txt
-prune test/functional/output
-include test/functional/output/README.txt
-global-exclude *.pyc *~ __pycache__ .DS_Store
Added: trunk/docutils/pyproject.toml
===================================================================
--- trunk/docutils/pyproject.toml (rev 0)
+++ trunk/docutils/pyproject.toml 2023-09-07 08:05:56 UTC (rev 9448)
@@ -0,0 +1,154 @@
+# Project configuration file for the "docutils" package (see PEP 518)
+
+# Build with flit (https://flit.pypa.io/)
+[build-system]
+requires = ["flit_core>=3.4,<4"]
+build-backend = "flit_core.buildapi"
+
+# Project metadata
+# cf. https://packaging.python.org/en/latest/specifications/declaring-project-metadata/
+[project]
+
+name = "docutils"
+dynamic = ["version"]
+description = "Docutils -- Python Documentation Utilities"
+readme.text = """
+Docutils is a modular system for processing documentation
+into useful formats, such as HTML, XML, and LaTeX. For
+input Docutils supports reStructuredText, an easy-to-read,
+what-you-see-is-what-you-get plaintext markup syntax.""" # wrap at col 60
+readme.content-type = "text/plain"
+
+urls.Homepage = "https://docutils.sourceforge.io"
+
+license.file = "COPYING.txt"
+
+requires-python = ">=3.9"
+
+# cf. https://pypi.org/trove-classifiers/
+classifiers = [
+ 'Development Status :: 4 - Beta',
+ 'Environment :: Console',
+ 'Intended Audience :: End Users/Desktop',
+ 'Intended Audience :: Other Audience',
+ 'Intended Audience :: Developers',
+ 'Intended Audience :: System Administrators',
+ 'License :: Public Domain',
+ 'License :: OSI Approved :: Python Software Foundation License',
+ 'License :: OSI Approved :: BSD License',
+ 'License :: OSI Approved :: GNU General Public License (GPL)',
+ 'Operating System :: OS Independent',
+ 'Programming Language :: Python :: 3',
+ 'Programming Language :: Python :: 3 :: Only',
+ 'Programming Language :: Python :: 3.9',
+ 'Programming Language :: Python :: 3.10',
+ 'Programming Language :: Python :: 3.11',
+ 'Topic :: Documentation',
+ 'Topic :: Software Development :: Documentation',
+ 'Topic :: Text Processing',
+ 'Natural Language :: English', # main/default language, keep first
+ 'Natural Language :: Afrikaans',
+ 'Natural Language :: Arabic',
+ 'Natural Language :: Catalan',
+ 'Natural Language :: Chinese (Simplified)',
+ 'Natural Language :: Chinese (Traditional)',
+ 'Natural Language :: Czech',
+ 'Natural Language :: Danish',
+ 'Natural Language :: Dutch',
+ 'Natural Language :: Esperanto',
+ 'Natural Language :: Finnish',
+ 'Natural Language :: French',
+ 'Natural Language :: Galician',
+ # 'Natural Language :: Georgian', # currently not listed in trove-classifiers
+ 'Natural Language :: German',
+ 'Natural Language :: Hebrew',
+ 'Natural Language :: Italian',
+ 'Natural Language :: Japanese',
+ 'Natural Language :: Korean',
+ 'Natural Language :: Latvian',
+ 'Natural Language :: Lithuanian',
+ 'Natural Language :: Persian',
+ 'Natural Language :: Polish',
+ 'Natural Language :: Portuguese (Brazilian)',
+ 'Natural Language :: Russian',
+ 'Natural Language :: Slovak',
+ 'Natural Language :: Spanish',
+ 'Natural Language :: Swedish',
+ 'Natural Language :: Ukrainian',
+]
+
+[[project.authors]]
+name = "David Goodger"
+email = "go...@py..."
+
+[[project.maintainers]]
+name = "docutils-develop list"
+email = "doc...@li..."
+
+[project.scripts]
+docutils = "docutils.__main__:main"
+rst2html = "docutils.core:rst2html"
+rst2html4 = "docutils.core:rst2html4"
+rst2html5 = "docutils.core:rst2html5"
+rst2latex = "docutils.core:rst2latex"
+rst2man = "docutils.core:rst2man"
+rst2odt = "docutils.core:rst2odt"
+rst2pseudoxml = "docutils.core:rst2pseudoxml"
+rst2s5 = "docutils.core:rst2s5"
+rst2xetex = "docutils.core:rst2xetex"
+rst2xml = "docutils.core:rst2xml"
+
+
+# Sdist (*.tar.gz) generation
+[tool.flit.sdist]
+
+# not required with ``flit --use-vcs`` (current default)
+# TODO: include generated HTML ?
+# include = [
+ # "*.txt",
+ # "docutils/",
+ # "docs/",
+ # "licenses/",
+ # "test/",
+ # "tools/",
+# ]
+
+# TODO: Recursive globbing (**) is not supported yet (in exclude pattern '**/*~')
+exclude = [
+ "*~",
+ "*/*~",
+ "*.DS_Store",
+ "*/*.DS_Store",
+ "test/alltests.out",
+ "test/record.txt",
+ "test/functional/output",
+]
+
+# Codespell configuration (see https://pypi.org/project/codespell/)
+[tool.codespell]
+skip = [
+ "test",
+ "pep-*.txt",
+ "iso*.txt",
+]
+ignore-words-list = [
+ "ba",
+ "complies",
+ "ede",
+ "fo",
+ "hist",
+ "ist",
+ "ment",
+ "nd",
+ "ned",
+ "ninjs",
+ "ownward",
+ "ream",
+ "ro",
+ "shttp",
+ "ta",
+ "te",
+ "ue",
+ "wee",
+ "windos",
+]
Property changes on: trunk/docutils/pyproject.toml
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Deleted: trunk/docutils/setup.cfg
===================================================================
--- trunk/docutils/setup.cfg 2023-09-06 11:10:42 UTC (rev 9447)
+++ trunk/docutils/setup.cfg 2023-09-07 08:05:56 UTC (rev 9448)
@@ -1,3 +0,0 @@
-[codespell]
-skip = test,pep-*.txt,iso*.txt
-ignore-words-list = ba,complies,ede,fo,hist,ist,ment,nd,ned,ninjs,ownward,ream,ro,shttp,ta,te,ue,wee,windos
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gr...@us...> - 2023-09-26 19:16:02
|
Revision: 9450
http://sourceforge.net/p/docutils/code/9450
Author: grubert
Date: 2023-09-26 19:16:00 +0000 (Tue, 26 Sep 2023)
Log Message:
-----------
remove setup.py
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
Removed Paths:
-------------
trunk/docutils/setup.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2023-09-22 20:06:05 UTC (rev 9449)
+++ trunk/docutils/HISTORY.txt 2023-09-26 19:16:00 UTC (rev 9450)
@@ -20,6 +20,7 @@
* Drop support for Python 3.7 and 3.8.
* Updated build stystem to use Flit_ (cf. patch #186 by Adam Turner).
+ Removed ``setup.py``.
.. _Flit: https://github.com/pypa/flit/
Deleted: trunk/docutils/setup.py
===================================================================
--- trunk/docutils/setup.py 2023-09-22 20:06:05 UTC (rev 9449)
+++ trunk/docutils/setup.py 2023-09-26 19:16:00 UTC (rev 9450)
@@ -1,147 +0,0 @@
-#!/usr/bin/env python3
-# $Id$
-# Copyright: This file has been placed in the public domain.
-
-import sys
-
-try:
- from setuptools import setup
-except ImportError:
- print("""\
-Error: The "setuptools" module, which is required for the
- installation of Docutils, could not be found.
-
- You may install it with `python -m pip install setuptools`
- or from a package called "python-setuptools" (or similar)
- using your system\'s package manager.
-
- Alternatively, install a release from PyPi with
- `python -m pip install docutils`.'
-
- If all this fails, try a "manual install".
- https://docutils.sourceforge.io/docs/dev/repository.html#install-manually
-""")
- sys.exit(1)
-
-
-package_data = {
- 'name': 'docutils',
- 'description': 'Docutils -- Python Documentation Utilities',
- 'long_description': """\
-Docutils is a modular system for processing documentation
-into useful formats, such as HTML, XML, and LaTeX. For
-input Docutils supports reStructuredText, an easy-to-read,
-what-you-see-is-what-you-get plaintext markup syntax.""", # wrap at col 60
- 'url': 'https://docutils.sourceforge.io/',
- 'version': '0.21b.dev',
- 'author': 'David Goodger',
- 'author_email': 'go...@py...',
- 'maintainer': 'docutils-develop list',
- 'maintainer_email': 'doc...@li...',
- 'license': 'public domain, Python, 2-Clause BSD, GPL 3 (see COPYING.txt)',
- 'platforms': 'OS-independent',
- 'python_requires': '>=3.9',
- 'include_package_data': True,
- 'exclude_package_data': {"": ["docutils.conf"]},
- 'package_dir': {
- 'docutils': 'docutils',
- 'docutils.tools': 'tools'
- },
- 'packages': [
- 'docutils',
- 'docutils.languages',
- 'docutils.parsers',
- 'docutils.parsers.rst',
- 'docutils.parsers.rst.directives',
- 'docutils.parsers.rst.include',
- 'docutils.parsers.rst.languages',
- 'docutils.readers',
- 'docutils.transforms',
- 'docutils.utils',
- 'docutils.utils.math',
- 'docutils.writers',
- 'docutils.writers.html4css1',
- 'docutils.writers.html5_polyglot',
- 'docutils.writers.pep_html',
- 'docutils.writers.s5_html',
- 'docutils.writers.s5_html.themes',
- 'docutils.writers.s5_html.themes.default',
- 'docutils.writers.latex2e',
- 'docutils.writers.xetex',
- 'docutils.writers.odf_odt',
- ],
- 'entry_points': {
- 'console_scripts': [
- 'docutils = docutils.__main__:main',
- 'rst2html = docutils.core:rst2html',
- 'rst2html4 = docutils.core:rst2html4',
- 'rst2html5 = docutils.core:rst2html5',
- 'rst2latex = docutils.core:rst2latex',
- 'rst2man = docutils.core:rst2man',
- 'rst2odt = docutils.core:rst2odt',
- 'rst2pseudoxml = docutils.core:rst2pseudoxml',
- 'rst2s5 = docutils.core:rst2s5',
- 'rst2xetex = docutils.core:rst2xetex',
- 'rst2xml = docutils.core:rst2xml',
- ]
- },
- 'classifiers': [
- 'Development Status :: 4 - Beta',
- 'Environment :: Console',
- 'Intended Audience :: End Users/Desktop',
- 'Intended Audience :: Other Audience',
- 'Intended Audience :: Developers',
- 'Intended Audience :: System Administrators',
- 'License :: Public Domain',
- 'License :: OSI Approved :: Python Software Foundation License',
- 'License :: OSI Approved :: BSD License',
- 'License :: OSI Approved :: GNU General Public License (GPL)',
- 'Operating System :: OS Independent',
- 'Programming Language :: Python :: 3',
- 'Programming Language :: Python :: 3.9',
- 'Programming Language :: Python :: 3.10',
- 'Programming Language :: Python :: 3.11',
- 'Topic :: Documentation',
- 'Topic :: Software Development :: Documentation',
- 'Topic :: Text Processing',
- 'Natural Language :: English', # main/default language, keep first
- 'Natural Language :: Afrikaans',
- 'Natural Language :: Arabic',
- 'Natural Language :: Catalan',
- 'Natural Language :: Chinese (Simplified)',
- 'Natural Language :: Chinese (Traditional)',
- 'Natural Language :: Czech',
- 'Natural Language :: Danish',
- 'Natural Language :: Dutch',
- 'Natural Language :: Esperanto',
- 'Natural Language :: Finnish',
- 'Natural Language :: French',
- 'Natural Language :: Galician',
- 'Natural Language :: Georgian',
- 'Natural Language :: German',
- 'Natural Language :: Hebrew',
- 'Natural Language :: Italian',
- 'Natural Language :: Japanese',
- 'Natural Language :: Korean',
- 'Natural Language :: Latvian',
- 'Natural Language :: Lithuanian',
- 'Natural Language :: Persian',
- 'Natural Language :: Polish',
- 'Natural Language :: Portuguese (Brazilian)',
- 'Natural Language :: Russian',
- 'Natural Language :: Slovak',
- 'Natural Language :: Spanish',
- 'Natural Language :: Swedish',
- 'Natural Language :: Ukrainian',
- ],
-}
-"""Distutils setup parameters."""
-
-
-def do_setup():
- # Install data files properly.
- return setup(**package_data)
-
-
-if __name__ == '__main__':
- do_setup()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2023-09-27 00:11:34
|
Revision: 9451
http://sourceforge.net/p/docutils/code/9451
Author: milde
Date: 2023-09-27 00:11:31 +0000 (Wed, 27 Sep 2023)
Log Message:
-----------
Update/complete Catalan translations (patch #203 by Antoni Bella Perez).
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/docutils/languages/ca.py
trunk/docutils/docutils/parsers/rst/languages/ca.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2023-09-26 19:16:00 UTC (rev 9450)
+++ trunk/docutils/HISTORY.txt 2023-09-27 00:11:31 UTC (rev 9451)
@@ -48,6 +48,8 @@
- Add support for Georgian language (patch #204 by Temuri Doghonadze).
+ - Update/complete Catalan translations (patch #203 by Antoni Bella Pérez).
+
* docutils/nodes.py
- Remove compatibility hacks `nodes.reprunicode` and `nodes.ensure_str()`.
Modified: trunk/docutils/docutils/languages/ca.py
===================================================================
--- trunk/docutils/docutils/languages/ca.py 2023-09-26 19:16:00 UTC (rev 9450)
+++ trunk/docutils/docutils/languages/ca.py 2023-09-27 00:11:31 UTC (rev 9451)
@@ -1,9 +1,10 @@
# $Id$
-# Author: Ivan Vilata i Balaguer <iv...@se...>
+# Authors: Ivan Vilata i Balaguer <iv...@se...>;
+# Antoni Bella Pérez <ant...@ya...>
# Copyright: This module has been placed in the public domain.
-# New language mappings are welcome. Before doing a new translation, please
-# read <https://docutils.sourceforge.io/docs/howto/i18n.html>.
+# New language mappings are welcome. Before doing a new translation,
+# please read <https://docutils.sourceforge.io/docs/howto/i18n.html>.
# Two files must be translated for each language: one in docutils/languages,
# the other in docutils/parsers/rst/languages.
@@ -17,17 +18,17 @@
# fixed: language-dependent
'author': 'Autor',
'authors': 'Autors',
- 'organization': 'Organitzaci\u00F3',
- 'address': 'Adre\u00E7a',
+ 'organization': 'Organització',
+ 'address': 'Adreça',
'contact': 'Contacte',
- 'version': 'Versi\u00F3',
- 'revision': 'Revisi\u00F3',
+ 'version': 'Versió',
+ 'revision': 'Revisió',
'status': 'Estat',
'date': 'Data',
'copyright': 'Copyright',
- 'dedication': 'Dedicat\u00F2ria',
+ 'dedication': 'Dedicatòria',
'abstract': 'Resum',
- 'attention': 'Atenci\u00F3!',
+ 'attention': 'Atenció!',
'caution': 'Compte!',
'danger': 'PERILL!',
'error': 'Error',
@@ -35,7 +36,7 @@
'important': 'Important',
'note': 'Nota',
'tip': 'Consell',
- 'warning': 'Av\u00EDs',
+ 'warning': 'Avís',
'contents': 'Contingut'}
"""Mapping of node class name to label text."""
@@ -43,15 +44,15 @@
# language-dependent: fixed
'autor': 'author',
'autors': 'authors',
- 'organitzaci\u00F3': 'organization',
- 'adre\u00E7a': 'address',
+ 'organització': 'organization',
+ 'adreça': 'address',
'contacte': 'contact',
- 'versi\u00F3': 'version',
- 'revisi\u00F3': 'revision',
+ 'versió': 'version',
+ 'revisió': 'revision',
'estat': 'status',
'data': 'date',
'copyright': 'copyright',
- 'dedicat\u00F2ria': 'dedication',
+ 'dedicatòria': 'dedication',
'resum': 'abstract'}
"""Catalan (lowcased) to canonical name mapping for bibliographic fields."""
Modified: trunk/docutils/docutils/parsers/rst/languages/ca.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/languages/ca.py 2023-09-26 19:16:00 UTC (rev 9450)
+++ trunk/docutils/docutils/parsers/rst/languages/ca.py 2023-09-27 00:11:31 UTC (rev 9451)
@@ -1,9 +1,10 @@
# $Id$
-# Author: Ivan Vilata i Balaguer <iv...@se...>
+# Authors: Ivan Vilata i Balaguer <iv...@se...>;
+# Antoni Bella Pérez <ant...@ya...>
# Copyright: This module has been placed in the public domain.
-# New language mappings are welcome. Before doing a new translation, please
-# read <https://docutils.sourceforge.io/docs/howto/i18n.html>.
+# New language mappings are welcome. Before doing a new translation,
+# please read <https://docutils.sourceforge.io/docs/howto/i18n.html>.
# Two files must be translated for each language: one in docutils/languages,
# the other in docutils/parsers/rst/languages.
@@ -17,9 +18,8 @@
directives = {
# language-dependent: fixed
- 'atenci\u00F3': 'attention',
+ 'atenció': 'attention',
'compte': 'caution',
- 'code (translation required)': 'code',
'perill': 'danger',
'error': 'error',
'suggeriment': 'hint',
@@ -26,27 +26,26 @@
'important': 'important',
'nota': 'note',
'consell': 'tip',
- 'av\u00EDs': 'warning',
+ 'avís': 'warning',
'advertiment': 'admonition',
'nota-al-marge': 'sidebar',
'nota-marge': 'sidebar',
'tema': 'topic',
- 'bloc-de-l\u00EDnies': 'line-block',
- 'bloc-l\u00EDnies': 'line-block',
+ 'bloc-de-línies': 'line-block',
+ 'bloc-línies': 'line-block',
'literal-analitzat': 'parsed-literal',
- 'r\u00FAbrica': 'rubric',
- 'ep\u00EDgraf': 'epigraph',
+ 'codi': 'code',
+ 'bloc-de-codi': 'code',
+ 'matemàtiques': 'math',
+ 'rúbrica': 'rubric',
+ 'epígraf': 'epigraph',
'sumari': 'highlights',
'cita-destacada': 'pull-quote',
'compost': 'compound',
- 'container (translation required)': 'container',
- # 'questions': 'questions',
+ 'contenidor': 'container',
'taula': 'table',
'taula-csv': 'csv-table',
'taula-llista': 'list-table',
- # 'qa': 'questions',
- # 'faq': 'questions',
- 'math (translation required)': 'math',
'meta': 'meta',
# 'imagemap': 'imagemap',
'imatge': 'image',
@@ -54,21 +53,21 @@
'inclou': 'include',
'incloure': 'include',
'cru': 'raw',
- 'reempla\u00E7a': 'replace',
- 'reempla\u00E7ar': 'replace',
+ 'reemplaça': 'replace',
+ 'reemplaçar': 'replace',
'unicode': 'unicode',
'data': 'date',
'classe': 'class',
'rol': 'role',
- 'default-role (translation required)': 'default-role',
- 'title (translation required)': 'title',
+ 'rol-predeterminat': 'default-role',
+ 'títol': 'title',
'contingut': 'contents',
'numsec': 'sectnum',
- 'numeraci\u00F3-de-seccions': 'sectnum',
- 'numeraci\u00F3-seccions': 'sectnum',
- 'cap\u00E7alera': 'header',
- 'peu-de-p\u00E0gina': 'footer',
- 'peu-p\u00E0gina': 'footer',
+ 'numeració-de-seccions': 'sectnum',
+ 'numeració-seccions': 'sectnum',
+ 'capçalera': 'header',
+ 'peu-de-pàgina': 'footer',
+ 'peu-pàgina': 'footer',
# 'footnotes': 'footnotes',
# 'citations': 'citations',
'notes-amb-destinacions': 'target-notes',
@@ -80,47 +79,48 @@
roles = {
# language-dependent: fixed
'abreviatura': 'abbreviation',
- 'abreviaci\u00F3': 'abbreviation',
+ 'abreviació': 'abbreviation',
'abrev': 'abbreviation',
'ab': 'abbreviation',
- 'acr\u00F2nim': 'acronym',
+ 'acrònim': 'acronym',
'ac': 'acronym',
- 'code (translation required)': 'code',
- '\u00EDndex': 'index',
- 'i': 'index',
- 'sub\u00EDndex': 'subscript',
+ 'codi': 'code',
+ 'èmfasi': 'emphasis',
+ 'literal': 'literal',
+ 'matemàtiques': 'math',
+ 'referència-a-pep': 'pep-reference',
+ 'referència-pep': 'pep-reference',
+ 'pep': 'pep-reference',
+ 'referència-a-rfc': 'rfc-reference',
+ 'referència-rfc': 'rfc-reference',
+ 'rfc': 'rfc-reference',
+ 'destacat': 'strong',
+ 'subíndex': 'subscript',
'sub': 'subscript',
- 'super\u00EDndex': 'superscript',
+ 'superíndex': 'superscript',
'sup': 'superscript',
- 'refer\u00E8ncia-a-t\u00EDtol': 'title-reference',
- 'refer\u00E8ncia-t\u00EDtol': 'title-reference',
- 't\u00EDtol': 'title-reference',
+ 'referència-a-títol': 'title-reference',
+ 'referència-títol': 'title-reference',
+ 'títol': 'title-reference',
't': 'title-reference',
- 'refer\u00E8ncia-a-pep': 'pep-reference',
- 'refer\u00E8ncia-pep': 'pep-reference',
- 'pep': 'pep-reference',
- 'refer\u00E8ncia-a-rfc': 'rfc-reference',
- 'refer\u00E8ncia-rfc': 'rfc-reference',
- 'rfc': 'rfc-reference',
- '\u00E8mfasi': 'emphasis',
- 'destacat': 'strong',
- 'literal': 'literal',
- 'math (translation required)': 'math',
- 'refer\u00E8ncia-amb-nom': 'named-reference',
- 'refer\u00E8ncia-nom': 'named-reference',
- 'refer\u00E8ncia-an\u00F2nima': 'anonymous-reference',
- 'refer\u00E8ncia-a-nota-al-peu': 'footnote-reference',
- 'refer\u00E8ncia-nota-al-peu': 'footnote-reference',
- 'refer\u00E8ncia-a-cita': 'citation-reference',
- 'refer\u00E8ncia-cita': 'citation-reference',
- 'refer\u00E8ncia-a-substituci\u00F3': 'substitution-reference',
- 'refer\u00E8ncia-substituci\u00F3': 'substitution-reference',
- 'destinaci\u00F3': 'target',
- 'refer\u00E8ncia-a-uri': 'uri-reference',
- 'refer\u00E8ncia-uri': 'uri-reference',
+ 'cru': 'raw',
+ # the following roles are not implemented in Docutils
+ 'índex': 'index',
+ 'i': 'index',
+ 'referència-anònima': 'anonymous-reference',
+ 'referència-a-cita': 'citation-reference',
+ 'referència-cita': 'citation-reference',
+ 'referència-a-nota-al-peu': 'footnote-reference',
+ 'referència-nota-al-peu': 'footnote-reference',
+ 'referència-amb-nom': 'named-reference',
+ 'referència-nom': 'named-reference',
+ 'referència-a-substitució': 'substitution-reference',
+ 'referència-substitució': 'substitution-reference',
+ 'referència-a-uri': 'uri-reference',
+ 'referència-uri': 'uri-reference',
'uri': 'uri-reference',
'url': 'uri-reference',
- 'cru': 'raw',
+ 'destinació': 'target',
}
"""Mapping of Catalan role names to canonical role names for interpreted text.
"""
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2023-11-10 08:45:43
|
Revision: 9468
http://sourceforge.net/p/docutils/code/9468
Author: milde
Date: 2023-11-10 08:45:38 +0000 (Fri, 10 Nov 2023)
Log Message:
-----------
Update functional tests for HTML
Extend SVG tests and bring them up to date.
Test with both, HTML4 and HTML5.
Minor corrections and edits elsewhere.
Modified Paths:
--------------
trunk/docutils/docs/user/rst/images/biohazard-bitmap-scaling.svg
trunk/docutils/docs/user/rst/images/biohazard-bitmap.svg
trunk/docutils/test/functional/expected/standalone_rst_html4css1.html
trunk/docutils/test/functional/expected/standalone_rst_html5.html
trunk/docutils/test/functional/input/data/html5-features.txt
trunk/docutils/test/functional/input/data/svg_images.txt
trunk/docutils/test/functional/input/data/swf_images.txt
trunk/docutils/test/functional/input/standalone_rst_html5.txt
Added Paths:
-----------
trunk/docutils/test/functional/input/data/interactive-button.svg
trunk/docutils/test/functional/input/data/object-with-hyperlink.svg
Modified: trunk/docutils/docs/user/rst/images/biohazard-bitmap-scaling.svg
===================================================================
--- trunk/docutils/docs/user/rst/images/biohazard-bitmap-scaling.svg 2023-11-10 08:45:23 UTC (rev 9467)
+++ trunk/docutils/docs/user/rst/images/biohazard-bitmap-scaling.svg 2023-11-10 08:45:38 UTC (rev 9468)
@@ -2,50 +2,36 @@
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:cc="http://creativecommons.org/ns#"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:xlink="http://www.w3.org/1999/xlink"
version="1.1"
- viewBox="0 0 16 16"
- width="100%"
+ viewBox="0 0 16 16"
+ width="100%"
height="100%"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:svg="http://www.w3.org/2000/svg"
id="svg2">
- <metadata
- id="metadata8">
- <rdf:RDF>
- <cc:Work
- rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:title></dc:title>
- </cc:Work>
- </rdf:RDF>
- </metadata>
<defs
id="defs6" />
- <image
- xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAIRJREFU
-OI2lUkEOwCAIa83+/+XusGCQIWOxF1GhUICSEEFSkvj1BgCjEwwAkkjylW0hyByyBP5+dR2zqrYE
-ux5kvq8e/AVtCh39HlbhqIIlcafdx+jxFezs2BY3fDkxO0lVezElnGA2MWrzmxftkiASxZIjjiWk
-BNlYd6NeJCyzLVbZ/92om331AFqcoAAAAABJRU5ErkJggg==
-"
- x="4.9541664"
- y="-5.2426963"
- width="11.322034"
- height="9.3559322"
- transform="matrix(0.77695327,0.62955828,-0.62955828,0.77695327,0,0)"
- id="image10" />
+ <a
+ id="a115"
+ xlink:href="#svg-images"
+ transform="translate(-0.51420152,0.95439357)">
+ <image
+ xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAIRJREFU OI2lUkEOwCAIa83+/+XusGCQIWOxF1GhUICSEEFSkvj1BgCjEwwAkkjylW0hyByyBP5+dR2zqrYE ux5kvq8e/AVtCh39HlbhqIIlcafdx+jxFezs2BY3fDkxO0lVezElnGA2MWrzmxftkiASxZIjjiWk BNlYd6NeJCyzLVbZ/92om331AFqcoAAAAABJRU5ErkJggg== "
+ x="5"
+ y="-5"
+ width="10"
+ height="10"
+ transform="rotate(39.01754)"
+ id="image10" />
+ </a>
<text
- x="0.40677962"
- y="15.186441"
+ x="0"
+ y="16"
id="text2987"
xml:space="preserve"
- style="font-size:4px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:DejaVu Sans;-inkscape-font-specification:DejaVu Sans"><tspan
- x="0.40677962"
- y="15.186441"
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4px;line-height:125%;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans';letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none"><tspan
+ x="0"
+ y="16"
id="tspan2989">turned</tspan></text>
</svg>
Modified: trunk/docutils/docs/user/rst/images/biohazard-bitmap.svg
===================================================================
--- trunk/docutils/docs/user/rst/images/biohazard-bitmap.svg 2023-11-10 08:45:23 UTC (rev 9467)
+++ trunk/docutils/docs/user/rst/images/biohazard-bitmap.svg 2023-11-10 08:45:38 UTC (rev 9468)
@@ -2,49 +2,35 @@
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:cc="http://creativecommons.org/ns#"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:xlink="http://www.w3.org/1999/xlink"
version="1.1"
width="16"
height="16"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:svg="http://www.w3.org/2000/svg"
id="svg2">
- <metadata
- id="metadata8">
- <rdf:RDF>
- <cc:Work
- rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:title></dc:title>
- </cc:Work>
- </rdf:RDF>
- </metadata>
<defs
id="defs6" />
- <image
- xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAIRJREFU
-OI2lUkEOwCAIa83+/+XusGCQIWOxF1GhUICSEEFSkvj1BgCjEwwAkkjylW0hyByyBP5+dR2zqrYE
-ux5kvq8e/AVtCh39HlbhqIIlcafdx+jxFezs2BY3fDkxO0lVezElnGA2MWrzmxftkiASxZIjjiWk
-BNlYd6NeJCyzLVbZ/92om331AFqcoAAAAABJRU5ErkJggg==
-"
- x="4.9541664"
- y="-5.2426963"
- width="11.322034"
- height="9.3559322"
- transform="matrix(0.77695327,0.62955828,-0.62955828,0.77695327,0,0)"
- id="image10" />
+ <a
+ id="a115"
+ xlink:href="#svg-images"
+ transform="translate(-0.51420152,0.95439357)">
+ <image
+ xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAIRJREFU OI2lUkEOwCAIa83+/+XusGCQIWOxF1GhUICSEEFSkvj1BgCjEwwAkkjylW0hyByyBP5+dR2zqrYE ux5kvq8e/AVtCh39HlbhqIIlcafdx+jxFezs2BY3fDkxO0lVezElnGA2MWrzmxftkiASxZIjjiWk BNlYd6NeJCyzLVbZ/92om331AFqcoAAAAABJRU5ErkJggg== "
+ x="5"
+ y="-5"
+ width="10"
+ height="10"
+ transform="rotate(39.01754)"
+ id="image10" />
+ </a>
<text
- x="0.40677962"
- y="15.186441"
+ x="0"
+ y="16"
id="text2987"
xml:space="preserve"
- style="font-size:4px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:DejaVu Sans;-inkscape-font-specification:DejaVu Sans"><tspan
- x="0.40677962"
- y="15.186441"
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4px;line-height:125%;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans';letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none"><tspan
+ x="0"
+ y="16"
id="tspan2989">turned</tspan></text>
</svg>
Modified: trunk/docutils/test/functional/expected/standalone_rst_html4css1.html
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_html4css1.html 2023-11-10 08:45:23 UTC (rev 9467)
+++ trunk/docutils/test/functional/expected/standalone_rst_html4css1.html 2023-11-10 08:45:38 UTC (rev 9468)
@@ -1276,74 +1276,63 @@
or Postscript formats for vector graphics instead). Rendering behaviour
varies, depending on the SVG image itself, the method used to put the
image in the document, and the viewing agent.</p>
+<div class="figure align-center">
+<object data="../../../docs/user/rst/images/title-scaling.svg" style="width: 40%;" type="image/svg+xml">../../../docs/user/rst/images/title-scaling.svg</object>
+<p class="caption">Figure with image occupying 40% of the line width.</p>
+<div class="legend">
+The <cite>viewBox</cite> attribute in the image file enables scaling
+also in <tt class="docutils literal"><object></tt> and <tt class="docutils literal"><svg></tt> nodes.</div>
+</div>
<p>All up-to-date HTML browsers support SVG, however not all do this fully
-and in the same manner. Many older versions, especially IE < 9, have
+and in the same manner. Some older browsers, especially IE < 9, have
deficiencies or require plug-ins (i.e. don't support the <tt class="docutils literal"><img></tt> tag).
-The <cite>html4css1</cite> writer includes SVG images using <tt class="docutils literal"><object></tt> tags,
-the <cite>html5</cite> writer uses <tt class="docutils literal"><img></tt> tags.</p>
-<p>If the image is wrapped in <tt class="docutils literal"><object></tt> or <tt class="docutils literal"><svg></tt> tags, it depends on the
-"viewBox" declaration inside the image's root <tt class="docutils literal"><svg></tt> element whether an
-SVG image is scaled or clipped/padded. Images wrapped in <tt class="docutils literal"><img></tt> are
-always scaled.</p>
-<ul>
-<li><object class="first align-right" data="../../../docs/user/rst/images/title-scaling.svg" style="width: 50%;" type="image/svg+xml">../../../docs/user/rst/images/title-scaling.svg</object>
-<p>An image occupying 50% of the line width. The "viewBox" attribute in
-the image file enables auto-scaling also in <tt class="docutils literal"><object></tt> tags and
-embedded SVG.</p>
-</li>
-<li><object class="first align-right" data="../../../docs/user/rst/images/title.svg" style="width: 50%; height: 15px;" type="image/svg+xml">../../../docs/user/rst/images/title.svg</object>
-<p>An image without "viewBox" in a box 50% wide and 15 pixles high.
-This image is scaled, if wrapped in an <tt class="docutils literal"><img></tt> tag but clipped in
-an <tt class="docutils literal"><object></tt> tag or within SVG.</p>
-</li>
-<li><object class="first align-right" data="../../../docs/user/rst/images/title-scaling.svg" style="width: 50%; height: 1.5em;" type="image/svg+xml">../../../docs/user/rst/images/title-scaling.svg</object>
-<p>A right aligned image with "viewBox", 50% wide and 1.5 em high.
-(SVG images keep the aspect ratio unless the "preserveAspectRatio"
-attribute is <tt class="docutils literal">"none"</tt>.)</p>
-</li>
-<li><p class="first">An inline image <object data="../../../docs/user/rst/images/biohazard-scaling.svg" style="height: 0.8em;" type="image/svg+xml">inline-svg</object> scaled to a height of 0.8 em.</p>
-</li>
-<li><object class="first align-right" data="../../../docs/user/rst/images/biohazard-scaling.svg" style="height: 1em;" type="image/svg+xml">../../../docs/user/rst/images/biohazard-scaling.svg</object>
-<p>An image 1 em high, right aligned:</p>
-</li>
-<li><p class="first">An image 5 mm x 5 mm, centred, with hyperlink reference:</p>
-<a class="reference internal image-reference" href="#svg-images"><object class="align-center" data="../../../docs/user/rst/images/biohazard-scaling.svg" style="width: 5mm; height: 5mm;" type="image/svg+xml">../../../docs/user/rst/images/biohazard-scaling.svg</object></a>
-</li>
-<li><object class="first align-right" data="../../../docs/user/rst/images/biohazard.svg" style="width: 4cm; height: 2em;" type="image/svg+xml">../../../docs/user/rst/images/biohazard.svg</object>
-<p>An image without "viewBox" in a 4 cm x 2 em box.</p>
-</li>
-</ul>
-<p>Older versions of <cite>webkit</cite> based browsers (chromium, safari, midori,
+Older versions of <cite>webkit</cite> based browsers (chromium, safari, midori,
konqueror) support the <tt class="docutils literal"><img></tt> tag but don't display contained bitmap
images.</p>
-<ul>
-<li><object class="first align-right" data="../../../docs/user/rst/images/biohazard-bitmap.svg" style="width: 3em;" type="image/svg+xml">../../../docs/user/rst/images/biohazard-bitmap.svg</object>
-<p>A small SVG image with embedded bitmap, The <tt class="docutils literal">:width:</tt> is set to 3 em
-in the rST source. Does not scale if wrapped in <tt class="docutils literal"><object></tt> tags
-because there is no "viewBox" attribute.</p>
-</li>
-<li><object class="first align-right" data="../../../docs/user/rst/images/biohazard-bitmap-scaling.svg" style="width: 3em;" type="image/svg+xml">../../../docs/user/rst/images/biohazard-bitmap-scaling.svg</object>
-<p>An SVG image with embedded bitmap and "viewBox", 3 em wide.</p>
-</li>
-</ul>
-<p>SVG images can also be put in figures:</p>
-<blockquote>
-<div class="figure align-center">
-<object data="../../../docs/user/rst/images/title-scaling.svg" style="width: 290px; height: 28px;" type="image/svg+xml">reStructuredText, the markup syntax</object>
-<p class="caption">SVG image in a figure.</p>
+<p>The "html4css1" writer includes SVG images using <tt class="docutils literal"><object></tt> tags,
+the "html5" writer uses <tt class="docutils literal"><img></tt> tags.</p>
+<p>If an image is wrapped in <tt class="docutils literal"><object></tt> or <tt class="docutils literal"><svg></tt> tags, it
+depends on the <cite>viewBox</cite> declaration inside the image's root
+<tt class="docutils literal"><svg></tt> element whether it is scaled or clipped/padded.
+Images wrapped in <tt class="docutils literal"><img></tt> are always scaled.</p>
+<p>SVG images with <cite>viewBox</cite> keep the aspect ratio unless the
+<cite>preserveAspectRatio</cite> attribute is <tt class="docutils literal">"none"</tt>.
+The following two images are, 40% wide and 1.2 em high:</p>
+<object class="align-left" data="../../../docs/user/rst/images/title-scaling.svg" style="width: 40%; height: 1.2em;" type="image/svg+xml">../../../docs/user/rst/images/title-scaling.svg</object>
+<p>Image with <cite>viewBox</cite>.</p>
+<object class="align-left" data="../../../docs/user/rst/images/title.svg" style="width: 40%; height: 1.2em;" type="image/svg+xml">../../../docs/user/rst/images/title.svg</object>
+<p>Image without <cite>viewBox</cite>.
+This image is scaled, in an <tt class="docutils literal"><img></tt> node
+but clipped in an <tt class="docutils literal"><object></tt> or SVG <tt class="docutils literal"><image></tt> node.</p>
+<object class="align-left" data="../../../docs/user/rst/images/biohazard-scaling.svg" style="height: 1.2em;" type="image/svg+xml">../../../docs/user/rst/images/biohazard-scaling.svg</object>
+<p>Image with <cite>viewBox</cite>, 1.2 em high, left aligned and <object data="../../../docs/user/rst/images/biohazard-scaling.svg" style="height: 1.2em;" type="image/svg+xml">inline-svg</object> inline.</p>
+<a class="reference internal image-reference" href="#svg-images"><object class="align-left" data="../../../docs/user/rst/images/biohazard-scaling.svg" style="width: 15mm; height: 5mm;" type="image/svg+xml">../../../docs/user/rst/images/biohazard-scaling.svg</object></a>
+<p>Image with <cite>viewBox</cite>, 5 mm x 15 mm, with hyperlink reference set in rST.</p>
+<object class="align-left" data="../../../docs/user/rst/images/biohazard.svg" style="width: 15mm; height: 5mm;" type="image/svg+xml">../../../docs/user/rst/images/biohazard.svg</object>
+<p>Image without <cite>viewBox</cite>, 5 mm x 15 mm.</p>
+<object class="align-left" data="../../../docs/user/rst/images/biohazard-bitmap-scaling.svg" style="width: 2em;" type="image/svg+xml">../../../docs/user/rst/images/biohazard-bitmap-scaling.svg</object>
+<p>Image with embedded bitmap, hyperlink, and <cite>viewBox</cite>, 2 em wide.</p>
+<object class="align-left" data="../../../docs/user/rst/images/biohazard-bitmap.svg" style="width: 2em;" type="image/svg+xml">../../../docs/user/rst/images/biohazard-bitmap.svg</object>
+<p>Image with embedded bitmap and hyperlink, without <cite>viewBox</cite>.
+Does not scale in <tt class="docutils literal"><object></tt> node.</p>
+<object class="align-left" data="../input/data/object-with-hyperlink.svg" style="width: 2.4em;" type="image/svg+xml">../input/data/object-with-hyperlink.svg</object>
+<a class="reference external image-reference" href="http://oreillymedia.github.io/svg-essentials-examples/ch14/animated_clock_js.svg"><object class="align-right" data="http://oreillymedia.github.io/svg-essentials-examples/ch14/animated_clock_js.svg" style="height: 3em;" type="image/svg+xml">[animated clock]</object></a>
+<p>Hyperlinks and script actions attached to SVG elements work in images
+included as <tt class="docutils literal"><object></tt> but fail in images included as <tt class="docutils literal"><img></tt>.
+Hyperlinks specified in the rST (<tt class="docutils literal">:target:</tt> directive option) always
+work. Due to security/privacy considerations, browsers may block
+<tt class="docutils literal"><object></tt> data from 3rd party sources.</p>
</div>
-</blockquote>
-</div>
<div class="section" id="swf-images">
<h2><a class="toc-backref" href="#toc-entry-44">2.25 SWF Images</a></h2>
-<p>Shockwave Flash is an image/movie format that most modern web browsers
-support via a plugin. It is sometimes blocked due to privacy/security
-concerns.</p>
+<p>The "Shockwave Flash" image/movie format requires a browser plugin.
+It is sometimes blocked due to privacy/security concerns and widely
+replaced by SVG and native video support in HTML5.</p>
<p>Images with extension <tt class="docutils literal">.swf</tt> are placed inside <object> elements.
For complete control over display options use raw HTML.</p>
<object class="align-left" data="../../../docs/user/rst/images/biohazard.swf" style="width: 4cm; height: 2em;" type="application/x-shockwave-flash">[biohazard.swf]</object>
<p>An SWF image in a 4 cm x 2 em box, left aligned.</p>
-<p>An inline SWF image <object data="../../../docs/user/rst/images/biohazard.swf" style="width: 0.8em; height: 0.8em;" type="application/x-shockwave-flash">inline-swf</object> scaled to 0.8 em x 0.8 em.</p>
+<p>An inline SWF image <object data="../../../docs/user/rst/images/biohazard.swf" style="width: 0.8em; height: 0.8em;" type="application/x-shockwave-flash">[biohazard.swf]</object> scaled to 0.8 em x 0.8 em.</p>
</div>
</div>
<div class="section" id="error-handling">
Modified: trunk/docutils/test/functional/expected/standalone_rst_html5.html
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_html5.html 2023-11-10 08:45:23 UTC (rev 9467)
+++ trunk/docutils/test/functional/expected/standalone_rst_html5.html 2023-11-10 08:45:38 UTC (rev 9468)
@@ -156,9 +156,10 @@
</li>
<li><p><a class="reference internal" href="#text-level-semantics" id="toc-entry-51"><span class="sectnum">3.3 </span>Text-Level Semantics</a></p></li>
<li><p><a class="reference internal" href="#indicating-edits" id="toc-entry-52"><span class="sectnum">3.4 </span>Indicating Edits</a></p></li>
+<li><p><a class="reference internal" href="#svg-images" id="toc-entry-53"><span class="sectnum">3.5 </span>SVG Images</a></p></li>
</ul>
</li>
-<li><p><a class="reference internal" href="#error-handling" id="toc-entry-53"><span class="sectnum">4 </span>Error Handling</a></p></li>
+<li><p><a class="reference internal" href="#error-handling" id="toc-entry-54"><span class="sectnum">4 </span>Error Handling</a></p></li>
</ul>
</nav>
<section id="structural-elements">
@@ -553,29 +554,29 @@
<h3><a class="toc-backref" href="#toc-entry-22" role="doc-backlink"><span class="sectnum">2.14 </span>Directives</a></h3>
<nav class="contents local" id="contents">
<ul class="auto-toc simple">
-<li><p><a class="reference internal" href="#document-parts" id="toc-entry-54"><span class="sectnum">2.14.1 </span>Document Parts</a></p></li>
-<li><p><a class="reference internal" href="#images-and-figures" id="toc-entry-55"><span class="sectnum">2.14.2 </span>Images and Figures</a></p></li>
-<li><p><a class="reference internal" href="#tables" id="toc-entry-56"><span class="sectnum">2.14.3 </span>Tables</a></p></li>
-<li><p><a class="reference internal" href="#admonitions" id="toc-entry-57"><span class="sectnum">2.14.4 </span>Admonitions</a></p></li>
-<li><p><a class="reference internal" href="#topics-sidebars-and-rubrics" id="toc-entry-58"><span class="sectnum">2.14.5 </span>Topics, Sidebars, and Rubrics</a></p></li>
-<li><p><a class="reference internal" href="#target-footnotes" id="toc-entry-59"><span class="sectnum">2.14.6 </span>Target Footnotes</a></p></li>
-<li><p><a class="reference internal" href="#replacement-text" id="toc-entry-60"><span class="sectnum">2.14.7 </span>Replacement Text</a></p></li>
-<li><p><a class="reference internal" href="#compound-paragraph" id="toc-entry-61"><span class="sectnum">2.14.8 </span>Compound Paragraph</a></p></li>
-<li><p><a class="reference internal" href="#parsed-literal-blocks" id="toc-entry-62"><span class="sectnum">2.14.9 </span>Parsed Literal Blocks</a></p></li>
-<li><p><a class="reference internal" href="#code" id="toc-entry-63"><span class="sectnum">2.14.10 </span>Code</a></p></li>
-<li><p><a class="reference internal" href="#meta" id="toc-entry-64"><span class="sectnum">2.14.11 </span>Meta</a></p></li>
+<li><p><a class="reference internal" href="#document-parts" id="toc-entry-55"><span class="sectnum">2.14.1 </span>Document Parts</a></p></li>
+<li><p><a class="reference internal" href="#images-and-figures" id="toc-entry-56"><span class="sectnum">2.14.2 </span>Images and Figures</a></p></li>
+<li><p><a class="reference internal" href="#tables" id="toc-entry-57"><span class="sectnum">2.14.3 </span>Tables</a></p></li>
+<li><p><a class="reference internal" href="#admonitions" id="toc-entry-58"><span class="sectnum">2.14.4 </span>Admonitions</a></p></li>
+<li><p><a class="reference internal" href="#topics-sidebars-and-rubrics" id="toc-entry-59"><span class="sectnum">2.14.5 </span>Topics, Sidebars, and Rubrics</a></p></li>
+<li><p><a class="reference internal" href="#target-footnotes" id="toc-entry-60"><span class="sectnum">2.14.6 </span>Target Footnotes</a></p></li>
+<li><p><a class="reference internal" href="#replacement-text" id="toc-entry-61"><span class="sectnum">2.14.7 </span>Replacement Text</a></p></li>
+<li><p><a class="reference internal" href="#compound-paragraph" id="toc-entry-62"><span class="sectnum">2.14.8 </span>Compound Paragraph</a></p></li>
+<li><p><a class="reference internal" href="#parsed-literal-blocks" id="toc-entry-63"><span class="sectnum">2.14.9 </span>Parsed Literal Blocks</a></p></li>
+<li><p><a class="reference internal" href="#code" id="toc-entry-64"><span class="sectnum">2.14.10 </span>Code</a></p></li>
+<li><p><a class="reference internal" href="#meta" id="toc-entry-65"><span class="sectnum">2.14.11 </span>Meta</a></p></li>
</ul>
</nav>
<p>These are just a sample of the many reStructuredText Directives. For
others, please see <a class="reference external" href="https://docutils.sourceforge.io/docs/ref/rst/directives.html">reStructuredText Directives</a> <a class="brackets" href="#footnote-14" id="footnote-reference-28" role="doc-noteref"><span class="fn-bracket">[</span>14<span class="fn-bracket">]</span></a>.</p>
<section id="document-parts">
-<h4><a class="toc-backref" href="#toc-entry-54" role="doc-backlink"><span class="sectnum">2.14.1 </span>Document Parts</a></h4>
+<h4><a class="toc-backref" href="#toc-entry-55" role="doc-backlink"><span class="sectnum">2.14.1 </span>Document Parts</a></h4>
<p>An example of the "contents" directive can be seen above this section
(a local, untitled table of <a class="reference internal" href="#contents">contents</a>) and at the beginning of the
document (a document-wide <a class="reference internal" href="#table-of-contents">table of contents</a>).</p>
</section>
<section id="images-and-figures">
-<h4><a class="toc-backref" href="#toc-entry-55" role="doc-backlink"><span class="sectnum">2.14.2 </span>Images and Figures</a></h4>
+<h4><a class="toc-backref" href="#toc-entry-56" role="doc-backlink"><span class="sectnum">2.14.2 </span>Images and Figures</a></h4>
<p>An image directive (also clickable -- a hyperlink reference):</p>
<a class="reference internal image-reference" href="#directives"><img alt="../../../docs/user/rst/images/title.png" class="class1 class2" src="../../../docs/user/rst/images/title.png" style="width: 70%;" /></a>
<p>Image with multiple IDs:</p>
@@ -669,7 +670,7 @@
upon the style sheet and the browser or rendering software used.</p>
</section>
<section id="tables">
-<h4><a class="toc-backref" href="#toc-entry-56" role="doc-backlink"><span class="sectnum">2.14.3 </span>Tables</a></h4>
+<h4><a class="toc-backref" href="#toc-entry-57" role="doc-backlink"><span class="sectnum">2.14.3 </span>Tables</a></h4>
<p>Tables may be given titles and additional arguments with the <em>table</em>
directive:</p>
<table class="align-left">
@@ -751,7 +752,7 @@
</table>
</section>
<section id="admonitions">
-<h4><a class="toc-backref" href="#toc-entry-57" role="doc-backlink"><span class="sectnum">2.14.4 </span>Admonitions</a></h4>
+<h4><a class="toc-backref" href="#toc-entry-58" role="doc-backlink"><span class="sectnum">2.14.4 </span>Admonitions</a></h4>
<aside class="admonition attention">
<p class="admonition-title">Attention!</p>
<p>Directives at large.</p>
@@ -800,7 +801,7 @@
</aside>
</section>
<section id="topics-sidebars-and-rubrics">
-<h4><a class="toc-backref" href="#toc-entry-58" role="doc-backlink"><span class="sectnum">2.14.5 </span>Topics, Sidebars, and Rubrics</a></h4>
+<h4><a class="toc-backref" href="#toc-entry-59" role="doc-backlink"><span class="sectnum">2.14.5 </span>Topics, Sidebars, and Rubrics</a></h4>
<p><em>Sidebars</em> are like miniature, parallel documents.</p>
<aside class="sidebar">
<p class="sidebar-title">Optional Sidebar Title</p>
@@ -824,7 +825,7 @@
allowed (e.g. inside a directive).</p>
</section>
<section id="target-footnotes">
-<h4><a class="toc-backref" href="#toc-entry-59" role="doc-backlink"><span class="sectnum">2.14.6 </span>Target Footnotes</a></h4>
+<h4><a class="toc-backref" href="#toc-entry-60" role="doc-backlink"><span class="sectnum">2.14.6 </span>Target Footnotes</a></h4>
<aside class="footnote-list brackets">
<aside class="footnote brackets" id="footnote-7" role="doc-footnote">
<span class="label"><span class="fn-bracket">[</span>7<span class="fn-bracket">]</span></span>
@@ -882,11 +883,11 @@
</aside>
</section>
<section id="replacement-text">
-<h4><a class="toc-backref" href="#toc-entry-60" role="doc-backlink"><span class="sectnum">2.14.7 </span>Replacement Text</a></h4>
+<h4><a class="toc-backref" href="#toc-entry-61" role="doc-backlink"><span class="sectnum">2.14.7 </span>Replacement Text</a></h4>
<p>I recommend you try <a class="reference external" href="http://www.python.org/">Python, <em>the</em> best language around</a> <a class="brackets" href="#footnote-7" id="footnote-reference-20" role="doc-noteref"><span class="fn-bracket">[</span>7<span class="fn-bracket">]</span></a>.</p>
</section>
<section id="compound-paragraph">
-<h4><a class="toc-backref" href="#toc-entry-61" role="doc-backlink"><span class="sectnum">2.14.8 </span>Compound Paragraph</a></h4>
+<h4><a class="toc-backref" href="#toc-entry-62" role="doc-backlink"><span class="sectnum">2.14.8 </span>Compound Paragraph</a></h4>
<p>The <em>compound</em> directive is used to create a "compound paragraph", which
is a single logical paragraph containing multiple physical body
elements. For example:</p>
@@ -992,7 +993,7 @@
</div>
</section>
<section id="parsed-literal-blocks">
-<h4><a class="toc-backref" href="#toc-entry-62" role="doc-backlink"><span class="sectnum">2.14.9 </span>Parsed Literal Blocks</a></h4>
+<h4><a class="toc-backref" href="#toc-entry-63" role="doc-backlink"><span class="sectnum">2.14.9 </span>Parsed Literal Blocks</a></h4>
<pre class="literal-block">This is a parsed literal block.
This line is indented. The next line is blank.
@@ -1002,7 +1003,7 @@
footnotes <a class="brackets" href="#footnote-1" id="footnote-reference-9" role="doc-noteref"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></a>, <span class="target" id="hyperlink-targets">hyperlink targets</span>, and <a class="reference external" href="http://www.python.org/">references</a>.</pre>
</section>
<section id="code">
-<h4><a class="toc-backref" href="#toc-entry-63" role="doc-backlink"><span class="sectnum">2.14.10 </span>Code</a></h4>
+<h4><a class="toc-backref" href="#toc-entry-64" role="doc-backlink"><span class="sectnum">2.14.10 </span>Code</a></h4>
<p>Blocks of source code can be set with the <cite>code</cite> directive. If the code
language is specified, the content is parsed and tagged by the <a class="reference external" href="http://pygments.org/">Pygments</a> <a class="brackets" href="#footnote-8" id="footnote-reference-21" role="doc-noteref"><span class="fn-bracket">[</span>8<span class="fn-bracket">]</span></a>
syntax highlighter and can be formatted with a style sheet. (Code parsing
@@ -1027,7 +1028,7 @@
</code><small class="ln">2 </small><code data-lineno="2 ">.. footer:: Document footer</code></pre>
</section>
<section id="meta">
-<h4><a class="toc-backref" href="#toc-entry-64" role="doc-backlink"><span class="sectnum">2.14.11 </span>Meta</a></h4>
+<h4><a class="toc-backref" href="#toc-entry-65" role="doc-backlink"><span class="sectnum">2.14.11 </span>Meta</a></h4>
<p>The <a class="reference external" href="https://docutils.sourceforge.io/docs/ref/rst/directives.html#metadata">“meta” directive</a> <a class="brackets" href="#footnote-15" id="footnote-reference-29" role="doc-noteref"><span class="fn-bracket">[</span>15<span class="fn-bracket">]</span></a> is used to specify metadata to be stored in,
e.g., HTML META tags or ODT file prope...
[truncated message content] |
|
From: <mi...@us...> - 2023-11-10 13:12:30
|
Revision: 9471
http://sourceforge.net/p/docutils/code/9471
Author: milde
Date: 2023-11-10 13:12:28 +0000 (Fri, 10 Nov 2023)
Log Message:
-----------
Do not use HTML5 text-level tags inside ``<code>`` and ``<code-block>``.
Fixes bugs:#476.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/docutils/writers/html5_polyglot/__init__.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2023-11-10 13:12:16 UTC (rev 9470)
+++ trunk/docutils/HISTORY.txt 2023-11-10 13:12:28 UTC (rev 9471)
@@ -205,6 +205,11 @@
__ https://www.w3.org/TR/dpub-aria-1.1/#doc-footnote
+* docutils/writers/html5_polyglot/__init__.py
+
+ - Do not use HTML5 text-level tags inside <code> and <code-block>
+ (fixes bug #476).
+
* docutils/writers/latex2e/__init__.py
- Do not load the `inputenc` package in UTF-8 encoded LaTeX sources.
Modified: trunk/docutils/docutils/writers/html5_polyglot/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/html5_polyglot/__init__.py 2023-11-10 13:12:16 UTC (rev 9470)
+++ trunk/docutils/docutils/writers/html5_polyglot/__init__.py 2023-11-10 13:12:28 UTC (rev 9471)
@@ -177,6 +177,7 @@
def depart_container(self, node):
self.body.append(f'</{node.html5tagname}>\n')
+ del node.html5tagname
# no standard meta tag name in HTML5, use dcterms.rights
# see https://wiki.whatwg.org/wiki/MetaExtensions
@@ -282,21 +283,23 @@
# Use `supported_inline_tags` if found in class values
def visit_inline(self, node):
classes = node['classes']
- tags = [cls for cls in self.supported_inline_tags
- if cls in classes]
- if len(tags):
- node.html5tagname = tags[0]
- classes.remove(tags[0])
- elif (classes == ['ln']
- and isinstance(node.parent, nodes.literal_block)
- and 'code' in node.parent.get('classes')):
- if self.body[-1] == '<code>':
- del self.body[-1]
- else:
- self.body.append('</code>')
- node.html5tagname = 'small'
+ node.html5tagname = 'span'
+ if (isinstance(node.parent, nodes.literal_block)
+ and 'code' in node.parent.get('classes')
+ or isinstance(node.parent, nodes.literal)
+ and getattr(node.parent, 'html5tagname', None) == 'code'):
+ if classes == ['ln']:
+ if self.body[-1] == '<code>':
+ del self.body[-1]
+ else:
+ self.body.append('</code>')
+ node.html5tagname = 'small'
else:
- node.html5tagname = 'span'
+ tags = [cls for cls in self.supported_inline_tags
+ if cls in classes]
+ if len(tags):
+ node.html5tagname = tags[0]
+ classes.remove(node.html5tagname)
self.body.append(self.starttag(node, node.html5tagname, ''))
def depart_inline(self, node):
@@ -316,21 +319,21 @@
self.body.append('</div>\n')
# <figcaption> closed in visit_figure()
- # use HTML text-level tags if matching class value found
+ # use HTML5 text-level tags if matching class value found
def visit_literal(self, node):
classes = node['classes']
+ html5tagname = 'span'
tags = [cls for cls in self.supported_inline_tags
if cls in classes]
if len(tags):
- tagname = tags[0]
- classes.remove(tags[0])
- else:
- tagname = 'span'
- if tagname == 'code':
- self.body.append(self.starttag(node, 'code', ''))
+ html5tagname = tags[0]
+ classes.remove(html5tagname)
+ if html5tagname == 'code':
+ node.html5tagname = html5tagname
+ self.body.append(self.starttag(node, html5tagname, ''))
return
self.body.append(
- self.starttag(node, tagname, '', CLASS='docutils literal'))
+ self.starttag(node, html5tagname, '', CLASS='docutils literal'))
text = node.astext()
# remove hard line breaks (except if in a parsed-literal block)
if not isinstance(node.parent, nodes.literal_block):
@@ -343,13 +346,13 @@
f'<span class="pre">{self.encode(token)}</span>')
else:
self.body.append(self.encode(token))
- self.body.append(f'</{tagname}>')
+ self.body.append(f'</{html5tagname}>')
# Content already processed:
raise nodes.SkipNode
def depart_literal(self, node):
# skipped unless literal element is from "code" role:
- self.body.append('</code>')
+ self.depart_inline(node)
# Meta tags: 'lang' attribute replaced by 'xml:lang' in XHTML 1.1
# HTML5/polyglot recommends using both
@@ -395,24 +398,24 @@
def visit_topic(self, node):
atts = {'classes': ['topic']}
if 'contents' in node['classes']:
- node.html_tagname = 'nav'
+ node.html5tagname = 'nav'
del atts['classes']
if isinstance(node.parent, nodes.document):
atts['role'] = 'doc-toc'
self.body_prefix[0] = '</head>\n<body class="with-toc">\n'
elif 'abstract' in node['classes']:
- node.html_tagname = 'div'
+ node.html5tagname = 'div'
atts['role'] = 'doc-abstract'
elif 'dedication' in node['classes']:
- node.html_tagname = 'div'
+ node.html5tagname = 'div'
atts['role'] = 'doc-dedication'
else:
- node.html_tagname = 'aside'
- self.body.append(self.starttag(node, node.html_tagname, **atts))
+ node.html5tagname = 'aside'
+ self.body.append(self.starttag(node, node.html5tagname, **atts))
def depart_topic(self, node):
- self.body.append(f'</{node.html_tagname}>\n')
- del node.html_tagname
+ self.body.append(f'</{node.html5tagname}>\n')
+ del node.html5tagname
# append self-link
def section_title_tags(self, node):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|