mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
v2.9.3.1
This commit is contained in:
@@ -16,6 +16,7 @@ You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.xtns.scribunto; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.xowa.langs.*;
|
||||
import gplx.xowa.xtns.scribunto.libs.*; import gplx.xowa.xtns.scribunto.engines.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
|
||||
public class Scrib_core {
|
||||
|
||||
@@ -22,20 +22,20 @@ public class Scrib_core_fxt {
|
||||
public Scrib_core_fxt(Xop_fxt fxt) {
|
||||
app = fxt.App();
|
||||
wiki = fxt.Wiki();
|
||||
core = Scrib_core.Core_new_(app, wiki.Ctx());
|
||||
core = Scrib_core.Core_new_(app, wiki.Parser_mgr().Ctx());
|
||||
}
|
||||
public Scrib_core_fxt Clear() {
|
||||
if (core == null) {
|
||||
app = Xoa_app_fxt.app_();
|
||||
wiki = Xoa_app_fxt.wiki_tst_(app);
|
||||
core = Scrib_core.Core_new_(app, wiki.Ctx());
|
||||
core = Scrib_core.Core_new_(app, wiki.Parser_mgr().Ctx());
|
||||
server = new Process_server_mock();
|
||||
core.Interpreter().Server_(server);
|
||||
}
|
||||
server.Clear();
|
||||
core.Proc_mgr().Clear();
|
||||
core.Frame_parent_(null);
|
||||
core.When_page_changed(wiki.Ctx().Cur_page());
|
||||
core.When_page_changed(wiki.Parser_mgr().Ctx().Cur_page());
|
||||
expd_server_rcvd_list.Clear();
|
||||
return this;
|
||||
} private Xoae_app app; Xowe_wiki wiki; Bry_bfr tmp_bfr = Bry_bfr.reset_(255);
|
||||
|
||||
@@ -16,7 +16,9 @@ You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.xtns.scribunto; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.html.*;
|
||||
import gplx.langs.htmls.*;
|
||||
import gplx.xowa.langs.*; import gplx.xowa.langs.msgs.*;
|
||||
import gplx.xowa.nss.*;
|
||||
import gplx.xowa.html.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.logs.*; import gplx.xowa.parsers.tmpls.*;
|
||||
import gplx.xowa.xtns.pfuncs.*;
|
||||
@@ -73,6 +75,6 @@ public class Scrib_invoke_func extends Pf_func_base {
|
||||
byte[] script_error_msg = msg_mgr.Val_by_id(Xol_msg_itm_.Id_scribunto_parser_error);
|
||||
error_fmtr.Bld_bfr_many(bfr, script_error_msg, error);
|
||||
}
|
||||
private static final Bry_fmtr error_fmtr = Bry_fmtr.new_("<strong class='error'><span class='scribunto-error' id='mw-scribunto-error-0'>~{0}: ~{1}</span></strong>"); // <!--~{0}: ~{1}.-->
|
||||
private static final Bry_fmtr error_fmtr = Bry_fmtr.new_("<strong class=\"error\"><span class=\"scribunto-error\" id=\"mw-scribunto-error-0\">~{0}: ~{1}</span></strong>"); // NOTE: must be "error" not 'error'; iferror checks for quote not apos; DATE:2015-09-17
|
||||
public static final String Err_mod_missing = "No such module";
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public class Luaj_server_func_dbg extends VarArgFunction {
|
||||
bfr.Add_str("<span class='xowa_dbg' style='color:red'>");
|
||||
for (int i = 1; i <= len; ++i) {
|
||||
String s = args.arg(i).toString();
|
||||
bfr.Add_str(gplx.html.Html_utl.Escape_html_as_str(s) + " ");
|
||||
bfr.Add_str(gplx.langs.htmls.Html_utl.Escape_html_as_str(s) + " ");
|
||||
}
|
||||
bfr.Add_str("</span><br/>");
|
||||
core.Page().Html_data().Xtn_scribunto_dbg_(bfr.Xto_bry_and_clear());
|
||||
|
||||
@@ -16,7 +16,7 @@ You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.xtns.scribunto.engines.process; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.scribunto.*; import gplx.xowa.xtns.scribunto.engines.*;
|
||||
import gplx.core.primitives.*; import gplx.php.*;
|
||||
import gplx.core.primitives.*; import gplx.langs.phps.*;
|
||||
public class Process_recv_msg {
|
||||
private Php_srl_parser parser = new Php_srl_parser();
|
||||
public Process_recv_msg() {
|
||||
|
||||
@@ -67,7 +67,7 @@ class Process_server_mock_rcvd_val implements Process_server_mock_rcvd {
|
||||
KeyVal kv = ary[i];
|
||||
Object kv_val = kv.Val();
|
||||
if (kv_val == null) {
|
||||
bfr.Add(gplx.core.json.Json_itm_.Bry__null);
|
||||
bfr.Add(gplx.langs.jsons.Json_itm_.Bry__null);
|
||||
continue;
|
||||
}
|
||||
Class<?> kv_val_type = kv_val.getClass();
|
||||
@@ -75,7 +75,7 @@ class Process_server_mock_rcvd_val implements Process_server_mock_rcvd {
|
||||
if (print_key && !kv_val_is_array)
|
||||
bfr.Add_str(kv.Key()).Add_byte(Byte_ascii.Colon);
|
||||
if (Type_adp_.Eq(kv_val_type, Bool_.Cls_ref_type))
|
||||
bfr.Add(Bool_.cast(kv_val) ? gplx.core.json.Json_itm_.Bry__true : gplx.core.json.Json_itm_.Bry__false);
|
||||
bfr.Add(Bool_.cast(kv_val) ? gplx.langs.jsons.Json_itm_.Bry__true : gplx.langs.jsons.Json_itm_.Bry__false);
|
||||
else if (kv_val_is_array) {
|
||||
KeyVal[] sub = (KeyVal[])kv_val;
|
||||
if (sub.length == 0) {bfr.Add_byte(Byte_ascii.Curly_bgn).Add_byte(Byte_ascii.Curly_end);}
|
||||
|
||||
@@ -16,7 +16,7 @@ You should have received a copy of the GNU Affero General Public License
|
||||
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.core.json.*;
|
||||
import gplx.langs.jsons.*;
|
||||
class Kv_ary_utl {
|
||||
public static KeyVal[] new_(boolean base_1, Object... vals) {
|
||||
int len = vals.length;
|
||||
|
||||
@@ -191,7 +191,7 @@ public class Scrib_lib_language implements Scrib_lib {
|
||||
int date_bry_len = date_bry.length;
|
||||
if ( date_bry[date_bry_len - 1] == Byte_ascii.Ltr_Z
|
||||
&& date_bry[date_bry_len - 10] == Byte_ascii.Ltr_T) {
|
||||
int year_bgn = Bry_finder.Find_fwd_while(date_bry, 1, date_bry_len, Byte_ascii.Num_0);
|
||||
int year_bgn = Bry_find_.Find_fwd_while(date_bry, 1, date_bry_len, Byte_ascii.Num_0);
|
||||
date_bry = Bry_.Mid(date_bry, year_bgn); // lop off beginning "+000000..."
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,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 org.junit.*;
|
||||
import gplx.xowa.langs.numbers.*;
|
||||
import gplx.xowa.langs.*; import gplx.xowa.langs.numbers.*;
|
||||
public class Scrib_lib_language_tst {
|
||||
@Before public void init() {
|
||||
fxt.Clear_for_lib();
|
||||
|
||||
@@ -16,7 +16,9 @@ You should have received a copy of the GNU Affero General Public License
|
||||
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.core.primitives.*; import gplx.html.*;
|
||||
import gplx.core.primitives.*; import gplx.langs.htmls.*;
|
||||
import gplx.xowa.apps.gfss.*;
|
||||
import gplx.xowa.langs.*;
|
||||
import gplx.xowa.parsers.*;
|
||||
public class Scrib_lib_message implements Scrib_lib {
|
||||
public Scrib_lib_message(Scrib_core core) {this.core = core;} private Scrib_core core;
|
||||
@@ -102,7 +104,7 @@ class Scrib_lib_message_data {
|
||||
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();
|
||||
byte[] raw_msg_val = gplx.xowa.apps.Xoa_gfs_php_mgr.Xto_gfs(tmp_bfr, raw_msg_key);
|
||||
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);
|
||||
tmp_bfr.Mkr_rls();
|
||||
@@ -133,7 +135,7 @@ class Scrib_lib_message_data {
|
||||
&& raw_msg_key == null // ignore if raw_msg; note that raw_msg can generate empty String; EX:raw_msg={{empty}} -> ""; PAGE:it.w:L'Internazionale DATE:2015-02-25
|
||||
) {
|
||||
Bry_bfr bfr = wiki.Utl__bfr_mkr().Get_b512();
|
||||
bfr.Add(gplx.html.Html_entity_.Lt_bry).Add(msg_key).Add(gplx.html.Html_entity_.Gt_bry); // NOTE: Message.php has logic that says: if plain, "< >", else "< >"; for now, always use escaped
|
||||
bfr.Add(gplx.langs.htmls.Html_entity_.Lt_bry).Add(msg_key).Add(gplx.langs.htmls.Html_entity_.Gt_bry); // NOTE: Message.php has logic that says: if plain, "< >", else "< >"; for now, always use escaped
|
||||
return bfr.To_bry_and_rls();
|
||||
}
|
||||
switch (fmt_tid) {
|
||||
@@ -145,7 +147,7 @@ class Scrib_lib_message_data {
|
||||
msg_val = bfr.Add(Html_tag_.P_lhs).Add(msg_val).Add(Html_tag_.P_rhs).To_bry_and_rls();
|
||||
break;
|
||||
case Fmt_tid_escaped:
|
||||
msg_val = gplx.html.Html_utl.Escape_html_as_bry(msg_val);
|
||||
msg_val = gplx.langs.htmls.Html_utl.Escape_html_as_bry(msg_val);
|
||||
break;
|
||||
}
|
||||
return msg_val;
|
||||
|
||||
@@ -16,7 +16,7 @@ You should have received a copy of the GNU Affero General Public License
|
||||
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 org.junit.*;
|
||||
import org.junit.*; import gplx.xowa.langs.*;
|
||||
public class Scrib_lib_message_tst {
|
||||
@Before public void init() {
|
||||
fxt.Clear_for_lib();
|
||||
|
||||
@@ -238,7 +238,7 @@ public class Scrib_lib_mw implements Scrib_lib {
|
||||
}
|
||||
Xot_invk_mock mock_frame = Xot_invk_mock.new_(Bry_.new_u8(frame_id), kv_args); // use frame_id for Frame_ttl; in lieu of a better candidate; DATE:2014-09-21
|
||||
tmp_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
|
||||
cur_wiki.Parser().Parse_text_to_wtxt(tmp_root, tmp_ctx, tmp_ctx.Tkn_mkr(), text_bry);
|
||||
cur_wiki.Parser_mgr().Main().Parse_text_to_wtxt(tmp_root, tmp_ctx, tmp_ctx.Tkn_mkr(), text_bry);
|
||||
tmp_root.Tmpl_evaluate(tmp_ctx, text_bry, mock_frame, tmp_bfr);
|
||||
return rslt.Init_obj(tmp_bfr.To_str_and_rls());
|
||||
}
|
||||
@@ -283,7 +283,7 @@ public class Scrib_lib_mw implements Scrib_lib {
|
||||
// get argx
|
||||
byte[] fnc_name = fnc_name_ref.Val();
|
||||
int fnc_name_len = fnc_name.length;
|
||||
int fnc_name_colon_pos = Bry_finder.Find_fwd(fnc_name, Byte_ascii.Colon, 0, fnc_name_len);
|
||||
int fnc_name_colon_pos = Bry_find_.Find_fwd(fnc_name, Byte_ascii.Colon, 0, fnc_name_len);
|
||||
if (fnc_name_colon_pos == Bry_.NotFound) {
|
||||
KeyVal arg_argx = (KeyVal)rv.Get_at(0);
|
||||
argx_ref.Val_(arg_argx.Val_to_bry());
|
||||
@@ -315,7 +315,7 @@ public class Scrib_lib_mw implements Scrib_lib {
|
||||
sub_src = core.Wiki().Cache_mgr().Page_cache().Get_or_load_as_src(ttl);
|
||||
if (sub_src != null) {
|
||||
Xot_invk_mock sub_frame = Xot_invk_mock.new_(core.Frame_current().Defn_tid(), 0, ttl.Full_txt(), args_ary); // NOTE: (1) must have ns (Full); (2) must be txt (space, not underscore); EX:Template:Location map+; DATE:2014-09-21
|
||||
Xot_defn_tmpl transclude_tmpl = ctx.Wiki().Parser().Parse_text_to_defn_obj(ctx, ctx.Tkn_mkr(), ttl.Ns(), ttl.Page_db(), sub_src);
|
||||
Xot_defn_tmpl transclude_tmpl = ctx.Wiki().Parser_mgr().Main().Parse_text_to_defn_obj(ctx, ctx.Tkn_mkr(), ttl.Ns(), ttl.Page_db(), sub_src);
|
||||
Bry_bfr sub_bfr = cur_wiki.Utl__bfr_mkr().Get_k004();
|
||||
transclude_tmpl.Tmpl_evaluate(ctx, sub_frame, sub_bfr);
|
||||
return rslt.Init_obj(sub_bfr.To_str_and_rls());
|
||||
|
||||
@@ -113,7 +113,7 @@ public class Scrib_lib_mw__invoke_tst {
|
||||
@Test public void Err_mod_blank() {fxt.Test_parse_err("{{#invoke:}}" , Scrib_invoke_func.Err_mod_missing);}
|
||||
@Test public void Err_mod_missing() {fxt.Test_parse_err("{{#invoke:Missing}}" , Scrib_invoke_func.Err_mod_missing);}
|
||||
@Test public void Err_mod_custom() {
|
||||
fxt.Test_error(Err_.new_("err_type", "fail", "key0", "val0"), "<strong class='error'><span class='scribunto-error' id='mw-scribunto-error-0'>Script error: fail</span></strong>");
|
||||
fxt.Test_error(Err_.new_("err_type", "fail", "key0", "val0"), "<strong class=\"error\"><span class=\"scribunto-error\" id=\"mw-scribunto-error-0\">Script error: fail</span></strong>");
|
||||
}
|
||||
private void Init_preprocess() {
|
||||
fxt.Init_tmpl("{{#invoke:Mod_0|Func_0|1|c|d}}"); // current
|
||||
|
||||
@@ -16,7 +16,9 @@ You should have received a copy of the GNU Affero General Public License
|
||||
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.xowa.wikis.xwikis.*;
|
||||
import gplx.xowa.langs.*;
|
||||
import gplx.xowa.nss.*;
|
||||
import gplx.xowa.wikis.metas.*; import gplx.xowa.wikis.xwikis.*;
|
||||
public class Scrib_lib_site implements Scrib_lib {
|
||||
public Scrib_lib_site(Scrib_core core) {this.core = core;} private Scrib_core core;
|
||||
public Scrib_lua_mod Mod() {return mod;} private Scrib_lua_mod mod;
|
||||
|
||||
@@ -16,7 +16,7 @@ You should have received a copy of the GNU Affero General Public License
|
||||
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 org.junit.*;
|
||||
import org.junit.*; import gplx.xowa.nss.*;
|
||||
public class Scrib_lib_site_tst {
|
||||
@Before public void init() {
|
||||
fxt.Clear_for_lib();
|
||||
|
||||
@@ -16,6 +16,7 @@ You should have received a copy of the GNU Affero General Public License
|
||||
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.xowa.langs.msgs.*;
|
||||
public class Scrib_lib_text implements Scrib_lib {
|
||||
private final Scrib_lib_text__json_util json_util = new Scrib_lib_text__json_util();
|
||||
private final Scrib_lib_text__reindex_data reindex_data = new Scrib_lib_text__reindex_data();
|
||||
|
||||
@@ -16,7 +16,7 @@ You should have received a copy of the GNU Affero General Public License
|
||||
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.core.json.*;
|
||||
import gplx.langs.jsons.*;
|
||||
class Scrib_lib_text__json_util {
|
||||
private final Json_wtr wtr = new Json_wtr();
|
||||
public void Reindex_arrays(Scrib_lib_text__reindex_data rv, KeyVal[] kv_ary, boolean is_encoding) {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -16,7 +16,7 @@ You should have received a copy of the GNU Affero General Public License
|
||||
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 org.junit.*; import gplx.core.json.*;
|
||||
import org.junit.*; import gplx.langs.jsons.*;
|
||||
public class Scrib_lib_text_json_tst {
|
||||
private Scrib_invoke_func_fxt fxt = new Scrib_invoke_func_fxt(); private Scrib_lib_text lib;
|
||||
private Scrib_lib_json_fxt json_fxt = new Scrib_lib_json_fxt();
|
||||
|
||||
@@ -16,7 +16,7 @@ You should have received a copy of the GNU Affero General Public License
|
||||
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 org.junit.*; import gplx.core.json.*;
|
||||
import org.junit.*; import gplx.langs.jsons.*;
|
||||
public class Scrib_lib_text_tst {
|
||||
private Scrib_invoke_func_fxt fxt = new Scrib_invoke_func_fxt(); private Scrib_lib_text lib;
|
||||
@Before public void init() {
|
||||
|
||||
@@ -17,9 +17,10 @@ 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.core.primitives.*;
|
||||
import gplx.xowa.nss.*;
|
||||
import gplx.xowa.wikis.caches.*; import gplx.xowa.xtns.pfuncs.ttls.*; import gplx.xowa.wikis.xwikis.*; import gplx.xowa.wikis.data.tbls.*;
|
||||
import gplx.xowa2.files.commons.*; import gplx.xowa.files.origs.*;
|
||||
import gplx.xowa.wmfs.apis.*;
|
||||
import gplx.xowa.files.commons.*; import gplx.xowa.files.origs.*;
|
||||
import gplx.xowa.wms.apis.*;
|
||||
public class Scrib_lib_title implements Scrib_lib {
|
||||
public Scrib_lib_title(Scrib_core core) {this.core = core;} private Scrib_core core;
|
||||
public Scrib_lua_mod Mod() {return mod;} private Scrib_lua_mod mod;
|
||||
|
||||
@@ -17,7 +17,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 org.junit.*;
|
||||
import gplx.dbs.*; import gplx.xowa2.files.commons.*; import gplx.xowa.wikis.data.*;
|
||||
import gplx.dbs.*; import gplx.xowa.files.commons.*; import gplx.xowa.wikis.data.*;
|
||||
import gplx.fsdb.*;
|
||||
import gplx.xowa.wikis.domains.*; import gplx.xowa.files.*; import gplx.xowa.files.origs.*; import gplx.xowa.files.repos.*; import gplx.xowa.wikis.ttls.*;
|
||||
public class Scrib_lib_title_tst {
|
||||
@@ -97,7 +97,7 @@ public class Scrib_lib_title_tst {
|
||||
fxt.Test_scrib_proc_obj(lib, Scrib_lib_title.Invk_cascadingProtection, Object_.Ary("A") , Scrib_lib_title.CascadingProtection_rv);
|
||||
}
|
||||
private static void Wiki_orig_tbl__create(Xowe_wiki wiki) {
|
||||
Xowe_wiki_bldr.Create(wiki, 1, "dump.xml");
|
||||
Xowe_wiki_.Create(wiki, 1, "dump.xml");
|
||||
Xowd_db_file text_db = wiki.Data__core_mgr().Dbs__make_by_tid(Xowd_db_file_.Tid_text); text_db.Tbl__text().Create_tbl();
|
||||
Fsdb_db_mgr__v2_bldr.I.Get_or_make(wiki, Bool_.Y);
|
||||
wiki.File_mgr().Init_file_mgr_by_load(wiki);
|
||||
|
||||
@@ -17,6 +17,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.xowa.xtns.pfuncs.ttls.*;
|
||||
import gplx.xowa.nss.*;
|
||||
import gplx.xowa.parsers.*;
|
||||
public class Scrib_lib_uri implements Scrib_lib {
|
||||
public Scrib_lib_uri(Scrib_core core) {this.core = core;} private Scrib_core core;
|
||||
|
||||
@@ -16,7 +16,7 @@ You should have received a copy of the GNU Affero General Public License
|
||||
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.core.regxs.*; import gplx.intl.*;
|
||||
import gplx.langs.regxs.*; import gplx.core.intls.*;
|
||||
import gplx.xowa.parsers.*;
|
||||
public class Scrib_lib_ustring implements Scrib_lib {
|
||||
private final String_surrogate_utl surrogate_utl = new String_surrogate_utl();
|
||||
|
||||
@@ -16,7 +16,7 @@ You should have received a copy of the GNU Affero General Public License
|
||||
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 org.junit.*; import gplx.core.regxs.*;
|
||||
import org.junit.*; import gplx.langs.regxs.*;
|
||||
public class Scrib_lib_ustring__lib_tst {
|
||||
@Before public void init() {
|
||||
fxt.Clear_for_lib();
|
||||
|
||||
@@ -16,7 +16,7 @@ You should have received a copy of the GNU Affero General Public License
|
||||
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.core.json.*; import gplx.xowa.xtns.wdatas.*; import gplx.xowa.xtns.wdatas.parsers.*;
|
||||
import gplx.langs.jsons.*; import gplx.xowa.xtns.wdatas.*; import gplx.xowa.xtns.wdatas.parsers.*;
|
||||
import gplx.xowa.wikis.domains.*;
|
||||
public class Scrib_lib_wikibase implements Scrib_lib {
|
||||
public Scrib_lib_wikibase(Scrib_core core) {this.core = core;} private Scrib_core core;
|
||||
|
||||
@@ -17,7 +17,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.xowa.xtns.wdatas.*;
|
||||
import gplx.core.json.*; import gplx.xowa.xtns.wdatas.core.*;
|
||||
import gplx.langs.jsons.*; import gplx.xowa.xtns.wdatas.core.*;
|
||||
public class Scrib_lib_wikibase_entity implements Scrib_lib {
|
||||
public Scrib_lib_wikibase_entity(Scrib_core core) {this.core = core;} private Scrib_core core;
|
||||
public Scrib_lua_mod Mod() {return mod;} private Scrib_lua_mod mod;
|
||||
|
||||
@@ -17,7 +17,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 org.junit.*;
|
||||
import gplx.core.json.*; import gplx.xowa.xtns.wdatas.*; import gplx.xowa.xtns.wdatas.core.*; import gplx.xowa.xtns.wdatas.parsers.*;
|
||||
import gplx.langs.jsons.*; import gplx.xowa.xtns.wdatas.*; import gplx.xowa.xtns.wdatas.core.*; import gplx.xowa.xtns.wdatas.parsers.*;
|
||||
public class Scrib_lib_wikibase_srl_tst {
|
||||
@Before public void init() {fxt.Clear();} private Scrib_lib_wikibase_srl_fxt fxt = new Scrib_lib_wikibase_srl_fxt();
|
||||
@Test public void Label() {
|
||||
|
||||
@@ -16,7 +16,7 @@ You should have received a copy of the GNU Affero General Public License
|
||||
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.core.regxs.*;
|
||||
import gplx.langs.regxs.*;
|
||||
public class Scrib_regx_converter {
|
||||
private List_adp capt_list = List_adp_.new_(), grps_parens = List_adp_.new_(); private List_adp grps_open = List_adp_.new_();
|
||||
public Scrib_regx_converter() {Init();}
|
||||
|
||||
@@ -16,7 +16,7 @@ You should have received a copy of the GNU Affero General Public License
|
||||
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 org.junit.*; import gplx.core.regxs.*;
|
||||
import org.junit.*; import gplx.langs.regxs.*;
|
||||
public class Scrib_regx_converter_tst {
|
||||
@Before public void init() {fxt.Clear();} private Scrib_regx_converter_fxt fxt = new Scrib_regx_converter_fxt();
|
||||
@Test public void Basic() {fxt.Test_parse("abc012ABC" , "abc012ABC");}
|
||||
|
||||
41
400_xowa/src/gplx/xowa/xtns/scribunto/libs/Xow_wiki_tst.java
Normal file
41
400_xowa/src/gplx/xowa/xtns/scribunto/libs/Xow_wiki_tst.java
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
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 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_by_ttl() { // 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.Test_getPageByTtl("Does_not_exist", null);
|
||||
}
|
||||
}
|
||||
class Xow_wiki_fxt {
|
||||
public void Clear() {
|
||||
fxt = new Xop_fxt();
|
||||
}
|
||||
public Xop_fxt Fxt() {return fxt;} private Xop_fxt 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);
|
||||
Xoae_page actl = fxt.Wiki().Data_mgr().Load_page_by_ttl(url, ttl);
|
||||
if (expd == null) Tfds.Eq_true(actl.Missing());
|
||||
else Tfds.Eq(expd, String_.new_u8(actl.Ttl().Raw()));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user