Skip to content

Commit

Permalink
Rollup merge of #101813 - GuillaumeGomez:check-css-variables, r=notri…
Browse files Browse the repository at this point in the history
…ddle

Extend CSS check to CSS variables

This PR is a bit big because the first commit is a rewrite of the CSS parser to something a bit simpler which still allows to get easily access to CSS properties name.

The other two are about adding tests and adding the CSS variables check.

This check was missing because we are relying more and more on CSS variables rather than CSS selectors in themes.

r? `@notriddle`
  • Loading branch information
GuillaumeGomez authored Sep 16, 2022
2 parents e96abef + d3529ce commit 6f8d41c
Show file tree
Hide file tree
Showing 3 changed files with 296 additions and 233 deletions.
16 changes: 14 additions & 2 deletions src/librustdoc/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,13 @@ impl Options {

let to_check = matches.opt_strs("check-theme");
if !to_check.is_empty() {
let paths = theme::load_css_paths(static_files::themes::LIGHT.as_bytes());
let paths = match theme::load_css_paths(static_files::themes::LIGHT) {
Ok(p) => p,
Err(e) => {
diag.struct_err(&e.to_string()).emit();
return Err(1);
}
};
let mut errors = 0;

println!("rustdoc: [check-theme] Starting tests! (Ignoring all other arguments)");
Expand Down Expand Up @@ -547,7 +553,13 @@ impl Options {

let mut themes = Vec::new();
if matches.opt_present("theme") {
let paths = theme::load_css_paths(static_files::themes::LIGHT.as_bytes());
let paths = match theme::load_css_paths(static_files::themes::LIGHT) {
Ok(p) => p,
Err(e) => {
diag.struct_err(&e.to_string()).emit();
return Err(1);
}
};

for (theme_file, theme_s) in
matches.opt_strs("theme").iter().map(|s| (PathBuf::from(&s), s.to_owned()))
Expand Down
Loading

0 comments on commit 6f8d41c

Please sign in to comment.