pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

py-docutils: merge more upstream changes



Module Name:	pkgsrc-wip
Committed By:	Thomas Klausner <wiz%NetBSD.org@localhost>
Pushed By:	wiz
Date:		Sun Aug 17 21:17:43 2025 +0200
Changeset:	7cf4076ffd7295869fd044f687fce94397c68c62

Modified Files:
	py-docutils/Makefile
	py-docutils/distinfo
	py-docutils/patches/patch-docutils_parsers_rst_states.py
Added Files:
	py-docutils/patches/patch-docutils_frontend.py
	py-docutils/patches/patch-docutils_nodes.py
	py-docutils/patches/patch-docutils_transforms_references.py
	py-docutils/patches/patch-docutils_writers___html__base.py
	py-docutils/patches/patch-docutils_writers_html4css1_____init____.py
	py-docutils/patches/patch-docutils_writers_html5__polyglot_____init____.py
	py-docutils/patches/patch-docutils_writers_latex2e_____init____.py
	py-docutils/patches/patch-docutils_writers_odf__odt_____init____.py
	py-docutils/patches/patch-docutils_writers_xetex_____init____.py

Log Message:
py-docutils: merge more upstream changes

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=7cf4076ffd7295869fd044f687fce94397c68c62

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 py-docutils/Makefile                               |   4 +-
 py-docutils/distinfo                               |  11 +-
 py-docutils/patches/patch-docutils_frontend.py     |  45 ++++
 py-docutils/patches/patch-docutils_nodes.py        |  29 +++
 .../patches/patch-docutils_parsers_rst_states.py   | 271 ++++++++++++++++++---
 .../patch-docutils_transforms_references.py        |  20 ++
 .../patches/patch-docutils_writers___html__base.py |  24 ++
 ...atch-docutils_writers_html4css1_____init____.py |  13 +
 ...ocutils_writers_html5__polyglot_____init____.py |  13 +
 .../patch-docutils_writers_latex2e_____init____.py |  80 ++++++
 ...patch-docutils_writers_odf__odt_____init____.py |  18 ++
 .../patch-docutils_writers_xetex_____init____.py   |  14 ++
 12 files changed, 509 insertions(+), 33 deletions(-)

diffs:
diff --git a/py-docutils/Makefile b/py-docutils/Makefile
index dd4029a56e..8aa2175a18 100644
--- a/py-docutils/Makefile
+++ b/py-docutils/Makefile
@@ -29,8 +29,8 @@ post-install:
 	cd ${DESTDIR}${PREFIX}/bin && \
 	${MV} ${bin} ${bin}-${PYVERSSUFFIX} || ${TRUE}
 .endfor
-# due to patches/patch-docutils_parsers_rst_states.py
-	${RM} -f ${DESTDIR}${PREFIX}/${PYSITELIB}/docutils/parsers/rst/states.py.orig
+# due to patches
+	find ${DESTDIR}${PREFIX}/${PYSITELIB} -name *.orig -delete
 
 do-test:
 	cd ${WRKSRC} && ${PYTHONBIN} test/alltests.py
diff --git a/py-docutils/distinfo b/py-docutils/distinfo
index 60ab8171f8..67cf6b4783 100644
--- a/py-docutils/distinfo
+++ b/py-docutils/distinfo
@@ -3,4 +3,13 @@ $NetBSD: distinfo,v 1.33 2025/08/03 10:06:37 wiz Exp $
 BLAKE2s (docutils-0.22.tar.gz) = 20d7b105f2af0a2417ab1e3800120565ef7c3fc77da8dd4ebef852624b7b3eaa
 SHA512 (docutils-0.22.tar.gz) = 09082eb3bdd5f9b3e977d356740efee47725a50fbaca7bf35c7fddff06003c2b2177a38d160a9956f9e96261f881c0d870c0aa9fef84f90d0cac079ccc73669d
 Size (docutils-0.22.tar.gz) = 2277984 bytes
-SHA1 (patch-docutils_parsers_rst_states.py) = e355d56f6595f5f5b240f23eccaa7ce9da5677f8
+SHA1 (patch-docutils_frontend.py) = e36ef1bbc98c2b01ae45341636a93a93e712b757
+SHA1 (patch-docutils_nodes.py) = 942cfbb6aa27313fac8b2be572c38833d5cbeae1
+SHA1 (patch-docutils_parsers_rst_states.py) = 2ae0fd135af2e4e999daf71be079335f3b6d527e
+SHA1 (patch-docutils_transforms_references.py) = 4997f5b060903359aed297ec74653093d6ef5cda
+SHA1 (patch-docutils_writers___html__base.py) = f432c8222ea1ef1f7181439e39caf130f014fa03
+SHA1 (patch-docutils_writers_html4css1_____init____.py) = b1a13109b56f1ba6922b1a67a2a52b3b34ace689
+SHA1 (patch-docutils_writers_html5__polyglot_____init____.py) = 5324c969d44395627942e9036770e7174313e30a
+SHA1 (patch-docutils_writers_latex2e_____init____.py) = ef56b1e93636673e1605f25344c4d744d6e4f943
+SHA1 (patch-docutils_writers_odf__odt_____init____.py) = 6244cfd4b2fa431afeb896116dd0a335d262df84
+SHA1 (patch-docutils_writers_xetex_____init____.py) = 4164cd7c8d9d8f1c501ba2d560a58ace6923abc1
diff --git a/py-docutils/patches/patch-docutils_frontend.py b/py-docutils/patches/patch-docutils_frontend.py
new file mode 100644
index 0000000000..ae48cf9d93
--- /dev/null
+++ b/py-docutils/patches/patch-docutils_frontend.py
@@ -0,0 +1,45 @@
+$NetBSD$
+
+--- docutils/frontend.py.orig	2025-07-29 14:37:38.634775200 +0000
++++ docutils/frontend.py
+@@ -808,34 +808,26 @@ class OptionParser(optparse.OptionParser
+           ['--input-encoding'],
+           {'metavar': '<name[:handler]>', 'default': 'utf-8',
+            'validator': validate_encoding_and_error_handler}),
+-         ('Specify the error handler for undecodable characters.  '
+-          'Choices: "strict" (default), "ignore", and "replace".',
+-          ['--input-encoding-error-handler'],
++         (SUPPRESS_HELP, ['--input-encoding-error-handler'],
+           {'default': 'strict', 'validator': validate_encoding_error_handler}),
+          ('Specify the text encoding and optionally the error handler for '
+           'output.  Default: utf-8.',
+           ['--output-encoding'],
+           {'metavar': '<name[:handler]>', 'default': 'utf-8',
+            'validator': validate_encoding_and_error_handler}),
+-         ('Specify error handler for unencodable output characters; '
+-          '"strict" (default), "ignore", "replace", '
+-          '"xmlcharrefreplace", "backslashreplace".',
+-          ['--output-encoding-error-handler'],
++         (SUPPRESS_HELP, ['--output-encoding-error-handler'],
+           {'default': 'strict', 'validator': validate_encoding_error_handler}),
+-         ('Specify text encoding and optionally error handler '
+-          'for error output.  Default: %s.' % default_error_encoding,
++         ('Specify text encoding and optionally the error handler'
++          f' for error output.  Default: {default_error_encoding}.',
+           ['--error-encoding', '-e'],
+           {'metavar': '<name[:handler]>', 'default': default_error_encoding,
+            'validator': validate_encoding_and_error_handler}),
+-         ('Specify the error handler for unencodable characters in '
+-          'error output.  Default: %s.'
+-          % default_error_encoding_error_handler,
+-          ['--error-encoding-error-handler'],
++         (SUPPRESS_HELP, ['--error-encoding-error-handler'],
+           {'default': default_error_encoding_error_handler,
+            'validator': validate_encoding_error_handler}),
+          ('Specify the language (as BCP 47 language tag).  Default: en.',
+           ['--language', '-l'], {'dest': 'language_code', 'default': 'en',
+-                                 'metavar': '<name>'}),
++                                 'metavar': '<tag>'}),
+          ('Write output file dependencies to <file>.',
+           ['--record-dependencies'],
+           {'metavar': '<file>', 'validator': validate_dependency_file,
diff --git a/py-docutils/patches/patch-docutils_nodes.py b/py-docutils/patches/patch-docutils_nodes.py
new file mode 100644
index 0000000000..ea1f40df92
--- /dev/null
+++ b/py-docutils/patches/patch-docutils_nodes.py
@@ -0,0 +1,29 @@
+$NetBSD$
+
+--- docutils/nodes.py.orig	2025-07-29 14:37:37.467805600 +0000
++++ docutils/nodes.py
+@@ -820,18 +820,21 @@ class Element(Node):
+     def section_hierarchy(self) -> list[section]:
+         """Return the element's section hierarchy.
+ 
+-        Return a list of all <section> elements containing `self`
+-        (including `self` if it is a <section>).
++        Return a list of all <section> elements that contain `self`
++        (including `self` if it is a <section>) and have a parent node.
+ 
+         List item ``[i]`` is the parent <section> of level i+1
+         (1: section, 2: subsection, 3: subsubsection, ...).
+         The length of the list is the element's section level.
+ 
++        See `docutils.parsers.rst.states.RSTState.check_subsection()`
++        for a usage example.
++
+         Provisional. May be changed or removed without warning.
+         """
+         sections = []
+         node = self
+-        while node is not None:
++        while node.parent is not None:
+             if isinstance(node, section):
+                 sections.append(node)
+             node = node.parent
diff --git a/py-docutils/patches/patch-docutils_parsers_rst_states.py b/py-docutils/patches/patch-docutils_parsers_rst_states.py
index 15ffa74b14..501f31ff9d 100644
--- a/py-docutils/patches/patch-docutils_parsers_rst_states.py
+++ b/py-docutils/patches/patch-docutils_parsers_rst_states.py
@@ -1,11 +1,51 @@
 $NetBSD$
 
-https://sourceforge.net/p/docutils/bugs/508/
-https://sourceforge.net/p/docutils/bugs/509/
-
 --- docutils/parsers/rst/states.py.orig	2025-07-29 14:37:37.894344600 +0000
 +++ docutils/parsers/rst/states.py
-@@ -169,7 +169,6 @@ class RSTStateMachine(StateMachineWS):
+@@ -104,6 +104,7 @@ from __future__ import annotations
+ 
+ __docformat__ = 'reStructuredText'
+ 
++import copy
+ import re
+ from types import FunctionType, MethodType
+ from types import SimpleNamespace as Struct
+@@ -121,6 +122,10 @@ from docutils.utils import split_escaped
+ from docutils.utils._roman_numerals import (InvalidRomanNumeralError,
+                                             RomanNumeral)
+ 
++TYPE_CHECKING = False
++if TYPE_CHECKING:
++    from docutils.statemachine import StringList
++
+ 
+ class MarkupError(DataError): pass
+ class UnknownInterpretedRoleError(DataError): pass
+@@ -151,16 +156,19 @@ class RSTStateMachine(StateMachineWS):
+         if inliner is None:
+             inliner = Inliner()
+         inliner.init_customizations(document.settings)
++        # A collection of objects to share with nested parsers.
++        # The attributes `reporter`, `section_level`, and
++        # `section_bubble_up_kludge` will be removed in Docutils 2.0
+         self.memo = Struct(document=document,
+-                           reporter=document.reporter,
++                           reporter=document.reporter,  # ignored
+                            language=self.language,
+                            title_styles=[],
+-                           section_level=0,  # ignored, to be removed in 2.0
+-                           section_bubble_up_kludge=False,  # ignored, ""
++                           section_level=0,  # ignored
++                           section_bubble_up_kludge=False,  # ignored
+                            inliner=inliner)
+         self.document = document
+         self.attach_observer(document.note_source)
+-        self.reporter = self.memo.reporter
++        self.reporter = self.document.reporter
+         self.node = document
+         results = StateMachineWS.run(self, input_lines, input_offset,
+                                      input_source=document['source'])
+@@ -169,7 +177,6 @@ class RSTStateMachine(StateMachineWS):
  
  
  class NestedStateMachine(StateMachineWS):
@@ -13,16 +53,136 @@ https://sourceforge.net/p/docutils/bugs/509/
      """
      StateMachine run from within other StateMachine runs, to parse nested
      document structures.
-@@ -177,7 +176,7 @@ class NestedStateMachine(StateMachineWS)
+@@ -177,17 +184,28 @@ class NestedStateMachine(StateMachineWS)
  
      def run(self, input_lines, input_offset, memo, node, match_titles=True):
          """
 -        Parse `input_lines` and populate a `docutils.nodes.document` instance.
 +        Parse `input_lines` and populate `node`.
++
++        Use a separate "title style hierarchy" if `node` is not
++        attached to the document (changed in Docutils 0.23).
  
          Extend `StateMachineWS.run()`: set up document-wide data.
          """
-@@ -326,35 +325,53 @@ class RSTState(StateWS):
+         self.match_titles = match_titles
+-        self.memo = memo
++        self.memo = copy.copy(memo)
+         self.document = memo.document
+         self.attach_observer(self.document.note_source)
+-        self.reporter = memo.reporter
+         self.language = memo.language
++        self.reporter = self.document.reporter
+         self.node = node
++        if match_titles:
++            # Start a new title style hierarchy if `node` is not
++            # a descendant of the `document`:
++            _root = node
++            while _root.parent is not None:
++                _root = _root.parent
++            if _root != self.document:
++                self.memo.title_styles = []
+         results = StateMachineWS.run(self, input_lines, input_offset)
+         assert results == [], ('NestedStateMachine.run() results should be '
+                                'empty!')
+@@ -214,9 +232,9 @@ class RSTState(StateWS):
+         StateWS.runtime_init(self)
+         memo = self.state_machine.memo
+         self.memo = memo
+-        self.reporter = memo.reporter
+-        self.inliner = memo.inliner
+         self.document = memo.document
++        self.inliner = memo.inliner
++        self.reporter = self.document.reporter
+         self.parent = self.state_machine.node
+         # enable the reporter to determine source and source-line
+         if not hasattr(self.reporter, 'get_source_and_line'):
+@@ -248,11 +266,40 @@ class RSTState(StateWS):
+         """Called at beginning of file."""
+         return [], []
+ 
+-    def nested_parse(self, block, input_offset, node, match_titles=False,
+-                     state_machine_class=None, state_machine_kwargs=None):
+-        """
+-        Create a new StateMachine rooted at `node` and run it over the input
+-        `block`.
++    def nested_parse(self,
++                     block: StringList,
++                     input_offset: int,
++                     node: nodes.Element,
++                     match_titles: bool = False,
++                     state_machine_class: StateMachineWS|None = None,
++                     state_machine_kwargs: dict|None = None
++                     ) -> int:
++        """
++        Parse the input `block` with a nested state-machine rooted at `node`.
++
++        :block:
++            reStructuredText source extract.
++        :input_offset:
++            Line number at start of the block.
++        :node:
++            Base node. Generated nodes will be appended to this node
++            (unless a new section with lower level is encountered, see below).
++        :match_titles:
++            Allow section titles?
++            If the base `node` is attached to the document, new sections will
++            be appended according their level in the section hierarchy
++            (moving up the tree).
++            If the base `node` is *not* attached to the document,
++            a separate section title style hierarchy is used for the nested
++            parsing (all sections are subsections of the current section).
++        :state_machine_class:
++            Default: `NestedStateMachine`.
++        :state_machine_kwargs:
++            Keyword arguments for the state-machine instantiation.
++            Default: `self.nested_sm_kwargs`.
++
++        Create a new state-machine instance if required.
++        Return new offset.
+         """
+         use_default = 0
+         if state_machine_class is None:
+@@ -261,8 +308,6 @@ class RSTState(StateWS):
+         if state_machine_kwargs is None:
+             state_machine_kwargs = self.nested_sm_kwargs
+             use_default += 1
+-        block_length = len(block)
+-
+         state_machine = None
+         if use_default == 2:
+             try:
+@@ -272,8 +317,11 @@ class RSTState(StateWS):
+         if not state_machine:
+             state_machine = state_machine_class(debug=self.debug,
+                                                 **state_machine_kwargs)
++        # run the statemachine and populate `node`:
++        block_length = len(block)
+         state_machine.run(block, input_offset, memo=self.memo,
+                           node=node, match_titles=match_titles)
++        # clean up
+         if use_default == 2:
+             self.nested_sm_cache.append(state_machine)
+         else:
+@@ -293,9 +341,15 @@ class RSTState(StateWS):
+                           state_machine_class=None,
+                           state_machine_kwargs=None):
+         """
+-        Create a new StateMachine rooted at `node` and run it over the input
+-        `block`. Also keep track of optional intermediate blank lines and the
++        Parse the input `block` with a nested state-machine rooted at `node`.
++
++        Create a new StateMachine rooted at `node` and run it over the
++        input `block` (see also `nested_parse()`).
++        Also keep track of optional intermediate blank lines and the
+         required final one.
++
++        Return new offset and a boolean indicating whether there was a
++        blank final line.
+         """
+         if state_machine_class is None:
+             state_machine_class = self.nested_sm
+@@ -326,40 +380,45 @@ class RSTState(StateWS):
  
          When a new section is reached that isn't a subsection of the current
          section, set `self.parent` to the new section's parent section
@@ -34,12 +194,6 @@ https://sourceforge.net/p/docutils/bugs/509/
 -        # current section level: (0 document, 1 section, 2 subsection, ...)
 -        mylevel = len(parent_sections)
 -        # Determine the level of the new section:
-+        # Adding a new <section> at level "i" is done by appending to
-+        # ``parent_sections[i-1].parent``.
-+        # However, in nested parsing the root `node` may be a <section>.
-+        # Then ``parent_sections[0]`` has no parent and must be discarded:
-+        if parent_sections and parent_sections[0].parent is None:
-+            parent_sections.pop(0)
 +        # current section level: (0 root, 1 section, 2 subsection, ...)
 +        oldlevel = len(parent_sections)
 +        # new section level:
@@ -47,17 +201,18 @@ https://sourceforge.net/p/docutils/bugs/509/
 -            level = title_styles.index(style) + 1
 +            newlevel = title_styles.index(style) + 1
          except ValueError:  # new title style
-             title_styles.append(style)
+-            title_styles.append(style)
 -            level = len(title_styles)
-+            newlevel = len(title_styles)
++            newlevel = len(title_styles) + 1
          # The new level must not be deeper than an immediate child
          # of the current level:
 -        if level > mylevel + 1:
 -            styles = " ".join("/".join(s for s in style)
 -                              for style in title_styles)
+-            self.parent += self.reporter.severe(
 +        if newlevel > oldlevel + 1:
 +            styles = ' '.join('/'.join(style) for style in title_styles)
-             self.parent += self.reporter.severe(
++            self.parent += self.reporter.error(
                  'Inconsistent title style:'
 -                f' skip from level {mylevel} to {level}.',
 +                f' skip from level {oldlevel} to {newlevel}.',
@@ -68,24 +223,80 @@ https://sourceforge.net/p/docutils/bugs/509/
          # Update parent state:
 -        self.memo.section_level = level
 -        if level <= mylevel:
++        if newlevel > len(title_styles):
++            title_styles.append(style)
 +        self.memo.section_level = newlevel
-+        if newlevel <= oldlevel:
++        if newlevel > oldlevel:
++            # new section is a subsection: get the current section or base node
++            while self.parent.parent and not isinstance(
++                      self.parent, (nodes.section, nodes.document)):
++                self.parent = self.parent.parent
++        else:
              # new section is sibling or higher up in the section hierarchy
 -            self.parent = parent_sections[level-1].parent
-+            new_parent = parent_sections[newlevel-1].parent
-+            if new_parent is None:
-+                styles = ' '.join('/'.join(style) for style in title_styles)
-+                self.parent += self.reporter.severe(
-+                    f'Cannot skip from level {oldlevel} to {newlevel}.'
-+                    ' Current element has only {len(self.parent_sections)'
-+                    ' parent sections.'
-+                    ' (Mismatch of `memo.section_styles`,'
-+                    ' and the root node of a nested parser?)',
-+                    nodes.literal_block('', source),
-+                    nodes.paragraph('', f'Established title styles: {styles}'),
-+                    line=lineno)
-+                return False
-+            self.parent = new_parent
++            self.parent = parent_sections[newlevel-1].parent
          return True
  
      def title_inconsistent(self, sourcetext, lineno):
+         # Ignored. Will be removed in Docutils 2.0.
+-        error = self.reporter.severe(
++        error = self.reporter.error(
+             'Title level inconsistent:', nodes.literal_block('', sourcetext),
+             line=lineno)
+         return error
+@@ -620,9 +679,9 @@ class Inliner:
+         :text: source string
+         :lineno: absolute line number, cf. `statemachine.get_source_and_line()`
+         """
+-        self.reporter = memo.reporter
+         self.document = memo.document
+         self.language = memo.language
++        self.reporter = self.document.reporter
+         self.parent = parent
+         pattern_search = self.patterns.initial.search
+         dispatch = self.dispatch
+@@ -2420,7 +2479,7 @@ class Body(RSTState):
+             raise statemachine.TransitionCorrection('text')
+         else:
+             blocktext = self.state_machine.line
+-            msg = self.reporter.severe(
++            msg = self.reporter.error(
+                   'Unexpected section title or transition.',
+                   nodes.literal_block(blocktext, blocktext),
+                   line=self.state_machine.abs_line_number())
+@@ -2775,7 +2834,7 @@ class Text(RSTState):
+             # if the error is in a table (try with test_tables.py)?
+             # print("get_source_and_line", srcline)
+             # print("abs_line_number", self.state_machine.abs_line_number())
+-            msg = self.reporter.severe(
++            msg = self.reporter.error(
+                 'Unexpected section title.',
+                 nodes.literal_block(blocktext, blocktext),
+                 source=src, line=srcline)
+@@ -2977,7 +3036,7 @@ class Line(SpecializedText):
+             if len(overline.rstrip()) < 4:
+                 self.short_overline(context, blocktext, lineno, 2)
+             else:
+-                msg = self.reporter.severe(
++                msg = self.reporter.error(
+                     'Incomplete section title.',
+                     nodes.literal_block(blocktext, blocktext),
+                     line=lineno)
+@@ -2991,7 +3050,7 @@ class Line(SpecializedText):
+             if len(overline.rstrip()) < 4:
+                 self.short_overline(context, blocktext, lineno, 2)
+             else:
+-                msg = self.reporter.severe(
++                msg = self.reporter.error(
+                     'Missing matching underline for section title overline.',
+                     nodes.literal_block(source, source),
+                     line=lineno)
+@@ -3002,7 +3061,7 @@ class Line(SpecializedText):
+             if len(overline.rstrip()) < 4:
+                 self.short_overline(context, blocktext, lineno, 2)
+             else:
+-                msg = self.reporter.severe(
++                msg = self.reporter.error(
+                       'Title overline & underline mismatch.',
+                       nodes.literal_block(source, source),
+                       line=lineno)
diff --git a/py-docutils/patches/patch-docutils_transforms_references.py b/py-docutils/patches/patch-docutils_transforms_references.py
new file mode 100644
index 0000000000..42fc8cd17f
--- /dev/null
+++ b/py-docutils/patches/patch-docutils_transforms_references.py
@@ -0,0 +1,20 @@
+$NetBSD$
+
+--- docutils/transforms/references.py.orig	2025-07-29 14:37:38.409054500 +0000
++++ docutils/transforms/references.py
+@@ -542,10 +542,12 @@ class Footnotes(Transform):
+             try:
+                 label = self.autofootnote_labels[i]
+             except IndexError:
++                n = len(self.autofootnote_labels)
++                s = 's' if n > 1 else ''
+                 msg = self.document.reporter.error(
+-                      'Too many autonumbered footnote references: only %s '
+-                      'corresponding footnotes available.'
+-                      % len(self.autofootnote_labels), base_node=ref)
++                          'Too many autonumbered footnote references: '
++                          f'only {n} corresponding footnote{s} available.',
++                          base_node=ref)
+                 msgid = self.document.set_id(msg)
+                 for ref in self.document.autofootnote_refs[i:]:
+                     if ref.resolved or ref.hasattr('refname'):
diff --git a/py-docutils/patches/patch-docutils_writers___html__base.py b/py-docutils/patches/patch-docutils_writers___html__base.py
new file mode 100644
index 0000000000..f7e56c892f
--- /dev/null
+++ b/py-docutils/patches/patch-docutils_writers___html__base.py
@@ -0,0 +1,24 @@
+$NetBSD$
+
+--- docutils/writers/_html_base.py.orig	2025-07-29 14:37:37.539381000 +0000
++++ docutils/writers/_html_base.py
+@@ -115,16 +115,16 @@ class Writer(writers.Writer):
+          ('Disable compact simple field lists.',
+           ['--no-compact-field-lists'],
+           {'dest': 'compact_field_lists', 'action': 'store_false'}),
+-         ('Added to standard table classes. '
++         ('Class value(s) assigned to all tables. '
+           'Defined styles: borderless, booktabs, '
+           'align-left, align-center, align-right, '
+           'colwidths-auto, colwidths-grid.',
+           ['--table-style'],
+-          {'default': ''}),
++          {'metavar': '<style>', 'default': ''}),
+          ('Math output format (one of "MathML", "HTML", "MathJax", '
+           'or "LaTeX") and option(s). (default: "MathML")',
+           ['--math-output'],
+-          {'default': 'MathML',
++          {'metavar': '<format [option(s)]>', 'default': 'MathML',
+            'validator': frontend.validate_math_output}),
+          ('Prepend an XML declaration. ',
+           ['--xml-declaration'],
diff --git a/py-docutils/patches/patch-docutils_writers_html4css1_____init____.py b/py-docutils/patches/patch-docutils_writers_html4css1_____init____.py
new file mode 100644
index 0000000000..34e1550774
--- /dev/null
+++ b/py-docutils/patches/patch-docutils_writers_html4css1_____init____.py
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- docutils/writers/html4css1/__init__.py.orig	2025-07-29 14:37:37.693212000 +0000
++++ docutils/writers/html4css1/__init__.py
+@@ -74,7 +74,7 @@ class Writer(writers._html_base.Writer):
+             'Math output format (one of "MathML", "HTML", "MathJax", or '
+             '"LaTeX") and option(s). (default: "HTML math.css")',
+             ['--math-output'],
+-            {'default': 'HTML math.css',
++            {'metavar': '<format [option(s)]>', 'default': 'HTML math.css',
+              'validator': frontend.validate_math_output}),
+         xml_declaration=(
+             'Prepend an XML declaration (default). ',
diff --git a/py-docutils/patches/patch-docutils_writers_html5__polyglot_____init____.py b/py-docutils/patches/patch-docutils_writers_html5__polyglot_____init____.py
new file mode 100644
index 0000000000..10973367a9
--- /dev/null
+++ b/py-docutils/patches/patch-docutils_writers_html5__polyglot_____init____.py
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- docutils/writers/html5_polyglot/__init__.py.orig	2025-07-29 14:37:37.693464500 +0000
++++ docutils/writers/html5_polyglot/__init__.py
+@@ -93,7 +93,7 @@ class Writer(_html_base.Writer):
+          ('Suggest at which point images should be loaded: '
+           '"embed", "link" (default), or "lazy".',
+           ['--image-loading'],
+-          {'choices': ('embed', 'link', 'lazy'),
++          {'metavar': '<strategy>', 'choices': ('embed', 'link', 'lazy'),
+            # 'default': 'link'  # default set in _html_base.py
+            }),
+          ('Append a self-link to section headings.',
diff --git a/py-docutils/patches/patch-docutils_writers_latex2e_____init____.py b/py-docutils/patches/patch-docutils_writers_latex2e_____init____.py
new file mode 100644
index 0000000000..de12c9684a
--- /dev/null
+++ b/py-docutils/patches/patch-docutils_writers_latex2e_____init____.py
@@ -0,0 +1,80 @@
+$NetBSD$
+
+--- docutils/writers/latex2e/__init__.py.orig	2025-07-29 14:37:37.736252500 +0000
++++ docutils/writers/latex2e/__init__.py
+@@ -47,11 +47,11 @@ class Writer(writers.Writer):
+         None,
+         (('Specify LaTeX documentclass.  Default: "article".',
+           ['--documentclass'],
+-          {'default': 'article', }),
++          {'metavar': '<documentclass>', 'default': 'article'}),
+          ('Specify document options.  Multiple options can be given, '
+           'separated by commas.  Default: "a4paper".',
+           ['--documentoptions'],
+-          {'default': 'a4paper', }),
++          {'metavar': '<options>', 'default': 'a4paper'}),
+          ('Format for footnote references: one of "superscript" or '
+           '"brackets".  Default: "superscript".',
+           ['--footnote-references'],
+@@ -105,7 +105,7 @@ class Writer(writers.Writer):
+          ('Customization by LaTeX code in the preamble. '
+           'Default: select PDF standard fonts (Times, Helvetica, Courier).',
+           ['--latex-preamble'],
+-          {'default': default_preamble}),
++          {'metavar': '<preamble>', 'default': default_preamble}),
+          ('Specify the template file. Default: "%s".' % default_template,
+           ['--template'],
+           {'default': default_template, 'metavar': '<file>'}),
+@@ -139,9 +139,11 @@ class Writer(writers.Writer):
+            'validator': frontend.validate_boolean}),
+          ('Color of any hyperlinks embedded in text. '
+           'Default: "blue" (use "false" to disable).',
+-          ['--hyperlink-color'], {'default': 'blue'}),
++          ['--hyperlink-color'],
++          {'metavar': '<color>', 'default': 'blue'}),
+          ('Additional options to the "hyperref" package.',
+-          ['--hyperref-options'], {'default': ''}),
++          ['--hyperref-options'],
++          {'metavar': '<options>', 'default': ''}),
+          ('Enable compound enumerators for nested enumerated lists '
+           '(e.g. "1.2.a.ii").',
+           ['--compound-enumerators'],
+@@ -166,8 +168,8 @@ class Writer(writers.Writer):
+          ('When possible, use the specified environment for literal-blocks. '
+           'Default: "" (fall back to "alltt").',
+           ['--literal-block-env'],
+-          {'default': ''}),
+-         ('Deprecated alias for "--literal-block-env=verbatim".',
++          {'metavar': '<environment>', 'default': ''}),
++         (frontend.SUPPRESS_HELP,  # deprecated legacy option
+           ['--use-verbatim-when-possible'],
+           {'action': 'store_true',
+            'validator': frontend.validate_boolean}),
+@@ -181,22 +183,19 @@ class Writer(writers.Writer):
+            'action': 'append',
+            'validator': frontend.validate_comma_separated_list,
+            'choices': table_style_values}),
+-         ('LaTeX graphicx package option. '
+-          'Possible values are "dvipdfmx", "dvips", "dvisvgm", '
+-          '"luatex", "pdftex", and "xetex".'
+-          'Default: "".',
++         ('LaTeX graphicx package option. Default: "".',
+           ['--graphicx-option'],
+-          {'default': ''}),
++          {'metavar': '<option>', 'default': ''}),
+          ('LaTeX font encoding. '
+           'Possible values are "", "T1" (default), "OT1", "LGR,T1" or '
+           'any other combination of options to the `fontenc` package. ',
+           ['--font-encoding'],
+-          {'default': 'T1'}),
++          {'metavar': '<encoding>', 'default': 'T1'}),
+          ('Per default the latex-writer puts the reference title into '
+-          'hyperreferences. Specify "ref*" or "pageref*" to get the section '
++          'hyperreferences. Specify "ref" or "pageref" to get the section '
+           'number or the page number.',
+           ['--reference-label'],
+-          {'default': ''}),
++          {'metavar': '<command name>', 'default': ''}),
+          ('Specify style and database(s) for bibtex, for example '
+           '"--use-bibtex=unsrt,mydb1,mydb2". Provisional!',
+           ['--use-bibtex'],
diff --git a/py-docutils/patches/patch-docutils_writers_odf__odt_____init____.py b/py-docutils/patches/patch-docutils_writers_odf__odt_____init____.py
new file mode 100644
index 0000000000..703a3d015c
--- /dev/null
+++ b/py-docutils/patches/patch-docutils_writers_odf__odt_____init____.py
@@ -0,0 +1,18 @@
+$NetBSD$
+
+--- docutils/writers/odf_odt/__init__.py.orig	2025-07-29 14:37:37.693677400 +0000
++++ docutils/writers/odf_odt/__init__.py
+@@ -386,10 +386,9 @@ class Writer(writers.Writer):
+             ('Specify a stylesheet.  '
+                 'Default: "%s"' % default_stylesheet_path,
+                 ['--stylesheet'],
+-                {
+-                    'default': default_stylesheet_path,
+-                    'dest': 'stylesheet'
+-                }),
++                {'default': default_stylesheet_path,
++                    'dest': 'stylesheet',
++                    'metavar': '<filename>'}),
+             ('Specify an ODF-specific configuration/mapping file '
+                 'relative to the current working directory.',
+                 ['--odf-config-file'],
diff --git a/py-docutils/patches/patch-docutils_writers_xetex_____init____.py b/py-docutils/patches/patch-docutils_writers_xetex_____init____.py
new file mode 100644
index 0000000000..e4ae2def9e
--- /dev/null
+++ b/py-docutils/patches/patch-docutils_writers_xetex_____init____.py
@@ -0,0 +1,14 @@
+$NetBSD$
+
+--- docutils/writers/xetex/__init__.py.orig	2025-07-29 14:37:37.839053600 +0000
++++ docutils/writers/xetex/__init__.py
+@@ -57,7 +57,8 @@ class Writer(latex2e.Writer):
+         latex_preamble=('Customization by LaTeX code in the preamble. '
+                         'Default: select "Linux Libertine" fonts.',
+                         ['--latex-preamble'],
+-                        {'default': default_preamble}),
++                        {'metavar': '<preamble>',
++                         'default': default_preamble}),
+         )
+ 
+     def __init__(self) -> None:


Home | Main Index | Thread Index | Old Index