summaryrefslogtreecommitdiff
path: root/sphinx/writers/websupport.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2017-04-09 12:06:35 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2017-04-22 17:54:20 +0900
commitfef9f870d40481c042e1d1f6bda38a1ca009a973 (patch)
treee17aa3b7bc9a1ae5505931bcdd1586296f7de135 /sphinx/writers/websupport.py
parent45887c7d62dde461f2741f1cb9e2cc1ca26a42dd (diff)
downloadsphinx-git-fef9f870d40481c042e1d1f6bda38a1ca009a973.tar.gz
Split websupport to sphinxcontrib-websupport package
Diffstat (limited to 'sphinx/writers/websupport.py')
-rw-r--r--sphinx/writers/websupport.py36
1 files changed, 1 insertions, 35 deletions
diff --git a/sphinx/writers/websupport.py b/sphinx/writers/websupport.py
index 607ed3df6..1e7f4babd 100644
--- a/sphinx/writers/websupport.py
+++ b/sphinx/writers/websupport.py
@@ -9,38 +9,4 @@
:license: BSD, see LICENSE for details.
"""
-from sphinx.writers.html import HTMLTranslator
-from sphinx.util.websupport import is_commentable
-
-
-class WebSupportTranslator(HTMLTranslator):
- """
- Our custom HTML translator.
- """
-
- def __init__(self, builder, *args, **kwargs):
- HTMLTranslator.__init__(self, builder, *args, **kwargs)
- self.comment_class = 'sphinx-has-comment'
-
- def dispatch_visit(self, node):
- if is_commentable(node) and hasattr(node, 'uid'):
- self.handle_visit_commentable(node)
- HTMLTranslator.dispatch_visit(self, node)
-
- def handle_visit_commentable(self, node):
- # We will place the node in the HTML id attribute. If the node
- # already has an id (for indexing purposes) put an empty
- # span with the existing id directly before this node's HTML.
- self.add_db_node(node)
- if node.attributes['ids']:
- self.body.append('<span id="%s"></span>'
- % node.attributes['ids'][0])
- node.attributes['ids'] = ['s%s' % node.uid]
- node.attributes['classes'].append(self.comment_class)
-
- def add_db_node(self, node):
- storage = self.builder.storage
- if not storage.has_node(node.uid):
- storage.add_node(id=node.uid,
- document=self.builder.current_docname,
- source=node.rawsource or node.astext())
+from sphinxcontrib.websupport.writer import WebSupportTranslator # NOQA