Skip to content

Commit fd775bc

Browse files
author
Ashe Connor
authored
Merge pull request #55 from brson/table-misparse
Fix the grammar for scanning table marker rows
2 parents a8d94e6 + 31746ff commit fd775bc

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/lexer.pest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,6 @@ table_newline = _{ "\r"? ~ "\n" }
4848
table_marker = _{ table_spacechar* ~ ":"? ~ "-"+ ~ ":"? ~ table_spacechar* }
4949
table_cell = { ( escaped_char | !("|" | "\r" | "\n") ~ any)* }
5050

51-
table_start = { "|"? ~ table_marker ~ ("|" ~ table_marker)* ~ "|"? ~ table_spacechar* | table_newline }
51+
table_start = { "|"? ~ table_marker ~ ("|" ~ table_marker)* ~ "|"? ~ table_spacechar* ~ table_newline }
5252
table_cell_end = { "|" ~ table_spacechar* ~ table_newline? }
5353
table_row_end = { table_spacechar* ~ table_newline }

src/tests.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -673,3 +673,21 @@ fn no_panic_on_empty_bookended_atx_headers() {
673673
"<h1></h1>\n"
674674
);
675675
}
676+
677+
#[test]
678+
fn table_misparse_1() {
679+
html_opts(
680+
"a\n-b",
681+
"<p>a\n-b</p>\n",
682+
|opts| opts.ext_table = true,
683+
);
684+
}
685+
686+
#[test]
687+
fn table_misparse_2() {
688+
html_opts(
689+
"a\n-b\n-c",
690+
"<p>a\n-b\n-c</p>\n",
691+
|opts| opts.ext_table = true,
692+
);
693+
}

0 commit comments

Comments
 (0)