From 8500d1c8a746c03d469263df0c90b3114fe3d99f Mon Sep 17 00:00:00 2001 From: Jesse Millikan Date: Sun, 19 Mar 2017 03:53:24 -0400 Subject: [PATCH 01/18] Relative links for non-JS browsers --- src/theme/index.hbs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/theme/index.hbs b/src/theme/index.hbs index 48098e05..e6230921 100644 --- a/src/theme/index.hbs +++ b/src/theme/index.hbs @@ -20,6 +20,14 @@ + {{#previous}} + + {{/previous}} + + {{#next}} + + {{/next}} + From 980ea5796e3b800aaf996bf6af9942374bfce56f Mon Sep 17 00:00:00 2001 From: Jesse Millikan Date: Sun, 19 Mar 2017 16:21:38 -0400 Subject: [PATCH 02/18] next and prev attributes on the next and prev links, and #content --- src/theme/index.hbs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/theme/index.hbs b/src/theme/index.hbs index e6230921..effcc030 100644 --- a/src/theme/index.hbs +++ b/src/theme/index.hbs @@ -21,11 +21,9 @@ {{#previous}} - {{/previous}} {{#next}} - {{/next}} @@ -80,13 +78,13 @@ {{#previous}} - {{/previous}} {{#next}} - {{/next}} From d24ad83a5c6382e1c907adf9cd1551a8eebfc224 Mon Sep 17 00:00:00 2001 From: Jesse Millikan Date: Fri, 14 Apr 2017 15:51:23 -0400 Subject: [PATCH 03/18] Empty header sections --- src/theme/index.hbs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/theme/index.hbs b/src/theme/index.hbs index effcc030..4dc548a2 100644 --- a/src/theme/index.hbs +++ b/src/theme/index.hbs @@ -20,12 +20,6 @@ - {{#previous}} - {{/previous}} - - {{#next}} - {{/next}} - From d1f9174e7f394c1e9de8074ec51deba62fc46e50 Mon Sep 17 00:00:00 2001 From: Ning Sun Date: Fri, 5 May 2017 08:41:50 +0800 Subject: [PATCH 04/18] (feat) adopt new handlebars navigate api Signed-off-by: Ning Sun --- .../html_handlebars/helpers/navigation.rs | 14 ++++++--- src/renderer/html_handlebars/helpers/toc.rs | 31 +++++++++++-------- 2 files changed, 28 insertions(+), 17 deletions(-) diff --git a/src/renderer/html_handlebars/helpers/navigation.rs b/src/renderer/html_handlebars/helpers/navigation.rs index 50dd7a4a..779c6bfb 100644 --- a/src/renderer/html_handlebars/helpers/navigation.rs +++ b/src/renderer/html_handlebars/helpers/navigation.rs @@ -14,9 +14,12 @@ pub fn previous(_h: &Helper, r: &Handlebars, rc: &mut RenderContext) -> Result<( // get value from context data // rc.get_path() is current json parent path, you should always use it like this // param is the key of value you want to display - let chapters = rc.context().navigate(rc.get_path(), &VecDeque::new(), "chapters").to_owned(); + let chapters = rc.context() + .navigate(rc.get_path(), &VecDeque::new(), "chapters")? + .to_owned(); - let current = rc.context().navigate(rc.get_path(), &VecDeque::new(), "path") + let current = rc.context() + .navigate(rc.get_path(), &VecDeque::new(), "path")? .to_string() .replace("\"", ""); @@ -115,9 +118,12 @@ pub fn next(_h: &Helper, r: &Handlebars, rc: &mut RenderContext) -> Result<(), R // get value from context data // rc.get_path() is current json parent path, you should always use it like this // param is the key of value you want to display - let chapters = rc.context().navigate(rc.get_path(), &VecDeque::new(), "chapters").to_owned(); + let chapters = rc.context() + .navigate(rc.get_path(), &VecDeque::new(), "chapters")? + .to_owned(); - let current = rc.context().navigate(rc.get_path(), &VecDeque::new(), "path") + let current = rc.context() + .navigate(rc.get_path(), &VecDeque::new(), "path")? .to_string() .replace("\"", ""); diff --git a/src/renderer/html_handlebars/helpers/toc.rs b/src/renderer/html_handlebars/helpers/toc.rs index c7cc074a..454bd667 100644 --- a/src/renderer/html_handlebars/helpers/toc.rs +++ b/src/renderer/html_handlebars/helpers/toc.rs @@ -15,8 +15,13 @@ impl HelperDef for RenderToc { // get value from context data // rc.get_path() is current json parent path, you should always use it like this // param is the key of value you want to display - let chapters = rc.context().navigate(rc.get_path(), &VecDeque::new(), "chapters").to_owned(); - let current = rc.context().navigate(rc.get_path(), &VecDeque::new(), "path").to_string().replace("\"", ""); + let chapters = rc.context() + .navigate(rc.get_path(), &VecDeque::new(), "chapters")? + .to_owned(); + let current = rc.context() + .navigate(rc.get_path(), &VecDeque::new(), "path")? + .to_string() + .replace("\"", ""); try!(rc.writer.write_all("