mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Rollup merge of #147047 - notriddle:toolbar-index, r=GuillaumeGomez
rustdoc: put the toolbar on the all item index
This commit is contained in:
@@ -603,7 +603,12 @@ fn print_entries(e: &FxIndexSet<ItemEntry>, kind: ItemSection) -> impl fmt::Disp
|
||||
}
|
||||
|
||||
fmt::from_fn(|f| {
|
||||
f.write_str("<h1>List of all items</h1>")?;
|
||||
f.write_str(
|
||||
"<div class=\"main-heading\">\
|
||||
<h1>List of all items</h1>\
|
||||
<rustdoc-toolbar></rustdoc-toolbar>\
|
||||
</div>",
|
||||
)?;
|
||||
// Note: print_entries does not escape the title, because we know the current set of titles
|
||||
// doesn't require escaping.
|
||||
print_entries(&self.structs, ItemSection::Structs).fmt(f)?;
|
||||
|
||||
@@ -386,8 +386,13 @@ fn blank(cx: &Context<'_>) -> SortedTemplate<<Self as CciPart>::FileFormat> {
|
||||
let layout = &cx.shared.layout;
|
||||
let style_files = &cx.shared.style_files;
|
||||
const DELIMITER: &str = "\u{FFFC}"; // users are being naughty if they have this
|
||||
let content =
|
||||
format!("<h1>List of all crates</h1><ul class=\"all-items\">{DELIMITER}</ul>");
|
||||
let content = format!(
|
||||
"<div class=\"main-heading\">\
|
||||
<h1>List of all crates</h1>\
|
||||
<rustdoc-toolbar></rustdoc-toolbar>\
|
||||
</div>\
|
||||
<ul class=\"all-items\">{DELIMITER}</ul>"
|
||||
);
|
||||
let template = layout::render(layout, &page, "", content, style_files);
|
||||
SortedTemplate::from_template(&template, DELIMITER)
|
||||
.expect("Object Replacement Character (U+FFFC) should not appear in the --index-page")
|
||||
|
||||
@@ -20,3 +20,15 @@ assert-document-property: {"title": '"another one" Search - Rust'}
|
||||
press-key: "Escape"
|
||||
|
||||
assert-document-property: {"title": |title|}
|
||||
|
||||
// check that all.html does it correctly, too.
|
||||
go-to: "file://" + |DOC_PATH| + "/test_docs/all.html"
|
||||
assert-document-property: {"title": "List of all items in this crate"}
|
||||
call-function: ("perform-search", {"query": "verify"})
|
||||
assert-document-property: {"title": '"verify" Search - Rust'}
|
||||
|
||||
// check that index.html does it correctly, too.
|
||||
go-to: "file://" + |DOC_PATH| + "/index.html"
|
||||
assert-document-property: {"title": "Index of crates"}
|
||||
call-function: ("perform-search", {"query": "verify"})
|
||||
assert-document-property: {"title": '"verify" Search - Rust'}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//@ compile-flags: --enable-index-page -Z unstable-options
|
||||
//! The point of this crate is to be able to have enough different "kinds" of
|
||||
//! documentation generated so we can test each different features.
|
||||
#![doc(html_playground_url="https://play.rust-lang.org/")]
|
||||
|
||||
Reference in New Issue
Block a user