From b235b3e675e9f700d0ef942a960ed4b7d0a06729 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 21 Aug 2024 12:10:15 +0200 Subject: [PATCH] m.code: stop using stuff removed in docutils 0.21. The uses were just copypaste from the upstream implementation, and out of all imports only the error string was used. The documentation suggests using just str() instead, which is what I do, even though it's different from what ErrorString actually formatted. --- plugins/m/code.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/plugins/m/code.py b/plugins/m/code.py index 31ddb879..031bce58 100644 --- a/plugins/m/code.py +++ b/plugins/m/code.py @@ -28,7 +28,6 @@ import os.path import docutils from docutils.parsers import rst from docutils.parsers.rst.roles import set_classes -from docutils.utils.error_reporting import SafeString, ErrorString, locale_encoding from docutils.parsers.rst import Directive, directives import docutils.parsers.rst.directives.misc from docutils import io, nodes, utils, statemachine @@ -203,7 +202,7 @@ class Include(docutils.parsers.rst.directives.misc.Include): (self.name, SafeString(path))) except IOError as error: raise self.severe('Problems with "%s" directive path:\n%s.' % - (self.name, ErrorString(error))) + (self.name, str(error))) startline = self.options.get('start-line', None) endline = self.options.get('end-line', None) try: @@ -214,7 +213,7 @@ class Include(docutils.parsers.rst.directives.misc.Include): rawtext = include_file.read() except UnicodeError as error: raise self.severe('Problem with "%s" directive:\n%s' % - (self.name, ErrorString(error))) + (self.name, str(error))) # start-after/end-before: no restrictions on newlines in match-text, # and no restrictions on matching inside lines vs. line boundaries after_text = self.options.get('start-after', None) -- 2.30.2