summaryrefslogtreecommitdiff
path: root/src/compile.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/compile.rs')
-rw-r--r--src/compile.rs17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/compile.rs b/src/compile.rs
index 9e19b18..a0877cd 100644
--- a/src/compile.rs
+++ b/src/compile.rs
@@ -1,6 +1,9 @@
use html_escape::{encode_double_quoted_attribute, encode_single_quoted_attribute};
-use crate::analyze::{ConstantExpression, ConstantSymbolId, ConstantValue, ScopedSymbolTable};
+use crate::{
+ VOID_TAGS,
+ analyze::{ConstantExpression, ConstantLiteral, ConstantSymbolId, ScopedSymbolTable},
+};
fn symbol_table_from_path<'a>(
symbol_table: &'a ScopedSymbolTable<'a>,
@@ -62,7 +65,7 @@ fn compile_constant<'a>(
};
match expression {
ConstantExpression::Value(value) => match value {
- ConstantValue::String(value) => buffer.push_str(value),
+ ConstantLiteral::String(value) => buffer.push_str(value),
},
ConstantExpression::Name(name) => {
let mut name = *name;
@@ -97,10 +100,12 @@ fn compile_constant<'a>(
compile_attribute_value(buffer, symbol_table, name, *value);
}
buffer.push('>');
- compile_constant(buffer, symbol_table, *child);
- buffer.push_str("</");
- buffer.push_str(tag_name_lowercase);
- buffer.push('>');
+ if !VOID_TAGS.contains(tag_name_lowercase) {
+ compile_constant(buffer, symbol_table, *child);
+ buffer.push_str("</");
+ buffer.push_str(tag_name_lowercase);
+ buffer.push('>');
+ }
}
}
}