1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00
This commit is contained in:
gnosygnu
2014-09-07 22:38:50 -04:00
parent be63adc5af
commit a022d7f26c
293 changed files with 2546 additions and 1942 deletions

View File

@@ -90,13 +90,6 @@ public class Xop_tblw_lxr implements Xop_lxr {
}
else { // nth pipe; no need to check for invalidate
switch (wlxr_type) {
case Xop_tblw_wkr.Tblw_type_tc: // \n|+
case Xop_tblw_wkr.Tblw_type_tr: // \n|-
case Xop_tblw_wkr.Tblw_type_td: // \n|
//case Xop_tblw_wkr.Tblw_type_te: // |} // NOTE: ignore "|}"; needed for incomplete lnkis; EX: |[[a\n|}; EX:w:Wikipedia:Changing_attribution_for_an_edit; DATE:2014-03-16
ctx.Subs_add(root, tkn_mkr.NewLine(bgn_pos, bgn_pos + 1, Xop_nl_tkn.Tid_char, 1));
ctx.Subs_add(root, tkn_mkr.Pipe(bgn_pos + 1, bgn_pos + 2));
return bgn_pos + 2; // +2 to skip "\n|", but still look at 3rd char; ("+", "-", or "}")
case Xop_tblw_wkr.Tblw_type_td2: // ||
ctx.Subs_add(root, tkn_mkr.Pipe(bgn_pos, cur_pos));
return cur_pos;

View File

@@ -171,7 +171,7 @@ public class Xop_tblw_wkr implements Xop_ctx_wkr {
if (!tbl_is_xml)
ctx.Para().Process_nl(ctx, root, src, bgn_pos, bgn_pos + 1); // simulate "\n"; 2012-12-08
int stack_pos = ctx.Stack_idx_typ(Xop_tkn_itm_.Tid_tblw_tr);
if (stack_pos != Xop_ctx.Stack_not_found) // don't pop <tr> if none found; EX:en.w:Turks_in_Denmark DATE:2014-03-02
if (stack_pos != Xop_ctx.Stack_not_found) // don't pop <tr> if none found; PAGE:en.w:Turks_in_Denmark DATE:2014-03-02
ctx.Stack_pop_til(root, src, stack_pos, true, bgn_pos, bgn_pos, Xop_tkn_itm_.Tid_tblw_td);
break;
case Xop_tkn_itm_.Tid_tblw_tr: // fix; <tr><tr> -> <tr>

View File

@@ -27,7 +27,7 @@ public class Xop_tblw_wkr__double_pipe_tst {
, ""
));
}
@Test public void Tblw_lnki_nth() { // PURPOSE: if || is nth pipe, then treat as lnki; EX:en.w:Main_Page;de.w:Main_Page; DATE:2014-05-06
@Test public void Tblw_lnki_nth() { // PURPOSE: if || is nth pipe, then treat as lnki; PAGE:en.w:Main_Page;de.w:Main_Page; DATE:2014-05-06
fxt.Test_parse_page_wiki_str(String_.Concat_lines_nl_skip_last
( "{|"
, "|[[File:A.png|b||c]]"

View File

@@ -139,7 +139,7 @@ public class Xop_tblw_wkr__nested_tst {
, ""
));
}
@Test public void Tblw_tblx_tblw_fails() { // PURPOSE: {| -> <table> -> \n| was not rendering as <td>; EX:en.w:Paris#Demographics; DATE:2014-03-18
@Test public void Tblw_tblx_tblw_fails() { // PURPOSE: {| -> <table> -> \n| was not rendering as <td>; PAGE:en.w:Paris#Demographics; DATE:2014-03-18
fxt.Test_parse_page_wiki_str(String_.Concat_lines_nl_skip_last
( "{|"
, "|-"

View File

@@ -20,7 +20,7 @@ import org.junit.*;
public class Xop_tblw_wkr__uncommon_tst {
@Before public void init() {fxt.Reset(); fxt.Init_para_y_();} private Xop_fxt fxt = new Xop_fxt();
@After public void term() {fxt.Init_para_n_();}
@Test public void Tr_pops_entire_stack() { // PURPOSE: in strange cases, tr will pop entire stack; EX:en.w:Turks_in_Denmark; DATE:2014-03-02
@Test public void Tr_pops_entire_stack() { // PURPOSE: in strange cases, tr will pop entire stack; PAGE:en.w:Turks_in_Denmark; DATE:2014-03-02
fxt.Test_parse_page_all_str(String_.Concat_lines_nl_skip_last
( "{|"
, "<caption>a"
@@ -44,40 +44,61 @@ public class Xop_tblw_wkr__uncommon_tst {
, "</table>"
));
}
@Test public void Atrs_defect() { // PURPOSE: < in atrs was causing premature termination; EX:en.w:Wikipedia:List of hoaxes on Wikipedia
@Test public void Atrs_defect() { // PURPOSE: < in atrs was causing premature termination; PAGE:en.w:Wikipedia:List of hoaxes on Wikipedia
fxt.Test_parse_page_wiki_str(String_.Concat_lines_nl_skip_last
( "{|id=\"a<b\""
, "|a"
, "|}"), String_.Concat_lines_nl_skip_last
( "<table id=\"a.3Cb\">"
, " <tr>"
, " <td>a"
, " </td>"
, " </tr>"
, "</table>"
, ""
));
( "{|id=\"a<b\""
, "|a"
, "|}"), String_.Concat_lines_nl_skip_last
( "<table id=\"a.3Cb\">"
, " <tr>"
, " <td>a"
, " </td>"
, " </tr>"
, "</table>"
, ""
));
}
@Test public void Broken_lnki() { // PURPOSE: broken lnki was not closing table properly; EX:en.w:Wikipedia:Changing_attribution_for_an_edit; DATE:2014-03-16
@Test public void Broken_lnki() { // PURPOSE: broken lnki was not closing table properly; PAGE:en.w:Wikipedia:Changing_attribution_for_an_edit; DATE:2014-03-16
fxt.Test_parse_page_wiki_str(String_.Concat_lines_nl_skip_last
( "{|"
, "|-"
, "|a"
, "|[[b|c"
, "|}"
, "d"
), String_.Concat_lines_nl_skip_last
( "<table>"
, " <tr>"
, " <td>a"
, " </td>"
, " <td>[[b|c"
, " </td>"
, " </tr>"
, "</table>"
, ""
, "<p>d"
, "</p>"
));
( "{|"
, "|-"
, "|a"
, "|[[b|c"
, "|}"
, "d"
), String_.Concat_lines_nl_skip_last
( "<table>"
, " <tr>"
, " <td>a"
, " </td>"
, " <td>[[b|c"
, " </td>"
, " </tr>"
, "</table>"
, ""
, "<p>d"
, "</p>"
));
}
@Test public void Broken_lnki_2() { // PURPOSE: variation on above; PAGE:hr.b:Knjiga_pojmova_u_zrakoplovstvu/Kratice_u_zrakoplovstvu/S; DATE:2014-09-05
fxt.Test_parse_page_wiki_str(String_.Concat_lines_nl_skip_last
( "{|"
, "|-"
, "| [[A | b"
, "|-"
, "| B"
, "|}"
), String_.Concat_lines_nl_skip_last
( "<table>"
, " <tr>"
, " <td> [[A | b"
, " </td>"
, " </tr>"
, " <tr>"
, " <td> B"
, " </td>"
, " </tr>"
, "</table>"
));
}
}