auto-close elements with no child
This commit is contained in:
parent
f301f2cb10
commit
9af7d252d7
1 changed files with 16 additions and 11 deletions
|
@ -38,6 +38,10 @@ impl fmt::Debug for Element {
|
||||||
for attr in &self.attributes {
|
for attr in &self.attributes {
|
||||||
write!(fmt, " {}", attr)?;
|
write!(fmt, " {}", attr)?;
|
||||||
}
|
}
|
||||||
|
if self.children.is_empty() {
|
||||||
|
write!(fmt, "/>")?;
|
||||||
|
}
|
||||||
|
else {
|
||||||
write!(fmt, ">")?;
|
write!(fmt, ">")?;
|
||||||
for child in &self.children {
|
for child in &self.children {
|
||||||
match *child {
|
match *child {
|
||||||
|
@ -50,6 +54,7 @@ impl fmt::Debug for Element {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
write!(fmt, "</{}>", self.name)?;
|
write!(fmt, "</{}>", self.name)?;
|
||||||
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue