1
Fork 0

Apply review comments

This commit is contained in:
Guillaume Gomez 2019-10-10 12:09:01 +02:00
parent 8f9014d98f
commit 530d866aef
3 changed files with 9 additions and 9 deletions

View file

@ -374,7 +374,7 @@ Note that the theme's name will be the file name without its extension. So if yo
### `check-theme`: check if your themes implement all the required rules ### `check-theme`: check if your themes implement all the required rules
This flag allows you to check if your themes implement the necessary CSS rules. To put it more This flag allows you to check if your themes implement the necessary CSS rules. To put it more
simply, when adding a new theme, it needs to implements all the CSS rules present in the "light" simply, when adding a new theme, it needs to implement all the CSS rules present in the "light"
CSS theme. CSS theme.
You can use this flag like this: You can use this flag like this:

View file

@ -1,6 +1,7 @@
use std::path::PathBuf; use std::path::PathBuf;
use crate::externalfiles::ExternalHtml; use crate::externalfiles::ExternalHtml;
use crate::html::escape::Escape;
use crate::html::render::ensure_trailing_slash; use crate::html::render::ensure_trailing_slash;
use crate::html::format::{Buffer, Print}; use crate::html::format::{Buffer, Print};
@ -166,10 +167,11 @@ pub fn render<T: Print, S: Print>(
themes = themes.iter() themes = themes.iter()
.filter_map(|t| t.file_stem()) .filter_map(|t| t.file_stem())
.filter_map(|t| t.to_str()) .filter_map(|t| t.to_str())
.map(|t| format!(r#"<link rel="stylesheet" type="text/css" href="{}{}{}.css">"#, .map(|t| format!(r#"<link rel="stylesheet" type="text/css" href="{}.css">"#,
Escape(&format!("{}{}{}",
static_root_path, static_root_path,
t, t,
page.resource_suffix)) page.resource_suffix))))
.collect::<String>(), .collect::<String>(),
suffix=page.resource_suffix, suffix=page.resource_suffix,
static_extra_scripts=page.static_extra_scripts.iter().map(|e| { static_extra_scripts=page.static_extra_scripts.iter().map(|e| {

View file

@ -569,9 +569,7 @@ fn write_shared(
let content = try_err!(fs::read(&entry), &entry); let content = try_err!(fs::read(&entry), &entry);
let theme = try_none!(try_none!(entry.file_stem(), &entry).to_str(), &entry); let theme = try_none!(try_none!(entry.file_stem(), &entry).to_str(), &entry);
let extension = try_none!(try_none!(entry.extension(), &entry).to_str(), &entry); let extension = try_none!(try_none!(entry.extension(), &entry).to_str(), &entry);
cx.shared.fs.write( cx.shared.fs.write(cx.path(&format!("{}.{}", theme, extension)), content.as_slice())?;
cx.path(&format!("{}.{}", Escape(theme), extension)),
content.as_slice())?;
themes.insert(theme.to_owned()); themes.insert(theme.to_owned());
} }
@ -637,7 +635,7 @@ themePicker.onclick = switchThemeButtonState;
themePicker.onblur = handleThemeButtonsBlur; themePicker.onblur = handleThemeButtonsBlur;
{}.forEach(function(item) {{ {}.forEach(function(item) {{
var but = document.createElement('button'); var but = document.createElement('button');
but.innerHTML = item; but.textContent = item;
but.onclick = function(el) {{ but.onclick = function(el) {{
switchTheme(currentTheme, mainTheme, item, true); switchTheme(currentTheme, mainTheme, item, true);
}}; }};