1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00

v1.10.4.1

This commit is contained in:
gnosygnu
2014-10-26 22:13:39 -04:00
parent 7d8984f6a8
commit eddb6bebc7
71 changed files with 1265 additions and 366 deletions

View File

@@ -103,9 +103,9 @@ public class Xop_xnde_wkr implements Xop_ctx_wkr {
}
if (tag_obj == null) { // not a known xml tag; EX: "<abcd>"; "if 5 < 7 then"
if (ctx.Parse_tid() == Xop_parser_.Parse_tid_page_wiki) {
if (ctx_cur_tid_is_tblw_atr_owner) // <unknown_tag is occurring inside tblw element (EX: {| style='margin:1em<f'); just add to txt tkn
if (ctx_cur_tid_is_tblw_atr_owner) // unknown_tag is occurring inside tblw element (EX: {| style='margin:1em<f'); just add to txt tkn
return ctx.Lxr_make_txt_(cur_pos);
else { // <unknown_tag is occurring anyhwere else; escape < to &lt; and resume from character just after it;
else { // unknown_tag is occurring anyhwere else; escape < to &lt; and resume from character just after it;
ctx.Subs_add(root, Make_bry_tkn(tkn_mkr, src, bgn_pos, cur_pos));
return cur_pos;
}
@@ -218,9 +218,9 @@ public class Xop_xnde_wkr implements Xop_ctx_wkr {
private static Xop_tkn_itm Make_bry_tkn(Xop_tkn_mkr tkn_mkr, byte[] src, int bgn_pos, int cur_pos) {
int len = cur_pos - bgn_pos;
byte[] bry = null;
if (len == 1 && src[cur_pos] == Byte_ascii.Lt) bry = Html_entity_.Lt_bry;
else if (len == 2 && src[cur_pos] == Byte_ascii.Lt
&& src[cur_pos + 1] == Byte_ascii.Slash) bry = Bry_escape_lt_slash;
if (len == 1 && src[bgn_pos] == Byte_ascii.Lt) bry = Html_entity_.Lt_bry;
else if (len == 2 && src[bgn_pos] == Byte_ascii.Lt
&& src[bgn_pos + 1] == Byte_ascii.Slash) bry = Bry_escape_lt_slash; // NOTE: should use bgn_pos, not cur_pos; DATE:2014-10-22
else bry = Bry_.Add(Html_entity_.Lt_bry, Bry_.Mid(src, bgn_pos + 1, cur_pos)); // +1 to skip <
return tkn_mkr.Bry_raw(bgn_pos, cur_pos, bry);
}

View File

@@ -41,7 +41,7 @@ public class Xop_xnde_wkr__err_malformed_tst {
}
@Test public void Incomplete_tag_ref() {// PURPOSE: invalid tag shouldn't break parser; EX:w:Cullen_(surname); "http://www.surnamedb.com/Surname/Cullen<ref"
fxt.Test_parse_page_all_str("a<ref", "a&lt;ref");
}
}
@Test public void Inline_tag_fix() { // PURPOSE: force <b/> to be <b></b>; EX: w:Exchange_value
fxt.Init_log_(Xop_xnde_log.No_inline);
fxt.Test_parse_page_all_str("<b/>", "<b></b>");
@@ -66,4 +66,9 @@ public class Xop_xnde_wkr__err_malformed_tst {
, "</div>"
));
}
@Test public void Incomplete_tag() { // PURPOSE: handle incomplete tag sequences; DATE:2014-10-22
fxt.Test_parse_page_all_str("<", "&lt;");
fxt.Test_parse_page_all_str("</", "&lt;/");
fxt.Test_parse_page_all_str("</<", "&lt;/&lt;"); // this used to fail
}
}

View File

@@ -164,7 +164,7 @@ public class Xop_xnde_wkr__include_uncommon_tst {
);
fxt.Init_defn_clear();
}
@Test public void Pre_and_includeonly() {
@Test public void Pre_and_includeonly() { // PAGE:https://en.wikipedia.org/wiki/BSD_licenses DATE:2014-05-23
fxt.Init_defn_add("pre2", "<pre<includeonly></includeonly>>{{{1}}}</pre>");
fxt.Test_parse_page_all_str
( "{{pre2|a}}"