diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2017-01-11 00:55:57 +0900 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2017-01-28 20:44:40 +0900 |
commit | 851172b13b05fd814314f60924f38fc37a649468 (patch) | |
tree | 5bc3c8e573b8f93406fe3e4548aabce858540c09 /sphinx/environment/managers/indexentries.py | |
parent | e2c7b1db4206542c72e0dfbfc78bae9a8d153dfd (diff) | |
download | sphinx-git-851172b13b05fd814314f60924f38fc37a649468.tar.gz |
Reimplement IndexEntriesManager as a collector
Diffstat (limited to 'sphinx/environment/managers/indexentries.py')
-rw-r--r-- | sphinx/environment/managers/indexentries.py | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/sphinx/environment/managers/indexentries.py b/sphinx/environment/managers/indexentries.py deleted file mode 100644 index 680ef374d..000000000 --- a/sphinx/environment/managers/indexentries.py +++ /dev/null @@ -1,61 +0,0 @@ -# -*- coding: utf-8 -*- -""" - sphinx.environment.managers.indexentries - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - Index entries manager for sphinx.environment. - - :copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS. - :license: BSD, see LICENSE for details. -""" - -from sphinx import addnodes -from sphinx.util import split_index_msg, logging -from sphinx.environment.managers import EnvironmentManager - -if False: - # For type annotation - from docutils import nodes # NOQA - from sphinx.environment import BuildEnvironment # NOQA - -logger = logging.getLogger(__name__) - - -class IndexEntries(EnvironmentManager): - name = 'indices' - - def __init__(self, env): - # type: (BuildEnvironment) -> None - super(IndexEntries, self).__init__(env) - self.data = env.indexentries - - def clear_doc(self, docname): - # type: (unicode) -> None - self.data.pop(docname, None) - - def merge_other(self, docnames, other): - # type: (List[unicode], BuildEnvironment) -> None - for docname in docnames: - self.data[docname] = other.indexentries[docname] - - def process_doc(self, docname, doctree): - # type: (unicode, nodes.Node) -> None - entries = self.data[docname] = [] - for node in doctree.traverse(addnodes.index): - try: - for entry in node['entries']: - split_index_msg(entry[0], entry[1]) - except ValueError as exc: - logger.warning(str(exc), location=node) - node.parent.remove(node) - else: - for entry in node['entries']: - if len(entry) == 5: - # Since 1.4: new index structure including index_key (5th column) - entries.append(entry) - else: - entries.append(entry + (None,)) - - def get_updated_docs(self): - # type: () -> List[unicode] - return [] |