fix(validate): table row can have no children
This commit is contained in:
parent
7d064c526e
commit
65629b692f
|
@ -713,6 +713,8 @@ pub fn parse_org_table<'a, T: ElementArena<'a>>(
|
||||||
|
|
||||||
let mut has_header = false;
|
let mut has_header = false;
|
||||||
|
|
||||||
|
// TODO: merge contiguous rules
|
||||||
|
|
||||||
if let Some(line) = iter.next() {
|
if let Some(line) = iter.next() {
|
||||||
let line = line.trim_start();
|
let line = line.trim_start();
|
||||||
if !line.starts_with("|-") {
|
if !line.starts_with("|-") {
|
||||||
|
|
|
@ -131,7 +131,6 @@ impl Org<'_> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Element::TableRow(TableRow::Header) => {
|
Element::TableRow(TableRow::Header) => {
|
||||||
expect_children!(node_id);
|
|
||||||
for child in node_id.children(&self.arena) {
|
for child in node_id.children(&self.arena) {
|
||||||
expect_element!(
|
expect_element!(
|
||||||
child,
|
child,
|
||||||
|
@ -141,7 +140,6 @@ impl Org<'_> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Element::TableRow(TableRow::Body) => {
|
Element::TableRow(TableRow::Body) => {
|
||||||
expect_children!(node_id);
|
|
||||||
for child in node_id.children(&self.arena) {
|
for child in node_id.children(&self.arena) {
|
||||||
expect_element!(
|
expect_element!(
|
||||||
child,
|
child,
|
||||||
|
|
|
@ -154,3 +154,19 @@ test_suite!(
|
||||||
"#,
|
"#,
|
||||||
"<main><section><table><tbody></tbody></table></section></main>"
|
"<main><section><table><tbody></tbody></table></section></main>"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
test_suite!(
|
||||||
|
table6,
|
||||||
|
r#"
|
||||||
|
|
|
||||||
|
|-
|
||||||
|
|
|
||||||
|
|-
|
||||||
|
|
|
||||||
|
"#,
|
||||||
|
"<main><section><table>\
|
||||||
|
<thead><tr></tr></thead>\
|
||||||
|
<tbody><tr></tr></tbody>\
|
||||||
|
<tbody><tr></tr></tbody>\
|
||||||
|
</table></section></main>"
|
||||||
|
);
|
||||||
|
|
Loading…
Reference in a new issue