diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2019-03-26 23:57:16 +0100 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2019-03-26 23:57:16 +0100 |
| commit | 5652dd677c63d0d1bc7d26f09baceaff7e7525b5 (patch) | |
| tree | 15f5866ba5c946e925aa5192622e057576771f44 | |
| parent | 50c50e3a82e80dcc31f366b81c491fd0bf8ed5ac (diff) | |
| download | rust-5652dd677c63d0d1bc7d26f09baceaff7e7525b5.tar.gz rust-5652dd677c63d0d1bc7d26f09baceaff7e7525b5.zip | |
Fix error index CSS file name
| -rw-r--r-- | src/bootstrap/doc.rs | 1 | ||||
| -rw-r--r-- | src/tools/error_index_generator/main.rs | 20 |
2 files changed, 13 insertions, 8 deletions
diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs index cab6abf74b6..71708a0bdb1 100644 --- a/src/bootstrap/doc.rs +++ b/src/bootstrap/doc.rs @@ -889,6 +889,7 @@ impl Step for ErrorIndex { ); index.arg("html"); index.arg(out.join("error-index.html")); + index.arg(crate::channel::CFG_RELEASE_NUM); // FIXME: shouldn't have to pass this env var index.env("CFG_BUILD", &builder.config.build) diff --git a/src/tools/error_index_generator/main.rs b/src/tools/error_index_generator/main.rs index faeeea605a2..04986b59ea0 100644 --- a/src/tools/error_index_generator/main.rs +++ b/src/tools/error_index_generator/main.rs @@ -27,9 +27,10 @@ enum OutputFormat { } impl OutputFormat { - fn from(format: &str) -> OutputFormat { + fn from(format: &str, resource_suffix: &str) -> OutputFormat { match &*format.to_lowercase() { - "html" => OutputFormat::HTML(HTMLFormatter(RefCell::new(IdMap::new()))), + "html" => OutputFormat::HTML(HTMLFormatter(RefCell::new(IdMap::new()), + resource_suffix.to_owned())), "markdown" => OutputFormat::Markdown(MarkdownFormatter), s => OutputFormat::Unknown(s.to_owned()), } @@ -44,7 +45,7 @@ trait Formatter { fn footer(&self, output: &mut dyn Write) -> Result<(), Box<dyn Error>>; } -struct HTMLFormatter(RefCell<IdMap>); +struct HTMLFormatter(RefCell<IdMap>, String); struct MarkdownFormatter; impl Formatter for HTMLFormatter { @@ -55,7 +56,7 @@ impl Formatter for HTMLFormatter { <title>Rust Compiler Error Index</title> <meta charset="utf-8"> <!-- Include rust.css after light.css so its rules take priority. --> -<link rel="stylesheet" type="text/css" href="light.css"/> +<link rel="stylesheet" type="text/css" href="light{suffix}.css"/> <link rel="stylesheet" type="text/css" href="rust.css"/> <style> .error-undescribed {{ @@ -64,7 +65,7 @@ impl Formatter for HTMLFormatter { </style> </head> <body> -"##)?; +"##, suffix=self.1)?; Ok(()) } @@ -242,9 +243,12 @@ fn main_with_result(format: OutputFormat, dst: &Path) -> Result<(), Box<dyn Erro fn parse_args() -> (OutputFormat, PathBuf) { let mut args = env::args().skip(1); - let format = args.next().map(|a| OutputFormat::from(&a)) - .unwrap_or(OutputFormat::from("html")); - let dst = args.next().map(PathBuf::from).unwrap_or_else(|| { + let format = args.next(); + let dst = args.next(); + let resource_suffix = args.next().unwrap_or_else(String::new); + let format = format.map(|a| OutputFormat::from(&a, &resource_suffix)) + .unwrap_or(OutputFormat::from("html", &resource_suffix)); + let dst = dst.map(PathBuf::from).unwrap_or_else(|| { match format { OutputFormat::HTML(..) => PathBuf::from("doc/error-index.html"), OutputFormat::Markdown(..) => PathBuf::from("doc/error-index.md"), |
