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,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.wikis.xwikis; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*;
|
||||
import gplx.xowa.apps.langs.*;
|
||||
import gplx.xowa.langs.cfgs.*;
|
||||
public class Xow_lang_itm {
|
||||
private final Xow_lang_grp html_grp; private final Xow_xwiki_itm xwiki; private final Xoac_lang_itm lang;
|
||||
public Xow_lang_itm(Xow_lang_grp html_grp, Xow_xwiki_itm xwiki, Xoac_lang_itm lang) {
|
||||
|
||||
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.wikis.xwikis; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*;
|
||||
import gplx.xowa.langs.*; import gplx.xowa.wikis.xwikis.*; import gplx.xowa.apis.xowa.html.*; import gplx.xowa.xtns.wdatas.core.*;
|
||||
import gplx.xowa.html.hrefs.*;
|
||||
import gplx.xowa.apps.langs.*;
|
||||
import gplx.xowa.langs.cfgs.*;
|
||||
public class Xow_lang_mgr {
|
||||
Xow_lang_mgr() {
|
||||
int len = Xol_lang_itm_.Id__max;
|
||||
@@ -79,7 +79,7 @@ public class Xow_lang_mgr {
|
||||
byte[] ttl_bry = ttl.Page_txt_w_anchor();
|
||||
boolean empty_xwiki = false;
|
||||
if (Bry_.Len_eq_0(ttl_bry)) {
|
||||
ttl_bry = wiki.Ctx().Cur_page().Ttl().Page_txt();
|
||||
ttl_bry = wiki.Parser_mgr().Ctx().Cur_page().Ttl().Page_txt();
|
||||
empty_xwiki = true;
|
||||
}
|
||||
itm.Atrs_set(ttl_bry, empty_xwiki, slink.Badges());
|
||||
|
||||
@@ -50,12 +50,12 @@ public class Xow_lang_mgr_fxt {
|
||||
public Xowe_wiki Wiki() {return wiki;} private Xowe_wiki wiki;
|
||||
Xoae_app app;
|
||||
public void tst(String raw, String expd) {
|
||||
Xop_ctx ctx = wiki.Ctx();
|
||||
Xop_ctx ctx = wiki.Parser_mgr().Ctx();
|
||||
ctx.Cur_page().Ttl_(Xoa_ttl.parse(wiki, Bry_.new_a7("test_page")));
|
||||
byte[] raw_bry = Bry_.new_u8(raw);
|
||||
Bry_bfr bfr = Bry_bfr.new_();
|
||||
Xop_root_tkn root = ctx.Tkn_mkr().Root(raw_bry);
|
||||
wiki.Parser().Parse_page_all_clear(root, ctx, ctx.Tkn_mkr(), raw_bry);
|
||||
wiki.Parser_mgr().Main().Parse_page_all_clear(root, ctx, ctx.Tkn_mkr(), raw_bry);
|
||||
wiki.Html_mgr().Html_wtr().Write_all(bfr, ctx, raw_bry, root);
|
||||
|
||||
Bry_bfr html_bfr = Bry_bfr.new_();
|
||||
|
||||
@@ -17,13 +17,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.wikis.xwikis; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*;
|
||||
import gplx.core.net.*;
|
||||
import gplx.xowa.apps.gfss.*;
|
||||
import gplx.xowa.langs.*;
|
||||
import gplx.xowa.wikis.domains.*;
|
||||
public class Xow_xwiki_itm_bldr {
|
||||
private final Bry_bfr tmp_bfr = Bry_bfr.new_();
|
||||
private final Gfo_url_parser url_parser = new Gfo_url_parser(); private final Gfo_url url = new Gfo_url();
|
||||
public Xow_xwiki_itm Bld(Xow_domain_itm cur_domain, byte[] key, byte[] mw_url, byte[] domain_name) {
|
||||
byte[] xo_url = gplx.xowa.apps.Xoa_gfs_php_mgr.Xto_gfs(tmp_bfr, mw_url); // EX: "//commons.wikimedia.org/wiki/Category:$1" -> "//commons.wikimedia.org/wiki/Category:~{0}"
|
||||
byte[] xo_url = Xoa_gfs_php_mgr.Xto_gfs(tmp_bfr, mw_url); // EX: "//commons.wikimedia.org/wiki/Category:$1" -> "//commons.wikimedia.org/wiki/Category:~{0}"
|
||||
url_parser.Parse(url, xo_url, 0, xo_url.length);
|
||||
byte[] domain_bry = url.Segs__get_at_1st(); // extract "commons.wikimedia.org"
|
||||
Xow_domain_itm domain_itm = Xow_domain_itm_.parse(domain_bry);
|
||||
|
||||
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.wikis.xwikis; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*;
|
||||
import gplx.core.net.*;
|
||||
import gplx.xowa.langs.*; import gplx.xowa.apps.langs.*;
|
||||
import gplx.xowa.langs.*; import gplx.xowa.langs.cfgs.*;
|
||||
import gplx.xowa.html.hrefs.*;
|
||||
import gplx.xowa.wikis.domains.*; import gplx.xowa.wikis.xwikis.cfgs.*;
|
||||
public class Xow_xwiki_mgr implements GfoInvkAble {
|
||||
@@ -28,8 +28,10 @@ public class Xow_xwiki_mgr implements GfoInvkAble {
|
||||
public Xow_xwiki_mgr(Xowe_wiki wiki, Gfo_url_parser url_parser) {
|
||||
this.wiki = wiki;
|
||||
srl = new Xow_xwiki_mgr_srl(wiki.Domain_itm(), this);
|
||||
}
|
||||
public Xow_lang_mgr Lang_mgr() {return lang_mgr;} private final Xow_lang_mgr lang_mgr = Xow_lang_mgr.dflt_();
|
||||
this.xwiki_domain_tid = Xwiki_tid(wiki.Domain_tid());
|
||||
}
|
||||
public int Xwiki_domain_tid() {return xwiki_domain_tid;} private int xwiki_domain_tid;
|
||||
public Xow_lang_mgr Lang_mgr() {return lang_mgr;} private final Xow_lang_mgr lang_mgr = Xow_lang_mgr.dflt_();
|
||||
public int Len() {return list.Count();}
|
||||
public void Clear() {hash.Clear(); list.Clear();}
|
||||
public Xow_xwiki_itm Get_at(int i) {return (Xow_xwiki_itm)list.Get_at(i);}
|
||||
@@ -66,7 +68,7 @@ public class Xow_xwiki_mgr implements GfoInvkAble {
|
||||
return (Xow_domain_itm[])rv.To_ary_and_clear(Xow_domain_itm.class);
|
||||
}
|
||||
public void Add_bulk(byte[] raw) {
|
||||
byte[][] rows = Bry_.Split(raw, Byte_ascii.Nl);
|
||||
byte[][] rows = Bry_split_.Split(raw, Byte_ascii.Nl);
|
||||
int rows_len = rows.length;
|
||||
Hash_adp_bry lang_regy = Xol_lang_itm_.Regy();
|
||||
for (int i = 0; i < rows_len; i++) {
|
||||
@@ -76,7 +78,7 @@ public class Xow_xwiki_mgr implements GfoInvkAble {
|
||||
}
|
||||
}
|
||||
public Xow_xwiki_itm Add_bulk_row(Hash_adp_bry lang_regy, byte[] row) {
|
||||
byte[][] flds = Bry_.Split(row, Byte_ascii.Pipe); int flds_len = flds.length;
|
||||
byte[][] flds = Bry_split_.Split(row, Byte_ascii.Pipe); int flds_len = flds.length;
|
||||
byte[] alias = Bry_.Empty, domain_bry = Bry_.Empty;
|
||||
for (int j = 0; j < flds_len; j++) {
|
||||
byte[] fld = flds[j];
|
||||
@@ -115,7 +117,7 @@ public class Xow_xwiki_mgr implements GfoInvkAble {
|
||||
return tmp_bfr.To_str_and_rls();
|
||||
}
|
||||
public void Add_bulk_peers(byte[] raw) {
|
||||
byte[][] keys = Bry_.Split(raw, Byte_ascii.Tilde);
|
||||
byte[][] keys = Bry_split_.Split(raw, Byte_ascii.Tilde);
|
||||
int len = keys.length;
|
||||
Ordered_hash peers = Ordered_hash_.new_();
|
||||
Cfg_nde_root peer_root = wiki.Appe().Wiki_mgr().Groups();
|
||||
@@ -216,4 +218,15 @@ public class Xow_xwiki_mgr implements GfoInvkAble {
|
||||
Invk_add_bulk = "add_bulk", Invk_add_bulk_langs = "add_bulk_langs", Invk_add_bulk_peers = "add_bulk_peers", Invk_add_many = "add_many"
|
||||
, Invk_itms_print = "itms_print", Invk_count = "count", Invk_clear = "clear"
|
||||
;
|
||||
private static int Xwiki_tid(int tid) {
|
||||
switch (tid) {
|
||||
case Xow_domain_type_.Int__commons:
|
||||
case Xow_domain_type_.Int__species:
|
||||
case Xow_domain_type_.Int__incubator:
|
||||
case Xow_domain_type_.Int__mediawiki:
|
||||
case Xow_domain_type_.Int__wmfblog:
|
||||
case Xow_domain_type_.Int__home: return Xow_domain_type_.Int__wikipedia; // set xwiki_tid to wikipedia; allows [[da:Page]] to point to da.wikipedia.org; PAGE:species:Puccinia; DATE:2014-09-14
|
||||
default: return tid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.wikis.xwikis; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*;
|
||||
import gplx.srls.dsvs.*; import gplx.xowa.wikis.domains.*;
|
||||
import gplx.langs.dsvs.*; import gplx.xowa.wikis.domains.*;
|
||||
class Xow_xwiki_mgr_srl extends Dsv_wkr_base {
|
||||
private byte[] key, url_fmt, name;
|
||||
private final Xow_domain_itm cur_domain; private final Xow_xwiki_mgr mgr;
|
||||
|
||||
@@ -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.wikis.xwikis.cfgs; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*; import gplx.xowa.wikis.xwikis.*;
|
||||
import gplx.xowa.langs.cfgs.*;
|
||||
interface Xoac_wiki_obj {}
|
||||
public class Xoac_wiki_grp implements Cfg_nde_obj, Xoac_wiki_obj {
|
||||
public Xoac_wiki_grp(byte[] key) {this.key_bry = key; this.name_bry = key_bry;}
|
||||
|
||||
@@ -16,8 +16,8 @@ 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.wikis.xwikis.cfgs; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*; import gplx.xowa.wikis.xwikis.*;
|
||||
import org.junit.*;
|
||||
import gplx.xowa.wikis.*;
|
||||
import org.junit.*; import gplx.core.tests.*;
|
||||
import gplx.xowa.wikis.*; import gplx.xowa.langs.cfgs.*;
|
||||
public class Xoac_wiki_grp_tst {
|
||||
Xoac_wiki_grp_fxt fxt = new Xoac_wiki_grp_fxt();
|
||||
@Before public void init() {fxt.Clear();}
|
||||
|
||||
@@ -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.wikis.xwikis.cfgs; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*; import gplx.xowa.wikis.xwikis.*;
|
||||
import gplx.xowa.langs.cfgs.*;
|
||||
public class Xoac_wiki_itm implements Cfg_nde_obj, Xoac_wiki_obj {
|
||||
public Xoac_wiki_itm(byte[] key) {this.key_bry = key;}
|
||||
public byte[] Key_bry() {return key_bry;} private byte[] key_bry;
|
||||
@@ -30,6 +31,6 @@ public class Xoac_wiki_itm implements Cfg_nde_obj, Xoac_wiki_obj {
|
||||
public void Nde_subs_del(byte[] key) {throw Err_.new_wo_type("leafs cannot delete itms", "key", String_.new_u8(key));}
|
||||
public void Nde_atrs_set(byte[][] ary) {
|
||||
int ary_len = ary.length;
|
||||
if (ary_len > 0) aliases = Bry_.Split(ary[0], Byte_ascii.Semic);
|
||||
if (ary_len > 0) aliases = Bry_split_.Split(ary[0], Byte_ascii.Semic);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user