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

v1.10.3.1

This commit is contained in:
gnosygnu
2014-10-20 00:38:50 -04:00
parent d6561b3c1f
commit 7d8984f6a8
58 changed files with 654 additions and 441 deletions

View File

@@ -148,11 +148,12 @@ public class Xoa_url_parser {
}
else { // parse failed; url doesn't have protocol
byte[] wiki_bry = rv.Wiki_bry();
if (Bry_.Len_gt_0(wiki_bry)) { // NOTE: wiki_bry null when passing in Category:A from home_wiki
Xow_xwiki_itm xwiki_itm = app.User().Wiki().Xwiki_mgr().Get_by_key(wiki_bry); // see if url.Wiki_bry is actually wiki;
if ( xwiki_itm != null // null-check
&& !xwiki_itm.Type_is_xwiki_lang(cur_wiki.Lang().Lang_id())) // in xwiki, but not lang; EX: "fr.wikipedia.org" vs "fr"; ca.s:So/Natura_del_so; DATE:2014-04-26
wiki = app.Wiki_mgr().Get_by_key_or_make(xwiki_itm.Domain());
if (Bry_.Len_gt_0(wiki_bry)) { // NOTE: wiki_bry is null when passing in Category:A from home_wiki
Xow_xwiki_itm xwiki_itm = app.User().Wiki().Xwiki_mgr().Get_by_key(wiki_bry); // check if url.Wiki_bry is actually wiki; note that checking User().Wiki().Xwiki_mgr() to find "offline" wikis
if ( xwiki_itm != null // null-check
&& Bry_.Eq(xwiki_itm.Domain(), wiki_bry) // check that xwiki.domain == wiki; avoids false lang matches like "so/page" or "C/page"; EX: "fr.wikipedia.org" vs "fr"; ca.s:So/Natura_del_so; DATE:2014-04-26; PAGE:no.b:C/Variabler; DATE:2014-10-14
)
wiki = app.Wiki_mgr().Get_by_key_or_make(xwiki_itm.Domain());
}
if (rv.Page_bry() == null) { // 1 seg; EX: "Earth"; "fr.wikipedia.org"
if (wiki != null) { // wiki_bry is known wiki; EX: "fr.wikipedia.org"

View File

@@ -25,6 +25,10 @@ public class Xoa_url_parser_basic_tst {
@Test public void Abrv() { // deprecate; no longer needed with shortcuts
fxt.Expd_wiki("en.wikipedia.org").Expd_page("A").Test_parse_w_wiki("en.wikipedia.org/A");
}
@Test public void Commons() { // PURPOSE: "C" was being picked up as an xwiki to commons; PAGE:no.b:C/Variabler; DATE:2014-10-14
fxt.Init_xwiki("c", "commons.wikimedia.org"); // add alias of "C"
fxt.Expd_wiki("en.wikipedia.org").Expd_page("C/D").Test_parse_w_wiki("C/D"); // should use default wiki of enwiki, not commons; also, page should be "C/D", not "D"
}
@Test public void Http_basic() {
fxt.Expd_wiki("en.wikipedia.org").Expd_page("A").Test_parse_w_wiki("http://en.wikipedia.org/wiki/A");
}
@@ -144,6 +148,7 @@ class Xoa_url_parser_chkr implements Tst_chkr {
public Xoa_url_parser_chkr Expd_anchor(String v) {this.expd_anchor = v; return this;} private String expd_anchor;
public Xoa_url_parser_chkr Expd_action_is_edit_y() {this.expd_anchor_is_edit = Bool_.Y_byte; return this;} private byte expd_anchor_is_edit = Bool_.__byte;
public Xoa_url_parser_chkr Expd_action_is_edit_n() {this.expd_anchor_is_edit = Bool_.N_byte; return this;}
public void Init_xwiki(String alias, String domain) {app.User().Wiki().Xwiki_mgr().Add_full(alias, domain);}
public int Chk(Tst_mgr mgr, String path, Object actl_obj) {
Xoa_url actl = (Xoa_url)actl_obj;
int rv = 0;