@@ -17,10 +17,11 @@ use super::print_item::{full_path, item_path, print_item};
17
17
use super :: search_index:: build_index;
18
18
use super :: write_shared:: write_shared;
19
19
use super :: {
20
- collect_spans_and_sources, print_sidebar, scrape_examples_help, sidebar_module_like, AllTypes ,
21
- LinkFromSrc , StylePath ,
20
+ collect_spans_and_sources, scrape_examples_help,
21
+ sidebar:: print_sidebar,
22
+ sidebar:: { sidebar_module_like, Sidebar } ,
23
+ AllTypes , LinkFromSrc , StylePath ,
22
24
} ;
23
-
24
25
use crate :: clean:: { self , types:: ExternalLocation , ExternalCrate } ;
25
26
use crate :: config:: { ModuleSorting , RenderOptions } ;
26
27
use crate :: docfs:: { DocFS , PathError } ;
@@ -35,6 +36,7 @@ use crate::html::url_parts_builder::UrlPartsBuilder;
35
36
use crate :: html:: { layout, sources, static_files} ;
36
37
use crate :: scrape_examples:: AllCallLocations ;
37
38
use crate :: try_err;
39
+ use askama:: Template ;
38
40
39
41
/// Major driving force in all rustdoc rendering. This contains information
40
42
/// about where in the tree-like hierarchy rendering is occurring and controls
@@ -600,15 +602,18 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
600
602
} ;
601
603
let all = shared. all . replace ( AllTypes :: new ( ) ) ;
602
604
let mut sidebar = Buffer :: html ( ) ;
603
- write ! ( sidebar, "<h2 class=\" location\" ><a href=\" #\" >Crate {}</a></h2>" , crate_name) ;
604
-
605
- let mut items = Buffer :: html ( ) ;
606
- sidebar_module_like ( & mut items, all. item_sections ( ) ) ;
607
- if !items. is_empty ( ) {
608
- sidebar. push_str ( "<div class=\" sidebar-elems\" >" ) ;
609
- sidebar. push_buffer ( items) ;
610
- sidebar. push_str ( "</div>" ) ;
611
- }
605
+
606
+ let blocks = sidebar_module_like ( all. item_sections ( ) ) ;
607
+ let bar = Sidebar {
608
+ title_prefix : "Crate " ,
609
+ title : crate_name. as_str ( ) ,
610
+ is_crate : false ,
611
+ version : "" ,
612
+ blocks : vec ! [ blocks] ,
613
+ path : String :: new ( ) ,
614
+ } ;
615
+
616
+ bar. render_into ( & mut sidebar) . unwrap ( ) ;
612
617
613
618
let v = layout:: render (
614
619
& shared. layout ,
0 commit comments