1
Fork 0

Auto merge of #57006 - GuillaumeGomez:no-crate-filter, r=QuietMisdreavus

Add no-crate filter option on rustdoc

@onur asked me about it so here it is!

r? @QuietMisdreavus
This commit is contained in:
bors 2018-12-29 01:22:04 +00:00
commit 43d26b1f35
9 changed files with 78 additions and 19 deletions

View file

@ -133,6 +133,9 @@ struct SharedContext {
/// Optional path string to be used to load static files on output pages. If not set, uses
/// combinations of `../` to reach the documentation root.
pub static_root_path: Option<String>,
/// If false, the `select` element to have search filtering by crates on rendered docs
/// won't be generated.
pub generate_search_filter: bool,
}
impl SharedContext {
@ -500,6 +503,7 @@ pub fn run(mut krate: clean::Crate,
extern_html_root_urls,
resource_suffix,
static_root_path,
generate_search_filter,
..
} = options;
@ -528,6 +532,7 @@ pub fn run(mut krate: clean::Crate,
themes,
resource_suffix,
static_root_path,
generate_search_filter,
};
// If user passed in `--playground-url` arg, we fill in crate name here
@ -1099,7 +1104,8 @@ themePicker.onblur = handleThemeButtonsBlur;
try_err!(layout::render(&mut w, &cx.shared.layout,
&page, &(""), &content,
cx.shared.css_file_extension.is_some(),
&cx.shared.themes), &dst);
&cx.shared.themes,
cx.shared.generate_search_filter), &dst);
try_err!(w.flush(), &dst);
}
}
@ -1372,7 +1378,8 @@ impl<'a> SourceCollector<'a> {
layout::render(&mut w, &self.scx.layout,
&page, &(""), &Source(contents),
self.scx.css_file_extension.is_some(),
&self.scx.themes)?;
&self.scx.themes,
self.scx.generate_search_filter)?;
w.flush()?;
self.scx.local_sources.insert(p.clone(), href);
Ok(())
@ -1974,7 +1981,8 @@ impl Context {
try_err!(layout::render(&mut w, &self.shared.layout,
&page, &sidebar, &all,
self.shared.css_file_extension.is_some(),
&self.shared.themes),
&self.shared.themes,
self.shared.generate_search_filter),
&final_file);
// Generating settings page.
@ -1994,7 +2002,8 @@ impl Context {
try_err!(layout::render(&mut w, &layout,
&page, &sidebar, &settings,
self.shared.css_file_extension.is_some(),
&themes),
&themes,
self.shared.generate_search_filter),
&settings_file);
Ok(())
@ -2055,7 +2064,8 @@ impl Context {
&Sidebar{ cx: self, item: it },
&Item{ cx: self, item: it },
self.shared.css_file_extension.is_some(),
&self.shared.themes)?;
&self.shared.themes,
self.shared.generate_search_filter)?;
} else {
let mut url = self.root_path();
if let Some(&(ref names, ty)) = cache().paths.get(&it.def_id) {