Skip to content

Commit aa3cb14

Browse files
committed
---
yaml --- r: 111002 b: refs/heads/snap-stage3 c: 8f5d71c h: refs/heads/master v: v3
1 parent ac2d3f0 commit aa3cb14

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 296e60be6b027a52de58251848037a92f23a0878
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 9eb336a0206178f52146d41dd152166233df703b
4+
refs/heads/snap-stage3: 8f5d71cf71849bea25f87836cec1b06b476baf37
55
refs/heads/try: 38201d7c6bf0c32b0e5bdc8ecd63976ebc1b3a4c
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/librustdoc/html/render.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,12 +309,23 @@ pub fn run(mut krate: clean::Crate, dst: Path) -> io::IoResult<()> {
309309
let index = {
310310
let mut w = MemWriter::new();
311311
try!(write!(&mut w, r#"searchIndex['{}'] = \{"items":["#, krate.name));
312+
313+
let mut lastpath = ~"";
312314
for (i, item) in cache.search_index.iter().enumerate() {
315+
// Omit the path if it is same to that of the prior item.
316+
let path;
317+
if lastpath == item.path {
318+
path = "";
319+
} else {
320+
lastpath = item.path.clone();
321+
path = item.path.as_slice();
322+
};
323+
313324
if i > 0 {
314325
try!(write!(&mut w, ","));
315326
}
316327
try!(write!(&mut w, r#"[{:u},"{}","{}",{}"#,
317-
item.ty, item.name, item.path,
328+
item.ty, item.name, path,
318329
item.desc.to_json().to_str()));
319330
match item.parent {
320331
Some(nodeid) => {
@@ -325,7 +336,9 @@ pub fn run(mut krate: clean::Crate, dst: Path) -> io::IoResult<()> {
325336
}
326337
try!(write!(&mut w, "]"));
327338
}
339+
328340
try!(write!(&mut w, r#"],"paths":["#));
341+
329342
for (i, &nodeid) in pathid_to_nodeid.iter().enumerate() {
330343
let &(ref fqp, short) = cache.paths.find(&nodeid).unwrap();
331344
if i > 0 {
@@ -334,6 +347,7 @@ pub fn run(mut krate: clean::Crate, dst: Path) -> io::IoResult<()> {
334347
try!(write!(&mut w, r#"[{:u},"{}"]"#,
335348
short, *fqp.last().unwrap()));
336349
}
350+
337351
try!(write!(&mut w, r"]\};"));
338352

339353
str::from_utf8(w.unwrap().as_slice()).unwrap().to_owned()

branches/snap-stage3/src/librustdoc/html/static/main.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@
539539

540540
// an array of [(Number) item type,
541541
// (String) name,
542-
// (String) full path,
542+
// (String) full path or empty string for previous path,
543543
// (String) description,
544544
// (optional Number) the parent path index to `paths`]
545545
var items = rawSearchIndex[crate].items;
@@ -561,10 +561,11 @@
561561
// all other search operations have access to this cached data for
562562
// faster analysis operations
563563
var len = items.length;
564+
var lastPath = "";
564565
for (var i = 0; i < len; i += 1) {
565566
var rawRow = items[i];
566567
var row = {crate: crate, ty: rawRow[0], name: rawRow[1],
567-
path: rawRow[2], desc: rawRow[3],
568+
path: rawRow[2] || lastPath, desc: rawRow[3],
568569
parent: paths[rawRow[4]]};
569570
searchIndex.push(row);
570571
if (typeof row.name === "string") {
@@ -573,6 +574,7 @@
573574
} else {
574575
searchWords.push("");
575576
}
577+
lastPath = row.path;
576578
}
577579
}
578580
return searchWords;

0 commit comments

Comments
 (0)