1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2025-05-30 14:04:56 +00:00

Remove unused invk branch; Update tests [#460]

This commit is contained in:
gnosygnu 2019-05-12 23:42:42 -04:00
parent c07e6e25b5
commit 648cd4944a
2 changed files with 15 additions and 18 deletions

View File

@ -71,17 +71,6 @@ public class Pfunc_anchorencode_mgr {
}
break;
}
case Xop_tkn_itm_.Tid_tmpl_invk:
Xot_invk_tkn invk_tkn = (Xot_invk_tkn)sub;
Arg_itm_tkn name_tkn = invk_tkn.Name_tkn().Key_tkn();
int name_ary_bgn = name_tkn.Src_bgn() + 1, name_ary_end = name_tkn.Src_end();
byte[] name_ary = Bry_.Mid(src, name_ary_bgn, name_ary_end); // + 1 to skip :
int name_ary_len = name_ary_end - name_ary_bgn;
if (name_ary_len > 0 && name_ary[0] == Byte_ascii.Colon) // has initial colon; EX: {{:a}
tmp_bfr.Add_mid(name_ary, 1, name_ary_len); // 1 to skip initial colon
else // regular tmpl; EX: {{a}}
tmp_bfr.Add(ctx.Wiki().Ns_mgr().Ns_template().Gen_ttl(name_ary));
break;
case Xop_tkn_itm_.Tid_lnki:
Lnki((Xop_lnki_tkn)sub);
break;

View File

@ -31,6 +31,9 @@ public class Pfunc_anchorencode_tst {
@Test public void Html_ref() {
fxt.Test("{{anchorencode:a " b}}", "a_"_b");
}
@Test public void Xnde() {
fxt.Test("{{anchorencode:a <i>b</i> c}}", "a_b_c");
}
@Test public void Lnke() {
fxt.Test("{{anchorencode:[irc://a b c]}}", "b_c");
}
@ -52,14 +55,15 @@ public class Pfunc_anchorencode_tst {
@Test public void Lnki_caption_html() { // ISSUE#:460
fxt.Test("{{anchorencode:[[a|<span style=\"color:red\">b</span>]]}}", "b");
}
@Test public void Xnde() {
fxt.Test("{{anchorencode:a <i>b</i> c}}", "a_b_c");
@Test public void Lnki_missing_basic() {
fxt.Test("{{anchorencode:{{Xowa_missing}}}}", "Template:Xowa_missing");
}
@Test public void Tmpl_missing_basic() {
fxt.Test("{{anchorencode:{{xowa_na}}}}", "Template:xowa_na");
@Test public void Lnki_missing_colon() {
fxt.Test("{{anchorencode:{{:Xowa_missing}}}}", "Xowa_missing");
}
@Test public void Tmpl_missing_colon() {
fxt.Test("{{anchorencode:{{:xowa_na}}}}", "xowa_na"); // NOTE: changed from "Template:A" to "a"; DATE:2016-06-24
@Test public void Tmpl() {
fxt.Make_page("Template:Xowa1", "a<span>b</span>c");
fxt.Test(false, "{{anchorencode:{{Xowa1}}}}", "abc");
}
}
class Pfunc_anchorenchode_fxt {
@ -71,7 +75,11 @@ class Pfunc_anchorenchode_fxt {
public void Reset() {
fxt.Reset();
}
public void Test(String raw, String expd) {
public void Make_page(String ttl, String text) {
fxt.Init_page_create(ttl, text);
}
public void Test(String raw, String expd) {this.Test(dbg, raw, expd);}
public void Test(boolean dbg, String raw, String expd) {
if (dbg) Console_adp__sys.Instance.Write_str(fxt.Make__test_string(raw, expd));
fxt.Test_str_full(raw, expd, fxt.Exec_parse_page_all_as_str(raw));
}