Skip to content

Commit 276ee6f

Browse files
committed
Move search JS into search-index.js
Export a few variables and functions into the global scope because they are needed both by main.js and search-index.js.
1 parent d4d7ebf commit 276ee6f

File tree

4 files changed

+1534
-1524
lines changed

4 files changed

+1534
-1524
lines changed

src/librustdoc/html/render/write_shared.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -408,9 +408,8 @@ pub(super) fn write_shared(
408408
// with rustdoc running in parallel.
409409
all_indexes.sort();
410410
write_crate("search-index.js", &|| {
411-
let mut v = String::from("var searchIndex = JSON.parse('{\\\n");
412-
v.push_str(&all_indexes.join(",\\\n"));
413-
v.push_str("\\\n}');\ninitSearch(searchIndex);");
411+
let v = static_files::SEARCH_JS
412+
.replace(r#""SEARCH_INDEX_PLACEHOLDER": {}"#, &all_indexes.join(",\\\n"));
414413
Ok(v.into_bytes())
415414
})?;
416415

0 commit comments

Comments
 (0)