1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00
This commit is contained in:
gnosygnu
2014-07-20 23:42:54 -04:00
parent bc10cd76b6
commit e882217c62
408 changed files with 3648 additions and 2687 deletions

View File

@@ -21,7 +21,7 @@ public class Xoa_url_arg_hash {
public Gfo_url_arg Get_arg(byte[] key) {return (Gfo_url_arg)hash.Fetch(key);}
public int Get_val_int_or(byte[] key, int or) {
byte[] val_bry = Get_val_bry_or(key, null); if (val_bry == null) return or;
return Bry_.X_to_int_or(val_bry, or);
return Bry_.Xto_int_or(val_bry, or);
}
public byte[] Get_val_bry_or(byte[] key, byte[] or) {
Gfo_url_arg arg = (Gfo_url_arg)hash.Fetch(key);
@@ -63,12 +63,14 @@ public class Xoa_url_arg_hash {
Gfo_url_arg[] ary = (Gfo_url_arg[])hash.XtoAry(Gfo_url_arg.class);
url.Args_(ary);
}
public static void Concat_bfr(Bry_bfr bfr, Gfo_url_arg[] ary) {
public static void Concat_bfr(Bry_bfr bfr, Url_encoder href_encoder, Gfo_url_arg[] ary) {
int ary_len = ary.length;
for (int i = 0; i < ary_len; i++) {
Gfo_url_arg itm = ary[i];
bfr.Add_byte(i == 0 ? Byte_ascii.Question : Byte_ascii.Amp);
bfr.Add(itm.Key_bry()).Add_byte(Byte_ascii.Eq).Add(itm.Val_bry());
href_encoder.Encode(bfr, itm.Key_bry());
bfr.Add_byte(Byte_ascii.Eq);
href_encoder.Encode(bfr, itm.Val_bry());
}
}
}

View File

@@ -208,7 +208,7 @@ public class Xoa_url_parser {
page_bry = Xoa_page_.Main_page_bry_empty;
}
if (rv.Anchor_bry() != null) {
byte[] anchor_bry = app.Url_converter_id().Encode(rv.Anchor_bry()); // reencode for anchors (which use . encoding, not % encoding); EX.WP: Enlightenment_Spain#Enlightened_despotism_.281759%E2%80%931788.29
byte[] anchor_bry = app.Encoder_mgr().Id().Encode(rv.Anchor_bry()); // reencode for anchors (which use . encoding, not % encoding); PAGE:en.w:Enlightenment_Spain#Enlightened_despotism_.281759%E2%80%931788.29
rv.Anchor_bry_(anchor_bry);
}
Xoa_ttl ttl = Xoa_ttl.parse_(wiki, page_bry);

View File

@@ -47,7 +47,7 @@ public class Xoh_href_parser {
bgn = file_slash_end = Bry_.While_fwd(raw, Byte_ascii.Slash, tmp_url.Protocol_bry().length, raw_len);
rv.Tid_(Xoh_href.Tid_xowa);
rv.Wiki_(wiki.Domain_bry()); // wiki is always the current wiki
byte[] page = wiki.App().Url_converter_gfs().Decode(Bry_.Mid(raw, bgn, raw_len));
byte[] page = wiki.App().Encoder_mgr().Gfs().Decode(Bry_.Mid(raw, bgn, raw_len));
rv.Page_(page); // page is everything after "/xcmd/"; individual cmds will do further parsing; note that it should be decoded; EX: %20 -> " "; also note that anchor (#) or query params (?) are not parsed; the entire String will be reparsed later
return;
}

View File

@@ -196,7 +196,7 @@ class Xoh_href_parser_fxt {
wiki = Xoa_app_fxt.wiki_tst_(app);
wiki.Xwiki_mgr().Add_bulk(Bry_.new_ascii_("wikt|en.wiktionary.org"));
app.User().Wiki().Xwiki_mgr().Add_bulk(Bry_.new_ascii_("en.wiktionary.org|en.wiktionary.org"));
href_parser = new Xoh_href_parser(app.Url_converter_href(), app.Url_parser().Url_parser());
href_parser = new Xoh_href_parser(app.Encoder_mgr().Href(), app.Url_parser().Url_parser());
}
public Xoa_app App() {return app;} private Xoa_app app;
public Xoh_href_parser_fxt Init_xwiki_alias(String alias, String domain) {