@@ -95,6 +95,9 @@ impl HtmlHandlebars {
9595 ch. name . clone ( ) + " - " + book_title
9696 } ;
9797
98+ let rendered_path = path. with_extension ( "html" ) ;
99+
100+ ctx. data . insert ( "rendered_path" . to_owned ( ) , json ! ( rendered_path) ) ;
98101 ctx. data . insert ( "path" . to_owned ( ) , json ! ( path) ) ;
99102 ctx. data . insert ( "content" . to_owned ( ) , json ! ( content) ) ;
100103 ctx. data . insert ( "chapter_title" . to_owned ( ) , json ! ( ch. name) ) ;
@@ -124,6 +127,7 @@ impl HtmlHandlebars {
124127 utils:: fs:: write_file ( & ctx. destination , & filepath, rendered. as_bytes ( ) ) ?;
125128
126129 if ctx. is_index {
130+ ctx. data . insert ( "rendered_path" . to_owned ( ) , json ! ( "index.html" ) ) ;
127131 ctx. data . insert ( "path" . to_owned ( ) , json ! ( "index.md" ) ) ;
128132 ctx. data . insert ( "path_to_root" . to_owned ( ) , json ! ( "" ) ) ;
129133 ctx. data . insert ( "is_index" . to_owned ( ) , json ! ( true ) ) ;
@@ -182,6 +186,7 @@ impl HtmlHandlebars {
182186 "/"
183187 } ;
184188 data_404. insert ( "base_url" . to_owned ( ) , json ! ( base_url) ) ;
189+ data_404. insert ( "rendered_path" . to_owned ( ) , json ! ( "404.html" ) ) ;
185190 // Set a dummy path to ensure other paths (e.g. in the TOC) are generated correctly
186191 data_404. insert ( "path" . to_owned ( ) , json ! ( "404.md" ) ) ;
187192 data_404. insert ( "content" . to_owned ( ) , json ! ( html_content_404) ) ;
@@ -360,6 +365,7 @@ impl HtmlHandlebars {
360365 // the last rendered chapter by removing it from its context
361366 data. remove ( "title" ) ;
362367 data. insert ( "is_print" . to_owned ( ) , json ! ( true ) ) ;
368+ data. insert ( "rendered_path" . to_owned ( ) , json ! ( "print.html" ) ) ;
363369 data. insert ( "path" . to_owned ( ) , json ! ( "print.md" ) ) ;
364370 data. insert ( "content" . to_owned ( ) , json ! ( print_content) ) ;
365371 data. insert (
0 commit comments