summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docutils/docutils/__init__.py7
-rw-r--r--docutils/docutils/core.py2
-rw-r--r--docutils/docutils/frontend.py2
-rw-r--r--docutils/docutils/io.py11
-rw-r--r--docutils/docutils/languages/__init__.py2
-rw-r--r--docutils/docutils/languages/af.py2
-rw-r--r--docutils/docutils/languages/sv.py2
-rw-r--r--docutils/docutils/languages/zh_cn.py6
-rw-r--r--docutils/docutils/languages/zh_tw.py50
-rw-r--r--docutils/docutils/parsers/__init__.py2
-rw-r--r--docutils/docutils/parsers/recommonmark_wrapper.py2
-rw-r--r--docutils/docutils/parsers/rst/directives/body.py2
-rw-r--r--docutils/docutils/parsers/rst/directives/images.py4
-rw-r--r--docutils/docutils/parsers/rst/directives/misc.py8
-rw-r--r--docutils/docutils/parsers/rst/directives/tables.py4
-rw-r--r--docutils/docutils/parsers/rst/languages/af.py4
-rw-r--r--docutils/docutils/parsers/rst/languages/cs.py6
-rw-r--r--docutils/docutils/parsers/rst/languages/de.py8
-rw-r--r--docutils/docutils/parsers/rst/languages/eo.py2
-rw-r--r--docutils/docutils/parsers/rst/languages/ja.py6
-rw-r--r--docutils/docutils/parsers/rst/languages/nl.py2
-rw-r--r--docutils/docutils/parsers/rst/languages/sv.py12
-rw-r--r--docutils/docutils/parsers/rst/roles.py6
-rw-r--r--docutils/docutils/parsers/rst/states.py64
-rw-r--r--docutils/docutils/parsers/rst/tableparser.py2
-rw-r--r--docutils/docutils/statemachine.py14
-rw-r--r--docutils/docutils/transforms/components.py2
-rw-r--r--docutils/docutils/transforms/parts.py6
-rw-r--r--docutils/docutils/transforms/peps.py4
-rw-r--r--docutils/docutils/transforms/references.py2
-rw-r--r--docutils/docutils/transforms/universal.py6
-rw-r--r--docutils/docutils/utils/__init__.py9
-rw-r--r--docutils/docutils/utils/code_analyzer.py10
-rw-r--r--docutils/docutils/utils/math/latex2mathml.py2
-rw-r--r--docutils/docutils/utils/math/tex2mathml_extern.py10
-rw-r--r--docutils/docutils/utils/punctuation_chars.py21
-rw-r--r--docutils/docutils/utils/smartquotes.py107
-rw-r--r--docutils/docutils/writers/_html_base.py40
-rw-r--r--docutils/docutils/writers/docutils_xml.py16
-rw-r--r--docutils/docutils/writers/html4css1/__init__.py6
-rw-r--r--docutils/docutils/writers/html5_polyglot/__init__.py8
-rw-r--r--docutils/docutils/writers/latex2e/__init__.py362
-rw-r--r--docutils/docutils/writers/manpage.py12
-rw-r--r--docutils/docutils/writers/odf_odt/__init__.py4
-rw-r--r--docutils/docutils/writers/s5_html/__init__.py4
-rw-r--r--docutils/docutils/writers/xetex/__init__.py38
-rw-r--r--docutils/test/DocutilsTestSupport.py6
-rw-r--r--docutils/test/functional/tests/field_name_limit.py2
-rw-r--r--docutils/test/test_command_line.py10
-rwxr-xr-xdocutils/test/test_functional.py2
-rwxr-xr-xdocutils/test/test_io.py11
-rwxr-xr-xdocutils/test/test_language.py2
-rwxr-xr-xdocutils/test/test_nodes.py6
-rw-r--r--docutils/test/test_parsers/test_recommonmark/test_misc.py2
-rwxr-xr-xdocutils/test/test_parsers/test_recommonmark/test_transitions.py2
-rw-r--r--docutils/test/test_parsers/test_rst/test_directives/test_admonitions_dummy_lang.py2
-rw-r--r--docutils/test/test_parsers/test_rst/test_directives/test_code_parsing.py2
-rw-r--r--docutils/test/test_parsers/test_rst/test_source_line.py2
-rwxr-xr-xdocutils/test/test_parsers/test_rst/test_tables.py6
-rwxr-xr-xdocutils/test/test_parsers/test_rst/test_transitions.py2
-rwxr-xr-xdocutils/test/test_publisher.py11
-rwxr-xr-xdocutils/test/test_settings.py4
-rwxr-xr-xdocutils/test/test_transforms/test___init__.py2
-rwxr-xr-xdocutils/test/test_transforms/test_expose_internals.py2
-rw-r--r--docutils/test/test_transforms/test_filter_messages.py2
-rw-r--r--docutils/test/test_transforms/test_smartquotes.py2
-rwxr-xr-xdocutils/test/test_transforms/test_transitions.py4
-rwxr-xr-xdocutils/test/test_transforms/test_writer_aux.py2
-rwxr-xr-xdocutils/test/test_utils.py6
-rwxr-xr-xdocutils/test/test_viewlist.py2
-rwxr-xr-xdocutils/test/test_writers/test_docutils_xml.py4
-rwxr-xr-xdocutils/test/test_writers/test_pseudoxml.py2
-rwxr-xr-xdocutils/tools/buildhtml.py2
-rw-r--r--docutils/tools/dev/generate_punctuation_chars.py16
-rwxr-xr-xdocutils/tools/docutils-cli.py6
-rwxr-xr-xdocutils/tools/quicktest.py6
-rwxr-xr-xdocutils/tools/rst2html5.py2
-rw-r--r--docutils/tox.ini11
78 files changed, 523 insertions, 521 deletions
diff --git a/docutils/docutils/__init__.py b/docutils/docutils/__init__.py
index 358fc7d8b..f07201c2b 100644
--- a/docutils/docutils/__init__.py
+++ b/docutils/docutils/__init__.py
@@ -117,10 +117,9 @@ __version_info__ = VersionInfo(
major=0,
minor=19,
micro=0,
- releaselevel='beta', # one of 'alpha', 'beta', 'candidate', 'final'
- # pre-release serial number (0 for final releases and active development):
- serial=0,
- release=False # True for official releases and pre-releases
+ releaselevel='beta', # one of 'alpha', 'beta', 'candidate', 'final'
+ serial=0, # pre-release number (0 for final releases and snapshots)
+ release=False # True for official releases and pre-releases
)
"""Comprehensive version information tuple. See 'Version Numbering' in
docs/dev/policies.txt."""
diff --git a/docutils/docutils/core.py b/docutils/docutils/core.py
index 66f017c91..eabc20583 100644
--- a/docutils/docutils/core.py
+++ b/docutils/docutils/core.py
@@ -213,7 +213,7 @@ class Publisher:
except Exception as error:
if not self.settings: # exception too early to report nicely
raise
- if self.settings.traceback: # Propagate exceptions?
+ if self.settings.traceback: # Propagate exceptions?
self.debugging_dumps()
raise
self.report_Exception(error)
diff --git a/docutils/docutils/frontend.py b/docutils/docutils/frontend.py
index 6fcedac83..bac23be99 100644
--- a/docutils/docutils/frontend.py
+++ b/docutils/docutils/frontend.py
@@ -315,7 +315,7 @@ class Values(optparse.Values):
def update(self, other_dict, option_parser):
if isinstance(other_dict, Values):
other_dict = other_dict.__dict__
- other_dict = dict(other_dict) # also works with ConfigParser sections
+ other_dict = dict(other_dict) # also works with ConfigParser sections
for setting in option_parser.lists.keys():
if hasattr(self, setting) and setting in other_dict:
value = getattr(self, setting)
diff --git a/docutils/docutils/io.py b/docutils/docutils/io.py
index 7f65df60c..9c3b9f92a 100644
--- a/docutils/docutils/io.py
+++ b/docutils/docutils/io.py
@@ -23,7 +23,7 @@ from docutils import TransformSpec
# If no valid guess can be made, locale_encoding is set to `None`:
try:
locale_encoding = locale.getlocale()[1] or locale.getdefaultlocale()[1]
-except ValueError as error: # OS X may set UTF-8 without language code
+except ValueError as error: # OS X may set UTF-8 without language code
# See https://bugs.python.org/issue18378 fixed in 3.8
# and https://sourceforge.net/p/docutils/bugs/298/.
# Drop the special case after requiring Python >= 3.8
@@ -31,7 +31,7 @@ except ValueError as error: # OS X may set UTF-8 without language code
locale_encoding = "UTF-8"
else:
locale_encoding = None
-except: # any other problems determining the locale -> use None
+except: # any other problems determining the locale -> use None
locale_encoding = None
try:
codecs.lookup(locale_encoding or '')
@@ -279,11 +279,12 @@ class ErrorOutput:
self.destination.write(data.encode(self.encoding,
self.encoding_errors))
except TypeError:
- if isinstance(data, str): # destination may expect bytes
+ if isinstance(data, str): # destination may expect bytes
self.destination.write(data.encode(self.encoding,
self.encoding_errors))
elif self.destination in (sys.stderr, sys.stdout):
- self.destination.buffer.write(data) # write bytes to raw stream
+ # write bytes to raw stream
+ self.destination.buffer.write(data)
else:
self.destination.write(str(data, self.encoding,
self.decoding_errors))
@@ -433,7 +434,7 @@ class FileOutput(Output):
self.opened = False
else:
self.destination = sys.stdout
- elif (# destination is file-type object -> check mode:
+ 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 '
diff --git a/docutils/docutils/languages/__init__.py b/docutils/docutils/languages/__init__.py
index d3542cea6..41c019d8c 100644
--- a/docutils/docutils/languages/__init__.py
+++ b/docutils/docutils/languages/__init__.py
@@ -64,7 +64,7 @@ class LanguageImporter:
except KeyError:
pass
for tag in normalize_language_tag(language_code):
- tag = tag.replace('-', '_') # '-' not valid in module names
+ tag = tag.replace('-', '_') # '-' not valid in module names
module = self.import_from_packages(tag, reporter)
if module is not None:
break
diff --git a/docutils/docutils/languages/af.py b/docutils/docutils/languages/af.py
index 87ab1234d..a45e29692 100644
--- a/docutils/docutils/languages/af.py
+++ b/docutils/docutils/languages/af.py
@@ -33,7 +33,7 @@ labels = {
'hint': 'Wenk',
'important': 'Belangrik',
'note': 'Nota',
- 'tip': 'Tip', # hint and tip both have the same translation: wenk
+ 'tip': 'Tip', # hint and tip both have the same translation: wenk
'warning': 'Waarskuwing',
'contents': 'Inhoud'}
"""Mapping of node class name to label text."""
diff --git a/docutils/docutils/languages/sv.py b/docutils/docutils/languages/sv.py
index 0f05df346..e15c07e5c 100644
--- a/docutils/docutils/languages/sv.py
+++ b/docutils/docutils/languages/sv.py
@@ -27,7 +27,7 @@ labels = {
'dedication': 'Dedikation',
'abstract': 'Sammanfattning',
'attention': 'Observera!',
- 'caution': 'Akta!', # 'Varning' already used for 'warning'
+ 'caution': 'Akta!', # 'Varning' already used for 'warning'
'danger': 'FARA!',
'error': 'Fel',
'hint': 'Vink',
diff --git a/docutils/docutils/languages/zh_cn.py b/docutils/docutils/languages/zh_cn.py
index 0ddb9fa08..82c54397a 100644
--- a/docutils/docutils/languages/zh_cn.py
+++ b/docutils/docutils/languages/zh_cn.py
@@ -58,9 +58,9 @@ bibliographic_fields = {
"""Simplified Chinese to canonical name mapping for bibliographic fields."""
author_separators = [';', ',',
- '\uff1b', # ';'
- '\uff0c', # ','
- '\u3001', # '、'
+ '\uff1b', # ';'
+ '\uff0c', # ','
+ '\u3001', # '、'
]
"""List of separator strings for the 'Authors' bibliographic field. Tried in
order."""
diff --git a/docutils/docutils/languages/zh_tw.py b/docutils/docutils/languages/zh_tw.py
index 27f3f770f..6428dc7f2 100644
--- a/docutils/docutils/languages/zh_tw.py
+++ b/docutils/docutils/languages/zh_tw.py
@@ -15,28 +15,28 @@ __docformat__ = 'reStructuredText'
labels = {
# fixed: language-dependent
- 'author': '\u4f5c\u8005', # '作者' <-- Chinese word
- 'authors': '\u4f5c\u8005\u7fa4', # '作者群',
- 'organization': '\u7d44\u7e54', # '組織',
- 'address': '\u5730\u5740', # '地址',
- 'contact': '\u9023\u7d61', # '連絡',
- 'version': '\u7248\u672c', # '版本',
- 'revision': '\u4fee\u8a02', # '修訂',
- 'status': '\u72c0\u614b', # '狀態',
- 'date': '\u65e5\u671f', # '日期',
- 'copyright': '\u7248\u6b0a', # '版權',
- 'dedication': '\u984c\u737b', # '題獻',
- 'abstract': '\u6458\u8981', # '摘要',
- 'attention': '\u6ce8\u610f\uff01', # '注意!',
- 'caution': '\u5c0f\u5fc3\uff01', # '小心!',
- 'danger': '\uff01\u5371\u96aa\uff01', # '!危險!',
- 'error': '\u932f\u8aa4', # '錯誤',
- 'hint': '\u63d0\u793a', # '提示',
- 'important': '\u91cd\u8981', # '注意!',
- 'note': '\u8a3b\u91cb', # '註釋',
- 'tip': '\u79d8\u8a23', # '秘訣',
- 'warning': '\u8b66\u544a', # '警告',
- 'contents': '\u76ee\u9304' # '目錄'
+ 'author': '\u4f5c\u8005', # '作者' <-- Chinese word
+ 'authors': '\u4f5c\u8005\u7fa4', # '作者群',
+ 'organization': '\u7d44\u7e54', # '組織',
+ 'address': '\u5730\u5740', # '地址',
+ 'contact': '\u9023\u7d61', # '連絡',
+ 'version': '\u7248\u672c', # '版本',
+ 'revision': '\u4fee\u8a02', # '修訂',
+ 'status': '\u72c0\u614b', # '狀態',
+ 'date': '\u65e5\u671f', # '日期',
+ 'copyright': '\u7248\u6b0a', # '版權',
+ 'dedication': '\u984c\u737b', # '題獻',
+ 'abstract': '\u6458\u8981', # '摘要',
+ 'attention': '\u6ce8\u610f\uff01', # '注意!',
+ 'caution': '\u5c0f\u5fc3\uff01', # '小心!',
+ 'danger': '\uff01\u5371\u96aa\uff01', # '!危險!',
+ 'error': '\u932f\u8aa4', # '錯誤',
+ 'hint': '\u63d0\u793a', # '提示',
+ 'important': '\u91cd\u8981', # '注意!',
+ 'note': '\u8a3b\u91cb', # '註釋',
+ 'tip': '\u79d8\u8a23', # '秘訣',
+ 'warning': '\u8b66\u544a', # '警告',
+ 'contents': '\u76ee\u9304', # '目錄'
}
"""Mapping of node class name to label text."""
@@ -57,9 +57,9 @@ bibliographic_fields = {
"""Traditional Chinese to canonical name mapping for bibliographic fields."""
author_separators = [';', ',',
- '\uff1b', # ';'
- '\uff0c', # ','
- '\u3001', # '、'
+ '\uff1b', # ';'
+ '\uff0c', # ','
+ '\u3001', # '、'
]
"""List of separator strings for the 'Authors' bibliographic field. Tried in
order."""
diff --git a/docutils/docutils/parsers/__init__.py b/docutils/docutils/parsers/__init__.py
index f86f762e4..ba496224d 100644
--- a/docutils/docutils/parsers/__init__.py
+++ b/docutils/docutils/parsers/__init__.py
@@ -64,7 +64,7 @@ class Parser(Component):
self.document.note_parse_message)
-_parser_aliases = {# short names for known parsers
+_parser_aliases = { # short names for known parsers
'null': 'docutils.parsers.null',
# reStructuredText
'rst': 'docutils.parsers.rst',
diff --git a/docutils/docutils/parsers/recommonmark_wrapper.py b/docutils/docutils/parsers/recommonmark_wrapper.py
index 5db784041..a888750d6 100644
--- a/docutils/docutils/parsers/recommonmark_wrapper.py
+++ b/docutils/docutils/parsers/recommonmark_wrapper.py
@@ -60,7 +60,7 @@ class Parser(CommonMarkParser):
config_section_dependencies = ('parsers',)
def get_transforms(self):
- return Component.get_transforms(self) # + [AutoStructify]
+ return Component.get_transforms(self) # + [AutoStructify]
def parse(self, inputstring, document):
"""Use the upstream parser and clean up afterwards.
diff --git a/docutils/docutils/parsers/rst/directives/body.py b/docutils/docutils/parsers/rst/directives/body.py
index c2dc2464f..daddf8ce2 100644
--- a/docutils/docutils/parsers/rst/directives/body.py
+++ b/docutils/docutils/parsers/rst/directives/body.py
@@ -136,7 +136,7 @@ class CodeBlock(Directive):
optional_arguments = 1
option_spec = {'class': directives.class_option,
'name': directives.unchanged,
- 'number-lines': directives.unchanged # integer or None
+ 'number-lines': directives.unchanged # integer or None
}
has_content = True
diff --git a/docutils/docutils/parsers/rst/directives/images.py b/docutils/docutils/parsers/rst/directives/images.py
index 9d7785657..268cecc6b 100644
--- a/docutils/docutils/parsers/rst/directives/images.py
+++ b/docutils/docutils/parsers/rst/directives/images.py
@@ -10,7 +10,7 @@ __docformat__ = 'reStructuredText'
from urllib.request import url2pathname
-try: # check for the Python Imaging Library
+try: # check for the Python Imaging Library
import PIL.Image
except ImportError:
try: # sometimes PIL modules are put in PYTHONPATH's root
@@ -131,7 +131,7 @@ class Figure(Image):
with PIL.Image.open(imagepath) as img:
figure_node['width'] = '%dpx' % img.size[0]
except (OSError, UnicodeEncodeError):
- pass # TODO: warn/info?
+ pass # TODO: warn/info?
else:
self.state.document.settings.record_dependencies.add(
imagepath.replace('\\', '/'))
diff --git a/docutils/docutils/parsers/rst/directives/misc.py b/docutils/docutils/parsers/rst/directives/misc.py
index 002ef820d..f9b740ee2 100644
--- a/docutils/docutils/parsers/rst/directives/misc.py
+++ b/docutils/docutils/parsers/rst/directives/misc.py
@@ -41,7 +41,7 @@ class Include(Directive):
'start-after': directives.unchanged_required,
'end-before': directives.unchanged_required,
# ignored except for 'literal' or 'code':
- 'number-lines': directives.unchanged, # integer or None
+ 'number-lines': directives.unchanged, # integer or None
'class': directives.class_option,
'name': directives.unchanged}
@@ -159,9 +159,9 @@ class Include(Directive):
if tab_width < 0:
include_lines = rawtext.splitlines()
codeblock = CodeBlock(self.name,
- [self.options.pop('code')], # arguments
+ [self.options.pop('code')], # arguments
self.options,
- include_lines, # content
+ include_lines, # content
self.lineno,
self.content_offset,
self.block_text,
@@ -173,7 +173,7 @@ class Include(Directive):
clip_options = (startline, endline, before_text, after_text)
include_log = self.state.document.include_log
# log entries are tuples (<source>, <clip-options>)
- if not include_log: # new document
+ if not include_log: # new document
include_log.append((utils.relative_path(None, source),
(None, None, None, None)))
if (path, clip_options) in include_log:
diff --git a/docutils/docutils/parsers/rst/directives/tables.py b/docutils/docutils/parsers/rst/directives/tables.py
index de30e408b..d985bda0c 100644
--- a/docutils/docutils/parsers/rst/directives/tables.py
+++ b/docutils/docutils/parsers/rst/directives/tables.py
@@ -163,7 +163,7 @@ class RSTTable(Table):
colspec['colwidth'] = col_width
if self.widths == 'auto':
table_node['classes'] += ['colwidths-auto']
- elif self.widths: # "grid" or list of integers
+ elif self.widths: # "grid" or list of integers
table_node['classes'] += ['colwidths-given']
self.add_name(table_node)
if title:
@@ -480,7 +480,7 @@ class ListTable(Table):
table = nodes.table()
if self.widths == 'auto':
table['classes'] += ['colwidths-auto']
- elif self.widths: # explicitly set column widths
+ elif self.widths: # explicitly set column widths
table['classes'] += ['colwidths-given']
tgroup = nodes.tgroup(cols=len(col_widths))
table += tgroup
diff --git a/docutils/docutils/parsers/rst/languages/af.py b/docutils/docutils/parsers/rst/languages/af.py
index 707c1cf5c..dc147fba1 100644
--- a/docutils/docutils/parsers/rst/languages/af.py
+++ b/docutils/docutils/parsers/rst/languages/af.py
@@ -24,7 +24,7 @@ directives = {
'wenk': 'hint',
'belangrik': 'important',
'nota': 'note',
- 'tip': 'tip', # hint and tip both have the same translation: wenk
+ 'tip': 'tip', # hint and tip both have the same translation: wenk
'waarskuwing': 'warning',
'vermaning': 'admonition',
'kantstreep': 'sidebar',
@@ -51,7 +51,7 @@ directives = {
'insluiting': 'include',
'rou': 'raw',
'vervang': 'replace',
- 'unicode': 'unicode', # should this be translated? unikode
+ 'unicode': 'unicode', # should this be translated? unikode
'datum': 'date',
'klas': 'class',
'role (translation required)': 'role',
diff --git a/docutils/docutils/parsers/rst/languages/cs.py b/docutils/docutils/parsers/rst/languages/cs.py
index 10aa61c76..358c847a5 100644
--- a/docutils/docutils/parsers/rst/languages/cs.py
+++ b/docutils/docutils/parsers/rst/languages/cs.py
@@ -18,7 +18,7 @@ __docformat__ = 'reStructuredText'
directives = {
# language-dependent: fixed
'pozor': 'attention',
- 'caution (translation required)': 'caution', # jak rozlisit caution a warning?
+ 'caution (translation required)': 'caution', # jak rozlisit caution a warning?
'code (translation required)': 'code',
'nebezpe\u010D\u00ED': 'danger',
'chyba': 'error',
@@ -47,8 +47,8 @@ directives = {
'math (translation required)': 'math',
'meta (translation required)': 'meta',
#'imagemap': 'imagemap',
- 'image (translation required)': 'image', # obrazek
- 'figure (translation required)': 'figure', # a tady?
+ 'image (translation required)': 'image', # obrazek
+ 'figure (translation required)': 'figure', # a tady?
'include (translation required)': 'include',
'raw (translation required)': 'raw',
'replace (translation required)': 'replace',
diff --git a/docutils/docutils/parsers/rst/languages/de.py b/docutils/docutils/parsers/rst/languages/de.py
index 723572b4f..187df6cfc 100644
--- a/docutils/docutils/parsers/rst/languages/de.py
+++ b/docutils/docutils/parsers/rst/languages/de.py
@@ -29,7 +29,7 @@ directives = {
'warnung': 'warning',
'ermahnung': 'admonition',
'kasten': 'sidebar',
- 'seitenkasten': 'sidebar', # kept for backwards compatibiltity
+ 'seitenkasten': 'sidebar', # kept for backwards compatibiltity
'seitenleiste': 'sidebar',
'thema': 'topic',
'zeilenblock': 'line-block',
@@ -37,8 +37,8 @@ directives = {
'rubrik': 'rubric',
'epigraph': 'epigraph',
'highlights': 'highlights',
- 'pull-quote': 'pull-quote', # commonly used in German too
- 'seitenansprache': 'pull-quote', # cf. http://www.typografie.info/2/wiki.php?title=Seitenansprache
+ 'pull-quote': 'pull-quote', # commonly used in German too
+ 'seitenansprache': 'pull-quote', # cf. http://www.typografie.info/2/wiki.php?title=Seitenansprache
'zusammengesetzt': 'compound',
'verbund': 'compound',
'container': 'container',
@@ -86,7 +86,7 @@ roles = {
'titel-referenz': 'title-reference',
'pep-referenz': 'pep-reference',
'rfc-referenz': 'rfc-reference',
- 'betonung': 'emphasis', # for backwards compatibility
+ 'betonung': 'emphasis', # for backwards compatibility
'betont': 'emphasis',
'fett': 'strong',
'wörtlich': 'literal',
diff --git a/docutils/docutils/parsers/rst/languages/eo.py b/docutils/docutils/parsers/rst/languages/eo.py
index 951c48580..99abd71c7 100644
--- a/docutils/docutils/parsers/rst/languages/eo.py
+++ b/docutils/docutils/parsers/rst/languages/eo.py
@@ -47,7 +47,7 @@ directives = {
#'qa': 'questions',
#'faq': 'questions',
'tabelo': 'table',
- 'tabelo-vdk': 'csv-table', # "valoroj disigitaj per komoj"
+ 'tabelo-vdk': 'csv-table', # "valoroj disigitaj per komoj"
'tabelo-csv': 'csv-table',
'tabelo-lista': 'list-table',
'meta': 'meta',
diff --git a/docutils/docutils/parsers/rst/languages/ja.py b/docutils/docutils/parsers/rst/languages/ja.py
index baf4f1689..ff97fa2b7 100644
--- a/docutils/docutils/parsers/rst/languages/ja.py
+++ b/docutils/docutils/parsers/rst/languages/ja.py
@@ -72,14 +72,14 @@ directives = {
'ディフォルトロール': 'default-role',
'既定役': 'default-role',
'タイトル': 'title',
- '題': 'title', # 題名 件名
+ '題': 'title', # 題名 件名
'目次': 'contents',
'節数': 'sectnum',
'ヘッダ': 'header',
'フッタ': 'footer',
- #'脚注': 'footnotes', # 脚註?
+ #'脚注': 'footnotes', # 脚註?
#'サイテーション': 'citations',   # 出典 引証 引用
- 'ターゲットノート': 'target-notes', # 的注 的脚注
+ 'ターゲットノート': 'target-notes', # 的注 的脚注
}
"""Japanese name to registered (in directives/__init__.py) directive name
mapping."""
diff --git a/docutils/docutils/parsers/rst/languages/nl.py b/docutils/docutils/parsers/rst/languages/nl.py
index a2704dcf4..5ae1b1b37 100644
--- a/docutils/docutils/parsers/rst/languages/nl.py
+++ b/docutils/docutils/parsers/rst/languages/nl.py
@@ -35,7 +35,7 @@ directives = {
'rubriek': 'rubric',
'opschrift': 'epigraph',
'hoogtepunten': 'highlights',
- 'pull-quote': 'pull-quote', # Dutch printers use the english term
+ 'pull-quote': 'pull-quote', # Dutch printers use the english term
'samenstelling': 'compound',
'verbinding': 'compound',
'container (translation required)': 'container',
diff --git a/docutils/docutils/parsers/rst/languages/sv.py b/docutils/docutils/parsers/rst/languages/sv.py
index c8b184eb1..acf5afbc8 100644
--- a/docutils/docutils/parsers/rst/languages/sv.py
+++ b/docutils/docutils/parsers/rst/languages/sv.py
@@ -15,21 +15,21 @@ __docformat__ = 'reStructuredText'
directives = {
'observera': 'attention',
- 'akta': 'caution', # also 'försiktigt'
+ 'akta': 'caution', # also 'försiktigt'
'kod': 'code',
'fara': 'danger',
'fel': 'error',
- 'vink': 'hint', # also 'hint'
+ 'vink': 'hint', # also 'hint'
'viktigt': 'important',
'notera': 'note',
'tips': 'tip',
'varning': 'warning',
- 'anmärkning': 'admonition', # literal 'tillrättavisning', 'förmaning'
+ 'anmärkning': 'admonition', # literal 'tillrättavisning', 'förmaning'
'sidorad': 'sidebar',
'ämne': 'topic',
'tema': 'topic',
'rad-block': 'line-block',
- 'parsed-literal (translation required)': 'parsed-literal', # 'tolkad-bokstavlig'?
+ 'parsed-literal (translation required)': 'parsed-literal', # 'tolkad-bokstavlig'?
'rubrik': 'rubric',
'epigraf': 'epigraph',
'höjdpunkter': 'highlights',
@@ -45,7 +45,7 @@ directives = {
'list-tabell': 'list-table',
'meta': 'meta',
'matematik': 'math',
- # 'bildkarta': 'imagemap', # FIXME: Translation might be too literal.
+ # 'bildkarta': 'imagemap', # FIXME: Translation might be too literal.
'bild': 'image',
'figur': 'figure',
'inkludera': 'include',
@@ -80,7 +80,7 @@ roles = {
'rfc-referens': 'rfc-reference',
'betoning': 'emphasis',
'stark': 'strong',
- 'bokstavlig': 'literal', # also 'ordagranna'
+ 'bokstavlig': 'literal', # also 'ordagranna'
'matematik': 'math',
'namngiven-referens': 'named-reference',
'anonym-referens': 'anonymous-reference',
diff --git a/docutils/docutils/parsers/rst/roles.py b/docutils/docutils/parsers/rst/roles.py
index 16abd3556..8585beba5 100644
--- a/docutils/docutils/parsers/rst/roles.py
+++ b/docutils/docutils/parsers/rst/roles.py
@@ -149,7 +149,7 @@ def role(role_name, language_module, lineno, reporter):
role_fn = _role_registry[canonicalname]
register_local_role(normname, role_fn)
return role_fn, messages
- return None, messages # Error message will be generated by caller.
+ return None, messages # Error message will be generated by caller.
def register_canonical_role(name, role_fn):
"""
@@ -222,7 +222,7 @@ class CustomRole:
opts = normalized_role_options(self.supplied_options)
try:
opts.update(options)
- except TypeError: # options may be ``None``
+ except TypeError: # options may be ``None``
pass
# pass concatenation of content from instance and call argument:
supplied_content = self.supplied_content or []
@@ -361,7 +361,7 @@ register_canonical_role('code', code_role)
def math_role(role, rawtext, text, lineno, inliner,
options=None, content=None):
options = normalized_role_options(options)
- text = utils.unescape(text, True) # raw text without inline role markup
+ text = utils.unescape(text, True) # raw text without inline role markup
node = nodes.math(rawtext, text, **options)
return [node], []
diff --git a/docutils/docutils/parsers/rst/states.py b/docutils/docutils/parsers/rst/states.py
index c62aced9d..43dc613ea 100644
--- a/docutils/docutils/parsers/rst/states.py
+++ b/docutils/docutils/parsers/rst/states.py
@@ -347,7 +347,7 @@ class RSTState(StateWS):
try: # check for existing title style
level = title_styles.index(style) + 1
except ValueError: # new title style
- if len(title_styles) == memo.section_level: # new subsection
+ if len(title_styles) == memo.section_level: # new subsection
title_styles.append(style)
return True
else: # not at lowest level
@@ -393,8 +393,8 @@ class RSTState(StateWS):
self.state_machine.input_lines[offset:], input_offset=absoffset,
node=section_node, match_titles=True)
self.goto_line(newabsoffset)
- if memo.section_level <= mylevel: # can't handle next section?
- raise EOFError # bubble up to supersection
+ if memo.section_level <= mylevel: # can't handle next section?
+ raise EOFError # bubble up to supersection
# reset section_level; next pass will detect it properly
memo.section_level = mylevel
@@ -487,27 +487,27 @@ class Inliner:
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
r'_`', # inline internal target
r'\|(?!\|)'] # substitution reference
),
- ('whole', '', end_string_suffix, # whole constructs
- [# reference name & end-string
+ ('whole', '', end_string_suffix, # whole constructs
+ [ # reference name & end-string
r'(?P<refname>%s)(?P<refend>__?)' % self.simplename,
('footnotelabel', r'\[', r'(?P<fnend>\]_)',
- [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'[0-9]+', # manually numbered
+ r'\#(%s)?' % self.simplename, # auto-numbered (w/ label?)
+ r'\*', # auto-symbol
+ r'(?P<citationlabel>%s)' % self.simplename, # citation ref
]
)
]
),
('backquote', # interpreted text or phrase reference
- '(?P<role>(:%s:)?)' % self.simplename, # optional role
+ '(?P<role>(:%s:)?)' % self.simplename, # optional role
self.non_whitespace_after,
['`(?!`)'] # but not literal
)
@@ -804,7 +804,7 @@ class Inliner:
def phrase_ref(self, before, after, rawsource, escaped, text=None):
# `text` is ignored (since 0.16)
match = self.patterns.embedded_link.search(escaped)
- if match: # embedded <URI> or <alias_>
+ if match: # embedded <URI> or <alias_>
text = escaped[:match.start(0)]
unescaped = unescape(text)
rawtext = unescape(text, True)
@@ -1089,7 +1089,7 @@ class Body(RSTState):
'period': Struct(prefix='', suffix='.', start=0, end=-1)}
enum.formats = enum.formatinfo.keys()
enum.sequences = ['arabic', 'loweralpha', 'upperalpha',
- 'lowerroman', 'upperroman'] # ORDERED!
+ 'lowerroman', 'upperroman'] # ORDERED!
enum.sequencepats = {'arabic': '[0-9]+',
'loweralpha': '[a-z]',
'upperalpha': '[A-Z]',
@@ -1217,7 +1217,7 @@ class Body(RSTState):
for i in range(len(indented)):
line = indented[i].rstrip()
if line:
- if nonblank_seen and blank == i - 1: # last line blank
+ if nonblank_seen and blank == i - 1: # last line blank
match = self.attribution_pattern.match(line)
if match:
attribution_end, indent = self.check_attribution(
@@ -1257,7 +1257,7 @@ class Body(RSTState):
def parse_attribution(self, indented, line_offset):
text = '\n'.join(indented).rstrip()
- lineno = 1 + line_offset # line_offset is zero-based
+ lineno = 1 + line_offset # line_offset is zero-based
textnodes, messages = self.inline_text(text, lineno)
node = nodes.attribution(text, '', *textnodes)
node.source, node.line = self.state_machine.get_source_and_line(lineno)
@@ -1421,7 +1421,7 @@ class Body(RSTState):
auto-enumerator ("#" instead of the regular enumerator).
Return ``None`` for invalid (out of range) ordinals.
- """ #"
+ """
if sequence == '#':
enumerator = '#'
elif sequence == 'arabic':
@@ -1488,8 +1488,8 @@ class Body(RSTState):
def parse_field_marker(self, match):
"""Extract & return field name from a field marker match."""
- field = match.group()[1:] # strip off leading ':'
- field = field[:field.rfind(':')] # strip off trailing ':' etc.
+ field = match.group()[1:] # strip off leading ':'
+ field = field[:field.rfind(':')] # strip off trailing ':' etc.
return field
def parse_field_body(self, indented, offset, node):
@@ -1627,7 +1627,7 @@ class Body(RSTState):
text = '\n'.join(indented)
text_nodes, messages = self.inline_text(text, lineno)
line = nodes.line(text, '', *text_nodes)
- if match.string.rstrip() != '|': # not empty
+ if match.string.rstrip() != '|': # not empty
line.indent = len(match.group(1)) - 1
return line, messages, blank_finish
@@ -1714,12 +1714,12 @@ class Body(RSTState):
width = len(block[0].strip())
for i in range(len(block)):
block[i] = block[i].strip()
- if block[i][0] not in '+|': # check left edge
+ if block[i][0] not in '+|': # check left edge
blank_finish = 0
self.state_machine.previous_line(len(block) - i)
del block[i:]
break
- if not self.grid_table_top_pat.match(block[-1]): # find bottom
+ if not self.grid_table_top_pat.match(block[-1]): # find bottom
blank_finish = 0
# from second-last to third line of table:
for i in range(len(block) - 2, 1, -1):
@@ -1795,7 +1795,7 @@ class Body(RSTState):
table = nodes.table()
if widths == 'auto':
table['classes'] += ['colwidths-auto']
- elif widths: # "grid" or list of integers
+ elif widths: # "grid" or list of integers
table['classes'] += ['colwidths-given']
tgroup = nodes.tgroup(cols=len(colwidths))
table += tgroup
@@ -1981,7 +1981,7 @@ class Body(RSTState):
- 'refuri' and the URI
- 'malformed' and a system_message node
"""
- if block and block[-1].strip()[-1:] == '_': # possible indirect target
+ if block and block[-1].strip()[-1:] == '_': # possible indirect target
reference = ' '.join(line.strip() for line in block)
refname = self.is_reference(reference)
if refname:
@@ -2135,7 +2135,7 @@ class Body(RSTState):
) = 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]) # noqa: E203
+ initial_line_offset : self.state_machine.line_offset + 1]) # noqa: E203
try:
arguments, options, content, content_offset = (
self.parse_directive_block(indented, line_offset,
@@ -2264,7 +2264,7 @@ class Body(RSTState):
newline_offset, blank_finish = self.nested_list_parse(
datalines, 0, node, initial_state='ExtensionOptions',
blank_finish=True)
- if newline_offset != len(datalines): # incomplete parse of block
+ if newline_offset != len(datalines): # incomplete parse of block
return 0, 'invalid option block'
try:
options = utils.extract_extension_options(node, option_spec)
@@ -2292,8 +2292,8 @@ class Body(RSTState):
def comment(self, match):
if self.state_machine.is_next_line_blank():
first_comment_line = match.string[match.end():]
- if not first_comment_line.strip(): # empty comment
- return [nodes.comment()], True # "A tiny but practical wart."
+ if not first_comment_line.strip(): # empty comment
+ return [nodes.comment()], True # "A tiny but practical wart."
if first_comment_line.startswith('end of inclusion from "'):
# cf. parsers.rst.directives.misc.Include
self.document.include_log.pop()
@@ -2443,7 +2443,7 @@ class RFC2822Body(Body):
patterns['rfc2822'] = r'[!-9;-~]+:( +|$)'
initial_transitions = [(name, 'Body')
for name in Body.initial_transitions]
- initial_transitions.insert(-1, ('rfc2822', 'Body')) # just before 'text'
+ initial_transitions.insert(-1, ('rfc2822', 'Body')) # just before 'text'
def rfc2822(self, match, context, next_state):
"""RFC2822-style field list item."""
@@ -2451,7 +2451,7 @@ class RFC2822Body(Body):
self.parent += fieldlist
field, blank_finish = self.rfc2822_field(match)
fieldlist += field
- offset = self.state_machine.line_offset + 1 # next line
+ offset = self.state_machine.line_offset + 1 # next line
newline_offset, blank_finish = self.nested_list_parse(
self.state_machine.input_lines[offset:],
input_offset=self.state_machine.abs_line_offset() + 1,
@@ -2504,7 +2504,7 @@ class SpecializedBody(Body):
def invalid_input(self, match=None, context=None, next_state=None):
"""Not a compound element member. Abort this state machine."""
- self.state_machine.previous_line() # back up so parent SM can reassess
+ self.state_machine.previous_line() # back up so parent SM can reassess
raise EOFError
indent = invalid_input
@@ -2912,7 +2912,7 @@ class Definition(SpecializedText):
def eof(self, context):
"""Not a definition."""
- self.state_machine.previous_line(2) # so parent SM can reassess
+ self.state_machine.previous_line(2) # so parent SM can reassess
return []
def indent(self, match, context, next_state):
@@ -3089,7 +3089,7 @@ class QuotedLiteralBlock(RSTState):
self.parent += self.reporter.warning(
'Literal block expected; none found.',
line=self.state_machine.abs_line_number()
- ) # src not available, statemachine.input_lines is empty
+ ) # src not available, statemachine.input_lines is empty
self.state_machine.previous_line()
self.parent += self.messages
return []
diff --git a/docutils/docutils/parsers/rst/tableparser.py b/docutils/docutils/parsers/rst/tableparser.py
index 18a085cc0..6e06c4c2c 100644
--- a/docutils/docutils/parsers/rst/tableparser.py
+++ b/docutils/docutils/parsers/rst/tableparser.py
@@ -294,7 +294,7 @@ class GridTableParser(TableParser):
for i in range(len(colseps)):
colindex[colseps[i]] = i # column boundary -> col number map
colspecs = [(colseps[i] - colseps[i - 1] - 1)
- for i in range(1, len(colseps))] # list of column widths
+ for i in range(1, len(colseps))] # list of column widths
# prepare an empty table with the correct number of rows & columns
onerow = [None for i in range(len(colseps) - 1)]
rows = [onerow[:] for i in range(len(rowseps) - 1)]
diff --git a/docutils/docutils/statemachine.py b/docutils/docutils/statemachine.py
index 606185139..c7ec957a0 100644
--- a/docutils/docutils/statemachine.py
+++ b/docutils/docutils/statemachine.py
@@ -244,7 +244,7 @@ class StateMachine:
else:
results.extend(result)
except TransitionCorrection as exception:
- self.previous_line() # back up for another try
+ self.previous_line() # back up for another try
transitions = (exception.args[0],)
if self.debug:
print('\nStateMachine.run: TransitionCorrection to '
@@ -252,7 +252,7 @@ class StateMachine:
% (state.__class__.__name__, transitions[0]), file=self._stderr)
continue
except StateCorrection as exception:
- self.previous_line() # back up for another try
+ self.previous_line() # back up for another try
next_state = exception.args[0]
if len(exception.args) == 1:
transitions = None
@@ -407,7 +407,7 @@ class StateMachine:
return block
except UnexpectedIndentationError as err:
block = err.args[0]
- self.next_line(len(block) - 1) # advance to last line of block
+ self.next_line(len(block) - 1) # advance to last line of block
raise
def check_line(self, context, state, transitions=None):
@@ -808,7 +808,7 @@ class StateMachineWS(StateMachine):
indented, indent, blank_finish = self.input_lines.get_indented(
self.line_offset, until_blank, strip_indent)
if indented:
- self.next_line(len(indented) - 1) # advance to last indented line
+ self.next_line(len(indented) - 1) # advance to last indented line
while indented and not indented[0].strip():
indented.trim_start()
offset += 1
@@ -838,7 +838,7 @@ class StateMachineWS(StateMachine):
indented, indent, blank_finish = self.input_lines.get_indented(
self.line_offset, until_blank, strip_indent,
block_indent=indent)
- self.next_line(len(indented) - 1) # advance to last indented line
+ self.next_line(len(indented) - 1) # advance to last indented line
while indented and not indented[0].strip():
indented.trim_start()
offset += 1
@@ -870,7 +870,7 @@ class StateMachineWS(StateMachine):
indented, indent, blank_finish = self.input_lines.get_indented(
self.line_offset, until_blank, strip_indent,
first_indent=indent)
- self.next_line(len(indented) - 1) # advance to last indented line
+ self.next_line(len(indented) - 1) # advance to last indented line
if strip_top:
while indented and not indented[0].strip():
indented.trim_start()
@@ -1443,7 +1443,7 @@ class StringList(ViewList):
new = []
for char in line:
new.append(char)
- if east_asian_width(char) in 'WF': # 'W'ide & 'F'ull-width
+ if east_asian_width(char) in 'WF': # Wide & Full-width
new.append(pad_char)
self.data[i] = ''.join(new)
diff --git a/docutils/docutils/transforms/components.py b/docutils/docutils/transforms/components.py
index 340f6831d..462c2400a 100644
--- a/docutils/docutils/transforms/components.py
+++ b/docutils/docutils/transforms/components.py
@@ -45,7 +45,7 @@ class Filter(Transform):
def apply(self):
pending = self.startnode
- component_type = pending.details['component'] # 'reader' or 'writer'
+ component_type = pending.details['component'] # 'reader' or 'writer'
formats = (pending.details['format']).split(',')
component = self.document.transformer.components[component_type]
for format in formats:
diff --git a/docutils/docutils/transforms/parts.py b/docutils/docutils/transforms/parts.py
index 5ee6ce336..7aa9d73ed 100644
--- a/docutils/docutils/transforms/parts.py
+++ b/docutils/docutils/transforms/parts.py
@@ -38,7 +38,7 @@ class SectNum(Transform):
if self.maxdepth is None:
self.maxdepth = sys.maxsize
self.update_section_numbers(self.document)
- else: # store details for eventual section numbering by the writer
+ else: # store details for eventual section numbering by the writer
self.document.settings.sectnum_depth = self.maxdepth
self.document.settings.sectnum_start = self.startvalue
self.document.settings.sectnum_prefix = self.prefix
@@ -140,8 +140,8 @@ class Contents(Transform):
entries.append(item)
if entries:
contents = nodes.bullet_list('', *entries)
- if auto: # auto-numbered sections
- contents['classes'].append('auto-toc') # auto-numbered sections
+ if auto: # auto-numbered sections
+ contents['classes'].append('auto-toc')
return contents
else:
return []
diff --git a/docutils/docutils/transforms/peps.py b/docutils/docutils/transforms/peps.py
index 342e28a8d..a8905cc67 100644
--- a/docutils/docutils/transforms/peps.py
+++ b/docutils/docutils/transforms/peps.py
@@ -48,7 +48,7 @@ class Headers(Transform):
'header; it is not a PEP.')
pep = None
for field in header:
- if field[0].astext().lower() == 'pep': # should be the first field
+ if field[0].astext().lower() == 'pep': # should be the first field
value = field[1].astext()
try:
pep = int(value)
@@ -122,7 +122,7 @@ class Headers(Transform):
refuri=(self.document.settings.pep_base_url
+ self.pep_url % pepno)))
newbody.append(space)
- para[:] = newbody[:-1] # drop trailing space
+ para[:] = newbody[:-1] # drop trailing space
elif name == 'last-modified':
utils.clean_rcs_keywords(para, self.rcs_keyword_substitutions)
if cvs_url:
diff --git a/docutils/docutils/transforms/references.py b/docutils/docutils/transforms/references.py
index b18966e6c..f2b9f2b71 100644
--- a/docutils/docutils/transforms/references.py
+++ b/docutils/docutils/transforms/references.py
@@ -235,7 +235,7 @@ class IndirectHyperlinks(Transform):
self.circular_indirect_reference(target)
return
target.multiply_indirect = 1
- self.resolve_indirect_target(reftarget) # multiply indirect
+ self.resolve_indirect_target(reftarget) # multiply indirect
del target.multiply_indirect
if reftarget.hasattr('refuri'):
target['refuri'] = reftarget['refuri']
diff --git a/docutils/docutils/transforms/universal.py b/docutils/docutils/transforms/universal.py
index 08c8a40b3..35af57f9a 100644
--- a/docutils/docutils/transforms/universal.py
+++ b/docutils/docutils/transforms/universal.py
@@ -152,7 +152,7 @@ class FilterMessages(Transform):
for node in tuple(self.document.findall(nodes.system_message)):
if node['level'] < self.document.reporter.report_level:
node.parent.remove(node)
- try: # also remove id-entry
+ try: # also remove id-entry
del(self.document.ids[node['ids'][0]])
except (IndexError):
pass
@@ -318,7 +318,7 @@ class SmartQuotes(Transform):
if tag in smartquotes.smartchars.quotes:
lang = tag
break
- else: # language not supported: (keep ASCII quotes)
+ else: # language not supported -- keep ASCII quotes
if lang not in self.unsupported_languages:
self.document.reporter.warning(
'No smart quotes defined for language "%s".' % lang,
@@ -335,4 +335,4 @@ class SmartQuotes(Transform):
for txtnode, newtext in zip(txtnodes, teacher):
txtnode.parent.replace(txtnode, nodes.Text(newtext))
- self.unsupported_languages = set() # reset
+ self.unsupported_languages.clear()
diff --git a/docutils/docutils/utils/__init__.py b/docutils/docutils/utils/__init__.py
index 53695406f..37d89929e 100644
--- a/docutils/docutils/utils/__init__.py
+++ b/docutils/docutils/utils/__init__.py
@@ -168,8 +168,9 @@ class Reporter:
if line is not None:
attributes.setdefault('line', line)
# assert source is not None, "node has line- but no source-argument"
- if 'source' not in attributes: # 'line' is absolute line number
- try: # look up (source, line-in-source)
+ if 'source' not in attributes:
+ # 'line' is absolute line number
+ try:
source, line = self.get_source_and_line(attributes.get('line'))
except AttributeError:
source, line = None, None
@@ -345,7 +346,7 @@ def decode_path(path):
return path
try:
path = path.decode(sys.getfilesystemencoding(), 'strict')
- except AttributeError: # default value None has no decode method
+ except AttributeError: # default value None has no decode method
if not path:
return ''
raise ValueError('`path` value must be a String or ``None``, '
@@ -525,7 +526,7 @@ def get_stylesheet_list(settings):
# expand relative paths if found in stylesheet-dirs:
stylesheets = [find_file_in_dirs(path, settings.stylesheet_dirs)
for path in stylesheets]
- if os.sep != '/': # for URLs, we need POSIX paths
+ if os.sep != '/': # for URLs, we need POSIX paths
stylesheets = [path.replace(os.sep, '/') for path in stylesheets]
return stylesheets
diff --git a/docutils/docutils/utils/code_analyzer.py b/docutils/docutils/utils/code_analyzer.py
index 5edc8736f..f0ecc9b71 100644
--- a/docutils/docutils/utils/code_analyzer.py
+++ b/docutils/docutils/utils/code_analyzer.py
@@ -16,9 +16,9 @@ except ImportError:
with_pygments = False
# Filter the following token types from the list of class arguments:
-unstyled_tokens = ['token', # Token (base token type)
- 'text', # Token.Text
- ''] # short name for Token and Text
+unstyled_tokens = ['token', # Token (base token type)
+ 'text', # Token.Text
+ ''] # short name for Token and Text
# (Add, e.g., Token.Punctuation with ``unstyled_tokens += 'punctuation'``.)
class LexerError(ApplicationError):
@@ -97,9 +97,9 @@ class Lexer:
return
tokens = pygments.lex(self.code, self.lexer)
for tokentype, value in self.merge(tokens):
- if self.tokennames == 'long': # long CSS class args
+ if self.tokennames == 'long': # long CSS class args
classes = str(tokentype).lower().split('.')
- else: # short CSS class args
+ else: # short CSS class args
classes = [_get_ttype_class(tokentype)]
classes = [cls for cls in classes if cls not in unstyled_tokens]
yield classes, value
diff --git a/docutils/docutils/utils/math/latex2mathml.py b/docutils/docutils/utils/math/latex2mathml.py
index 8df9d30b2..2dc95b8fc 100644
--- a/docutils/docutils/utils/math/latex2mathml.py
+++ b/docutils/docutils/utils/math/latex2mathml.py
@@ -39,7 +39,7 @@ from docutils.utils.math import tex2unichar, toplevel_code
# identifiers -> <mi>
letters = tex2unichar.mathalpha
-letters['hbar'] = '\u210F' # compatibility mapping to ℏ (\hslash).
+letters['hbar'] = '\u210F' # compatibility mapping to ℏ (\hslash).
# (ħ LATIN SMALL LETTER H WITH STROKE is upright)
# special case: Capital Greek letters: (upright in TeX style)
diff --git a/docutils/docutils/utils/math/tex2mathml_extern.py b/docutils/docutils/utils/math/tex2mathml_extern.py
index 6aa46133b..03b336805 100644
--- a/docutils/docutils/utils/math/tex2mathml_extern.py
+++ b/docutils/docutils/utils/math/tex2mathml_extern.py
@@ -31,7 +31,7 @@ def latexml(math_code, reporter=None):
.. _LaTeXML: http://dlmf.nist.gov/LaTeXML/
"""
p = subprocess.Popen(['latexml',
- '-', # read from stdin
+ '-', # read from stdin
# '--preload=amsmath',
'--inputencoding=utf8',
],
@@ -50,7 +50,7 @@ def latexml(math_code, reporter=None):
'-',
'--nonumbersections',
'--format=xhtml',
- # '--linelength=78', # experimental
+ # '--linelength=78', # experimental
'--'
],
stdin=subprocess.PIPE,
@@ -77,9 +77,9 @@ def ttm(math_code, reporter=None):
.. _TtM: http://hutchinson.belmont.ma.us/tth/mml/
"""
p = subprocess.Popen(['ttm',
- # '-i', # italic font for equations. Default roman.
- '-', # unicode character encoding. (Default iso-8859-1).
- '-r', # output raw MathML (no preamble or postlude)
+ # '-i', # italic font for equations. Default roman.
+ '-u', # unicode encoding. (Default iso-8859-1).
+ '-r', # output raw MathML (no wrapper)
],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
diff --git a/docutils/docutils/utils/punctuation_chars.py b/docutils/docutils/utils/punctuation_chars.py
index b3617fe55..99ab36f14 100644
--- a/docutils/docutils/utils/punctuation_chars.py
+++ b/docutils/docutils/utils/punctuation_chars.py
@@ -82,7 +82,7 @@ delimiters = (u'\\-/:\u058a\xa1\xb7\xbf\u037e\u0387\u055a-\u055f\u0589'
u'\ufe50-\ufe52\ufe54-\ufe58\ufe5f-\ufe61\ufe63\ufe68\ufe6a'
u'\ufe6b\uff01-\uff03\uff05-\uff07\uff0a\uff0c-\uff0f\uff1a'
u'\uff1b\uff1f\uff20\uff3c\uff61\uff64\uff65')
-if sys.maxunicode >= 0x10FFFF: # "wide" build
+if sys.maxunicode >= 0x10FFFF: # "wide" build
delimiters += (u'\U00010100\U00010101\U0001039f\U000103d0\U00010857'
u'\U0001091f\U0001093f\U00010a50-\U00010a58\U00010a7f'
u'\U00010b39-\U00010b3f\U000110bb\U000110bc\U000110be-'
@@ -93,15 +93,16 @@ closing_delimiters = u'\\\\.,;!?'
# Matching open/close quotes
# --------------------------
-quote_pairs = {# open char: matching closing characters # usage example
- u'\xbb': u'\xbb', # » » Swedish
- u'\u2018': u'\u201a', # ‘ ‚ Albanian/Greek/Turkish
- u'\u2019': u'\u2019', # ’ ’ Swedish
- u'\u201a': u'\u2018\u2019', # ‚ ‘ German ‚ ’ Polish
- u'\u201c': u'\u201e', # “ „ Albanian/Greek/Turkish
- u'\u201e': u'\u201c\u201d', # „ “ German „ ” Polish
- u'\u201d': u'\u201d', # ” ” Swedish
- u'\u203a': u'\u203a', # › › Swedish
+quote_pairs = {
+ # open char: matching closing characters # usage example
+ u'\xbb': u'\xbb', # » » Swedish
+ u'\u2018': u'\u201a', # ‘ ‚ Albanian/Greek/Turkish
+ u'\u2019': u'\u2019', # ’ ’ Swedish
+ u'\u201a': u'\u2018\u2019', # ‚ ‘ German ‚ ’ Polish
+ u'\u201c': u'\u201e', # “ „ Albanian/Greek/Turkish
+ u'\u201e': u'\u201c\u201d', # „ “ German „ ” Polish
+ u'\u201d': u'\u201d', # ” ” Swedish
+ u'\u203a': u'\u203a', # › › Swedish
}
"""Additional open/close quote pairs."""
diff --git a/docutils/docutils/utils/smartquotes.py b/docutils/docutils/utils/smartquotes.py
index a5b127e20..66d9f9a7e 100644
--- a/docutils/docutils/utils/smartquotes.py
+++ b/docutils/docutils/utils/smartquotes.py
@@ -387,10 +387,10 @@ import re, sys
class smartchars:
"""Smart quotes and dashes"""
- endash = '–' # "&#8211;" EN DASH
- emdash = '—' # "&#8212;" EM DASH
- ellipsis = '…' # "&#8230;" HORIZONTAL ELLIPSIS
- apostrophe = '’' # "&#8217;" RIGHT SINGLE QUOTATION MARK
+ endash = '–' # "&#8211;" EN DASH
+ emdash = '—' # "&#8212;" EM DASH
+ ellipsis = '…' # "&#8230;" HORIZONTAL ELLIPSIS
+ apostrophe = '’' # "&#8217;" RIGHT SINGLE QUOTATION MARK
# quote characters (language-specific, set in __init__())
# [1] https://en.wikipedia.org/wiki/Non-English_usage_of_quotation_marks
@@ -407,7 +407,7 @@ class smartchars:
# See also configuration option "smartquote-locales".
quotes = {'af': '“”‘’',
'af-x-altquot': '„”‚’',
- 'bg': '„“‚‘', # Bulgarian, https://bg.wikipedia.org/wiki/Кавички
+ 'bg': '„“‚‘', # https://bg.wikipedia.org/wiki/Кавички
'ca': '«»“”',
'ca-x-altquot': '“”‘’',
'cs': '„“‚‘',
@@ -420,24 +420,24 @@ class smartchars:
'de-ch': '«»‹›',
'el': '«»“”',
'en': '“”‘’',
- 'en-uk-x-altquot': '‘’“”', # Attention: " → ‘ and ' → “ !
+ 'en-uk-x-altquot': '‘’“”', # Attention: " → ‘ and ' → “ !
'eo': '“”‘’',
'es': '«»“”',
'es-x-altquot': '“”‘’',
- 'et': '„“‚‘', # no secondary quote listed in
- 'et-x-altquot': '«»‹›', # the sources above (wikipedia.org)
+ 'et': '„“‚‘', # no secondary quote listed in
+ 'et-x-altquot': '«»‹›', # the sources above (wikipedia.org)
'eu': '«»‹›',
'fi': '””’’',
'fi-x-altquot': '»»››',
- 'fr': ('« ', ' »', '“', '”'), # full no-break space
- 'fr-x-altquot': ('« ', ' »', '“', '”'), # narrow no-break space
- 'fr-ch': '«»‹›',
- 'fr-ch-x-altquot': ('« ', ' »', '‹ ', ' ›'), # narrow no-break space, http://typoguide.ch/
+ 'fr': ('« ', ' »', '“', '”'), # full no-break space
+ 'fr-x-altquot': ('« ', ' »', '“', '”'), # narrow no-break space
+ 'fr-ch': '«»‹›', # http://typoguide.ch/
+ 'fr-ch-x-altquot': ('« ', ' »', '‹ ', ' ›'), # narrow no-break space
'gl': '«»“”',
- 'he': '”“»«', # Hebrew is RTL, test position:
- 'he-x-altquot': '„”‚’', # low quotation marks are opening.
- # 'he-x-altquot': '“„‘‚', # RTL: low quotation marks opening
- 'hr': '„”‘’', # http://hrvatska-tipografija.com/polunavodnici/
+ 'he': '”“»«', # Hebrew is RTL, test position:
+ 'he-x-altquot': '„”‚’', # low quotation marks are opening.
+ # 'he-x-altquot': '“„‘‚', # RTL: low quotation marks opening
+ 'hr': '„”‘’', # http://hrvatska-tipografija.com/polunavodnici/
'hr-x-altquot': '»«›‹',
'hsb': '„“‚‘',
'hsb-x-altquot': '»«›‹',
@@ -446,38 +446,38 @@ class smartchars:
'it': '«»“”',
'it-ch': '«»‹›',
'it-x-altquot': '“”‘’',
- # 'it-x-altquot2': '“„‘‚', # [7] in headlines
+ # 'it-x-altquot2': '“„‘‚', # [7] in headlines
'ja': '「」『』',
'ko': '“”‘’',
'lt': '„“‚‘',
'lv': '„“‚‘',
- 'mk': '„“‚‘', # Macedonian, https://mk.wikipedia.org/wiki/Правопис_и_правоговор_на_македонскиот_јазик
+ 'mk': '„“‚‘', # Macedonian, https://mk.wikipedia.org/wiki/Правопис_и_правоговор_на_македонскиот_јазик
'nl': '“”‘’',
'nl-x-altquot': '„”‚’',
# 'nl-x-altquot2': '””’’',
- 'nb': '«»’’', # Norsk bokmål (canonical form 'no')
- 'nn': '«»’’', # Nynorsk [10]
- 'nn-x-altquot': '«»‘’', # [8], [10]
- # 'nn-x-altquot2': '«»«»', # [9], [10
- # 'nn-x-altquot3': '„“‚‘', # [10]
- 'no': '«»’’', # Norsk bokmål [10]
- 'no-x-altquot': '«»‘’', # [8], [10]
- # 'no-x-altquot2': '«»«»', # [9], [10
- # 'no-x-altquot3': '„“‚‘', # [10]
+ 'nb': '«»’’', # Norsk bokmål (canonical form 'no')
+ 'nn': '«»’’', # Nynorsk [10]
+ 'nn-x-altquot': '«»‘’', # [8], [10]
+ # 'nn-x-altquot2': '«»«»', # [9], [10
+ # 'nn-x-altquot3': '„“‚‘', # [10]
+ 'no': '«»’’', # Norsk bokmål [10]
+ 'no-x-altquot': '«»‘’', # [8], [10]
+ # 'no-x-altquot2': '«»«»', # [9], [10
+ # 'no-x-altquot3': '„“‚‘', # [10]
'pl': '„”«»',
'pl-x-altquot': '«»‚’',
- # 'pl-x-altquot2': '„”‚’', # https://pl.wikipedia.org/wiki/Cudzys%C5%82%C3%B3w
+ # 'pl-x-altquot2': '„”‚’', # https://pl.wikipedia.org/wiki/Cudzys%C5%82%C3%B3w
'pt': '«»“”',
'pt-br': '“”‘’',
'ro': '„”«»',
'ru': '«»„“',
- 'sh': '„”‚’', # Serbo-Croatian
+ 'sh': '„”‚’', # Serbo-Croatian
'sh-x-altquot': '»«›‹',
- 'sk': '„“‚‘', # Slovak
+ 'sk': '„“‚‘', # Slovak
'sk-x-altquot': '»«›‹',
- 'sl': '„“‚‘', # Slovenian
+ 'sl': '„“‚‘', # Slovenian
'sl-x-altquot': '»«›‹',
- 'sq': '«»‹›', # Albanian
+ 'sq': '«»‹›', # Albanian
'sq-x-altquot': '“„‘‚',
'sr': '„”’’',
'sr-x-altquot': '»«›‹',
@@ -485,7 +485,7 @@ class smartchars:
'sv-x-altquot': '»»››',
'tr': '“”‘’',
'tr-x-altquot': '«»‹›',
- # 'tr-x-altquot2': '“„‘‚', # [7] antiquated?
+ # 'tr-x-altquot2': '“„‘‚', # [7] antiquated?
'uk': '«»„“',
'uk-x-altquot': '„“‚‘',
'zh-cn': '“”‘’',
@@ -532,8 +532,8 @@ def educate_tokens(text_tokens, attr=default_smartypants_attr, language='en'):
do_ellipses = False
do_stupefy = False
- # if attr == "0": # pass tokens unchanged (see below).
- if attr == "1": # Do everything, turn all options on.
+ # if attr == "0": # pass tokens unchanged (see below).
+ if attr == "1": # Do everything, turn all options on.
do_quotes = True
do_backticks = True
do_dashes = 1
@@ -550,7 +550,7 @@ def educate_tokens(text_tokens, attr=default_smartypants_attr, language='en'):
do_backticks = True
do_dashes = 3
do_ellipses = True
- elif attr == "-1": # Special "stupefy" mode.
+ elif attr == "-1": # Special "stupefy" mode.
do_stupefy = True
else:
if "q" in attr: do_quotes = True
@@ -580,7 +580,7 @@ def educate_tokens(text_tokens, attr=default_smartypants_attr, language='en'):
yield text
continue
- last_char = text[-1:] # Remember last char before processing.
+ last_char = text[-1:] # Remember last char before processing.
text = processEscapes(text)
@@ -633,12 +633,12 @@ def educateQuotes(text, language='en'):
"""
smart = smartchars(language)
- ch_classes = {'open': '[([{]', # opening braces
- 'close': r'[^\s]', # everything except whitespace
- 'punct': r"""[-!"#\$\%'()*+,.\/:;<=>?\@\[\\\]\^_`{|}~]""",
- 'dash': '[-–—]' # hyphen and em/en dashes
- + r'|&[mn]dash;|&\#8211;|&\#8212;|&\#x201[34];',
- 'sep': '[\\s\u200B\u200C]|&nbsp;', # Whitespace, ZWSP, ZWNJ
+ ch_classes = {'open': '[([{]', # opening braces
+ 'close': r'[^\s]', # everything except whitespace
+ 'punct': r"""[-!" #\$\%'()*+,.\/:;<=>?\@\[\\\]\^_`{|}~]""",
+ 'dash': '[-–—]' # hyphen and em/en dashes
+ r'|&[mn]dash;|&\#8211;|&\#8212;|&\#x201[34];',
+ 'sep': '[\\s\u200B\u200C]|&nbsp;', # Whitespace, ZWSP, ZWNJ
}
# Special case if the very first character is a quote
@@ -660,7 +660,7 @@ def educateQuotes(text, language='en'):
r'\1%s'%smart.cpquote, text)
# Special case for decade abbreviations (the '80s):
- if language.startswith('en'): # TODO similar cases in other languages?
+ if language.startswith('en'): # TODO similar cases in other languages?
text = re.sub(r"'(?=\d{2}s)", smart.apostrophe, text)
# Get most opening secondary quotes:
@@ -670,8 +670,8 @@ def educateQuotes(text, language='en'):
%(open)s | # opening brace, or
%(dash)s # em/en-dash
)
- ' # the quote
- (?=\\w|%(punct)s) # followed by a word character or punctuation
+ ' # the quote
+ (?=\\w|%(punct)s) # word character or punctuation
""" % ch_classes, re.VERBOSE)
text = opening_secondary_quotes_regex.sub(r'\1'+smart.osquote, text)
@@ -755,8 +755,8 @@ def educateDashes(text):
an em-dash character.
"""
- text = text.replace(r'---', smartchars.endash) # en (yes, backwards)
- text = text.replace(r'--', smartchars.emdash) # em (yes, backwards)
+ text = text.replace(r'---', smartchars.endash) # en (yes, backwards)
+ text = text.replace(r'--', smartchars.emdash) # em (yes, backwards)
return text
@@ -819,16 +819,13 @@ def stupefyEntities(text, language='en'):
"""
smart = smartchars(language)
- text = text.replace(smart.endash, "-") # en-dash
- text = text.replace(smart.emdash, "--") # em-dash
-
+ text = text.replace(smart.endash, "-")
+ text = text.replace(smart.emdash, "--")
text = text.replace(smart.osquote, "'") # open secondary quote
text = text.replace(smart.csquote, "'") # close secondary quote
-
text = text.replace(smart.opquote, '"') # open primary quote
text = text.replace(smart.cpquote, '"') # close primary quote
-
- text = text.replace(smart.ellipsis, '...') # ellipsis
+ text = text.replace(smart.ellipsis, '...')
return text
@@ -898,7 +895,7 @@ if __name__ == "__main__":
import itertools
import locale
try:
- locale.setlocale(locale.LC_ALL, '') # set to user defaults
+ locale.setlocale(locale.LC_ALL, '') # set to user defaults
defaultlanguage = locale.getdefaultlocale()[0]
except:
defaultlanguage = 'en'
diff --git a/docutils/docutils/writers/_html_base.py b/docutils/docutils/writers/_html_base.py
index 7f40e3e7c..8d52d1445 100644
--- a/docutils/docutils/writers/_html_base.py
+++ b/docutils/docutils/writers/_html_base.py
@@ -34,7 +34,7 @@ from docutils.utils.math import (unichar2tex, pick_math_environment,
class Writer(writers.Writer):
- supported = ('html', 'xhtml') # update in subclass
+ supported = ('html', 'xhtml') # update in subclass
"""Formats this writer supports."""
settings_spec = (
@@ -132,7 +132,7 @@ class Writer(writers.Writer):
settings_defaults = {'output_encoding_error_handler': 'xmlcharrefreplace'}
- config_section = 'html base writer' # overwrite in subclass
+ config_section = 'html base writer' # overwrite in subclass
config_section_dependencies = ('writers', 'html writers')
visitor_attributes = (
@@ -265,13 +265,13 @@ class HTMLTranslator(nodes.NodeVisitor):
words_and_spaces = re.compile(r'[^ \n]+| +|\n')
# wrap point inside word:
in_word_wrap_point = re.compile(r'.+\W\W.+|[-?].+')
- lang_attribute = 'lang' # name changes to 'xml:lang' in XHTML 1.1
+ lang_attribute = 'lang' # name changes to 'xml:lang' in XHTML 1.1
special_characters = {ord('&'): '&amp;',
ord('<'): '&lt;',
ord('"'): '&quot;',
ord('>'): '&gt;',
- ord('@'): '&#64;', # may thwart address harvesters
+ ord('@'): '&#64;', # may thwart address harvesters
}
"""Character references for characters with a special meaning in HTML."""
@@ -319,7 +319,7 @@ class HTMLTranslator(nodes.NodeVisitor):
'Use "image_loading: link".',
FutureWarning, stacklevel=8)
if self.image_loading is None:
- self.image_loading = 'link' # default
+ self.image_loading = 'link' # default
self.math_output = settings.math_output.split()
self.math_output_options = self.math_output[1:]
self.math_output = self.math_output[0].lower()
@@ -340,13 +340,13 @@ class HTMLTranslator(nodes.NodeVisitor):
self.subtitle = []
self.header = []
self.footer = []
- self.html_head = [self.content_type] # charset not interpolated
+ self.html_head = [self.content_type] # charset not interpolated
self.html_title = []
self.html_subtitle = []
self.html_body = []
- self.in_document_title = 0 # len(self.body) or 0
+ self.in_document_title = 0 # len(self.body) or 0
self.in_mailto = False
- self.author_in_authors = False # for html4css1
+ self.author_in_authors = False # for html4css1
self.math_header = []
def astext(self):
@@ -825,7 +825,7 @@ class HTMLTranslator(nodes.NodeVisitor):
self.html_head.extend(self.head[1:])
self.body_prefix.append(self.starttag(node, 'div', CLASS='document'))
self.body_suffix.insert(0, '</div>\n')
- self.fragment.extend(self.body) # self.fragment is the "naked" body
+ self.fragment.extend(self.body) # self.fragment is the "naked" body
self.html_body.extend(self.body_prefix[1:] + self.body_pre_docinfo
+ self.docinfo + self.body
+ self.body_suffix[:-1])
@@ -1005,7 +1005,7 @@ class HTMLTranslator(nodes.NodeVisitor):
with PIL.Image.open(imagepath) as img:
imgsize = img.size
except (OSError, UnicodeEncodeError):
- pass # TODO: warn?
+ pass # TODO: warn?
else:
self.settings.record_dependencies.add(
imagepath.replace('\\', '/'))
@@ -1156,7 +1156,7 @@ class HTMLTranslator(nodes.NodeVisitor):
else:
self.body.append(self.encode(token))
self.body.append('</span>')
- raise nodes.SkipNode # content already processed
+ raise nodes.SkipNode # content already processed
def depart_literal(self, node):
# skipped unless literal element is from "code" role:
@@ -1177,7 +1177,8 @@ class HTMLTranslator(nodes.NodeVisitor):
# for the math-output: LaTeX and MathJax simply wrap the content,
# HTML and MathML also convert the math_code.
# HTML container
- math_tags = {# math_output: (block, inline, class-arguments)
+ math_tags = {
+ # math_output: (block, inline, class-arguments)
'html': ('div', 'span', 'formula'),
'latex': ('pre', 'tt', 'math'),
'mathml': ('div', '', ''),
@@ -1195,7 +1196,8 @@ class HTMLTranslator(nodes.NodeVisitor):
tag = self.math_tags[self.math_output][math_env == '']
clsarg = self.math_tags[self.math_output][2]
# LaTeX container
- wrappers = {# math_mode: (inline, block)
+ wrappers = {
+ # math_mode: (inline, block)
'html': ('$%s$', '\\begin{%s}\n%s\n\\end{%s}'),
'latex': (None, None),
'mathml': ('$%s$', '\\begin{%s}\n%s\n\\end{%s}'),
@@ -1209,9 +1211,9 @@ class HTMLTranslator(nodes.NodeVisitor):
# get and wrap content
math_code = node.astext().translate(unichar2tex.uni2tex_table)
if wrapper:
- try: # wrapper with three "%s"
+ try: # wrapper with three "%s"
math_code = wrapper % (math_env, math_code, math_env)
- except TypeError: # wrapper with one "%s"
+ except TypeError: # wrapper with one "%s"
math_code = wrapper % math_code
# settings and conversion
if self.math_output in ('latex', 'mathjax'):
@@ -1280,7 +1282,7 @@ class HTMLTranslator(nodes.NodeVisitor):
suffix='\n'*bool(math_env),
CLASS=clsarg))
self.body.append(math_code)
- if math_env: # block mode (equation, display)
+ if math_env: # block mode (equation, display)
self.body.append('\n')
if tag:
self.body.append('</%s>' % tag)
@@ -1290,14 +1292,14 @@ class HTMLTranslator(nodes.NodeVisitor):
raise nodes.SkipNode
def depart_math(self, node):
- pass # never reached
+ pass # never reached
def visit_math_block(self, node):
math_env = pick_math_environment(node.astext())
self.visit_math(node, math_env=math_env)
def depart_math_block(self, node):
- pass # never reached
+ pass # never reached
# Meta tags: 'lang' attribute replaced by 'xml:lang' in XHTML 1.1
# HTML5/polyglot recommends using both
@@ -1627,7 +1629,7 @@ class HTMLTranslator(nodes.NodeVisitor):
if node.hasattr('refid'):
atts = {}
atts['class'] = 'toc-backref'
- atts['role'] = 'doc-backlink' # HTML5 only
+ atts['role'] = 'doc-backlink' # HTML5 only
atts['href'] = '#' + node['refid']
start_tag += self.starttag(nodes.reference(), 'a', '', **atts)
close_tag = '</a></%s>\n' % tagname
diff --git a/docutils/docutils/writers/docutils_xml.py b/docutils/docutils/writers/docutils_xml.py
index 029d2b505..5a2c76dbc 100644
--- a/docutils/docutils/writers/docutils_xml.py
+++ b/docutils/docutils/writers/docutils_xml.py
@@ -33,7 +33,7 @@ class Writer(writers.Writer):
['--newlines'],
{'action': 'store_true', 'validator': frontend.validate_boolean}),
('Generate XML with indents and newlines.',
- ['--indents'], #@ TODO use integer value for number of spaces?
+ ['--indents'], #@ TODO use integer value for number of spaces?
{'action': 'store_true', 'validator': frontend.validate_boolean}),
('Omit the XML declaration. Use with caution.',
['--no-xml-declaration'],
@@ -92,10 +92,10 @@ class XMLTranslator(nodes.GenericNodeVisitor):
self.newline = '\n'
if settings.indents:
self.newline = '\n'
- self.indent = ' ' #@ TODO make this configurable?
- self.level = 0 # indentation level
- self.in_simple = 0 # level of nesting inside mixed-content elements
- self.fixed_text = 0 # level of nesting inside FixedText elements
+ self.indent = ' ' #@ TODO make this configurable?
+ self.level = 0 # indentation level
+ self.in_simple = 0 # level of nesting inside mixed-content elements
+ self.fixed_text = 0 # level of nesting inside FixedText elements
# Output
self.output = []
@@ -114,7 +114,7 @@ class XMLTranslator(nodes.GenericNodeVisitor):
# --------------------------------
simple_nodes = (nodes.TextElement,
- nodes.image, nodes.colspec, nodes.transition) # empty elements
+ nodes.image, nodes.colspec, nodes.transition) # empty elements
def default_visit(self, node):
"""Default node visit method."""
@@ -176,11 +176,11 @@ class XMLTranslator(nodes.GenericNodeVisitor):
line_num = self.the_handle.locator.getLineNumber()
srcline = node.line
if not isinstance(node.parent, nodes.TextElement):
- srcline += 2 # directive content start line
+ srcline += 2 # directive content start line
msg = 'Invalid raw XML in column %d, line offset %d:\n%s' % (
col_num, line_num, node.astext())
self.warn(msg, source=node.source, line=srcline+line_num-1)
- raise nodes.SkipNode # content already processed
+ raise nodes.SkipNode # content already processed
class TestXml(xml.sax.handler.ContentHandler):
diff --git a/docutils/docutils/writers/html4css1/__init__.py b/docutils/docutils/writers/html4css1/__init__.py
index a1e515b98..a05172e70 100644
--- a/docutils/docutils/writers/html4css1/__init__.py
+++ b/docutils/docutils/writers/html4css1/__init__.py
@@ -32,7 +32,7 @@ class Writer(writers._html_base.Writer):
os.path.abspath(os.path.dirname(__file__)),
os.path.abspath(os.path.join(
os.path.dirname(os.path.dirname(__file__)),
- 'html5_polyglot')) # for math.css
+ 'html5_polyglot')) # for math.css
]
default_template = os.path.join(
os.path.dirname(os.path.abspath(__file__)), 'template.txt')
@@ -566,7 +566,7 @@ class HTMLTranslator(writers._html_base.HTMLTranslator):
with PIL.Image.open(imagepath) as img:
img_size = img.size
except (OSError, UnicodeEncodeError):
- pass # TODO: warn/info?
+ pass # TODO: warn/info?
else:
self.settings.record_dependencies.add(
imagepath.replace('\\', '/'))
@@ -723,7 +723,7 @@ class HTMLTranslator(writers._html_base.HTMLTranslator):
([], ['first'], ['last'], ['first', 'last']))):
# Attribute which needs to survive.
return False
- first = isinstance(node.parent[0], nodes.label) # skip label
+ first = isinstance(node.parent[0], nodes.label) # skip label
for child in node.parent.children[first:]:
# only first paragraph can be compact
if isinstance(child, nodes.Invisible):
diff --git a/docutils/docutils/writers/html5_polyglot/__init__.py b/docutils/docutils/writers/html5_polyglot/__init__.py
index 7656ea7f1..80be0ff27 100644
--- a/docutils/docutils/writers/html5_polyglot/__init__.py
+++ b/docutils/docutils/writers/html5_polyglot/__init__.py
@@ -84,18 +84,18 @@ class Writer(writers._html_base.Writer):
settings_spec = settings_spec + (
'HTML5 Writer Options',
'',
- ((frontend.SUPPRESS_HELP, # Obsoleted by "--image-loading"
+ ((frontend.SUPPRESS_HELP, # Obsoleted by "--image-loading"
['--embed-images'],
{'action': 'store_true',
'validator': frontend.validate_boolean}),
- (frontend.SUPPRESS_HELP, # Obsoleted by "--image-loading"
+ (frontend.SUPPRESS_HELP, # Obsoleted by "--image-loading"
['--link-images'],
{'dest': 'embed_images', 'action': 'store_false'}),
('Suggest at which point images should be loaded: '
'"embed", "link" (default), or "lazy".',
['--image-loading'],
{'choices': ('embed', 'link', 'lazy'),
- # 'default': 'link' # default set in _html_base.py
+ # 'default': 'link' # default set in _html_base.py
}),
('Append a self-link to section headings.',
['--section-self-link'],
@@ -221,7 +221,7 @@ class HTMLTranslator(writers._html_base.HTMLTranslator):
self.html_head.extend(self.head[1:])
self.body_prefix.append(self.starttag(node, 'main'))
self.body_suffix.insert(0, '</main>\n')
- self.fragment.extend(self.body) # self.fragment is the "naked" body
+ self.fragment.extend(self.body) # self.fragment is the "naked" body
self.html_body.extend(self.body_prefix[1:] + self.body_pre_docinfo
+ self.docinfo + self.body
+ self.body_suffix[:-1])
diff --git a/docutils/docutils/writers/latex2e/__init__.py b/docutils/docutils/writers/latex2e/__init__.py
index e7d5f71c8..c20c2044c 100644
--- a/docutils/docutils/writers/latex2e/__init__.py
+++ b/docutils/docutils/writers/latex2e/__init__.py
@@ -40,7 +40,7 @@ class Writer(writers.Writer):
'\\usepackage{mathptmx} % Times\n'
'\\usepackage[scaled=.90]{helvet}\n'
'\\usepackage{courier}')
- table_style_values = [# TODO: align-left, align-center, align-right, ??
+ table_style_values = [ # TODO: align-left, align-center, align-right, ??
'booktabs', 'borderless', 'colwidths-auto',
'nolines', 'standard']
@@ -237,7 +237,7 @@ class Writer(writers.Writer):
),
)
- settings_defaults = {'sectnum_depth': 0} # updated by SectNum transform
+ settings_defaults = {'sectnum_depth': 0} # updated by SectNum transform
config_section = 'latex2e writer'
config_section_dependencies = ('writers', 'latex writers')
@@ -279,7 +279,7 @@ class Writer(writers.Writer):
with open(templatepath, encoding='utf8') as fp:
template = fp.read()
# fill template
- self.assemble_parts() # create dictionary of parts
+ self.assemble_parts() # create dictionary of parts
self.output = string.Template(template).substitute(self.parts)
def assemble_parts(self):
@@ -289,7 +289,7 @@ class Writer(writers.Writer):
lines = getattr(self, part)
if part in self.head_parts:
if lines:
- lines.append('') # to get a trailing newline
+ lines.append('') # to get a trailing newline
self.parts[part] = '\n'.join(lines)
else:
# body contains inline elements, so join without newline
@@ -311,7 +311,7 @@ class Babel:
# https://www.w3.org/International/articles/language-tags/
# and http://www.iana.org/assignments/language-subtag-registry
language_codes = {
- # code TeX/Babel-name comment
+ # code TeX/Babel-name comment
'af': 'afrikaans',
'ar': 'arabic',
# 'be': 'belarusian',
@@ -322,14 +322,14 @@ class Babel:
'cs': 'czech',
'cy': 'welsh',
'da': 'danish',
- 'de': 'ngerman', # new spelling (de_1996)
- 'de-1901': 'german', # old spelling
+ 'de': 'ngerman', # new spelling (de_1996)
+ 'de-1901': 'german', # old spelling
'de-AT': 'naustrian',
'de-AT-1901': 'austrian',
'dsb': 'lowersorbian',
- 'el': 'greek', # monotonic (el-monoton)
+ 'el': 'greek', # monotonic (el-monoton)
'el-polyton': 'polutonikogreek',
- 'en': 'english', # TeX' default language
+ 'en': 'english', # TeX' default language
'en-AU': 'australian',
'en-CA': 'canadian',
'en-GB': 'british',
@@ -343,16 +343,16 @@ class Babel:
'fi': 'finnish',
'fr': 'french',
'fr-CA': 'canadien',
- 'ga': 'irish', # Irish Gaelic
- # 'grc': # Ancient Greek
- 'grc-ibycus': 'ibycus', # Ibycus encoding
+ 'ga': 'irish', # Irish Gaelic
+ # 'grc': # Ancient Greek
+ 'grc-ibycus': 'ibycus', # Ibycus encoding
'gl': 'galician',
'he': 'hebrew',
'hr': 'croatian',
'hsb': 'uppersorbian',
'hu': 'magyar',
'ia': 'interlingua',
- 'id': 'bahasai', # Bahasa (Indonesian)
+ 'id': 'bahasai', # Bahasa (Indonesian)
'is': 'icelandic',
'it': 'italian',
'ja': 'japanese',
@@ -360,25 +360,25 @@ class Babel:
'la': 'latin',
'lt': 'lithuanian',
'lv': 'latvian',
- 'mn': 'mongolian', # Mongolian, Cyrillic script (mn-cyrl)
- 'ms': 'bahasam', # Bahasa (Malay)
- 'nb': 'norsk', # Norwegian Bokmal
+ 'mn': 'mongolian', # Mongolian, Cyrillic (mn-cyrl)
+ 'ms': 'bahasam', # Bahasa (Malay)
+ 'nb': 'norsk', # Norwegian Bokmal
'nl': 'dutch',
- 'nn': 'nynorsk', # Norwegian Nynorsk
- 'no': 'norsk', # Norwegian (Bokmal)
+ 'nn': 'nynorsk', # Norwegian Nynorsk
+ 'no': 'norsk', # Norwegian (Bokmal)
'pl': 'polish',
'pt': 'portuges',
'pt-BR': 'brazil',
'ro': 'romanian',
'ru': 'russian',
- 'se': 'samin', # North Sami
- 'sh-Cyrl': 'serbianc', # Serbo-Croatian, Cyrillic script
- 'sh-Latn': 'serbian', # Serbo-Croatian, Latin script see also 'hr'
+ 'se': 'samin', # North Sami
+ 'sh-Cyrl': 'serbianc', # Serbo-Croatian, Cyrillic
+ 'sh-Latn': 'serbian', # Serbo-Croatian, Latin (cf. 'hr')
'sk': 'slovak',
'sl': 'slovene',
'sq': 'albanian',
- 'sr': 'serbianc', # Serbian, Cyrillic script (contributed)
- 'sr-Latn': 'serbian', # Serbian, Latin script
+ 'sr': 'serbianc', # Serbian, Cyrillic (contributed)
+ 'sr-Latn': 'serbian', # Serbian, Latin script
'sv': 'swedish',
# 'th': 'thai',
'tr': 'turkish',
@@ -404,15 +404,16 @@ class Babel:
# ngerman, norsk, nynorsk, polish, portuges, russian, serbian, slovak,
# slovene, spanish, swedish, ukrainian, and uppersorbian --
# is escaped as ``\textquotedbl``.
- active_chars = {# TeX/Babel-name: active characters to deactivate
- # 'breton': ':;!?' # ensure whitespace
+ active_chars = {
+ # TeX/Babel-name: active characters to deactivate
+ # 'breton': ':;!?' # ensure whitespace
# 'esperanto': '^',
# 'estonian': '~"`',
- # 'french': ':;!?' # ensure whitespace
- 'galician': '.<>', # also '~"'
- # 'magyar': '`', # for special hyphenation cases
- 'spanish': '.<>', # old versions also '~'
- # 'turkish': ':!=' # ensure whitespace
+ # 'french': ':;!?' # ensure whitespace
+ 'galician': '.<>', # also '~"'
+ # 'magyar': '`', # for special hyphenation cases
+ 'spanish': '.<>', # old versions also '~'
+ # 'turkish': ':!=' # ensure whitespace
}
def __init__(self, language_code, reporter=None):
@@ -583,7 +584,7 @@ PreambleCmds.ttem = r"""
# Definitions from docutils.sty::
def _read_block(fp):
- block = [next(fp)] # first line (empty)
+ block = [next(fp)] # first line (empty)
for line in fp:
if not line.strip():
break
@@ -642,52 +643,52 @@ class CharMaps:
ord(']'): '{]}',
# the soft hyphen is unknown in 8-bit text
# and not properly handled by XeTeX
- 0x00AD: '\\-', # SOFT HYPHEN
+ 0x00AD: '\\-', # SOFT HYPHEN
}
# Unicode chars that are not recognized by LaTeX's utf8 encoding
unsupported_unicode = {
# TODO: ensure white space also at the beginning of a line?
# 0x00A0: '\\leavevmode\\nobreak\\vadjust{}~'
- 0x2000: '\\enskip', # EN QUAD
- 0x2001: '\\quad', # EM QUAD
- 0x2002: '\\enskip', # EN SPACE
- 0x2003: '\\quad', # EM SPACE
- 0x2008: '\\,', # PUNCTUATION SPACE   
- 0x200b: '\\hspace{0pt}', # ZERO WIDTH SPACE
- 0x202F: '\\,', # NARROW NO-BREAK SPACE
- # 0x02d8: '\\\u{ }', # BREVE
- 0x2011: '\\hbox{-}', # NON-BREAKING HYPHEN
- 0x212b: '\\AA', # ANGSTROM SIGN
- 0x21d4: '\\ensuremath{\\Leftrightarrow}', # LEFT RIGHT DOUBLE ARROW
- 0x2260: '\\ensuremath{\\neq}', # NOT EQUAL TO
- 0x2261: '\\ensuremath{\\equiv}', # IDENTICAL TO
- 0x2264: '\\ensuremath{\\le}', # LESS-THAN OR EQUAL TO
- 0x2265: '\\ensuremath{\\ge}', # GREATER-THAN OR EQUAL TO
+ 0x2000: '\\enskip', # EN QUAD
+ 0x2001: '\\quad', # EM QUAD
+ 0x2002: '\\enskip', # EN SPACE
+ 0x2003: '\\quad', # EM SPACE
+ 0x2008: '\\,', # PUNCTUATION SPACE   
+ 0x200b: '\\hspace{0pt}', # ZERO WIDTH SPACE
+ 0x202F: '\\,', # NARROW NO-BREAK SPACE
+ # 0x02d8: '\\\u{ }', # BREVE
+ 0x2011: '\\hbox{-}', # NON-BREAKING HYPHEN
+ 0x212b: '\\AA', # ANGSTROM SIGN
+ 0x21d4: '\\ensuremath{\\Leftrightarrow}', # LEFT RIGHT DOUBLE ARROW
+ 0x2260: '\\ensuremath{\\neq}', # NOT EQUAL TO
+ 0x2261: '\\ensuremath{\\equiv}', # IDENTICAL TO
+ 0x2264: '\\ensuremath{\\le}', # LESS-THAN OR EQUAL TO
+ 0x2265: '\\ensuremath{\\ge}', # GREATER-THAN OR EQUAL TO
# Docutils footnote symbols:
0x2660: '\\ensuremath{\\spadesuit}',
0x2663: '\\ensuremath{\\clubsuit}',
- 0xfb00: 'ff', # LATIN SMALL LIGATURE FF
- 0xfb01: 'fi', # LATIN SMALL LIGATURE FI
- 0xfb02: 'fl', # LATIN SMALL LIGATURE FL
- 0xfb03: 'ffi', # LATIN SMALL LIGATURE FFI
- 0xfb04: 'ffl', # LATIN SMALL LIGATURE FFL
+ 0xfb00: 'ff', # LATIN SMALL LIGATURE FF
+ 0xfb01: 'fi', # LATIN SMALL LIGATURE FI
+ 0xfb02: 'fl', # LATIN SMALL LIGATURE FL
+ 0xfb03: 'ffi', # LATIN SMALL LIGATURE FFI
+ 0xfb04: 'ffl', # LATIN SMALL LIGATURE FFL
}
# Unicode chars that are recognized by LaTeX's utf8 encoding
utf8_supported_unicode = {
- 0x00A0: '~', # NO-BREAK SPACE
- 0x00AB: '\\guillemotleft{}', # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
- 0x00bb: '\\guillemotright{}', # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
- 0x200C: '\\textcompwordmark{}', # ZERO WIDTH NON-JOINER
+ 0x00A0: '~', # NO-BREAK SPACE
+ 0x00AB: '\\guillemotleft{}', # LEFT-POINTING DOUBLE ANGLE QUOTATION
+ 0x00bb: '\\guillemotright{}', # RIGHT-POINTING DOUBLE ANGLE QUOTATION
+ 0x200C: '\\textcompwordmark{}', # ZERO WIDTH NON-JOINER
0x2013: '\\textendash{}',
0x2014: '\\textemdash{}',
0x2018: '\\textquoteleft{}',
0x2019: '\\textquoteright{}',
- 0x201A: '\\quotesinglbase{}', # SINGLE LOW-9 QUOTATION MARK
+ 0x201A: '\\quotesinglbase{}', # SINGLE LOW-9 QUOTATION MARK
0x201C: '\\textquotedblleft{}',
0x201D: '\\textquotedblright{}',
- 0x201E: '\\quotedblbase{}', # DOUBLE LOW-9 QUOTATION MARK
+ 0x201E: '\\quotedblbase{}', # DOUBLE LOW-9 QUOTATION MARK
0x2030: '\\textperthousand{}', # PER MILLE SIGN
- 0x2031: '\\textpertenthousand{}', # PER TEN THOUSAND SIGN
+ 0x2031: '\\textpertenthousand{}', # PER TEN THOUSAND SIGN
0x2039: '\\guilsinglleft{}',
0x203A: '\\guilsinglright{}',
0x2423: '\\textvisiblespace{}', # OPEN BOX
@@ -699,87 +700,87 @@ class CharMaps:
# recognized with 'utf8', if textcomp is loaded
textcomp = {
# Latin-1 Supplement
- 0x00a2: '\\textcent{}', # ¢ CENT SIGN
- 0x00a4: '\\textcurrency{}', # ¤ CURRENCY SYMBOL
- 0x00a5: '\\textyen{}', # ¥ YEN SIGN
- 0x00a6: '\\textbrokenbar{}', # ¦ BROKEN BAR
- 0x00a7: '\\textsection{}', # § SECTION SIGN
- 0x00a8: '\\textasciidieresis{}', # ¨ DIAERESIS
- 0x00a9: '\\textcopyright{}', # © COPYRIGHT SIGN
- 0x00aa: '\\textordfeminine{}', # ª FEMININE ORDINAL INDICATOR
- 0x00ac: '\\textlnot{}', # ¬ NOT SIGN
- 0x00ae: '\\textregistered{}', # ® REGISTERED SIGN
- 0x00af: '\\textasciimacron{}', # ¯ MACRON
- 0x00b0: '\\textdegree{}', # ° DEGREE SIGN
- 0x00b1: '\\textpm{}', # ± PLUS-MINUS SIGN
- 0x00b2: '\\texttwosuperior{}', # ² SUPERSCRIPT TWO
- 0x00b3: '\\textthreesuperior{}', # ³ SUPERSCRIPT THREE
- 0x00b4: '\\textasciiacute{}', # ´ ACUTE ACCENT
- 0x00b5: '\\textmu{}', # µ MICRO SIGN
- 0x00b6: '\\textparagraph{}', # ¶ PILCROW SIGN # != \textpilcrow
- 0x00b9: '\\textonesuperior{}', # ¹ SUPERSCRIPT ONE
- 0x00ba: '\\textordmasculine{}', # º MASCULINE ORDINAL INDICATOR
- 0x00bc: '\\textonequarter{}', # 1/4 FRACTION
- 0x00bd: '\\textonehalf{}', # 1/2 FRACTION
- 0x00be: '\\textthreequarters{}', # 3/4 FRACTION
- 0x00d7: '\\texttimes{}', # × MULTIPLICATION SIGN
- 0x00f7: '\\textdiv{}', # ÷ DIVISION SIGN
+ 0x00a2: '\\textcent{}', # ¢ CENT SIGN
+ 0x00a4: '\\textcurrency{}', # ¤ CURRENCY SYMBOL
+ 0x00a5: '\\textyen{}', # ¥ YEN SIGN
+ 0x00a6: '\\textbrokenbar{}', # ¦ BROKEN BAR
+ 0x00a7: '\\textsection{}', # § SECTION SIGN
+ 0x00a8: '\\textasciidieresis{}', # ¨ DIAERESIS
+ 0x00a9: '\\textcopyright{}', # © COPYRIGHT SIGN
+ 0x00aa: '\\textordfeminine{}', # ª FEMININE ORDINAL INDICATOR
+ 0x00ac: '\\textlnot{}', # ¬ NOT SIGN
+ 0x00ae: '\\textregistered{}', # ® REGISTERED SIGN
+ 0x00af: '\\textasciimacron{}', # ¯ MACRON
+ 0x00b0: '\\textdegree{}', # ° DEGREE SIGN
+ 0x00b1: '\\textpm{}', # ± PLUS-MINUS SIGN
+ 0x00b2: '\\texttwosuperior{}', # ² SUPERSCRIPT TWO
+ 0x00b3: '\\textthreesuperior{}', # ³ SUPERSCRIPT THREE
+ 0x00b4: '\\textasciiacute{}', # ´ ACUTE ACCENT
+ 0x00b5: '\\textmu{}', # µ MICRO SIGN
+ 0x00b6: '\\textparagraph{}', # ¶ PILCROW SIGN # != \textpilcrow
+ 0x00b9: '\\textonesuperior{}', # ¹ SUPERSCRIPT ONE
+ 0x00ba: '\\textordmasculine{}', # º MASCULINE ORDINAL INDICATOR
+ 0x00bc: '\\textonequarter{}', # 1/4 FRACTION
+ 0x00bd: '\\textonehalf{}', # 1/2 FRACTION
+ 0x00be: '\\textthreequarters{}', # 3/4 FRACTION
+ 0x00d7: '\\texttimes{}', # × MULTIPLICATION SIGN
+ 0x00f7: '\\textdiv{}', # ÷ DIVISION SIGN
# others
- 0x0192: '\\textflorin{}', # LATIN SMALL LETTER F WITH HOOK
- 0x02b9: '\\textasciiacute{}', # MODIFIER LETTER PRIME
- 0x02ba: '\\textacutedbl{}', # MODIFIER LETTER DOUBLE PRIME
- 0x2016: '\\textbardbl{}', # DOUBLE VERTICAL LINE
- 0x2022: '\\textbullet{}', # BULLET
- 0x2032: '\\textasciiacute{}', # PRIME
- 0x2033: '\\textacutedbl{}', # DOUBLE PRIME
- 0x2035: '\\textasciigrave{}', # REVERSED PRIME
- 0x2036: '\\textgravedbl{}', # REVERSED DOUBLE PRIME
- 0x203b: '\\textreferencemark{}', # REFERENCE MARK
- 0x203d: '\\textinterrobang{}', # INTERROBANG
- 0x2044: '\\textfractionsolidus{}', # FRACTION SLASH
- 0x2045: '\\textlquill{}', # LEFT SQUARE BRACKET WITH QUILL
- 0x2046: '\\textrquill{}', # RIGHT SQUARE BRACKET WITH QUILL
- 0x2052: '\\textdiscount{}', # COMMERCIAL MINUS SIGN
- 0x20a1: '\\textcolonmonetary{}', # COLON SIGN
- 0x20a3: '\\textfrenchfranc{}', # FRENCH FRANC SIGN
- 0x20a4: '\\textlira{}', # LIRA SIGN
- 0x20a6: '\\textnaira{}', # NAIRA SIGN
- 0x20a9: '\\textwon{}', # WON SIGN
- 0x20ab: '\\textdong{}', # DONG SIGN
- 0x20ac: '\\texteuro{}', # EURO SIGN
- 0x20b1: '\\textpeso{}', # PESO SIGN
- 0x20b2: '\\textguarani{}', # GUARANI SIGN
- 0x2103: '\\textcelsius{}', # DEGREE CELSIUS
- 0x2116: '\\textnumero{}', # NUMERO SIGN
- 0x2117: '\\textcircledP{}', # SOUND RECORDING COPYRIGHT
- 0x211e: '\\textrecipe{}', # PRESCRIPTION TAKE
- 0x2120: '\\textservicemark{}', # SERVICE MARK
- 0x2122: '\\texttrademark{}', # TRADE MARK SIGN
- 0x2126: '\\textohm{}', # OHM SIGN
- 0x2127: '\\textmho{}', # INVERTED OHM SIGN
- 0x212e: '\\textestimated{}', # ESTIMATED SYMBOL
- 0x2190: '\\textleftarrow{}', # LEFTWARDS ARROW
- 0x2191: '\\textuparrow{}', # UPWARDS ARROW
- 0x2192: '\\textrightarrow{}', # RIGHTWARDS ARROW
- 0x2193: '\\textdownarrow{}', # DOWNWARDS ARROW
- 0x2212: '\\textminus{}', # MINUS SIGN
- 0x2217: '\\textasteriskcentered{}', # ASTERISK OPERATOR
- 0x221a: '\\textsurd{}', # SQUARE ROOT
- 0x2422: '\\textblank{}', # BLANK SYMBOL
- 0x25e6: '\\textopenbullet{}', # WHITE BULLET
- 0x25ef: '\\textbigcircle{}', # LARGE CIRCLE
- 0x266a: '\\textmusicalnote{}', # EIGHTH NOTE
- 0x26ad: '\\textmarried{}', # MARRIAGE SYMBOL
- 0x26ae: '\\textdivorced{}', # DIVORCE SYMBOL
- 0x27e8: '\\textlangle{}', # MATHEMATICAL LEFT ANGLE BRACKET
- 0x27e9: '\\textrangle{}', # MATHEMATICAL RIGHT ANGLE BRACKET
+ 0x0192: '\\textflorin{}', # LATIN SMALL LETTER F WITH HOOK
+ 0x02b9: '\\textasciiacute{}', # MODIFIER LETTER PRIME
+ 0x02ba: '\\textacutedbl{}', # MODIFIER LETTER DOUBLE PRIME
+ 0x2016: '\\textbardbl{}', # DOUBLE VERTICAL LINE
+ 0x2022: '\\textbullet{}', # BULLET
+ 0x2032: '\\textasciiacute{}', # PRIME
+ 0x2033: '\\textacutedbl{}', # DOUBLE PRIME
+ 0x2035: '\\textasciigrave{}', # REVERSED PRIME
+ 0x2036: '\\textgravedbl{}', # REVERSED DOUBLE PRIME
+ 0x203b: '\\textreferencemark{}', # REFERENCE MARK
+ 0x203d: '\\textinterrobang{}', # INTERROBANG
+ 0x2044: '\\textfractionsolidus{}', # FRACTION SLASH
+ 0x2045: '\\textlquill{}', # LEFT SQUARE BRACKET WITH QUILL
+ 0x2046: '\\textrquill{}', # RIGHT SQUARE BRACKET WITH QUILL
+ 0x2052: '\\textdiscount{}', # COMMERCIAL MINUS SIGN
+ 0x20a1: '\\textcolonmonetary{}', # COLON SIGN
+ 0x20a3: '\\textfrenchfranc{}', # FRENCH FRANC SIGN
+ 0x20a4: '\\textlira{}', # LIRA SIGN
+ 0x20a6: '\\textnaira{}', # NAIRA SIGN
+ 0x20a9: '\\textwon{}', # WON SIGN
+ 0x20ab: '\\textdong{}', # DONG SIGN
+ 0x20ac: '\\texteuro{}', # EURO SIGN
+ 0x20b1: '\\textpeso{}', # PESO SIGN
+ 0x20b2: '\\textguarani{}', # GUARANI SIGN
+ 0x2103: '\\textcelsius{}', # DEGREE CELSIUS
+ 0x2116: '\\textnumero{}', # NUMERO SIGN
+ 0x2117: '\\textcircledP{}', # SOUND RECORDING COPYRIGHT
+ 0x211e: '\\textrecipe{}', # PRESCRIPTION TAKE
+ 0x2120: '\\textservicemark{}', # SERVICE MARK
+ 0x2122: '\\texttrademark{}', # TRADE MARK SIGN
+ 0x2126: '\\textohm{}', # OHM SIGN
+ 0x2127: '\\textmho{}', # INVERTED OHM SIGN
+ 0x212e: '\\textestimated{}', # ESTIMATED SYMBOL
+ 0x2190: '\\textleftarrow{}', # LEFTWARDS ARROW
+ 0x2191: '\\textuparrow{}', # UPWARDS ARROW
+ 0x2192: '\\textrightarrow{}', # RIGHTWARDS ARROW
+ 0x2193: '\\textdownarrow{}', # DOWNWARDS ARROW
+ 0x2212: '\\textminus{}', # MINUS SIGN
+ 0x2217: '\\textasteriskcentered{}', # ASTERISK OPERATOR
+ 0x221a: '\\textsurd{}', # SQUARE ROOT
+ 0x2422: '\\textblank{}', # BLANK SYMBOL
+ 0x25e6: '\\textopenbullet{}', # WHITE BULLET
+ 0x25ef: '\\textbigcircle{}', # LARGE CIRCLE
+ 0x266a: '\\textmusicalnote{}', # EIGHTH NOTE
+ 0x26ad: '\\textmarried{}', # MARRIAGE SYMBOL
+ 0x26ae: '\\textdivorced{}', # DIVORCE SYMBOL
+ 0x27e8: '\\textlangle{}', # MATHEMATICAL LEFT ANGLE BRACKET
+ 0x27e9: '\\textrangle{}', # MATHEMATICAL RIGHT ANGLE BRACKET
}
# Unicode chars that require a feature/package to render
pifont = {
- 0x2665: '\\ding{170}', # black heartsuit
- 0x2666: '\\ding{169}', # black diamondsuit
- 0x2713: '\\ding{51}', # check mark
- 0x2717: '\\ding{55}', # check mark
+ 0x2665: '\\ding{170}', # black heartsuit
+ 0x2666: '\\ding{169}', # black diamondsuit
+ 0x2713: '\\ding{51}', # check mark
+ 0x2717: '\\ding{55}', # check mark
}
# TODO: greek alphabet ... ?
# see also LaTeX codec
@@ -820,7 +821,7 @@ class DocumentClass:
"sectnum" directive, return the corresponding value for the
LaTeX ``tocdepth`` or ``secnumdepth`` counters.
"""
- depth = min(depth, len(self.sections)) # limit to supported levels
+ depth = min(depth, len(self.sections)) # limit to supported levels
if 'chapter' in self.sections:
depth -= 1
if self.sections[0] == 'part':
@@ -855,7 +856,7 @@ class Table:
self._col_specs = []
self.caption = []
self._attrs = {}
- self._in_head = False # maybe context with search
+ self._in_head = False # maybe context with search
def close(self):
self._open = False
@@ -952,8 +953,8 @@ class Table:
latex_colspecs = ['l'] * len(self._col_specs)
elif self.legacy_column_widths:
# use old algorithm for backwards compatibility
- width = 80 # assumed standard line length
- factor = 0.93 # do not make it full linewidth
+ width = 80 # assumed standard line length
+ factor = 0.93 # do not make it full linewidth
# first see if we get too wide.
total_width = sum(node['colwidth']+1 for node in self._col_specs)
if total_width > width:
@@ -975,7 +976,7 @@ class Table:
if 'colwidths-given' not in node.parent.parent['classes']:
allowance = 1
else:
- allowance = 0 # "widths" option specified, use exact ratio
+ allowance = 0 # "widths" option specified, use exact ratio
self._colwidths = [(node['colwidth']+allowance)/norm_length
for node in self._col_specs]
total_width = sum(self._colwidths)
@@ -1140,17 +1141,17 @@ class LaTeXTranslator(nodes.NodeVisitor):
# Auxiliary variables
# -------------------
- has_latex_toc = False # is there a toc in the doc? (needed by minitoc)
+ has_latex_toc = False # is there a toc in the doc? (needed by minitoc)
section_level = 0
# Flags to encode():
# inside citation reference labels underscores dont need to be escaped
inside_citation_reference_label = False
- verbatim = False # do not encode
- insert_non_breaking_blanks = False # replace blanks by "~"
- insert_newline = False # add latex newline commands
- literal = False # literal text (block or inline)
- alltt = False # inside `alltt` environment
+ verbatim = False # do not encode
+ insert_non_breaking_blanks = False # replace blanks by "~"
+ insert_newline = False # add latex newline commands
+ literal = False # literal text (block or inline)
+ alltt = False # inside `alltt` environment
def __init__(self, document, babel_class=Babel):
super().__init__(document)
@@ -1236,16 +1237,16 @@ class LaTeXTranslator(nodes.NodeVisitor):
self.head_prefix = [r'\documentclass[%s]{%s}' %
(self.documentoptions,
self.settings.documentclass)]
- self.requirements = SortableDict() # made a list in depart_document()
+ self.requirements = SortableDict() # made a list in depart_document()
self.requirements['__static'] = r'\usepackage{ifthen}'
self.latex_preamble = [settings.latex_preamble]
- self.fallbacks = SortableDict() # made a list in depart_document()
- self.pdfsetup = [] # PDF properties (hyperref package)
+ self.fallbacks = SortableDict() # made a list in depart_document()
+ self.pdfsetup = [] # PDF properties (hyperref package)
self.title = []
self.subtitle = []
- self.titledata = [] # \title, \author, \date
+ self.titledata = [] # \title, \author, \date
## self.body_prefix = ['\\begin{document}\n']
- self.body_pre_docinfo = [] # \maketitle
+ self.body_pre_docinfo = [] # \maketitle
self.docinfo = []
self.dedication = []
self.abstract = []
@@ -1355,9 +1356,9 @@ class LaTeXTranslator(nodes.NodeVisitor):
# (or use documentclass-default (as currently))?
# Section numbering
- if settings.sectnum_xform: # section numbering by Docutils
+ if settings.sectnum_xform: # section numbering by Docutils
PreambleCmds.secnumdepth = r'\setcounter{secnumdepth}{0}'
- else: # section numbering by LaTeX:
+ else: # section numbering by LaTeX:
secnumdepth = settings.sectnum_depth
# Possible values of settings.sectnum_depth:
# None "sectnum" directive without depth arg -> LaTeX default
@@ -1395,7 +1396,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
# Embed content of style file:
if self.settings.embed_stylesheet:
if is_package:
- path = base + '.sty' # ensure extension
+ path = base + '.sty' # ensure extension
try:
content = docutils.io.FileInput(source_path=path,
encoding='utf-8').read()
@@ -1412,7 +1413,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
return '%% embedded stylesheet: %s\n%s' % (path, content)
# Link to style file:
if is_package:
- path = base # drop extension
+ path = base # drop extension
cmd = r'\usepackage{%s}'
else:
cmd = r'\input{%s}'
@@ -1527,7 +1528,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
text = text.translate(table)
# Break up input ligatures e.g. '--' to '-{}-'.
- if not self.is_xetex: # Not required with xetex/luatex
+ if not self.is_xetex: # Not required with xetex/luatex
separate_chars = '-'
# In monospace-font, we also separate ',,', '``' and "''" and some
# other characters which can't occur in non-literal text.
@@ -1667,7 +1668,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
if isinstance(child, (nodes.container, nodes.compound)):
return self.term_postfix(child)
if isinstance(child, nodes.image):
- return '\\leavevmode\n' # Images get an additional newline.
+ return '\\leavevmode\n' # Images get an additional newline.
if not isinstance(child, (nodes.paragraph, nodes.math_block)):
return '\\leavevmode'
return ''
@@ -2073,7 +2074,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
while self.active_table.get_rowspan(
self.active_table.get_entry_number()):
self.out.append(' & ')
- self.active_table.visit_entry() # increment cell count
+ self.active_table.visit_entry() # increment cell count
def visit_entry(self, node):
# cell separation
@@ -2131,11 +2132,11 @@ class LaTeXTranslator(nodes.NodeVisitor):
and node.astext()):
self.out.append("%")
- self.active_table.visit_entry() # increment cell count
+ self.active_table.visit_entry() # increment cell count
def depart_entry(self, node):
- self.out.append(self.context.pop()) # header / not header
- self.out.append(self.context.pop()) # multirow/column
+ self.out.append(self.context.pop()) # header / not header
+ self.out.append(self.context.pop()) # multirow/column
# insert extra "&"s, if following rows are spanned from above:
self.insert_additional_table_colum_delimiters()
@@ -2154,11 +2155,12 @@ class LaTeXTranslator(nodes.NodeVisitor):
'lowerroman': 'roman',
'upperroman': 'Roman'}
# default LaTeX enumeration labels:
- default_labels = [# (präfix, enumtype, suffix)
- ('', 'arabic', '.'), # 1.
- ('(', 'alph', ')'), # (a)
- ('', 'roman', '.'), # i.
- ('', 'Alph', '.')] # A.
+ default_labels = [
+ # (präfix, enumtype, suffix)
+ ('', 'arabic', '.'), # 1.
+ ('(', 'alph', ')'), # (a)
+ ('', 'roman', '.'), # i.
+ ('', 'Alph', '.')] # A.
prefix = ''
if self.compound_enumerators:
@@ -2275,7 +2277,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
try:
backref = node['backrefs'][0]
except IndexError:
- backref = node['ids'][0] # no backref, use self-ref instead
+ backref = node['ids'][0] # no backref, use self-ref instead
if self.docutils_footnotes:
if not self.fallback_stylesheet:
self.fallbacks['footnotes'] = PreambleCmds.footnotes
@@ -2444,7 +2446,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
def depart_image(self, node):
self.out += self.ids_to_labels(node, newline=True)
- def visit_inline(self, node): # <span>, i.e. custom roles
+ def visit_inline(self, node): # <span>, i.e. custom roles
for cls in node['classes']:
if cls.startswith('language-'):
language = self.babel.language_name(cls[9:])
@@ -2662,14 +2664,14 @@ class LaTeXTranslator(nodes.NodeVisitor):
raise nodes.SkipNode
def depart_math(self, node):
- pass # never reached
+ pass # never reached
def visit_math_block(self, node):
math_env = pick_math_environment(node.astext())
self.visit_math(node, math_env=math_env)
def depart_math_block(self, node):
- pass # never reached
+ pass # never reached
def visit_option(self, node):
if self.context[-1]:
@@ -2693,7 +2695,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
self.context.append(0)
def depart_option_group(self, node):
- self.context.pop() # the flag
+ self.context.pop() # the flag
self.out.append('] ')
def visit_option_list(self, node):
@@ -2743,7 +2745,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
(nodes.paragraph, nodes.compound))):
pass
elif self.active_table.colwidths_auto:
- if index == 1: # second paragraph
+ if index == 1: # second paragraph
self.warn('LaTeX merges paragraphs in tables '
'with auto-sized columns!', base_node=node)
if index > 0:
@@ -2873,7 +2875,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
self.out.append('}\n')
self.duclass_close(node)
- attribution_formats = {'dash': ('—', ''), # EM DASH
+ attribution_formats = {'dash': ('—', ''), # EM DASH
'parentheses': ('(', ')'),
'parens': ('(', ')'),
'none': ('', '')}
@@ -3010,9 +3012,9 @@ class LaTeXTranslator(nodes.NodeVisitor):
def visit_target(self, node):
# Skip indirect targets:
- if ('refuri' in node # external hyperlink
- or 'refid' in node # resolved internal link
- or 'refname' in node): # unresolved internal link
+ if ('refuri' in node # external hyperlink
+ or 'refid' in node # resolved internal link
+ or 'refname' in node): # unresolved internal link
## self.out.append('%% %s\n' % node) # for debugging
return
self.out.append('%\n')
@@ -3169,8 +3171,8 @@ class LaTeXTranslator(nodes.NodeVisitor):
raise nodes.SkipNode
# labels and PDF bookmark (sidebar entry)
- self.out.append('\n') # start new paragraph
- if node['names']: # don't add labels just for auto-ids
+ self.out.append('\n') # start new paragraph
+ if node['names']: # don't add labels just for auto-ids
self.out += self.ids_to_labels(node, newline=True)
if (isinstance(node.next_node(), nodes.title)
and 'local' not in node['classes']
@@ -3232,7 +3234,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
self.push_output_collector(self.abstract)
self.out.append('\\begin{abstract}')
if isinstance(node.next_node(), nodes.title):
- node.pop(0) # LaTeX provides its own title
+ node.pop(0) # LaTeX provides its own title
else:
# special topics:
if 'abstract' in node['classes']:
diff --git a/docutils/docutils/writers/manpage.py b/docutils/docutils/writers/manpage.py
index 7f0ddc4f4..4513940dc 100644
--- a/docutils/docutils/writers/manpage.py
+++ b/docutils/docutils/writers/manpage.py
@@ -211,7 +211,7 @@ class Translator(nodes.NodeVisitor):
# Hopefully ``C`` courier too.
self.defs = {
'indent': ('.INDENT %.1f\n', '.UNINDENT\n'),
- 'definition_list_item': ('.TP', ''), # paragraph with hanging tag
+ 'definition_list_item': ('.TP', ''), # paragraph with hanging tag
'field_name': ('.TP\n.B ', '\n'),
'literal': ('\\fB', '\\fP'),
'literal_block': ('.sp\n.nf\n.ft C\n', '\n.ft P\n.fi\n'),
@@ -893,9 +893,9 @@ class Translator(nodes.NodeVisitor):
# options with parameter bold italic, .BI, -f file
#
# we do not know if .B or .BI
- self.context.append('.B ') # blind guess. Add blank for sphinx see docutils/bugs/380
- self.context.append(len(self.body)) # to be able to insert later
- self.context.append(0) # option counter
+ self.context.append('.B ') # blind guess. Add blank for sphinx see docutils/bugs/380
+ self.context.append(len(self.body)) # to be able to insert later
+ self.context.append(0) # option counter
def depart_option_group(self, node):
self.context.pop() # the counter
@@ -926,7 +926,7 @@ class Translator(nodes.NodeVisitor):
pass
def visit_option_argument(self, node):
- self.context[-3] = '.BI' # bold/italic alternate
+ self.context[-3] = '.BI' # bold/italic alternate
if node['delimiter'] != ' ':
self.body.append('\\fB%s ' % node['delimiter'])
elif self.body[len(self.body)-1].endswith('='):
@@ -946,7 +946,7 @@ class Translator(nodes.NodeVisitor):
pass
def first_child(self, node):
- first = isinstance(node.parent[0], nodes.label) # skip label
+ first = isinstance(node.parent[0], nodes.label) # skip label
for child in node.parent.children[first:]:
if isinstance(child, nodes.Invisible):
continue
diff --git a/docutils/docutils/writers/odf_odt/__init__.py b/docutils/docutils/writers/odf_odt/__init__.py
index 7b3eb030c..1e0520e56 100644
--- a/docutils/docutils/writers/odf_odt/__init__.py
+++ b/docutils/docutils/writers/odf_odt/__init__.py
@@ -32,7 +32,7 @@ import zipfile
import docutils
from docutils import frontend, nodes, utils, writers, languages
-from docutils.parsers.rst.directives.images import PIL # optional
+from docutils.parsers.rst.directives.images import PIL # optional
from docutils.readers import standalone
from docutils.transforms import references
@@ -774,7 +774,7 @@ class Writer(writers.Writer):
elif prop == 'subject':
el1 = SubElement(root, 'dc:subject', nsdict=METNSD)
el1.text = value
- else: # Store remaining properties as custom/user-defined
+ else: # Store remaining properties as custom/user-defined
el1 = SubElement(root, 'meta:user-defined',
attrib={'meta:name': prop}, nsdict=METNSD)
el1.text = value
diff --git a/docutils/docutils/writers/s5_html/__init__.py b/docutils/docutils/writers/s5_html/__init__.py
index a93cc88c5..24eded815 100644
--- a/docutils/docutils/writers/s5_html/__init__.py
+++ b/docutils/docutils/writers/s5_html/__init__.py
@@ -222,8 +222,8 @@ class S5HTMLTranslator(html4css1.HTMLTranslator):
line = line.strip()
if line and not line.startswith('#'):
path = find_theme(line)
- if path in theme_paths: # check for duplicates (cycles)
- path = None # if found, use default base
+ if path in theme_paths: # check for duplicates (cycles)
+ path = None # if found, use default base
else:
theme_paths.append(path)
break
diff --git a/docutils/docutils/writers/xetex/__init__.py b/docutils/docutils/writers/xetex/__init__.py
index 4dadbc762..3dcb23b94 100644
--- a/docutils/docutils/writers/xetex/__init__.py
+++ b/docutils/docutils/writers/xetex/__init__.py
@@ -63,7 +63,7 @@ class Writer(latex2e.Writer):
def __init__(self):
latex2e.Writer.__init__(self)
- self.settings_defaults.update({'fontencoding': ''}) # use default (TU)
+ self.settings_defaults.update({'fontencoding': ''}) # use default (TU)
self.translator_class = XeLaTeXTranslator
@@ -75,23 +75,23 @@ class Babel(latex2e.Babel):
language_codes = latex2e.Babel.language_codes.copy()
# Additionally supported or differently named languages:
language_codes.update({
- # code Polyglossia-name comment
- 'cop': 'coptic',
- 'de': 'german', # new spelling (de_1996)
- 'de-1901': 'ogerman', # old spelling
- 'dv': 'divehi', # Maldivian
- 'dsb': 'lsorbian',
- 'el-polyton': 'polygreek',
- 'fa': 'farsi',
- 'grc': 'ancientgreek',
- 'hsb': 'usorbian',
- 'sh-Cyrl': 'serbian', # Serbo-Croatian, Cyrillic script
- 'sh-Latn': 'croatian', # Serbo-Croatian, Latin script
- 'sq': 'albanian',
- 'sr': 'serbian', # Cyrillic script (sr-Cyrl)
- 'th': 'thai',
- 'vi': 'vietnamese',
- # zh-Latn: ??? # Chinese Pinyin
+ # code Polyglossia-name comment
+ 'cop': 'coptic',
+ 'de': 'german', # new spelling (de_1996)
+ 'de-1901': 'ogerman', # old spelling
+ 'dv': 'divehi', # Maldivian
+ 'dsb': 'lsorbian',
+ 'el-polyton': 'polygreek',
+ 'fa': 'farsi',
+ 'grc': 'ancientgreek',
+ 'hsb': 'usorbian',
+ 'sh-Cyrl': 'serbian', # Serbo-Croatian, Cyrillic script
+ 'sh-Latn': 'croatian', # Serbo-Croatian, Latin script
+ 'sq': 'albanian',
+ 'sr': 'serbian', # Cyrillic script (sr-Cyrl)
+ 'th': 'thai',
+ 'vi': 'vietnamese',
+ # zh-Latn: ??? # Chinese Pinyin
})
# normalize (downcase) keys
language_codes = {k.lower(): v for k, v in language_codes.items()}
@@ -121,7 +121,7 @@ class Babel(latex2e.Babel):
self.quotes = ('"', '"')
# language dependent configuration:
# double quotes are "active" in some languages (e.g. German).
- self.literal_double_quote = '"' # TODO: use \textquotedbl ?
+ self.literal_double_quote = '"' # TODO: use \textquotedbl ?
def __call__(self):
setup = [r'\usepackage{polyglossia}',
diff --git a/docutils/test/DocutilsTestSupport.py b/docutils/test/DocutilsTestSupport.py
index 6a33207cd..404771cfe 100644
--- a/docutils/test/DocutilsTestSupport.py
+++ b/docutils/test/DocutilsTestSupport.py
@@ -142,7 +142,7 @@ class CustomTestCase(StandardTestCase):
Note: the modified signature is incompatible with
the "pytest" and "nose" frameworks.
- """ # cf. feature-request #81
+ """ # cf. feature-request #81
compare = difflib.Differ().compare
"""Comparison method shared by all subclasses."""
@@ -262,7 +262,7 @@ class CustomTestSuite(unittest.TestSuite):
if not mydir:
mydir = os.curdir
if callerpath.startswith(mydir):
- self.id = callerpath[len(mydir) + 1:] # caller's module
+ self.id = callerpath[len(mydir) + 1:] # caller's module
else:
self.id = callerpath
else:
@@ -662,7 +662,7 @@ class WriterPublishTestCase(CustomTestCase, docutils.SettingsSpec):
settings_default_overrides = {'_disable_config': True,
'strict_visitor': True}
- writer_name = '' # set in subclasses or constructor
+ writer_name = '' # set in subclasses or constructor
def __init__(self, *args, writer_name='', **kwargs):
if writer_name:
diff --git a/docutils/test/functional/tests/field_name_limit.py b/docutils/test/functional/tests/field_name_limit.py
index af66c4ddd..3a2611c5d 100644
--- a/docutils/test/functional/tests/field_name_limit.py
+++ b/docutils/test/functional/tests/field_name_limit.py
@@ -8,7 +8,7 @@ parser_name = "rst"
writer_name = "html"
# Settings
-settings_overrides['field_name_limit'] = 0 # no limit
+settings_overrides['field_name_limit'] = 0 # no limit
settings_overrides['docinfo_xform'] = False
# local copy of stylesheets:
# (Test runs in ``docutils/test/``, we need relative path from there.)
diff --git a/docutils/test/test_command_line.py b/docutils/test/test_command_line.py
index 296e4075e..7453eaf22 100644
--- a/docutils/test/test_command_line.py
+++ b/docutils/test/test_command_line.py
@@ -12,7 +12,7 @@ import locale
import sys
import unittest
-import DocutilsTestSupport # must be imported before docutils
+import DocutilsTestSupport # must be imported before docutils
import docutils.core
# determine/guess the encoding of the standard input:
@@ -31,16 +31,16 @@ except LookupError:
class CommandLineEncodingTests(unittest.TestCase):
def test_sys_argv_decoding(self):
- if argv_encoding == 'ascii': # cannot test
+ if argv_encoding == 'ascii': # cannot test
return
- sys.argv.append('--source-url=test.txt') # pure ASCII argument
+ sys.argv.append('--source-url=test.txt') # pure ASCII argument
sys.argv.append('--title=Dornröschen')
publisher = docutils.core.Publisher()
publisher.process_command_line()
self.assertEqual(publisher.settings.source_url, 'test.txt')
self.assertEqual(publisher.settings.title, 'Dornröschen')
- sys.argv.pop() # --title
- sys.argv.pop() # --source-url
+ sys.argv.pop() # --title
+ sys.argv.pop() # --source-url
if __name__ == '__main__':
diff --git a/docutils/test/test_functional.py b/docutils/test/test_functional.py
index 66f02c3b6..a6135da14 100755
--- a/docutils/test/test_functional.py
+++ b/docutils/test/test_functional.py
@@ -98,7 +98,7 @@ expected output and check it in:
Note: the modified signature is incompatible with
the "pytest" and "nose" frameworks.
- """ # cf. feature-request #81
+ """ # cf. feature-request #81
assert configfile is not None, 'required argument'
self.configfile = configfile
diff --git a/docutils/test/test_io.py b/docutils/test/test_io.py
index 8798b9d78..7efbe5717 100755
--- a/docutils/test/test_io.py
+++ b/docutils/test/test_io.py
@@ -66,8 +66,8 @@ class HelperTests(unittest.TestCase):
self.assertEqual(io.check_encoding(mock_stdout, 'UTF-9'), None)
def test_error_string(self):
- us = '\xfc' # bytes(us) fails
- bs = b'\xc3\xbc' # str(bs) returns repr(bs)
+ us = '\xfc' # bytes(us) fails
+ bs = b'\xc3\xbc' # str(bs) returns repr(bs)
self.assertEqual('Exception: spam',
io.error_string(Exception('spam')))
@@ -224,7 +224,7 @@ class ErrorOutputTests(unittest.TestCase):
self.assertEqual(e.destination, sys.stderr)
def test_bbuf(self):
- buf = BBuf() # buffer storing byte string
+ buf = BBuf() # buffer storing byte string
e = io.ErrorOutput(buf, encoding='ascii')
# write byte-string as-is
e.write(b'b\xfc')
@@ -242,11 +242,12 @@ class ErrorOutputTests(unittest.TestCase):
self.assertEqual(buf.getvalue(), b'b\xfc u\\xfc e\\xfc u\xc3\xbc')
def test_ubuf(self):
- buf = UBuf() # buffer only accepting unicode string
+ buf = UBuf() # buffer only accepting unicode string
# decode of binary strings
e = io.ErrorOutput(buf, encoding='ascii')
e.write(b'b\xfc')
- self.assertEqual(buf.getvalue(), 'b\ufffd') # use REPLACEMENT CHARACTER
+ # use REPLACEMENT CHARACTER
+ self.assertEqual(buf.getvalue(), 'b\ufffd')
# write Unicode string and Exceptions with Unicode args
e.write(' u\xfc')
self.assertEqual(buf.getvalue(), 'b\ufffd u\xfc')
diff --git a/docutils/test/test_language.py b/docutils/test/test_language.py
index c3ca25f7d..4dbec4dfb 100755
--- a/docutils/test/test_language.py
+++ b/docutils/test/test_language.py
@@ -81,7 +81,7 @@ class LanguageTestCase(DocutilsTestSupport.CustomTestCase):
Note: the modified signature is incompatible with
the "pytest" and "nose" frameworks.
- """ # cf. feature-request #81
+ """ # cf. feature-request #81
self.ref = docutils.languages.get_language(reference_language,
_reporter)
diff --git a/docutils/test/test_nodes.py b/docutils/test/test_nodes.py
index d1c9e998f..3a8723d51 100755
--- a/docutils/test/test_nodes.py
+++ b/docutils/test/test_nodes.py
@@ -640,9 +640,9 @@ class SetIdTests(unittest.TestCase):
def setUp(self):
self.document = utils.new_document('test')
self.elements = [nodes.Element(names=['test']),
- nodes.section(), # Name empty
- nodes.section(names=['Test']), # duplicate id
- nodes.footnote(names=['2019-10-30']), # id empty
+ nodes.section(), # Name empty
+ nodes.section(names=['Test']), # duplicate id
+ nodes.footnote(names=['2019-10-30']), # id empty
]
def test_set_id_default(self):
diff --git a/docutils/test/test_parsers/test_recommonmark/test_misc.py b/docutils/test/test_parsers/test_recommonmark/test_misc.py
index 02e7ba490..ef7ee69fb 100644
--- a/docutils/test/test_parsers/test_recommonmark/test_misc.py
+++ b/docutils/test/test_parsers/test_recommonmark/test_misc.py
@@ -17,7 +17,7 @@ import unittest
if __name__ == '__main__':
import __init__
-from test_parsers import DocutilsTestSupport # must be imported before docutils
+from test_parsers import DocutilsTestSupport # must be imported before docutils
from docutils import core, utils, parsers
from docutils.core import publish_string
diff --git a/docutils/test/test_parsers/test_recommonmark/test_transitions.py b/docutils/test/test_parsers/test_recommonmark/test_transitions.py
index 394f3f72f..5d0e3a388 100755
--- a/docutils/test/test_parsers/test_recommonmark/test_transitions.py
+++ b/docutils/test/test_parsers/test_recommonmark/test_transitions.py
@@ -203,7 +203,7 @@ A paragraph and two transitions.
----------
----------
-""", # the same:
+""",
"""\
<document source="test data">
<paragraph>
diff --git a/docutils/test/test_parsers/test_rst/test_directives/test_admonitions_dummy_lang.py b/docutils/test/test_parsers/test_rst/test_directives/test_admonitions_dummy_lang.py
index 005c95a48..825d18f47 100644
--- a/docutils/test/test_parsers/test_rst/test_directives/test_admonitions_dummy_lang.py
+++ b/docutils/test/test_parsers/test_rst/test_directives/test_admonitions_dummy_lang.py
@@ -14,7 +14,7 @@ from test_parsers import DocutilsTestSupport
def suite():
settings = {'language_code': 'local-dummy-lang',
- 'report_level': 2} # warning (has no effect on test output is run as __main__).
+ 'report_level': 2} # TODO: ignored when run as __main__
s = DocutilsTestSupport.ParserTestSuite(suite_settings=settings)
s.generateTests(totest)
return s
diff --git a/docutils/test/test_parsers/test_rst/test_directives/test_code_parsing.py b/docutils/test/test_parsers/test_rst/test_directives/test_code_parsing.py
index 942ba56c4..7bb2ac922 100644
--- a/docutils/test/test_parsers/test_rst/test_directives/test_code_parsing.py
+++ b/docutils/test/test_parsers/test_rst/test_directives/test_code_parsing.py
@@ -17,7 +17,7 @@ import unittest
if __name__ == '__main__':
import __init__
-from test_parsers import DocutilsTestSupport # must be imported before docutils
+from test_parsers import DocutilsTestSupport # must be imported before docutils
from docutils import core, utils
from docutils.core import publish_string
from docutils.utils.code_analyzer import with_pygments
diff --git a/docutils/test/test_parsers/test_rst/test_source_line.py b/docutils/test/test_parsers/test_rst/test_source_line.py
index 4b6d95131..b1c0b8023 100644
--- a/docutils/test/test_parsers/test_rst/test_source_line.py
+++ b/docutils/test/test_parsers/test_rst/test_source_line.py
@@ -27,7 +27,7 @@ import os
if __name__ == '__main__':
import __init__
-from test_transforms import DocutilsTestSupport # before importing docutils!
+from test_transforms import DocutilsTestSupport # before importing docutils!
from docutils.transforms.universal import ExposeInternals
from docutils.parsers.rst import Parser
diff --git a/docutils/test/test_parsers/test_rst/test_tables.py b/docutils/test/test_parsers/test_rst/test_tables.py
index c4c3ffdb2..cbd6b3790 100755
--- a/docutils/test/test_parsers/test_rst/test_tables.py
+++ b/docutils/test/test_parsers/test_rst/test_tables.py
@@ -571,7 +571,7 @@ No blank line after table.
| (The first cell of this table may expand |
| to accommodate long filesystem paths.) |
+------------------------------------------------------------------------------+
-""") % ('\n'.join('| %-70s |' % include2[part * 70 : (part + 1) * 70] # noqa: E203
+""") % ('\n'.join('| %-70s |' % include2[part * 70 : (part + 1) * 70] # noqa: E203
for part in range(len(include2) // 70 + 1))),
"""\
<document source="test data">
@@ -606,7 +606,7 @@ Something before.
Something afterwards.
And more.
-""") % ('\n'.join('| %-70s |' % include2[part * 70 : (part + 1) * 70] # noqa: E203
+""") % ('\n'.join('| %-70s |' % include2[part * 70 : (part + 1) * 70] # noqa: E203
for part in range(len(include2) // 70 + 1))),
"""\
<document source="test data">
@@ -1274,7 +1274,7 @@ Inclusion .. include::
Note The first row of this table may expand
to accommodate long filesystem paths.
========= =====================================================================
-""" % ('\n'.join(' %-65s' % include2[part * 65 : (part + 1) * 65] # noqa: E203
+""" % ('\n'.join(' %-65s' % include2[part * 65 : (part + 1) * 65] # noqa: E203
for part in range(len(include2) // 65 + 1))),
"""\
<document source="test data">
diff --git a/docutils/test/test_parsers/test_rst/test_transitions.py b/docutils/test/test_parsers/test_rst/test_transitions.py
index ac95c7470..78a405fd4 100755
--- a/docutils/test/test_parsers/test_rst/test_transitions.py
+++ b/docutils/test/test_parsers/test_rst/test_transitions.py
@@ -205,7 +205,7 @@ A paragraph and two transitions.
----------
----------
-""", # the same:
+""",
"""\
<document source="test data">
<paragraph>
diff --git a/docutils/test/test_publisher.py b/docutils/test/test_publisher.py
index c3fa0cc43..582d1bdb1 100755
--- a/docutils/test/test_publisher.py
+++ b/docutils/test/test_publisher.py
@@ -14,8 +14,6 @@ import DocutilsTestSupport # must be imported before docutils
import docutils
from docutils import core, nodes, io
-u_prefix = b''
-
test_document = """\
Test Document
@@ -38,11 +36,8 @@ pseudoxml_output = b"""\
<paragraph>
Unknown target name: "nonexistent".
"""
-exposed_pseudoxml_output = (
- b'<document ids="test-document" internal:refnames="{'
- + u_prefix
- + b"""\
-\'nonexistent\': [<reference: <#text: \'nonexistent\'>>]}" names="test\\ document" source="<string>" title="Test Document">
+exposed_pseudoxml_output = b"""\
+<document ids="test-document" internal:refnames="{'nonexistent': [<reference: <#text: 'nonexistent'>>]}" names="test\\ document" source="<string>" title="Test Document">
<title>
Test Document
<paragraph>
@@ -55,7 +50,7 @@ exposed_pseudoxml_output = (
<system_message backrefs="problematic-1" ids="system-message-1" level="3" line="4" source="<string>" type="ERROR">
<paragraph>
Unknown target name: "nonexistent".
-""") # % u_prefix # %-expansion not supported in bytes in 3.3 and 3.4
+"""
class PublisherTests(DocutilsTestSupport.StandardTestCase):
diff --git a/docutils/test/test_settings.py b/docutils/test/test_settings.py
index bd104ca38..0630eece8 100755
--- a/docutils/test/test_settings.py
+++ b/docutils/test/test_settings.py
@@ -223,7 +223,7 @@ class ConfigEnvVarFileTests(ConfigFileTests):
def tearDown(self):
os.environ = self.orig_environ
- def test_old(self): pass # don't repreat this test
+ def test_old(self): pass # don't repreat this test
@unittest.skipUnless(
os.name == 'posix',
@@ -350,7 +350,7 @@ class HelperFunctionsTests(unittest.TestCase):
reporter = utils.Reporter('test', 1, 4)
with self.assertWarnsRegex(DeprecationWarning,
'Set attributes via configuration settings'):
- reporter.set_conditions('foo', 1, 4) # trigger warning
+ reporter.set_conditions('foo', 1, 4) # trigger warning
if __name__ == '__main__':
unittest.main()
diff --git a/docutils/test/test_transforms/test___init__.py b/docutils/test/test_transforms/test___init__.py
index e216a1d33..ba07c0bbf 100755
--- a/docutils/test/test_transforms/test___init__.py
+++ b/docutils/test/test_transforms/test___init__.py
@@ -12,7 +12,7 @@ import unittest
if __name__ == '__main__':
import __init__
-from test_transforms import DocutilsTestSupport # before importing docutils!
+from test_transforms import DocutilsTestSupport # before importing docutils!
from docutils import transforms, utils
diff --git a/docutils/test/test_transforms/test_expose_internals.py b/docutils/test/test_transforms/test_expose_internals.py
index b4835efe9..079966d1a 100755
--- a/docutils/test/test_transforms/test_expose_internals.py
+++ b/docutils/test/test_transforms/test_expose_internals.py
@@ -10,7 +10,7 @@ Test module for universal.ExposeInternals transform.
if __name__ == '__main__':
import __init__
-from test_transforms import DocutilsTestSupport # before importing docutils!
+from test_transforms import DocutilsTestSupport # before importing docutils!
from docutils.transforms.universal import ExposeInternals
from docutils.parsers.rst import Parser
diff --git a/docutils/test/test_transforms/test_filter_messages.py b/docutils/test/test_transforms/test_filter_messages.py
index db1250d43..3ac3744fe 100644
--- a/docutils/test/test_transforms/test_filter_messages.py
+++ b/docutils/test/test_transforms/test_filter_messages.py
@@ -26,7 +26,7 @@ from docutils.parsers.rst import Parser
def suite():
parser = Parser()
- settings = {'report_level': 5} # filter all system messages
+ settings = {'report_level': 5} # filter all system messages
s = DocutilsTestSupport.TransformTestSuite(
parser, suite_settings=settings)
s.generateTests(totest)
diff --git a/docutils/test/test_transforms/test_smartquotes.py b/docutils/test/test_transforms/test_smartquotes.py
index 98477e341..cd40cbc63 100644
--- a/docutils/test/test_transforms/test_smartquotes.py
+++ b/docutils/test/test_transforms/test_smartquotes.py
@@ -26,7 +26,7 @@ def suite():
parser = Parser()
settings = {'smart_quotes': True,
'trim_footnote_ref_space': True,
- 'report': 2} # TODO: why is this ignored when running as main?
+ 'report': 2} # TODO why is this ignored when running as main?
s = DocutilsTestSupport.TransformTestSuite(
parser, suite_settings=settings)
s.generateTests(totest)
diff --git a/docutils/test/test_transforms/test_transitions.py b/docutils/test/test_transforms/test_transitions.py
index c098e9e8e..05a347f78 100755
--- a/docutils/test/test_transforms/test_transitions.py
+++ b/docutils/test/test_transforms/test_transitions.py
@@ -10,7 +10,7 @@ Test module for misc.Transitions transform.
if __name__ == '__main__':
import __init__
-from test_transforms import DocutilsTestSupport # before importing docutils!
+from test_transforms import DocutilsTestSupport # before importing docutils!
from docutils.transforms.misc import Transitions
from docutils.parsers.rst import Parser
@@ -174,7 +174,7 @@ A paragraph and two transitions.
----------
----------
-""", # the same:
+""",
"""\
<document source="test data">
<paragraph>
diff --git a/docutils/test/test_transforms/test_writer_aux.py b/docutils/test/test_transforms/test_writer_aux.py
index 2b8ba6e8c..f316c848f 100755
--- a/docutils/test/test_transforms/test_writer_aux.py
+++ b/docutils/test/test_transforms/test_writer_aux.py
@@ -10,7 +10,7 @@ Test module for writer_aux transforms.
if __name__ == '__main__':
import __init__
-from test_transforms import DocutilsTestSupport # before importing docutils!
+from test_transforms import DocutilsTestSupport # before importing docutils!
from docutils.transforms import writer_aux
from docutils.parsers.rst import Parser
diff --git a/docutils/test/test_utils.py b/docutils/test/test_utils.py
index 5e95818eb..0d08be310 100755
--- a/docutils/test/test_utils.py
+++ b/docutils/test/test_utils.py
@@ -268,8 +268,8 @@ class HelperFunctionTests(unittest.TestCase):
def test_column_width(self):
self.assertEqual(utils.column_width('de'), 2)
- self.assertEqual(utils.column_width('dâ'), 2) # pre-composed
- self.assertEqual(utils.column_width('dâ'), 2) # combining
+ self.assertEqual(utils.column_width('dâ'), 2) # pre-composed
+ self.assertEqual(utils.column_width('dâ'), 2) # combining
def test_decode_path(self):
try:
@@ -279,7 +279,7 @@ class HelperFunctionTests(unittest.TestCase):
bytespath = utils.decode_path(bytes_filename)
unipath = utils.decode_path('späm')
defaultpath = utils.decode_path(None)
- if bytes_filename != b'spam': # skip if ä cannot be encoded
+ if bytes_filename != b'spam': # skip if ä cannot be encoded
self.assertEqual(bytespath, 'späm')
self.assertEqual(unipath, 'späm')
self.assertEqual(defaultpath, '')
diff --git a/docutils/test/test_viewlist.py b/docutils/test/test_viewlist.py
index 3c70f3a7e..5b59a8829 100755
--- a/docutils/test/test_viewlist.py
+++ b/docutils/test/test_viewlist.py
@@ -37,7 +37,7 @@ class ViewListTests(unittest.TestCase):
self.assertEqual(self.b, self.b_list)
self.assertEqual(self.c, self.c_list)
self.assertEqual(len(self.a), len(self.a_list))
- self.assertTrue('d' in self.a) # __contains__
+ self.assertTrue('d' in self.a) # __contains__
self.assertEqual([value for value in self.a], self.a_list)
# get and set values
self.assertEqual(self.a[2], self.a_list[2])
diff --git a/docutils/test/test_writers/test_docutils_xml.py b/docutils/test/test_writers/test_docutils_xml.py
index 0ee39a020..15713fa9b 100755
--- a/docutils/test/test_writers/test_docutils_xml.py
+++ b/docutils/test/test_writers/test_docutils_xml.py
@@ -17,7 +17,7 @@ Test for docutils XML writer.
if __name__ == '__main__':
import __init__
-from test_writers import DocutilsTestSupport # before importing docutils!
+from test_writers import DocutilsTestSupport # before importing docutils!
import docutils
import docutils.core
@@ -194,7 +194,7 @@ class DocutilsXMLTestCase(DocutilsTestSupport.StandardTestCase):
'<string>:10: '
'(WARNING/2) Invalid raw XML in column 30, line offset 1:\n',
'<test>inline raw XML&lt;/test>\n'])
- settings['halt_level'] = 2 # convert info messages to exceptions
+ settings['halt_level'] = 2 # convert info messages to exceptions
settings['warning_stream'] = ''
with self.assertRaises(docutils.utils.SystemMessage):
publish_xml(settings, invalid_raw_xml_source)
diff --git a/docutils/test/test_writers/test_pseudoxml.py b/docutils/test/test_writers/test_pseudoxml.py
index 3cc14329c..99111f5b1 100755
--- a/docutils/test/test_writers/test_pseudoxml.py
+++ b/docutils/test/test_writers/test_pseudoxml.py
@@ -15,7 +15,7 @@ from test_writers import DocutilsTestSupport
def suite():
# Settings dictionary must not be empty for later changes to work.
- settings = {'expose_internals': []} # default
+ settings = {'expose_internals': []} # default
s = DocutilsTestSupport.PublishTestSuite('pseudoxml',
suite_settings=settings)
s.generateTests(totest)
diff --git a/docutils/tools/buildhtml.py b/docutils/tools/buildhtml.py
index 7fe83a424..a30daa180 100755
--- a/docutils/tools/buildhtml.py
+++ b/docutils/tools/buildhtml.py
@@ -82,7 +82,7 @@ class SettingsSpec(docutils.SettingsSpec):
'choices': ['html', 'html4', 'html5'],
# 'default': 'html' (set below)
}),
- (frontend.SUPPRESS_HELP, # Obsoleted by "--writer"
+ (frontend.SUPPRESS_HELP, # Obsoleted by "--writer"
['--html-writer'],
{'metavar': '<writer>',
'choices': ['html', 'html4', 'html5']}),
diff --git a/docutils/tools/dev/generate_punctuation_chars.py b/docutils/tools/dev/generate_punctuation_chars.py
index a73f37e41..9a2795ff4 100644
--- a/docutils/tools/dev/generate_punctuation_chars.py
+++ b/docutils/tools/dev/generate_punctuation_chars.py
@@ -134,12 +134,12 @@ def match_chars(c1, c2):
# ::
unicode_punctuation_categories = {
- # 'Pc': 'Connector', # not used in Docutils inline markup recognition
+ # 'Pc': 'Connector', # not used in Docutils inline markup recognition
'Pd': 'Dash',
'Ps': 'Open',
'Pe': 'Close',
- 'Pi': 'Initial quote', # may behave like Ps or Pe depending on usage
- 'Pf': 'Final quote', # may behave like Ps or Pe depending on usage
+ 'Pi': 'Initial quote', # may behave like Ps or Pe depending on usage
+ 'Pf': 'Final quote', # may behave like Ps or Pe depending on usage
'Po': 'Other'
}
"""Unicode character categories for punctuation"""
@@ -189,7 +189,7 @@ def character_category_patterns():
recognition rules`_.
"""
- cp_min = 160 # ASCII chars have special rules for backwards compatibility
+ cp_min = 160 # ASCII chars have special rules for backwards compatibility
ucharlists = unicode_charlists(unicode_punctuation_categories, cp_min)
"""Strings of characters in Unicode punctuation character categories"""
@@ -200,12 +200,12 @@ def character_category_patterns():
# low quotation marks are also used as closers (e.g. in Greek)
# move them to category Pi:
- ucharlists['Ps'].remove('‚') # 201A SINGLE LOW-9 QUOTATION MARK
- ucharlists['Ps'].remove('„') # 201E DOUBLE LOW-9 QUOTATION MARK
+ ucharlists['Ps'].remove('‚') # 201A SINGLE LOW-9 QUOTATION MARK
+ ucharlists['Ps'].remove('„') # 201E DOUBLE LOW-9 QUOTATION MARK
ucharlists['Pi'] += ['‚', '„']
- ucharlists['Pi'].remove('‛') # 201B SINGLE HIGH-REVERSED-9 QUOTATION MARK
- ucharlists['Pi'].remove('‟') # 201F DOUBLE HIGH-REVERSED-9 QUOTATION MARK
+ ucharlists['Pi'].remove('‛') # 201B … HIGH-REVERSED-9 QUOTATION MARK
+ ucharlists['Pi'].remove('‟') # 201F … HIGH-REVERSED-9 QUOTATION MARK
ucharlists['Pf'] += ['‛', '‟']
# 301F LOW DOUBLE PRIME QUOTATION MARK misses the opening pendant:
diff --git a/docutils/tools/docutils-cli.py b/docutils/tools/docutils-cli.py
index da77334c5..15307f247 100755
--- a/docutils/tools/docutils-cli.py
+++ b/docutils/tools/docutils-cli.py
@@ -30,14 +30,14 @@ class CliSettingsSpec(docutils.SettingsSpec):
settings_spec = (
'Docutils CLI Options',
None,
- (# 'help text', [<option strings>], {<keyword arguments>}
- ('Reader name (default/current: "%default").',
+ # options: ('help text', [<option strings>], {<keyword arguments>})
+ (('Reader name (default/current: "%default").',
['--reader'], {'metavar': '<reader>'}),
('Parser name (default/current: "%default").',
['--parser'], {'metavar': '<parser>'}),
('Writer name (default/current: "%default").',
['--writer'], {'metavar': '<writer>'}),
- )
+ )
)
config_section = 'docutils-cli application'
config_section_dependencies = ('applications',)
diff --git a/docutils/tools/quicktest.py b/docutils/tools/quicktest.py
index 2c423f48e..a3335f318 100755
--- a/docutils/tools/quicktest.py
+++ b/docutils/tools/quicktest.py
@@ -102,9 +102,9 @@ def escape(text):
"""
Return `text` in triple-double-quoted Python string form.
"""
- text = text.replace('\\', '\\\\') # escape backslashes
- text = text.replace('"""', '""\\"') # break up triple-double-quotes
- text = text.replace(' \n', ' \\n\\\n') # protect trailing whitespace
+ text = text.replace('\\', '\\\\') # escape backslashes
+ text = text.replace('"""', '""\\"') # break up triple-double-quotes
+ text = text.replace(' \n', ' \\n\\\n') # protect trailing whitespace
return text
_outputFormatters = {
diff --git a/docutils/tools/rst2html5.py b/docutils/tools/rst2html5.py
index 744b5c751..f745205d5 100755
--- a/docutils/tools/rst2html5.py
+++ b/docutils/tools/rst2html5.py
@@ -19,7 +19,7 @@ The output is also valid XML.
"""
try:
- import locale # module missing in Jython
+ import locale # module missing in Jython
locale.setlocale(locale.LC_ALL, '')
except locale.Error:
pass
diff --git a/docutils/tox.ini b/docutils/tox.ini
index cc263a6b0..08b2e599f 100644
--- a/docutils/tox.ini
+++ b/docutils/tox.ini
@@ -38,7 +38,6 @@ ignore =
# whitespace around the operators with the lowest priority(ies).
# Use your own judgment; …"
- E261, # at least two spaces before inline comment
E262, # inline comment should start with '# '
E265, # block comment should start with '# '
E266, # too many leading '#' for block comment
@@ -77,18 +76,22 @@ per-file-ignores =
docutils/parsers/rst/directives/tables.py:E128
# complex regexp definitions
docutils/parsers/rst/states.py:E121,E128
+ # deprecated module, will be removed
+ docutils/utils/error_reporting.py:E261
# module with 3rd-party origin
- docutils/utils/math/math2html.py:E111,E114,E123,E241
+ docutils/utils/math/math2html.py:E111,E114,E123,E241,E261
# generated auxiliary files
docutils/utils/math/unichar2tex.py:E122
- docutils/utils/math/tex2unichar.py:E123
+ docutils/utils/math/tex2unichar.py:E123,E261
# allow aligning values in data-collections
docutils/utils/smartquotes.py:E241
docutils/utils/roman.py:E241
- docutils/utils/math/latex2mathml.py:E241
+ docutils/utils/math/latex2mathml.py:E241,E261
docutils/writers/latex2e/__init__.py:E241
docutils/writers/xetex/__init__.py:E241
+ # deprecated module, will be removed
+ test/test_error_reporting.py:E261
# included configuration files referencing externally defined variables
test/functional/tests/*:F821
# don't indent list delimiters in lists of test samples (multi-line strings)