From: Vladimír Vondruš Date: Wed, 21 Aug 2024 10:10:15 +0000 (+0200) Subject: m.code: stop using stuff removed in docutils 0.21. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~cjwatson/git?a=commitdiff_plain;h=b235b3e675e9f700d0ef942a960ed4b7d0a06729;p=blog.git 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. --- 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)