@@ -27,9 +27,10 @@ enum OutputFormat {
27
27
}
28
28
29
29
impl OutputFormat {
30
- fn from ( format : & str ) -> OutputFormat {
30
+ fn from ( format : & str , resource_suffix : & str ) -> OutputFormat {
31
31
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 ( ) ) ) ,
33
34
"markdown" => OutputFormat :: Markdown ( MarkdownFormatter ) ,
34
35
s => OutputFormat :: Unknown ( s. to_owned ( ) ) ,
35
36
}
@@ -44,7 +45,7 @@ trait Formatter {
44
45
fn footer ( & self , output : & mut dyn Write ) -> Result < ( ) , Box < dyn Error > > ;
45
46
}
46
47
47
- struct HTMLFormatter ( RefCell < IdMap > ) ;
48
+ struct HTMLFormatter ( RefCell < IdMap > , String ) ;
48
49
struct MarkdownFormatter ;
49
50
50
51
impl Formatter for HTMLFormatter {
@@ -55,7 +56,7 @@ impl Formatter for HTMLFormatter {
55
56
<title>Rust Compiler Error Index</title>
56
57
<meta charset="utf-8">
57
58
<!-- 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"/>
59
60
<link rel="stylesheet" type="text/css" href="rust.css"/>
60
61
<style>
61
62
.error-undescribed {{
@@ -64,7 +65,7 @@ impl Formatter for HTMLFormatter {
64
65
</style>
65
66
</head>
66
67
<body>
67
- "## ) ?;
68
+ "## , suffix= self . 1 ) ?;
68
69
Ok ( ( ) )
69
70
}
70
71
@@ -242,9 +243,12 @@ fn main_with_result(format: OutputFormat, dst: &Path) -> Result<(), Box<dyn Erro
242
243
243
244
fn parse_args ( ) -> ( OutputFormat , PathBuf ) {
244
245
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 ( || {
248
252
match format {
249
253
OutputFormat :: HTML ( ..) => PathBuf :: from ( "doc/error-index.html" ) ,
250
254
OutputFormat :: Markdown ( ..) => PathBuf :: from ( "doc/error-index.md" ) ,
0 commit comments