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
|
@ -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 New Issue