@@ -27,9 +27,10 @@ enum OutputFormat {
2727}
2828
2929impl OutputFormat {
30- fn from ( format : & str ) -> OutputFormat {
30+ fn from ( format : & str , resource_suffix : & str ) -> OutputFormat {
3131 match & * format. to_lowercase ( ) {
32- "html" => OutputFormat :: HTML ( HTMLFormatter ( RefCell :: new ( IdMap :: new ( ) ) ) ) ,
32+ "html" => OutputFormat :: HTML ( HTMLFormatter ( RefCell :: new ( IdMap :: new ( ) ) ,
33+ resource_suffix. to_owned ( ) ) ) ,
3334 "markdown" => OutputFormat :: Markdown ( MarkdownFormatter ) ,
3435 s => OutputFormat :: Unknown ( s. to_owned ( ) ) ,
3536 }
@@ -44,7 +45,7 @@ trait Formatter {
4445 fn footer ( & self , output : & mut dyn Write ) -> Result < ( ) , Box < dyn Error > > ;
4546}
4647
47- struct HTMLFormatter ( RefCell < IdMap > ) ;
48+ struct HTMLFormatter ( RefCell < IdMap > , String ) ;
4849struct MarkdownFormatter ;
4950
5051impl Formatter for HTMLFormatter {
@@ -55,7 +56,7 @@ impl Formatter for HTMLFormatter {
5556<title>Rust Compiler Error Index</title>
5657<meta charset="utf-8">
5758<!-- Include rust.css after light.css so its rules take priority. -->
58- <link rel="stylesheet" type="text/css" href="light.css"/>
59+ <link rel="stylesheet" type="text/css" href="light{suffix} .css"/>
5960<link rel="stylesheet" type="text/css" href="rust.css"/>
6061<style>
6162.error-undescribed {{
@@ -64,7 +65,7 @@ impl Formatter for HTMLFormatter {
6465</style>
6566</head>
6667<body>
67- "## ) ?;
68+ "## , suffix= self . 1 ) ?;
6869 Ok ( ( ) )
6970 }
7071
@@ -242,9 +243,12 @@ fn main_with_result(format: OutputFormat, dst: &Path) -> Result<(), Box<dyn Erro
242243
243244fn parse_args ( ) -> ( OutputFormat , PathBuf ) {
244245 let mut args = env:: args ( ) . skip ( 1 ) ;
245- let format = args. next ( ) . map ( |a| OutputFormat :: from ( & a) )
246- . unwrap_or ( OutputFormat :: from ( "html" ) ) ;
247- let dst = args. next ( ) . map ( PathBuf :: from) . unwrap_or_else ( || {
246+ let format = args. next ( ) ;
247+ let dst = args. next ( ) ;
248+ let resource_suffix = args. next ( ) . unwrap_or_else ( String :: new) ;
249+ let format = format. map ( |a| OutputFormat :: from ( & a, & resource_suffix) )
250+ . unwrap_or ( OutputFormat :: from ( "html" , & resource_suffix) ) ;
251+ let dst = dst. map ( PathBuf :: from) . unwrap_or_else ( || {
248252 match format {
249253 OutputFormat :: HTML ( ..) => PathBuf :: from ( "doc/error-index.html" ) ,
250254 OutputFormat :: Markdown ( ..) => PathBuf :: from ( "doc/error-index.md" ) ,
0 commit comments