mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
v2.9.2.1
This commit is contained in:
31
400_xowa/src/gplx/xowa/parsers/tblws/Xop_tblw_log.java
Normal file
31
400_xowa/src/gplx/xowa/parsers/tblws/Xop_tblw_log.java
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.parsers.tblws; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*;
|
||||
public class Xop_tblw_log {
|
||||
private static final Gfo_msg_grp owner = Gfo_msg_grp_.new_(Xoa_app_.Nde, "tblw");
|
||||
public static final Gfo_msg_itm
|
||||
Dangling = Gfo_msg_itm_.new_warn_(owner, "dangling_tblw")
|
||||
, Elem_without_tbl = Gfo_msg_itm_.new_warn_(owner, "elem_without_tbl")
|
||||
// , Row_trailing = Gfo_msg_itm_.new_warn_(owner, "Row_trailing")
|
||||
, Caption_after_tr = Gfo_msg_itm_.new_warn_(owner, "caption_after_tr")
|
||||
, Caption_after_td = Gfo_msg_itm_.new_warn_(owner, "caption_after_td")
|
||||
, Caption_after_tc = Gfo_msg_itm_.new_warn_(owner, "caption_after_tc")
|
||||
, Hdr_after_cell = Gfo_msg_itm_.new_warn_(owner, "hdr_after_cell")
|
||||
, Tbl_empty = Gfo_msg_itm_.new_warn_(owner, "tbl_empty")
|
||||
;
|
||||
}
|
||||
@@ -16,7 +16,7 @@ You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.parsers.tblws; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*;
|
||||
import gplx.core.btries.*; import gplx.xowa.parsers.paras.*;
|
||||
import gplx.core.btries.*; import gplx.xowa.parsers.paras.*; import gplx.xowa.parsers.lnkis.*; import gplx.xowa.parsers.miscs.*;
|
||||
public class Xop_tblw_lxr implements Xop_lxr {
|
||||
public byte Lxr_tid() {return Xop_lxr_.Tid_tblw;}
|
||||
public int Make_tkn(Xop_ctx ctx, Xop_tkn_mkr tkn_mkr, Xop_root_tkn root, byte[] src, int src_len, int bgn_pos, int cur_pos) {
|
||||
|
||||
@@ -16,6 +16,7 @@ You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.parsers.tblws; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*;
|
||||
import gplx.xowa.parsers.xndes.*;
|
||||
public class Xop_tblw_tb_tkn extends Xop_tkn_itm_base implements Xop_tblw_tkn {
|
||||
public Xop_tblw_tb_tkn(int bgn, int end, boolean tblw_xml, boolean auto_created) {
|
||||
this.tblw_xml = tblw_xml; this.Tkn_ini_pos(false, bgn, end);
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.parsers.tblws; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*;
|
||||
public class Xop_tblw_tb_tkn_chkr extends Xop_tkn_chkr_base {
|
||||
@Override public Class<?> TypeOf() {return Xop_tblw_tb_tkn.class;}
|
||||
@Override public byte Tkn_tid() {return Xop_tkn_itm_.Tid_tblw_tb;}
|
||||
public int Caption_count() {return caption_count;} public Xop_tblw_tb_tkn_chkr Caption_count_(int v) {caption_count = v; return this;} private int caption_count = Int_.Neg1_count;
|
||||
public Xop_tblw_tb_tkn_chkr Atrs_rng_(int bgn, int end) {this.atrs_bgn = bgn; this.atrs_end = end; return this;} private int atrs_bgn = Xop_tblw_wkr.Atrs_null, atrs_end = Xop_tblw_wkr.Atrs_null;
|
||||
@Override public int Chk_hook(Tst_mgr mgr, String path, Object actl_obj, int err) {
|
||||
Xop_tblw_tb_tkn actl = (Xop_tblw_tb_tkn)actl_obj;
|
||||
err += mgr.Tst_val(caption_count == Int_.Neg1_count, path, "caption_count", caption_count, actl.Caption_count());
|
||||
err += mgr.Tst_val(atrs_bgn == Xop_tblw_wkr.Atrs_null, path, "atrs_bgn", atrs_bgn, actl.Atrs_bgn());
|
||||
err += mgr.Tst_val(atrs_end == Xop_tblw_wkr.Atrs_null, path, "atrs_end", atrs_end, actl.Atrs_end());
|
||||
return err;
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@ You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.parsers.tblws; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*;
|
||||
import gplx.xowa.parsers.xndes.*;
|
||||
public class Xop_tblw_tc_tkn extends Xop_tkn_itm_base implements Xop_tblw_tkn {
|
||||
@Override public byte Tkn_tid() {return Xop_tkn_itm_.Tid_tblw_tc;}
|
||||
public int Tblw_tid() {return Xop_xnde_tag_.Tid_caption;}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.parsers.tblws; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*;
|
||||
public class Xop_tblw_tc_tkn_chkr extends Xop_tkn_chkr_base {
|
||||
@Override public Class<?> TypeOf() {return Xop_tblw_tc_tkn.class;}
|
||||
@Override public byte Tkn_tid() {return Xop_tkn_itm_.Tid_tblw_tc;}
|
||||
@Override public int Chk_hook(Tst_mgr mgr, String path, Object actl_obj, int err) {
|
||||
// Xop_tblw_tc_tkn actl = (Xop_tblw_tc_tkn)actl_obj;
|
||||
return err;
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@ You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.parsers.tblws; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*;
|
||||
import gplx.xowa.parsers.xndes.*;
|
||||
public class Xop_tblw_td_tkn extends Xop_tkn_itm_base implements Xop_tblw_tkn {
|
||||
@Override public byte Tkn_tid() {return Xop_tkn_itm_.Tid_tblw_td;}
|
||||
public int Tblw_tid() {return Xop_xnde_tag_.Tid_td;}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.parsers.tblws; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*;
|
||||
public class Xop_tblw_td_tkn_chkr extends Xop_tkn_chkr_base {
|
||||
@Override public Class<?> TypeOf() {return Xop_tblw_td_tkn.class;}
|
||||
@Override public byte Tkn_tid() {return Xop_tkn_itm_.Tid_tblw_td;}
|
||||
public Xop_tblw_td_tkn_chkr Atrs_rng_(int bgn, int end) {this.atrs_bgn = bgn; this.atrs_end = end; return this;} private int atrs_bgn = Xop_tblw_wkr.Atrs_null, atrs_end = Xop_tblw_wkr.Atrs_null;
|
||||
@Override public int Chk_hook(Tst_mgr mgr, String path, Object actl_obj, int err) {
|
||||
Xop_tblw_td_tkn actl = (Xop_tblw_td_tkn)actl_obj;
|
||||
err += mgr.Tst_val(atrs_bgn == Xop_tblw_wkr.Atrs_null, path, "atrs_bgn", atrs_bgn, actl.Atrs_bgn());
|
||||
err += mgr.Tst_val(atrs_end == Xop_tblw_wkr.Atrs_null, path, "atrs_end", atrs_end, actl.Atrs_end());
|
||||
return err;
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@ You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.parsers.tblws; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*;
|
||||
import gplx.xowa.parsers.xndes.*;
|
||||
public class Xop_tblw_th_tkn extends Xop_tkn_itm_base implements Xop_tblw_tkn {
|
||||
@Override public byte Tkn_tid() {return Xop_tkn_itm_.Tid_tblw_th;}
|
||||
public int Tblw_tid() {return Xop_xnde_tag_.Tid_th;}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.parsers.tblws; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*;
|
||||
public class Xop_tblw_th_tkn_chkr extends Xop_tkn_chkr_base {
|
||||
@Override public Class<?> TypeOf() {return Xop_tblw_th_tkn.class;}
|
||||
@Override public byte Tkn_tid() {return Xop_tkn_itm_.Tid_tblw_th;}
|
||||
public Xop_tblw_th_tkn_chkr Atrs_rng_(int bgn, int end) {this.atrs_bgn = bgn; this.atrs_end = end; return this;} private int atrs_bgn = Xop_tblw_wkr.Atrs_null, atrs_end = Xop_tblw_wkr.Atrs_null;
|
||||
@Override public int Chk_hook(Tst_mgr mgr, String path, Object actl_obj, int err) {
|
||||
Xop_tblw_th_tkn actl = (Xop_tblw_th_tkn)actl_obj;
|
||||
err += mgr.Tst_val(atrs_bgn == -1, path, "atrs_bgn", atrs_bgn, actl.Atrs_bgn());
|
||||
err += mgr.Tst_val(atrs_end == -1, path, "atrs_end", atrs_end, actl.Atrs_end());
|
||||
return err;
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@ You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.parsers.tblws; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*;
|
||||
import gplx.xowa.parsers.xndes.*;
|
||||
public interface Xop_tblw_tkn extends Xop_tkn_itm {
|
||||
int Tblw_tid();
|
||||
boolean Tblw_xml();
|
||||
|
||||
@@ -16,6 +16,7 @@ You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.parsers.tblws; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*;
|
||||
import gplx.xowa.parsers.xndes.*;
|
||||
public class Xop_tblw_tr_tkn extends Xop_tkn_itm_base implements Xop_tblw_tkn {
|
||||
public Xop_tblw_tr_tkn(int bgn, int end, boolean tblw_xml, boolean auto_created) {
|
||||
this.tblw_xml = tblw_xml; this.Tkn_ini_pos(false, bgn, end);
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.parsers.tblws; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*;
|
||||
public class Xop_tblw_tr_tkn_chkr extends Xop_tkn_chkr_base {
|
||||
@Override public Class<?> TypeOf() {return Xop_tblw_tr_tkn.class;}
|
||||
@Override public byte Tkn_tid() {return Xop_tkn_itm_.Tid_tblw_tr;}
|
||||
public Xop_tblw_tr_tkn_chkr Atrs_rng_(int bgn, int end) {this.atrs_bgn = bgn; this.atrs_end = end; return this;} private int atrs_bgn = Xop_tblw_wkr.Atrs_null, atrs_end = Xop_tblw_wkr.Atrs_null;
|
||||
@Override public int Chk_hook(Tst_mgr mgr, String path, Object actl_obj, int err) {
|
||||
Xop_tblw_tr_tkn actl = (Xop_tblw_tr_tkn)actl_obj;
|
||||
err += mgr.Tst_val(atrs_bgn == -1, path, "atrs_bgn", atrs_bgn, actl.Atrs_bgn());
|
||||
err += mgr.Tst_val(atrs_end == -1, path, "atrs_end", atrs_end, actl.Atrs_end());
|
||||
return err;
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@ You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.parsers.tblws; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*;
|
||||
import gplx.xowa.parsers.lists.*; import gplx.xowa.parsers.paras.*;
|
||||
import gplx.xowa.parsers.lists.*; import gplx.xowa.parsers.paras.*; import gplx.xowa.parsers.xndes.*; import gplx.xowa.parsers.miscs.*;
|
||||
public class Xop_tblw_wkr implements Xop_ctx_wkr {
|
||||
private int tblw_te_ignore_count = 0;
|
||||
public boolean Cell_pipe_seen() {return cell_pipe_seen;} public Xop_tblw_wkr Cell_pipe_seen_(boolean v) {cell_pipe_seen = v; return this;} private boolean cell_pipe_seen; // status of 1st cell pipe; EX: \n| a | b | c || -> flag pipe between a and b but ignore b and c
|
||||
@@ -48,7 +48,6 @@ public class Xop_tblw_wkr implements Xop_ctx_wkr {
|
||||
}
|
||||
if (ctx.Apos().Stack_len() > 0) // open apos; note that apos keeps its own stack, as they are not "structural" (not sure about this)
|
||||
ctx.Apos().EndFrame(ctx, root, src, cur_pos, true); // close it
|
||||
|
||||
Xop_tblw_tkn prv_tkn = ctx.Stack_get_tbl();
|
||||
if ( prv_tkn == null // prv_tkn not found; i.e.: no earlier "{|" or "<table>"
|
||||
|| ( ctx.Stack_get_tblw_tb() == null // no {| on stack; DATE:2014-05-05
|
||||
@@ -192,10 +191,25 @@ public class Xop_tblw_wkr implements Xop_ctx_wkr {
|
||||
switch (prv_tid) {
|
||||
case Xop_tkn_itm_.Tid_tblw_tr: break; // noop; <tr><td>
|
||||
case Xop_tkn_itm_.Tid_tblw_td: // fix; <td><td> -> <td></td><td>
|
||||
if (!tbl_is_xml) // only for "\n|" not <td>
|
||||
ctx.Para().Process_nl(ctx, root, src, bgn_pos, bgn_pos + 1); // simulate "\n"; DATE:2014-02-20; ru.w:;[[Help:Download]]; DATE:2014-02-20
|
||||
ctx.Para().Process_block__bgn_y__end_n(Xop_xnde_tag_.Tag_td); // <td>
|
||||
ctx.Stack_pop_til(root, src, ctx.Stack_idx_typ(prv_tid), true, bgn_pos, bgn_pos, Xop_tkn_itm_.Tid_tblw_td);
|
||||
if ( prv_tkn.Tblw_xml() // prv is <td>
|
||||
&& !tbl_is_xml // cur is "\n|"
|
||||
) { // insert <tr>; EX: "<tr><td>\n|" -> "<tr><td><tr><td>" PAGE:fi.w:Salibandyn_maailmanmestaruuskilpailut_2012 DATE:2015-09-07
|
||||
int prv_tr_tkn_idx = ctx.Stack_idx_typ(Xop_tkn_itm_.Tid_tblw_tr);
|
||||
if (prv_tr_tkn_idx != Xop_ctx.Stack_not_found) { // <tr> exists
|
||||
int prv_tb_tkn_idx = ctx.Stack_idx_typ(Xop_tkn_itm_.Tid_tblw_tb);
|
||||
if (prv_tb_tkn_idx < prv_tr_tkn_idx) // don't close <tr> above current tbl
|
||||
ctx.Stack_pop_til(root, src, prv_tr_tkn_idx, true, bgn_pos, bgn_pos, Xop_tkn_itm_.Tid_tblw_td); // close <tr>
|
||||
}
|
||||
new_tkn = tkn_mkr.Tblw_tr(bgn_pos, cur_pos, tbl_is_xml, true); // make a new <tr>
|
||||
new_tkn.Atrs_rng_set(bgn_pos, bgn_pos);
|
||||
ctx.Subs_add_and_stack_tblw(root, prv_tkn, new_tkn);
|
||||
}
|
||||
else {
|
||||
if (!tbl_is_xml) // only for "\n|" not <td>
|
||||
ctx.Para().Process_nl(ctx, root, src, bgn_pos, bgn_pos + 1); // simulate "\n"; DATE:2014-02-20; ru.w:;[[Help:Download]]; DATE:2014-02-20
|
||||
ctx.Para().Process_block__bgn_y__end_n(Xop_xnde_tag_.Tag_td); // <td>
|
||||
ctx.Stack_pop_til(root, src, ctx.Stack_idx_typ(prv_tid), true, bgn_pos, bgn_pos, Xop_tkn_itm_.Tid_tblw_td);
|
||||
}
|
||||
break;
|
||||
case Xop_tkn_itm_.Tid_tblw_th: // fix; <th><td> -> <th></th><td>
|
||||
ctx.Stack_pop_til(root, src, ctx.Stack_idx_typ(prv_tid), true, bgn_pos, bgn_pos, Xop_tkn_itm_.Tid_tblw_td);
|
||||
|
||||
@@ -139,41 +139,6 @@ public class Xop_tblw_wkr__nested_tst {
|
||||
, ""
|
||||
));
|
||||
}
|
||||
@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
|
||||
( "{|"
|
||||
, "|-"
|
||||
, "|a"
|
||||
, "</td></tr>"
|
||||
, "<tr><td><table>"
|
||||
, "<tr><td>b</td>"
|
||||
, "</tr>"
|
||||
, "|c"
|
||||
, "</td></tr></table>"
|
||||
, "|}"
|
||||
), String_.Concat_lines_nl_skip_last
|
||||
( "<table>"
|
||||
, " <tr>"
|
||||
, " <td>a"
|
||||
, " </td>"
|
||||
, " </tr>"
|
||||
, " <tr>"
|
||||
, " <td>"
|
||||
, " <table>"
|
||||
, " <tr>"
|
||||
, " <td>b"
|
||||
, " </td>"
|
||||
, " </tr>"
|
||||
, " <tr>"
|
||||
, " <td>c"
|
||||
, " </td>"
|
||||
, " </tr>"
|
||||
, " </table>"
|
||||
, " </td>"
|
||||
, " </tr>"
|
||||
, "</table>"
|
||||
));
|
||||
}
|
||||
// @Test public void Nested_tbl_missing() { // PURPOSE: nested table not rendering properly; EX:ar.s:; DATE:2014-03-18
|
||||
// fxt.Test_parse_page_wiki_str(String_.Concat_lines_nl_skip_last
|
||||
// ( "{|"
|
||||
|
||||
@@ -68,4 +68,65 @@ public class Xop_tblw_wkr__tblx_tst {
|
||||
)
|
||||
);
|
||||
}
|
||||
@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
|
||||
( "{|"
|
||||
, "|-"
|
||||
, "|a"
|
||||
, "</td></tr>"
|
||||
, "<tr><td><table>"
|
||||
, "<tr><td>b</td>"
|
||||
, "</tr>"
|
||||
, "|c"
|
||||
, "</td></tr></table>"
|
||||
, "|}"
|
||||
), String_.Concat_lines_nl_skip_last
|
||||
( "<table>"
|
||||
, " <tr>"
|
||||
, " <td>a"
|
||||
, " </td>"
|
||||
, " </tr>"
|
||||
, " <tr>"
|
||||
, " <td>"
|
||||
, " <table>"
|
||||
, " <tr>"
|
||||
, " <td>b"
|
||||
, " </td>"
|
||||
, " </tr>"
|
||||
, " <tr>"
|
||||
, " <td>c"
|
||||
, " </td>"
|
||||
, " </tr>"
|
||||
, " </table>"
|
||||
, " </td>"
|
||||
, " </tr>"
|
||||
, "</table>"
|
||||
));
|
||||
}
|
||||
@Test public void Auto_tr_after_td() { // PURPOSE: "<tr><td>\n|" -> "<tr><td><tr><td>"; PAGE:fi.w:Salibandyn_maailmanmestaruuskilpailut_2012 DATE:2015-09-07
|
||||
fxt.Test_parse_page_wiki_str(String_.Concat_lines_nl_skip_last
|
||||
( "{|"
|
||||
, " <tr>"
|
||||
, " <td>a"
|
||||
, " </td>"
|
||||
, " <td>"
|
||||
, "|b"
|
||||
, "|}"
|
||||
) , String_.Concat_lines_nl_skip_last
|
||||
( "<table>"
|
||||
, " <tr>"
|
||||
, " <td>a"
|
||||
, " </td>"
|
||||
, " <td>" // NOTE: dangling <td> from above just gets auto-closed; no logic in tblw_wkr to actually remove it
|
||||
, " </td>"
|
||||
, " </tr>"
|
||||
, " <tr>" // <tr> inserted by transition from <td> to "\n|"
|
||||
, " <td>b"
|
||||
, " </td>"
|
||||
, " </tr>"
|
||||
, "</table>"
|
||||
, ""
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.parsers.tblws; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*;
|
||||
import gplx.core.btries.*;
|
||||
import gplx.xowa.parsers.xndes.*;
|
||||
public class Xop_tblw_ws_itm {
|
||||
public byte Tblw_type() {return tblw_type;} private byte tblw_type;
|
||||
public int Hook_len() {return hook_len;} private int hook_len;
|
||||
|
||||
Reference in New Issue
Block a user