diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2018-11-21 01:08:50 +0900 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2018-11-21 01:37:48 +0900 |
commit | f128be573bcedd8b58df3bd9da333ad9c108d6b0 (patch) | |
tree | c9c0a8b5b947aef51afd0345085a2a53f4a52052 /sphinx/writers/text.py | |
parent | 42193dc581e5d89f0daa0d6d1afc318bf9b8f045 (diff) | |
download | sphinx-git-f128be573bcedd8b58df3bd9da333ad9c108d6b0.tar.gz |
Update type hints to text writer
Diffstat (limited to 'sphinx/writers/text.py')
-rw-r--r-- | sphinx/writers/text.py | 366 |
1 files changed, 183 insertions, 183 deletions
diff --git a/sphinx/writers/text.py b/sphinx/writers/text.py index e39d1abca..c38d719db 100644 --- a/sphinx/writers/text.py +++ b/sphinx/writers/text.py @@ -462,11 +462,11 @@ class TextTranslator(nodes.NodeVisitor): self.states[-1].extend(result) def visit_document(self, node): - # type: (nodes.Node) -> None + # type: (nodes.document) -> None self.new_state(0) def depart_document(self, node): - # type: (nodes.Node) -> None + # type: (nodes.document) -> None self.end_state() self.body = self.nl.join(line and (' ' * indent + line) for indent, lines in self.states[0] @@ -474,53 +474,53 @@ class TextTranslator(nodes.NodeVisitor): # XXX header/footer? def visit_section(self, node): - # type: (nodes.Node) -> None + # type: (nodes.section) -> None self._title_char = self.sectionchars[self.sectionlevel] self.sectionlevel += 1 def depart_section(self, node): - # type: (nodes.Node) -> None + # type: (nodes.section) -> None self.sectionlevel -= 1 def visit_topic(self, node): - # type: (nodes.Node) -> None + # type: (nodes.topic) -> None self.new_state(0) def depart_topic(self, node): - # type: (nodes.Node) -> None + # type: (nodes.topic) -> None self.end_state() visit_sidebar = visit_topic depart_sidebar = depart_topic def visit_rubric(self, node): - # type: (nodes.Node) -> None + # type: (nodes.rubric) -> None self.new_state(0) self.add_text('-[ ') def depart_rubric(self, node): - # type: (nodes.Node) -> None + # type: (nodes.rubric) -> None self.add_text(' ]-') self.end_state() def visit_compound(self, node): - # type: (nodes.Node) -> None + # type: (nodes.compound) -> None pass def depart_compound(self, node): - # type: (nodes.Node) -> None + # type: (nodes.compound) -> None pass def visit_glossary(self, node): - # type: (nodes.Node) -> None + # type: (addnodes.glossary) -> None pass def depart_glossary(self, node): - # type: (nodes.Node) -> None + # type: (addnodes.glossary) -> None pass def visit_title(self, node): - # type: (nodes.Node) -> None + # type: (nodes.title) -> None if isinstance(node.parent, nodes.Admonition): self.add_text(node.astext() + ': ') raise nodes.SkipNode @@ -538,7 +538,7 @@ class TextTranslator(nodes.NodeVisitor): return '' def depart_title(self, node): - # type: (nodes.Node) -> None + # type: (nodes.title) -> None if isinstance(node.parent, nodes.section): char = self._title_char else: @@ -555,89 +555,89 @@ class TextTranslator(nodes.NodeVisitor): self.states[-1].append((0, title)) def visit_subtitle(self, node): - # type: (nodes.Node) -> None + # type: (nodes.subtitle) -> None pass def depart_subtitle(self, node): - # type: (nodes.Node) -> None + # type: (nodes.subtitle) -> None pass def visit_attribution(self, node): - # type: (nodes.Node) -> None + # type: (nodes.attribution) -> None self.add_text('-- ') def depart_attribution(self, node): - # type: (nodes.Node) -> None + # type: (nodes.attribution) -> None pass def visit_desc(self, node): - # type: (nodes.Node) -> None + # type: (addnodes.desc) -> None pass def depart_desc(self, node): - # type: (nodes.Node) -> None + # type: (addnodes.desc) -> None pass def visit_desc_signature(self, node): - # type: (nodes.Node) -> None + # type: (addnodes.desc_signature) -> None self.new_state(0) def depart_desc_signature(self, node): - # type: (nodes.Node) -> None + # type: (addnodes.desc_signature) -> None # XXX: wrap signatures in a way that makes sense self.end_state(wrap=False, end=None) def visit_desc_signature_line(self, node): - # type: (nodes.Node) -> None + # type: (addnodes.desc_signature_line) -> None pass def depart_desc_signature_line(self, node): - # type: (nodes.Node) -> None + # type: (addnodes.desc_signature_line) -> None self.add_text('\n') def visit_desc_name(self, node): - # type: (nodes.Node) -> None + # type: (addnodes.desc_name) -> None pass def depart_desc_name(self, node): - # type: (nodes.Node) -> None + # type: (addnodes.desc_name) -> None pass def visit_desc_addname(self, node): - # type: (nodes.Node) -> None + # type: (addnodes.desc_addname) -> None pass def depart_desc_addname(self, node): - # type: (nodes.Node) -> None + # type: (addnodes.desc_addname) -> None pass def visit_desc_type(self, node): - # type: (nodes.Node) -> None + # type: (addnodes.desc_type) -> None pass def depart_desc_type(self, node): - # type: (nodes.Node) -> None + # type: (addnodes.desc_type) -> None pass def visit_desc_returns(self, node): - # type: (nodes.Node) -> None + # type: (addnodes.desc_returns) -> None self.add_text(' -> ') def depart_desc_returns(self, node): - # type: (nodes.Node) -> None + # type: (addnodes.desc_returns) -> None pass def visit_desc_parameterlist(self, node): - # type: (nodes.Node) -> None + # type: (addnodes.desc_parameterlist) -> None self.add_text('(') self.first_param = 1 def depart_desc_parameterlist(self, node): - # type: (nodes.Node) -> None + # type: (addnodes.desc_parameterlist) -> None self.add_text(')') def visit_desc_parameter(self, node): - # type: (nodes.Node) -> None + # type: (addnodes.desc_parameter) -> None if not self.first_param: self.add_text(', ') else: @@ -646,48 +646,48 @@ class TextTranslator(nodes.NodeVisitor): raise nodes.SkipNode def visit_desc_optional(self, node): - # type: (nodes.Node) -> None + # type: (addnodes.desc_optional) -> None self.add_text('[') def depart_desc_optional(self, node): - # type: (nodes.Node) -> None + # type: (addnodes.desc_optional) -> None self.add_text(']') def visit_desc_annotation(self, node): - # type: (nodes.Node) -> None + # type: (addnodes.desc_annotation) -> None pass def depart_desc_annotation(self, node): - # type: (nodes.Node) -> None + # type: (addnodes.desc_annotation) -> None pass def visit_desc_content(self, node): - # type: (nodes.Node) -> None + # type: (addnodes.desc_content) -> None self.new_state() self.add_text(self.nl) def depart_desc_content(self, node): - # type: (nodes.Node) -> None + # type: (addnodes.desc_content) -> None self.end_state() def visit_figure(self, node): - # type: (nodes.Node) -> None + # type: (nodes.figure) -> None self.new_state() def depart_figure(self, node): - # type: (nodes.Node) -> None + # type: (nodes.figure) -> None self.end_state() def visit_caption(self, node): - # type: (nodes.Node) -> None + # type: (nodes.caption) -> None pass def depart_caption(self, node): - # type: (nodes.Node) -> None + # type: (nodes.caption) -> None pass def visit_productionlist(self, node): - # type: (nodes.Node) -> None + # type: (addnodes.productionlist) -> None self.new_state() names = [] for production in node: @@ -705,16 +705,16 @@ class TextTranslator(nodes.NodeVisitor): raise nodes.SkipNode def visit_footnote(self, node): - # type: (nodes.Node) -> None + # type: (nodes.footnote) -> None self._footnote = node.children[0].astext().strip() self.new_state(len(self._footnote) + 3) def depart_footnote(self, node): - # type: (nodes.Node) -> None + # type: (nodes.footnote) -> None self.end_state(first='[%s] ' % self._footnote) def visit_citation(self, node): - # type: (nodes.Node) -> None + # type: (nodes.citation) -> None if len(node) and isinstance(node[0], nodes.label): self._citlabel = node[0].astext() else: @@ -722,133 +722,133 @@ class TextTranslator(nodes.NodeVisitor): self.new_state(len(self._citlabel) + 3) def depart_citation(self, node): - # type: (nodes.Node) -> None + # type: (nodes.citation) -> None self.end_state(first='[%s] ' % self._citlabel) def visit_label(self, node): - # type: (nodes.Node) -> None + # type: (nodes.label) -> None raise nodes.SkipNode def visit_legend(self, node): - # type: (nodes.Node) -> None + # type: (nodes.legend) -> None pass def depart_legend(self, node): - # type: (nodes.Node) -> None + # type: (nodes.legend) -> None pass # XXX: option list could use some better styling def visit_option_list(self, node): - # type: (nodes.Node) -> None + # type: (nodes.option_list) -> None pass def depart_option_list(self, node): - # type: (nodes.Node) -> None + # type: (nodes.option_list) -> None pass def visit_option_list_item(self, node): - # type: (nodes.Node) -> None + # type: (nodes.option_list_item) -> None self.new_state(0) def depart_option_list_item(self, node): - # type: (nodes.Node) -> None + # type: (nodes.option_list_item) -> None self.end_state() def visit_option_group(self, node): - # type: (nodes.Node) -> None + # type: (nodes.option_group) -> None self._firstoption = True def depart_option_group(self, node): - # type: (nodes.Node) -> None + # type: (nodes.option_group) -> None self.add_text(' ') def visit_option(self, node): - # type: (nodes.Node) -> None + # type: (nodes.option) -> None if self._firstoption: self._firstoption = False else: self.add_text(', ') def depart_option(self, node): - # type: (nodes.Node) -> None + # type: (nodes.option) -> None pass def visit_option_string(self, node): - # type: (nodes.Node) -> None + # type: (nodes.option_string) -> None pass def depart_option_string(self, node): - # type: (nodes.Node) -> None + # type: (nodes.option_string) -> None pass def visit_option_argument(self, node): - # type: (nodes.Node) -> None + # type: (nodes.option_argument) -> None self.add_text(node['delimiter']) def depart_option_argument(self, node): - # type: (nodes.Node) -> None + # type: (nodes.option_argument) -> None pass def visit_description(self, node): - # type: (nodes.Node) -> None + # type: (nodes.description) -> None pass def depart_description(self, node): - # type: (nodes.Node) -> None + # type: (nodes.description) -> None pass def visit_tabular_col_spec(self, node): - # type: (nodes.Node) -> None + # type: (addnodes.tabular_col_spec) -> None raise nodes.SkipNode def visit_colspec(self, node): - # type: (nodes.Node) -> None + # type: (nodes.colspec) -> None self.table.colwidth.append(node["colwidth"]) raise nodes.SkipNode def visit_tgroup(self, node): - # type: (nodes.Node) -> None + # type: (nodes.tgroup) -> None pass def depart_tgroup(self, node): - # type: (nodes.Node) -> None + # type: (nodes.tgroup) -> None pass def visit_thead(self, node): - # type: (nodes.Node) -> None + # type: (nodes.thead) -> None pass def depart_thead(self, node): - # type: (nodes.Node) -> None + # type: (nodes.thead) -> None pass def visit_tbody(self, node): - # type: (nodes.Node) -> None + # type: (nodes.tbody) -> None self.table.set_separator() def depart_tbody(self, node): - # type: (nodes.Node) -> None + # type: (nodes.tbody) -> None pass def visit_row(self, node): - # type: (nodes.Node) -> None + # type: (nodes.row) -> None if self.table.lines: self.table.add_row() def depart_row(self, node): - # type: (nodes.Node) -> None + # type: (nodes.row) -> None pass def visit_entry(self, node): - # type: (nodes.Node) -> None + # type: (nodes.entry) -> None self.entry = Cell( rowspan=node.get("morerows", 0) + 1, colspan=node.get("morecols", 0) + 1 ) self.new_state(0) def depart_entry(self, node): - # type: (nodes.Node) -> None + # type: (nodes.entry) -> None text = self.nl.join(self.nl.join(x[1]) for x in self.states.pop()) self.stateindent.pop() self.entry.text = text @@ -856,20 +856,20 @@ class TextTranslator(nodes.NodeVisitor): self.entry = None def visit_table(self, node): - # type: (nodes.Node) -> None + # type: (nodes.table) -> None if self.table: raise NotImplementedError('Nested tables are not supported.') self.new_state(0) self.table = Table() def depart_table(self, node): - # type: (nodes.Node) -> None + # type: (nodes.table) -> None self.add_text(str(self.table)) self.table = None self.end_state(wrap=False) def visit_acks(self, node): - # type: (nodes.Node) -> None + # type: (addnodes.acks) -> None self.new_state(0) self.add_text(', '.join(n.astext() for n in node.children[0].children) + '.') @@ -877,14 +877,14 @@ class TextTranslator(nodes.NodeVisitor): raise nodes.SkipNode def visit_image(self, node): - # type: (nodes.Node) -> None + # type: (nodes.image) -> None if 'alt' in node.attributes: self.add_text(_('[image: %s]') % node['alt']) self.add_text(_('[image]')) raise nodes.SkipNode def visit_transition(self, node): - # type: (nodes.Node) -> None + # type: (nodes.transition) -> None indent = sum(self.stateindent) self.new_state(0) self.add_text('=' * (MAXWIDTH - indent)) @@ -892,31 +892,31 @@ class TextTranslator(nodes.NodeVisitor): raise nodes.SkipNode def visit_bullet_list(self, node): - # type: (nodes.Node) -> None + # type: (nodes.bullet_list) -> None self.list_counter.append(-1) def depart_bullet_list(self, node): - # type: (nodes.Node) -> None + # type: (nodes.bullet_list) -> None self.list_counter.pop() def visit_enumerated_list(self, node): - # type: (nodes.Node) -> None + # type: (nodes.enumerated_list) -> None self.list_counter.append(node.get('start', 1) - 1) def depart_enumerated_list(self, node): - # type: (nodes.Node) -> None + # type: (nodes.enumerated_list) -> None self.list_counter.pop() def visit_definition_list(self, node): - # type: (nodes.Node) -> None + # type: (nodes.definition_list) -> None self.list_counter.append(-2) def depart_definition_list(self, node): - # type: (nodes.Node) -> None + # type: (nodes.definition_list) -> None self.list_counter.pop() def visit_list_item(self, node): - # type: (nodes.Node) -> None + # type: (nodes.list_item) -> None if self.list_counter[-1] == -1: # bullet list self.new_state(2) @@ -929,7 +929,7 @@ class TextTranslator(nodes.NodeVisitor): self.new_state(len(str(self.list_counter[-1])) + 2) def depart_list_item(self, node): - # type: (nodes.Node) -> None + # type: (nodes.list_item) -> None if self.list_counter[-1] == -1: self.end_state(first='* ') elif self.list_counter[-1] == -2: @@ -938,103 +938,103 @@ class TextTranslator(nodes.NodeVisitor): self.end_state(first='%s. ' % self.list_counter[-1]) def visit_definition_list_item(self, node): - # type: (nodes.Node) -> None + # type: (nodes.definition_list_item) -> None self._classifier_count_in_li = len(node.traverse(nodes.classifier)) def depart_definition_list_item(self, node): - # type: (nodes.Node) -> None + # type: (nodes.definition_list_item) -> None pass def visit_term(self, node): - # type: (nodes.Node) -> None + # type: (nodes.term) -> None self.new_state(0) def depart_term(self, node): - # type: (nodes.Node) -> None + # type: (nodes.term) -> None if not self._classifier_count_in_li: self.end_state(end=None) def visit_classifier(self, node): - # type: (nodes.Node) -> None + # type: (nodes.classifier) -> None self.add_text(' : ') def depart_classifier(self, node): - # type: (nodes.Node) -> None + # type: (nodes.classifier) -> None self._classifier_count_in_li -= 1 if not self._classifier_count_in_li: self.end_state(end=None) def visit_definition(self, node): - # type: (nodes.Node) -> None + # type: (nodes.definition) -> None self.new_state() def depart_definition(self, node): - # type: (nodes.Node) -> None + # type: (nodes.definition) -> None self.end_state() def visit_field_list(self, node): - # type: (nodes.Node) -> None + # type: (nodes.field_list) -> None pass def depart_field_list(self, node): - # type: (nodes.Node) -> None + # type: (nodes.field_list) -> None pass def visit_field(self, node): - # type: (nodes.Node) -> None + # type: (nodes.field) -> None pass def depart_field(self, node): - # type: (nodes.Node) -> None + # type: (nodes.field) -> None pass def visit_field_name(self, node): - # type: (nodes.Node) -> None + # type: (nodes.field_name) -> None self.new_state(0) def depart_field_name(self, node): - # type: (nodes.Node) -> None + # type: (nodes.field_name) -> None self.add_text(':') self.end_state(end=None) def visit_field_body(self, node): - # type: (nodes.Node) -> None + # type: (nodes.field_body) -> None self.new_state() def depart_field_body(self, node): - # type: (nodes.Node) -> None + # type: (nodes.field_body) -> None self.end_state() def visit_centered(self, node): - # type: (nodes.Node) -> None + # type: (addnodes.centered) -> None pass def depart_centered(self, node): - # type: (nodes.Node) -> None + # type: (addnodes.centered) -> None pass def visit_hlist(self, node): - # type: (nodes.Node) -> None + # type: (addnodes.hlist) -> None pass def depart_hlist(self, node): - # type: (nodes.Node) -> None + # type: (addnodes.hlist) -> None pass def visit_hlistcol(self, node): - # type: (nodes.Node) -> None + # type: (addnodes.hlistcol) -> None pass def depart_hlistcol(self, node): - # type: (nodes.Node) -> None + # type: (addnodes.hlistcol) -> None pass def visit_admonition(self, node): - # type: (nodes.Node) -> None + # type: (nodes.admonition) -> None self.new_state(0) def depart_admonition(self, node): - # type: (nodes.Node) -> None + # type: (nodes.admonition) -> None self.end_state() def _visit_admonition(self, node): @@ -1047,7 +1047,7 @@ class TextTranslator(nodes.NodeVisitor): def _make_depart_admonition(name): # type: (unicode) -> Callable[[TextTranslator, nodes.Node], None] def depart_admonition(self, node): - # type: (nodes.NodeVisitor, nodes.Node) -> None + # type: (nodes.admonition) -> None self.end_state(first=admonitionlabels[name] + ': ') return depart_admonition @@ -1073,273 +1073,273 @@ class TextTranslator(nodes.NodeVisitor): depart_seealso = _make_depart_admonition('seealso') def visit_versionmodified(self, node): - # type: (nodes.Node) -> None + # type: (addnodes.versionmodified) -> None self.new_state(0) def depart_versionmodified(self, node): - # type: (nodes.Node) -> None + # type: (addnodes.versionmodified) -> None self.end_state() def visit_literal_block(self, node): - # type: (nodes.Node) -> None + # type: (nodes.literal_block) -> None self.new_state() def depart_literal_block(self, node): - # type: (nodes.Node) -> None + # type: (nodes.literal_block) -> None self.end_state(wrap=False) def visit_doctest_block(self, node): - # type: (nodes.Node) -> None + # type: (nodes.doctest_block) -> None self.new_state(0) def depart_doctest_block(self, node): - # type: (nodes.Node) -> None + # type: (nodes.doctest_block) -> None self.end_state(wrap=False) def visit_line_block(self, node): - # type: (nodes.Node) -> None + # type: (nodes.line_block) -> None self.new_state() self.lineblocklevel += 1 def depart_line_block(self, node): - # type: (nodes.Node) -> None + # type: (nodes.line_block) -> None self.lineblocklevel -= 1 self.end_state(wrap=False, end=None) if not self.lineblocklevel: self.add_text('\n') def visit_line(self, node): - # type: (nodes.Node) -> None + # type: (nodes.line) -> None pass def depart_line(self, node): - # type: (nodes.Node) -> None + # type: (nodes.line) -> None self.add_text('\n') def visit_block_quote(self, node): - # type: (nodes.Node) -> None + # type: (nodes.block_quote) -> None self.new_state() def depart_block_quote(self, node): - # type: (nodes.Node) -> None + # type: (nodes.block_quote) -> None self.end_state() def visit_compact_paragraph(self, node): - # type: (nodes.Node) -> None + # type: (addnodes.compact_paragraph) -> None pass def depart_compact_paragraph(self, node): - # type: (nodes.Node) -> None + # type: (addnodes.compact_paragraph) -> None pass def visit_paragraph(self, node): - # type: (nodes.Node) -> None + # type: (nodes.paragraph) -> None if not isinstance(node.parent, nodes.Admonition) or \ isinstance(node.parent, addnodes.seealso): self.new_state(0) def depart_paragraph(self, node): - # type: (nodes.Node) -> None + # type: (nodes.paragraph) -> None if not isinstance(node.parent, nodes.Admonition) or \ isinstance(node.parent, addnodes.seealso): self.end_state() def visit_target(self, node): - # type: (nodes.Node) -> None + # type: (nodes.target) -> None raise nodes.SkipNode def visit_index(self, node): - # type: (nodes.Node) -> None + # type: (addnodes.index) -> None raise nodes.SkipNode def visit_toctree(self, node): - # type: (nodes.Node) -> None + # type: (addnodes.toctree) -> None raise nodes.SkipNode def visit_pending_xref(self, node): - # type: (nodes.Node) -> None + # type: (addnodes.pending_xref) -> None pass def depart_pending_xref(self, node): - # type: (nodes.Node) -> None + # type: (addnodes.pending_xref) -> None pass def visit_reference(self, node): - # type: (nodes.Node) -> None + # type: (nodes.reference) -> None if self.add_secnumbers: numbers = node.get("secnumber") if numbers is not None: self.add_text('.'.join(map(str, numbers)) + self.secnumber_suffix) def depart_reference(self, node): - # type: (nodes.Node) -> None + # type: (nodes.reference) -> None pass def visit_number_reference(self, node): - # type: (nodes.Node) -> None + # type: (addnodes.number_reference) -> None text = nodes.Text(node.get('title', '#')) self.visit_Text(text) raise nodes.SkipNode def visit_download_reference(self, node): - # type: (nodes.Node) -> None + # type: (addnodes.download_reference) -> None pass def depart_download_reference(self, node): - # type: (nodes.Node) -> None + # type: (addnodes.download_reference) -> None pass def visit_emphasis(self, node): - # type: (nodes.Node) -> None + # type: (nodes.emphasis) -> None self.add_text('*') def depart_emphasis(self, node): - # type: (nodes.Node) -> None + # type: (nodes.emphasis) -> None self.add_text('*') def visit_literal_emphasis(self, node): - # type: (nodes.Node) -> None + # type: (addnodes.literal_emphasis) -> None self.add_text('*') def depart_literal_emphasis(self, node): - # type: (nodes.Node) -> None + # type: (addnodes.literal_emphasis) -> None self.add_text('*') def visit_strong(self, node): - # type: (nodes.Node) -> None + # type: (nodes.strong) -> None self.add_text('**') def depart_strong(self, node): - # type: (nodes.Node) -> None + # type: (nodes.strong) -> None self.add_text('**') def visit_literal_strong(self, node): - # type: (nodes.Node) -> None + # type: (addnodes.literal_strong) -> None self.add_text('**') def depart_literal_strong(self, node): - # type: (nodes.Node) -> None + # type: (addnodes.literal_strong) -> None self.add_text('**') def visit_abbreviation(self, node): - # type: (nodes.Node) -> None + # type: (nodes.abbreviation) -> None self.add_text('') def depart_abbreviation(self, node): - # type: (nodes.Node) -> None + # type: (nodes.abbreviation) -> None if node.hasattr('explanation'): self.add_text(' (%s)' % node['explanation']) def visit_manpage(self, node): - # type: (nodes.Node) -> Any + # type: (addnodes.manpage) -> None return self.visit_literal_emphasis(node) def depart_manpage(self, node): - # type: (nodes.Node) -> Any + # type: (addnodes.manpage) -> None return self.depart_literal_emphasis(node) def visit_title_reference(self, node): - # type: (nodes.Node) -> None + # type: (nodes.title_reference) -> None self.add_text('*') def depart_title_reference(self, node): - # type: (nodes.Node) -> None + # type: (nodes.title_reference) -> None self.add_text('*') def visit_literal(self, node): - # type: (nodes.Node) -> None + # type: (nodes.literal) -> None self.add_text('"') def depart_literal(self, node): - # type: (nodes.Node) -> None + # type: (nodes.literal) -> None self.add_text('"') def visit_subscript(self, node): - # type: (nodes.Node) -> None + # type: (nodes.subscript) -> None self.add_text('_') def depart_subscript(self, node): - # type: (nodes.Node) -> None + # type: (nodes.subscript) -> None pass def visit_superscript(self, node): - # type: (nodes.Node) -> None + # type: (nodes.superscript) -> None self.add_text('^') def depart_superscript(self, node): - # type: (nodes.Node) -> None + # type: (nodes.superscript) -> None pass def visit_footnote_reference(self, node): - # type: (nodes.Node) -> None + # type: (nodes.footnote_reference) -> None self.add_text('[%s]' % node.astext()) raise nodes.SkipNode def visit_citation_reference(self, node): - # type: (nodes.Node) -> None + # type: (nodes.citation_reference) -> None self.add_text('[%s]' % node.astext()) raise nodes.SkipNode def visit_Text(self, node): - # type: (nodes.Node) -> None + # type: (nodes.Text) -> None self.add_text(node.astext()) def depart_Text(self, node): - # type: (nodes.Node) -> None + # type: (nodes.Text) -> None pass def visit_generated(self, node): - # type: (nodes.Node) -> None + # type: (nodes.generated) -> None pass def depart_generated(self, node): - # type: (nodes.Node) -> None + # type: (nodes.generated) -> None pass def visit_inline(self, node): - # type: (nodes.Node) -> None + # type: (nodes.inline) -> None if 'xref' in node['classes'] or 'term' in node['classes']: self.add_text('*') def depart_inline(self, node): - # type: (nodes.Node) -> None + # type: (nodes.inline) -> None if 'xref' in node['classes'] or 'term' in node['classes']: self.add_text('*') def visit_container(self, node): - # type: (nodes.Node) -> None + # type: (nodes.container) -> None pass def depart_container(self, node): - # type: (nodes.Node) -> None + # type: (nodes.container) -> None pass def visit_problematic(self, node): - # type: (nodes.Node) -> None + # type: (nodes.problematic) -> None self.add_text('>>') def depart_problematic(self, node): - # type: (nodes.Node) -> None + # type: (nodes.problematic) -> None self.add_text('<<') def visit_system_message(self, node): - # type: (nodes.Node) -> None + # type: (nodes.system_message) -> None self.new_state(0) self.add_text('<SYSTEM MESSAGE: %s>' % node.astext()) self.end_state() raise nodes.SkipNode def visit_comment(self, node): - # type: (nodes.Node) -> None + # type: (nodes.comment) -> None raise nodes.SkipNode def visit_meta(self, node): - # type: (nodes.Node) -> None + # type: (addnodes.meta) -> None # only valid for HTML raise nodes.SkipNode def visit_raw(self, node): - # type: (nodes.Node) -> None + # type: (nodes.raw) -> None if 'text' in node.get('format', '').split(): self.new_state(0) self.add_text(node.astext()) @@ -1347,19 +1347,19 @@ class TextTranslator(nodes.NodeVisitor): raise nodes.SkipNode def visit_math(self, node): - # type: (nodes.Node) -> None + # type: (nodes.math) -> None pass def depart_math(self, node): - # type: (nodes.Node) -> None + # type: (nodes.math) -> None pass def visit_math_block(self, node): - # type: (nodes.Node) -> None + # type: (nodes.math_block) -> None self.new_state() def depart_math_block(self, node): - # type: (nodes.Node) -> None + # type: (nodes.math_block) -> None self.end_state() def unknown_visit(self, node): |