mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
'v3.7.2.1'
This commit is contained in:
@@ -93,7 +93,7 @@ public class Scrib_lib_language implements Scrib_lib {
|
||||
}
|
||||
public boolean IsValidCode(Scrib_proc_args args, Scrib_proc_rslt rslt) { // REF.MW: Language.php!isValidCode
|
||||
byte[] lang_code = args.Pull_bry(0);
|
||||
boolean valid = Xoa_ttl.parse(core.Wiki(), lang_code) != null; // NOTE: MW calls Title::getTitleInvalidRegex()
|
||||
boolean valid = Xoa_ttl.Parse(core.Wiki(), lang_code) != null; // NOTE: MW calls Title::getTitleInvalidRegex()
|
||||
if (valid) {
|
||||
int len = lang_code.length;
|
||||
for (int i = 0; i < len; i++) {
|
||||
|
||||
@@ -99,11 +99,11 @@ class Scrib_lib_message_data {
|
||||
if (data_ttl == null)
|
||||
ttl = ctx.Page().Ttl();
|
||||
else
|
||||
ttl = Xoa_ttl.parse(wiki, data_ttl);
|
||||
ttl = Xoa_ttl.Parse(wiki, data_ttl);
|
||||
}
|
||||
if (raw_msg_key != null) {
|
||||
Xol_msg_itm raw_msg_itm = new Xol_msg_itm(-1, Bry_.Empty);
|
||||
Bry_bfr tmp_bfr = wiki.Utl__bfr_mkr().Get_b512();
|
||||
Bry_bfr tmp_bfr = Bry_bfr_.New(); // wiki.Utl__bfr_mkr().Get_b512();
|
||||
byte[] raw_msg_val = Xoa_gfs_php_mgr.Xto_gfs(tmp_bfr, raw_msg_key);
|
||||
Xol_msg_itm_.update_val_(raw_msg_itm, raw_msg_val);
|
||||
byte[] raw_msg_rv = wiki.Msg_mgr().Val_by_itm(tmp_bfr, raw_msg_itm, args);
|
||||
|
||||
@@ -95,12 +95,12 @@ public class Scrib_lib_mw implements Scrib_lib {
|
||||
String mod_code = fsys_mgr.Get_or_null(mod_name); // check if mod_name a file in /lualib/ directoryScribunto .lua file (in /lualib/)
|
||||
if (mod_code != null)
|
||||
return rslt.Init_obj(core.Interpreter().LoadString("@" + mod_name + ".lua", mod_code));
|
||||
Xoa_ttl ttl = Xoa_ttl.parse(cur_wiki, Bry_.new_u8(mod_name));// NOTE: should have Module: prefix
|
||||
Xoa_ttl ttl = Xoa_ttl.Parse(cur_wiki, Bry_.new_u8(mod_name));// NOTE: should have Module: prefix
|
||||
if (ttl == null) return rslt.Init_ary_empty();
|
||||
Xoae_page page = cur_wiki.Data_mgr().Load_page_by_ttl(ttl);
|
||||
if (page.Missing()) return rslt.Init_ary_empty();
|
||||
if (page.Db().Page().Exists_n()) return rslt.Init_ary_empty();
|
||||
Scrib_lua_mod mod = new Scrib_lua_mod(core, mod_name);
|
||||
return rslt.Init_obj(mod.LoadString(String_.new_u8(page.Data_raw())));
|
||||
return rslt.Init_obj(mod.LoadString(String_.new_u8(page.Db().Text().Text_bry())));
|
||||
}
|
||||
public boolean LoadPHPLibrary(Scrib_proc_args args, Scrib_proc_rslt rslt) { // NOTE: noop; Scribunto uses this to load the Scribunto_*Library classses (EX: Scribunto_TitleLibrary); DATE:2015-01-21
|
||||
return rslt.Init_obj(null);
|
||||
@@ -224,7 +224,7 @@ public class Scrib_lib_mw implements Scrib_lib {
|
||||
String text_str = args.Pull_str(1);
|
||||
byte[] text_bry = Bry_.new_u8(text_str);
|
||||
Xop_root_tkn tmp_root = ctx.Tkn_mkr().Root(text_bry);
|
||||
Xop_ctx tmp_ctx = Xop_ctx.new_sub_(cur_wiki);
|
||||
Xop_ctx tmp_ctx = Xop_ctx.new_sub_(core.Ctx());
|
||||
int args_adj = Scrib_frame_.Get_arg_adj(frame_tid);
|
||||
int args_len = frame.Args_len() - args_adj;
|
||||
Keyval[] kv_args = new Keyval[args_len];
|
||||
@@ -244,6 +244,7 @@ public class Scrib_lib_mw implements Scrib_lib {
|
||||
tmp_root.Tmpl_evaluate(tmp_ctx, text_bry, mock_frame, tmp_bfr);
|
||||
return rslt.Init_obj(tmp_bfr.To_str_and_rls());
|
||||
}
|
||||
private static final Xol_func_itm finder = new Xol_func_itm();
|
||||
public boolean CallParserFunction(Scrib_proc_args args, Scrib_proc_rslt rslt) {
|
||||
String frame_id = args.Pull_str(0);
|
||||
int frame_tid = Scrib_frame_.Get_frame_tid(frame_id);
|
||||
@@ -254,11 +255,17 @@ public class Scrib_lib_mw implements Scrib_lib {
|
||||
Bry_obj_ref fnc_name_ref = Bry_obj_ref.New(fnc_name);
|
||||
Keyval[] parser_func_args = CallParserFunction_parse_args(cur_wiki.Appe().Utl_num_parser(), argx_ref, fnc_name_ref, args.Ary());
|
||||
Xot_invk_mock frame = Xot_invk_mock.new_(parent_frame.Defn_tid(), 0, fnc_name, parser_func_args); // pass something as frame_ttl; choosng fnc_name; DATE:2014-09-21
|
||||
Xol_func_itm finder = cur_wiki.Lang().Func_regy().Find_defn(fnc_name, 0, fnc_name_len);
|
||||
Xot_defn defn = finder.Func();
|
||||
|
||||
|
||||
Xot_defn defn;
|
||||
synchronized (finder) {
|
||||
cur_wiki.Lang().Func_regy().Find_defn(finder, fnc_name, 0, fnc_name_len);
|
||||
defn = finder.Func();
|
||||
}
|
||||
|
||||
if (defn == Xot_defn_.Null) throw Err_.new_wo_type("callParserFunction: function was not found", "function", String_.new_u8(fnc_name));
|
||||
Bry_bfr bfr = cur_wiki.Utl__bfr_mkr().Get_k004();
|
||||
Xop_ctx fnc_ctx = Xop_ctx.new_sub_(cur_wiki);
|
||||
Xop_ctx fnc_ctx = Xop_ctx.new_sub_(core.Ctx());
|
||||
fnc_ctx.Parse_tid_(Xop_parser_.Parse_tid_page_tmpl); // default xnde names to template; needed for test, but should be in place; DATE:2014-06-27
|
||||
Xot_invk_tkn.Eval_func(fnc_ctx, src, parent_frame, frame, bfr, defn, argx_ref.Val());
|
||||
bfr.Mkr_rls();
|
||||
@@ -302,10 +309,10 @@ public class Scrib_lib_mw implements Scrib_lib {
|
||||
public boolean ExpandTemplate(Scrib_proc_args args, Scrib_proc_rslt rslt) {
|
||||
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"
|
||||
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.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:"
|
||||
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);
|
||||
// BLOCK.bgn:Xot_invk_tkn.Transclude; cannot reuse b/c Transclude needs invk_tkn, and invk_tkn is manufactured late; DATE:2014-01-02
|
||||
byte[] sub_src = null;
|
||||
@@ -351,10 +358,10 @@ public class Scrib_lib_mw implements Scrib_lib {
|
||||
Xoa_ttl ttl = null;
|
||||
if (Type_adp_.ClassOf_obj(ttl_obj) != String.class) { // title = false
|
||||
byte[] ttl_bry = frame.Frame_ttl();
|
||||
ttl = Xoa_ttl.parse(core.Wiki(), ttl_bry);
|
||||
ttl = Xoa_ttl.Parse(core.Wiki(), ttl_bry);
|
||||
}
|
||||
else {
|
||||
ttl = Xoa_ttl.parse(cur_wiki, Bry_.new_u8((String)ttl_obj));
|
||||
ttl = Xoa_ttl.Parse(cur_wiki, Bry_.new_u8((String)ttl_obj));
|
||||
if (ttl == null) throw Err_.new_wo_type("newChild: invalid title", "title", (String)ttl_obj);
|
||||
}
|
||||
Keyval[] args_ary = args.Pull_kv_ary_safe(2);
|
||||
|
||||
@@ -70,13 +70,11 @@ public class Scrib_lib_site implements Scrib_lib {
|
||||
}
|
||||
else {
|
||||
int rv_count = 0;
|
||||
switch (ctg_type) {
|
||||
case "all": rv_count = ctg_itm.All; break;
|
||||
case "pages": rv_count = ctg_itm.Pages; break;
|
||||
case "subcats": rv_count = ctg_itm.Subcs; break;
|
||||
case "files": rv_count = ctg_itm.Files; break;
|
||||
default: throw Scrib_err.Make__err__arg(Invk_pagesInCategory, 2, ctg_type, "one of '*', 'all', 'pages', 'subcats', or 'files'");
|
||||
}
|
||||
if (String_.Eq(ctg_type, "all")) rv_count = ctg_itm.All;
|
||||
else if (String_.Eq(ctg_type, "pages")) rv_count = ctg_itm.Pages;
|
||||
else if (String_.Eq(ctg_type, "subcats")) rv_count = ctg_itm.Subcs;
|
||||
else if (String_.Eq(ctg_type, "files")) rv_count = ctg_itm.Files;
|
||||
else throw Scrib_err.Make__err__arg(Invk_pagesInCategory, 2, ctg_type, "one of '*', 'all', 'pages', 'subcats', or 'files'");
|
||||
return rslt.Init_obj(rv_count);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.xtns.scribunto.libs; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.scribunto.*;
|
||||
import gplx.langs.jsons.*;
|
||||
class Scrib_lib_text__json_util {
|
||||
private final Json_wtr wtr = new Json_wtr();
|
||||
private final Json_wtr wtr = new Json_wtr();
|
||||
public void Reindex_arrays(Scrib_lib_text__reindex_data rv, Keyval[] kv_ary, boolean is_encoding) {
|
||||
int next = 0;
|
||||
if (is_encoding) {
|
||||
@@ -112,10 +112,10 @@ class Scrib_lib_text__json_util {
|
||||
}
|
||||
private Object Decode_ary(Json_ary ary) {
|
||||
int len = ary.Len();
|
||||
Object rv = Array_.Create(Object.class, len);
|
||||
Object[] rv = new Object[len];
|
||||
for (int i = 0; i < len; ++i) {
|
||||
Json_itm itm = ary.Get_at(i);
|
||||
Array_.Set_at(rv, i, Decode_obj(itm));
|
||||
rv[i] = Decode_obj(itm);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
@@ -200,7 +200,7 @@ class KeyVal__sorter__key_is_numeric implements gplx.core.lists.ComparerAble {
|
||||
int rhs_int = Int_.parse_or(rhs_itm.Key(), Int_.Min_value);
|
||||
return CompareAble_.Compare(lhs_int, rhs_int);
|
||||
}
|
||||
public static final KeyVal__sorter__key_is_numeric Instance = new KeyVal__sorter__key_is_numeric(); KeyVal__sorter__key_is_numeric() {}
|
||||
public static final KeyVal__sorter__key_is_numeric Instance = new KeyVal__sorter__key_is_numeric(); KeyVal__sorter__key_is_numeric() {}
|
||||
}
|
||||
class Scrib_lib_text__reindex_data {
|
||||
public boolean Rv_is_kvy() {return rv_is_kvy;} private boolean rv_is_kvy;
|
||||
|
||||
@@ -69,7 +69,7 @@ public class Scrib_lib_title implements Scrib_lib {
|
||||
Bry_bfr bfr = wiki.Utl__bfr_mkr().Get_b512();
|
||||
ttl_bry = bfr.Add(ns_bry).Add_byte(Byte_ascii.Colon).Add(ttl_bry).To_bry_and_rls();
|
||||
}
|
||||
Xoa_ttl ttl = Xoa_ttl.parse(core.Wiki(), ttl_bry);
|
||||
Xoa_ttl ttl = Xoa_ttl.Parse(core.Wiki(), ttl_bry);
|
||||
if (ttl == null) return rslt.Init_obj(null); // invalid title; exit; matches MW logic
|
||||
return rslt.Init_obj(GetInexpensiveTitleData(ttl));
|
||||
}
|
||||
@@ -83,7 +83,7 @@ public class Scrib_lib_title implements Scrib_lib {
|
||||
byte url_func_tid = ((Byte_obj_val)url_func_obj).Val();
|
||||
byte[] qry_bry = args.Extract_qry_args(wiki, 2);
|
||||
// byte[] proto = Scrib_kv_utl_.Val_to_bry_or(values, 3, null); // NOTE: Scribunto has more conditional logic around argument 2 and setting protocols; DATE:2014-07-07
|
||||
Xoa_ttl ttl = Xoa_ttl.parse(wiki, ttl_bry); if (ttl == null) return rslt.Init_obj(null);
|
||||
Xoa_ttl ttl = Xoa_ttl.Parse(wiki, ttl_bry); if (ttl == null) return rslt.Init_obj(null);
|
||||
Bry_bfr bfr = wiki.Appe().Utl__bfr_mkr().Get_b512();
|
||||
//if (url_func_tid == Pfunc_urlfunc.Tid_full) {
|
||||
// if (proto == null) proto = Proto_relative;
|
||||
@@ -124,13 +124,13 @@ public class Scrib_lib_title implements Scrib_lib {
|
||||
tmp_bfr.Add(ns_bry).Add_byte(Byte_ascii.Colon);
|
||||
tmp_bfr.Add_str_u8(ttl_str);
|
||||
if (anchor_str != null) tmp_bfr.Add_byte(Byte_ascii.Hash).Add_str_u8(anchor_str);
|
||||
Xoa_ttl ttl = Xoa_ttl.parse(wiki, tmp_bfr.To_bry_and_rls());
|
||||
Xoa_ttl ttl = Xoa_ttl.Parse(wiki, tmp_bfr.To_bry_and_rls());
|
||||
if (ttl == null) return rslt.Init_obj(null); // invalid title; exit;
|
||||
return rslt.Init_obj(GetInexpensiveTitleData(ttl));
|
||||
}
|
||||
public boolean GetExpensiveData(Scrib_proc_args args, Scrib_proc_rslt rslt) {
|
||||
byte[] ttl_bry = args.Pull_bry(0);
|
||||
Xoa_ttl ttl = Xoa_ttl.parse(core.Wiki(), ttl_bry);
|
||||
Xoa_ttl ttl = Xoa_ttl.Parse(core.Wiki(), ttl_bry);
|
||||
if (ttl == Xoa_ttl.Null) return rslt.Init_null();
|
||||
// TODO_OLD: MW does extra logic here to cache ttl in ttl cache to avoid extra title lookups
|
||||
boolean ttl_exists = false, ttl_redirect = false; int ttl_id = 0;
|
||||
@@ -151,11 +151,11 @@ public class Scrib_lib_title implements Scrib_lib {
|
||||
public boolean GetFileInfo(Scrib_proc_args args, Scrib_proc_rslt rslt) {
|
||||
byte[] ttl_bry = args.Pull_bry(0);
|
||||
Xowe_wiki wiki = core.Wiki();
|
||||
Xoa_ttl ttl = Xoa_ttl.parse(wiki, ttl_bry);
|
||||
Xoa_ttl ttl = Xoa_ttl.Parse(wiki, ttl_bry);
|
||||
if ( ttl == null
|
||||
|| !ttl.Ns().Id_is_file_or_media()
|
||||
) return rslt.Init_obj(GetFileInfo_absent);
|
||||
if (ttl.Ns().Id_is_media()) ttl = Xoa_ttl.parse(wiki, Xow_ns_.Tid__file, ttl.Page_db()); // if [[Media:]] change to [[File:]]; theoretically, this should be changed in Get_page, but not sure if I want to put this logic that low; DATE:2014-01-07
|
||||
if (ttl.Ns().Id_is_media()) ttl = Xoa_ttl.Parse(wiki, Xow_ns_.Tid__file, ttl.Page_db()); // if [[Media:]] change to [[File:]]; theoretically, this should be changed in Get_page, but not sure if I want to put this logic that low; DATE:2014-01-07
|
||||
// Xoae_page file_page = Pfunc_filepath.Load_page(wiki, ttl); // EXPENSIVE
|
||||
// boolean exists = !file_page.Missing();
|
||||
// if (!exists) return rslt.Init_obj(Keyval_.Ary(Keyval_.new_("exists", false))); // NOTE: do not reinstate; will exit early if commons is not installed; DATE:2015-01-25; NOTE: Media objects are often flagged as absent in offline mode
|
||||
@@ -175,7 +175,7 @@ public class Scrib_lib_title implements Scrib_lib {
|
||||
public boolean GetContent(Scrib_proc_args args, Scrib_proc_rslt rslt) {
|
||||
byte[] ttl_bry = args.Pull_bry(0);
|
||||
Xowe_wiki wiki = core.Wiki();
|
||||
Xoa_ttl ttl = Xoa_ttl.parse(wiki, ttl_bry); if (ttl == null) return rslt.Init_obj(null);
|
||||
Xoa_ttl ttl = Xoa_ttl.Parse(wiki, ttl_bry); if (ttl == null) return rslt.Init_obj(null);
|
||||
Xow_page_cache_itm page_itm = wiki.Cache_mgr().Page_cache().Get_or_load_as_itm_2(ttl);
|
||||
byte[] rv = null;
|
||||
if (page_itm != null) {
|
||||
@@ -195,13 +195,13 @@ public class Scrib_lib_title implements Scrib_lib {
|
||||
public boolean ProtectionLevels(Scrib_proc_args args, Scrib_proc_rslt rslt) {
|
||||
// byte[] ttl_bry = args.Pull_bry(0);
|
||||
// Xowe_wiki wiki = core.Wiki();
|
||||
// Xoa_ttl ttl = Xoa_ttl.parse(wiki, ttl_bry); if (ttl == null) return rslt.Init_obj(null);
|
||||
// Xoa_ttl ttl = Xoa_ttl.Parse(wiki, ttl_bry); if (ttl == null) return rslt.Init_obj(null);
|
||||
return rslt.Init_many_objs(""); // NOTE: always return no protection; protectionLevels are stored in different table which is currently not mirrored; DATE:2014-04-09
|
||||
}
|
||||
public boolean CascadingProtection(Scrib_proc_args args, Scrib_proc_rslt rslt) {
|
||||
byte[] ttl_bry = args.Pull_bry(0);
|
||||
Xowe_wiki wiki = core.Wiki();
|
||||
Xoa_ttl ttl = Xoa_ttl.parse(wiki, ttl_bry); if (ttl == null) return rslt.Init_obj(null);
|
||||
Xoa_ttl ttl = Xoa_ttl.Parse(wiki, ttl_bry); if (ttl == null) return rslt.Init_obj(null);
|
||||
return rslt.Init_obj(CascadingProtection_rv);
|
||||
}
|
||||
public static final Keyval[] CascadingProtection_rv = Keyval_.Ary(Keyval_.new_("sources", Bool_.N), Keyval_.new_("restrictions", Keyval_.Ary_empty));
|
||||
|
||||
@@ -53,7 +53,6 @@ public class Scrib_lib_title_tst {
|
||||
fxt.Test__proc__objs__nest(lib, Scrib_lib_title.Invk_makeTitle, Object_.Ary("Template", "A", "b") , ttl_fast(10, "Template", "A", "b"));
|
||||
fxt.Parser_fxt().Wiki().Xwiki_mgr().Add_by_atrs("fr", "fr.wikipedia.org");
|
||||
fxt.Test__proc__objs__nest(lib, Scrib_lib_title.Invk_makeTitle, Object_.Ary("Template", "A", "b", "fr") , ttl_fast(0, "", "Template:A", "b", "fr"));
|
||||
fxt.Parser_fxt().Init_log_(gplx.xowa.wikis.ttls.Xop_ttl_log.Invalid_char);
|
||||
fxt.Test__proc__objs__nest(lib, Scrib_lib_title.Invk_makeTitle, Object_.Ary("Template", "a[b"), Scrib_invoke_func_fxt.Null_rslt_ary); // PURPOSE: handle bad MakeTitle cmds; PAGE:en.w:Disney; DATE:2013-10-15
|
||||
}
|
||||
@Test public void GetExpensiveData_absent() {
|
||||
|
||||
@@ -43,7 +43,7 @@ public class Scrib_lib_uri implements Scrib_lib {
|
||||
}
|
||||
private static final int Proc_anchorEncode = 0, Proc_localUrl = 1, Proc_fullUrl = 2, Proc_canonicalUrl = 3, Proc_init_uri_for_page = 4;
|
||||
public static final String Invk_anchorEncode = "anchorEncode", Invk_localUrl = "localUrl", Invk_fullUrl = "fullUrl", Invk_canonicalUrl = "canonicalUrl", Invk_init_uri_for_page = "init_uri_for_page";
|
||||
private static final String[] Proc_names = String_.Ary(Invk_anchorEncode, Invk_localUrl, Invk_fullUrl, Invk_canonicalUrl, Invk_init_uri_for_page);
|
||||
private static final String[] Proc_names = String_.Ary(Invk_anchorEncode, Invk_localUrl, Invk_fullUrl, Invk_canonicalUrl, Invk_init_uri_for_page);
|
||||
public boolean AnchorEncode(Scrib_proc_args args, Scrib_proc_rslt rslt) {
|
||||
byte[] raw_bry = args.Pull_bry(0);
|
||||
Bry_bfr bfr = core.App().Utl__bfr_mkr().Get_b512();
|
||||
@@ -57,7 +57,7 @@ public class Scrib_lib_uri implements Scrib_lib {
|
||||
Xowe_wiki wiki = core.Wiki();
|
||||
byte[] ttl_bry = args.Pull_bry(0);
|
||||
byte[] qry_bry = args.Extract_qry_args(wiki, 1);
|
||||
Xoa_ttl ttl = Xoa_ttl.parse(wiki, ttl_bry);
|
||||
Xoa_ttl ttl = Xoa_ttl.Parse(wiki, ttl_bry);
|
||||
if (ttl == null) return rslt.Init_null();
|
||||
Bry_bfr bfr = core.App().Utl__bfr_mkr().Get_b512();
|
||||
if (ttl.Ns().Id() == Xow_ns_.Tid__media) { // change "Media:" -> "File:"
|
||||
|
||||
@@ -65,7 +65,7 @@ public class Scrib_lib_wikibase implements Scrib_lib {
|
||||
public boolean GetEntityId(Scrib_proc_args args, Scrib_proc_rslt rslt) {
|
||||
byte[] ttl_bry = args.Pull_bry(0);
|
||||
Xowe_wiki wiki = core.Wiki();
|
||||
Xoa_ttl ttl = Xoa_ttl.parse(wiki, ttl_bry);
|
||||
Xoa_ttl ttl = Xoa_ttl.Parse(wiki, ttl_bry);
|
||||
byte[] rv = wiki.Appe().Wiki_mgr().Wdata_mgr().Qid_mgr.Get_or_null(wiki, ttl); if (rv == null) rv = Bry_.Empty;
|
||||
return rslt.Init_obj(rv);
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ public class Scrib_lib_wikibase_srl_tst {
|
||||
, " numeric-id:'3'"
|
||||
, " property:'P2'"
|
||||
, " snaktype:'value'"
|
||||
, " datatype:'wikibase-entityid'"
|
||||
, " datatype:'wikibase-item'"
|
||||
, " rank:'normal'"
|
||||
, " type:'statement'"
|
||||
, ""
|
||||
@@ -212,7 +212,7 @@ public class Scrib_lib_wikibase_srl_tst {
|
||||
, " numeric-id:'3'"
|
||||
, " property:'P2'"
|
||||
, " snaktype:'value'"
|
||||
, " datatype:'wikibase-entityid'"
|
||||
, " datatype:'wikibase-item'"
|
||||
, " rank:'normal'"
|
||||
, " type:'statement'"
|
||||
, " p2:"
|
||||
@@ -226,7 +226,7 @@ public class Scrib_lib_wikibase_srl_tst {
|
||||
, " numeric-id:'3'"
|
||||
, " property:'P2'"
|
||||
, " snaktype:'value'"
|
||||
, " datatype:'wikibase-entityid'"
|
||||
, " datatype:'wikibase-item'"
|
||||
, " rank:'normal'"
|
||||
, " type:'statement'"
|
||||
, ""
|
||||
|
||||
@@ -20,7 +20,7 @@ import org.junit.*;
|
||||
public class Xow_wiki_tst {
|
||||
@Before public void init() {fxt.Clear();} private Xow_wiki_fxt fxt = new Xow_wiki_fxt();
|
||||
@Test public void Load_page_and_parse() { // PURPOSE.fix: unknown page causes null reference error in scribunto; DATE:2013-08-27
|
||||
Scrib_core.Core_new_(fxt.Fxt().App(), fxt.Fxt().Ctx());
|
||||
fxt.Fxt().Wiki().Parser_mgr().Scrib().Core_make(fxt.Fxt().Ctx());
|
||||
fxt.Test_getPageByTtl("Does_not_exist", null);
|
||||
}
|
||||
}
|
||||
@@ -32,10 +32,10 @@ class Xow_wiki_fxt {
|
||||
public void Test_getPageByTtl(String ttl_str, String expd) {
|
||||
Xowe_wiki wiki = fxt.Wiki();
|
||||
byte[] ttl_bry = Bry_.new_a7(ttl_str);
|
||||
Xoa_url url = Xoa_url.new_(wiki.Domain_bry(), ttl_bry);
|
||||
Xoa_ttl ttl = Xoa_ttl.parse(wiki, ttl_bry);
|
||||
Xoa_url url = Xoa_url.New(wiki.Domain_bry(), ttl_bry);
|
||||
Xoa_ttl ttl = Xoa_ttl.Parse(wiki, ttl_bry);
|
||||
Xoae_page actl = fxt.Wiki().Data_mgr().Load_page_and_parse(url, ttl);
|
||||
if (expd == null) Tfds.Eq_true(actl.Missing());
|
||||
if (expd == null) Tfds.Eq_true(actl.Db().Page().Exists_n());
|
||||
else Tfds.Eq(expd, String_.new_u8(actl.Ttl().Raw()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user