mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
v2.10.3.1
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
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.guis.urls; import gplx.*; import gplx.xowa.*; import gplx.xowa.guis.*;
|
||||
import gplx.xowa.files.*; import gplx.xowa.files.repos.*; import gplx.xowa.files.origs.*;
|
||||
import gplx.xowa.parsers.lnkis.*;
|
||||
public class Xof_orig_file_downloader {
|
||||
public static Xof_fsdb_itm Make_fsdb(Xowe_wiki wiki, byte[] lnki_ttl, Xof_img_size img_size, Xof_url_bldr url_bldr) {
|
||||
Xof_fsdb_itm fsdb = new Xof_fsdb_itm();
|
||||
lnki_ttl = Xoa_ttl.Replace_spaces(Xoa_app_.Utl__encoder_mgr().Http_url().Decode(lnki_ttl));
|
||||
fsdb.Init_at_lnki(Xof_exec_tid.Tid_viewer_app, wiki.Domain_itm().Abrv_xo(), lnki_ttl, Xop_lnki_type.Id_none, Xop_lnki_tkn.Upright_null, Xof_img_size.Size__neg1, Xof_img_size.Size__neg1, Xof_lnki_time.Null, Xof_lnki_page.Null, Xof_patch_upright_tid_.Tid_all);
|
||||
fsdb.Init_at_hdoc(Int_.Max_value, Xof_html_elem.Tid_img);// NOTE: set elem_id to "impossible" number, otherwise it will auto-update an image on the page with a super-large size; [[File:Alfred Sisley 062.jpg]]
|
||||
Xof_orig_itm orig = wiki.File__orig_mgr().Find_by_ttl_or_null(lnki_ttl); if (orig == Xof_orig_itm.Null) return null; // orig not found; need orig in order to get repo
|
||||
Xof_repo_itm repo = wiki.File__repo_mgr().Get_trg_by_id_or_null(orig.Repo(), lnki_ttl, Bry_.Empty); if (repo == null) return null; // repo not found
|
||||
fsdb.Init_at_orig(orig.Repo(), repo.Wiki_domain(), orig.Ttl(), orig.Ext(), orig.W(), orig.H(), orig.Redirect());
|
||||
fsdb.Init_at_html(Xof_exec_tid.Tid_viewer_app, img_size, repo, url_bldr);
|
||||
fsdb.File_is_orig_(true);
|
||||
return fsdb;
|
||||
}
|
||||
}
|
||||
107
400_xowa/src/gplx/xowa/guis/urls/Xog_url_wkr.java
Normal file
107
400_xowa/src/gplx/xowa/guis/urls/Xog_url_wkr.java
Normal file
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
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.guis.urls; import gplx.*; import gplx.xowa.*; import gplx.xowa.guis.*;
|
||||
import gplx.core.net.*;
|
||||
import gplx.xowa.files.*; import gplx.xowa.files.repos.*; import gplx.xowa.files.origs.*;
|
||||
import gplx.xowa.htmls.hrefs.*; import gplx.xowa.htmls.doms.*;
|
||||
import gplx.xowa.guis.views.*;
|
||||
public class Xog_url_wkr {
|
||||
private final Xoa_url tmp_url = Xoa_url.blank();
|
||||
private Xoae_app app; private Xog_win_itm win; private Xowe_wiki wiki; private Xoae_page page;
|
||||
private final Xof_img_size img_size = new Xof_img_size(); private final Xof_url_bldr url_bldr = Xof_url_bldr.new_v2();
|
||||
public Xog_url_wkr Parse(Xog_win_itm win, String href_str) {
|
||||
if (href_str == null) return this; // text is not link; return;
|
||||
byte[] href_bry = Bry_.new_u8(href_str);
|
||||
this.win = win; this.app = win.App();
|
||||
this.page = win.Active_page();
|
||||
this.wiki = win.Active_tab().Wiki();
|
||||
app.Html__href_parser().Parse_as_url(tmp_url, href_bry, wiki, page.Ttl().Page_url());
|
||||
return this;
|
||||
}
|
||||
public Xoa_url Exec() {
|
||||
switch (tmp_url.Tid()) {
|
||||
case Xoa_url_.Tid_unknown: return Xoa_url.Null; // unknown; return null which will become a noop
|
||||
case Xoa_url_.Tid_inet: return Exec_url_http(app); // http://site.org
|
||||
case Xoa_url_.Tid_anch: return Exec_url_anchor(win); // #anchor
|
||||
case Xoa_url_.Tid_xcmd: return Exec_url_xowa(app); // xowa:app.version or /xcmd/app.version
|
||||
case Xoa_url_.Tid_file: return Exec_url_file(app, wiki, page, win, tmp_url.Raw()); // file:///xowa/A.png
|
||||
case Xoa_url_.Tid_page: return Exec_url_page(app, wiki, page, win, tmp_url.Raw()); // Page /wiki/Page
|
||||
default: throw Err_.new_unhandled(tmp_url.Tid());
|
||||
}
|
||||
}
|
||||
private Xoa_url Exec_url_xowa(Xoae_app app) { // EX: xowa:app.version
|
||||
// NOTE: must catch exception else it will bubble to SWT browser and raise secondary exception of xowa is not a registered protocol
|
||||
try {app.Gfs_mgr().Run_str(String_.new_u8(tmp_url.Page_bry()));}
|
||||
catch (Exception e) {app.Gui_mgr().Kit().Ask_ok("", "", Err_.Message_gplx_full(e));}
|
||||
return Rslt_handled;
|
||||
}
|
||||
private Xoa_url Exec_url_http(Xoae_app app) { // EX: http://a.org
|
||||
app.Prog_mgr().Exec_view_web(tmp_url.Raw());
|
||||
return Rslt_handled;
|
||||
}
|
||||
private Xoa_url Exec_url_anchor(Xog_win_itm win) { // EX: #anchor
|
||||
win.Active_html_itm().Scroll_page_by_id_gui(tmp_url.Anch_str()); // NOTE: was originally directly; changed to call on thread; DATE:2014-05-03
|
||||
return Rslt_handled;
|
||||
}
|
||||
private Xoa_url Exec_url_file(Xoae_app app, Xowe_wiki cur_wiki, Xoae_page page, Xog_win_itm win, byte[] href_bry) { // EX: file:///xowa/A.png
|
||||
Xowe_wiki wiki = (Xowe_wiki)page.Commons_mgr().Source_wiki_or(cur_wiki);
|
||||
Io_url href_url = Io_url_.http_any_(String_.new_u8(Xoa_app_.Utl__encoder_mgr().Http_url().Decode(href_bry)), Op_sys.Cur().Tid_is_wnt());
|
||||
gplx.gfui.Gfui_html html_box = win.Active_html_box();
|
||||
String xowa_ttl = wiki.Gui_mgr().Cfg_browser().Content_editable()
|
||||
? html_box.Html_js_eval_proc_as_str(Xog_js_procs.Selection__get_active_for_editable_mode, gplx.xowa.htmls.Xoh_consts.Atr_xowa_title_str, null)
|
||||
: Xoh_dom_.Title_by_href(href_bry, Bry_.new_u8(html_box.Html_js_eval_proc_as_str(Xog_js_procs.Doc__root_html_get)));
|
||||
if (xowa_ttl == null) {app.Gui_mgr().Kit().Ask_ok("", "", "could not find find anchor with href in html: href=~{0}", href_bry); return Rslt_handled;}
|
||||
byte[] lnki_ttl = Xoa_app_.Utl__encoder_mgr().Http_url().Decode(Xoa_ttl.Replace_spaces(Bry_.new_u8(xowa_ttl)));
|
||||
Xof_fsdb_itm fsdb = Xof_orig_file_downloader.Make_fsdb(wiki, lnki_ttl, img_size, url_bldr);
|
||||
if (!Io_mgr.Instance.ExistsFil(href_url)) {
|
||||
// if (!Xof_orig_file_downloader.Get_to_url(fsdb, href_url, wiki, lnki_ttl, url_bldr))
|
||||
if (!Xof_file_wkr.Show_img(fsdb, Xoa_app_.Usr_dlg(), wiki.File__bin_mgr(), wiki.File__mnt_mgr(), wiki.App().User().User_db_mgr().Cache_mgr(), wiki.File__repo_mgr(), gplx.xowa.files.gui.Xog_js_wkr_.Noop, img_size, url_bldr, page))
|
||||
return Rslt_handled;
|
||||
}
|
||||
gplx.ios.IoItmFil fil = Io_mgr.Instance.QueryFil(href_url);
|
||||
if (fil.Exists()) {
|
||||
ProcessAdp media_player = app.Prog_mgr().App_by_ext(href_url.Ext());
|
||||
media_player.Run(href_url);
|
||||
fsdb.File_size_(fil.Size());
|
||||
gplx.xowa.files.caches.Xou_cache_mgr cache_mgr = wiki.Appe().User().User_db_mgr().Cache_mgr();
|
||||
cache_mgr.Update(fsdb);
|
||||
cache_mgr.Db_save();
|
||||
}
|
||||
return Rslt_handled;
|
||||
}
|
||||
private Xoa_url Exec_url_page(Xoae_app app, Xowe_wiki wiki, Xoae_page page, Xog_win_itm win, byte[] href_bry) { // EX: "Page"; "/wiki/Page"; // rewritten; DATE:2014-01-19
|
||||
Xoa_url rv = wiki.Utl__url_parser().Parse(href_bry);// needed for query_args
|
||||
Gfo_qarg_itm[] qargs = rv.Qargs_ary();
|
||||
int qargs_len = qargs.length;
|
||||
if (qargs_len > 0) { // remove anchors from qargs; EX: "to=B#mw_pages"
|
||||
for (int i = 0; i < qargs_len; i++) {
|
||||
Gfo_qarg_itm arg = qargs[i];
|
||||
int anch_pos = Bry_find_.Find_bwd(arg.Val_bry(), Byte_ascii.Hash); // NOTE: must .FindBwd to handle Category args like de.wikipedia.org/wiki/Kategorie:Begriffskl%C3%A4rung?pagefrom=#::12%20PANZERDIVISION#mw-pages; DATE:2013-06-18
|
||||
if (anch_pos != Bry_.NotFound)
|
||||
arg.Val_bry_(Bry_.Mid(arg.Val_bry(), 0, anch_pos));
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
public static Xoa_url Rslt_handled = null;
|
||||
public static Xoa_url Exec_url(Xog_win_itm win, String href_str) {
|
||||
Xog_url_wkr url_wkr = new Xog_url_wkr();
|
||||
url_wkr.Parse(win, href_str);
|
||||
return url_wkr.Exec();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
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.guis.urls.url_macros; import gplx.*; import gplx.xowa.*; import gplx.xowa.guis.*; import gplx.xowa.guis.urls.*;
|
||||
import gplx.core.btries.*;
|
||||
public class Xog_url_macro_grp implements GfoInvkAble {
|
||||
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_u8(abrv), Bry_.new_u8(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"));
|
||||
else if (ctx.Match(k, Invk_del)) Del(m.ReadBry("abrv"));
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
return this;
|
||||
}
|
||||
private static final String Invk_clear = "clear", Invk_set = "set", Invk_del = "del";
|
||||
}
|
||||
class Xog_url_macro_itm {
|
||||
private Bry_fmtr fmtr;
|
||||
public Xog_url_macro_itm(byte[] abrv, byte[] fmt) {this.abrv = abrv; this.fmt = fmt;}
|
||||
public byte[] Abrv() {return abrv;} private byte[] abrv;
|
||||
public byte[] Fmt() {return fmt;} private byte[] fmt;
|
||||
public byte[] Fmtr_exec(Bry_bfr bfr, Object... args) {
|
||||
if (fmtr == null) fmtr = new Bry_fmtr().Fmt_(fmt).Compile();
|
||||
fmtr.Bld_bfr_many(bfr, args);
|
||||
return bfr.To_bry_and_clear();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
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.guis.urls.url_macros; import gplx.*; import gplx.xowa.*; import gplx.xowa.guis.*; import gplx.xowa.guis.urls.*;
|
||||
public class Xog_url_macro_mgr {
|
||||
private Bry_bfr bfr = Bry_bfr.reset_(255);
|
||||
public Xog_url_macro_mgr() {
|
||||
this.Init();
|
||||
}
|
||||
public void Lang_default_(byte[] v) {lang_default = v;} private byte[] lang_default = Bry_.new_a7("en");
|
||||
public Xog_url_macro_grp Types_mgr() {return types_mgr;} private Xog_url_macro_grp types_mgr = new Xog_url_macro_grp();
|
||||
public Xog_url_macro_grp Custom_mgr() {return custom_mgr;} private Xog_url_macro_grp custom_mgr = new Xog_url_macro_grp();
|
||||
public byte[] Fmt_or_null(byte[] raw) {
|
||||
int raw_len = raw.length;
|
||||
int dot_pos = -1;
|
||||
for (int i = 0; i < raw_len; i++) {
|
||||
byte b = raw[i];
|
||||
switch (b) {
|
||||
case Byte_ascii.Dot:
|
||||
dot_pos = i;
|
||||
break;
|
||||
case Byte_ascii.Colon:
|
||||
return Fmt_or_null__type(raw, raw_len, dot_pos, i);
|
||||
}
|
||||
}
|
||||
return Unhandled;
|
||||
}
|
||||
private byte[] Fmt_or_null__type(byte[] raw, int raw_len, int dot_pos, int colon_pos) {
|
||||
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().Match_exact(raw, 0, type_end); // match entire prefix
|
||||
if (custom_obj == null) {
|
||||
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;
|
||||
return type_itm.Fmtr_exec(bfr, lang_bry, Bry_.Mid(raw, colon_pos + 1, raw_len));
|
||||
}
|
||||
else {
|
||||
Xog_url_macro_itm custom_itm = (Xog_url_macro_itm)custom_obj;
|
||||
return custom_itm.Fmtr_exec(bfr, Bry_.Mid(raw, colon_pos + 1, raw_len));
|
||||
}
|
||||
}
|
||||
private void Init() {
|
||||
types_mgr.Set("w" , "~{0}.wikipedia.org/wiki/~{1}");
|
||||
types_mgr.Set("d" , "~{0}.wiktionary.org/wiki/~{1}");
|
||||
types_mgr.Set("s" , "~{0}.wikisource.org/wiki/~{1}");
|
||||
types_mgr.Set("v" , "~{0}.wikivoyage.org/wiki/~{1}");
|
||||
types_mgr.Set("q" , "~{0}.wikiquote.org/wiki/~{1}");
|
||||
types_mgr.Set("b" , "~{0}.wikibooks.org/wiki/~{1}");
|
||||
types_mgr.Set("u" , "~{0}.wikiversity.org/wiki/~{1}");
|
||||
types_mgr.Set("n" , "~{0}.wikinews.org/wiki/~{1}");
|
||||
types_mgr.Set("a" , "~{0}.wikia.com/wiki/~{1}");
|
||||
types_mgr.Set("m" , "~{0}.wikimedia.com/wiki/~{1}");
|
||||
custom_mgr.Set("c" , "commons.wikimedia.org/wiki/~{0}");
|
||||
custom_mgr.Set("wd" , "www.wikidata.org/wiki/~{0}");
|
||||
custom_mgr.Set("wd.q" , "www.wikidata.org/wiki/Q~{0}");
|
||||
custom_mgr.Set("wd.p" , "www.wikidata.org/wiki/Property:P~{0}");
|
||||
custom_mgr.Set("sp" , "wikispecies.wikimedia.org/wiki/~{0}");
|
||||
custom_mgr.Set("meta" , "meta.wikimedia.org/wiki/~{0}");
|
||||
custom_mgr.Set("s.w" , "simple.wikipedia.org/wiki/~{0}");
|
||||
custom_mgr.Set("s.d" , "simple.wiktionary.org/wiki/~{0}");
|
||||
custom_mgr.Set("s.b" , "simple.wikibooks.org/wiki/~{0}");
|
||||
custom_mgr.Set("s.q" , "simple.wikiquote.org/wiki/~{0}");
|
||||
custom_mgr.Set("?" , "Special:Search/~{0}?fulltext=y");
|
||||
}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_lang_default)) return String_.new_u8(lang_default);
|
||||
else if (ctx.Match(k, Invk_lang_default_)) lang_default = m.ReadBry("v");
|
||||
else if (ctx.Match(k, Invk_types)) return types_mgr;
|
||||
else if (ctx.Match(k, Invk_custom)) return custom_mgr;
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
return this;
|
||||
}
|
||||
private static final String Invk_lang_default = "lang_default", Invk_lang_default_ = "lang_default_", Invk_types = "types", Invk_custom = "custom";
|
||||
public static final byte[] Unhandled = null;
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
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.guis.urls.url_macros; import gplx.*; import gplx.xowa.*; import gplx.xowa.guis.*; import gplx.xowa.guis.urls.*;
|
||||
import org.junit.*;
|
||||
public class Xog_url_macro_mgr_tst {
|
||||
@Before public void init() {fxt.Clear();} private Xog_url_macro_mgr_fxt fxt = new Xog_url_macro_mgr_fxt();
|
||||
@Test public void Custom_basic() {fxt.Test("?:Page" , "Special:Search/Page?fulltext=y");}
|
||||
@Test public void Type_basic() {fxt.Test("en.w:Page" , "en.wikipedia.org/wiki/Page");}
|
||||
@Test public void Type_main() {fxt.Test("en.w:" , "en.wikipedia.org/wiki/");}
|
||||
@Test public void Type_tid() {fxt.Test("w:Page" , "en.wikipedia.org/wiki/Page");}
|
||||
@Test public void Type_lang() {fxt.Test("fr.w:Page" , "fr.wikipedia.org/wiki/Page");}
|
||||
@Test public void Type_unhandled() {fxt.Test("x:A" , null);}
|
||||
@Test public void Type_unhandled_ns() {fxt.Test("Help:A" , null);}
|
||||
@Test public void Type_custom() {fxt.Test("wd.q:123" , "www.wikidata.org/wiki/Q123");}
|
||||
@Test public void Type_del() {
|
||||
fxt.Test("w:A", "en.wikipedia.org/wiki/A");
|
||||
fxt.Abrv_mgr().Types_mgr().Del(Bry_.new_a7("w"));
|
||||
fxt.Test("w:A", null);
|
||||
}
|
||||
@Test public void Type_set() {
|
||||
fxt.Abrv_mgr().Types_mgr().Set("w", "~{0}.~{1}");
|
||||
fxt.Test("w.A", null);
|
||||
}
|
||||
@Test public void Lang_default() {
|
||||
fxt.Abrv_mgr().Lang_default_(Bry_.new_a7("fr"));
|
||||
fxt.Test("w:Page", "fr.wikipedia.org/wiki/Page");
|
||||
}
|
||||
@Test public void Precedence() { // PURPOSE: Custom should take precedence over type
|
||||
fxt.Abrv_mgr().Custom_mgr().Set("w", "custom:~{0}");
|
||||
fxt.Test("w:Page" , "custom:Page");
|
||||
}
|
||||
}
|
||||
class Xog_url_macro_mgr_fxt {
|
||||
public void Clear() {
|
||||
abrv_mgr = new Xog_url_macro_mgr();
|
||||
}
|
||||
public Xog_url_macro_mgr Abrv_mgr() {return abrv_mgr;} private Xog_url_macro_mgr abrv_mgr;
|
||||
public void Test(String raw, String expd) {
|
||||
Tfds.Eq(expd, String_.new_a7(abrv_mgr.Fmt_or_null(Bry_.new_a7(raw))));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user