SF.net SVN: docutils:[10091 ] trunk/docutils

milde--- via Docutils-checkins <[email protected]> Thu, 17 Apr 2025 12:21:42 +0000
Newsgroups gmane.text.docutils.cvs
Message-ID <[email protected]>
Revision: 10091
          http://sourceforge.net/p/docutils/code/10091
Author:   milde
Date:     2025-04-17 12:21:36 +0000 (Thu, 17 Apr 2025)
Log Message:
-----------
Fix "error_encoding" default in the interactive help output.

While the "error_encoding" configuration setting allows specifying
the error handler after a colon, the default value is just the encoding
of the error stream determined by Python and the related error handler
defaults to the "error_encoding_error_handler" setting's default.

Also fix the output samples in the test suite.

Modified Paths:
--------------
    trunk/docutils/docutils/frontend.py
    trunk/docutils/test/data/help/docutils.rst
    trunk/docutils/test/data/help/rst2html.rst
    trunk/docutils/test/data/help/rst2latex.rst
    trunk/docutils/test/test_CLI.py

Modified: trunk/docutils/docutils/frontend.py
===================================================================
--- trunk/docutils/docutils/frontend.py	2025-04-17 12:20:57 UTC (rev 10090)
+++ trunk/docutils/docutils/frontend.py	2025-04-17 12:21:36 UTC (rev 10091)
@@ -818,8 +818,7 @@
           ['--output-encoding-error-handler'],
           {'default': 'strict', 'validator': validate_encoding_error_handler}),
          ('Specify text encoding and optionally error handler '
-          'for error output.  Default: %s:%s.'
-          % (default_error_encoding, default_error_encoding_error_handler),
+          'for error output.  Default: %s.' % default_error_encoding,
           ['--error-encoding', '-e'],
           {'metavar': '<name[:handler]>', 'default': default_error_encoding,
            'validator': validate_encoding_and_error_handler}),

Modified: trunk/docutils/test/data/help/docutils.rst
===================================================================
--- trunk/docutils/test/data/help/docutils.rst	2025-04-17 12:20:57 UTC (rev 10090)
+++ trunk/docutils/test/data/help/docutils.rst	2025-04-17 12:21:36 UTC (rev 10091)
@@ -73,7 +73,7 @@
                         "xmlcharrefreplace", "backslashreplace".
 --error-encoding=<name[:handler]>, -e <name[:handler]>
                         Specify text encoding and optionally error handler for
-                        error output.  Default: utf-8:backslashreplace.
+                        error output.  Default: utf-8.
 --error-encoding-error-handler=ERROR_ENCODING_ERROR_HANDLER
                         Specify the error handler for unencodable characters
                         in error output.  Default: backslashreplace.

Modified: trunk/docutils/test/data/help/rst2html.rst
===================================================================
--- trunk/docutils/test/data/help/rst2html.rst	2025-04-17 12:20:57 UTC (rev 10090)
+++ trunk/docutils/test/data/help/rst2html.rst	2025-04-17 12:21:36 UTC (rev 10091)
@@ -74,7 +74,7 @@
                         "xmlcharrefreplace", "backslashreplace".
 --error-encoding=<name[:handler]>, -e <name[:handler]>
                         Specify text encoding and optionally error handler for
-                        error output.  Default: utf-8:backslashreplace.
+                        error output.  Default: utf-8.
 --error-encoding-error-handler=ERROR_ENCODING_ERROR_HANDLER
                         Specify the error handler for unencodable characters
                         in error output.  Default: backslashreplace.

Modified: trunk/docutils/test/data/help/rst2latex.rst
===================================================================
--- trunk/docutils/test/data/help/rst2latex.rst	2025-04-17 12:20:57 UTC (rev 10090)
+++ trunk/docutils/test/data/help/rst2latex.rst	2025-04-17 12:21:36 UTC (rev 10091)
@@ -74,7 +74,7 @@
                         "xmlcharrefreplace", "backslashreplace".
 --error-encoding=<name[:handler]>, -e <name[:handler]>
                         Specify text encoding and optionally error handler for
-                        error output.  Default: utf-8:backslashreplace.
+                        error output.  Default: utf-8.
 --error-encoding-error-handler=ERROR_ENCODING_ERROR_HANDLER
                         Specify the error handler for unencodable characters
                         in error output.  Default: backslashreplace.

Modified: trunk/docutils/test/test_CLI.py
===================================================================
--- trunk/docutils/test/test_CLI.py	2025-04-17 12:20:57 UTC (rev 10090)
+++ trunk/docutils/test/test_CLI.py	2025-04-17 12:21:36 UTC (rev 10091)
@@ -75,8 +75,9 @@
                         output, flags=re.DOTALL)
         # normalise error encoding default
         output = output.replace(
-            f'{core.OptionParser.default_error_encoding}:backslashreplace',
-            'utf-8:backslashreplace')
+            'error output.  Default: '
+            f'{core.OptionParser.default_error_encoding}',
+            'error output.  Default: utf-8')
         return output
 
     def test_main_help(self):

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.