diff --git a/djota.pl b/djota.pl index 043da1e..2fc3670 100644 --- a/djota.pl +++ b/djota.pl @@ -223,7 +223,14 @@ whites(_). table_row([Ast|Xs]) --> - seq(X), { length(X, N), N > 0, inline_text_ast(X, Ast) }, + seq(X), { + findall(C, (member(C, X), C = '`'), Cs), + length(Cs, CN), + 0 is CN mod 2, + inline_text_ast(X, Ast), + append(_, [T], X), + dif(T, '\\') + }, "|", table_row(Xs). table_row([Ast]) --> @@ -387,7 +394,8 @@ { attrs_html(Attrs, AttrsHtml) }, "", Str, "". ast_html_node_(str(Str)) --> - Str. + { phrase(escape_html_(Html), Str) }, + Html. ast_html_node_items_([], _) --> "". ast_html_node_items_([item(Item)|Items], loose) --> diff --git a/test.lgt b/test.lgt index 46c85d8..e114ec6 100644 --- a/test.lgt +++ b/test.lgt @@ -110,6 +110,7 @@ test(table_ast) :- test(table) :- djota:djot("| 1 | 2 |\n| 3 | 4 | 5 |", "
1 2
3 4 5
"), - djota:djot("|fruit|price|\n|---|---:|\n|apple|4|\n|banana|10|", "
fruitprice
apple4
banana10
"). + djota:djot("|fruit|price|\n|---|---:|\n|apple|4|\n|banana|10|", "
fruitprice
apple4
banana10
"), + djota:djot("| just two \\| `|` | cells in this table |", "
just two | | cells in this table
"). :- end_object. \ No newline at end of file