|
From: <mi...@us...> - 2022-01-29 16:28:21
|
Revision: 8994
http://sourceforge.net/p/docutils/code/8994
Author: milde
Date: 2022-01-29 16:28:17 +0000 (Sat, 29 Jan 2022)
Log Message:
-----------
Fix code indentation
Check conformance to our coding policies with flake8.
Fix the following problems:
E111 indentation is not a multiple of four
E114 indentation is not a multiple of four (comment)
E115 expected an indented block (comment)
E116 unexpected indentation (comment)
E117 over-indented
E121 continuation line under-indented for hanging indent
E122 continuation line missing indentation or outdented
E124 closing bracked does not match visual indentaion
E127 continuation line over-indented for visual indent
E128 continuation line under-indented for visual indent
E131 continuation line unaligned for hanging indent
Modified Paths:
--------------
trunk/docutils/docutils/__init__.py
trunk/docutils/docutils/core.py
trunk/docutils/docutils/frontend.py
trunk/docutils/docutils/io.py
trunk/docutils/docutils/languages/zh_cn.py
trunk/docutils/docutils/languages/zh_tw.py
trunk/docutils/docutils/nodes.py
trunk/docutils/docutils/parsers/__init__.py
trunk/docutils/docutils/parsers/recommonmark_wrapper.py
trunk/docutils/docutils/parsers/rst/__init__.py
trunk/docutils/docutils/parsers/rst/directives/body.py
trunk/docutils/docutils/parsers/rst/directives/misc.py
trunk/docutils/docutils/parsers/rst/languages/ar.py
trunk/docutils/docutils/parsers/rst/languages/fa.py
trunk/docutils/docutils/parsers/rst/languages/fr.py
trunk/docutils/docutils/parsers/rst/languages/he.py
trunk/docutils/docutils/parsers/rst/languages/it.py
trunk/docutils/docutils/parsers/rst/languages/ru.py
trunk/docutils/docutils/parsers/rst/languages/sk.py
trunk/docutils/docutils/parsers/rst/roles.py
trunk/docutils/docutils/parsers/rst/states.py
trunk/docutils/docutils/parsers/rst/tableparser.py
trunk/docutils/docutils/statemachine.py
trunk/docutils/docutils/transforms/peps.py
trunk/docutils/docutils/transforms/references.py
trunk/docutils/docutils/transforms/universal.py
trunk/docutils/docutils/utils/__init__.py
trunk/docutils/docutils/utils/code_analyzer.py
trunk/docutils/docutils/utils/error_reporting.py
trunk/docutils/docutils/utils/math/latex2mathml.py
trunk/docutils/docutils/utils/math/math2html.py
trunk/docutils/docutils/utils/math/tex2mathml_extern.py
trunk/docutils/docutils/utils/smartquotes.py
trunk/docutils/docutils/utils/urischemes.py
trunk/docutils/docutils/writers/_html_base.py
trunk/docutils/docutils/writers/html4css1/__init__.py
trunk/docutils/docutils/writers/html5_polyglot/__init__.py
trunk/docutils/docutils/writers/latex2e/__init__.py
trunk/docutils/docutils/writers/manpage.py
trunk/docutils/docutils/writers/odf_odt/pygmentsformatter.py
trunk/docutils/docutils/writers/pep_html/__init__.py
trunk/docutils/docutils/writers/pseudoxml.py
trunk/docutils/docutils/writers/s5_html/__init__.py
trunk/docutils/docutils/writers/xetex/__init__.py
trunk/docutils/test/functional/tests/dangerous.py
trunk/docutils/test/functional/tests/pep_html.py
trunk/docutils/test/functional/tests/standalone_rst_s5_html_1.py
trunk/docutils/test/package_unittest.py
trunk/docutils/test/test__init__.py
trunk/docutils/test/test_dependencies.py
trunk/docutils/test/test_io.py
trunk/docutils/test/test_nodes.py
trunk/docutils/test/test_parsers/test_rst/test_directives/test_block_quotes.py
trunk/docutils/test/test_publisher.py
trunk/docutils/test/test_settings.py
trunk/docutils/test/test_statemachine.py
trunk/docutils/test/test_traversals.py
trunk/docutils/test/test_utils.py
trunk/docutils/test/test_viewlist.py
trunk/docutils/test/test_writers/test_docutils_xml.py
trunk/docutils/test/test_writers/test_html4css1_misc.py
trunk/docutils/test/test_writers/test_html4css1_template.py
trunk/docutils/test/test_writers/test_html5_polyglot_misc.py
trunk/docutils/test/test_writers/test_html5_polyglot_parts.py
trunk/docutils/test/test_writers/test_latex2e.py
trunk/docutils/test/test_writers/test_latex2e_misc.py
trunk/docutils/test/test_writers/test_odt.py
trunk/docutils/tools/buildhtml.py
trunk/docutils/tools/dev/generate_punctuation_chars.py
trunk/docutils/tools/dev/unicode2rstsubs.py
trunk/docutils/tools/docutils-cli.py
trunk/docutils/tools/quicktest.py
trunk/docutils/tools/rst2odt.py
trunk/docutils/tox.ini
Modified: trunk/docutils/docutils/__init__.py
===================================================================
--- trunk/docutils/docutils/__init__.py 2022-01-29 13:20:04 UTC (rev 8993)
+++ trunk/docutils/docutils/__init__.py 2022-01-29 16:28:17 UTC (rev 8994)
@@ -84,8 +84,8 @@
if releaselevel == 'final':
if not release:
raise ValueError('releaselevel "final" must not be used '
- 'with development versions (leads to wrong '
- 'version ordering of the related __version__')
+ 'with development versions (leads to wrong '
+ 'version ordering of the related __version__')
if serial != 0:
raise ValueError('"serial" must be 0 for final releases')
Modified: trunk/docutils/docutils/core.py
===================================================================
--- trunk/docutils/docutils/core.py 2022-01-29 13:20:04 UTC (rev 8993)
+++ trunk/docutils/docutils/core.py 2022-01-29 16:28:17 UTC (rev 8994)
@@ -275,7 +275,7 @@
def report_SystemMessage(self, error):
print('Exiting due to level-%s (%s) system message.' % (
- error.level, utils.Reporter.levels[error.level]),
+ error.level, utils.Reporter.levels[error.level]),
file=self._stderr)
def report_UnicodeError(self, error):
@@ -508,14 +508,18 @@
return pub.publish(enable_exit_status=enable_exit_status)
def publish_cmdline_to_binary(reader=None, reader_name='standalone',
- parser=None, parser_name='restructuredtext',
- writer=None, writer_name='pseudoxml',
- settings=None, settings_spec=None,
- settings_overrides=None, config_section=None,
- enable_exit_status=True, argv=None,
- usage=default_usage, description=default_description,
- destination=None, destination_class=io.BinaryFileOutput
- ):
+ parser=None, parser_name='restructuredtext',
+ writer=None, writer_name='pseudoxml',
+ settings=None,
+ settings_spec=None,
+ settings_overrides=None,
+ config_section=None,
+ enable_exit_status=True,
+ argv=None,
+ usage=default_usage,
+ description=default_description,
+ destination=None,
+ destination_class=io.BinaryFileOutput):
"""
Set up & run a `Publisher` for command-line-based file I/O (input and
output file paths taken automatically from the command line). Return the
@@ -533,7 +537,7 @@
(along with command-line option descriptions).
"""
pub = Publisher(reader, parser, writer, settings=settings,
- destination_class=destination_class)
+ destination_class=destination_class)
pub.set_components(reader_name, parser_name, writer_name)
output = pub.publish(
argv, usage, description, settings_spec, settings_overrides,
Modified: trunk/docutils/docutils/frontend.py
===================================================================
--- trunk/docutils/docutils/frontend.py 2022-01-29 13:20:04 UTC (rev 8993)
+++ trunk/docutils/docutils/frontend.py 2022-01-29 16:28:17 UTC (rev 8994)
@@ -162,7 +162,7 @@
return value
def validate_comma_separated_list(setting, value, option_parser,
- config_parser=None, config_section=None):
+ config_parser=None, config_section=None):
"""Check/normalize list arguments (split at "," and strip whitespace).
"""
# `value` may be ``bytes``, ``str``, or a ``list`` (when given as
@@ -207,7 +207,7 @@
return value
def validate_smartquotes_locales(setting, value, option_parser,
- config_parser=None, config_section=None):
+ config_parser=None, config_section=None):
"""Check/normalize a comma separated list of smart quote definitions.
Return a list of (language-tag, quotes) string tuples."""
@@ -236,7 +236,7 @@
quotes = multichar_quotes
elif len(quotes) != 4:
raise ValueError('Invalid value "%s". Please specify 4 quotes\n'
- ' (primary open/close; secondary open/close).'
+ ' (primary open/close; secondary open/close).'
% item.encode('ascii', 'backslashreplace'))
lc_quotes.append((lang, quotes))
return lc_quotes
@@ -281,8 +281,7 @@
# opt_spec is ("<help>", [<option strings>], {<keyword args>})
opt_name = [opt_string[2:].replace('-', '_')
for opt_string in opt_spec[1]
- if opt_string.startswith('--')
- ][0]
+ if opt_string.startswith('--')][0]
if opt_name in exclude:
continue
if opt_name in replace.keys():
Modified: trunk/docutils/docutils/io.py
===================================================================
--- trunk/docutils/docutils/io.py 2022-01-29 13:20:04 UTC (rev 8993)
+++ trunk/docutils/docutils/io.py 2022-01-29 16:28:17 UTC (rev 8994)
@@ -281,7 +281,7 @@
except TypeError:
if isinstance(data, str): # destination may expect bytes
self.destination.write(data.encode(self.encoding,
- self.encoding_errors))
+ self.encoding_errors))
elif self.destination in (sys.stderr, sys.stdout):
self.destination.buffer.write(data) # write bytes to raw stream
else:
@@ -422,9 +422,9 @@
self.opened = True
self.autoclose = autoclose
if handle_io_errors is not None:
- warnings.warn('io.FileOutput: initialization argument '
- '"handle_io_errors" is ignored and will be removed in '
- 'Docutils 1.2.', DeprecationWarning, stacklevel=2)
+ warnings.warn('io.FileOutput: init argument "handle_io_errors" '
+ 'is ignored and will be removed in '
+ 'Docutils 1.2.', DeprecationWarning, stacklevel=2)
if mode is not None:
self.mode = mode
self._stderr = ErrorOutput()
@@ -436,9 +436,9 @@
elif (# destination is file-type object -> check mode:
mode and hasattr(self.destination, 'mode')
and mode != self.destination.mode):
- print('Warning: Destination mode "%s" differs from specified '
- 'mode "%s"' % (self.destination.mode, mode),
- file=self._stderr)
+ print('Warning: Destination mode "%s" differs from specified '
+ 'mode "%s"' % (self.destination.mode, mode),
+ file=self._stderr)
if not destination_path:
try:
self.destination_path = self.destination.name
@@ -482,10 +482,12 @@
except AttributeError:
if check_encoding(self.destination,
self.encoding) is False:
- raise ValueError('Encoding of %s (%s) differs \n'
+ raise ValueError(
+ 'Encoding of %s (%s) differs \n'
' from specified encoding (%s)' %
(self.destination_path or 'destination',
- self.destination.encoding, self.encoding))
+ self.destination.encoding,
+ self.encoding))
else:
raise err
except (UnicodeError, LookupError) as err:
Modified: trunk/docutils/docutils/languages/zh_cn.py
===================================================================
--- trunk/docutils/docutils/languages/zh_cn.py 2022-01-29 13:20:04 UTC (rev 8993)
+++ trunk/docutils/docutils/languages/zh_cn.py 2022-01-29 16:28:17 UTC (rev 8994)
@@ -61,6 +61,6 @@
'\uff1b', # ';'
'\uff0c', # ','
'\u3001', # '、'
- ]
+ ]
"""List of separator strings for the 'Authors' bibliographic field. Tried in
order."""
Modified: trunk/docutils/docutils/languages/zh_tw.py
===================================================================
--- trunk/docutils/docutils/languages/zh_tw.py 2022-01-29 13:20:04 UTC (rev 8993)
+++ trunk/docutils/docutils/languages/zh_tw.py 2022-01-29 16:28:17 UTC (rev 8994)
@@ -60,6 +60,6 @@
'\uff1b', # ';'
'\uff0c', # ','
'\u3001', # '、'
- ]
+ ]
"""List of separator strings for the 'Authors' bibliographic field. Tried in
order."""
Modified: trunk/docutils/docutils/nodes.py
===================================================================
--- trunk/docutils/docutils/nodes.py 2022-01-29 13:20:04 UTC (rev 8993)
+++ trunk/docutils/docutils/nodes.py 2022-01-29 16:28:17 UTC (rev 8994)
@@ -670,7 +670,7 @@
def astext(self):
return self.child_text_separator.join(
- [child.astext() for child in self.children])
+ [child.astext() for child in self.children])
def non_default_attributes(self):
atts = {}
@@ -1125,7 +1125,7 @@
if text != '':
textnode = Text(text)
Element.__init__(self, rawsource, textnode, *children,
- **attributes)
+ **attributes)
else:
Element.__init__(self, rawsource, *children, **attributes)
@@ -1385,8 +1385,9 @@
else:
prefix = id_prefix + auto_id_prefix
if prefix.endswith('%'):
- prefix = '%s%s-' % (prefix[:-1], suggested_prefix
- or make_id(node.tagname))
+ prefix = '%s%s-' % (prefix[:-1],
+ suggested_prefix
+ or make_id(node.tagname))
while True:
self.id_counter[prefix] += 1
id = '%s%d' % (prefix, self.id_counter[prefix])
@@ -1448,9 +1449,9 @@
old_node = self.ids[old_id]
if 'refuri' in node:
refuri = node['refuri']
- if old_node['names'] \
- and 'refuri' in old_node \
- and old_node['refuri'] == refuri:
+ if (old_node['names']
+ and 'refuri' in old_node
+ and old_node['refuri'] == refuri):
level = 1 # just inform if refuri's identical
if level > 1:
dupname(old_node, name)
@@ -1542,8 +1543,8 @@
name = whitespace_normalize_name(def_name)
if name in self.substitution_defs:
msg = self.reporter.error(
- 'Duplicate substitution definition name: "%s".' % name,
- base_node=subdef)
+ 'Duplicate substitution definition name: "%s".' % name,
+ base_node=subdef)
if msgnode is not None:
msgnode += msg
oldnode = self.substitution_defs[name]
@@ -1574,7 +1575,7 @@
def copy(self):
obj = self.__class__(self.settings, self.reporter,
- **self.attributes)
+ **self.attributes)
obj.source = self.source
obj.line = self.line
return obj
@@ -1796,7 +1797,7 @@
def astext(self):
line = self.get('line', '')
return '%s:%s: (%s/%s) %s' % (self['source'], line, self['type'],
- self['level'], Element.astext(self))
+ self['level'], Element.astext(self))
class pending(Special, Invisible, Element):
@@ -1839,11 +1840,10 @@
"""Detail data (dictionary) required by the pending operation."""
def pformat(self, indent=' ', level=0):
- internals = [
- '.. internal attributes:',
- ' .transform: %s.%s' % (self.transform.__module__,
- self.transform.__name__),
- ' .details:']
+ internals = ['.. internal attributes:',
+ ' .transform: %s.%s' % (self.transform.__module__,
+ self.transform.__name__),
+ ' .details:']
details = sorted(self.details.items())
for key, value in details:
if isinstance(value, Node):
@@ -1850,8 +1850,9 @@
internals.append('%7s%s:' % ('', key))
internals.extend(['%9s%s' % ('', line)
for line in value.pformat().splitlines()])
- elif value and isinstance(value, list) \
- and isinstance(value[0], Node):
+ elif (value
+ and isinstance(value, list)
+ and isinstance(value[0], Node)):
internals.append('%7s%s:' % ('', key))
for v in value:
internals.extend(['%9s%s' % ('', line)
@@ -1864,7 +1865,7 @@
def copy(self):
obj = self.__class__(self.transform, self.details, self.rawsource,
- **self.attributes)
+ **self.attributes)
obj._document = self._document
obj.source = self.source
obj.line = self.line
@@ -2229,8 +2230,8 @@
id = id.translate(_non_id_translate)
# get rid of non-ascii characters.
# 'ascii' lowercase to prevent problems with turkish locale.
- id = unicodedata.normalize('NFKD', id).\
- encode('ascii', 'ignore').decode('ascii')
+ id = unicodedata.normalize(
+ 'NFKD', id).encode('ascii', 'ignore').decode('ascii')
# shrink runs of whitespace and replace by hyphen
id = _non_id_chars.sub('-', ' '.join(id.split()))
id = _non_id_at_ends.sub('', id)
Modified: trunk/docutils/docutils/parsers/__init__.py
===================================================================
--- trunk/docutils/docutils/parsers/__init__.py 2022-01-29 13:20:04 UTC (rev 8993)
+++ trunk/docutils/docutils/parsers/__init__.py 2022-01-29 16:28:17 UTC (rev 8994)
@@ -39,7 +39,8 @@
['--line-length-limit'],
{'metavar': '<length>', 'type': 'int', 'default': 10000,
'validator': frontend.validate_nonnegative_int}),
- ))
+ )
+ )
component_type = 'parser'
config_section = 'parsers'
Modified: trunk/docutils/docutils/parsers/recommonmark_wrapper.py
===================================================================
--- trunk/docutils/docutils/parsers/recommonmark_wrapper.py 2022-01-29 13:20:04 UTC (rev 8993)
+++ trunk/docutils/docutils/parsers/recommonmark_wrapper.py 2022-01-29 16:28:17 UTC (rev 8994)
@@ -44,6 +44,11 @@
pending_xref = nodes.pending
+# auxiliary function for `document.findall()`
+def is_literal(node):
+ return isinstance(node, (nodes.literal, nodes.literal_block))
+
+
class Parser(CommonMarkParser):
"""MarkDown parser based on recommonmark.
@@ -94,8 +99,7 @@
i += 1
# add "code" class argument to literal elements (inline and block)
- for node in document.findall(lambda n: isinstance(n,
- (nodes.literal, nodes.literal_block))):
+ for node in document.findall(is_literal):
if 'code' not in node['classes']:
node['classes'].append('code')
# move "language" argument to classes
Modified: trunk/docutils/docutils/parsers/rst/__init__.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/__init__.py 2022-01-29 13:20:04 UTC (rev 8993)
+++ trunk/docutils/docutils/parsers/rst/__init__.py 2022-01-29 16:28:17 UTC (rev 8994)
@@ -143,7 +143,8 @@
['--character-level-inline-markup'],
{'action': 'store_true', 'default': False,
'dest': 'character_level_inline_markup'}),
- ))
+ )
+ )
config_section = 'restructuredtext parser'
config_section_dependencies = ('parsers',)
Modified: trunk/docutils/docutils/parsers/rst/directives/body.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/directives/body.py 2022-01-29 13:20:04 UTC (rev 8993)
+++ trunk/docutils/docutils/parsers/rst/directives/body.py 2022-01-29 16:28:17 UTC (rev 8994)
@@ -45,7 +45,7 @@
textnodes, more_messages = self.state.inline_text(
self.options['subtitle'], self.lineno)
titles.append(nodes.subtitle(self.options['subtitle'], '',
- *textnodes))
+ *textnodes))
messages.extend(more_messages)
else:
titles = []
@@ -137,7 +137,7 @@
option_spec = {'class': directives.class_option,
'name': directives.unchanged,
'number-lines': directives.unchanged # integer or None
- }
+ }
has_content = True
def run(self):
@@ -193,9 +193,10 @@
class MathBlock(Directive):
option_spec = {'class': directives.class_option,
- 'name': directives.unchanged}
+ 'name': directives.unchanged,
## TODO: Add Sphinx' ``mathbase.py`` option 'nowrap'?
# 'nowrap': directives.flag,
+ }
has_content = True
def run(self):
Modified: trunk/docutils/docutils/parsers/rst/directives/misc.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/directives/misc.py 2022-01-29 13:20:04 UTC (rev 8993)
+++ trunk/docutils/docutils/parsers/rst/directives/misc.py 2022-01-29 16:28:17 UTC (rev 8994)
@@ -80,7 +80,7 @@
(self.name, path))
except OSError as error:
raise self.severe('Problems with "%s" directive path:\n%s.' %
- (self.name, io.error_string(error)))
+ (self.name, io.error_string(error)))
else:
self.state.document.settings.record_dependencies.add(path)
@@ -128,8 +128,9 @@
text = rawtext.expandtabs(tab_width)
else:
text = rawtext
- literal_block = nodes.literal_block(rawtext, source=path,
- classes=self.options.get('class', []))
+ literal_block = nodes.literal_block(
+ rawtext, source=path,
+ classes=self.options.get('class', []))
literal_block.line = 1
self.add_name(literal_block)
if 'number-lines' in self.options:
@@ -260,7 +261,7 @@
text = raw_file.read()
except UnicodeError as error:
raise self.severe('Problem with "%s" directive:\n%s'
- % (self.name, io.error_string(error)))
+ % (self.name, io.error_string(error)))
attributes['source'] = path
elif 'url' in self.options:
source = self.options['url']
@@ -273,7 +274,9 @@
raw_text = urlopen(source).read()
except (URLError, OSError) as error:
raise self.severe('Problems with "%s" directive URL "%s":\n%s.'
- % (self.name, self.options['url'], io.error_string(error)))
+ % (self.name,
+ self.options['url'],
+ io.error_string(error)))
raw_file = io.StringInput(source=raw_text, source_path=source,
encoding=encoding,
error_handler=e_handler)
@@ -289,7 +292,7 @@
raw_node = nodes.raw('', text, classes=self.options.get('class', []),
**attributes)
(raw_node.source,
- raw_node.line) = self.state_machine.get_source_and_line(self.lineno)
+ raw_node.line) = self.state_machine.get_source_and_line(self.lineno)
return [raw_node]
@@ -364,7 +367,7 @@
decoded = directives.unicode_code(code)
except ValueError as error:
raise self.error('Invalid character code: %s\n%s'
- % (code, io.error_string(error)))
+ % (code, io.error_string(error)))
element += nodes.Text(decoded)
return element.children
@@ -444,10 +447,10 @@
'supported (specified by "%r" role).' % (self.name, base_role))
try:
converted_role = convert_directive_function(base_role)
- (arguments, options, content, content_offset) = (
- self.state.parse_directive_block(
- self.content[1:], self.content_offset, converted_role,
- option_presets={}))
+ (arguments, options, content, content_offset
+ ) = self.state.parse_directive_block(
+ self.content[1:], self.content_offset,
+ converted_role, option_presets={})
except states.MarkupError as detail:
error = self.reporter.error(
'Error in "%s" directive:\n%s.' % (self.name, detail),
@@ -458,8 +461,9 @@
try:
options['class'] = directives.class_option(new_role_name)
except ValueError as detail:
- error = self.reporter.error('Invalid argument '
- 'for "%s" directive:\n%s.' % (self.name, detail),
+ error = self.reporter.error(
+ 'Invalid argument for "%s" directive:\n%s.'
+ % (self.name, detail),
nodes.literal_block(self.block_text, self.block_text),
line=self.lineno)
return messages + [error]
@@ -516,8 +520,8 @@
def parsemeta(self, match):
name = self.parse_field_marker(match)
name = utils.unescape(utils.escape2null(name))
- indented, indent, line_offset, blank_finish = \
- self.state_machine.get_first_known_indented(match.end())
+ (indented, indent, line_offset, blank_finish
+ ) = self.state_machine.get_first_known_indented(match.end())
node = nodes.meta()
node['content'] = utils.unescape(utils.escape2null(
' '.join(indented)))
Modified: trunk/docutils/docutils/parsers/rst/languages/ar.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/languages/ar.py 2022-01-29 13:20:04 UTC (rev 8993)
+++ trunk/docutils/docutils/parsers/rst/languages/ar.py 2022-01-29 16:28:17 UTC (rev 8994)
@@ -15,57 +15,57 @@
__docformat__ = 'reStructuredText'
directives = {
- # language-dependent: fixed
- 'تنبيه': 'attention',
- 'احتیاط': 'caution',
- 'كود': 'code',
- 'خطر': 'danger',
- 'خطأ': 'error',
- 'تلميح': 'hint',
- 'مهم': 'important',
- 'ملاحظة': 'note',
- 'نصيحة': 'tip',
- 'تحذير': 'warning',
- 'تذكير': 'admonition',
- 'شريط-جانبي': 'sidebar',
- 'موضوع': 'topic',
- 'قالب-سطري': 'line-block',
- 'لفظ-حرفي': 'parsed-literal',
- 'معيار': 'rubric',
- 'فكرة-الكتاب': 'epigraph',
- 'تمييز': 'highlights',
- 'نقل-قول': 'pull-quote',
- 'ترکیب': 'compound',
- 'وعاء': 'container',
- #'questions': 'questions',
- 'جدول': 'table',
- 'جدول-csv': 'csv-table',
- 'جدول-قوائم': 'list-table',
- #'qa': 'questions',
- #'faq': 'questions',
- 'ميتا': 'meta',
- 'رياضيات': 'math',
- #'imagemap': 'imagemap',
- 'صورة': 'image',
- 'رسم-توضيحي': 'figure',
- 'تضمين': 'include',
- 'خام': 'raw',
- 'تبديل': 'replace',
- 'یونیکد': 'unicode',
- 'تاریخ': 'date',
- 'كائن': 'class',
- 'قانون': 'role',
- 'قانون-افتراضي': 'default-role',
- 'عنوان': 'title',
- 'المحتوى': 'contents',
- 'رقم-الفصل': 'sectnum',
- 'رقم-القسم': 'sectnum',
- 'رأس-الصفحة': 'header',
- 'هامش': 'footer',
- #'footnotes': 'footnotes',
- #'citations': 'citations',
- '': 'target-notes',
- }
+ # language-dependent: fixed
+ 'تنبيه': 'attention',
+ 'احتیاط': 'caution',
+ 'كود': 'code',
+ 'خطر': 'danger',
+ 'خطأ': 'error',
+ 'تلميح': 'hint',
+ 'مهم': 'important',
+ 'ملاحظة': 'note',
+ 'نصيحة': 'tip',
+ 'تحذير': 'warning',
+ 'تذكير': 'admonition',
+ 'شريط-جانبي': 'sidebar',
+ 'موضوع': 'topic',
+ 'قالب-سطري': 'line-block',
+ 'لفظ-حرفي': 'parsed-literal',
+ 'معيار': 'rubric',
+ 'فكرة-الكتاب': 'epigraph',
+ 'تمييز': 'highlights',
+ 'نقل-قول': 'pull-quote',
+ 'ترکیب': 'compound',
+ 'وعاء': 'container',
+ #'questions': 'questions',
+ 'جدول': 'table',
+ 'جدول-csv': 'csv-table',
+ 'جدول-قوائم': 'list-table',
+ #'qa': 'questions',
+ #'faq': 'questions',
+ 'ميتا': 'meta',
+ 'رياضيات': 'math',
+ #'imagemap': 'imagemap',
+ 'صورة': 'image',
+ 'رسم-توضيحي': 'figure',
+ 'تضمين': 'include',
+ 'خام': 'raw',
+ 'تبديل': 'replace',
+ 'یونیکد': 'unicode',
+ 'تاریخ': 'date',
+ 'كائن': 'class',
+ 'قانون': 'role',
+ 'قانون-افتراضي': 'default-role',
+ 'عنوان': 'title',
+ 'المحتوى': 'contents',
+ 'رقم-الفصل': 'sectnum',
+ 'رقم-القسم': 'sectnum',
+ 'رأس-الصفحة': 'header',
+ 'هامش': 'footer',
+ #'footnotes': 'footnotes',
+ #'citations': 'citations',
+ '': 'target-notes',
+}
"""Arabic name to registered (in directives/__init__.py) directive name
mapping."""
@@ -93,6 +93,7 @@
'منبع-uri': 'uri-reference',
'uri': 'uri-reference',
'url': 'uri-reference',
- 'خام': 'raw',}
+ 'خام': 'raw',
+}
"""Mapping of Arabic role names to canonical role names for interpreted text.
"""
Modified: trunk/docutils/docutils/parsers/rst/languages/fa.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/languages/fa.py 2022-01-29 13:20:04 UTC (rev 8993)
+++ trunk/docutils/docutils/parsers/rst/languages/fa.py 2022-01-29 16:28:17 UTC (rev 8994)
@@ -16,59 +16,59 @@
directives = {
- # language-dependent: fixed
- 'توجه': 'attention',
- 'احتیاط': 'caution',
- 'کد': 'code',
- 'بلوک-کد': 'code',
- 'کد-منبع': 'code',
- 'خطر': 'danger',
- 'خطا': 'error',
- 'راهنما': 'hint',
- 'مهم': 'important',
- 'یادداشت': 'note',
- 'نکته': 'tip',
- 'اخطار': 'warning',
- 'تذکر': 'admonition',
- 'نوار-کناری': 'sidebar',
- 'موضوع': 'topic',
- 'بلوک-خط': 'line-block',
- 'تلفظ-پردازش-شده': 'parsed-literal',
- 'سر-فصل': 'rubric',
- 'کتیبه': 'epigraph',
- 'نکات-برجسته': 'highlights',
- 'نقل-قول': 'pull-quote',
- 'ترکیب': 'compound',
- 'ظرف': 'container',
- #'questions': 'questions',
- 'جدول': 'table',
- 'جدول-csv': 'csv-table',
- 'جدول-لیست': 'list-table',
- #'qa': 'questions',
- #'faq': 'questions',
- 'متا': 'meta',
- 'ریاضی': 'math',
- #'imagemap': 'imagemap',
- 'تصویر': 'image',
- 'شکل': 'figure',
- 'شامل': 'include',
- 'خام': 'raw',
- 'جایگزین': 'replace',
- 'یونیکد': 'unicode',
- 'تاریخ': 'date',
- 'کلاس': 'class',
- 'قانون': 'role',
- 'قانون-پیشفرض': 'default-role',
- 'عنوان': 'title',
- 'محتوا': 'contents',
- 'شماره-فصل': 'sectnum',
- 'شمارهگذاری-فصل': 'sectnum',
- 'سرآیند': 'header',
- 'پاصفحه': 'footer',
- #'footnotes': 'footnotes',
- #'citations': 'citations',
- 'یادداشت-هدف': 'target-notes',
- }
+ # language-dependent: fixed
+ 'توجه': 'attention',
+ 'احتیاط': 'caution',
+ 'کد': 'code',
+ 'بلوک-کد': 'code',
+ 'کد-منبع': 'code',
+ 'خطر': 'danger',
+ 'خطا': 'error',
+ 'راهنما': 'hint',
+ 'مهم': 'important',
+ 'یادداشت': 'note',
+ 'نکته': 'tip',
+ 'اخطار': 'warning',
+ 'تذکر': 'admonition',
+ 'نوار-کناری': 'sidebar',
+ 'موضوع': 'topic',
+ 'بلوک-خط': 'line-block',
+ 'تلفظ-پردازش-شده': 'parsed-literal',
+ 'سر-فصل': 'rubric',
+ 'کتیبه': 'epigraph',
+ 'نکات-برجسته': 'highlights',
+ 'نقل-قول': 'pull-quote',
+ 'ترکیب': 'compound',
+ 'ظرف': 'container',
+ #'questions': 'questions',
+ 'جدول': 'table',
+ 'جدول-csv': 'csv-table',
+ 'جدول-لیست': 'list-table',
+ #'qa': 'questions',
+ #'faq': 'questions',
+ 'متا': 'meta',
+ 'ریاضی': 'math',
+ #'imagemap': 'imagemap',
+ 'تصویر': 'image',
+ 'شکل': 'figure',
+ 'شامل': 'include',
+ 'خام': 'raw',
+ 'جایگزین': 'replace',
+ 'یونیکد': 'unicode',
+ 'تاریخ': 'date',
+ 'کلاس': 'class',
+ 'قانون': 'role',
+ 'قانون-پیشفرض': 'default-role',
+ 'عنوان': 'title',
+ 'محتوا': 'contents',
+ 'شماره-فصل': 'sectnum',
+ 'شمارهگذاری-فصل': 'sectnum',
+ 'سرآیند': 'header',
+ 'پاصفحه': 'footer',
+ #'footnotes': 'footnotes',
+ #'citations': 'citations',
+ 'یادداشت-هدف': 'target-notes',
+}
"""Persian name to registered (in directives/__init__.py) directive name
mapping."""
@@ -96,6 +96,7 @@
'منبع-uri': 'uri-reference',
'uri': 'uri-reference',
'url': 'uri-reference',
- 'خام': 'raw',}
+ 'خام': 'raw',
+}
"""Mapping of Persian role names to canonical role names for interpreted text.
"""
Modified: trunk/docutils/docutils/parsers/rst/languages/fr.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/languages/fr.py 2022-01-29 13:20:04 UTC (rev 8993)
+++ trunk/docutils/docutils/parsers/rst/languages/fr.py 2022-01-29 16:28:17 UTC (rev 8994)
@@ -90,7 +90,7 @@
'emphase': 'emphasis',
'fort': 'strong',
'litt\u00E9ral': 'literal',
- 'math (translation required)': 'math',
+ 'math (translation required)': 'math',
'nomm\u00E9e-r\u00E9f\u00E9rence': 'named-reference',
'anonyme-r\u00E9f\u00E9rence': 'anonymous-reference',
'note-r\u00E9f\u00E9rence': 'footnote-reference',
Modified: trunk/docutils/docutils/parsers/rst/languages/he.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/languages/he.py 2022-01-29 13:20:04 UTC (rev 8993)
+++ trunk/docutils/docutils/parsers/rst/languages/he.py 2022-01-29 16:28:17 UTC (rev 8994)
@@ -54,7 +54,7 @@
'replace': 'replace',
'unicode': 'unicode',
'date': 'date',
- '\u05e1\u05d2\u05e0\u05d5\u05df': 'class',
+ '\u05e1\u05d2\u05e0\u05d5\u05df': 'class',
'role': 'role',
'default-role': 'default-role',
'title': 'title',
Modified: trunk/docutils/docutils/parsers/rst/languages/it.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/languages/it.py 2022-01-29 13:20:04 UTC (rev 8993)
+++ trunk/docutils/docutils/parsers/rst/languages/it.py 2022-01-29 16:28:17 UTC (rev 8994)
@@ -84,7 +84,7 @@
'enfasi': 'emphasis',
'forte': 'strong',
'letterale': 'literal',
- 'math (translation required)': 'math',
+ 'math (translation required)': 'math',
'riferimento-con-nome': 'named-reference',
'riferimento-anonimo': 'anonymous-reference',
'riferimento-nota': 'footnote-reference',
Modified: trunk/docutils/docutils/parsers/rst/languages/ru.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/languages/ru.py 2022-01-29 13:20:04 UTC (rev 8993)
+++ trunk/docutils/docutils/parsers/rst/languages/ru.py 2022-01-29 16:28:17 UTC (rev 8994)
@@ -15,74 +15,74 @@
__docformat__ = 'reStructuredText'
directives = {
- 'блок-строк': 'line-block',
- 'meta': 'meta',
- 'математика': 'math',
- 'обработанный-литерал': 'parsed-literal',
- 'выделенная-цитата': 'pull-quote',
- 'код': 'code',
- 'compound (translation required)': 'compound',
- 'контейнер': 'container',
- 'таблица': 'table',
- 'csv-table (translation required)': 'csv-table',
- 'list-table (translation required)': 'list-table',
- 'сырой': 'raw',
- 'замена': 'replace',
- 'тестовая-директива-restructuredtext': 'restructuredtext-test-directive',
- 'целевые-сноски': 'target-notes',
- 'unicode': 'unicode',
- 'дата': 'date',
- 'боковая-полоса': 'sidebar',
- 'важно': 'important',
- 'включать': 'include',
- 'внимание': 'attention',
- 'выделение': 'highlights',
- 'замечание': 'admonition',
- 'изображение': 'image',
- 'класс': 'class',
- 'роль': 'role',
- 'default-role (translation required)': 'default-role',
- 'титул': 'title',
- 'номер-раздела': 'sectnum',
- 'нумерация-разделов': 'sectnum',
- 'опасно': 'danger',
- 'осторожно': 'caution',
- 'ошибка': 'error',
- 'подсказка': 'tip',
- 'предупреждение': 'warning',
- 'примечание': 'note',
- 'рисунок': 'figure',
- 'рубрика': 'rubric',
- 'совет': 'hint',
- 'содержание': 'contents',
- 'тема': 'topic',
- 'эпиграф': 'epigraph',
- 'header (translation required)': 'header',
- 'footer (translation required)': 'footer',}
+ 'блок-строк': 'line-block',
+ 'meta': 'meta',
+ 'математика': 'math',
+ 'обработанный-литерал': 'parsed-literal',
+ 'выделенная-цитата': 'pull-quote',
+ 'код': 'code',
+ 'compound (translation required)': 'compound',
+ 'контейнер': 'container',
+ 'таблица': 'table',
+ 'csv-table (translation required)': 'csv-table',
+ 'list-table (translation required)': 'list-table',
+ 'сырой': 'raw',
+ 'замена': 'replace',
+ 'тестовая-директива-restructuredtext': 'restructuredtext-test-directive',
+ 'целевые-сноски': 'target-notes',
+ 'unicode': 'unicode',
+ 'дата': 'date',
+ 'боковая-полоса': 'sidebar',
+ 'важно': 'important',
+ 'включать': 'include',
+ 'внимание': 'attention',
+ 'выделение': 'highlights',
+ 'замечание': 'admonition',
+ 'изображение': 'image',
+ 'класс': 'class',
+ 'роль': 'role',
+ 'default-role (translation required)': 'default-role',
+ 'титул': 'title',
+ 'номер-раздела': 'sectnum',
+ 'нумерация-разделов': 'sectnum',
+ 'опасно': 'danger',
+ 'осторожно': 'caution',
+ 'ошибка': 'error',
+ 'подсказка': 'tip',
+ 'предупреждение': 'warning',
+ 'примечание': 'note',
+ 'рисунок': 'figure',
+ 'рубрика': 'rubric',
+ 'совет': 'hint',
+ 'содержание': 'contents',
+ 'тема': 'topic',
+ 'эпиграф': 'epigraph',
+ 'header (translation required)': 'header',
+ 'footer (translation required)': 'footer',}
"""Russian 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-reference',
- 'ссылка-на-сноску': 'footnote-reference',
- 'цитатная-ссылка': 'citation-reference',
- 'цель': 'target',
- 'сырой': 'raw',}
+ 'акроним': '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-reference',
+ 'ссылка-на-сноску': 'footnote-reference',
+ 'цитатная-ссылка': 'citation-reference',
+ 'цель': 'target',
+ 'сырой': 'raw',}
"""Mapping of Russian role names to canonical role names for interpreted text.
"""
Modified: trunk/docutils/docutils/parsers/rst/languages/sk.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/languages/sk.py 2022-01-29 13:20:04 UTC (rev 8993)
+++ trunk/docutils/docutils/parsers/rst/languages/sk.py 2022-01-29 16:28:17 UTC (rev 8994)
@@ -82,7 +82,7 @@
'emphasis (translation required)': 'emphasis',
'strong (translation required)': 'strong',
'literal (translation required)': 'literal',
- 'math (translation required)': 'math',
+ 'math (translation required)': 'math',
'named-reference (translation required)': 'named-reference',
'anonymous-reference (translation required)': 'anonymous-reference',
'footnote-reference (translation required)': 'footnote-reference',
Modified: trunk/docutils/docutils/parsers/rst/roles.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/roles.py 2022-01-29 13:20:04 UTC (rev 8993)
+++ trunk/docutils/docutils/parsers/rst/roles.py 2022-01-29 16:28:17 UTC (rev 8994)
@@ -229,7 +229,8 @@
content = content or []
delimiter = ['\n'] if supplied_content and content else []
return self.base_role(role, rawtext, text, lineno, inliner,
- options=opts, content=supplied_content+delimiter+content)
+ options=opts,
+ content=supplied_content+delimiter+content)
def generic_custom_role(role, rawtext, text, lineno, inliner,
Modified: trunk/docutils/docutils/parsers/rst/states.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/states.py 2022-01-29 13:20:04 UTC (rev 8993)
+++ trunk/docutils/docutils/parsers/rst/states.py 2022-01-29 16:28:17 UTC (rev 8994)
@@ -486,7 +486,8 @@
args.update(vars(self.__class__))
parts = ('initial_inline', start_string_prefix, '',
- [('start', '', self.non_whitespace_after, # simple start-strings
+ [
+ ('start', '', self.non_whitespace_after, # simple start-strings
[r'\*\*', # strong
r'\*(?!\*)', # emphasis but not strong
r'``', # literal
@@ -500,7 +501,8 @@
[r'[0-9]+', # manually numbered
r'\#(%s)?' % self.simplename, # auto-numbered (w/ label?)
r'\*', # auto-symbol
- r'(?P<citationlabel>%s)' % self.simplename] # citation reference
+ r'(?P<citationlabel>%s)' % self.simplename, # citation reference
+ ]
)
]
),
@@ -510,7 +512,7 @@
['`(?!`)'] # but not literal
)
]
- )
+ )
self.start_string_prefix = start_string_prefix
self.end_string_suffix = end_string_suffix
self.parts = parts
@@ -809,8 +811,9 @@
aliastext = match.group(2)
rawaliastext = unescape(aliastext, True)
underscore_escaped = rawaliastext.endswith(r'\_')
- if aliastext.endswith('_') and not (underscore_escaped
- or self.patterns.uri.match(aliastext)):
+ if (aliastext.endswith('_')
+ and not (underscore_escaped
+ or self.patterns.uri.match(aliastext))):
aliastype = 'name'
alias = normalize_name(unescape(aliastext[:-1]))
target = nodes.target(match.group(1), refname=alias)
@@ -1162,8 +1165,8 @@
def indent(self, match, context, next_state):
"""Block quote."""
- indented, indent, line_offset, blank_finish = \
- self.state_machine.get_indented()
+ (indented, indent, line_offset, blank_finish
+ ) = self.state_machine.get_indented()
elements = self.block_quote(indented, line_offset)
self.parent += elements
if not blank_finish:
@@ -1174,8 +1177,8 @@
elements = []
while indented:
blockquote = nodes.block_quote(rawsource='\n'.join(indented))
- (blockquote.source, blockquote.line) = \
- self.state_machine.get_source_and_line(line_offset+1)
+ (blockquote.source, blockquote.line
+ ) = self.state_machine.get_source_and_line(line_offset+1)
(blockquote_lines,
attribution_lines,
attribution_offset,
@@ -1470,8 +1473,8 @@
name = self.parse_field_marker(match)
src, srcline = self.state_machine.get_source_and_line()
lineno = self.state_machine.abs_line_number()
- indented, indent, line_offset, blank_finish = \
- self.state_machine.get_first_known_indented(match.end())
+ (indented, indent, line_offset, blank_finish
+ ) = self.state_machine.get_first_known_indented(match.end())
field_node = nodes.field()
field_node.source = src
field_node.line = srcline
@@ -1495,16 +1498,17 @@
def option_marker(self, match, context, next_state):
"""Option list item."""
optionlist = nodes.option_list()
- (optionlist.source, optionlist.line) = self.state_machine.get_source_and_line()
+ (optionlist.source, optionlist.line
+ ) = self.state_machine.get_source_and_line()
try:
listitem, blank_finish = self.option_list_item(match)
except MarkupError as error:
# This shouldn't happen; pattern won't match.
- msg = self.reporter.error('Invalid option list marker: %s' %
- error)
+ msg = self.reporter.error('Invalid option list marker: %s'
+ % error)
self.parent += msg
- indented, indent, line_offset, blank_finish = \
- self.state_machine.get_first_known_indented(match.end())
+ (indented, indent, line_offset, blank_finish
+ ) = self.state_machine.get_first_known_indented(match.end())
elements = self.block_quote(indented, line_offset)
self.parent += elements
if not blank_finish:
@@ -1526,8 +1530,8 @@
def option_list_item(self, match):
offset = self.state_machine.abs_line_offset()
options = self.parse_option_marker(match)
- indented, indent, line_offset, blank_finish = \
- self.state_machine.get_first_known_indented(match.end())
+ (indented, indent, line_offset, blank_finish
+ ) = self.state_machine.get_first_known_indented(match.end())
if not indented: # not an option list item
self.goto_line(offset)
raise statemachine.TransitionCorrection('text')
@@ -1617,9 +1621,9 @@
def line_block_line(self, match, lineno):
"""Return one line element of a line_block."""
- indented, indent, line_offset, blank_finish = \
- self.state_machine.get_first_known_indented(match.end(),
- until_blank=True)
+ (indented, indent, line_offset, blank_finish
+ ) = self.state_machine.get_first_known_indented(match.end(),
+ until_blank=True)
text = '\n'.join(indented)
text_nodes, messages = self.inline_text(text, lineno)
line = nodes.line(text, '', *text_nodes)
@@ -1881,8 +1885,8 @@
def footnote(self, match):
src, srcline = self.state_machine.get_source_and_line()
- indented, indent, offset, blank_finish = \
- self.state_machine.get_first_known_indented(match.end())
+ (indented, indent, offset, blank_finish
+ ) = self.state_machine.get_first_known_indented(match.end())
label = match.group(1)
name = normalize_name(label)
footnote = nodes.footnote('\n'.join(indented))
@@ -1912,8 +1916,8 @@
def citation(self, match):
src, srcline = self.state_machine.get_source_and_line()
- indented, indent, offset, blank_finish = \
- self.state_machine.get_first_known_indented(match.end())
+ (indented, indent, offset, blank_finish
+ ) = self.state_machine.get_first_known_indented(match.end())
label = match.group(1)
name = normalize_name(label)
citation = nodes.citation('\n'.join(indented))
@@ -1930,9 +1934,9 @@
def hyperlink_target(self, match):
pattern = self.explicit.patterns.target
lineno = self.state_machine.abs_line_number()
- block, indent, offset, blank_finish = \
- self.state_machine.get_first_known_indented(
- match.end(), until_blank=True, strip_indent=False)
+ (block, indent, offset, blank_finish
+ ) = self.state_machine.get_first_known_indented(
+ match.end(), until_blank=True, strip_indent=False)
blocktext = match.string[:match.end()] + '\n'.join(block)
block = [escape2null(line) for line in block]
escaped = block[0]
@@ -2015,9 +2019,9 @@
def substitution_def(self, match):
pattern = self.explicit.patterns.substitution
src, srcline = self.state_machine.get_source_and_line()
- block, indent, offset, blank_finish = \
- self.state_machine.get_first_known_indented(match.end(),
- strip_indent=False)
+ (block, indent, offset, blank_finish
+ ) = self.state_machine.get_first_known_indented(match.end(),
+ strip_indent=False)
blocktext = (match.string[:match.end()] + '\n'.join(block))
block.disconnect()
escaped = escape2null(block[0].rstrip())
@@ -2127,9 +2131,9 @@
directive = convert_directive_function(directive)
lineno = self.state_machine.abs_line_number()
initial_line_offset = self.state_machine.line_offset
- indented, indent, line_offset, blank_finish \
- = self.state_machine.get_first_known_indented(match.end(),
- strip_top=0)
+ (indented, indent, line_offset, blank_finish
+ ) = self.state_machine.get_first_known_indented(match.end(),
+ strip_top=0)
block_text = '\n'.join(self.state_machine.input_lines[
initial_line_offset : self.state_machine.line_offset + 1])
try:
@@ -2277,12 +2281,12 @@
def unknown_directive(self, type_name):
lineno = self.state_machine.abs_line_number()
- indented, indent, offset, blank_finish = \
- self.state_machine.get_first_known_indented(0, strip_indent=False)
+ (indented, indent, offset, blank_finish
+ ) = self.state_machine.get_first_known_indented(0, strip_indent=False)
text = '\n'.join(indented)
- error = self.reporter.error(
- 'Unknown directive type "%s".' % type_name,
- nodes.literal_block(text, text), line=lineno)
+ error = self.reporter.error('Unknown directive type "%s".' % type_name,
+ nodes.literal_block(text, text),
+ line=lineno)
return [error], blank_finish
def comment(self, match):
@@ -2294,8 +2298,8 @@
# cf. parsers.rst.directives.misc.Include
self.document.include_log.pop()
return [], True
- indented, indent, offset, blank_finish = \
- self.state_machine.get_first_known_indented(match.end())
+ (indented, indent, offset, blank_finish
+ ) = self.state_machine.get_first_known_indented(match.end())
while indented and not indented[-1].strip():
indented.trim_end()
text = '\n'.join(indented)
@@ -2393,9 +2397,9 @@
def anonymous_target(self, match):
lineno = self.state_machine.abs_line_number()
- block, indent, offset, blank_finish \
- = self.state_machine.get_first_known_indented(match.end(),
- until_blank=True)
+ (block, indent, offset, blank_finish
+ ) = self.state_machine.get_first_known_indented(match.end(),
+ until_blank=True)
blocktext = match.string[:match.end()] + '\n'.join(block)
block = [escape2null(line) for line in block]
target = self.make_target(block, blocktext, lineno, '')
@@ -2461,9 +2465,9 @@
def rfc2822_field(self, match):
name = match.string[:match.string.find(':')]
- indented, indent, line_offset, blank_finish = \
- self.state_machine.get_first_known_indented(match.end(),
- until_blank=True)
+ (indented, indent, line_offset, blank_finish
+ ) = self.state_machine.get_first_known_indented(match.end(),
+ until_blank=True)
fieldnode = nodes.field()
fieldnode += nodes.field_name(name, name)
fieldbody = nodes.field_body('\n'.join(indented))
@@ -2755,8 +2759,10 @@
raise statemachine.TransitionCorrection('text')
else:
blocktext = context[0] + '\n' + self.state_machine.line
- msg = self.reporter.warning('Title underline too short.',
- nodes.literal_block(blocktext, blocktext), line=lineno)
+ msg = self.reporter.warning(
+ 'Title underline too short.',
+ nodes.literal_block(blocktext, blocktext),
+ line=lineno)
messages.append(msg)
if not self.state_machine.match_titles:
blocktext = context[0] + '\n' + self.state_machine.line
@@ -2766,7 +2772,8 @@
# 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('Unexpected section title.',
+ msg = self.reporter.severe(
+ 'Unexpected section title.',
nodes.literal_block(blocktext, blocktext),
source=src, line=srcline)
self.parent += messages
@@ -2801,8 +2808,8 @@
def literal_block(self):
"""Return a list of nodes."""
- indented, indent, offset, blank_finish = \
- self.state_machine.get_indented()
+ (indented, indent, offset, blank_finish
+ ) = self.state_machine.get_indented()
while indented and not indented[-1].strip():
indented.trim_end()
if not indented:
@@ -2829,8 +2836,8 @@
return parent_node.children
def definition_list_item(self, termline):
- indented, indent, line_offset, blank_finish = \
- self.state_machine.get_indented()
+ (indented, indent, line_offset, blank_finish
+ ) = self.state_machine.get_indented()
itemnode = nodes.definition_list_item(
'\n'.join(termline + list(indented)))
lineno = self.state_machine.abs_line_number() - 1
@@ -3081,8 +3088,8 @@
else:
self.parent += self.reporter.warning(
'Literal block expected; none found.',
- line=self.state_machine.abs_line_number())
- # src not available, because statemachine.input_lines is empty
+ line=self.state_machine.abs_line_number()
+ ) # src not available, statemachine.input_lines is empty
self.state_machine.previous_line()
self.parent += self.messages
return []
@@ -3116,7 +3123,7 @@
if context:
self.messages.append(
self.reporter.error('Inconsistent literal block quoting.',
- line=self.state_machine.abs_line_number()))
+ line=self.state_machine.abs_line_number()))
self.state_machine.previous_line()
raise EOFError
Modified: trunk/docutils/docutils/parsers/rst/tableparser.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/tableparser.py 2022-01-29 13:20:04 UTC (rev 8993)
+++ trunk/docutils/docutils/parsers/rst/tableparser.py 2022-01-29 16:28:17 UTC (rev 8994)
@@ -36,8 +36,8 @@
"""
def __init__(self, *args, **kwargs):
- self.offset = kwargs.pop('offset', 0)
- DataError.__init__(self, *args)
+ self.offset = kwargs.pop('offset', 0)
+ DataError.__init__(self, *args)
class TableParser:
@@ -169,8 +169,9 @@
corners = [(0, 0)]
while corners:
top, left = corners.pop(0)
- if top == self.bottom or left == self.right \
- or top <= self.done[left]:
+ if (top == self.bottom
+ or left == self.right
+ or top <= self.done[left]):
continue
result = self.scan_cell(top, left)
if not result:
@@ -512,9 +513,9 @@
if new_end > main_end:
self.columns[-1] = (main_start, new_end)
elif line[end:nextstart].strip():
- raise TableMarkupError('Text in column margin '
- 'in table line %s.' % (first_line+offset+1),
- offset=first_line+offset)
+ raise TableMarkupError('Text in column margin in table '
+ 'line %s.' % (first_line+offset+1),
+ offset=first_line+offset)
offset += 1
columns.pop()
Modified: trunk/docutils/docutils/statemachine.py
===================================================================
--- trunk/docutils/docutils/statemachine.py 2022-01-29 13:20:04 UTC (rev 8993)
+++ trunk/docutils/docutils/statemachine.py 2022-01-29 16:28:17 UTC (rev 8994)
@@ -482,8 +482,8 @@
type, value, module, line, function = _exception_data()
print('%s: %s' % (type, value), file=self._stderr)
print('input line %s' % (self.abs_line_number()), file=self._stderr)
- print(('module %s, line %s, function %s' %
- (module, line, function)), file=self._stderr)
+ print('module %s, line %s, function %s' % (module, line, function),
+ file=self._stderr)
def attach_observer(self, observer):
...
[truncated message content] |