use CSS to hide elements on certain themes
This commit is contained in:
parent
a3b508fab9
commit
215af5dc1e
|
@ -143,6 +143,9 @@ impl BookBuilder {
|
||||||
let mut variables_css = File::create(cssdir.join("variables.css"))?;
|
let mut variables_css = File::create(cssdir.join("variables.css"))?;
|
||||||
variables_css.write_all(theme::VARIABLES_CSS)?;
|
variables_css.write_all(theme::VARIABLES_CSS)?;
|
||||||
|
|
||||||
|
let mut excludes_css = File::create(cssdir.join("exclude.css"))?;
|
||||||
|
excludes_css.write_all(theme::EXCLUDES_CSS)?;
|
||||||
|
|
||||||
let mut favicon = File::create(themedir.join("favicon.png"))?;
|
let mut favicon = File::create(themedir.join("favicon.png"))?;
|
||||||
favicon.write_all(theme::FAVICON_PNG)?;
|
favicon.write_all(theme::FAVICON_PNG)?;
|
||||||
|
|
||||||
|
|
|
@ -229,6 +229,7 @@ impl HtmlHandlebars {
|
||||||
write_file(destination, "css/print.css", &theme.print_css)?;
|
write_file(destination, "css/print.css", &theme.print_css)?;
|
||||||
}
|
}
|
||||||
write_file(destination, "css/variables.css", &theme.variables_css)?;
|
write_file(destination, "css/variables.css", &theme.variables_css)?;
|
||||||
|
write_file(destination, "css/exclude.css", &theme.excludes_css)?;
|
||||||
if let Some(contents) = &theme.favicon_png {
|
if let Some(contents) = &theme.favicon_png {
|
||||||
write_file(destination, "favicon.png", contents)?;
|
write_file(destination, "favicon.png", contents)?;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
.light .no-light {
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rust .no-rust {
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navy .no-navy {
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ayu .no-ayu {
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.coal .no-coal {
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navy, .ayu, .coal .no-dark {
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
|
@ -21,6 +21,7 @@ pub static CHROME_CSS: &[u8] = include_bytes!("css/chrome.css");
|
||||||
pub static GENERAL_CSS: &[u8] = include_bytes!("css/general.css");
|
pub static GENERAL_CSS: &[u8] = include_bytes!("css/general.css");
|
||||||
pub static PRINT_CSS: &[u8] = include_bytes!("css/print.css");
|
pub static PRINT_CSS: &[u8] = include_bytes!("css/print.css");
|
||||||
pub static VARIABLES_CSS: &[u8] = include_bytes!("css/variables.css");
|
pub static VARIABLES_CSS: &[u8] = include_bytes!("css/variables.css");
|
||||||
|
pub static EXCLUDES_CSS: &[u8] = include_bytes!("css/exclude.css");
|
||||||
pub static FAVICON_PNG: &[u8] = include_bytes!("favicon.png");
|
pub static FAVICON_PNG: &[u8] = include_bytes!("favicon.png");
|
||||||
pub static FAVICON_SVG: &[u8] = include_bytes!("favicon.svg");
|
pub static FAVICON_SVG: &[u8] = include_bytes!("favicon.svg");
|
||||||
pub static JS: &[u8] = include_bytes!("book.js");
|
pub static JS: &[u8] = include_bytes!("book.js");
|
||||||
|
@ -54,6 +55,7 @@ pub struct Theme {
|
||||||
pub general_css: Vec<u8>,
|
pub general_css: Vec<u8>,
|
||||||
pub print_css: Vec<u8>,
|
pub print_css: Vec<u8>,
|
||||||
pub variables_css: Vec<u8>,
|
pub variables_css: Vec<u8>,
|
||||||
|
pub excludes_css: Vec<u8>,
|
||||||
pub favicon_png: Option<Vec<u8>>,
|
pub favicon_png: Option<Vec<u8>>,
|
||||||
pub favicon_svg: Option<Vec<u8>>,
|
pub favicon_svg: Option<Vec<u8>>,
|
||||||
pub js: Vec<u8>,
|
pub js: Vec<u8>,
|
||||||
|
@ -91,6 +93,7 @@ impl Theme {
|
||||||
theme_dir.join("css/variables.css"),
|
theme_dir.join("css/variables.css"),
|
||||||
&mut theme.variables_css,
|
&mut theme.variables_css,
|
||||||
),
|
),
|
||||||
|
(theme_dir.join("css/exclude.css"), &mut theme.excludes_css),
|
||||||
(theme_dir.join("highlight.js"), &mut theme.highlight_js),
|
(theme_dir.join("highlight.js"), &mut theme.highlight_js),
|
||||||
(theme_dir.join("clipboard.min.js"), &mut theme.clipboard_js),
|
(theme_dir.join("clipboard.min.js"), &mut theme.clipboard_js),
|
||||||
(theme_dir.join("highlight.css"), &mut theme.highlight_css),
|
(theme_dir.join("highlight.css"), &mut theme.highlight_css),
|
||||||
|
@ -153,6 +156,7 @@ impl Default for Theme {
|
||||||
general_css: GENERAL_CSS.to_owned(),
|
general_css: GENERAL_CSS.to_owned(),
|
||||||
print_css: PRINT_CSS.to_owned(),
|
print_css: PRINT_CSS.to_owned(),
|
||||||
variables_css: VARIABLES_CSS.to_owned(),
|
variables_css: VARIABLES_CSS.to_owned(),
|
||||||
|
excludes_css: EXCLUDES_CSS.to_owned(),
|
||||||
favicon_png: Some(FAVICON_PNG.to_owned()),
|
favicon_png: Some(FAVICON_PNG.to_owned()),
|
||||||
favicon_svg: Some(FAVICON_SVG.to_owned()),
|
favicon_svg: Some(FAVICON_SVG.to_owned()),
|
||||||
js: JS.to_owned(),
|
js: JS.to_owned(),
|
||||||
|
@ -213,6 +217,7 @@ mod tests {
|
||||||
"css/general.css",
|
"css/general.css",
|
||||||
"css/print.css",
|
"css/print.css",
|
||||||
"css/variables.css",
|
"css/variables.css",
|
||||||
|
"css/exclude.css",
|
||||||
"book.js",
|
"book.js",
|
||||||
"highlight.js",
|
"highlight.js",
|
||||||
"tomorrow-night.css",
|
"tomorrow-night.css",
|
||||||
|
@ -240,6 +245,7 @@ mod tests {
|
||||||
general_css: Vec::new(),
|
general_css: Vec::new(),
|
||||||
print_css: Vec::new(),
|
print_css: Vec::new(),
|
||||||
variables_css: Vec::new(),
|
variables_css: Vec::new(),
|
||||||
|
excludes_css: Vec::new(),
|
||||||
favicon_png: Some(Vec::new()),
|
favicon_png: Some(Vec::new()),
|
||||||
favicon_svg: Some(Vec::new()),
|
favicon_svg: Some(Vec::new()),
|
||||||
js: Vec::new(),
|
js: Vec::new(),
|
||||||
|
|
|
@ -119,6 +119,7 @@ fn copy_theme() {
|
||||||
"css/general.css",
|
"css/general.css",
|
||||||
"css/print.css",
|
"css/print.css",
|
||||||
"css/variables.css",
|
"css/variables.css",
|
||||||
|
"css/exclude.css",
|
||||||
"favicon.png",
|
"favicon.png",
|
||||||
"favicon.svg",
|
"favicon.svg",
|
||||||
"highlight.css",
|
"highlight.css",
|
||||||
|
|
Loading…
Reference in New Issue