Use Tera templates for rustdoc.
Replaces a format!() call in layout::render with a template expansion. Introduces a `templates` field in SharedContext so parts of rustdoc can share pre-rendered templates. This currently builds in a copy of the single template available, like with static files. However, future work can make this live-loadable with a perma-unstable flag, to make rustdoc developers' work easier.
This commit is contained in:
parent
50a407200b
commit
cd0f93193c
10 changed files with 252 additions and 176 deletions
|
@ -460,7 +460,14 @@ pub(super) fn write_shared(
|
|||
})
|
||||
.collect::<String>()
|
||||
);
|
||||
let v = layout::render(&cx.shared.layout, &page, "", content, &cx.shared.style_files);
|
||||
let v = layout::render(
|
||||
&cx.shared.templates,
|
||||
&cx.shared.layout,
|
||||
&page,
|
||||
"",
|
||||
content,
|
||||
&cx.shared.style_files,
|
||||
);
|
||||
cx.shared.fs.write(&dst, v.as_bytes())?;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue