Fix keyboard chapter navigation for `file` urls. (#915)
This commit is contained in:
parent
a674c9eff1
commit
8bb5426441
|
@ -35,7 +35,7 @@ pub fn create_files(search_config: &Search, destination: &Path, book: &Book) ->
|
|||
utils::fs::write_file(
|
||||
destination,
|
||||
"searchindex.js",
|
||||
format!("window.search = {};", index).as_bytes(),
|
||||
format!("Object.assign(window.search, {});", index).as_bytes(),
|
||||
)?;
|
||||
utils::fs::write_file(destination, "searcher.js", searcher::JS)?;
|
||||
utils::fs::write_file(destination, "mark.min.js", searcher::MARK_JS)?;
|
||||
|
|
|
@ -427,8 +427,8 @@ mod search {
|
|||
fn read_book_index(root: &Path) -> serde_json::Value {
|
||||
let index = root.join("book/searchindex.js");
|
||||
let index = file_to_string(index).unwrap();
|
||||
let index = index.trim_start_matches("window.search = ");
|
||||
let index = index.trim_end_matches(';');
|
||||
let index = index.trim_start_matches("Object.assign(window.search, ");
|
||||
let index = index.trim_end_matches(");");
|
||||
serde_json::from_str(&index).unwrap()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue