@@ -95,6 +95,9 @@ impl HtmlHandlebars {
95
95
ch. name . clone ( ) + " - " + book_title
96
96
} ;
97
97
98
+ let rendered_path = path. with_extension ( "html" ) ;
99
+
100
+ ctx. data . insert ( "rendered_path" . to_owned ( ) , json ! ( rendered_path) ) ;
98
101
ctx. data . insert ( "path" . to_owned ( ) , json ! ( path) ) ;
99
102
ctx. data . insert ( "content" . to_owned ( ) , json ! ( content) ) ;
100
103
ctx. data . insert ( "chapter_title" . to_owned ( ) , json ! ( ch. name) ) ;
@@ -124,6 +127,7 @@ impl HtmlHandlebars {
124
127
utils:: fs:: write_file ( & ctx. destination , & filepath, rendered. as_bytes ( ) ) ?;
125
128
126
129
if ctx. is_index {
130
+ ctx. data . insert ( "rendered_path" . to_owned ( ) , json ! ( "index.html" ) ) ;
127
131
ctx. data . insert ( "path" . to_owned ( ) , json ! ( "index.md" ) ) ;
128
132
ctx. data . insert ( "path_to_root" . to_owned ( ) , json ! ( "" ) ) ;
129
133
ctx. data . insert ( "is_index" . to_owned ( ) , json ! ( true ) ) ;
@@ -182,6 +186,7 @@ impl HtmlHandlebars {
182
186
"/"
183
187
} ;
184
188
data_404. insert ( "base_url" . to_owned ( ) , json ! ( base_url) ) ;
189
+ data_404. insert ( "rendered_path" . to_owned ( ) , json ! ( "404.html" ) ) ;
185
190
// Set a dummy path to ensure other paths (e.g. in the TOC) are generated correctly
186
191
data_404. insert ( "path" . to_owned ( ) , json ! ( "404.md" ) ) ;
187
192
data_404. insert ( "content" . to_owned ( ) , json ! ( html_content_404) ) ;
@@ -360,6 +365,7 @@ impl HtmlHandlebars {
360
365
// the last rendered chapter by removing it from its context
361
366
data. remove ( "title" ) ;
362
367
data. insert ( "is_print" . to_owned ( ) , json ! ( true ) ) ;
368
+ data. insert ( "rendered_path" . to_owned ( ) , json ! ( "print.html" ) ) ;
363
369
data. insert ( "path" . to_owned ( ) , json ! ( "print.md" ) ) ;
364
370
data. insert ( "content" . to_owned ( ) , json ! ( print_content) ) ;
365
371
data. insert (
0 commit comments