mirror of
https://github.com/gnosygnu/xowa.git
synced 2024-10-27 20:34:16 +00:00
ParserFunctions: Handle spaces in {{int}} keys [#817]
This commit is contained in:
parent
845253af79
commit
b1c52aa2b2
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
XOWA: the XOWA Offline Wiki Application
|
XOWA: the XOWA Offline Wiki Application
|
||||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
Copyright (C) 2012-2020 gnosygnu@gmail.com
|
||||||
|
|
||||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||||
or alternatively under the terms of the Apache License Version 2.0.
|
or alternatively under the terms of the Apache License Version 2.0.
|
||||||
@ -13,15 +13,27 @@ The terms of each license can be found in the source code repository:
|
|||||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||||
*/
|
*/
|
||||||
package gplx.xowa.xtns.pfuncs.langs; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
package gplx.xowa.xtns.pfuncs.langs;
|
||||||
import gplx.langs.phps.*;
|
|
||||||
import gplx.xowa.langs.*; import gplx.xowa.langs.kwds.*; import gplx.xowa.langs.msgs.*;
|
import gplx.Bry_;
|
||||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
|
import gplx.Bry_bfr;
|
||||||
|
import gplx.xowa.Xoa_ttl;
|
||||||
|
import gplx.xowa.Xowe_wiki;
|
||||||
|
import gplx.xowa.langs.Xol_lang_itm;
|
||||||
|
import gplx.xowa.langs.kwds.Xol_kwd_grp_;
|
||||||
|
import gplx.xowa.langs.msgs.Xol_msg_mgr_;
|
||||||
|
import gplx.xowa.parsers.Xop_ctx;
|
||||||
|
import gplx.xowa.parsers.tmpls.Xot_invk;
|
||||||
|
import gplx.xowa.xtns.pfuncs.Pf_func;
|
||||||
|
import gplx.xowa.xtns.pfuncs.Pf_func_;
|
||||||
|
import gplx.xowa.xtns.pfuncs.Pf_func_base;
|
||||||
|
|
||||||
public class Pfunc_int extends Pf_func_base {
|
public class Pfunc_int extends Pf_func_base {
|
||||||
@Override public int Id() {return Xol_kwd_grp_.Id_i18n_int;}
|
@Override public int Id() {return Xol_kwd_grp_.Id_i18n_int;}
|
||||||
@Override public boolean Func_require_colon_arg() {return true;}
|
@Override public boolean Func_require_colon_arg() {return true;}
|
||||||
@Override public void Func_evaluate(Bry_bfr bfr, Xop_ctx ctx, Xot_invk caller, Xot_invk self, byte[] src) {
|
@Override public void Func_evaluate(Bry_bfr bfr, Xop_ctx ctx, Xot_invk caller, Xot_invk self, byte[] src) {
|
||||||
byte[] msg_key = Eval_argx(ctx, src, caller, self);
|
byte[] msg_key = Eval_argx(ctx, src, caller, self);
|
||||||
|
msg_key = Xoa_ttl.Replace_spaces(msg_key); // 2020-11-02|ISSUE#:817|handle keys with spaces
|
||||||
Xowe_wiki wiki = ctx.Wiki();
|
Xowe_wiki wiki = ctx.Wiki();
|
||||||
Xol_lang_itm page_lang = ctx.Page().Lang();
|
Xol_lang_itm page_lang = ctx.Page().Lang();
|
||||||
byte[][] args_ary = Bry_.Ary_empty;
|
byte[][] args_ary = Bry_.Ary_empty;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
XOWA: the XOWA Offline Wiki Application
|
XOWA: the XOWA Offline Wiki Application
|
||||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
Copyright (C) 2012-2020 gnosygnu@gmail.com
|
||||||
|
|
||||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||||
or alternatively under the terms of the Apache License Version 2.0.
|
or alternatively under the terms of the Apache License Version 2.0.
|
||||||
@ -13,8 +13,16 @@ The terms of each license can be found in the source code repository:
|
|||||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||||
*/
|
*/
|
||||||
package gplx.xowa.xtns.pfuncs.langs; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
package gplx.xowa.xtns.pfuncs.langs;
|
||||||
import org.junit.*; import gplx.xowa.langs.*; import gplx.xowa.langs.msgs.*;
|
|
||||||
|
import gplx.Bry_;
|
||||||
|
import gplx.xowa.Xop_fxt;
|
||||||
|
import gplx.xowa.Xowe_wiki;
|
||||||
|
import gplx.xowa.langs.Xol_lang_itm;
|
||||||
|
import gplx.xowa.langs.msgs.Xol_msg_itm;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
public class Pfunc_int_tst {
|
public class Pfunc_int_tst {
|
||||||
@Before public void init() {fxt.Reset();} private Pf_msg_mgr_fxt fxt = new Pf_msg_mgr_fxt();
|
@Before public void init() {fxt.Reset();} private Pf_msg_mgr_fxt fxt = new Pf_msg_mgr_fxt();
|
||||||
@Test public void Basic() {fxt.Test_parse_en("{{int:january}}" , "January");}
|
@Test public void Basic() {fxt.Test_parse_en("{{int:january}}" , "January");}
|
||||||
@ -76,6 +84,10 @@ public class Pfunc_int_tst {
|
|||||||
fxt.Test_parse_en("{{int:wiki_only_msg}}", "en_gfs_msg");
|
fxt.Test_parse_en("{{int:wiki_only_msg}}", "en_gfs_msg");
|
||||||
fxt.Test_parse_wiki(enwiktionary, "{{int:wiki_only_msg}}", "enwiktionary_msg");
|
fxt.Test_parse_wiki(enwiktionary, "{{int:wiki_only_msg}}", "enwiktionary_msg");
|
||||||
}
|
}
|
||||||
|
@Test public void KeyHasSpace() {// 2020-11-02|ISSUE#:817|handle keys with spaces
|
||||||
|
fxt.Init_msg_gfs("tst_msg", "{{#expr:1}}", false, true);
|
||||||
|
fxt.Test_parse_en("{{int:tst msg}}", "1");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
class Pf_msg_mgr_fxt {
|
class Pf_msg_mgr_fxt {
|
||||||
private Xop_fxt fxt;
|
private Xop_fxt fxt;
|
||||||
@ -109,4 +121,3 @@ class Pf_msg_mgr_fxt {
|
|||||||
fxt.Page().Lang_(en_lang); // NOTE: must reset back to en_lang, else rest of tests will look up under fr
|
fxt.Page().Lang_(en_lang); // NOTE: must reset back to en_lang, else rest of tests will look up under fr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4869,6 +4869,7 @@ apihelp-wbsetdescription-param-language|Lingua della descrizione
|
|||||||
apihelp-wbsetdescription-param-value|Il valore da impostare per la descrizione
|
apihelp-wbsetdescription-param-value|Il valore da impostare per la descrizione
|
||||||
apihelp-wbsetlabel-param-language|Lingua dell'etichetta
|
apihelp-wbsetlabel-param-language|Lingua dell'etichetta
|
||||||
apihelp-wbsetlabel-param-value|Il valore dell'etichetta
|
apihelp-wbsetlabel-param-value|Il valore dell'etichetta
|
||||||
|
history_short|Cronologia
|
||||||
']:>
|
']:>
|
||||||
).lang
|
).lang
|
||||||
;
|
;
|
||||||
|
Loading…
Reference in New Issue
Block a user