mirror of
https://github.com/gnosygnu/xowa.git
synced 2024-10-27 20:34:16 +00:00
Scribunto.Common: Fix script error 'Country data' on many en.w game pages
This commit is contained in:
parent
be0d09aaff
commit
00318ce8cf
@ -309,7 +309,9 @@ public class Scrib_lib_mw implements Scrib_lib {
|
||||
String ttl_str = args.Pull_str(1);
|
||||
byte[] ttl_bry = Bry_.new_u8(ttl_str);
|
||||
Xoa_ttl ttl = Xoa_ttl.Parse(cur_wiki, ttl_bry); // parse directly; handles titles where template is already part of title; EX: "Template:A"
|
||||
if (ttl == null) return rslt.Init_ary_empty(); // invalid ttl;
|
||||
if (ttl == null) {
|
||||
return rslt.Init_fail("expandTemplate: invalid title \"" + ttl_str + "\""); // NOTE: must return error if title is invalid; PAGE:en.w:Tetris DATE:2017-04-09
|
||||
}
|
||||
if (!ttl.ForceLiteralLink() && ttl.Ns().Id_is_main()) // title is not literal and is not prefixed with Template; parse again as template; EX: ":A" and "Template:A" are fine; "A" is parsed again as "Template:A"
|
||||
ttl = Xoa_ttl.Parse(cur_wiki, Bry_.Add(cur_wiki.Ns_mgr().Ns_template().Name_db_w_colon(), ttl_bry)); // parse again, but add "Template:"
|
||||
Keyval[] args_ary = args.Pull_kv_ary_safe(2);
|
||||
|
@ -89,7 +89,11 @@ public class Scrib_lib_mw__lib_tst {
|
||||
}
|
||||
@Test public void ExpandTemplate__missing_template() {// PURPOSE: return error if template is missing; PAGE:en.w:Flag_of_Greenland DATE:2016-05-02
|
||||
fxt.Init_page("{{#invoke:Mod_0|Prc_0}}");
|
||||
fxt.Test_scrib_proc_err(lib, Scrib_lib_mw.Invk_expandTemplate, Object_.Ary("current", "A", Scrib_kv_utl_.flat_many_(1, "a")), "expandTemplate: template \"A\" does not exist");
|
||||
fxt.Test_scrib_proc_err(lib, Scrib_lib_mw.Invk_expandTemplate, Object_.Ary("current", "A", Scrib_kv_utl_.flat_many_(2, "need to pass arg to reach error message")), "expandTemplate: template \"A\" does not exist");
|
||||
}
|
||||
@Test public void ExpandTemplate__invalid_title() {// PURPOSE: return error if title is invalid; PAGE:en.w:Tetris DATE:2017-04-09
|
||||
fxt.Init_page("{{#invoke:Mod_0|Prc_0}}");
|
||||
fxt.Test_scrib_proc_err(lib, Scrib_lib_mw.Invk_expandTemplate, Object_.Ary("current", "[[A]]"), "expandTemplate: invalid title \"[[A]]\"");
|
||||
}
|
||||
@Test public void SetTTL() {
|
||||
fxt.Test_scrib_proc_empty(lib, Scrib_lib_mw.Invk_setTTL, Object_.Ary(123));
|
||||
|
Loading…
Reference in New Issue
Block a user