File tree Expand file tree Collapse file tree 4 files changed +25
-7
lines changed Expand file tree Collapse file tree 4 files changed +25
-7
lines changed Original file line number Diff line number Diff line change @@ -19,8 +19,8 @@ pub(crate) fn rewrite_lol(
19
19
use lol_html:: { HtmlRewriter , MemorySettings , Settings } ;
20
20
21
21
let head_html = Head :: new ( data) . render ( ) . unwrap ( ) ;
22
- let vendored_html = Vendored :: new ( data ) . render ( ) . unwrap ( ) ;
23
- let body_html = Body :: new ( data ) . render ( ) . unwrap ( ) ;
22
+ let vendored_html = Vendored . render ( ) . unwrap ( ) ;
23
+ let body_html = Body . render ( ) . unwrap ( ) ;
24
24
let topbar_html = Topbar :: new ( data) . render ( ) . unwrap ( ) ;
25
25
26
26
// Before: <body> ... rustdoc content ... </body>
Original file line number Diff line number Diff line change @@ -36,9 +36,28 @@ macro_rules! rustdoc_page {
36
36
} ;
37
37
}
38
38
39
- rustdoc_page ! ( Head , "rustdoc/head.html" ) ;
40
- rustdoc_page ! ( Vendored , "rustdoc/vendored.html" ) ;
41
- rustdoc_page ! ( Body , "rustdoc/body.html" ) ;
39
+ #[ derive( Template ) ]
40
+ #[ template( path = "rustdoc/head.html" ) ]
41
+ pub struct Head < ' a > {
42
+ rustdoc_css_file : & ' a Option < String > ,
43
+ }
44
+
45
+ impl < ' a > Head < ' a > {
46
+ pub fn new ( inner : & ' a RustdocPage ) -> Self {
47
+ Self {
48
+ rustdoc_css_file : & inner. metadata . rustdoc_css_file ,
49
+ }
50
+ }
51
+ }
52
+
53
+ #[ derive( Template ) ]
54
+ #[ template( path = "rustdoc/vendored.html" ) ]
55
+ pub struct Vendored ;
56
+
57
+ #[ derive( Template ) ]
58
+ #[ template( path = "rustdoc/body.html" ) ]
59
+ pub struct Body ;
60
+
42
61
rustdoc_page ! ( Topbar , "rustdoc/topbar.html" , get_metadata) ;
43
62
44
63
/// Holds all data relevant to templating
Original file line number Diff line number Diff line change 6
6
{%- endblock title -%}
7
7
8
8
{%- block topbar -%}
9
- {%- set metadata = metadata -%}
10
9
{%- set current_target = String::new() -%}
11
10
{%- set latest_version = "" -%}
12
11
{%- set latest_path = "" -%}
Original file line number Diff line number Diff line change 1
1
{%- import "macros.html" as macros -%}
2
- < link rel ="stylesheet " href ="/-/static/{{metadata. rustdoc_css_file|unwrap}}?{{ crate::BUILD_VERSION|slugify }} " media ="all " />
2
+ < link rel ="stylesheet " href ="/-/static/{{rustdoc_css_file|unwrap}}?{{ crate::BUILD_VERSION|slugify }} " media ="all " />
3
3
4
4
< link rel ="search " href ="/-/static/opensearch.xml " type ="application/opensearchdescription+xml " title ="Docs.rs " />
5
5
You can’t perform that action at this time.
0 commit comments