Add optional attributes
This commit is contained in:
1 parent
9f1c735cf1
commit
d297e2baa2
6 files changed
+171
-57
No files matched your search
@@ -224,6 +224,15 @@ impl Writer<'_> {
|
||||
|
||||
fn write_attribute_value(&mut self, value: &ElementAttrValue) -> Result {
|
||||
match value {
|
||||
ElementAttrValue::AttrOptionalExpr { condition, value } => {
|
||||
write!(
|
||||
self.out,
|
||||
"if {condition} {{ ",
|
||||
condition = prettyplease::unparse_expr(condition),
|
||||
)?;
|
||||
self.write_attribute_value(value)?;
|
||||
write!(self.out, " }}")?;
|
||||
}
|
||||
ElementAttrValue::AttrLiteral(value) => {
|
||||
write!(self.out, "{value}", value = ifmt_to_string(value))?;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user