1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00

Scribunto.Site: Use fully-qualified url for url property, not domain

This commit is contained in:
gnosygnu
2017-04-01 09:38:20 -04:00
parent 8cda46bef9
commit 3674dcf8de
6 changed files with 85 additions and 13 deletions

View File

@@ -17,6 +17,7 @@ package gplx.xowa.wikis.xwikis; import gplx.*; import gplx.xowa.*; import gplx.x
import gplx.core.net.*; import gplx.xowa.htmls.hrefs.*;
import gplx.xowa.langs.*;
import gplx.xowa.wikis.domains.*; import gplx.xowa.wikis.xwikis.parsers.*; import gplx.xowa.wikis.xwikis.sitelinks.*;
import gplx.xowa.wikis.xwikis.interwikis.*;
public class Xow_xwiki_mgr {
private final Ordered_hash list = Ordered_hash_.New_bry(); private final Hash_adp_bry hash = Hash_adp_bry.ci_a7();
private final Xow_wiki wiki;
@@ -24,6 +25,7 @@ public class Xow_xwiki_mgr {
this.wiki = wiki;
this.xwiki_domain_tid = Xwiki_tid(wiki.Domain_tid());
}
public Xow_interwiki_map Interwiki_map() {return interwiki_map;} private final Xow_interwiki_map interwiki_map = new Xow_interwiki_map(); // separate map for Scrib; DATE:2017-04-01
public int Xwiki_domain_tid() {return xwiki_domain_tid;} private int xwiki_domain_tid;
public int Len() {return list.Count();}
public void Clear() {hash.Clear(); list.Clear();}
@@ -36,6 +38,11 @@ public class Xow_xwiki_mgr {
return Add_by_atrs(Bry_.new_a7(key), Bry_.new_a7(domain), null)
.Offline_(true);// NOTE: need to mark offline in order to show in left sidebar
}
public Xow_xwiki_itm Add_by_site_interwikimap(byte[] key, byte[] domain_bry, byte[] url_xo, byte[] url_wm) {
interwiki_map.Add(key, domain_bry, url_wm);
return this.Add_by_atrs(key, domain_bry, url_xo);
}
public Xow_xwiki_itm Add_by_atrs(String key, String domain) {return Add_by_atrs(Bry_.new_a7(key), Bry_.new_a7(domain), null);}
public Xow_xwiki_itm Add_by_atrs(byte[] key, byte[] domain) {return Add_by_atrs(key, domain, null);}
public Xow_xwiki_itm Add_by_atrs(byte[] key, byte[] domain_bry, byte[] url_fmt) {

View File

@@ -0,0 +1,26 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.xowa.wikis.xwikis.interwikis; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*; import gplx.xowa.wikis.xwikis.*;
public class Xow_interwiki_itm {
public Xow_interwiki_itm(byte[] key, byte[] domain, byte[] url) {
this.key = key;
this.domain = domain;
this.url = url;
}
public byte[] Key() {return key;} private final byte[] key;
public byte[] Domain() {return domain;} private final byte[] domain;
public byte[] Url() {return url;} private final byte[] url;
}

View File

@@ -0,0 +1,25 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.xowa.wikis.xwikis.interwikis; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*; import gplx.xowa.wikis.xwikis.*;
public class Xow_interwiki_map {
private final Ordered_hash hash = Ordered_hash_.New_bry();
public int Len() {return hash.Len();}
public Xow_interwiki_itm Get_at(int i) {return (Xow_interwiki_itm)hash.Get_at(i);}
public void Add(byte[] key, byte[] domain, byte[] url) {
Xow_interwiki_itm itm = new Xow_interwiki_itm(key, domain, url);
hash.Add_if_dupe_use_nth(key, itm);
}
}