mirror of
https://github.com/gnosygnu/xowa.git
synced 2024-10-27 20:34:16 +00:00
Parser.Table: Close previous paragraph when starting table
This commit is contained in:
parent
680e6b88d6
commit
ea46354cf8
@ -36,7 +36,9 @@ public class Xop_para_wkr_pre_tst {
|
|||||||
, "|a"
|
, "|a"
|
||||||
, "|}"
|
, "|}"
|
||||||
), String_.Concat_lines_nl
|
), String_.Concat_lines_nl
|
||||||
( "<table>"
|
( "<p>" // NOTE: <p> added for TRAILING_TBLW fix; DATE:2017-04-08
|
||||||
|
, "</p>"
|
||||||
|
, "<table>"
|
||||||
, " <tr>"
|
, " <tr>"
|
||||||
, " <td>a"
|
, " <td>a"
|
||||||
, " </td>"
|
, " </td>"
|
||||||
|
@ -53,8 +53,11 @@ public class Xop_tblw_wkr implements Xop_ctx_wkr {
|
|||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
switch (wlxr_type) {
|
switch (wlxr_type) {
|
||||||
case Tblw_type_tb: // "{|";
|
case Tblw_type_tb: { // "{|";
|
||||||
|
// close para when table starts; needed for TRAILING_TBLW fix; PAGE:en.w:Template_engine_(web) DATE:2017-04-08
|
||||||
|
ctx.Para().Process_block__bgn__nl_w_symbol(ctx, root, src, bgn_pos, cur_pos - 1, Xop_xnde_tag_.Tag__table); // -1 b/c cur_pos includes sym_byte; EX: \n{
|
||||||
break; // noop; by definition "{|" does not need to have a previous "{|"
|
break; // noop; by definition "{|" does not need to have a previous "{|"
|
||||||
|
}
|
||||||
case Tblw_type_td: // "|"
|
case Tblw_type_td: // "|"
|
||||||
case Tblw_type_td2: // "||"
|
case Tblw_type_td2: // "||"
|
||||||
if (tbl_is_xml) { // <td> should automatically add <table><tr>
|
if (tbl_is_xml) { // <td> should automatically add <table><tr>
|
||||||
|
@ -496,7 +496,9 @@ public class Xop_tblw_wkr__basic_tst {
|
|||||||
, " </td>"
|
, " </td>"
|
||||||
, " </tr>"
|
, " </tr>"
|
||||||
, "</table>"
|
, "</table>"
|
||||||
, "<br />" // was being ignored
|
, ""
|
||||||
|
, "<p><br />" // (a) <br/> was being ignored; (b) <p> added for TRAILING_TBLW fix; DATE:2017-04-08
|
||||||
|
, "</p>"
|
||||||
, "<table>"
|
, "<table>"
|
||||||
, " <tr>"
|
, " <tr>"
|
||||||
, " <td>b"
|
, " <td>b"
|
||||||
|
@ -151,4 +151,25 @@ public class Xop_tblw_wkr__para_tst {
|
|||||||
@Test public void Tblw_td2_should_not_create_ws() { // PURPOSE: a||b -> a\n||b; EX:none;discovered during luaj test; DATE:2014-04-14
|
@Test public void Tblw_td2_should_not_create_ws() { // PURPOSE: a||b -> a\n||b; EX:none;discovered during luaj test; DATE:2014-04-14
|
||||||
fxt.Test_parse_page_wiki_str("a||b", "<p>a||b\n</p>");
|
fxt.Test_parse_page_wiki_str("a||b", "<p>a||b\n</p>");
|
||||||
}
|
}
|
||||||
|
@Test public void Para_on_tblw() { // PURPOSE:table following link should automatically add para around link; PAGE:en.w:Template_engine_(web) DATE:2017-04-08
|
||||||
|
fxt.Test_parse_page_wiki_str(String_.Concat_lines_nl_skip_last
|
||||||
|
( "[[A]] b"
|
||||||
|
, "{|"
|
||||||
|
, "|-"
|
||||||
|
, "|c"
|
||||||
|
, "|}"
|
||||||
|
)
|
||||||
|
, String_.Concat_lines_nl_skip_last
|
||||||
|
( "<p><a href=\"/wiki/A\">A</a> b" // NOTE: previously, <p> was not included; now added for TRAILING_TBLW fix; DATE:2017-04-08
|
||||||
|
, "</p>"
|
||||||
|
, "<table>"
|
||||||
|
, " <tr>"
|
||||||
|
, " <td>c"
|
||||||
|
, " </td>"
|
||||||
|
, " </tr>"
|
||||||
|
, "</table>"
|
||||||
|
, ""
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user