mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
v2.8.5.1
This commit is contained in:
@@ -87,18 +87,18 @@ public class Xoa_ttl { // PAGE:en.w:http://en.wikipedia.org/wiki/Help:Link; REF.
|
||||
int ques_pos = Bry_finder.Find_bwd(full_txt, Byte_ascii.Question, full_txt_len, page_bgn);
|
||||
return Bry_.Mid(full_txt, page_bgn, ques_pos == Bry_.NotFound ? full_txt_len : ques_pos);
|
||||
}
|
||||
public static Xoa_ttl parse_(Xowe_wiki wiki, int ns_id, byte[] ttl) {
|
||||
public static Xoa_ttl parse(Xowe_wiki wiki, int ns_id, byte[] ttl) {
|
||||
Xow_ns ns = wiki.Ns_mgr().Ids_get_or_null(ns_id);
|
||||
byte[] raw = Bry_.Add(ns.Name_db_w_colon(), ttl);
|
||||
return new_(wiki, wiki.Appe().Msg_log(), raw, 0, raw.length);
|
||||
}
|
||||
public static Xoa_ttl parse_(Xowe_wiki wiki, byte[] raw) {return new_(wiki, wiki.Appe().Msg_log(), raw, 0, raw.length);}
|
||||
public static Xoa_ttl parse(Xowe_wiki wiki, byte[] raw) {return new_(wiki, wiki.Appe().Msg_log(), raw, 0, raw.length);}
|
||||
private static final Object thread_lock = new Object();
|
||||
// $dbkey = preg_replace( '/\xE2\x80[\x8E\x8F\xAA-\xAE]/S', '', $dbkey );
|
||||
// $dbkey = preg_replace( '/[ _\xA0\x{1680}\x{180E}\x{2000}-\x{200A}\x{2028}\x{2029}\x{202F}\x{205F}\x{3000}]+/u', '_', $dbkey );
|
||||
private static final int Char__bidi = 1, Char__ws = 2;
|
||||
private static final Btrie_slim_mgr char_trie = Btrie_slim_mgr.cs()
|
||||
.Add_many_int(Char__bidi , "\u00E2\u0080\u008E", "\u00E2\u0080\u008F", "\u00E2\u0080\u00AA", "\u00E2\u0080\u00AB", "\u00E2\u0080\u00AC", "\u00E2\u0080\u00AD", "\u00E2\u0080\u00AE")
|
||||
.Add_many_int(Char__bidi , Bry_.ints_(0xE2, 0x80, 0x8E), Bry_.ints_(0xE2, 0x80, 0x8F), Bry_.ints_(0xE2, 0x80, 0xAA), Bry_.ints_(0xE2, 0x80, 0xAB), Bry_.ints_(0xE2, 0x80, 0xAC), Bry_.ints_(0xE2, 0x80, 0xAD), Bry_.ints_(0xE2, 0x80, 0xAE))
|
||||
.Add_many_int(Char__ws , "\u00A0", "\u1680", "\u180E", "\u2000", "\u2001", "\u2002", "\u2003", "\u2004", "\u2005", "\u2006", "\u2007", "\u2008", "\u2009", "\u200A", "\u2028", "\u2029", "\u202F", "\u205F", "\u3000")
|
||||
;
|
||||
public static Xoa_ttl new_(Xowe_wiki wiki, Gfo_msg_log msg_log, byte[] src, int bgn, int end) {
|
||||
|
||||
@@ -48,7 +48,7 @@ public class Xop_ctx {
|
||||
public Xop_curly_wkr Curly() {return curly;} private Xop_curly_wkr curly = new Xop_curly_wkr();
|
||||
|
||||
public boolean Tmpl_load_enabled() {return tmpl_load_enabled;} public void Tmpl_load_enabled_(boolean v) {tmpl_load_enabled = v;} private boolean tmpl_load_enabled = true;
|
||||
public int Tmpl_tkn_max() {return tmpl_tkn_max;} public void Tmpl_tkn_max_(int v) {tmpl_tkn_max = v;} private int tmpl_tkn_max = Int_.MaxValue;
|
||||
public int Tmpl_tkn_max() {return tmpl_tkn_max;} public void Tmpl_tkn_max_(int v) {tmpl_tkn_max = v;} private int tmpl_tkn_max = Int_.Max_value;
|
||||
public Xop_keeplist_wiki Tmpl_keeplist() {return tmpl_keeplist;} public void Tmpl_keeplist_(Xop_keeplist_wiki v) {this.tmpl_keeplist = v;} private Xop_keeplist_wiki tmpl_keeplist;
|
||||
public boolean Tmpl_args_parsing() {return tmpl_args_parsing;} public Xop_ctx Tmpl_args_parsing_(boolean v) {tmpl_args_parsing = v; return this;} private boolean tmpl_args_parsing;
|
||||
public Bry_bfr Tmpl_output() {return tmpl_output;} public Xop_ctx Tmpl_output_(Bry_bfr v) {tmpl_output = v; return this;} private Bry_bfr tmpl_output; // OBSOLETE: after tmpl_prepend_nl rewrite; DATE:2014-08-21
|
||||
@@ -299,7 +299,7 @@ public class Xop_ctx {
|
||||
ctx.Stack_pop_til(root, src, stack_pos, true, bgn_pos, cur_pos, Xop_tkn_itm_.Tid_txt);
|
||||
}
|
||||
public static Xop_ctx new_(Xowe_wiki wiki) {
|
||||
Xop_ctx rv = new Xop_ctx(wiki, Xoae_page.new_(wiki, Xoa_ttl.parse_(wiki, Xoa_page_.Main_page_bry))); // HACK: use "Main_Page" to put in valid page title
|
||||
Xop_ctx rv = new Xop_ctx(wiki, Xoae_page.new_(wiki, Xoa_ttl.parse(wiki, Xoa_page_.Main_page_bry))); // HACK: use "Main_Page" to put in valid page title
|
||||
return rv;
|
||||
}
|
||||
public static Xop_ctx new_sub_(Xowe_wiki wiki) {return new_sub_(wiki, wiki.Ctx().cur_page);}
|
||||
|
||||
@@ -72,7 +72,7 @@ public class Xop_fxt {
|
||||
return this;
|
||||
}
|
||||
public Xoa_ttl Page_ttl_(String txt) {
|
||||
Xoa_ttl rv = Xoa_ttl.parse_(wiki, Bry_.new_u8(txt));
|
||||
Xoa_ttl rv = Xoa_ttl.parse(wiki, Bry_.new_u8(txt));
|
||||
ctx.Cur_page().Ttl_(rv);
|
||||
return rv;
|
||||
}
|
||||
@@ -172,7 +172,7 @@ public class Xop_fxt {
|
||||
public Xop_fxt Init_page_create(String ttl, String txt) {return Init_page_create(wiki, ttl, txt);}
|
||||
public Xop_fxt Init_page_create(Xowe_wiki wiki, String ttl, String txt) {Init_page_create_static(wiki, ttl, txt);return this;}
|
||||
public static void Init_page_create_static(Xowe_wiki wiki, String ttl_str, String text_str) {
|
||||
Xoa_ttl ttl = Xoa_ttl.parse_(wiki, Bry_.new_u8(ttl_str));
|
||||
Xoa_ttl ttl = Xoa_ttl.parse(wiki, Bry_.new_u8(ttl_str));
|
||||
byte[] text = Bry_.new_u8(text_str);
|
||||
wiki.Db_mgr().Save_mgr().Data_create(ttl, text);
|
||||
}
|
||||
@@ -181,7 +181,7 @@ public class Xop_fxt {
|
||||
}
|
||||
public Xop_fxt Init_page_update(String ttl, String txt) {return Init_page_update(wiki, ttl, txt);}
|
||||
public Xop_fxt Init_page_update(Xowe_wiki wiki, String ttl, String txt) {
|
||||
Xoa_ttl page_ttl = Xoa_ttl.parse_(wiki, Bry_.new_u8(ttl));
|
||||
Xoa_ttl page_ttl = Xoa_ttl.parse(wiki, Bry_.new_u8(ttl));
|
||||
byte[] page_raw = Bry_.new_u8(txt);
|
||||
Xoae_page page = wiki.Data_mgr().Get_page(page_ttl, false);
|
||||
wiki.Db_mgr().Save_mgr().Data_update(page, page_raw);
|
||||
@@ -340,7 +340,7 @@ public class Xop_fxt {
|
||||
public static byte[] Load_page(Xowe_wiki wiki, String ttl_str) {
|
||||
byte[] ttl_bry = Bry_.new_u8(ttl_str);
|
||||
Xoa_url page_url = Xoa_url.new_(wiki.Domain_bry(), ttl_bry);
|
||||
Xoa_ttl ttl = Xoa_ttl.parse_(wiki, ttl_bry);
|
||||
Xoa_ttl ttl = Xoa_ttl.parse(wiki, ttl_bry);
|
||||
return wiki.Load_page_by_ttl(page_url, ttl).Data_raw();
|
||||
}
|
||||
public static void Reg_xwiki_alias(Xowe_wiki wiki, String alias, String domain) {
|
||||
|
||||
@@ -20,10 +20,10 @@ import gplx.xowa.files.*;
|
||||
public class Xop_lnki_tkn_chkr extends Xop_tkn_chkr_base {
|
||||
@Override public Class<?> TypeOf() {return Xop_lnki_tkn.class;}
|
||||
@Override public byte Tkn_tid() {return Xop_tkn_itm_.Tid_lnki;}
|
||||
public int Ns_id() {return nsId;} public Xop_lnki_tkn_chkr Ns_id_(int v) {nsId = v; return this;} private int nsId = Int_.MinValue;
|
||||
public int Ns_id() {return nsId;} public Xop_lnki_tkn_chkr Ns_id_(int v) {nsId = v; return this;} private int nsId = Int_.Min_value;
|
||||
public byte ImgType() {return imgType;} public Xop_lnki_tkn_chkr ImgType_(byte v) {imgType = v; return this;} private byte imgType = Byte_.Max_value_127;
|
||||
public int Width() {return width;} public Xop_lnki_tkn_chkr Width_(int v) {width = v; return this;} private int width = Int_.MinValue;
|
||||
public int Height() {return height;} public Xop_lnki_tkn_chkr Height_(int v) {height = v; return this;} private int height = Int_.MinValue;
|
||||
public int Width() {return width;} public Xop_lnki_tkn_chkr Width_(int v) {width = v; return this;} private int width = Int_.Min_value;
|
||||
public int Height() {return height;} public Xop_lnki_tkn_chkr Height_(int v) {height = v; return this;} private int height = Int_.Min_value;
|
||||
public byte HAlign() {return hAlign;} public Xop_lnki_tkn_chkr HAlign_(byte v) {hAlign = v; return this;} private byte hAlign = Byte_.Max_value_127;
|
||||
public byte VAlign() {return vAlign;} public Xop_lnki_tkn_chkr VAlign_(byte v) {vAlign = v; return this;} private byte vAlign = Byte_.Max_value_127;
|
||||
public byte Border() {return border;} public Xop_lnki_tkn_chkr Border_(byte v) {border = v; return this;} private byte border = Bool_.__byte;
|
||||
@@ -38,10 +38,10 @@ public class Xop_lnki_tkn_chkr extends Xop_tkn_chkr_base {
|
||||
public Xop_tkn_chkr_base Link_tkn() {return link_tkn;} public Xop_lnki_tkn_chkr Link_tkn_(Xop_tkn_chkr_base v) {link_tkn = v; return this;} private Xop_tkn_chkr_base link_tkn;
|
||||
@Override public int Chk_hook(Tst_mgr mgr, String path, Object actl_obj, int err) {
|
||||
Xop_lnki_tkn actl = (Xop_lnki_tkn)actl_obj;
|
||||
err += mgr.Tst_val(nsId == Int_.MinValue, path, "nsId", nsId, actl.Ns_id());
|
||||
err += mgr.Tst_val(nsId == Int_.Min_value, path, "nsId", nsId, actl.Ns_id());
|
||||
err += mgr.Tst_val(imgType == Byte_.Max_value_127, path, "imgType", imgType, actl.Lnki_type());
|
||||
err += mgr.Tst_val(width == Int_.MinValue, path, "width", width, actl.W());
|
||||
err += mgr.Tst_val(height == Int_.MinValue, path, "height", height, actl.H());
|
||||
err += mgr.Tst_val(width == Int_.Min_value, path, "width", width, actl.W());
|
||||
err += mgr.Tst_val(height == Int_.Min_value, path, "height", height, actl.H());
|
||||
err += mgr.Tst_val(hAlign == Byte_.Max_value_127, path, "halign", hAlign, actl.Align_h());
|
||||
err += mgr.Tst_val(vAlign == Byte_.Max_value_127, path, "valign", vAlign, actl.Align_v());
|
||||
err += mgr.Tst_val(border == Bool_.__byte, path, "border", border, actl.Border());
|
||||
|
||||
@@ -47,7 +47,7 @@ public class Xop_redirect_mgr {
|
||||
if (ttl_end == Bry_.NotFound) return Redirect_null_ttl;
|
||||
byte[] redirect_bry = Bry_.Mid(src, ttl_bgn, ttl_end);
|
||||
redirect_bry = url_decoder.Decode(redirect_bry); // NOTE: url-decode links; PAGE: en.w:Watcher_(Buffy_the_Vampire_Slayer); DATE:2014-08-18
|
||||
return Xoa_ttl.parse_(wiki, redirect_bry);
|
||||
return Xoa_ttl.parse(wiki, redirect_bry);
|
||||
}
|
||||
public static final Xoa_ttl Extract_redirect_is_null = null;
|
||||
public static final int Redirect_max_allowed = 4;
|
||||
|
||||
@@ -54,7 +54,7 @@ class Xop_redirect_mgr_fxt {
|
||||
fxt.Init_page_create(tmpl_ttl_str, tmpl_wtxt_str); // create redirect_src
|
||||
fxt.Init_page_create(redirect_ttl, "test"); // create redirect_trg
|
||||
fxt.Test_parse_page_tmpl_tkn("{{" + tmpl_ttl_str + "}}"); // parse {{redirect_src}}
|
||||
Xoa_ttl tmpl_ttl = Xoa_ttl.parse_(fxt.Wiki(), Bry_.new_u8(tmpl_ttl_str));
|
||||
Xoa_ttl tmpl_ttl = Xoa_ttl.parse(fxt.Wiki(), Bry_.new_u8(tmpl_ttl_str));
|
||||
Xot_defn_tmpl defn_tmpl = (Xot_defn_tmpl)fxt.Wiki().Cache_mgr().Defn_cache().Get_by_key(tmpl_ttl.Page_db()); // get defn (which parse should have created)
|
||||
Tfds.Eq(expd_frame_ttl, String_.new_u8(defn_tmpl.Frame_ttl())); // check frame_ttl
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user