1
1
use std:: cell:: RefCell ;
2
2
use std:: collections:: BTreeMap ;
3
- use std:: error:: Error as StdError ;
4
3
use std:: io;
5
4
use std:: path:: { Path , PathBuf } ;
6
5
use std:: rc:: Rc ;
@@ -16,6 +15,7 @@ use rustc_span::symbol::sym;
16
15
17
16
use super :: cache:: { build_index, ExternalLocation } ;
18
17
use super :: print_item:: { full_path, item_path, print_item} ;
18
+ use super :: templates;
19
19
use super :: write_shared:: write_shared;
20
20
use super :: {
21
21
collect_spans_and_sources, print_sidebar, settings, AllTypes , LinkFromSrc , NameDoc , StylePath ,
@@ -33,7 +33,6 @@ use crate::formats::FormatRenderer;
33
33
use crate :: html:: escape:: Escape ;
34
34
use crate :: html:: format:: Buffer ;
35
35
use crate :: html:: markdown:: { self , plain_text_summary, ErrorCodes , IdMap } ;
36
- use crate :: html:: static_files:: { PAGE , PRINT_ITEM } ;
37
36
use crate :: html:: { layout, sources} ;
38
37
39
38
/// Major driving force in all rustdoc rendering. This contains information
@@ -416,16 +415,7 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
416
415
} ;
417
416
let mut issue_tracker_base_url = None ;
418
417
let mut include_sources = true ;
419
-
420
- let mut templates = tera:: Tera :: default ( ) ;
421
- templates. add_raw_template ( "page.html" , PAGE ) . map_err ( |e| Error {
422
- file : "page.html" . into ( ) ,
423
- error : format ! ( "{}: {}" , e, e. source( ) . map( |e| e. to_string( ) ) . unwrap_or_default( ) ) ,
424
- } ) ?;
425
- templates. add_raw_template ( "print_item.html" , PRINT_ITEM ) . map_err ( |e| Error {
426
- file : "print_item.html" . into ( ) ,
427
- error : format ! ( "{}: {}" , e, e. source( ) . map( |e| e. to_string( ) ) . unwrap_or_default( ) ) ,
428
- } ) ?;
418
+ let templates = templates:: load ( ) ?;
429
419
430
420
// Crawl the crate attributes looking for attributes which control how we're
431
421
// going to emit HTML
0 commit comments