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-07-06 22:58:35 -04:00
parent 57f65b4d0c
commit ecbe2918d8
187 changed files with 4184 additions and 2286 deletions

View File

@@ -53,7 +53,7 @@ public class Xop_lnki_wkr implements Xop_ctx_wkr, Xop_arg_wkr {
}
int lvl_pos = ctx.Stack_idx_typ(Xop_tkn_itm_.Tid_lnki);
if (lvl_pos == Xop_ctx.Stack_not_found) return ctx.Lxr_make_txt_(cur_pos); // "]]" found but no "[[" in stack; interpet "]]" literally
Xop_lnki_tkn lnki = (Xop_lnki_tkn)ctx.Stack_pop_til(root, src, lvl_pos, false, bgn_pos, cur_pos);
Xop_lnki_tkn lnki = (Xop_lnki_tkn)ctx.Stack_pop_til(root, src, lvl_pos, false, bgn_pos, cur_pos, Xop_tkn_itm_.Tid_lnki_end);
if (!arg_bldr.Bld(ctx, tkn_mkr, this, Xop_arg_wkr_.Typ_lnki, root, lnki, bgn_pos, cur_pos, lnki.Tkn_sub_idx() + 1, root.Subs_len(), src))
return Xop_lnki_wkr_.Invalidate_lnki(ctx, src, root, lnki, bgn_pos);
cur_pos = Xop_lnki_wkr_.Chk_for_tail(ctx.Lang(), src, cur_pos, src_len, lnki);

View File

@@ -93,6 +93,9 @@ public class Xop_lnki_wkr_basic_tst {
@Test public void Size_large_numbers() { // PURPOSE: perf code identified large sizes as caption; DATE:2014-02-15
fxt.Test_parse_page_wiki("[[Image:a|1234567890x1234567890px]]" , fxt.tkn_lnki_().Width_(1234567890).Height_(1234567890));
}
@Test public void Size_dangling_xnde() { // PURPOSE: dangling xnde should not eat rest of lnki; PAGE:sr.w:Сићевачка_клисура DATE:2014-07-03
fxt.Init_log_(Xop_xnde_log.Dangling_xnde).Test_parse_page_wiki("[[Image:a.png|<b>c|40px]]" , fxt.tkn_lnki_().Width_(40).Height_(-1));
}
@Test public void Size_ws_para() { // PURPOSE: <p> in arg_bldr causes parse to fail; EX: w:Supreme_Court_of_the_United_States; DATE:2014-04-05
fxt.Init_para_y_();
fxt.Test_parse_page_all("[[File:A.png| \n 40px]]"
@@ -182,9 +185,8 @@ public class Xop_lnki_wkr_basic_tst {
fxt.Test_parse_page_wiki("[[ ]]", fxt.tkn_txt_(0, 2), fxt.tkn_space_(2, 3), fxt.tkn_txt_(3, 5));
}
@Test public void Exc_invalid_utf8() { // PURPOSE: "%DO" is an invalid UTF-8 sequence (requires 2 bytes, not just %D0); DATE:2013-11-11
fxt.Ctx().Lang().Case_mgr().Add_bulk(Xol_case_itm_.Universal); // NOTE: only occurs during Universal
fxt.Test_parse_page_all_str("[[%D0]]", "[[%D0]]"); // invalid titles render literally
fxt.Ctx().Lang().Case_mgr().Add_bulk(Xol_case_itm_.English);
fxt.Ctx().Lang().Case_mgr_utf8_(); // NOTE: only occurs during Universal
fxt.Test_parse_page_all_str("[[%D0]]", "[[%D0]]"); // invalid titles render literally
}
@Test public void Ex_eq() { // make sure that eq is not evaluated for kv delimiter
fxt.Test_parse_page_wiki("[[=]]", fxt.tkn_lnki_(0, 5));