mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
'v3.4.3.1'
This commit is contained in:
@@ -36,7 +36,7 @@ public class Pfunc_ifexist_mgr {
|
||||
boolean rv = false;
|
||||
switch (ttl_ns.Id()) {
|
||||
case Xow_ns_.Tid__special: rv = true; break; // NOTE: some pages call for [[Special]]; always return true for now; DATE:2014-07-17
|
||||
case Xow_ns_.Tid__media: rv = Find_ttl_for_media_ns(exists_itm, wiki, ttl_ns, ttl_bry); break;
|
||||
case Xow_ns_.Tid__media: rv = Find_ttl_for_media_ns(exists_itm, wiki, ttl_ns, ttl_bry); break;
|
||||
default: rv = Find_ttl_in_db(exists_itm, wiki, ttl_ns, ttl_bry); break;
|
||||
}
|
||||
exists_itm.Exists_(rv);
|
||||
|
||||
@@ -49,5 +49,5 @@ public class Pfunc_displaytitle extends Pf_func_base {
|
||||
byte[] rv = case_mgr.Case_build_lower(val); // lower-case
|
||||
return Bry_.Replace(rv, Byte_ascii.Space, Byte_ascii.Underline); // force underline; PAGE:de.w:Mod_qos DATE:2014-11-06
|
||||
}
|
||||
public static final Pfunc_displaytitle Instance = new Pfunc_displaytitle(); Pfunc_displaytitle() {}
|
||||
public static final Pfunc_displaytitle Instance = new Pfunc_displaytitle(); Pfunc_displaytitle() {}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class Pfunc_urlfunc extends Pf_func_base { // EX: {{lc:A}} -> a
|
||||
Bry_bfr tmp_bfr = ctx.App().Utl__bfr_mkr().Get_b512().Mkr_rls();
|
||||
switch (tid) {
|
||||
case Tid_local: tmp_bfr.Add(ctx.Wiki().Props().ArticlePath());break;
|
||||
case Tid_full: tmp_bfr.Add(Bry_relative_url).Add(ctx.Wiki().Props().ServerName()).Add(ctx.Wiki().Props().ArticlePath()); break;
|
||||
case Tid_full: tmp_bfr.Add(Bry_relative_url).Add(ctx.Wiki().Props().Server_name()).Add(ctx.Wiki().Props().ArticlePath()); break;
|
||||
case Tid_canonical: tmp_bfr.Add(ctx.Wiki().Props().Server()).Add(ctx.Wiki().Props().ArticlePath()); break;
|
||||
default: throw Err_.new_unhandled(tid);
|
||||
}
|
||||
@@ -58,7 +58,7 @@ public class Pfunc_urlfunc extends Pf_func_base { // EX: {{lc:A}} -> a
|
||||
@Override public int Id() {return id;} private int id;
|
||||
@Override public Pf_func New(int id, byte[] name) {return new Pfunc_urlfunc(id, tid, encode).Name_(name);}
|
||||
public static final byte Tid_local = 0, Tid_full = 1, Tid_canonical = 2;
|
||||
public static final byte[] Bry_relative_url = Bry_.new_a7("//");
|
||||
public static final byte[] Bry_relative_url = Bry_.new_a7("//");
|
||||
}
|
||||
/*
|
||||
NOTE: Both fullurle: and localurle: performed additional character escaping on the resulting link, but no example is known where that still has any additional effect.
|
||||
|
||||
@@ -18,15 +18,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.xtns.pfuncs.ttls; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import org.junit.*;
|
||||
public class Pfunc_urlfunc_tst {
|
||||
private final Xop_fxt fxt = new Xop_fxt();
|
||||
private final Xop_fxt fxt = new Xop_fxt();
|
||||
@Before public void init() {fxt.Reset();}
|
||||
@Test public void Localurl() {fxt.Test_parse_tmpl_str_test("{{localurl:a&b! c}}" , "{{test}}", "/wiki/A%26b!_c");}
|
||||
@Test public void Fullurl() {fxt.Test_parse_tmpl_str_test("{{fullurl:a&b! c}}" , "{{test}}", "//en.wikipedia.org/wiki/A%26b!_c");}
|
||||
@Test public void Canonicalurl() {fxt.Test_parse_tmpl_str_test("{{canonicalurl:a&b! c}}" , "{{test}}", "http://en.wikipedia.org/wiki/A%26b!_c");}
|
||||
@Test public void Canonicalurl_case() {fxt.Test_parse_tmpl_str_test("{{CANONICALURL:a&b! c}}" , "{{test}}", "http://en.wikipedia.org/wiki/A%26b!_c");}
|
||||
@Test public void Localurle() {fxt.Test_parse_tmpl_str_test("{{localurle:a&b! c}}" , "{{test}}", "/wiki/A%26b!_c");}
|
||||
@Test public void Canonicalurl() {fxt.Test_parse_tmpl_str_test("{{canonicalurl:a&b! c}}" , "{{test}}", "https://en.wikipedia.org/wiki/A%26b!_c");}
|
||||
@Test public void Canonicalurl_case() {fxt.Test_parse_tmpl_str_test("{{CANONICALURL:a&b! c}}" , "{{test}}", "https://en.wikipedia.org/wiki/A%26b!_c");}
|
||||
@Test public void Localurle() {fxt.Test_parse_tmpl_str_test("{{localurle:a&b! c}}" , "{{test}}", "/wiki/A%26b!_c");}
|
||||
@Test public void Fullurle() {fxt.Test_parse_tmpl_str_test("{{fullurle:a&b! c}}" , "{{test}}", "//en.wikipedia.org/wiki/A%26b!_c");}
|
||||
@Test public void Canonicalurle() {fxt.Test_parse_tmpl_str_test("{{canonicalurle:a&b! c}}" , "{{test}}", "http://en.wikipedia.org/wiki/A%26b!_c");}
|
||||
@Test public void Canonicalurle() {fxt.Test_parse_tmpl_str_test("{{canonicalurle:a&b! c}}" , "{{test}}", "https://en.wikipedia.org/wiki/A%26b!_c");}
|
||||
@Test public void Fullurl_arg() {fxt.Test_parse_tmpl_str_test("{{fullurle:a&b! c|action=edit}}" , "{{test}}", "//en.wikipedia.org/wiki/A%26b!_c?action=edit");}
|
||||
@Test public void Random() {fxt.Test_parse_tmpl_str_test("{{fullurle:a&b! c|action=edit}}" , "{{test|a|b|c}}", "//en.wikipedia.org/wiki/A%26b!_c?action=edit");}
|
||||
@Test public void Xwiki() {
|
||||
|
||||
@@ -27,7 +27,7 @@ public class Pfunc_wiki_props extends Pf_func_base {
|
||||
switch (id) {
|
||||
case Xol_kwd_grp_.Id_site_sitename: bfr.Add(props.Site_name()); break;
|
||||
case Xol_kwd_grp_.Id_site_server: bfr.Add(props.Server()); break;
|
||||
case Xol_kwd_grp_.Id_site_servername: bfr.Add(props.ServerName()); break;
|
||||
case Xol_kwd_grp_.Id_site_servername: bfr.Add(props.Server_name()); break;
|
||||
case Xol_kwd_grp_.Id_site_articlepath: bfr.Add(props.ArticlePath()); break;
|
||||
case Xol_kwd_grp_.Id_site_scriptpath: bfr.Add(props.ScriptPath()); break;
|
||||
case Xol_kwd_grp_.Id_site_stylepath: bfr.Add(props.StylePath()); break;
|
||||
@@ -38,5 +38,5 @@ public class Pfunc_wiki_props extends Pf_func_base {
|
||||
}
|
||||
}
|
||||
@Override public Pf_func New(int id, byte[] name) {return new Pfunc_wiki_props(id).Name_(name);}
|
||||
public static final Pfunc_wiki_props Instance = new Pfunc_wiki_props(-1);
|
||||
public static final Pfunc_wiki_props Instance = new Pfunc_wiki_props(-1);
|
||||
}
|
||||
|
||||
@@ -18,11 +18,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.xtns.pfuncs.wikis; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import org.junit.*;
|
||||
public class Pfunc_wiki_stats_tst {
|
||||
private final Xop_fxt fxt = new Xop_fxt();
|
||||
private final Xop_fxt fxt = new Xop_fxt();
|
||||
@Before public void setup() {fxt.Reset();}
|
||||
@Test public void SiteName() {fxt.Test_parse_tmpl_str_test("{{SITENAME}}" , "{{test}}", "Wikipedia");}
|
||||
@Test public void ServerName() {fxt.Test_parse_tmpl_str_test("{{SERVERNAME}}" , "{{test}}", "en.wikipedia.org");}
|
||||
@Test public void Server() {fxt.Test_parse_tmpl_str_test("{{SERVER}}" , "{{test}}", "http://en.wikipedia.org");}
|
||||
@Test public void Server() {fxt.Test_parse_tmpl_str_test("{{SERVER}}" , "{{test}}", "https://en.wikipedia.org");}
|
||||
@Test public void ArticlePath() {fxt.Test_parse_tmpl_str_test("{{ARTICLEPATH}}" , "{{test}}", "/wiki/");} // FUTURE: should be /wiki/$1
|
||||
@Test public void ScriptPath() {fxt.Test_parse_tmpl_str_test("{{SCRIPTPATH}}" , "{{test}}", "/wiki");}
|
||||
@Test public void StylePath() {fxt.Test_parse_tmpl_str_test("{{STYLEPATH}}" , "{{test}}", "/wiki/skins");}
|
||||
|
||||
Reference in New Issue
Block a user