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