about summary refs log tree commit diff
path: root/src/librustdoc
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2019-09-14 17:43:10 +0200
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2019-11-18 16:43:48 +0100
commit7cbf31aa04679b6a9ccf7b19f9752be8a65e0245 (patch)
tree079a4f8b781f035e4c0e3e052d7bb762ed23baa3 /src/librustdoc
parentbbfd63c89afe091fa9ec75bba0a5721d153d78f3 (diff)
downloadrust-7cbf31aa04679b6a9ccf7b19f9752be8a65e0245.tar.gz
rust-7cbf31aa04679b6a9ccf7b19f9752be8a65e0245.zip
rename check-theme option into check-themes
Diffstat (limited to 'src/librustdoc')
-rw-r--r--src/librustdoc/config.rs6
-rw-r--r--src/librustdoc/html/render.rs7
-rw-r--r--src/librustdoc/html/static_files.rs2
-rw-r--r--src/librustdoc/lib.rs4
4 files changed, 8 insertions, 11 deletions
diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs
index 38e0e34be61..85feb89d7d5 100644
--- a/src/librustdoc/config.rs
+++ b/src/librustdoc/config.rs
@@ -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);
@@ -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);
diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs
index 60bb159c45f..dda4b024bce 100644
--- a/src/librustdoc/html/render.rs
+++ b/src/librustdoc/html/render.rs
@@ -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) {{
@@ -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()
     )?;
diff --git a/src/librustdoc/html/static_files.rs b/src/librustdoc/html/static_files.rs
index 9fc1d76185f..8702ba224db 100644
--- a/src/librustdoc/html/static_files.rs
+++ b/src/librustdoc/html/static_files.rs
@@ -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.
diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs
index 03a0f34b39b..6241ae7a3bb 100644
--- a/src/librustdoc/lib.rs
+++ b/src/librustdoc/lib.rs
@@ -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")
         }),