diff options
| author | Jacob Hoffman-Andrews <github@hoffman-andrews.com> | 2021-04-11 22:19:29 -0700 |
|---|---|---|
| committer | Jacob Hoffman-Andrews <github@hoffman-andrews.com> | 2021-04-12 22:52:16 -0700 |
| commit | 276ee6f542ea2c144d115214abf7aa4a7b8c2445 (patch) | |
| tree | 7888f449e885fd25d4cba84a31dd7b33320c59dd /src/librustdoc/html/render | |
| parent | d4d7ebf142d4dfc01f6435db1eb15eb337013aaf (diff) | |
| download | rust-276ee6f542ea2c144d115214abf7aa4a7b8c2445.tar.gz rust-276ee6f542ea2c144d115214abf7aa4a7b8c2445.zip | |
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.
Diffstat (limited to 'src/librustdoc/html/render')
| -rw-r--r-- | src/librustdoc/html/render/write_shared.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/librustdoc/html/render/write_shared.rs b/src/librustdoc/html/render/write_shared.rs index 8fb6d68f3c6..4240c986f57 100644 --- a/src/librustdoc/html/render/write_shared.rs +++ b/src/librustdoc/html/render/write_shared.rs @@ -408,9 +408,8 @@ pub(super) fn write_shared( // with rustdoc running in parallel. all_indexes.sort(); write_crate("search-index.js", &|| { - let mut v = String::from("var searchIndex = JSON.parse('{\\\n"); - v.push_str(&all_indexes.join(",\\\n")); - v.push_str("\\\n}');\ninitSearch(searchIndex);"); + let v = static_files::SEARCH_JS + .replace(r#""SEARCH_INDEX_PLACEHOLDER": {}"#, &all_indexes.join(",\\\n")); Ok(v.into_bytes()) })?; |
