mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
'v3.6.3.1'
This commit is contained in:
@@ -46,15 +46,15 @@ public class Pfunc_filepath extends Pf_func_base {
|
||||
byte[] url = url_bldr.Init_for_trg_html(Xof_repo_itm_.Mode_orig, trg_repo, ttl_bry, xfer_itm.Orig_ttl_md5(), xfer_itm.Orig_ext(), Xof_img_size.Size__neg1, Xof_lnki_time.Null, Xof_lnki_page.Null).Xto_bry();
|
||||
bfr.Add(url);
|
||||
}
|
||||
private static final Xof_xfer_itm xfer_itm = new Xof_xfer_itm();
|
||||
private static final Xof_url_bldr url_bldr = new Xof_url_bldr();
|
||||
private static final Xof_xfer_itm xfer_itm = new Xof_xfer_itm();
|
||||
private static final Xof_url_bldr url_bldr = new Xof_url_bldr();
|
||||
private static Xoae_page Load_page(Xowe_wiki wiki, Xoa_ttl ttl) {
|
||||
Xoae_page page = wiki.Data_mgr().Get_page(ttl, false);
|
||||
Xoae_page page = wiki.Data_mgr().Load_page_by_ttl(ttl);
|
||||
if (page.Missing()) { // file not found in current wiki; try commons;
|
||||
Xowe_wiki commons_wiki = (Xowe_wiki)wiki.Appe().Wiki_mgr().Get_by_or_null(wiki.Commons_wiki_key());
|
||||
if (commons_wiki != null) { // commons_wiki not installed; exit; DATE:2013-06-08
|
||||
if (!Env_.Mode_testing()) commons_wiki.Init_assert();// must assert load else page_zip never detected; DATE:2013-03-10
|
||||
page = commons_wiki.Data_mgr().Get_page(ttl, false);
|
||||
page = commons_wiki.Data_mgr().Load_page_by_ttl(ttl);
|
||||
}
|
||||
}
|
||||
return page;
|
||||
|
||||
@@ -21,8 +21,8 @@ import gplx.xowa.wikis.tdbs.*;
|
||||
import gplx.xowa.files.*; import gplx.xowa.files.exts.*; import gplx.xowa.files.origs.*; import gplx.xowa.files.repos.*;
|
||||
import gplx.xowa.wikis.domains.*; import gplx.xowa.wikis.ttls.*;
|
||||
public class Pfunc_filepath_tst {
|
||||
private final Xop_fxt fxt = new Xop_fxt();
|
||||
private final Xofw_wiki_wkr_mock mock_wkr = new Xofw_wiki_wkr_mock();
|
||||
private final Xop_fxt fxt = new Xop_fxt();
|
||||
private final Xofw_wiki_wkr_mock mock_wkr = new Xofw_wiki_wkr_mock();
|
||||
private Xowe_wiki en_wiki, commons_wiki;
|
||||
@Before public void init() {
|
||||
fxt.Reset();
|
||||
@@ -49,7 +49,7 @@ public class Pfunc_filepath_tst {
|
||||
}
|
||||
@Test public void Wiki_is_commons() {
|
||||
fxt.Init_page_create(commons_wiki, "File:A.png", "");
|
||||
commons_wiki.Tdb_fsys_mgr().Tdb_dir_regy()[Xotdb_dir_info_.Tid_page].Ext_tid_(gplx.core.ios.Io_stream_.Tid_raw);
|
||||
commons_wiki.Tdb_fsys_mgr().Tdb_dir_regy()[Xotdb_dir_info_.Tid_page].Ext_tid_(gplx.core.ios.streams.Io_stream_.Tid_raw);
|
||||
mock_wkr.Redirect_("A.png", "A.png").Repo_idx_(1);
|
||||
fxt.Test_parse_tmpl_str_test("{{filepath:A.png}}", "{{test}}", "file:///mem/xowa/file/commons/trg/orig/7/0/1/c/A.png");
|
||||
}
|
||||
|
||||
@@ -24,11 +24,11 @@ public class Pfunc_rel2abs extends Pf_func_base {
|
||||
private static final byte[] Ary_dot_slash = Bry_.new_a7("./"), Ary_dot_dot = Bry_.new_a7(".."), Ary_dot_dot_slash = Bry_.new_a7("../");
|
||||
private static void qry_bgns_with_init() {
|
||||
qry_bgns_with = Btrie_fast_mgr.cs();
|
||||
qry_bgns_with.Add(Byte_ascii.Slash, Int_obj_ref.new_(Id_slash));
|
||||
qry_bgns_with.Add(Byte_ascii.Dot, Int_obj_ref.new_(Id_dot));
|
||||
qry_bgns_with.Add(Ary_dot_slash, Int_obj_ref.new_(Id_dot_slash));
|
||||
qry_bgns_with.Add(Ary_dot_dot, Int_obj_ref.new_(Id_dot_dot));
|
||||
qry_bgns_with.Add(Ary_dot_dot_slash, Int_obj_ref.new_(Id_dot_dot_slash));
|
||||
qry_bgns_with.Add(Byte_ascii.Slash, Int_obj_ref.New(Id_slash));
|
||||
qry_bgns_with.Add(Byte_ascii.Dot, Int_obj_ref.New(Id_dot));
|
||||
qry_bgns_with.Add(Ary_dot_slash, Int_obj_ref.New(Id_dot_slash));
|
||||
qry_bgns_with.Add(Ary_dot_dot, Int_obj_ref.New(Id_dot_dot));
|
||||
qry_bgns_with.Add(Ary_dot_dot_slash, Int_obj_ref.New(Id_dot_dot_slash));
|
||||
} static Btrie_fast_mgr qry_bgns_with;
|
||||
@Override public void Func_evaluate(Bry_bfr bfr, Xop_ctx ctx, Xot_invk caller, Xot_invk self, byte[] src) {// REF.MW:ParserFunctions_body.php
|
||||
byte[] qry = Eval_argx(ctx, src, caller, self);
|
||||
@@ -57,7 +57,7 @@ public class Pfunc_rel2abs extends Pf_func_base {
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
private static final Int_obj_ref ignore_rel2abs_tid = Int_obj_ref.zero_();
|
||||
private static final Int_obj_ref ignore_rel2abs_tid = Int_obj_ref.New_zero();
|
||||
public static byte[] Rel2abs(Bry_bfr tmp_bfr, byte[] qry, byte[] src) {return Rel2abs(tmp_bfr, qry, src, ignore_rel2abs_tid);}
|
||||
public static byte[] Rel2abs(Bry_bfr tmp_bfr, byte[] qry, byte[] src, Int_obj_ref rel2abs_tid) {
|
||||
if (qry_bgns_with == null) qry_bgns_with_init();
|
||||
|
||||
@@ -27,5 +27,5 @@ public class Pfunc_urlencode extends Pf_func_base { // EX: {{urlencode:a b}} ->
|
||||
gplx.langs.htmls.encoders.Gfo_url_encoder_.Http_url.Encode(urlEncodeBfr, argx);
|
||||
bfr.Add_bfr_and_preserve(urlEncodeBfr);
|
||||
urlEncodeBfr.Clear();
|
||||
} private Bry_bfr urlEncodeBfr = Bry_bfr.new_(128);
|
||||
} private Bry_bfr urlEncodeBfr = Bry_bfr_.New_w_size(128);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user