summaryrefslogtreecommitdiff
path: root/sphinx/environment.py
diff options
context:
space:
mode:
Diffstat (limited to 'sphinx/environment.py')
-rw-r--r--sphinx/environment.py62
1 files changed, 0 insertions, 62 deletions
diff --git a/sphinx/environment.py b/sphinx/environment.py
index 5f3d5a2d8..e2d446acc 100644
--- a/sphinx/environment.py
+++ b/sphinx/environment.py
@@ -732,7 +732,6 @@ class BuildEnvironment(object):
self.process_images(docname, doctree)
self.process_downloads(docname, doctree)
self.process_metadata(docname, doctree)
- self.process_refonly_bullet_lists(docname, doctree)
self.create_title_from(docname, doctree)
self.note_indexentries_from(docname, doctree)
self.build_toc_from(docname, doctree)
@@ -977,67 +976,6 @@ class BuildEnvironment(object):
del doctree[0]
- def process_refonly_bullet_lists(self, docname, doctree):
- """Change refonly bullet lists to use compact_paragraphs.
-
- Specifically implemented for 'Indices and Tables' section, which looks
- odd when html_compact_lists is false.
- """
- if self.config.html_compact_lists:
- return
-
- class RefOnlyListChecker(nodes.GenericNodeVisitor):
- """Raise `nodes.NodeFound` if non-simple list item is encountered.
-
- Here 'simple' means a list item containing only a paragraph with a
- single reference in it.
- """
-
- def default_visit(self, node):
- raise nodes.NodeFound
-
- def visit_bullet_list(self, node):
- pass
-
- def visit_list_item(self, node):
- children = []
- for child in node.children:
- if not isinstance(child, nodes.Invisible):
- children.append(child)
- if len(children) != 1:
- raise nodes.NodeFound
- if not isinstance(children[0], nodes.paragraph):
- raise nodes.NodeFound
- para = children[0]
- if len(para) != 1:
- raise nodes.NodeFound
- if not isinstance(para[0], addnodes.pending_xref):
- raise nodes.NodeFound
- raise nodes.SkipChildren
-
- def invisible_visit(self, node):
- """Invisible nodes should be ignored."""
- pass
-
- def check_refonly_list(node):
- """Check for list with only references in it."""
- visitor = RefOnlyListChecker(doctree)
- try:
- node.walk(visitor)
- except nodes.NodeFound:
- return False
- else:
- return True
-
- for node in doctree.traverse(nodes.bullet_list):
- if check_refonly_list(node):
- for item in node.traverse(nodes.list_item):
- para = item[0]
- ref = para[0]
- compact_para = addnodes.compact_paragraph()
- compact_para += ref
- item.replace(para, compact_para)
-
def create_title_from(self, docname, document):
"""Add a title node to the document (just copy the first section title),
and store that title in the environment.