mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Don't consider contents of source comments for the search index.
This commit is contained in:
@@ -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()))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user