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
2016-02-01 00:06:50 -05:00
parent 52c36aa4f8
commit 6d179ca59d
52 changed files with 505 additions and 253 deletions

View File

@@ -29,12 +29,14 @@ public class Map_dd2dms_func extends Pf_func_base {
Bry_bfr tmp_bfr = ctx.Wiki().Utl__bfr_mkr().Get_b128();
byte[] plus = Bry_.Empty, minus = Bry_.Empty;
int prec = 4;
Xop_func_arg_itm func_arg = new Xop_func_arg_itm();
for (int i = 0; i < args_len; i++) {
Arg_nde_tkn arg = self.Args_get_by_idx(i);
byte[] key = Pf_func_.Eval_tkn(tmp_bfr, ctx, src, caller, arg.Key_tkn());
Arg_nde_tkn arg = self.Args_get_by_idx(i);
func_arg.Set(tmp_bfr, ctx, src, caller, self, arg);
byte[] key = func_arg.key;
Object key_tid_obj = Key_hash.Get_by(key);
if (key_tid_obj != null) {
byte[] val = Pf_func_.Eval_tkn(tmp_bfr, ctx, src, caller, arg.Val_tkn());
byte[] val = func_arg.val;
switch (((Byte_obj_val)key_tid_obj).Val()) {
case Key_tid_plus: plus = val; break;
case Key_tid_minus: minus = val; break;

View File

@@ -22,4 +22,5 @@ public class Map_dd2dms_func_tst {
@Test public void Example() {fxt.Test_parse_tmpl_str_test("{{#dd2dms: 14.58|precision=4}}" , "{{test}}" , "14° 34' 48&quot;");}
@Test public void Plus() {fxt.Test_parse_tmpl_str_test("{{#dd2dms: 14.58|precision=4|plus=pos}}" , "{{test}}" , "14° 34' 48&quot; pos");}
@Test public void Ws() {fxt.Test_parse_tmpl_str_test("{{#dd2dms: 14.58| precision = 4 | plus = pos }}" , "{{test}}" , "14° 34' 48&quot; pos");}
@Test public void Nested_pfunc() {fxt.Test_parse_tmpl_str_test("{{#dd2dms: 14.58|{{#if:2|precision=2}}}}" , "{{test|3}}" , "14° 34'");} // handle "{{#if:2|precision=2}}" -> "precision=2"
}

View File

@@ -29,13 +29,15 @@ public class Map_geolink_func extends Pf_func_base {
int args_len = self.Args_len();
Bry_bfr tmp_bfr = ctx.Wiki().Utl__bfr_mkr().Get_b128();
try {
Xop_func_arg_itm func_arg = new Xop_func_arg_itm();
byte[] pattern = Eval_argx(ctx, src, caller, self);
for (int i = 0; i < args_len; i++) {
Arg_nde_tkn arg = self.Args_get_by_idx(i);
byte[] key = Pf_func_.Eval_tkn(tmp_bfr, ctx, src, caller, arg.Key_tkn());
func_arg.Set(tmp_bfr, ctx, src, caller, self, arg);;
byte[] key = func_arg.key;
Object key_tid_obj = Key_hash.Get_by(key);
if (key_tid_obj != null) {
byte[] val = Pf_func_.Eval_tkn(tmp_bfr, ctx, src, caller, arg.Val_tkn());
byte[] val = func_arg.val;
switch (((Byte_obj_val)key_tid_obj).Val()) {
case Key_tid_lat_val: mer_x_val = val; break;
case Key_tid_long_val: mer_y_val = val; break;