@@ -95,6 +95,10 @@ impl HtmlHandlebars {
9595 ch. name . clone ( ) + " - " + book_title
9696 } ;
9797
98+ let rendered_path = path. with_extension ( "html" ) ;
99+
100+ ctx. data
101+ . insert ( "rendered_path" . to_owned ( ) , json ! ( rendered_path) ) ;
98102 ctx. data . insert ( "path" . to_owned ( ) , json ! ( path) ) ;
99103 ctx. data . insert ( "content" . to_owned ( ) , json ! ( content) ) ;
100104 ctx. data . insert ( "chapter_title" . to_owned ( ) , json ! ( ch. name) ) ;
@@ -124,6 +128,8 @@ impl HtmlHandlebars {
124128 utils:: fs:: write_file ( & ctx. destination , & filepath, rendered. as_bytes ( ) ) ?;
125129
126130 if ctx. is_index {
131+ ctx. data
132+ . insert ( "rendered_path" . to_owned ( ) , json ! ( "index.html" ) ) ;
127133 ctx. data . insert ( "path" . to_owned ( ) , json ! ( "index.md" ) ) ;
128134 ctx. data . insert ( "path_to_root" . to_owned ( ) , json ! ( "" ) ) ;
129135 ctx. data . insert ( "is_index" . to_owned ( ) , json ! ( true ) ) ;
@@ -182,6 +188,7 @@ impl HtmlHandlebars {
182188 "/"
183189 } ;
184190 data_404. insert ( "base_url" . to_owned ( ) , json ! ( base_url) ) ;
191+ data_404. insert ( "rendered_path" . to_owned ( ) , json ! ( "404.html" ) ) ;
185192 // Set a dummy path to ensure other paths (e.g. in the TOC) are generated correctly
186193 data_404. insert ( "path" . to_owned ( ) , json ! ( "404.md" ) ) ;
187194 data_404. insert ( "content" . to_owned ( ) , json ! ( html_content_404) ) ;
@@ -360,6 +367,7 @@ impl HtmlHandlebars {
360367 // the last rendered chapter by removing it from its context
361368 data. remove ( "title" ) ;
362369 data. insert ( "is_print" . to_owned ( ) , json ! ( true ) ) ;
370+ data. insert ( "rendered_path" . to_owned ( ) , json ! ( "print.html" ) ) ;
363371 data. insert ( "path" . to_owned ( ) , json ! ( "print.md" ) ) ;
364372 data. insert ( "content" . to_owned ( ) , json ! ( print_content) ) ;
365373 data. insert (
0 commit comments