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:
@@ -25,12 +25,12 @@ public class Xow_html_util implements GfoInvkAble {
|
||||
} private static final String Invk_if_bool = "if_bool", Invk_if_yn = "if_yn";
|
||||
String If_bool(String expr, String true_val, String false_val) {
|
||||
Object o = wiki.Appe().Gfs_mgr().Run_str(expr);
|
||||
try {return Bool_.cast_(o) ? true_val : false_val;}
|
||||
try {return Bool_.cast(o) ? true_val : false_val;}
|
||||
catch (Exception e) {Err_.Noop(e); return "expr failed: " + expr;}
|
||||
}
|
||||
String If_yn(String expr, String true_val, String false_val) {
|
||||
String o = String_.as_(wiki.Appe().Gfs_mgr().Run_str(expr));
|
||||
try {return Yn.parse_(o) ? true_val : false_val;}
|
||||
try {return Yn.parse(o) ? true_val : false_val;}
|
||||
catch (Exception e) {Err_.Noop(e); return "expr failed: " + expr;}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public class Xow_ns_ {
|
||||
, Id_help = 12 , Id_help_talk = 13
|
||||
, Id_category = 14 , Id_category_talk = 15
|
||||
, Id_portal = 100 , Id_portal_talk = 101
|
||||
, Id_null = Int_.MinValue
|
||||
, Id_null = Int_.Min_value
|
||||
;
|
||||
public static final String
|
||||
Key_media = "Media"
|
||||
|
||||
@@ -20,7 +20,7 @@ public class Xow_ns_case_ {
|
||||
public static final byte Id_all = 0, Id_1st = 1;
|
||||
public static final String Key_all = "case-sensitive", Key_1st = "first-letter";
|
||||
public static final byte[] Bry__all = Bry_.new_a7(Key_all), Bry__1st = Bry_.new_a7(Key_1st);
|
||||
public static byte parse_(String s) {
|
||||
public static byte parse(String s) {
|
||||
if (String_.Eq(s, Key_1st)) return Id_1st;
|
||||
else if (String_.Eq(s, Key_all)) return Id_all;
|
||||
else throw Err_.new_unhandled(s);
|
||||
|
||||
@@ -47,7 +47,7 @@ public class Xow_ns_mgr implements GfoInvkAble, gplx.lists.ComparerAble {
|
||||
public Xow_ns Ns_project() {return ns_project;} private Xow_ns ns_project;
|
||||
public Xow_ns Ns_module() {return ns_module;} private Xow_ns ns_module;
|
||||
public Xow_ns Ns_mediawiki() {return ns_mediawiki;} private Xow_ns ns_mediawiki;
|
||||
public int Ns_page_id() {return ns_page_id;} public void Ns_page_id_(int v) {ns_page_id = v;} private int ns_page_id = Int_.MinValue;
|
||||
public int Ns_page_id() {return ns_page_id;} public void Ns_page_id_(int v) {ns_page_id = v;} private int ns_page_id = Int_.Min_value;
|
||||
public int Count() {return ns_count;} private int ns_count = 0;
|
||||
public Xow_ns[] Ords_ary() {return ords;} private Xow_ns[] ords = new Xow_ns[Xow_ns_mgr_.Ordinal_max];
|
||||
public int Ords_len() {return ords_len;} private int ords_len;
|
||||
@@ -58,7 +58,7 @@ public class Xow_ns_mgr implements GfoInvkAble, gplx.lists.ComparerAble {
|
||||
private Xow_ns Ids_get_or_empty(int id) {
|
||||
Xow_ns rv = Ids_get_or_null(id);
|
||||
return rv == null ? Ns__empty : rv;
|
||||
} private static final Xow_ns Ns__empty = new Xow_ns(Int_.MaxValue, Byte_.Zero, Bry_.Empty, false);
|
||||
} private static final Xow_ns Ns__empty = new Xow_ns(Int_.Max_value, Byte_.Zero, Bry_.Empty, false);
|
||||
public Xow_ns Names_get_or_null(byte[] name_bry) {return this.Names_get_or_null(name_bry, 0, name_bry.length);}
|
||||
public Xow_ns Names_get_or_null(byte[] src, int bgn, int end) {
|
||||
Object rv = name_hash.Get_by_mid(src, bgn, end);
|
||||
@@ -174,18 +174,18 @@ public class Xow_ns_mgr implements GfoInvkAble, gplx.lists.ComparerAble {
|
||||
int ns_len = id_hash.Count();
|
||||
id_hash.Sort_by(this);
|
||||
// assert that all items are grouped in pairs of subj, talk; note that subj is even and talk is odd
|
||||
int nxt_ns_id = Int_.MinValue;
|
||||
int prv_ns_id = Int_.MinValue;
|
||||
int nxt_ns_id = Int_.Min_value;
|
||||
int prv_ns_id = Int_.Min_value;
|
||||
for (int i = 0; i < ns_len; i++) {
|
||||
Xow_ns ns = (Xow_ns)id_hash.Get_at(i);
|
||||
int ns_id = ns.Id();
|
||||
if (ns_id < 0 // ignore negative ns (which don't have subj/talk pairing)
|
||||
|| ns.Is_alias() // ignore alias
|
||||
) continue;
|
||||
if (nxt_ns_id != Int_.MinValue) { // nxt_ns_id is set
|
||||
if (nxt_ns_id != Int_.Min_value) { // nxt_ns_id is set
|
||||
if (nxt_ns_id != ns_id) // prv was subj, but cur does not match expected talk_id; create talk for prv subj
|
||||
Ords_sort_add(nxt_ns_id);
|
||||
nxt_ns_id = Int_.MinValue; // always reset value
|
||||
nxt_ns_id = Int_.Min_value; // always reset value
|
||||
}
|
||||
if (ns_id % 2 == 0) // subj
|
||||
nxt_ns_id = ns_id + 1; // anticipate nxt_ns_id
|
||||
@@ -195,7 +195,7 @@ public class Xow_ns_mgr implements GfoInvkAble, gplx.lists.ComparerAble {
|
||||
}
|
||||
prv_ns_id = ns_id;
|
||||
}
|
||||
if (nxt_ns_id != Int_.MinValue) // handle trailing ns_id; EX: 0, 1, 2; need to make 3
|
||||
if (nxt_ns_id != Int_.Min_value) // handle trailing ns_id; EX: 0, 1, 2; need to make 3
|
||||
Ords_sort_add(nxt_ns_id);
|
||||
|
||||
// sort again b/c new ns may have been added
|
||||
@@ -254,7 +254,7 @@ public class Xow_ns_mgr implements GfoInvkAble, gplx.lists.ComparerAble {
|
||||
byte[] line = lines[i];
|
||||
if (line.length == 0) continue;
|
||||
byte[][] flds = Bry_.Split(line, Byte_ascii.Pipe);
|
||||
int cur_id = Bry_.To_int_or(flds[0], Int_.MinValue);
|
||||
int cur_id = Bry_.To_int_or(flds[0], Int_.Min_value);
|
||||
this.Aliases_add(cur_id, String_.new_u8(flds[1]));
|
||||
}
|
||||
Ords_sort();
|
||||
|
||||
@@ -72,7 +72,7 @@ class Xow_ns_mgr_fxt {
|
||||
for (int i = 0; i < ns_names_len; ++i) {
|
||||
String ns_name = ns_names[i];
|
||||
Xow_ns actl_ns = ns_mgr.Names_get_or_null(Bry_.new_u8(ns_name));
|
||||
int actl_id = actl_ns == null ? Int_.MinValue : actl_ns.Id();
|
||||
int actl_id = actl_ns == null ? Int_.Min_value : actl_ns.Id();
|
||||
Tfds.Eq(expd_id, actl_id, ns_name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public class Xow_ns_tst {
|
||||
}
|
||||
class Xow_ns_fxt {
|
||||
public void Clear() {
|
||||
expd_id_subjId = expd_id_talkId = Int_.MaxValue;
|
||||
expd_id_subjId = expd_id_talkId = Int_.Max_value;
|
||||
expd_id_subj = expd_id_talk = false;
|
||||
}
|
||||
public Xow_ns_fxt Expd_id_subjId_(int v) {expd_id_subjId = v; return this;} private int expd_id_subjId;
|
||||
|
||||
@@ -19,7 +19,7 @@ package gplx.xowa; import gplx.*;
|
||||
import gplx.xowa.wikis.*; import gplx.xowa.wikis.domains.*;
|
||||
import gplx.xowa.html.hrefs.*;
|
||||
public class Xow_wiki_props implements GfoInvkAble {
|
||||
public byte[] Main_page() {return main_page;} private byte[] main_page = Xoa_page_.Main_page_bry; // HACK: default to Main_Page b/c some code tries to do Xoa_ttl.parse_() which will not work with ""; DATE:2014-02-16
|
||||
public byte[] Main_page() {return main_page;} private byte[] main_page = Xoa_page_.Main_page_bry; // HACK: default to Main_Page b/c some code tries to do Xoa_ttl.parse() which will not work with ""; DATE:2014-02-16
|
||||
public Xow_wiki_props Main_page_(byte[] v) {main_page = v; return this;}
|
||||
public void Main_page_update(Xowe_wiki wiki) {
|
||||
siteinfo_mainpage = main_page; // note that main_page came from <siteinfo>; store old value for record's sake
|
||||
|
||||
@@ -33,7 +33,7 @@ class Xow_wiki_fxt {
|
||||
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_ttl ttl = Xoa_ttl.parse(wiki, ttl_bry);
|
||||
Xoae_page actl = fxt.Wiki().Load_page_by_ttl(url, ttl);
|
||||
if (expd == null) Tfds.Eq_true(actl.Missing());
|
||||
else Tfds.Eq(expd, String_.new_u8(actl.Ttl().Raw()));
|
||||
|
||||
@@ -18,10 +18,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa; import gplx.*;
|
||||
public class Xowc_xtn_pages implements GfoInvkAble {
|
||||
public boolean Init_needed() {return init_needed;} private boolean init_needed = true;
|
||||
public int Ns_page_id() {return ns_page_id;} private int ns_page_id = Int_.MinValue;
|
||||
public int Ns_page_talk_id() {return ns_page_talk_id;} private int ns_page_talk_id = Int_.MinValue;
|
||||
public int Ns_index_id() {return ns_index_id;} private int ns_index_id = Int_.MinValue;
|
||||
public int Ns_index_talk_id() {return ns_index_talk_id;} private int ns_index_talk_id = Int_.MinValue;
|
||||
public int Ns_page_id() {return ns_page_id;} private int ns_page_id = Int_.Min_value;
|
||||
public int Ns_page_talk_id() {return ns_page_talk_id;} private int ns_page_talk_id = Int_.Min_value;
|
||||
public int Ns_index_id() {return ns_index_id;} private int ns_index_id = Int_.Min_value;
|
||||
public int Ns_index_talk_id() {return ns_index_talk_id;} private int ns_index_talk_id = Int_.Min_value;
|
||||
public void Ns_names_(byte[] page_name, byte[] page_talk_name, byte[] index_name, byte[] index_talk_name) {
|
||||
this.page_name = page_name; this.page_talk_name = page_talk_name; this.index_name = index_name; this.index_talk_name = index_talk_name;
|
||||
}
|
||||
@@ -31,7 +31,7 @@ public class Xowc_xtn_pages implements GfoInvkAble {
|
||||
, index_name = Default_ns_index_name
|
||||
, index_talk_name = Default_ns_index_talk_name;
|
||||
public void Reset() {
|
||||
ns_page_id = ns_page_talk_id = ns_index_id = ns_index_talk_id = Int_.MinValue;
|
||||
ns_page_id = ns_page_talk_id = ns_index_id = ns_index_talk_id = Int_.Min_value;
|
||||
init_needed = true;
|
||||
}
|
||||
public void Init(Xow_ns_mgr ns_mgr) {
|
||||
|
||||
@@ -59,7 +59,7 @@ class Xowc_xtn_pages_fxt {
|
||||
}
|
||||
private void Test_ns_canonical_itm(String name, int expd_ns_id) {
|
||||
Xow_ns ns = ns_mgr.Names_get_or_null(Bry_.new_a7(name));
|
||||
int actl_ns_id = ns == null ? Int_.MinValue : ns.Id();
|
||||
int actl_ns_id = ns == null ? Int_.Min_value : ns.Id();
|
||||
Tfds.Eq(expd_ns_id, actl_ns_id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,8 +78,8 @@ public class Xowe_wiki implements Xow_wiki, GfoInvkAble, GfoEvObj {
|
||||
}
|
||||
public GfoEvMgr EvMgr() {return ev_mgr;} private final GfoEvMgr ev_mgr;
|
||||
public Xow_ns_mgr Ns_mgr() {return ns_mgr;} private final Xow_ns_mgr ns_mgr;
|
||||
public Xoa_ttl Ttl_parse(byte[] ttl) {return Xoa_ttl.parse_(this, ttl);}
|
||||
public Xoa_ttl Ttl_parse(int ns_id, byte[] ttl) {return Xoa_ttl.parse_(this, ns_id, ttl);}
|
||||
public Xoa_ttl Ttl_parse(byte[] ttl) {return Xoa_ttl.parse(this, ttl);}
|
||||
public Xoa_ttl Ttl_parse(int ns_id, byte[] ttl) {return Xoa_ttl.parse(this, ns_id, ttl);}
|
||||
public boolean Type_is_edit() {return Bool_.Y;}
|
||||
public Xoa_app App() {return app;}
|
||||
public Xol_lang Lang() {return lang;} private final Xol_lang lang;
|
||||
|
||||
Reference in New Issue
Block a user