fix(validate): table row can have no children

This commit is contained in:
PoiScript 2019-11-06 13:33:52 +08:00
parent 7d064c526e
commit 65629b692f
3 changed files with 18 additions and 2 deletions

View file

@ -713,6 +713,8 @@ pub fn parse_org_table<'a, T: ElementArena<'a>>(
let mut has_header = false;
// TODO: merge contiguous rules
if let Some(line) = iter.next() {
let line = line.trim_start();
if !line.starts_with("|-") {

View file

@ -131,7 +131,6 @@ impl Org<'_> {
}
}
Element::TableRow(TableRow::Header) => {
expect_children!(node_id);
for child in node_id.children(&self.arena) {
expect_element!(
child,
@ -141,7 +140,6 @@ impl Org<'_> {
}
}
Element::TableRow(TableRow::Body) => {
expect_children!(node_id);
for child in node_id.children(&self.arena) {
expect_element!(
child,

View file

@ -154,3 +154,19 @@ test_suite!(
"#,
"<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>"
);