add map for pseudo elements
This commit is contained in:
parent
fa22940ac1
commit
28d7886ee8
|
@ -28,12 +28,13 @@ impl<'a> Class<'a> {
|
||||||
|
|
||||||
if let Some(pseudo) = pseudo {
|
if let Some(pseudo) = pseudo {
|
||||||
rest.push_str("::");
|
rest.push_str("::");
|
||||||
|
let pseudo: &str = z.pseudos.get(*pseudo).map(AsRef::as_ref).unwrap_or(pseudo);
|
||||||
rest.push_str(pseudo);
|
rest.push_str(pseudo);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO we can probably skip the format here, we just need to push the char at the start
|
// TODO we can probably skip the format here, we just need to push the char at the start
|
||||||
if !rest.is_empty() {
|
if !rest.is_empty() {
|
||||||
rest = format!(":{rest}");
|
rest.insert(0, ':')
|
||||||
}
|
}
|
||||||
|
|
||||||
format!(".{original}{rest}")
|
format!(".{original}{rest}")
|
||||||
|
|
|
@ -58,3 +58,13 @@ pub(crate) fn default_modifiers() -> HashMap<String, String> {
|
||||||
.map(|(a, b)| (a.to_string(), b.to_string()))
|
.map(|(a, b)| (a.to_string(), b.to_string()))
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) fn default_pseudos() -> HashMap<String, String> {
|
||||||
|
vec![
|
||||||
|
("ph", "placeholder"),
|
||||||
|
// TODO
|
||||||
|
]
|
||||||
|
.into_iter()
|
||||||
|
.map(|(a, b)| (a.to_string(), b.to_string()))
|
||||||
|
.collect()
|
||||||
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ pub struct Zephyr {
|
||||||
pub names: HashMap<String, String>,
|
pub names: HashMap<String, String>,
|
||||||
pub values: HashMap<String, String>,
|
pub values: HashMap<String, String>,
|
||||||
pub modifiers: HashMap<String, String>,
|
pub modifiers: HashMap<String, String>,
|
||||||
|
pub pseudos: HashMap<String, String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Zephyr {
|
impl Zephyr {
|
||||||
|
@ -25,6 +26,7 @@ impl Zephyr {
|
||||||
names: default_names(),
|
names: default_names(),
|
||||||
values: default_values(),
|
values: default_values(),
|
||||||
modifiers: default_modifiers(),
|
modifiers: default_modifiers(),
|
||||||
|
pseudos: default_pseudos(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,6 +37,7 @@ impl Zephyr {
|
||||||
names: HashMap::new(),
|
names: HashMap::new(),
|
||||||
values: HashMap::new(),
|
values: HashMap::new(),
|
||||||
modifiers: HashMap::new(),
|
modifiers: HashMap::new(),
|
||||||
|
pseudos: HashMap::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue