Don't consider contents of source comments for the search index.

This commit is contained in:
Georg Brandl
2009-05-31 19:47:42 +02:00
parent 92eef1b2e5
commit cfd0d8c42d
3 changed files with 44 additions and 1 deletions

View File

@@ -12,7 +12,7 @@ import re
import cPickle as pickle
from cStringIO import StringIO
from docutils.nodes import Text, NodeVisitor
from docutils.nodes import comment, Text, NodeVisitor, SkipNode
from sphinx.util.stemmer import PorterStemmer
from sphinx.util import jsdump, rpartition
@@ -83,6 +83,8 @@ class WordCollector(NodeVisitor):
self.found_words = []
def dispatch_visit(self, node):
if node.__class__ is comment:
raise SkipNode
if node.__class__ is Text:
self.found_words.extend(word_re.findall(node.astext()))