Skip to content

Commit

Permalink
Fix keyboard chapter navigation for file urls. (#915)
Browse files Browse the repository at this point in the history
  • Loading branch information
ehuss authored and Dylan-DPC committed May 7, 2019
1 parent a674c9e commit 8bb5426
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/renderer/html_handlebars/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?;
Expand Down
4 changes: 2 additions & 2 deletions tests/rendered_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down

0 comments on commit 8bb5426

Please sign in to comment.