Skip to content

Commit

Permalink
rename check-theme option into check-themes
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Nov 18, 2019
1 parent bbfd63c commit 7cbf31a
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/librustdoc/config.rs
Expand Up @@ -282,12 +282,12 @@ impl Options {
// check for deprecated options
check_deprecated_options(&matches, &diag);

let to_check = matches.opt_strs("check-theme");
let to_check = matches.opt_strs("check-themes");
if !to_check.is_empty() {
let paths = theme::load_css_paths(static_files::themes::LIGHT.as_bytes());
let mut errors = 0;

println!("rustdoc: [check-theme] Starting tests! (Ignoring all other arguments)");
println!("rustdoc: [check-themes] Starting tests! (Ignoring all other arguments)");
for theme_file in to_check.iter() {
print!(" - Checking \"{}\"...", theme_file);
let (success, differences) = theme::test_theme_against(theme_file, &paths, &diag);
Expand Down Expand Up @@ -384,7 +384,7 @@ impl Options {
default theme", theme_s))
.warn("the theme may appear incorrect when loaded")
.help(&format!("to see what rules are missing, call `rustdoc \
--check-theme \"{}\"`", theme_s))
--check-themes \"{}\"`", theme_s))
.emit();
}
themes.push(theme_file);
Expand Down
7 changes: 2 additions & 5 deletions src/librustdoc/html/render.rs
Expand Up @@ -635,7 +635,7 @@ function handleThemeButtonsBlur(e) {{
themePicker.onclick = switchThemeButtonState;
themePicker.onblur = handleThemeButtonsBlur;
[{}].forEach(function(item) {{
{}.forEach(function(item) {{
var but = document.createElement('button');
but.innerHTML = item;
but.onclick = function(el) {{
Expand All @@ -644,10 +644,7 @@ themePicker.onblur = handleThemeButtonsBlur;
but.onblur = handleThemeButtonsBlur;
themes.appendChild(but);
}});"#,
themes.iter()
.map(|s| format!("\"{}\"", s.replace("\\", "\\\\").replace("\"", "\\\"")))
.collect::<Vec<String>>()
.join(","));
as_json(&themes));
write(cx.dst.join(&format!("theme{}.js", cx.shared.resource_suffix)),
theme_js.as_bytes()
)?;
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/html/static_files.rs
Expand Up @@ -59,7 +59,7 @@ pub static RUST_FAVICON: &'static [u8] = include_bytes!("static/favicon.ico");
/// The built-in themes given to every documentation site.
pub mod themes {
/// The "light" theme, selected by default when no setting is available. Used as the basis for
/// the `--check-theme` functionality.
/// the `--check-themes` functionality.
pub static LIGHT: &'static str = include_str!("static/themes/light.css");

/// The "dark" theme.
Expand Down
4 changes: 2 additions & 2 deletions src/librustdoc/lib.rs
Expand Up @@ -256,8 +256,8 @@ fn opts() -> Vec<RustcOptGroup> {
"additional themes which will be added to the generated docs",
"FILES")
}),
stable("check-theme", |o| {
o.optmulti("", "check-theme",
stable("check-themes", |o| {
o.optmulti("", "check-themes",
"check if given theme is valid",
"FILES")
}),
Expand Down
2 changes: 1 addition & 1 deletion src/tools/rustdoc-themes/main.rs
Expand Up @@ -39,7 +39,7 @@ fn main() {
exit(1);
}
let status = Command::new(rustdoc_bin)
.args(&["-Z", "unstable-options", "--check-theme"])
.args(&["-Z", "unstable-options", "--check-themes"])
.args(&themes)
.status()
.expect("failed to execute child");
Expand Down

0 comments on commit 7cbf31a

Please sign in to comment.