[Python-checkins] r66575 - in doctools/trunk/sphinx: search.py static/searchtools.js

georg.brandl python-checkins at python.org
Wed Sep 24 10:53:17 CEST 2008


Author: georg.brandl
Date: Wed Sep 24 10:53:17 2008
New Revision: 66575
Log:
Compress the index more, by not storing the label name for keywords.
Modified:
 doctools/trunk/sphinx/search.py
 doctools/trunk/sphinx/static/searchtools.js
Modified: doctools/trunk/sphinx/search.py
==============================================================================
--- doctools/trunk/sphinx/search.py	(original)
+++ doctools/trunk/sphinx/search.py	Wed Sep 24 10:53:17 2008
@@ -123,14 +123,14 @@
 rv = {}
 dt = self._desctypes
 for kw, (ref, _, _, _) in self.env.modules.iteritems():
- rv[kw] = (ref, 0, 'module-' + kw)
+ rv[kw] = (ref, 0)
 for kw, (ref, ref_type) in self.env.descrefs.iteritems():
 try:
 i = dt[ref_type]
 except KeyError:
 i = len(dt)
 dt[ref_type] = i
- rv[kw] = (ref, i, kw)
+ rv[kw] = (ref, i)
 return rv
 
 def freeze(self):
Modified: doctools/trunk/sphinx/static/searchtools.js
==============================================================================
--- doctools/trunk/sphinx/static/searchtools.js	(original)
+++ doctools/trunk/sphinx/static/searchtools.js	Wed Sep 24 10:53:17 2008
@@ -329,13 +329,14 @@
 var regularResults = [];
 $('#search-progress').empty();
 
- // lookup the keyword
+ // lookup as keyword
 if (keyword != null) {
 for (var kw in keywords) {
 if (kw.toLowerCase().indexOf(keyword, kw.lastIndexOf('.')) > -1) {
 match = keywords[kw];
 descr = desctypes[match[1]] + _(', in ') + titles[match[0]];
- keywordResults.push([filenames[match[0]], kw, match[2], descr]);
+ anchor = '#' + (match[1] == 0 ? 'module-' + kw : kw);
+ keywordResults.push([filenames[match[0]], kw, anchor, descr]);
 }
 }
 }
@@ -382,7 +383,7 @@
 // if we have still a valid result we can add it
 // to the result list
 if (valid)
- regularResults.push([filenames[file], titles[file], null, null]);
+ regularResults.push([filenames[file], titles[file], '', null]);
 }
 
 // delete unused variables in order to not waste
@@ -409,8 +410,7 @@
 listItem.append($('<a/>').attr(
 'href',
 item[0] + DOCUMENTATION_OPTIONS.FILE_SUFFIX +
- highlightstring +
- (item[2] ? '#' + item[2] : '')).html(item[1]));
+ highlightstring + item[2]).html(item[1]));
 if (item[3]) {
 listItem.append($('<span> (' + item[3] + ')</span>'));
 Search.output.append(listItem);


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /