mirror of
https://github.com/rust-lang/mdBook
synced 2024-12-14 06:42:35 +00:00
Fix #40 where next helper returned a link to the current chapter instead of the next
This commit is contained in:
parent
0932bfd576
commit
10d756eff0
1 changed files with 3 additions and 2 deletions
|
@ -149,12 +149,12 @@ pub fn next(c: &Context, _h: &Helper, r: &Handlebars, rc: &mut RenderContext) ->
|
|||
|
||||
if let Some(previous) = previous {
|
||||
|
||||
let path = match previous.get("path") {
|
||||
let previous_path = match previous.get("path") {
|
||||
Some(p) => p,
|
||||
None => return Err(RenderError{ desc: "No path found for chapter in JSON data"})
|
||||
};
|
||||
|
||||
if path == ¤t {
|
||||
if previous_path == ¤t {
|
||||
|
||||
debug!("[*]: Found current chapter");
|
||||
debug!("[*]: Creating BTreeMap to inject in context");
|
||||
|
@ -169,6 +169,7 @@ pub fn next(c: &Context, _h: &Helper, r: &Handlebars, rc: &mut RenderContext) ->
|
|||
None => return Err(RenderError{ desc: "No title found for chapter in JSON data"})
|
||||
}
|
||||
|
||||
|
||||
let link = path_to_root.join(Path::new(path).with_extension("html"));
|
||||
debug!("[*]: Inserting link: {:?}", link);
|
||||
|
||||
|
|
Loading…
Reference in a new issue