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-13 23:23:30 -04:00
parent ecbe2918d8
commit bc10cd76b6
316 changed files with 3251 additions and 1652 deletions

View File

@@ -91,9 +91,8 @@ public class Xog_url_wkr {
return Rslt_handled;
}
private Xoa_url Exec_url_page(Xoa_app app, Xoa_page page, Xog_win_itm win, byte[] href_bry) { // EX: "Page"; "/wiki/Page"; // rewritten; DATE:2014-01-19
Xoa_url rv = new Xoa_url();
Xow_wiki wiki = page.Wiki();
app.Url_parser().Parse(rv, href_bry); // needed for query_args
Xoa_url rv = app.Url_parser().Parse(href_bry); // needed for query_args
byte[] anchor_bry = href.Anchor();
byte[] page_bry = rv.Page_bry();
byte[][] segs_ary = rv.Segs_ary();

View File

@@ -16,11 +16,12 @@ 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.gui.urls.url_macros; import gplx.*; import gplx.xowa.*; import gplx.xowa.gui.*; import gplx.xowa.gui.urls.*;
import gplx.core.btries.*;
public class Xog_url_macro_grp implements GfoInvkAble {
public ByteTrieMgr_slim Trie() {return trie;} private ByteTrieMgr_slim trie = ByteTrieMgr_slim.cs_();
public Btrie_slim_mgr Trie() {return trie;} private Btrie_slim_mgr trie = Btrie_slim_mgr.cs_();
public void Del(byte[] abrv) {trie.Del(abrv);}
public void Set(String abrv, String fmt) {Set(Bry_.new_utf8_(abrv), Bry_.new_utf8_(fmt));}
public void Set(byte[] abrv, byte[] fmt) {trie.Add(abrv, new Xog_url_macro_itm(abrv, fmt));}
public void Set(byte[] abrv, byte[] fmt) {trie.Add_obj(abrv, new Xog_url_macro_itm(abrv, fmt));}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_clear)) trie.Clear();
else if (ctx.Match(k, Invk_set)) Set(m.ReadBry("abrv"), m.ReadBry("fmt"));

View File

@@ -43,9 +43,9 @@ public class Xog_url_macro_mgr {
boolean dot_missing = dot_pos == -1;
int type_bgn = dot_pos + 1, type_end = colon_pos; // +1 to start type after dot;
if (dot_missing) type_bgn = 0;
Object custom_obj = custom_mgr.Trie().MatchAtCurExact(raw, 0, type_end); // match entire prefix
Object custom_obj = custom_mgr.Trie().Match_exact(raw, 0, type_end); // match entire prefix
if (custom_obj == null) {
Object type_obj = types_mgr.Trie().MatchAtCurExact(raw, type_bgn, type_end);
Object type_obj = types_mgr.Trie().Match_exact(raw, type_bgn, type_end);
if (type_obj == null) return Unhandled; // type abrv is not known; exit; EX: "en.unknown:Page"; "Page"
byte[] lang_bry = dot_missing ? lang_default : Bry_.Mid(raw, 0, dot_pos);
Xog_url_macro_itm type_itm = (Xog_url_macro_itm)type_obj;