Parser: Fix broken tables on a few dozen en.w pages

pull/620/head
gnosygnu 8 years ago
parent ccd8b204c5
commit 7bd176f51f

@ -373,7 +373,9 @@ public class Xop_fxt {
Tfds.Eq_str_lines(gplx.langs.htmls.Gfh_utl.Replace_apos(expd), actl, raw); Tfds.Eq_str_lines(gplx.langs.htmls.Gfh_utl.Replace_apos(expd), actl, raw);
} }
public void Test_str_full(String raw, String expd, String actl) {Tfds.Eq_str_lines(expd, actl, raw);} public void Test_str_full(String raw, String expd, String actl) {
Tfds.Eq_str_lines(expd, actl, raw);
}
public void Test_str_part_y(String actl, String... expd_parts) { public void Test_str_part_y(String actl, String... expd_parts) {
int expd_parts_len = expd_parts.length; int expd_parts_len = expd_parts.length;
for (int i = 0; i < expd_parts_len; i++) { for (int i = 0; i < expd_parts_len; i++) {

@ -89,13 +89,14 @@ public class Xop_list_wkr implements Xop_ctx_wkr {
ctx.Empty_ignored_y_(); ctx.Empty_ignored_y_();
} }
} }
if (allDd && cur_pos < src_len - 2 && src[cur_pos] == '{' && src[cur_pos + 1] == '|') // NOTE: if indent && next == {| then invoke table; EX: ":::{|" if (allDd) { // NOTE: if indent && next == {| then invoke table; EX: ":::{|"
return ctx.Tblw().Make_tkn_bgn(ctx, tkn_mkr, root, src, src_len, cur_pos, cur_pos + 2, false, Xop_tblw_wkr.Tblw_type_tb, Xop_tblw_wkr.Called_from_list, -1, -1); // NOTE: ws_enabled must be set to true; see test for Adinkras; Cato the Elder int tblw_bgn = Bry_find_.Find_fwd_while(src, cur_pos, src_len, Byte_ascii.Space); // skip spaces; EX: ": {|" DATE:2017-01-26
else { if (tblw_bgn < src_len - 2 && src[tblw_bgn] == '{' && src[tblw_bgn + 1] == '|') // check if next chars are "{|"
return ctx.Tblw().Make_tkn_bgn(ctx, tkn_mkr, root, src, src_len, tblw_bgn, tblw_bgn+ 2, false, Xop_tblw_wkr.Tblw_type_tb, Xop_tblw_wkr.Called_from_list, -1, -1); // NOTE: ws_enabled must be set to true; see test for Adinkras; Cato the Elder
}
dd_chk = symByt == Xop_list_tkn_.List_itmTyp_dt; dd_chk = symByt == Xop_list_tkn_.List_itmTyp_dt;
return cur_pos; return cur_pos;
} }
}
public void MakeTkn_end(Xop_ctx ctx, Xop_tkn_mkr tkn_mkr, Xop_root_tkn root, byte[] src, int src_len, int bgn_pos, int cur_pos, Xop_list_tkn bgn, byte sub_last) { public void MakeTkn_end(Xop_ctx ctx, Xop_tkn_mkr tkn_mkr, Xop_root_tkn root, byte[] src, int src_len, int bgn_pos, int cur_pos, Xop_list_tkn bgn, byte sub_last) {
// boolean empty_ignored = ctx.Empty_ignored(); // commented; see below; DATE:2014-06-24 // boolean empty_ignored = ctx.Empty_ignored(); // commented; see below; DATE:2014-06-24
Xop_tkn_itm end_tkn = tkn_mkr.List_end(bgn_pos, bgn.List_itmTyp()).List_path_(bgn.List_path()).List_uid_(listId).List_sub_last_(sub_last); Xop_tkn_itm end_tkn = tkn_mkr.List_end(bgn_pos, bgn.List_itmTyp()).List_path_(bgn.List_path()).List_uid_(listId).List_sub_last_(sub_last);

@ -260,6 +260,20 @@ public class Xop_list_wkr_basic_tst {
, fxt.tkn_list_end_(10).List_path_(0) , fxt.tkn_list_end_(10).List_path_(0)
); );
} }
@Test public void Mix_tblw_w_space() {
fxt.Test_html_full_str(": {|\n|a\n|}", String_.Concat_lines_nl_skip_last
( "<dl>"
, " <dd>"
, " <table>"
, " <tr>"
, " <td>a"
, " </td>"
, " </tr>"
, " </table>"
, " </dd>"
, "</dl>"
));
}
@Test public void Dif_lvls_1_3_1() { @Test public void Dif_lvls_1_3_1() {
fxt.Test_parse_page_all_str(String_.Concat_lines_nl_skip_last fxt.Test_parse_page_all_str(String_.Concat_lines_nl_skip_last
( "*1" ( "*1"

Loading…
Cancel
Save