Example #1
0
 @Override
 public void Func_evaluate(Bry_bfr bfr, Xop_ctx ctx, Xot_invk caller, Xot_invk self, byte[] src) {
   byte[] user_name = Eval_argx(ctx, src, caller, self);
   byte[] when_m = Bry_.Empty, when_f = Bry_.Empty, when_u = Bry_.Empty;
   int self_args_len = self.Args_len();
   if (self_args_len == 0) return; // per MW: EX: {{gender:name}} -> ""
   else {
     if (self_args_len > 0) {
       when_m =
           when_u =
               Pf_func_.Eval_arg_or_empty(
                   ctx, src, caller, self, self_args_len, 0); // default when_u to when_m
       if (self_args_len > 1) {
         when_f = Pf_func_.Eval_arg_or_empty(ctx, src, caller, self, self_args_len, 1);
         if (self_args_len > 2) {
           when_u = Pf_func_.Eval_arg_or_empty(ctx, src, caller, self, self_args_len, 2);
         }
       }
     }
   }
   if (self_args_len == 1) {
     bfr.Add(when_m);
     return;
   } // per MW: EX: {{gender:name|a}} -> "a"
   int gender = Get_gender(ctx.App().User(), user_name);
   Xol_lang_itm lang = ctx.Page().Lang();
   bfr.Add(lang.Gender().Gender_eval(gender, when_m, when_f, when_u));
 }
Example #2
0
 public void Special__gen(Xow_wiki wikii, Xoa_page pagei, Xoa_url url, Xoa_ttl ttl) {
   Xowe_wiki wiki = (Xowe_wiki) wikii;
   Xoae_page page = (Xoae_page) pagei;
   Xoa_app app = wiki.App();
   Dbui_tbl_itm__bmk ui_tbl =
       Dbui_tbl_itm__bmk.get_or_new(app, app.User().User_db_mgr().Bmk_mgr().Tbl__itm());
   page.Html_data().Head_mgr().Itm__dbui().Init(app).Enabled_y_();
   Bry_bfr bfr = wiki.Utl__bfr_mkr().Get_m001();
   ui_tbl.Select(bfr, Xoud_bmk_mgr.Owner_root);
   page.Db().Html().Html_bry_(bfr.To_bry_and_rls());
 }