1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2024-10-27 20:34:16 +00:00

Parser.Xml: Fix script error 'Unable to convert section' on 1 en.w page

This commit is contained in:
gnosygnu 2017-04-10 21:32:56 -04:00
parent d9377b5162
commit 80f572a06c
2 changed files with 11 additions and 2 deletions

View File

@ -123,7 +123,8 @@ public class Xop_xnde_tkn extends Xop_tkn_itm_base implements Xop_tblw_tkn {
cur_bfr.Add_mid(src, tag_close_bgn, tag_close_end);
// xtn is unclosed; add a </xtn> else rest of page will be gobbled; PAGE:en.w:Provinces_and_territories_of_Canada DATE:2014-11-13
if (tag_close_bgn == Int_.Min_value) {
// NOTE: must check for inline else will output trailing '</xtn>' after '<xtn/>' PAGE:en.w:National_Popular_Vote_Interstate_Compact DATE:2017-04-10
if (tag_close_bgn == Int_.Min_value && closeMode != Xop_xnde_tkn.CloseMode_inline) {
cur_bfr.Add(tag.Xtn_end_tag());
cur_bfr.Add(Byte_ascii.Gt_bry);
}

View File

@ -16,7 +16,7 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
package gplx.xowa.parsers.xndes; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*;
import org.junit.*; import gplx.xowa.parsers.lists.*;
public class Xop_xnde_wkr__err_dangling_tst {
private final Xop_fxt fxt = new Xop_fxt();
private final Xop_fxt fxt = new Xop_fxt();
@After public void term() {fxt.Init_para_n_();}
@Test public void Basic() {
fxt.Init_log_(Xop_xnde_log.Dangling_xnde)
@ -193,4 +193,12 @@ public class Xop_xnde_wkr__err_dangling_tst {
, " b"
));
}
@Test public void Section_inline() { // PURPOSE.FIX:do not output trailing '</xtn>' after '<xtn/>' PAGE:en.w:National_Popular_Vote_Interstate_Compact DATE:2017-04-10
fxt.Init_page_create("Template:Abc", "<section begin=key/>val<section end=key/>");
fxt.Test_parse_page_tmpl_str(String_.Concat_lines_nl_skip_last
( "{{Abc}}"
), String_.Concat_lines_nl_skip_last
( "<section begin=key/>val<section end=key/>" // fails if "<section begin=key/></section>val<section end=key/></section>"
));
}
}