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-01-03 21:27:38 -05:00
parent 9509363f46
commit 096045614c
647 changed files with 11693 additions and 7648 deletions

View File

@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.xtns; import gplx.*; import gplx.xowa.*;
import gplx.core.primitives.*; import gplx.core.btries.*;
import gplx.xowa.xtns.cite.*; import gplx.xowa.xtns.imaps.*; import gplx.xowa.xtns.relatedSites.*; import gplx.xowa.xtns.proofreadPage.*; import gplx.xowa.xtns.wdatas.*;
import gplx.xowa.xtns.cites.*; import gplx.xowa.xtns.imaps.*; import gplx.xowa.xtns.relatedSites.*; import gplx.xowa.xtns.proofreadPage.*; import gplx.xowa.xtns.wdatas.*;
import gplx.xowa.xtns.insiders.*; import gplx.xowa.xtns.indicators.*;
public class Xow_xtn_mgr implements GfoInvkAble {
private Ordered_hash regy = Ordered_hash_.New_bry();
@@ -45,7 +45,7 @@ public class Xow_xtn_mgr implements GfoInvkAble {
Add(app, new gplx.xowa.xtns.listings.Listing_xtn_mgr());
Add(app, new gplx.xowa.xtns.titleBlacklists.Blacklist_xtn_mgr());
Add(app, new gplx.xowa.xtns.pfuncs.scribunto.Pfunc_xtn_mgr());
Add(app, new gplx.xowa.xtns.graphs.Graph_xtn());
// Add(app, new gplx.xowa.xtns.graphs.Graph_xtn());
return this;
}
public Xow_xtn_mgr Ctor_by_wiki(Xowe_wiki wiki) {

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.xowa.xtns.categoryList; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
import org.junit.*;
public class Xtn_categoryList_nde_tst {
// private Xop_fxt fxt = new Xop_fxt(); String raw_src;
// private final Xop_fxt fxt = new Xop_fxt(); String raw_src;
@Test public void Basic() {
}
}

View File

@@ -15,7 +15,7 @@ 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.xtns.cite; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
package gplx.xowa.xtns.cites; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
public class Cite_xtn_mgr extends Xox_mgr_base {
@Override public byte[] Xtn_key() {return XTN_KEY;} public static final byte[] XTN_KEY = Bry_.new_a7("cite");
// public byte[] Group_default_name() {return group_default_name;} private byte[] group_default_name = Bry_.new_a7("lower-alpha");

View File

@@ -15,7 +15,7 @@ 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.xtns.cite; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
package gplx.xowa.xtns.cites; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
import gplx.core.brys.*; import gplx.core.brys.fmtrs.*; import gplx.core.brys.args.*;
import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.htmls.*;
import gplx.xowa.parsers.*; import gplx.xowa.parsers.xndes.*;
@@ -110,7 +110,7 @@ public class Ref_html_wtr {
}
private static Xoh_ref_list_fmtr grp_list_fmtr = new Xoh_ref_list_fmtr();
}
class Xoh_ref_list_fmtr extends gplx.core.brys.Bfr_arg_base {
class Xoh_ref_list_fmtr implements gplx.core.brys.Bfr_arg {
public void Init(Xowe_wiki wiki, Ref_html_wtr_cfg cfg, Ref_nde itm) {
this.wiki = wiki; this.cfg = cfg; this.itm = itm;
} private Xowe_wiki wiki; private Ref_nde itm; private Ref_html_wtr_cfg cfg;
@@ -124,7 +124,7 @@ class Xoh_ref_list_fmtr extends gplx.core.brys.Bfr_arg_base {
return itm; // no itm has text; TODO:WARN
}
private boolean HasTxt(Ref_nde v) {return v.Body() != null && v.Body().Root_src().length > 0;}
@Override public void Bfr_arg__add(Bry_bfr bfr) {
public void Bfr_arg__add(Bry_bfr bfr) {
int related_len = itm.Related_len();
Bry_fmtr itm_fmtr = cfg.Grp_html_list();
Fmt(itm_fmtr, wiki, bfr, itm);

View File

@@ -15,7 +15,7 @@ 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.xtns.cite; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
package gplx.xowa.xtns.cites; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
import gplx.core.brys.fmtrs.*;
public class Ref_html_wtr_cfg {
public Bry_fmtr Itm_html() {return itm_html;} private Bry_fmtr itm_html; public Ref_html_wtr_cfg Itm_html_(String v) {itm_html = Bry_fmtr.new_(v, "itm_id", "grp_id", "grp_key"); return this;}

View File

@@ -15,7 +15,7 @@ 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.xtns.cite; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
package gplx.xowa.xtns.cites; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
public class Ref_itm_grp {
private List_adp lsts = List_adp_.new_();
public Ref_itm_grp(byte[] grp_name) {this.grp_name = grp_name;}

View File

@@ -15,7 +15,7 @@ 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.xtns.cite; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
package gplx.xowa.xtns.cites; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
public class Ref_itm_lst {
public Ref_itm_lst(byte[] grp_name) {this.grp_name = grp_name;}
byte[] grp_name; int idx_major_last = 0;

View File

@@ -15,7 +15,7 @@ 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.xtns.cite; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
package gplx.xowa.xtns.cites; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
public class Ref_itm_mgr {
private Hash_adp_bry grps = Hash_adp_bry.cs(); // CASE_MATCH:changed from ci; DATE:2014-07-07
private Ref_itm_grp grp_default = new Ref_itm_grp(Bry_.Empty);

View File

@@ -15,7 +15,7 @@ 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.xtns.cite; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
package gplx.xowa.xtns.cites; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
import org.junit.*;
public class Ref_itm_mgr_cfg_tst {
@Before public void init() {fxt.Clear();} private Ref_itm_mgr_cfg_fxt fxt = new Ref_itm_mgr_cfg_fxt();

View File

@@ -15,7 +15,7 @@ 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.xtns.cite; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
package gplx.xowa.xtns.cites; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
import org.junit.*; import gplx.core.tests.*;
public class Ref_itm_mgr_tst {
Ref_itm_mgr_fxt fxt = new Ref_itm_mgr_fxt();

View File

@@ -15,7 +15,7 @@ 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.xtns.cite; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
package gplx.xowa.xtns.cites; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
import gplx.core.primitives.*;
import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.htmls.*;
import gplx.xowa.parsers.*; import gplx.xowa.parsers.xndes.*; import gplx.xowa.parsers.htmls.*;

View File

@@ -15,7 +15,7 @@ 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.xtns.cite; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
package gplx.xowa.xtns.cites; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
import gplx.core.primitives.*;
import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.htmls.*;
import gplx.xowa.parsers.*; import gplx.xowa.parsers.xndes.*; import gplx.xowa.parsers.htmls.*;

View File

@@ -15,10 +15,10 @@ 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.xtns.cite; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
package gplx.xowa.xtns.cites; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
import org.junit.*;
public class References_nde_basic_tst {
@Before public void init() {fxt.Clear_ref_mgr();} private Xop_fxt fxt = new Xop_fxt();
@Before public void init() {fxt.Clear_ref_mgr();} private final Xop_fxt fxt = new Xop_fxt();
@After public void term() {fxt.Init_para_n_();}
@Test public void Basic() {
fxt.Test_parse_page_wiki_str(String_.Concat_lines_nl_skip_last

View File

@@ -15,10 +15,10 @@ 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.xtns.cite; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
package gplx.xowa.xtns.cites; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
import org.junit.*;
public class References_nde_group_tst {
@Before public void init() {fxt.Clear_ref_mgr();} private Xop_fxt fxt = new Xop_fxt();
@Before public void init() {fxt.Clear_ref_mgr();} private final Xop_fxt fxt = new Xop_fxt();
@After public void term() {fxt.Init_para_n_();}
@Test public void Basic() {
fxt.Test_parse_page_wiki_str(String_.Concat_lines_nl_skip_last

View File

@@ -15,10 +15,10 @@ 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.xtns.cite; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
package gplx.xowa.xtns.cites; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
import org.junit.*;
public class References_nde_pre_tst {
@Before public void init() {fxt.Clear_ref_mgr();} private Xop_fxt fxt = new Xop_fxt();
@Before public void init() {fxt.Clear_ref_mgr();} private final Xop_fxt fxt = new Xop_fxt();
@After public void term() {fxt.Init_para_n_();}
@Test public void Pre_ignored() {
fxt.Test_parse_page_wiki_str(String_.Concat_lines_nl_skip_last

View File

@@ -15,10 +15,10 @@ 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.xtns.cite; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
package gplx.xowa.xtns.cites; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
import org.junit.*;
public class References_nde_rare_tst {
@Before public void init() {fxt.Clear_ref_mgr(); fxt.Reset();} private Xop_fxt fxt = new Xop_fxt();
@Before public void init() {fxt.Clear_ref_mgr(); fxt.Reset();} private final Xop_fxt fxt = new Xop_fxt();
@After public void term() {fxt.Init_para_n_();}
@Test public void Recursive() { // PURPOSE: handle recursive situations; EX: ja.w:Kソリューション ; ja.w:Template:cite web; DATE:2014-03-05
fxt.Init_page_create("Template:Recursive", "<ref>{{Recursive}}</ref>");

View File

@@ -142,7 +142,7 @@ class Dpl_itm {
byte[] key_bry = Bry_.Mid(src, fld_bgn, fld_end);
boolean log =
( Known_invalid_keys.Get_by_mid(src, fld_bgn, fld_end) != null // known invalid key; just log it; handles common items like orcer and showcurid
|| Bry_.Has_at_bgn(key_bry, Html_tag_.Comm_bgn) // ignore comment-like keys; EX: <!--category=Ctg_0--> will have key of "<!--category="
|| Bry_.Has_at_bgn(key_bry, Gfh_tag_.Comm_bgn) // ignore comment-like keys; EX: <!--category=Ctg_0--> will have key of "<!--category="
);
String err_msg = String_.Format("dynamic_page_list:unknown_key: page={0} key={1}", String_.new_u8(page_ttl), String_.new_u8(key_bry));
if (log)

View File

@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.xtns.dynamicPageList; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
import gplx.core.primitives.*;
import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.htmls.*;
import gplx.langs.htmls.*; import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.htmls.*;
import gplx.xowa.wikis.dbs.*; import gplx.xowa.wikis.ctgs.*; import gplx.xowa.wikis.data.tbls.*;
import gplx.xowa.parsers.*; import gplx.xowa.parsers.xndes.*; import gplx.xowa.parsers.htmls.*;
public class Dpl_xnde implements Xox_xnde {
@@ -55,13 +55,13 @@ public class Dpl_xnde implements Xox_xnde {
switch (html_mode.Tid()) {
case Dpl_html_data.Tid_list_ul:
case Dpl_html_data.Tid_list_ol:
bfr.Add(Xoh_consts.Space_2).Add(html_mode.Itm_bgn()).Add(Xoh_consts.A_bgn);
bfr.Add(Xoh_consts.Space_2).Add(html_mode.Itm_bgn()).Add(Gfh_bldr_.Bry__a_lhs_w_href);
bfr.Add_str_a7("/wiki/").Add(ttl_page_txt);
bfr.Add(Xoh_consts.A_bgn_lnki_0).Add(ttl_page_txt).Add_byte(Byte_ascii.Quote);
bfr.Add(Gfh_bldr_.Bry__title__nth).Add(ttl_page_txt).Add_byte(Byte_ascii.Quote);
if (itm.No_follow()) bfr.Add(Bry_nofollow);
bfr.Add_byte(Byte_ascii.Gt);
bfr.Add(ttl_page_txt);
bfr.Add(Xoh_consts.A_end).Add(html_mode.Itm_end()).Add_byte_nl();
bfr.Add(Gfh_bldr_.Bry__a_rhs).Add(html_mode.Itm_end()).Add_byte_nl();
break;
default:
break;

View File

@@ -192,7 +192,7 @@ class Dpl_page_mok {
public static Dpl_page_mok new_(int id, String ttl) {return new Dpl_page_mok(id, ttl);}
}
class Dpl_xnde_fxt {
private Xop_fxt fxt = new Xop_fxt();
private final Xop_fxt fxt = new Xop_fxt();
private int next_id;
public void Clear() {
next_id = 100;

View File

@@ -22,7 +22,7 @@ import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
public class Pages_using_pending_changes_func extends Pf_func_base {
@Override public int Id() {return Xol_kwd_grp_.Id_pagesUsingPendingChanges;}
@Override public Pf_func New(int id, byte[] name) {return new Pages_using_pending_changes_func().Name_(name);}
@Override public void Func_evaluate(Xop_ctx ctx, byte[] src, Xot_invk caller, Xot_invk self, Bry_bfr bfr) {
@Override public void Func_evaluate(Bry_bfr bfr, Xop_ctx ctx, Xot_invk caller, Xot_invk self, byte[] src) {
bfr.Add_int_fixed(0, 1);
}
public static final Pages_using_pending_changes_func Instance = new Pages_using_pending_changes_func(); Pages_using_pending_changes_func() {}

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.xowa.xtns.flaggedRevs; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
import org.junit.*; import gplx.xowa.wikis.pages.skins.*;
public class Pages_using_pending_changes_func_tst {
@Before public void init() {fxt.Reset();} private Xop_fxt fxt = new Xop_fxt();
@Before public void init() {fxt.Reset();} private final Xop_fxt fxt = new Xop_fxt();
@Test public void Basic() {
fxt.Test_html_full_str("{{PAGESUSINGPENDINGCHANGES}}", "0");
}

View File

@@ -22,6 +22,6 @@ import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
public class Pending_change_level_func extends Pf_func_base {
@Override public int Id() {return Xol_kwd_grp_.Id_pendingChangeLevel;}
@Override public Pf_func New(int id, byte[] name) {return new Pending_change_level_func().Name_(name);}
@Override public void Func_evaluate(Xop_ctx ctx, byte[] src, Xot_invk caller, Xot_invk self, Bry_bfr bfr) {}// NOOP
@Override public void Func_evaluate(Bry_bfr bfr, Xop_ctx ctx, Xot_invk caller, Xot_invk self, byte[] src) {}// NOOP
public static final Pending_change_level_func Instance = new Pending_change_level_func(); Pending_change_level_func() {}
}

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.xowa.xtns.flaggedRevs; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
import org.junit.*; import gplx.xowa.wikis.pages.skins.*;
public class Pending_change_level_func_tst {
@Before public void init() {fxt.Reset();} private Xop_fxt fxt = new Xop_fxt();
@Before public void init() {fxt.Reset();} private final Xop_fxt fxt = new Xop_fxt();
@Test public void Basic() {
fxt.Test_html_full_str("{{PENDINGCHANGELEVEL}}", "");
}

View File

@@ -20,20 +20,20 @@ import gplx.langs.htmls.*; import gplx.xowa.htmls.core.makes.*;
public interface Gallery_box_w_fmtr_arg extends gplx.core.brys.Bfr_arg {
Gallery_box_w_fmtr_arg Init(int uid, int width);
}
class Gallery_box_w_fmtr_arg__basic extends gplx.core.brys.Bfr_arg_base implements Gallery_box_w_fmtr_arg {
class Gallery_box_w_fmtr_arg__basic implements gplx.core.brys.Bfr_arg, Gallery_box_w_fmtr_arg {
private int width;
public Gallery_box_w_fmtr_arg Init(int uid, int width) {this.width = width; return this;}
@Override public void Bfr_arg__add(Bry_bfr bfr) {
public void Bfr_arg__add(Bry_bfr bfr) {
bfr.Add(Style_bgn);
bfr.Add_int_variable(width);
bfr.Add(Style_end);
}
private static final byte[] Style_bgn = Bry_.new_a7("style=\"width: "), Style_end = Bry_.new_a7("px\"");
private static final byte[] Style_bgn = Bry_.new_a7("style=\"width:"), Style_end = Bry_.new_a7("px;\"");
}
// class Gallery_box_w_fmtr_arg__hdump : gplx.core.brys.Bfr_arg_base, Gallery_box_w_fmtr_arg {
// class Gallery_box_w_fmtr_arg__hdump : gplx.core.brys.Bfr_arg, Gallery_box_w_fmtr_arg {
// private int uid;
// public Gallery_box_w_fmtr_arg Init(int uid, int width) {this.uid = uid; return this;}
// public override void Bfr_arg__add(Bry_bfr bfr) {
// public void Bfr_arg__add(Bry_bfr bfr) {
// bfr.Add(Xoh_make_trie_.Bry__gallery_box_w);
// bfr.Add_int_variable(uid);
// bfr.Add_byte_apos();
@@ -42,20 +42,20 @@ class Gallery_box_w_fmtr_arg__basic extends gplx.core.brys.Bfr_arg_base implemen
interface Gallery_img_pad_fmtr_arg extends gplx.core.brys.Bfr_arg {
Gallery_img_pad_fmtr_arg Init(int uid, int vpad);
}
class Gallery_img_pad_fmtr_arg__basic extends gplx.core.brys.Bfr_arg_base implements Gallery_img_pad_fmtr_arg {
class Gallery_img_pad_fmtr_arg__basic implements gplx.core.brys.Bfr_arg, Gallery_img_pad_fmtr_arg {
private int vpad;
public Gallery_img_pad_fmtr_arg Init(int uid, int vpad) {this.vpad = vpad; return this;}
@Override public void Bfr_arg__add(Bry_bfr bfr) {
public void Bfr_arg__add(Bry_bfr bfr) {
bfr.Add(Style_bgn);
bfr.Add_int_variable(vpad);
bfr.Add(Style_end);
}
private static final byte[] Style_bgn = Bry_.new_a7("style=\"margin:"), Style_end = Bry_.new_a7("px auto;\"");
}
// class Gallery_img_pad_fmtr_arg__hdump : gplx.core.brys.Bfr_arg_base, Gallery_img_pad_fmtr_arg {
// class Gallery_img_pad_fmtr_arg__hdump : gplx.core.brys.Bfr_arg, Gallery_img_pad_fmtr_arg {
// private int uid;
// public Gallery_img_pad_fmtr_arg Init(int uid, int width) {this.uid = uid; return this;}
// public override void Bfr_arg__add(Bry_bfr bfr) {
// public void Bfr_arg__add(Bry_bfr bfr) {
// bfr.Add(Xoh_make_trie_.Bry__gallery_img_pad);
// bfr.Add_int_variable(uid);
// bfr.Add_byte_apos();

View File

@@ -117,60 +117,10 @@ public class Gallery_html_wtr {
);
}
}
byte[] ul_id_atr = Gallery_html_wtr_.Bld_id_atr(tmp_bfr, hctx_is_hdump, Gallery_html_wtr_.Bld_id(tmp_bfr, Gallery_html_wtr_.Id__ul, mgr_elem_id));
itm_bfr.Mkr_rls();
tmp_bfr.Mkr_rls();
int mgr_box_width_max = mgr_box_width_all < mgr_box_width_row ? mgr_box_width_row : mgr_box_width_all;
Gallery_html_wtr_.Mgr_all_fmtr.Bld_bfr_many(bfr, mgr_elem_id, mgr_box_cls, Bfr_arg_.New_bry_fmtr(mgr_box_style, Bfr_arg_.New_int(mgr_box_width_max)), itm_bfr);
}
}
class Gallery_html_wtr_ {
public static final byte[] Cls_packed = Bry_.new_a7(" mw-gallery-packed");
public static final Bry_fmtr
Mgr_all_fmtr = Bry_fmtr.new_(String_.Concat_lines_nl_skip_last
( "<ul id=\"xowa_gallery_ul_~{gallery_id}\" class=\"gallery~{gallery_cls}\" style=\"~{gallery_style}\">~{itm_list}"
, "</ul>"
), "gallery_id", "gallery_cls", "gallery_style", "itm_list"
)
, Mgr_box_style_none = Bry_fmtr.new_()
, Mgr_box_style_max = Bry_fmtr.new_("max-width:~{gallery_width}px; _width:~{gallery_width}px;", "gallery_width")
, Itm_img_fmtr = Bry_fmtr.new_(String_.Concat_lines_nl_skip_last
( ""
, " <li id=\"xowa_gallery_li_~{img_id}\" class=\"gallerybox\" style=\"width:~{itm_box_width}px;\">"
, " <div id=\"xowa_gallery_div1_~{img_id}\" style=\"width:~{itm_box_width}px;\">"
, " <div id=\"xowa_gallery_div2_~{img_id}\" class=\"thumb\" style=\"width:~{itm_div_width}px;\">"
, " <div id=\"xowa_gallery_div3_~{img_id}\" style=\"margin:~{itm_margin}px auto;\">"
, " <a href=\"~{img_href}\" class=\"image\">"
, " <img id=\"xowa_file_img_~{img_id}\" alt=\"~{img_alt}\"~{img_core} />"
, " </a>"
, " </div>"
, " </div>"
, " <div class=\"gallerytext\">~{itm_caption}"
, " </div>"
, " </div>"
, " </li>"
), "itm_box_width", "itm_div_width", "itm_margin", "img_id", "img_ttl", "img_href", "img_core", "itm_caption", "img_alt"
)
, Itm_txt_fmtr = Bry_fmtr.new_(String_.Concat_lines_nl_skip_last
( ""
, " <li id=\"xowa_gallery_li_~{img_id}\" class=\"gallerybox\" style=\"width:~{itm_box_width};\">"
, " <div id=\"xowa_gallery_div1_~{img_id}\" style=\"width:~{itm_box_width};\">"
, " <div id=\"xowa_gallery_div2_~{img_id}\" style=\"~{itm_div_height}\">"
, " ~{itm_text}"
, " </div>"
, " <div class=\"gallerytext\">~{itm_caption}"
, " </div>"
, " </div>"
, " </li>"
), "itm_box_width", "itm_div_height", "itm_text", "itm_caption"
);
public static byte[] Bld_caption(Xowe_wiki wiki, Xop_ctx ctx, Xoh_html_wtr wtr, Xoh_wtr_ctx hctx, Gallery_itm itm) {
byte[] rv = itm.Caption_bry();
if (Bry_.Len_gt_0(rv)) {
Bry_bfr caption_bfr = wiki.Utl__bfr_mkr().Get_k004();
Xop_root_tkn caption_root = itm.Caption_tkn();
wtr.Write_tkn(caption_bfr, ctx, hctx, caption_root.Root_src(), caption_root, Xoh_html_wtr.Sub_idx_null, caption_root);
rv = caption_bfr.To_bry_and_rls();
}
return rv;
Gallery_html_wtr_.Fmtr__ul__nde.Bld_bfr_many(bfr, ul_id_atr, mgr_box_cls, Bfr_arg_.New_bry_fmtr(mgr_box_style, Bfr_arg_.New_int(mgr_box_width_max)), itm_bfr);
}
}

View File

@@ -0,0 +1,90 @@
/*
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.xtns.gallery; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
import gplx.core.brys.fmtrs.*;
import gplx.xowa.parsers.*; import gplx.xowa.htmls.core.htmls.*;
public class Gallery_html_wtr_ {
public static final byte[] Cls_packed = Bry_.new_a7(" mw-gallery-packed");
public static final Bry_fmtr
Fmtr__ul__nde = Bry_fmtr.new_(String_.Concat_lines_nl_skip_last
( "<ul~{id} class=\"gallery~{cls}\" style=\"~{style}\">~{itm_list}"
, "</ul>"
), "id", "cls", "style", "itm_list"
)
, Mgr_box_style_none = Bry_fmtr.new_()
, Mgr_box_style_max = Bry_fmtr.new_("max-width:~{gallery_width}px; _width:~{gallery_width}px;", "gallery_width")
, Itm_img_fmtr = Bry_fmtr.new_(String_.Concat_lines_nl_skip_last
( ""
, " <li id=\"xowa_gallery_li_~{img_id}\" class=\"gallerybox\" style=\"width:~{itm_box_width}px;\">"
, " <div id=\"xowa_gallery_div1_~{img_id}\" style=\"width:~{itm_box_width}px;\">"
, " <div id=\"xowa_gallery_div2_~{img_id}\" class=\"thumb\" style=\"width:~{itm_div_width}px;\">"
, " <div id=\"xowa_gallery_div3_~{img_id}\" style=\"margin:~{itm_margin}px auto;\">"
, " <a href=\"~{img_href}\" class=\"image\">"
, " <img id=\"xoimg_~{img_id}\" alt=\"~{img_alt}\"~{img_core} />"
, " </a>"
, " </div>"
, " </div>"
, " <div class=\"gallerytext\">~{itm_caption}"
, " </div>"
, " </div>"
, " </li>"
), "itm_box_width", "itm_div_width", "itm_margin", "img_id", "img_ttl", "img_href", "img_core", "itm_caption", "img_alt"
)
, Itm_txt_fmtr = Bry_fmtr.new_(String_.Concat_lines_nl_skip_last
( ""
, " <li id=\"xowa_gallery_li_~{img_id}\" class=\"gallerybox\" style=\"width:~{itm_box_width};\">"
, " <div id=\"xowa_gallery_div1_~{img_id}\" style=\"width:~{itm_box_width};\">"
, " <div id=\"xowa_gallery_div2_~{img_id}\" style=\"~{itm_div_height}\">"
, " ~{itm_text}"
, " </div>"
, " <div class=\"gallerytext\">~{itm_caption}"
, " </div>"
, " </div>"
, " </li>"
), "itm_box_width", "itm_div_height", "itm_text", "itm_caption"
);
public static final Bry_fmtr
Fmtr__ul__style = Bry_fmtr.new_( "max-width:~{max_width}px; _width:~{max_width}px;", "max_width")
, Fmtr__ul__cls = Bry_fmtr.new_( "gallery mw-gallery-~{mode}", "mode")
, Fmtr__li__txt = Bry_fmtr.new_( "\n <li class='gallerycaption'>~{caption}</li>", "caption")
, Fmtr__li__img = Bry_fmtr.new_( "\n <li~{li_id} class=\"gallerybox\" ~{itm_box_w}>"
+ "\n <div ~{itm_box_w}>", "li_id", "itm_box_w")
, Fmtr__div1__img = Bry_fmtr.new_( "\n <div class=\"thumb\" style=\"width:~{width}px;\">", "width")
, Fmtr__div1__missing = Bry_fmtr.new_( "\n <div class=\"thumb\" style=\"height:~{height}px;\">~{ttl_text}</div>", "height", "ttl_text")
, itm_div1_fmtr = Bry_fmtr.new_( "\n <div ~{vpad}>\n ", "vpad")
, hdump_box_w_fmtr = Bry_fmtr.new_( "width:~{width}px;", "width")
, hdump_img_pad_fmtr = Bry_fmtr.new_( "margin:~{width}px auto;", "width")
;
public static final byte[]
Id__ul = Bry_.new_a7("xowa_gallery_ul_")
, Id__li = Bry_.new_a7("xowa_gallery_li_")
;
private static final byte[] Id__atr = Bry_.new_a7(" id=\"");
public static byte[] Bld_id(Bry_bfr bfr, byte[] prefix, int id) {return bfr.Add(prefix).Add_int_variable(id).To_bry_and_clear();}
public static byte[] Bld_id_atr(Bry_bfr bfr, boolean hdump, byte[] li_id) {return hdump ? Bry_.Empty : bfr.Add(Id__atr).Add(li_id).Add_byte_quote().To_bry_and_clear();}
public static byte[] Bld_caption(Xowe_wiki wiki, Xop_ctx ctx, Xoh_html_wtr wtr, Xoh_wtr_ctx hctx, Gallery_itm itm) {
byte[] rv = itm.Caption_bry();
if (Bry_.Len_gt_0(rv)) {
Bry_bfr caption_bfr = wiki.Utl__bfr_mkr().Get_k004();
Xop_root_tkn caption_root = itm.Caption_tkn();
wtr.Write_tkn(caption_bfr, ctx, hctx, caption_root.Root_src(), caption_root, Xoh_html_wtr.Sub_idx_null, caption_root);
rv = caption_bfr.To_bry_and_rls();
}
return rv;
}
}

View File

@@ -54,16 +54,16 @@ public class Gallery_itm_parser_tst {
@Test public void Caption_complicated() {
fxt.Test_parse("File:A.png|alt=a|b[[c|d]]e ", fxt.Expd("File:A.png", "b[[c|d]]e", "a"));
}
@Test public void Alt_magic_word_has_arg() { // PURPOSE: img_alt magic_word is of form "alt=$1"; make sure =$1 is stripped for purpose of parser; DATE:2013-09-12
fxt.Init_kwd_set(Xol_kwd_grp_.Id_img_alt, "alt=$1");
fxt.Test_parse("File:A.png|alt=a|b", fxt.Expd("File:A.png", "b", "a"));
}
@Test public void Link_null() { // PURPOSE: null link causes page to fail; EX: ru.w:Гянджа; <gallery>Datei:A.png|link= |</gallery>; DATE:2014-04-11
fxt.Test_parse("File:A.png|link = |b", fxt.Expd("File:A.png", "b", null, null));
}
@Test public void Caption_empty() { // PURPOSE: check that empty ws doesn't break caption (based on Link_null); DATE:2014-04-11
fxt.Test_parse("File:A.png| | | ", fxt.Expd("File:A.png", null, null, null));
}
@Test public void Alt__magic_word_has_arg() { // PURPOSE: img_alt magic_word is of form "alt=$1"; make sure =$1 is stripped for purpose of parser; DATE:2013-09-12
fxt.Init_kwd_set(Xol_kwd_grp_.Id_img_alt, "alt=$1");
fxt.Test_parse("File:A.png|alt=a|b", fxt.Expd("File:A.png", "b", "a"));
}
}
class Gallery_itm_parser_fxt {
private Xoae_app app; private Xowe_wiki wiki;

View File

@@ -62,14 +62,14 @@ public abstract class Gallery_mgr_base {
int gallery_uid = page.Html_data().Xtn_gallery_next_id();
if (itms_per_row > 0) {
int max_width = itms_per_row * (itm_default_w + this.Get_all_padding());
box_style = Fmt_and_add(tmp_bfr, box_style_max_width_fmtr, box_style, max_width);
box_style = Fmt_and_add(tmp_bfr, Gallery_html_wtr_.Fmtr__ul__style, box_style, max_width);
page.Hdump_data().Imgs_add(new Xohd_img_itm__gallery_mgr(gallery_uid, max_width));
}
byte[] box_cls = Fmt_and_add(tmp_bfr, box_cls_fmtr, xnde.Atr_cls(), this.Tid_bry());
byte[] gallery_ul_id = tmp_bfr.Add(box_id_prefix_bry).Add_int_variable(gallery_uid).To_bry_and_clear();
byte[] box_cls = Fmt_and_add(tmp_bfr, Gallery_html_wtr_.Fmtr__ul__cls, xnde.Atr_cls(), this.Tid_bry());
byte[] gallery_ul_id = tmp_bfr.Add(Gallery_html_wtr_.Id__ul).Add_int_variable(gallery_uid).To_bry_and_clear();
Box_hdr_write(bfr, wiki.Appe().Html_mgr().Whitelist_mgr(), src, gallery_ul_id, box_cls, box_style, xnde.Atrs_other(), hctx_is_hdump, gallery_uid);
byte[] box_caption = xnde.Atr_caption();
if (Bry_.Len_gt_0(box_caption)) box_caption_fmtr.Bld_bfr_many(bfr, box_caption);
if (Bry_.Len_gt_0(box_caption)) Gallery_html_wtr_.Fmtr__li__txt.Bld_bfr_many(bfr, box_caption);
Xoae_app app = wiki.Appe(); Xoh_html_wtr html_wtr = wiki.Html_mgr().Html_wtr();
int itm_len = xnde.Itms_len();
@@ -78,7 +78,7 @@ public abstract class Gallery_mgr_base {
}
bfr.Add(box_html_end_bry);
tmp_bfr.Mkr_rls();
} private static final byte[] box_id_prefix_bry = Bry_.new_a7("xowa_gallery_ul_"), itm_id_prefix_bry = Bry_.new_a7("xowa_gallery_li_");
}
public static byte File_found_mode = Bool_.__byte;
public void Write_html_itm(Bry_bfr bfr, Bry_bfr tmp_bfr, Xoae_app app, Xowe_wiki wiki, Xoae_page page, Xop_ctx ctx, Xoh_html_wtr html_wtr, Xoh_wtr_ctx hctx, byte[] src, Gallery_xnde xnde, byte[] gallery_ul_id, int i, Xof_file_itm xfer_itm, boolean hctx_is_hdump) {
Gallery_itm itm = (Gallery_itm)xnde.Itms_get_at(i);
@@ -94,7 +94,8 @@ public abstract class Gallery_mgr_base {
xfer_itm.Html_elem_tid_(Xof_html_elem.Tid_gallery_v2);
}
int img_uid = xfer_itm.Html_uid();
byte[] gallery_li_id = tmp_bfr.Add(itm_id_prefix_bry).Add_int_variable(img_uid).To_bry_and_clear();
byte[] li_id = Gallery_html_wtr_.Bld_id(tmp_bfr, Gallery_html_wtr_.Id__li, img_uid);
byte[] li_id_atr = Gallery_html_wtr_.Bld_id_atr(tmp_bfr, hctx_is_hdump, li_id);
byte[] itm_html = Bry_.Empty;
int html_w_expand = xfer_itm.Html_w();
int html_h_expand = xfer_itm.Html_h();
@@ -107,8 +108,8 @@ public abstract class Gallery_mgr_base {
|| !file_found
)
) { // itm is not a file, or is not found; write text
itm_html = itm_missing_fmtr.Bld_bry_many(tmp_bfr, this.Get_thumb_padding() + itm_default_h, ttl.Page_txt());
itm.Html_prepare(wiki, ctx, src, xnde, xfer_itm, gallery_li_id, i);
itm_html = Gallery_html_wtr_.Fmtr__div1__missing.Bld_bry_many(tmp_bfr, this.Get_thumb_padding() + itm_default_h, ttl.Page_txt());
itm.Html_prepare(wiki, ctx, src, xnde, xfer_itm, li_id, i);
xfer_itm.Html_img_wkr_(itm);
lnki.W_(lnki_w_orig).H_(lnki_h_orig);
html_w_expand = lnki_w_orig; html_h_expand = lnki_h_orig; // reset lnki_w_orig / lnki_h_orig else large captions
@@ -116,8 +117,8 @@ public abstract class Gallery_mgr_base {
else {
byte[] alt = itm.Alt_bgn() == Bry_find_.Not_found && Bry_.Len_eq_0(itm_caption) // if ( $alt == '' && $text == '' ) $imageParameters['alt'] = $nt->getText();
? itm.Ttl().Page_txt()
: Xoh_html_wtr_escaper.Escape(app.Parser_amp_mgr(), tmp_bfr, Bry_.Mid(src, itm.Alt_bgn(), itm.Alt_end()))
;
: Bry_.Mid(src, itm.Alt_bgn(), itm.Alt_end());
alt = Xoh_html_wtr_escaper.Escape(app.Parser_amp_mgr(), tmp_bfr, alt); // NOTE: need to handle situations wherein alt has quotes; EX:File:A"b.png; PAGE:en.w:Alexandria,_Romania DATE:2015-12-27
Xoa_ttl href_ttl = itm.Link_bgn() == Bry_find_.Not_found
? ttl
: Xoa_ttl.parse(wiki, Bry_.Mid(src, itm.Link_bgn(), itm.Link_end()))
@@ -128,11 +129,11 @@ public abstract class Gallery_mgr_base {
int html_h_normal = xfer_itm.Html_h();
xfer_itm.Init_at_gallery_bgn(html_w_normal, html_h_normal, html_w_expand);// NOTE: file_w should be set to expanded width so js can resize if gallery
img_div_w = this.Get_thumb_div_width(html_w_expand);
itm_div0_fmtr.Bld_bfr_many(tmp_bfr, img_div_w);
Gallery_html_wtr_.Fmtr__div1__img.Bld_bfr_many(tmp_bfr, img_div_w);
// Gallery_img_pad_fmtr_arg vpad_fmtr = hctx_is_hdump ? (Gallery_img_pad_fmtr_arg)img_pad_fmtr__hdump : (Gallery_img_pad_fmtr_arg)img_pad_fmtr__basic;
Gallery_img_pad_fmtr_arg vpad_fmtr = img_pad_fmtr__basic;
vpad = this.Get_vpad(itm_default_h, html_h_expand);
itm_div1_fmtr.Bld_bfr_many(tmp_bfr, vpad_fmtr.Init(img_uid, vpad)); // <div style="margin:~{vpad}px auto;">
Gallery_html_wtr_.itm_div1_fmtr.Bld_bfr_many(tmp_bfr, vpad_fmtr.Init(img_uid, vpad)); // <div style="margin:~{vpad}px auto;">
wiki.Html_mgr().Html_wtr().Lnki_wtr().Write_file(tmp_bfr, ctx, hctx, src, lnki, xfer_itm, alt);
tmp_bfr.Add(itm_divs_end_bry);
itm_html = tmp_bfr.To_bry_and_clear();
@@ -148,7 +149,7 @@ public abstract class Gallery_mgr_base {
int itm_div_width = this.Get_gb_width(html_w_expand, html_h_expand);
// Gallery_box_w_fmtr_arg box_w_fmtr_arg = hctx_is_hdump ? (Gallery_box_w_fmtr_arg)box_w_fmtr__hdump : (Gallery_box_w_fmtr_arg)box_w_fmtr__basic;
Gallery_box_w_fmtr_arg box_w_fmtr_arg = box_w_fmtr__basic;
itm_li_bgn_fmtr.Bld_bfr_many(bfr, gallery_li_id, box_w_fmtr_arg.Init(img_uid, itm_div_width));
Gallery_html_wtr_.Fmtr__li__img.Bld_bfr_many(bfr, li_id_atr, box_w_fmtr_arg.Init(img_uid, itm_div_width));
bfr.Add(itm_html);
wiki.Parser_mgr().Main().Parse_text_to_html(tmp_bfr, page, hctx, true, itm_caption);
itm_caption = tmp_bfr.To_bry_and_clear();
@@ -167,19 +168,6 @@ public abstract class Gallery_mgr_base {
lnki.H_(itm_default_h);
}
@gplx.Virtual public void Adjust_image_parameters(Xof_file_itm xfer_itm) {} // REF.MW: Adjust the image parameters for a thumbnail. Used by a subclass to insert extra high resolution images.
public static final Bry_fmtr
box_style_max_width_fmtr = Bry_fmtr.new_( "max-width:~{max_width}px;_width:~{max_width}px;", "max_width") // id=xowa_gallery_ul_1
, box_cls_fmtr = Bry_fmtr.new_( "gallery mw-gallery-~{mode}", "mode")
, box_caption_fmtr = Bry_fmtr.new_( "\n <li class='gallerycaption'>~{caption}</li>", "caption")
, itm_li_bgn_fmtr = Bry_fmtr.new_( "\n <li id=\"~{id}\" class=\"gallerybox\" ~{itm_box_w}>" // id=xowa_gallery_li_1
+ "\n <div ~{itm_box_w}>", "id", "itm_box_w")
, itm_div0_fmtr = Bry_fmtr.new_( "\n <div class=\"thumb\" style=\"width: ~{width}px;\">", "width")
, itm_missing_fmtr = Bry_fmtr.new_( "\n <div class=\"thumb\" style=\"height: ~{height}px;\">~{ttl_text}</div>", "height", "ttl_text")
, itm_div1_fmtr = Bry_fmtr.new_( "\n <div ~{vpad}>\n ", "vpad")
, hdump_box_w_fmtr = Bry_fmtr.new_( "width:~{width}px;", "width")
, hdump_img_pad_fmtr = Bry_fmtr.new_( "margin:~{width}px auto;", "width")
;
private static final byte[]
itm_li_end_bry = Bry_.new_a7 ( "\n </div>"
+ "\n </li>")
@@ -195,9 +183,10 @@ public abstract class Gallery_mgr_base {
return tmp_bfr.To_bry_and_clear();
}
private static void Box_hdr_write(Bry_bfr bfr, Xop_xatr_whitelist_mgr whitelist_mgr, byte[] src, byte[] gallery_ul_uid, byte[] cls, byte[] style, List_adp xatr_list, boolean hctx_is_hdump, int uid) {
bfr.Add_byte(Byte_ascii.Lt).Add(Html_tag_.Bry__ul);
Html_wtr.Write_atr_bry(bfr, Html_atr_.Bry__id, gallery_ul_uid);
Html_wtr.Write_atr_bry(bfr, Html_atr_.Bry__class, cls);
bfr.Add_byte(Byte_ascii.Lt).Add(Gfh_tag_.Bry__ul);
if (!hctx_is_hdump)
Gfh_wtr.Write_atr_bry(bfr, Gfh_atr_.Bry__id, gallery_ul_uid);
Gfh_wtr.Write_atr_bry(bfr, Gfh_atr_.Bry__class, cls);
// if (hctx_is_hdump) {
// bfr.Add_byte_space();
// bfr.Add(Xoh_make_trie_.Bry__gallery_box_max);
@@ -205,7 +194,7 @@ public abstract class Gallery_mgr_base {
// bfr.Add_byte_apos();
// }
// else
Html_wtr.Write_atr_bry(bfr, Html_atr_.Bry__style, style);
Gfh_wtr.Write_atr_bry(bfr, Gfh_atr_.Bry__style, style);
if (xatr_list != null) {
int len = xatr_list.Count();
for (int i = 0; i < len; i++) {
@@ -213,7 +202,7 @@ public abstract class Gallery_mgr_base {
if (!whitelist_mgr.Chk(Xop_xnde_tag_.Tid_ul, src, xatr)) continue;
byte[] key = xatr.Key_bry();
byte[] val = xatr.Val_as_bry();
Html_wtr.Write_atr_bry(bfr, key, val);
Gfh_wtr.Write_atr_bry(bfr, key, val);
}
}
bfr.Add_byte(Byte_ascii.Gt);

View File

@@ -17,11 +17,21 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.xtns.gallery; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
import gplx.core.primitives.*;
class Gallery_mgr_base_ {
public class Gallery_mgr_base_ {
public static byte Get_or_traditional(byte[] bry) {
Byte_obj_val rv = (Byte_obj_val)Hash.Get_by(bry);
return rv == null ? Traditional_tid : rv.Val();
}
public static byte[] Get_bry_by_tid(byte mode) {
switch (mode) {
case Traditional_tid: return Traditional_bry;
case Nolines_tid: return Nolines_bry;
case Packed_tid: return Packed_bry;
case Packed_hover_tid: return Packed_hover_bry;
case Packed_overlay_tid: return Packed_overlay_bry;
default: throw Err_.new_unhandled(mode);
}
}
public static Gallery_mgr_base New_by_mode(byte mode) {
switch (mode) {
default:
@@ -54,7 +64,7 @@ class Gallery_mgr_base_ {
, Packed_hover_bry = Bry_.new_a7("packed-hover")
, Packed_overlay_bry = Bry_.new_a7("packed-overlay")
;
private static final Hash_adp_bry Hash = Hash_adp_bry.ci_a7()
public static final Hash_adp_bry Hash = Hash_adp_bry.ci_a7()
.Add_bry_byte(Traditional_bry , Traditional_tid)
.Add_bry_byte(Nolines_bry , Nolines_tid)
.Add_bry_byte(Packed_bry , Packed_tid)

View File

@@ -29,11 +29,11 @@ public class Gallery_mgr_base_basic_tst {
, "</gallery>"
), String_.Concat_lines_nl_skip_last
( "<ul id=\"xowa_gallery_ul_0\" class=\"gallery mw-gallery-traditional\">"
, " <li id=\"xowa_gallery_li_0\" class=\"gallerybox\" style=\"width: 235px\">"
, " <div style=\"width: 235px\">"
, " <div class=\"thumb\" style=\"width: 230px;\">"
, " <li id=\"xowa_gallery_li_0\" class=\"gallerybox\" style=\"width:235px;\">"
, " <div style=\"width:235px;\">"
, " <div class=\"thumb\" style=\"width:230px;\">"
, " <div style=\"margin:15px auto;\">"
, " <a href=\"/wiki/File:A.png\" class=\"image\" xowa_title=\"A.png\"><img id=\"xowa_file_img_0\" alt=\"\" src=\"file:///mem/wiki/repo/trg/thumb/7/0/A.png/200px.png\" width=\"200\" height=\"300\" /></a>"
, " <a href=\"/wiki/File:A.png\" class=\"image\" xowa_title=\"A.png\"><img id=\"xoimg_0\" alt=\"\" src=\"file:///mem/wiki/repo/trg/thumb/7/0/A.png/200px.png\" width=\"200\" height=\"300\" /></a>"
, " </div>"
, " </div>"
, " <div class=\"gallerytext\"><p><i>a1</i>"
@@ -42,11 +42,11 @@ public class Gallery_mgr_base_basic_tst {
, " </div>"
, " </div>"
, " </li>"
, " <li id=\"xowa_gallery_li_1\" class=\"gallerybox\" style=\"width: 235px\">"
, " <div style=\"width: 235px\">"
, " <div class=\"thumb\" style=\"width: 230px;\">"
, " <li id=\"xowa_gallery_li_1\" class=\"gallerybox\" style=\"width:235px;\">"
, " <div style=\"width:235px;\">"
, " <div class=\"thumb\" style=\"width:230px;\">"
, " <div style=\"margin:15px auto;\">"
, " <a href=\"/wiki/File:B.png\" class=\"image\" xowa_title=\"B.png\"><img id=\"xowa_file_img_1\" alt=\"\" src=\"file:///mem/wiki/repo/trg/thumb/5/7/B.png/200px.png\" width=\"200\" height=\"300\" /></a>"
, " <a href=\"/wiki/File:B.png\" class=\"image\" xowa_title=\"B.png\"><img id=\"xoimg_1\" alt=\"\" src=\"file:///mem/wiki/repo/trg/thumb/5/7/B.png/200px.png\" width=\"200\" height=\"300\" /></a>"
, " </div>"
, " </div>"
, " <div class=\"gallerytext\"><p><i>b1</i>"
@@ -67,7 +67,7 @@ public class Gallery_mgr_base_basic_tst {
fxt.Test_html_frag("<gallery>File:A.png|a{{test_tmpl}}c</gallery>", "<div class=\"gallerytext\"><p>abc\n</p>");
}
@Test public void Itm_defaults_to_120() {
fxt.Test_html_frag("<gallery>File:A.png|a</gallery>", "<img id=\"xowa_file_img_0\" alt=\"\" src=\"file:///mem/wiki/repo/trg/thumb/7/0/A.png/120px.png\" width=\"120\" height=\"120\" />");
fxt.Test_html_frag("<gallery>File:A.png|a</gallery>", "<img id=\"xoimg_0\" alt=\"\" src=\"file:///mem/wiki/repo/trg/thumb/7/0/A.png/120px.png\" width=\"120\" height=\"120\" />");
}
@Test public void Height_fix() {
fxt.Fxt().Wiki().File_mgr().Cfg_set(Xof_fsdb_mgr_cfg.Grp_xowa, Xof_fsdb_mgr_cfg.Key_gallery_fix_defaults, "y");
@@ -76,7 +76,7 @@ public class Gallery_mgr_base_basic_tst {
}
@Test public void Alt() {
fxt.Test_html_frag("<gallery>File:A.png|b|alt=c</gallery>"
, "<img id=\"xowa_file_img_0\" alt=\"c\" src=\"file:///mem/wiki/repo/trg/thumb/7/0/A.png/120px.png\" width=\"120\" height=\"120\" />"
, "<img id=\"xoimg_0\" alt=\"c\" src=\"file:///mem/wiki/repo/trg/thumb/7/0/A.png/120px.png\" width=\"120\" height=\"120\" />"
, "<div class=\"gallerytext\"><p>b\n</p>"
);
}
@@ -99,7 +99,7 @@ public class Gallery_mgr_base_basic_tst {
fxt.Test_html_frag("<gallery>File:A.png</gallery>", "<div class=\"gallerytext\">\n");
}
@Test public void Ttl_has_no_ns() { // PURPOSE: MW allows ttl to not have ns; DATE: 2013-11-18
fxt.Test_html_frag("<gallery>A.png|b</gallery>", "<img id=\"xowa_file_img_0\" alt=\"\" src=\"file:///mem/wiki/repo/trg/thumb/7/0/A.png/120px.png\" width=\"120\" height=\"120\" />"); // make sure image is generated
fxt.Test_html_frag("<gallery>A.png|b</gallery>", "<img id=\"xoimg_0\" alt=\"\" src=\"file:///mem/wiki/repo/trg/thumb/7/0/A.png/120px.png\" width=\"120\" height=\"120\" />"); // make sure image is generated
}
@Test public void Ref() { // PURPOSE: <ref> inside <gallery> was not showing up in <references>; DATE:2013-10-09
fxt.Test_html_frag("<gallery>File:A.png|<ref name='a'>b</ref></gallery><references/>"
@@ -125,7 +125,7 @@ public class Gallery_mgr_base_basic_tst {
}
@Test public void Missing() {
fxt.Init_files_missing_y_();
fxt.Test_html_frag("<gallery>File:A.png|b</gallery>", "<div class=\"thumb\" style=\"height: 150px;\">A.png</div>");
fxt.Test_html_frag("<gallery>File:A.png|b</gallery>", "<div class=\"thumb\" style=\"height:150px;\">A.png</div>");
}
@Test public void Multiple() { // PURPOSE.bug: multiple galleries should not use same gallery super; DATE:2014-04-13
fxt.Test_html_frag("<gallery>File:A.png|a</gallery><gallery widths=180px>File:B.png|b</gallery>"
@@ -148,6 +148,9 @@ public class Gallery_mgr_base_basic_tst {
), "C1" // make sure that image after nested gallery appears
);
}
@Test public void Alt__quotes() { // PURPOSE: file name with quotes will cause broken alt; PAGE:en.w:en.w:Alexandria,_Romania; DATE:2015-12-27
fxt.Test_html_frag("<gallery>File:A\"b.png", "alt=\"A&quot;b.png\""); // NOTE: not 'alt="A"b.png"'
}
// @Test public void Ttl_caption() { // TODO: category entries get rendered with name only (no ns)
// fxt.Test_html_frag
// ( "<gallery>Category:A</gallery>"
@@ -160,7 +163,7 @@ class Gallery_mgr_base_fxt {
fxt.Wiki().Xtn_mgr().Init_by_wiki(fxt.Wiki());
Gallery_mgr_base.File_found_mode = Bool_.Y_byte;
}
public Xop_fxt Fxt() {return fxt;} private Xop_fxt fxt = new Xop_fxt();
public Xop_fxt Fxt() {return fxt;} private final Xop_fxt fxt = new Xop_fxt();
public void Init_files_missing_y_() {
Gallery_mgr_base.File_found_mode = Bool_.N_byte;
}

View File

@@ -30,7 +30,7 @@ public class Gallery_mgr_base_xnde_atrs_tst {
@Test public void Atr_style() { // PURPOSE: combine style with itms_per_row
fxt.Test_html_frag
( "<gallery perrow=2 style='color:blue;'>File:A.png</gallery>"
, "<ul id=\"xowa_gallery_ul_0\" class=\"gallery mw-gallery-traditional\" style=\"max-width:326px;_width:326px; color:blue;\">"
, "<ul id=\"xowa_gallery_ul_0\" class=\"gallery mw-gallery-traditional\" style=\"max-width:326px; _width:326px; color:blue;\">"
);
}
@Test public void Atr_caption() { // PURPOSE: caption atr adds new element

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.xowa.xtns.gallery; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
import org.junit.*; import gplx.core.tests.*; import gplx.xowa.parsers.xndes.*; import gplx.xowa.wikis.ttls.*;
public class Gallery_xnde_tst {
private Xop_fxt fxt = new Xop_fxt(); String raw_src;
private final Xop_fxt fxt = new Xop_fxt(); String raw_src;
@Before public void init() {fxt.Reset(); fxt.Wiki().Xtn_mgr().Init_by_wiki(fxt.Wiki());}
@Test public void Lnki_no_caption() {
fxt.Test_parse_page_wiki("<gallery>File:A.png</gallery>"

View File

@@ -22,7 +22,7 @@ import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
public class Geoc_isin_func extends Pf_func_base {
@Override public int Id() {return Xol_kwd_grp_.Id_geoCrumbs_isin;}
@Override public Pf_func New(int id, byte[] name) {return new Geoc_isin_func().Name_(name);}
@Override public void Func_evaluate(Xop_ctx ctx, byte[] src, Xot_invk caller, Xot_invk self, Bry_bfr bfr) {
@Override public void Func_evaluate(Bry_bfr bfr, Xop_ctx ctx, Xot_invk caller, Xot_invk self, byte[] src) {
byte[] ttl_bry = Eval_argx(ctx, src, caller, self);
Xowe_wiki wiki = ctx.Wiki();
Xoa_ttl ttl = Xoa_ttl.parse(wiki, ttl_bry); if (ttl == null) return;

View File

@@ -24,7 +24,7 @@ public class Geoc_isin_func_tst {
}
}
class Geoc_isin_func_fxt {
private Xop_fxt fxt = new Xop_fxt();
private final Xop_fxt fxt = new Xop_fxt();
public void Reset() {
fxt.Reset();
}

View File

@@ -20,7 +20,7 @@ import gplx.xowa.xtns.pfuncs.*;
import gplx.xowa.langs.*; import gplx.xowa.langs.kwds.*;
import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
public class Geo_coordinates_func extends Pf_func_base {
@Override public void Func_evaluate(Xop_ctx ctx, byte[] src, Xot_invk caller, Xot_invk self, Bry_bfr bfr) {} // NOOP: MW uses to save coordinates for API retrieval
@Override public void Func_evaluate(Bry_bfr bfr, Xop_ctx ctx, Xot_invk caller, Xot_invk self, byte[] src) {} // NOOP: MW uses to save coordinates for API retrieval
@Override public int Id() {return Xol_kwd_grp_.Id_xtn_geodata_coordinates;}
@Override public Pf_func New(int id, byte[] name) {return new Geo_coordinates_func().Name_(name);}
public static final Geo_coordinates_func Instance = new Geo_coordinates_func(); Geo_coordinates_func() {}

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.xowa.xtns.geodata; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
import org.junit.*;
public class Geo_coordinates_func_tst {
private Xop_fxt fxt = new Xop_fxt();
private final Xop_fxt fxt = new Xop_fxt();
@Before public void init() {fxt.Reset();}
@Test public void Basic() {fxt.Test_parse_tmpl_str_test("{{#coordinates:1|2}}" , "{{test}}" , "");}
}

View File

@@ -19,12 +19,9 @@ package gplx.xowa.xtns.graphs; import gplx.*; import gplx.xowa.*; import gplx.xo
import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.htmls.*;
import gplx.xowa.parsers.*; import gplx.xowa.parsers.logs.*; import gplx.xowa.parsers.xndes.*; import gplx.xowa.parsers.htmls.*;
public class Graph_xnde implements Xox_xnde {
private Graph_xtn xtn;
public void Xatr__set(Xowe_wiki wiki, byte[] src, Mwh_atr_itm xatr, Object xatr_id_obj) {}
public void Xtn_parse(Xowe_wiki wiki, Xop_ctx ctx, Xop_root_tkn root, byte[] src, Xop_xnde_tkn xnde) {
ctx.Para().Process_block__xnde(xnde.Tag(), Xop_xnde_tag.Block_bgn);
this.xtn = (Graph_xtn)wiki.Xtn_mgr().Get_or_fail(Graph_xtn.Xtn_key_static);
xtn.Xtn_init_assert(wiki);
ctx.Cur_page().Html_data().Head_mgr().Itm__graph().Enabled_y_();
boolean log_wkr_enabled = Log_wkr != Xop_log_basic_wkr.Null; if (log_wkr_enabled) Log_wkr.Log_end_xnde(ctx.Cur_page(), Xop_log_basic_wkr.Tid_graph, src, xnde);
ctx.Para().Process_block__xnde(xnde.Tag(), Xop_xnde_tag.Block_end);

View File

@@ -1,45 +0,0 @@
/*
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.xtns.graphs; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
import gplx.xowa.wikis.*; import gplx.xowa.htmls.modules.*; import gplx.xowa.apps.fsys.*;
public class Graph_xtn extends Xox_mgr_base implements GfoInvkAble {
@Override public boolean Enabled_default() {return true;}
@Override public byte[] Xtn_key() {return Xtn_key_static;} public static final byte[] Xtn_key_static = Bry_.new_a7("graph");
@Override public Xox_mgr Clone_new() {return new Graph_xtn();}
@Override public void Xtn_init_by_wiki(Xowe_wiki wiki) {}
private boolean xtn_init_done = false;
public void Xtn_init_assert(Xowe_wiki wiki) {
if (xtn_init_done) return;
// if (!Enabled()) return;
// Xoae_app app = wiki.Appe();
// Io_url ext_root_dir = Hiero_root_dir(app.Fsys_mgr());
// Img_src_dir = Bry_.new_u8(ext_root_dir.GenSubDir("img").To_http_file_str());
// app.Gfs_mgr().Run_url_for(this, ext_root_dir.GenSubFil_nest("data", "tables.gfs"));
// html_wtr = new Hiero_html_mgr(this);
// parser.Init();
// xtn_init_done = true;
}
public void Clear() {
// prefab_mgr.Clear();
// file_mgr.Clear();
// phoneme_mgr.Clear();
}
@Override public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
return super.Invk(ctx, ikey, k, m);
}
}

View File

@@ -19,7 +19,6 @@ package gplx.xowa.xtns.hieros; import gplx.*; import gplx.xowa.*; import gplx.xo
import gplx.langs.htmls.*; import gplx.xowa.htmls.core.htmls.*;
class Hiero_html_mgr {
private Bry_bfr html_bfr = Bry_bfr.reset_(Io_mgr.Len_kb), content_bfr = Bry_bfr.reset_(255), tbl_content_bfr = Bry_bfr.reset_(Io_mgr.Len_kb), temp_bfr = Bry_bfr.reset_(255);
private Xoh_wtr_ctx hctx;
private boolean cartouche_opened = false;
public static int scale = 100;
private Hiero_prefab_mgr prefab_mgr; private Hiero_file_mgr file_mgr; private Hiero_phoneme_mgr phoneme_mgr;
@@ -31,7 +30,7 @@ class Hiero_html_mgr {
wtr = new Hiero_html_wtr(this, phoneme_mgr);
}
public void Render_blocks(Bry_bfr final_bfr, Xoh_wtr_ctx hctx, Hiero_block[] blocks, int scale, boolean hr_enabled) {
this.hctx = hctx; wtr.Init_for_write(hctx);
wtr.Init_for_write(hctx);
Hiero_html_mgr.scale = scale;
tbl_content_bfr.Clear(); content_bfr.Clear(); temp_bfr.Clear();
cartouche_opened = false;
@@ -41,9 +40,9 @@ class Hiero_html_mgr {
for (int i = 0; i < blocks_len; i++) {
Hiero_block block = blocks[i];
if (block.Len() == 1)
Render_block_single(content_bfr, hr_enabled, block);
Render_block_single(content_bfr, hctx, hr_enabled, block);
else
Render_block_many(content_bfr, hr_enabled, block);
Render_block_many(content_bfr, hctx, hr_enabled, block);
if (content_bfr.Len_gt_0())
tbl_content_bfr.Add_bfr_and_clear(content_bfr); // $tbl_content = $tbl + $content;
}
@@ -51,7 +50,7 @@ class Hiero_html_mgr {
wtr.Tbl_inner(html_bfr, tbl_content_bfr);
wtr.Tbl_outer(final_bfr, html_bfr);
}
private void Render_block_single(Bry_bfr content_bfr, boolean hr_enabled, Hiero_block block) {
private void Render_block_single(Bry_bfr content_bfr, Xoh_wtr_ctx hctx, boolean hr_enabled, Hiero_block block) {
byte[] code = block.Get_at(0); // block has only one code (hence the proc name: Render_block_single)
byte b_0 = code[0];
switch (b_0) {
@@ -62,7 +61,7 @@ class Hiero_html_mgr {
break;
}
case Byte_ascii.Lt: { // cartouche bgn
wtr.Td(content_bfr, Render_glyph(Tkn_lt));
wtr.Td(content_bfr, Render_glyph(hctx, Tkn_lt));
cartouche_opened = true;
wtr.Cartouche_bgn(content_bfr);
break;
@@ -70,17 +69,17 @@ class Hiero_html_mgr {
case Byte_ascii.Gt: { // cartouche end
wtr.Cartouche_end(content_bfr);
cartouche_opened = false;
wtr.Td(content_bfr, Render_glyph(Tkn_gt));
wtr.Td(content_bfr, Render_glyph(hctx, Tkn_gt));
break;
}
default: { // glyph or '.'
byte[] td_height = wtr.Td_height(Resize_glyph(code, cartouche_opened));
wtr.Td(content_bfr, Render_glyph(code, td_height));
wtr.Td(content_bfr, Render_glyph(hctx, code, td_height));
break;
}
}
}
private void Render_block_many(Bry_bfr content_bfr, boolean hr_enabled, Hiero_block block) {
private void Render_block_many(Bry_bfr content_bfr, Xoh_wtr_ctx hctx, boolean hr_enabled, Hiero_block block) {
temp_bfr.Clear(); // build prefab_bry: "convert all codes into '&' to test prefabs glyph"
int block_len = block.Len();
boolean amp = false;
@@ -106,7 +105,7 @@ class Hiero_html_mgr {
Hiero_prefab_itm prefab_itm = prefab_mgr.Get_by_key(prefab_bry);
if (prefab_itm != null) {
byte[] td_height = wtr.Td_height(Resize_glyph(prefab_bry, cartouche_opened));
wtr.Td(content_bfr, Render_glyph(prefab_bry, td_height));
wtr.Td(content_bfr, Render_glyph(hctx, prefab_bry, td_height));
}
else {
int line_max = 0, total = 0, height = 0; // get block total height
@@ -157,20 +156,19 @@ class Hiero_html_mgr {
}
// resize the glyph according to the block total height
byte[] td_height = wtr.Td_height(Resize_glyph(v, cartouche_opened, total));
temp_bfr.Add(Render_glyph(v, td_height));
temp_bfr.Add(Render_glyph(hctx, v, td_height));
}
wtr.Td(content_bfr, temp_bfr.To_bry_and_clear());
}
}
private byte[] Render_glyph(byte[] src) {return Render_glyph(src, Bry_.Empty);}
private byte[] Render_glyph(byte[] src, byte[] td_height) {
private byte[] Render_glyph(Xoh_wtr_ctx hctx, byte[] src) {return Render_glyph(hctx, src, Bry_.Empty);}
private byte[] Render_glyph(Xoh_wtr_ctx hctx, byte[] src, byte[] td_height) {
int src_len = src.length; if (src_len == 0) return src; // bounds check
byte byte_n = src[src_len - 1];
byte[] img_cls = byte_n == Byte_ascii.Backslash // REF.MW:isMirrored
? Bry_cls_mirrored // 'class="mw-mirrored" '
: Bry_.Empty
;
byte[] glyph = Extract_code(src, src_len); // trim backslashes from end; REF.MW:extractCode
byte[] img_cls = byte_n == Byte_ascii.Backslash // REF.MW:isMirrored
? Bry_cls_mirrored // 'class="mw-mirrored" '
: Bry_.Empty;
byte[] glyph = Extract_code(src, src_len); // trim backslashes from end; REF.MW:extractCode
if (Bry_.Eq(glyph, Tkn_dot_dot)) // render void block
return wtr.Void(Bool_.N);
else if (Bry_.Eq(glyph, Tkn_dot)) // render 1/2 width void block
@@ -182,18 +180,18 @@ class Hiero_html_mgr {
Hiero_phoneme_itm phoneme_itm = phoneme_mgr.Get_by_key(glyph);
Hiero_file_itm file_itm = null;
byte[] glyph_esc = Html_utl.Escape_html_as_bry(glyph);
byte[] glyph_esc = Gfh_utl.Escape_html_as_bry(glyph);
if (phoneme_itm != null) {
byte[] code = phoneme_itm.Gardiner_code();
file_itm = file_mgr.Get_by_key(code);
if (file_itm != null)
return wtr.Img_phoneme(img_cls, td_height, glyph_esc, code);
return wtr.Img_phoneme(hctx, img_cls, td_height, glyph_esc, code);
else
return glyph_esc;
}
file_itm = file_mgr.Get_by_key(glyph);
return file_itm != null
? wtr.Img_file(img_cls, td_height, glyph_esc)
? wtr.Img_file(hctx, img_cls, td_height, glyph_esc)
: glyph_esc
;
}

View File

@@ -22,8 +22,8 @@ class Hiero_html_wtr {
private Hiero_phoneme_mgr phoneme_mgr;
private Bry_bfr temp_bfr = Bry_bfr.reset_(255);
public Hiero_html_wtr(Hiero_html_mgr mgr, Hiero_phoneme_mgr phoneme_mgr) {this.phoneme_mgr = phoneme_mgr;}
public void Init_for_write(Xoh_wtr_ctx hctx) {this.hiero_img_dir = hctx.Mode_is_hdump() ? gplx.xowa.htmls.core.makes.Xoh_make_trie_.Bry__hiero_dir : Hiero_xtn_mgr.Img_src_dir;} private byte[] hiero_img_dir = null;
public void Hr(Bry_bfr bfr) {bfr.Add(Html_tag_.Hr_inl).Add_byte_nl();}
public void Init_for_write(Xoh_wtr_ctx hctx) {this.hiero_img_dir = Hiero_xtn_mgr.Img_src_dir;} private byte[] hiero_img_dir = null;
public void Hr(Bry_bfr bfr) {bfr.Add(Gfh_tag_.Hr_inl).Add_byte_nl();}
public void Tbl_eol(Bry_bfr bfr) {bfr.Add(Tbl_eol_bry);}
public byte[] Td_height(int height) {
return temp_bfr.Add(Option_bgn_bry).Add_int_variable(height).Add(Option_end_bry).To_bry_and_clear();
@@ -59,8 +59,7 @@ class Hiero_html_wtr {
, " <td>"
, " " + Tbl_bgn_str
, " <tr>"
))
;
));
public void Cartouche_end(Bry_bfr bfr) {
bfr.Add(Cartouche_end_lhs_bry).Add_int_variable((Hiero_html_mgr.Cartouche_width * Hiero_html_mgr.scale) / 100).Add(Cartouche_end_rhs_bry);
}
@@ -85,7 +84,7 @@ class Hiero_html_wtr {
int height = (int)((Hiero_html_mgr.Max_height * Hiero_html_mgr.scale) / 100);
Hiero_phoneme_itm phoneme_itm = phoneme_mgr.Get_by_key(glyph); if (phoneme_itm == null) throw Err_.new_wo_type("missing phoneme", "glyph", String_.new_u8(glyph));
byte[] code = phoneme_itm.Gardiner_code();
byte[] title = bgn ? Html_entity_.Lt_bry : Html_entity_.Gt_bry;
byte[] title = bgn ? Gfh_entity_.Lt_bry : Gfh_entity_.Gt_bry;
return cartouche_img_fmtr.Bld_bry_many(temp_bfr, hiero_img_dir, code, height, title);
}
private static final Bry_fmtr cartouche_img_fmtr = Bry_fmtr.new_(String_.Concat
@@ -93,7 +92,7 @@ class Hiero_html_wtr {
, " height='~{height}' title='~{title}'"
, " alt='~{title}' />"
)
, "path", "code", "height", "title");
, "path", "code", "height", "title", "hiero_tid");
public void Tbl_inner(Bry_bfr html_bfr, Bry_bfr text_bfr) {
html_bfr.Add(Tbl_inner_bgn).Add_bfr_and_clear(text_bfr).Add(Tbl_inner_end); // $html .= self::TABLE_START . "<tr>\n" . $tableContentHtml . '</tr></table>';
}
@@ -127,15 +126,14 @@ class Hiero_html_wtr {
, " </tr>"
, "</table>"
, ""
))
;
public byte[] Img_phoneme(byte[] img_cls, byte[] td_height, byte[] glyph_esc, byte[] code) {
byte[] code_esc = Html_utl.Escape_html_as_bry(temp_bfr, code);
));
public byte[] Img_phoneme(Xoh_wtr_ctx hctx, byte[] img_cls, byte[] td_height, byte[] glyph_esc, byte[] code) {
byte[] code_esc = Gfh_utl.Escape_html_as_bry(temp_bfr, code);
byte[] img_title = temp_bfr.Add(code_esc).Add_byte_space().Add_byte(Byte_ascii.Brack_bgn).Add(glyph_esc).Add_byte(Byte_ascii.Brack_end).To_bry_and_clear(); // "~{code} [~{glyph}]"
return Img(img_cls, td_height, glyph_esc, code_esc, img_title);
return Img(hctx, img_cls, td_height, glyph_esc, code_esc, img_title);
}
public byte[] Img_file(byte[] img_cls, byte[] td_height, byte[] glyph_esc) {return Img(img_cls, td_height, glyph_esc, glyph_esc, glyph_esc);}
private byte[] Img(byte[] img_cls, byte[] td_height, byte[] glyph, byte[] img_src_name, byte[] img_title) {
public byte[] Img_file(Xoh_wtr_ctx hctx, byte[] img_cls, byte[] td_height, byte[] glyph_esc) {return Img(hctx, img_cls, td_height, glyph_esc, glyph_esc, glyph_esc);}
private byte[] Img(Xoh_wtr_ctx hctx, byte[] img_cls, byte[] td_height, byte[] glyph, byte[] img_src_name, byte[] img_title) {
byte[] img_src = Bld_img_src(hiero_img_dir, img_src_name);
return glyph_img_fmtr.Bld_bry_many(temp_bfr, img_cls, Hiero_html_mgr.Image_margin, td_height, img_src, img_title, glyph);
}
@@ -147,10 +145,9 @@ class Hiero_html_wtr {
, " " + Tbl_bgn_str
, " <tr>"
));
private static final Bry_fmtr
glyph_img_fmtr = Bry_fmtr.new_
( "\n <img ~{img_cls}style='margin: ~{img_margin}px; ~{option}' src='~{img_src}' title='~{img_title}' alt='~{glyph}' />", "img_cls", "img_margin", "option", "img_src", "img_title", "glyph")
;
private static final Bry_fmtr glyph_img_fmtr = Bry_fmtr.new_
( "\n <img ~{img_cls}style='margin: ~{img_margin}px; ~{option}' src='~{img_src}' title='~{img_title}' alt='~{glyph}' />"
, "img_cls", "img_margin", "option", "img_src", "img_title", "glyph");
public byte[] Void(boolean half) { // render void
int width = Hiero_html_mgr.Max_height;
if (half) width /= 2;
@@ -164,10 +161,11 @@ class Hiero_html_wtr {
, " </td>"
, " </tr>"
, " </table>"
)
, "width");
), "width");
private static byte[] Bld_img_src(byte[] hiero_img_dir, byte[] name) {
return Bry_.Add(hiero_img_dir, Img_src_prefix, name, Img_src_ext);
}
private static final byte[] Img_src_prefix = Bry_.new_a7("hiero_"), Img_src_ext = Bry_.new_a7(".png");
private static final byte[] Img_src_prefix = Bry_.new_a7("hiero_")
, Img_src_ext = Bry_.new_a7(".png")
;
}

View File

@@ -40,11 +40,11 @@ class Hiero_parser {
int new_pos = trie.Match_pos();
switch (itm.Tid()) {
case Hiero_parser_itm.Tid_comment:
int end_comm = Bry_find_.Find_fwd(src, Html_tag_.Comm_end, new_pos, end);
int end_comm = Bry_find_.Find_fwd(src, Gfh_tag_.Comm_end, new_pos, end);
if (end_comm == Bry_find_.Not_found) // --> not found; for now, ignore <!--
pos = new_pos;
else
pos = end_comm + Html_tag_.Comm_end_len;
pos = end_comm + Gfh_tag_.Comm_end_len;
break;
case Hiero_parser_itm.Tid_block_spr:
New_block();
@@ -106,7 +106,7 @@ class Hiero_parser {
Init_itms(Hiero_parser_itm.Tid_tkn_spr, "*", ":", "(", ")");
Init_itms(Hiero_parser_itm.Tid_dot, ".");
Init_itms(Hiero_parser_itm.Tid_single_char , "!");
Init_itms(Hiero_parser_itm.Tid_comment, Html_tag_.Comm_bgn_str);
Init_itms(Hiero_parser_itm.Tid_comment, Gfh_tag_.Comm_bgn_str);
}
private void Init_itms(byte tid, String... keys) {
int keys_len = keys.length;

View File

@@ -35,20 +35,20 @@ class Imap_html_fmtrs {
), "href", "shape", "coords", "title")
, Img_anchor_none = Bry_fmtr.new_(String_.Concat_lines_nl_skip_last
( ""
, " <img id=\"xowa_file_img_~{img_elem_id}\" alt=\"~{img_alt}\"~{img_core}~{img_cls} usemap=\"#imageMap_1_~{imap_id}\"/>"
, " <img id=\"xoimg_~{img_elem_id}\" alt=\"~{img_alt}\"~{img_core}~{img_cls} usemap=\"#imageMap_1_~{imap_id}\"/>"
), "imap_id", "img_elem_id", "img_alt", "img_core", "img_cls", "anchor_href", "anchor_title"
)
, Img_anchor_lnki = Bry_fmtr.new_(String_.Concat_lines_nl_skip_last
( ""
, " <a href=\"~{anchor_href}\" title=\"~{anchor_title}\">"
, " <img id=\"xowa_file_img_~{img_elem_id}\" alt=\"~{img_alt}\"~{img_core}~{img_cls} usemap=\"#imageMap_1_~{imap_id}\"/>"
, " <img id=\"xoimg_~{img_elem_id}\" alt=\"~{img_alt}\"~{img_core}~{img_cls} usemap=\"#imageMap_1_~{imap_id}\"/>"
, " </a>"
), "imap_id", "img_elem_id", "img_alt", "img_core", "img_cls", "anchor_href", "anchor_title"
)
, Img_anchor_lnke = Bry_fmtr.new_(String_.Concat_lines_nl_skip_last
( ""
, " <a href=\"~{anchor_href}\" title=~{anchor_title} class=\"plainlinks\" rel=\"nofollow\">"
, " <img id=\"xowa_file_img_~{img_elem_id}\" alt=\"~{img_alt}\"~{img_core}~{img_cls} usemap=\"#imageMap_1_~{imap_id}\"/>"
, " <img id=\"xoimg_~{img_elem_id}\" alt=\"~{img_alt}\"~{img_core}~{img_cls} usemap=\"#imageMap_1_~{imap_id}\"/>"
, " </a>"
), "imap_id", "img_elem_id", "img_alt", "img_core", "img_cls", "anchor_href", "anchor_title"
)

View File

@@ -19,7 +19,7 @@ package gplx.xowa.xtns.imaps; import gplx.*; import gplx.xowa.*; import gplx.xow
import gplx.core.primitives.*; import gplx.core.brys.fmtrs.*;
import gplx.xowa.htmls.core.htmls.*; import gplx.xowa.htmls.core.wkrs.lnkis.htmls.*;
import gplx.xowa.parsers.*;
class Imap_img_fmtr_arg extends gplx.core.brys.Bfr_arg_base {
class Imap_img_fmtr_arg implements gplx.core.brys.Bfr_arg {
private Xoh_wtr_ctx hctx; private Imap_map map; private Imap_xtn_mgr xtn_mgr; // private byte[] src;
private int img_elem_id, img_w, img_h;
private byte[] img_alt, img_src, img_cls, img_href;
@@ -32,7 +32,7 @@ class Imap_img_fmtr_arg extends gplx.core.brys.Bfr_arg_base {
this.img_cls = img_cls;
this.img_href = img_href;
}
@Override public void Bfr_arg__add(Bry_bfr bfr) {
public void Bfr_arg__add(Bry_bfr bfr) {
Bry_fmtr fmtr = Imap_html_fmtrs.Img_anchor_none;
byte[] anchor_href = Bry_.Empty, anchor_text = Bry_.Empty;
Imap_itm_dflt itm_dflt = map.Dflt();

View File

@@ -37,7 +37,7 @@ public class Imap_map implements Xoh_file_img_wkr, Js_img_wkr {
private byte img_cls_tid;
private byte[] a_href, img_alt, img_cls_other;
public void Html_full_img(Bry_bfr tmp_bfr, Xoh_wtr_ctx hctx, Xoae_page page, byte[] src, Xof_file_itm xfer_itm, int uid
, byte[] a_href, byte a_cls, byte a_rel, byte[] a_title, byte[] a_xowa_title
, byte[] a_href, boolean a_href_is_file, byte a_cls, byte a_rel, byte[] a_title, byte[] a_xowa_title
, int img_w, int img_h, byte[] img_src, byte[] img_alt, byte img_cls, byte[] img_cls_other
) {
xfer_itm.Html_img_wkr_(this);

View File

@@ -17,20 +17,20 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.xtns.imaps; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
import gplx.core.brys.fmtrs.*;
class Imap_map_fmtr extends gplx.core.brys.Bfr_arg_base {
class Imap_map_fmtr implements gplx.core.brys.Bfr_arg {
private int imap_id;
public void Init(int imap_id, Imap_itm_shape[] shapes, double scale) {this.imap_id = imap_id; shapes_fmtr_arg.Init(shapes, scale);}
public Imap_pts_fmtr_arg Pts_fmtr() {return shapes_fmtr_arg.Pts_fmtr();}
@Override public void Bfr_arg__add(Bry_bfr bfr) {
public void Bfr_arg__add(Bry_bfr bfr) {
Imap_html_fmtrs.Map.Bld_bfr_many(bfr, imap_id, shapes_fmtr_arg);
}
private static final Imap_shapes_fmtr shapes_fmtr_arg = new Imap_shapes_fmtr();
}
class Imap_shapes_fmtr extends gplx.core.brys.Bfr_arg_base {
class Imap_shapes_fmtr implements gplx.core.brys.Bfr_arg {
private Imap_itm_shape[] shapes;
public void Init(Imap_itm_shape[] shapes, double scale) {this.shapes = shapes; pts_fmtr_arg.Scale_(scale);}
public Imap_pts_fmtr_arg Pts_fmtr() {return pts_fmtr_arg;}
@Override public void Bfr_arg__add(Bry_bfr bfr) {
public void Bfr_arg__add(Bry_bfr bfr) {
int shapes_len = shapes.length;
Bry_fmtr fmtr = Imap_html_fmtrs.Area;
for (int i = 0; i < shapes_len; ++i) {

View File

@@ -17,11 +17,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.xtns.imaps; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
import gplx.core.primitives.*;
class Imap_pts_fmtr_arg extends gplx.core.brys.Bfr_arg_base {
class Imap_pts_fmtr_arg implements gplx.core.brys.Bfr_arg {
private double scale = 1; private Double_obj_val[] pts;
public void Scale_(double v) {this.scale = v;}
public void Pts_(Double_obj_val[] v) {this.pts = v;}
@Override public void Bfr_arg__add(Bry_bfr bfr) {
public void Bfr_arg__add(Bry_bfr bfr) {
int pts_len = pts.length;
for (int i = 0; i < pts_len; ++i) {
Double_obj_val pt = pts[i];

View File

@@ -35,15 +35,10 @@ public class Imap_xnde_html_all_tst {
, " <area href=\"/wiki/B\" shape=\"circle\" coords=\"0,0,5\" alt=\"b1\" title=\"b1\"/>"
, " <area href=\"/wiki/C\" shape=\"rect\" coords=\"0,0,4,8\" alt=\"c1\" title=\"c1\"/>"
, " </map>"
, " <img id=\"xowa_file_img_0\" alt=\"\" src=\"file:///mem/wiki/repo/trg/thumb/7/0/A.png/123px.png\" width=\"123\" height=\"0\" usemap=\"#imageMap_1_1\"/>"
, " <img id=\"xoimg_0\" alt=\"\" src=\"file:///mem/wiki/repo/trg/thumb/7/0/A.png/123px.png\" width=\"123\" height=\"0\" usemap=\"#imageMap_1_1\"/>"
, " </div>"
, " <div class=\"thumbcaption\">"
, " <div class=\"magnify\">"
, " <a href=\"/wiki/File:A.png\" class=\"internal\" title=\"Enlarge\">"
, " <img src=\"file:///mem/xowa/bin/any/xowa/file/mediawiki.file/magnify-clip.png\" width=\"15\" height=\"11\" alt=\"\" />"
, " </a>"
, " </div>"
, " a1"
, "<div class=\"magnify\"><a href=\"/wiki/File:A.png\" class=\"internal\" title=\"Enlarge\"></a></div>a1"
, " </div>"
, " </div>"
, "</div>"
@@ -65,16 +60,11 @@ public class Imap_xnde_html_all_tst {
, " <map name=\"imageMap_1_1\">"
, " </map>"
, " <a href=\"/wiki/B\" title=\"b1\">"
, " <img id=\"xowa_file_img_0\" alt=\"\" src=\"file:///mem/wiki/repo/trg/thumb/7/0/A.png/123px.png\" width=\"123\" height=\"0\" usemap=\"#imageMap_1_1\"/>"
, " <img id=\"xoimg_0\" alt=\"\" src=\"file:///mem/wiki/repo/trg/thumb/7/0/A.png/123px.png\" width=\"123\" height=\"0\" usemap=\"#imageMap_1_1\"/>"
, " </a>"
, " </div>"
, " <div class=\"thumbcaption\">"
, " <div class=\"magnify\">"
, " <a href=\"/wiki/File:A.png\" class=\"internal\" title=\"Enlarge\">"
, " <img src=\"file:///mem/xowa/bin/any/xowa/file/mediawiki.file/magnify-clip.png\" width=\"15\" height=\"11\" alt=\"\" />"
, " </a>"
, " </div>"
, " a1"
, "<div class=\"magnify\"><a href=\"/wiki/File:A.png\" class=\"internal\" title=\"Enlarge\"></a></div>a1"
, " </div>"
, " </div>"
, "</div>"
@@ -90,7 +80,7 @@ public class Imap_xnde_html_all_tst {
( "<div id='imap_div_0' class=\"noresize\" style=\"height:0px; width: 123px;\">"
, " <map name=\"imageMap_1_1\">"
, " </map>"
, " <img id=\"xowa_file_img_0\" alt=\"a1\" src=\"file:///mem/wiki/repo/trg/thumb/7/0/A.png/123px.png\" width=\"123\" height=\"0\" usemap=\"#imageMap_1_1\"/>"
, " <img id=\"xoimg_0\" alt=\"a1\" src=\"file:///mem/wiki/repo/trg/thumb/7/0/A.png/123px.png\" width=\"123\" height=\"0\" usemap=\"#imageMap_1_1\"/>"
, " <div style=\"margin-left:0px; margin-top:1px; text-align:left;\">"
, " <a href=\"/wiki/File:A.png\" title=\"click here\">"
, " <img alt=\"click here\" src=\"file:///mem/xowa/bin/any/xowa/xtns/ImageMap/imgs/desc-20.png\" style=\"border: none;\" />"
@@ -113,15 +103,10 @@ public class Imap_xnde_html_all_tst {
, " <map name=\"imageMap_1_1\">"
, " <area href=\"http://b.org\" shape=\"circle\" coords=\"0,0,5\" alt=\"b1\" title=\"b1\"/>"
, " </map>"
, " <img id=\"xowa_file_img_0\" alt=\"\" src=\"file:///mem/wiki/repo/trg/thumb/7/0/A.png/123px.png\" width=\"123\" height=\"0\" usemap=\"#imageMap_1_1\"/>"
, " <img id=\"xoimg_0\" alt=\"\" src=\"file:///mem/wiki/repo/trg/thumb/7/0/A.png/123px.png\" width=\"123\" height=\"0\" usemap=\"#imageMap_1_1\"/>"
, " </div>"
, " <div class=\"thumbcaption\">"
, " <div class=\"magnify\">"
, " <a href=\"/wiki/File:A.png\" class=\"internal\" title=\"Enlarge\">"
, " <img src=\"file:///mem/xowa/bin/any/xowa/file/mediawiki.file/magnify-clip.png\" width=\"15\" height=\"11\" alt=\"\" />"
, " </a>"
, " </div>"
, " a1"
, "<div class=\"magnify\"><a href=\"/wiki/File:A.png\" class=\"internal\" title=\"Enlarge\"></a></div>a1"
, " </div>"
, " </div>"
, "</div>"
@@ -156,7 +141,7 @@ public class Imap_xnde_html_all_tst {
, "<div id='imap_div_0' class=\"noresize\">"
, " <map name=\"imageMap_1_1\">"
, " </map>"
, " <img id=\"xowa_file_img_0\" alt=\"b\" src=\"file:///mem/wiki/repo/trg/thumb/7/0/A.png/123px.png\" width=\"123\" height=\"0\" usemap=\"#imageMap_1_1\"/>" // NOTE: width must be 123, not 0
, " <img id=\"xoimg_0\" alt=\"b\" src=\"file:///mem/wiki/repo/trg/thumb/7/0/A.png/123px.png\" width=\"123\" height=\"0\" usemap=\"#imageMap_1_1\"/>" // NOTE: width must be 123, not 0
, " </div>"
, " </td>"
, " </tr>"
@@ -184,15 +169,10 @@ public class Imap_xnde_html_all_tst {
, " <map name=\"imageMap_1_1\">"
, " <area href=\"/wiki/B\" shape=\"circle\" coords=\"0,0,5\" alt=\"b1\" title=\"b1\"/>"
, " </map>"
, " <img id=\"xowa_file_img_0\" alt=\"\" src=\"file:///mem/wiki/repo/trg/thumb/7/0/A.png/123px.png\" width=\"123\" height=\"0\" usemap=\"#imageMap_1_1\"/>"
, " <img id=\"xoimg_0\" alt=\"\" src=\"file:///mem/wiki/repo/trg/thumb/7/0/A.png/123px.png\" width=\"123\" height=\"0\" usemap=\"#imageMap_1_1\"/>"
, " </div>"
, " <div class=\"thumbcaption\">"
, " <div class=\"magnify\">"
, " <a href=\"/wiki/File:A.png\" class=\"internal\" title=\"Enlarge\">"
, " <img src=\"file:///mem/xowa/bin/any/xowa/file/mediawiki.file/magnify-clip.png\" width=\"15\" height=\"11\" alt=\"\" />"
, " </a>"
, " </div>"
, " a1"
, "<div class=\"magnify\"><a href=\"/wiki/File:A.png\" class=\"internal\" title=\"Enlarge\"></a></div>a1"
, " </div>"
, " </div>"
, "</div>"
@@ -213,7 +193,7 @@ class Imap_xnde_html_fxt {
Xol_msg_itm msg = fxt.Wiki().Msg_mgr().Get_or_make(Bry_.new_a7("imagemap_description"));
msg.Atrs_set(Bry_.new_a7("click here"), false, false);
}
public Xop_fxt Fxt() {return fxt;} private Xop_fxt fxt = new Xop_fxt();
public Xop_fxt Fxt() {return fxt;} private final Xop_fxt fxt = new Xop_fxt();
public void Test_html_full_str(String raw, String expd) {fxt.Test_html_full_str(raw, expd);}
public void Test_html_full_frag(String raw, String expd) {fxt.Test_html_full_frag(raw, expd);}
public String Frag_html_full() {
@@ -221,7 +201,7 @@ class Imap_xnde_html_fxt {
( "<div id='imap_div_0' class=\"noresize\">"
, " <map name=\"imageMap_1_1\">"
, " </map>"
, " <img id=\"xowa_file_img_0\" alt=\"\" src=\"file:///mem/wiki/repo/trg/orig/7/0/A.png\" width=\"0\" height=\"0\" usemap=\"#imageMap_1_1\"/>"
, " <img id=\"xoimg_0\" alt=\"\" src=\"file:///mem/wiki/repo/trg/orig/7/0/A.png\" width=\"0\" height=\"0\" usemap=\"#imageMap_1_1\"/>"
, " </div>"
);
}

View File

@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.xtns.indicators; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
import gplx.core.brys.fmtrs.*;
public class Indicator_html_bldr extends gplx.core.brys.Bfr_arg_base {
public class Indicator_html_bldr implements gplx.core.brys.Bfr_arg {
private Indicator_html_bldr_itm bldr_itm = new Indicator_html_bldr_itm();
private Ordered_hash list = Ordered_hash_.New();
public void Enabled_(boolean v) {enabled = v;} private boolean enabled = Bool_.Y;
@@ -31,7 +31,7 @@ public class Indicator_html_bldr extends gplx.core.brys.Bfr_arg_base {
if (!enabled) return; // do not add if disabled; called from <page>; PAGE:en.s:The_Parochial_System_(Wilberforce,_1838); DATE:2015-04-29
list.Add_if_dupe_use_nth(xnde.Name(), xnde); // Add_if_dupe_use_nth: 2nd indicator overwrites 1st; DATE:2015-04-29
}
@Override public void Bfr_arg__add(Bry_bfr bfr) {
public void Bfr_arg__add(Bry_bfr bfr) {
if (list.Count() == 0) return; // do not build html if no items; DATE:2015-04-29
bldr_itm.Init(list);
fmtr_grp.Bld_bfr_many(bfr, bldr_itm);
@@ -44,10 +44,10 @@ public class Indicator_html_bldr extends gplx.core.brys.Bfr_arg_base {
), "itms")
;
}
class Indicator_html_bldr_itm extends gplx.core.brys.Bfr_arg_base {
class Indicator_html_bldr_itm implements gplx.core.brys.Bfr_arg {
private Ordered_hash list;
public void Init(Ordered_hash list) {this.list = list;}
@Override public void Bfr_arg__add(Bry_bfr bfr) {
public void Bfr_arg__add(Bry_bfr bfr) {
int list_len = list.Count();
for (int i = list_len - 1; i > -1; --i) { // reverse order
Indicator_xnde xnde = (Indicator_xnde)list.Get_at(i);

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.xowa.xtns.indicators; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
import org.junit.*;
public class Indicator_xnde_tst {
@Before public void init() {fxt.Reset();} private Xop_fxt fxt = new Xop_fxt();
@Before public void init() {fxt.Reset();} private final Xop_fxt fxt = new Xop_fxt();
@Test public void Basic() {
fxt.Test_parse_page_all_str("<indicator name='a'>test</indicator>", "");
}

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.xowa.xtns.inputBox; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
import org.junit.*;
public class Xtn_inputbox_nde_tst {
private Xop_fxt fxt = new Xop_fxt();
private final Xop_fxt fxt = new Xop_fxt();
@Test public void Basic() {
fxt.Test_parse_page_wiki_str("a<inputbox>b</inputbox>c", "ac");
}

View File

@@ -22,7 +22,7 @@ import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
public class Insider_func extends Pf_func_base {
@Override public int Id() {return Xol_kwd_grp_.Id_insider;}
@Override public Pf_func New(int id, byte[] name) {return new Insider_func().Name_(name);}
@Override public void Func_evaluate(Xop_ctx ctx, byte[] src, Xot_invk caller, Xot_invk self, Bry_bfr bfr) {
@Override public void Func_evaluate(Bry_bfr bfr, Xop_ctx ctx, Xot_invk caller, Xot_invk self, byte[] src) {
byte[] val = Eval_argx(ctx, src, caller, self);
Xopg_xtn_skin_mgr skin_mgr = ctx.Cur_page().Html_data().Xtn_skin_mgr();
Insider_xtn_skin_itm skin_itm = (Insider_xtn_skin_itm)skin_mgr.Get_or_null(Insider_xtn_skin_itm.KEY);

View File

@@ -24,7 +24,7 @@ public class Insider_func_tst {
}
}
class Insider_func_fxt {
private Xop_fxt fxt = new Xop_fxt();
private final Xop_fxt fxt = new Xop_fxt();
public void Reset() {
fxt.Reset();
}

View File

@@ -33,7 +33,7 @@ class Insider_xtn_skin_itm implements Xopg_xtn_skin_itm {
html_bldr.Bld_all(bfr, page, itms);
}
}
public class Insider_html_bldr extends gplx.core.brys.Bfr_arg_base {
public class Insider_html_bldr implements gplx.core.brys.Bfr_arg {
private Insider_xtn_mgr xtn_mgr;
private Bry_bfr tmp_ttl = Bry_bfr.reset_(255);
private List_adp list; private int list_len;
@@ -44,7 +44,7 @@ public class Insider_html_bldr extends gplx.core.brys.Bfr_arg_base {
hash.Clear();
fmtr_grp.Bld_bfr_many(bfr, xtn_mgr.Msg_sidebar_ttl(), xtn_mgr.Msg_about_page(), xtn_mgr.Msg_about_ttl(), this);
}
@Override public void Bfr_arg__add(Bry_bfr bfr) {
public void Bfr_arg__add(Bry_bfr bfr) {
Xowe_wiki wiki = xtn_mgr.Wiki();
Gfo_url_encoder href_encoder = gplx.langs.htmls.encoders.Gfo_url_encoder_.Href;
for (int i = 0; i < list_len; ++i) {

View File

@@ -70,7 +70,7 @@ public class Listing_xnde implements Xox_xnde, Mwh_atr_itm_owner {
if (xtn_mgr == null || !xtn_mgr.Enabled()) return;
Mwh_atr_itm[] atrs = Xox_xnde_.Xatr__set(wiki, this, Listing_xatrs.Key_hash, src, xnde);
Init_args();
Html_wtr hwtr = xtn_mgr.Hwtr();
Gfh_wtr hwtr = xtn_mgr.Hwtr();
if (!Bld_by_template(xnde, atrs, src)) {
Bld_by_args(xtn_mgr, hwtr, xnde, src);
html_output = hwtr.To_bry_and_clear();
@@ -106,7 +106,7 @@ public class Listing_xnde implements Xox_xnde, Mwh_atr_itm_owner {
html_output = wiki.Parser_mgr().Main().Parse_text_to_html(sub_ctx, bfr.To_bry_and_rls());
return true;
}
private void Bld_by_args(Listing_xtn_mgr xtn_mgr, Html_wtr wtr, Xop_xnde_tkn xnde, byte[] src) {
private void Bld_by_args(Listing_xtn_mgr xtn_mgr, Gfh_wtr wtr, Xop_xnde_tkn xnde, byte[] src) {
wtr.Nde_full(Tag_strong, xatr_name); // <strong>name</strong>
if (xatr_url != null)
wtr.Nde_full_atrs(Tag_a, wtr.To_bry_and_clear(), false

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.xowa.xtns.listings; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
import org.junit.*; import gplx.xowa.langs.*; import gplx.xowa.langs.msgs.*;
public class Listing_xnde_basic_tst {
private Xop_fxt fxt = new Xop_fxt();
private final Xop_fxt fxt = new Xop_fxt();
private Listing_xtn_mgr listings_xtn_mgr;
@Before public void init() {
fxt.Reset_for_msgs();

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.xowa.xtns.listings; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
import org.junit.*;
public class Listing_xnde_template_tst {
private Xop_fxt fxt = new Xop_fxt();
private final Xop_fxt fxt = new Xop_fxt();
private Listing_xtn_mgr listings_xtn_mgr;
@Before public void init() {
fxt.Reset_for_msgs();

View File

@@ -28,13 +28,13 @@ public class Listing_xtn_mgr extends Xox_mgr_base {
if (!Enabled()) return;
this.Reset(wiki);
}
@gplx.Internal protected Html_wtr Hwtr() {return hwtr;} private Html_wtr hwtr;
@gplx.Internal protected Gfh_wtr Hwtr() {return hwtr;} private Gfh_wtr hwtr;
public void Clear() {
listings_template = phone_symbol = tollfree_symbol = fax_symbol = email_symbol = null;
checkin_msg = checkout_msg = position_template = position_text = null;
}
private void Reset(Xowe_wiki wiki) {
hwtr = new Html_wtr();
hwtr = new Gfh_wtr();
Xop_ctx sub_ctx = Xop_ctx.new_sub_(wiki);
listings_template = Load_txt(wiki, sub_ctx, "listings-template");
phone_symbol = Load_txt(wiki, sub_ctx, "listings-phone-symbol", "listings-phone");
@@ -61,7 +61,7 @@ public class Listing_xtn_mgr extends Xox_mgr_base {
byte[] rv = null;
if (symbol_text != null) {
hwtr.Nde_full_atrs(Listing_xnde.Tag_abbr, symbol_text, true
, Listing_xnde.Atr_a_title, Html_utl.Escape_html_as_bry(template_text)
, Listing_xnde.Atr_a_title, Gfh_utl.Escape_html_as_bry(template_text)
);
rv = hwtr.To_bry_and_clear();
}
@@ -73,7 +73,7 @@ public class Listing_xtn_mgr extends Xox_mgr_base {
private byte[] Load_txt(Xowe_wiki wiki, Xop_ctx sub_ctx, String ttl) {
byte[] rv = wiki.Msg_mgr().Val_by_key_obj(Bry_.new_u8(ttl)); if (Bry_.Len_eq_0(rv)) return null; // ttl does not exist; note that msg_mgr returns "" for missing values
rv = wiki.Parser_mgr().Main().Parse_text_to_html(sub_ctx, rv);
rv = Html_utl.Escape_html_as_bry(rv);
rv = Gfh_utl.Escape_html_as_bry(rv);
return rv;
}
private Xol_msg_itm Load_msg(Xowe_wiki wiki, Xop_ctx sub_ctx, String ttl) {

View File

@@ -22,7 +22,7 @@ import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
public class Lst_pfunc_lst extends Pf_func_base {
@Override public int Id() {return Xol_kwd_grp_.Id_lst;}
@Override public Pf_func New(int id, byte[] name) {return new Lst_pfunc_lst().Name_(name);}
@Override public void Func_evaluate(Xop_ctx ctx, byte[] src, Xot_invk caller, Xot_invk self, Bry_bfr bfr) {
@Override public void Func_evaluate(Bry_bfr bfr, Xop_ctx ctx, Xot_invk caller, Xot_invk self, byte[] src) {
byte[] src_ttl_bry = Eval_argx(ctx, src, caller, self); if (Bry_.Len_eq_0(src_ttl_bry)) return; // {{#lst:}} -> ""
int args_len = self.Args_len();
byte[] sect_bgn = Pf_func_.Eval_arg_or(ctx, src, caller, self, args_len, 0, Lst_pfunc_wkr.Null_arg);

View File

@@ -22,7 +22,7 @@ import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
public class Lst_pfunc_lstx extends Pf_func_base {
@Override public int Id() {return Xol_kwd_grp_.Id_lstx;}
@Override public Pf_func New(int id, byte[] name) {return new Lst_pfunc_lstx().Name_(name);}
@Override public void Func_evaluate(Xop_ctx ctx, byte[] src, Xot_invk caller, Xot_invk self, Bry_bfr bfr) {
@Override public void Func_evaluate(Bry_bfr bfr, Xop_ctx ctx, Xot_invk caller, Xot_invk self, byte[] src) {
byte[] src_ttl_bry = Eval_argx(ctx, src, caller, self); if (Bry_.Len_eq_0(src_ttl_bry)) return; // {{#lst:}} -> ""
int args_len = self.Args_len();
byte[] sect_exclude = Pf_func_.Eval_arg_or(ctx, src, caller, self, args_len, 0, Lst_pfunc_wkr.Null_arg);

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.xowa.xtns.lst; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
import org.junit.*; import gplx.xowa.langs.*;
public class Lst_section_nde_tst {
private Xop_fxt fxt = new Xop_fxt();
private final Xop_fxt fxt = new Xop_fxt();
@Test public void Basic() {
fxt.Test_parse_page_all_str("a<section name=\"b\">c</section>d", "ad");
}

View File

@@ -23,7 +23,7 @@ import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
public class Map_dd2dms_func extends Pf_func_base {
@Override public int Id() {return Xol_kwd_grp_.Id_mapSources_dd2dms;}
@Override public Pf_func New(int id, byte[] name) {return new Map_dd2dms_func().Name_(name);}
@Override public void Func_evaluate(Xop_ctx ctx, byte[] src, Xot_invk caller, Xot_invk self, Bry_bfr bfr) {
@Override public void Func_evaluate(Bry_bfr bfr, Xop_ctx ctx, Xot_invk caller, Xot_invk self, byte[] src) {
byte[] coord = Eval_argx(ctx, src, caller, self);
int args_len = self.Args_len();
Bry_bfr tmp_bfr = ctx.Wiki().Utl__bfr_mkr().Get_b128();

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.xowa.xtns.mapSources; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
import org.junit.*;
public class Map_dd2dms_func_tst {
@Before public void init() {fxt.Reset();} private Xop_fxt fxt = new Xop_fxt();
@Before public void init() {fxt.Reset();} private final Xop_fxt fxt = new Xop_fxt();
@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");}

View File

@@ -22,7 +22,7 @@ import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
public class Map_deg2dd_func extends Pf_func_base {
@Override public int Id() {return Xol_kwd_grp_.Id_mapSources_deg2dd;}
@Override public Pf_func New(int id, byte[] name) {return new Map_deg2dd_func().Name_(name);}
@Override public void Func_evaluate(Xop_ctx ctx, byte[] src, Xot_invk caller, Xot_invk self, Bry_bfr bfr) {
@Override public void Func_evaluate(Bry_bfr bfr, Xop_ctx ctx, Xot_invk caller, Xot_invk self, byte[] src) {
byte[] coord = Eval_argx(ctx, src, caller, self);
byte[] precision_bry = Pf_func_.Eval_val_or(ctx, src, caller, self, self.Args_len(), 0, null);
int prec = precision_bry == null ? -1 : Bry_.To_int_or(precision_bry, -1);

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.xowa.xtns.mapSources; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
import org.junit.*;
public class Map_deg2dd_func_tst {
@Before public void init() {fxt.Reset();} private Xop_fxt fxt = new Xop_fxt();
@Before public void init() {fxt.Reset();} private final Xop_fxt fxt = new Xop_fxt();
@Test public void Prec_basic() {fxt.Test_parse_tmpl_str_test("{{#deg2dd: 1.2345|2}}" , "{{test}}" , "1.23");}
@Test public void Prec_round() {fxt.Test_parse_tmpl_str_test("{{#deg2dd: 1.2345|3}}" , "{{test}}" , "1.235");}
@Test public void Example() {fxt.Test_parse_tmpl_str_test("{{#deg2dd: 14° 23' 45'' S|precision=3}}" , "{{test}}" , "-14.396");}

View File

@@ -23,7 +23,7 @@ import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
public class Map_geolink_func extends Pf_func_base {
@Override public int Id() {return Xol_kwd_grp_.Id_mapSources_geoLink;}
@Override public Pf_func New(int id, byte[] name) {return new Map_geolink_func().Name_(name);}
@Override public void Func_evaluate(Xop_ctx ctx, byte[] src, Xot_invk caller, Xot_invk self, Bry_bfr bfr) {
@Override public void Func_evaluate(Bry_bfr bfr, Xop_ctx ctx, Xot_invk caller, Xot_invk self, byte[] src) {
byte[] mer_x_val = null, mer_y_val = null, mer_x_pos = null, mer_x_neg = null, mer_y_pos = null, mer_y_neg = null;
int prec = 4;
int args_len = self.Args_len();

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.xowa.xtns.mapSources; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
import org.junit.*;
public class Map_geolink_func_tst {
@Before public void init() {fxt.Reset();} private Xop_fxt fxt = new Xop_fxt();
@Before public void init() {fxt.Reset();} private final Xop_fxt fxt = new Xop_fxt();
@Test public void Example() {
fxt.Test_parse_tmpl_str_test
( "{{#geoLink: $1 $2 $3 $4 $5 $6|lat=10.5|long=20.5|plusLat=N|plusLong=E|minusLat=S|minusLong=W|precision=decimal places}}", "{{test}}"

View File

@@ -22,7 +22,7 @@ import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
public class Message_target_func extends Pf_func_base {
@Override public int Id() {return Xol_kwd_grp_.Id_massMessage_target;}
@Override public Pf_func New(int id, byte[] name) {return new Message_target_func().Name_(name);}
@Override public void Func_evaluate(Xop_ctx ctx, byte[] src, Xot_invk caller, Xot_invk self, Bry_bfr bfr) {
@Override public void Func_evaluate(Bry_bfr bfr, Xop_ctx ctx, Xot_invk caller, Xot_invk self, byte[] src) {
byte[] argx = Eval_argx(ctx, src, caller, self); if (argx == null) return;
bfr.Add(Xop_tkn_.Lnki_bgn).Add(argx).Add(Xop_tkn_.Lnki_end); // TODO: evaluate 2nd arg; {{#target:A|en.wikipedia.org}}
}

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.xowa.xtns.massMessage; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
import org.junit.*;
public class Message_target_func_tst {
@Before public void init() {fxt.Reset();} private Xop_fxt fxt = new Xop_fxt();
@Before public void init() {fxt.Reset();} private final Xop_fxt fxt = new Xop_fxt();
@Test public void Basic() {
fxt.Test_parse_page_all_str("{{#target:A}}", "<a href=\"/wiki/A\">A</a>");
}

View File

@@ -60,10 +60,10 @@ public class Xof_math_html_wtr {
for (int i = bgn; i < end; i++) {
byte b = bry[i];
switch (b) {
case Byte_ascii.Lt: if (mathjax) escaped = gplx.langs.htmls.Html_entity_.Lt_bry; break;
case Byte_ascii.Gt: if (mathjax) escaped = gplx.langs.htmls.Html_entity_.Gt_bry; break;
case Byte_ascii.Lt: if (mathjax) escaped = gplx.langs.htmls.Gfh_entity_.Lt_bry; break;
case Byte_ascii.Gt: if (mathjax) escaped = gplx.langs.htmls.Gfh_entity_.Gt_bry; break;
// case Byte_ascii.Amp: escaped = Const_amp; break; // TOMBSTONE:never escape ampersand; PAGE:s.w:Matrix_(mathematics); DATE:2014-07-19
// case Byte_ascii.Quote: if (mathjax) escaped = gplx.langs.htmls.Html_entity_.Quote_bry; break; // TOMBSTONE:do not escape quote; PAGE:s.w:Matrix_(mathematics); DATE:2014-07-19
// case Byte_ascii.Quote: if (mathjax) escaped = gplx.langs.htmls.Gfh_entity_.Quote_bry; break; // TOMBSTONE:do not escape quote; PAGE:s.w:Matrix_(mathematics); DATE:2014-07-19
default:
if (dirty || write_to_bfr)
bfr.Add_byte(b);

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.xowa.xtns.math; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
import org.junit.*;
public class Xof_math_mgr_html_tst {
@Before public void init() {} private Xop_fxt fxt = new Xop_fxt();
@Before public void init() {} private final Xop_fxt fxt = new Xop_fxt();
@Test public void Escape_lt_gt_mathjax() { // PURPOSE: escape <>&"; EX:de.w:Vergleich_(Zahlen); DATE:2014-05-10; PAGE:s.w:Matrix_(mathematics) DATE:2014-07-19
fxt.Test_html_full_str("<math>a<>b</math>", "<span id='xowa_math_txt_0'>a&lt;&gt;b</span>");
}

View File

@@ -0,0 +1,42 @@
/*
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.xtns.pagebanners; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.htmls.*;
import gplx.xowa.parsers.*; import gplx.xowa.parsers.logs.*; import gplx.xowa.parsers.xndes.*; import gplx.xowa.parsers.htmls.*;
public class Pb_xnde implements Xox_xnde {
// private Pb_xtn xtn;
public void Xatr__set(Xowe_wiki wiki, byte[] src, Mwh_atr_itm xatr, Object xatr_id_obj) {}
public void Xtn_parse(Xowe_wiki wiki, Xop_ctx ctx, Xop_root_tkn root, byte[] src, Xop_xnde_tkn xnde) {
ctx.Para().Process_block__xnde(xnde.Tag(), Xop_xnde_tag.Block_bgn);
// this.xtn = (Pb_xtn)wiki.Xtn_mgr().Get_or_fail(Pb_xtn.Xtn_key_static);
// xtn.Xtn_init_assert(wiki);
// ctx.Cur_page().Html_data().Head_mgr().Itm__graph().Enabled_y_();
// boolean log_wkr_enabled = Log_wkr != Xop_log_basic_wkr.Null; if (log_wkr_enabled) Log_wkr.Log_end_xnde(ctx.Cur_page(), Xop_log_basic_wkr.Tid_graph, src, xnde);
ctx.Para().Process_block__xnde(xnde.Tag(), Xop_xnde_tag.Block_end);
}
public void Xtn_write(Bry_bfr bfr, Xoae_app app, Xop_ctx ctx, Xoh_html_wtr html_wtr, Xoh_wtr_ctx hctx, Xop_xnde_tkn xnde, byte[] src) {
// bfr.Add(Html__div_bgn);
// bfr.Add_mid(src, xnde.Tag_open_end(), xnde.Tag_close_bgn());
// bfr.Add(Html__div_end);
}
public static Xop_log_basic_wkr Log_wkr = Xop_log_basic_wkr.Null;
// private static final byte[]
// Html__div_bgn = Bry_.new_a7("<div class='mw-wiki-graph'>\n")
// , Html__div_end = Bry_.new_a7("</div>\n")
// ;
}

View File

@@ -0,0 +1,25 @@
/*
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.xtns.pagebanners; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
public class Pb_xtn extends Xox_mgr_base implements GfoInvkAble {
@Override public boolean Enabled_default() {return true;}
@Override public byte[] Xtn_key() {return Xtn_key_static;} public static final byte[] Xtn_key_static = Bry_.new_a7("graph");
@Override public Xox_mgr Clone_new() {return new Pb_xtn();}
@Override public void Xtn_init_by_wiki(Xowe_wiki wiki) {}
public void Xtn_init_assert(Xowe_wiki wiki) {}
}

View File

@@ -19,7 +19,7 @@ package gplx.xowa.xtns.pfuncs; import gplx.*; import gplx.xowa.*; import gplx.xo
import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
public interface Pf_func extends Xot_defn {
int Id();
void Func_evaluate(Xop_ctx ctx, byte[] src, Xot_invk caller, Xot_invk self, Bry_bfr bb);
void Func_evaluate(Bry_bfr bfr, Xop_ctx ctx, Xot_invk caller, Xot_invk self, byte[] src);
boolean Func_require_colon_arg();
Pf_func New(int id, byte[] name);
}

View File

@@ -237,6 +237,7 @@ public class Pf_func_ {
, Xol_kwd_grp_.Id_pendingChangeLevel
, Xol_kwd_grp_.Id_pagesUsingPendingChanges
, Xol_kwd_grp_.Id_bang
, Xol_kwd_grp_.Id_rev_revisionsize
};
public static Xot_defn Get_prototype(int id) {
switch (id) {
@@ -319,6 +320,7 @@ public class Pf_func_ {
case Xol_kwd_grp_.Id_page_id:
case Xol_kwd_grp_.Id_rev_id:
case Xol_kwd_grp_.Id_rev_pagesize:
case Xol_kwd_grp_.Id_rev_revisionsize:
case Xol_kwd_grp_.Id_rev_user:
case Xol_kwd_grp_.Id_rev_protectionlevel: return Pfunc_rev_props.Instance;
case Xol_kwd_grp_.Id_page_displaytitle: return Pfunc_displaytitle.Instance;
@@ -414,12 +416,12 @@ public class Pf_func_ {
class Pf_func_noop extends Pf_func_base {
public Pf_func_noop(int id) {this.id = id;} private int id;
@Override public int Id() {return id;}
@Override public void Func_evaluate(Xop_ctx ctx, byte[] src, Xot_invk caller, Xot_invk self, Bry_bfr bfr) {}
@Override public void Func_evaluate(Bry_bfr bfr, Xop_ctx ctx, Xot_invk caller, Xot_invk self, byte[] src) {}
@Override public Pf_func New(int id, byte[] name) {return new Pf_func_noop(id).Name_(name);}
}
class Pf_func_bang extends Pf_func_base {
@Override public int Id() {return Xol_kwd_grp_.Id_bang;}
@Override public void Func_evaluate(Xop_ctx ctx, byte[] src, Xot_invk caller, Xot_invk self, Bry_bfr bfr) {bfr.Add_byte_pipe();}
@Override public void Func_evaluate(Bry_bfr bfr, Xop_ctx ctx, Xot_invk caller, Xot_invk self, byte[] src) {bfr.Add_byte_pipe();}
@Override public Pf_func New(int id, byte[] name) {return this;}
public static final Pf_func_bang Instance = new Pf_func_bang();
Pf_func_bang() {this.Name_(Byte_ascii.Bang_bry);}

View File

@@ -27,7 +27,7 @@ public abstract class Pf_func_base implements Pf_func {
public void Rls() {name = null; argx_dat = null;}
public abstract Pf_func New(int id, byte[] name);
public Xot_defn Clone(int id, byte[] name) {return New(id, name);}
public abstract void Func_evaluate(Xop_ctx ctx, byte[] src, Xot_invk caller, Xot_invk self, Bry_bfr bfr);
public abstract void Func_evaluate(Bry_bfr bfr, Xop_ctx ctx, Xot_invk caller, Xot_invk self, byte[] src);
public byte[] Argx_dat() {return argx_dat;} public void Argx_dat_(byte[] v) {argx_dat = v;} private byte[] argx_dat = Bry_.Empty;
public byte[] Eval_argx(Xop_ctx ctx, byte[] src, Xot_invk caller, Xot_invk self) {
if (argx_dat == Bry_.Empty) {

View File

@@ -20,7 +20,7 @@ import gplx.xowa.langs.*; import gplx.xowa.langs.kwds.*; import gplx.core.log_ms
import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
public class Pfunc_expr extends Pf_func_base {
@Override public boolean Func_require_colon_arg() {return true;}
@Override public void Func_evaluate(Xop_ctx ctx, byte[] src, Xot_invk caller, Xot_invk self, Bry_bfr bfr) {
@Override public void Func_evaluate(Bry_bfr bfr, Xop_ctx ctx, Xot_invk caller, Xot_invk self, byte[] src) {
byte[] val_dat_ary = Eval_argx(ctx, src, caller, self); if (val_dat_ary == Bry_.Empty) return;
Evaluate(bfr, ctx, val_dat_ary);
}

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.xowa.xtns.pfuncs.exprs; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
import org.junit.*;
public class Pfunc_expr_tst {
private Xop_fxt fxt = new Xop_fxt();
private final Xop_fxt fxt = new Xop_fxt();
@Before public void init() {fxt.Reset();}
@Test public void Null() {fxt.Test_parse_tmpl_str_test("{{#expr:}}" , "{{test}}" , "");}
@Test public void Num_len1() {fxt.Test_parse_tmpl_str_test("{{#expr:1}}" , "{{test}}" , "1");}

View File

@@ -20,7 +20,7 @@ import gplx.xowa.langs.*; import gplx.xowa.langs.kwds.*;
import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
public class Pfunc_if extends Pf_func_base {
@Override public boolean Func_require_colon_arg() {return true;}
@Override public void Func_evaluate(Xop_ctx ctx, byte[] src, Xot_invk caller, Xot_invk self, Bry_bfr bfr) {
@Override public void Func_evaluate(Bry_bfr bfr, Xop_ctx ctx, Xot_invk caller, Xot_invk self, byte[] src) {
byte[] val = Eval_argx(ctx, src, caller, self);
boolean val_is_empty = true; int val_len = val.length;
for (int i = 0; i < val_len; i++) {

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.xowa.xtns.pfuncs.ifs; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
import org.junit.*;
public class Pfunc_if_tst {
private Xop_fxt fxt = new Xop_fxt();
private final Xop_fxt fxt = new Xop_fxt();
@Before public void init() {fxt.Reset();}
@Test public void If_y() {fxt.Test_parse_tmpl_str_test("{{#if:1|a|b}}" , "{{test}}" , "a");}
@Test public void If_n() {fxt.Test_parse_tmpl_str_test("{{#if:|a|b}}" , "{{test}}" , "b");}

View File

@@ -20,7 +20,7 @@ import gplx.xowa.langs.*; import gplx.xowa.langs.kwds.*;
import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
public class Pfunc_ifeq extends Pf_func_base {
@Override public boolean Func_require_colon_arg() {return true;}
@Override public void Func_evaluate(Xop_ctx ctx, byte[] src, Xot_invk caller, Xot_invk self, Bry_bfr bfr) {
@Override public void Func_evaluate(Bry_bfr bfr, Xop_ctx ctx, Xot_invk caller, Xot_invk self, byte[] src) {
int self_args_len = self.Args_len(); if (self_args_len < 2) return; // no equal/not_equal clauses defined; return; EX: {{#if:a}} {{#if:a|b}}
byte[] lhs = Eval_argx(ctx, src, caller, self);
byte[] rhs = Pf_func_.Eval_arg_or_empty(ctx, src, caller, self, self_args_len, 0);

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.xowa.xtns.pfuncs.ifs; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
import org.junit.*;
public class Pfunc_ifeq_tst {
private Xop_fxt fxt = new Xop_fxt();
private final Xop_fxt fxt = new Xop_fxt();
@Before public void init() {fxt.Reset();}
@Test public void Ifeq_y() {fxt.Test_parse_tmpl_str_test("{{#ifeq:1|1|a|b}}" , "{{test}}" , "a");}

View File

@@ -21,17 +21,17 @@ import gplx.xowa.langs.*; import gplx.xowa.langs.kwds.*;
import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
public class Pfunc_iferror extends Pf_func_base {
@Override public boolean Func_require_colon_arg() {return true;}
@Override public void Func_evaluate(Xop_ctx ctx, byte[] src, Xot_invk caller, Xot_invk self, Bry_bfr bb) {
@Override public void Func_evaluate(Bry_bfr bfr, Xop_ctx ctx, Xot_invk caller, Xot_invk self, byte[] src) {
int self_args_len = self.Args_len();
byte[] val_dat_ary = Eval_argx(ctx, src, caller, self);
if (val_dat_ary == null) return;
if (Error_exists(val_dat_ary))
bb.Add(Pf_func_.Eval_arg_or_empty(ctx, src, caller, self, self_args_len, 0));
byte[] argx = Eval_argx(ctx, src, caller, self);
if (argx == null) return;
if (Error_exists(argx))
bfr.Add(Pf_func_.Eval_arg_or_empty(ctx, src, caller, self, self_args_len, 0));
else {
if (self_args_len < 2) // pass clause absent; add original
bb.Add(val_dat_ary);
bfr.Add(argx);
else
bb.Add(Pf_func_.Eval_arg_or_empty(ctx, src, caller, self, self_args_len, 1));
bfr.Add(Pf_func_.Eval_arg_or_empty(ctx, src, caller, self, self_args_len, 1));
}
}
@Override public int Id() {return Xol_kwd_grp_.Id_xtn_iferror;}

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.xowa.xtns.pfuncs.ifs; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
import org.junit.*;
public class Pfunc_iferror_tst {
private Xop_fxt fxt = new Xop_fxt();
private final Xop_fxt fxt = new Xop_fxt();
@Before public void init() {fxt.Reset();}
@Test public void Basic_pass() {fxt.Test_parse_tmpl_str_test("{{#iferror: {{#expr: 1 + 2 }} | error | ok }}" , "{{test}}" , "ok");}
@Test public void Basic_fail() {fxt.Test_parse_tmpl_str_test("{{#iferror: {{#expr: 1 + X }} | error | ok }}" , "{{test}}" , "error");}

View File

@@ -22,13 +22,13 @@ public class Pfunc_ifexist extends Pf_func_base {
@Override public int Id() {return Xol_kwd_grp_.Id_xtn_iferror;}
@Override public Pf_func New(int id, byte[] name) {return new Pfunc_ifexist().Name_(name);}
@Override public boolean Func_require_colon_arg() {return true;}
@Override public void Func_evaluate(Xop_ctx ctx, byte[] src, Xot_invk caller, Xot_invk self, Bry_bfr rslt_bfr) {
@Override public void Func_evaluate(Bry_bfr bfr, Xop_ctx ctx, Xot_invk caller, Xot_invk self, byte[] src) {
int args_len = self.Args_len();
byte[] val_bry = Eval_argx(ctx, src, caller, self);
if (Exists(ctx.Wiki(), val_bry))
rslt_bfr.Add(Pf_func_.Eval_arg_or_empty(ctx, src, caller, self, args_len, 0));
byte[] argx = Eval_argx(ctx, src, caller, self);
if (Exists(ctx.Wiki(), argx))
bfr.Add(Pf_func_.Eval_arg_or_empty(ctx, src, caller, self, args_len, 0));
else
rslt_bfr.Add(Pf_func_.Eval_arg_or_empty(ctx, src, caller, self, args_len, 1));
bfr.Add(Pf_func_.Eval_arg_or_empty(ctx, src, caller, self, args_len, 1));
}
public static boolean Exists(Xowe_wiki wiki, byte[] ttl_bry) {
synchronized (Mgr) {return Mgr.Exists(wiki, ttl_bry);}

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.xowa.xtns.pfuncs.ifs; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
import org.junit.*; import gplx.xowa.wikis.tdbs.metas.*;
public class Pfunc_ifexist_tst {
private Xop_fxt fxt = new Xop_fxt();
private final Xop_fxt fxt = new Xop_fxt();
@Before public void init() {fxt.Reset();}
@Test public void Basic_pass() {fxt.Test_parse_tmpl_str_test("{{#ifexist: Abc | exists | doesn't exist }}" , "{{test}}" , "doesn't exist");}
@Test public void Empty() {fxt.Test_parse_tmpl_str_test("{{#ifexist:|y|n}}" , "{{test}}" , "n");} // NOTE: {{autolink}} can pass in ""

View File

@@ -20,25 +20,24 @@ import gplx.xowa.xtns.pfuncs.exprs.*;
import gplx.xowa.langs.*; import gplx.xowa.langs.kwds.*;
import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
public class Pfunc_ifexpr extends Pf_func_base {
@Override public int Id() {return Xol_kwd_grp_.Id_xtn_ifexpr;}
@Override public Pf_func New(int id, byte[] name) {return new Pfunc_ifexpr().Name_(name);}
@Override public boolean Func_require_colon_arg() {return true;}
@Override public void Func_evaluate(Xop_ctx ctx, byte[] src, Xot_invk caller, Xot_invk self, Bry_bfr bb) {
@Override public void Func_evaluate(Bry_bfr bfr, Xop_ctx ctx, Xot_invk caller, Xot_invk self, byte[] src) {
int self_args_len = self.Args_len();
byte[] val_dat_ary = Eval_argx(ctx, src, caller, self);
if (val_dat_ary == null) return;
Decimal_adp result = shunter.Evaluate(ctx, val_dat_ary);
byte[] argx = Eval_argx(ctx, src, caller, self); if (argx == null) return;
Decimal_adp result = shunter.Evaluate(ctx, argx);
boolean is_nan = result == Pfunc_expr_shunter.Null_rslt;
if (is_nan && shunter.Err().Len() > 0) {
bb.Add_bfr_and_preserve(shunter.Err());
bfr.Add_bfr_and_preserve(shunter.Err());
shunter.Err().Clear();
}
else {
if (is_nan || result.To_int() == 0)
bb.Add(Pf_func_.Eval_arg_or_empty(ctx, src, caller, self, self_args_len, 1));
bfr.Add(Pf_func_.Eval_arg_or_empty(ctx, src, caller, self, self_args_len, 1));
else
bb.Add(Pf_func_.Eval_arg_or_empty(ctx, src, caller, self, self_args_len, 0));
bfr.Add(Pf_func_.Eval_arg_or_empty(ctx, src, caller, self, self_args_len, 0));
}
}
Pfunc_expr_shunter shunter = Pfunc_expr_shunter.Instance;
@Override public int Id() {return Xol_kwd_grp_.Id_xtn_ifexpr;}
@Override public Pf_func New(int id, byte[] name) {return new Pfunc_ifexpr().Name_(name);}
private final Pfunc_expr_shunter shunter = Pfunc_expr_shunter.Instance;
}

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.xowa.xtns.pfuncs.ifs; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
import org.junit.*;
public class Pfunc_ifexpr_tst {
private Xop_fxt fxt = new Xop_fxt();
private final Xop_fxt fxt = new Xop_fxt();
@Before public void init() {fxt.Reset();}
@Test public void Basic_y() {fxt.Test_parse_tmpl_str_test("{{#ifexpr: 1 > 0 |y|n}}" , "{{test}}" , "y");}
@Test public void Basic_n() {fxt.Test_parse_tmpl_str_test("{{#ifexpr: 1 < 0 |y|n}}" , "{{test}}" , "n");}

View File

@@ -22,7 +22,7 @@ public class Pfunc_switch extends Pf_func_base {
@Override public int Id() {return Xol_kwd_grp_.Id_xtn_switch;}
@Override public Pf_func New(int id, byte[] name) {return new Pfunc_switch().Name_(name);}
@Override public boolean Func_require_colon_arg() {return true;}
@Override public void Func_evaluate(Xop_ctx ctx, byte[] src, Xot_invk caller, Xot_invk self, Bry_bfr bfr) {// REF.MW:ParserFunctions_body.php
@Override public void Func_evaluate(Bry_bfr bfr, Xop_ctx ctx, Xot_invk caller, Xot_invk self, byte[] src) {// REF.MW:ParserFunctions_body.php
int self_args_len = self.Args_len(); if (self_args_len == 0) return; // no cases; return; effectively "empty"
byte[] argx = Eval_argx(ctx, src, caller, self);
boolean fall_thru_found = false;

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.xowa.xtns.pfuncs.ifs; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
import org.junit.*; import gplx.xowa.langs.*; import gplx.xowa.langs.kwds.*;
public class Pfunc_switch_tst {
@Before public void init() {fxt.Reset();} private Xop_fxt fxt = new Xop_fxt();
@Before public void init() {fxt.Reset();} private final Xop_fxt fxt = new Xop_fxt();
@Test public void Basic_a() {fxt.Test_parse_tmpl_str_test("{{#switch:a|a=1|b=2|3}}" , "{{test}}" , "1");}
@Test public void Basic_b() {fxt.Test_parse_tmpl_str_test("{{#switch:b|a=1|b=2|3}}" , "{{test}}" , "2");}
@Test public void Basic_dflt() {fxt.Test_parse_tmpl_str_test("{{#switch:z|a=1|b=2|3}}" , "{{test}}" , "3");}

View File

@@ -19,7 +19,7 @@ package gplx.xowa.xtns.pfuncs.ifs; import gplx.*; import gplx.xowa.*; import gpl
import gplx.xowa.langs.*; import gplx.xowa.langs.kwds.*;
import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
public class Xop_xowa_dbg extends Pf_func_base {
@Override public void Func_evaluate(Xop_ctx ctx, byte[] src, Xot_invk caller, Xot_invk self, Bry_bfr bfr) {
@Override public void Func_evaluate(Bry_bfr bfr, Xop_ctx ctx, Xot_invk caller, Xot_invk self, byte[] src) {
byte[] argx = Eval_argx(ctx, src, caller, self);
bfr.Add(argx);
Argx_list.Add(argx);

View File

@@ -23,7 +23,7 @@ public class Pfunc_gender extends Pf_func_base {
@Override public int Id() {return Xol_kwd_grp_.Id_i18n_gender;}
@Override public boolean Func_require_colon_arg() {return true;}
@Override public Pf_func New(int id, byte[] name) {return new Pfunc_gender().Name_(name);}
@Override public void Func_evaluate(Xop_ctx ctx, byte[] src, Xot_invk caller, Xot_invk self, Bry_bfr bfr) {
@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();

View File

@@ -22,7 +22,7 @@ public class Pfunc_grammar extends Pf_func_base {
@Override public int Id() {return Xol_kwd_grp_.Id_i18n_grammar;}
@Override public boolean Func_require_colon_arg() {return true;}
@Override public Pf_func New(int id, byte[] name) {return new Pfunc_grammar().Name_(name);} // NOTE: odmiana used as magic-word / template in pl.d; EX:pl.d:hund; DATE:2014-08-14
@Override public void Func_evaluate(Xop_ctx ctx, byte[] src, Xot_invk caller, Xot_invk self, Bry_bfr bfr) {
@Override public void Func_evaluate(Bry_bfr bfr, Xop_ctx ctx, Xot_invk caller, Xot_invk self, byte[] src) {
byte[] argx = Eval_argx(ctx, src, caller, self);
byte[] word = Pf_func_.Eval_arg_or_empty(ctx, src, caller, self, self.Args_len(), 0);
Xol_lang_itm lang = ctx.Cur_page().Lang();

View File

@@ -22,7 +22,7 @@ import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
public class Pfunc_int extends Pf_func_base {
@Override public int Id() {return Xol_kwd_grp_.Id_i18n_int;}
@Override public boolean Func_require_colon_arg() {return true;}
@Override public void Func_evaluate(Xop_ctx ctx, byte[] src, Xot_invk caller, Xot_invk self, Bry_bfr bfr) {
@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);
Xowe_wiki wiki = ctx.Wiki();
Xol_lang_itm page_lang = ctx.Cur_page().Lang();

View File

@@ -21,7 +21,7 @@ import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
public class Pfunc_language extends Pf_func_base {
@Override public int Id() {return Xol_kwd_grp_.Id_i18n_language;}
@Override public Pf_func New(int id, byte[] name) {return new Pfunc_language().Name_(name);}
@Override public void Func_evaluate(Xop_ctx ctx, byte[] src, Xot_invk caller, Xot_invk self, Bry_bfr bfr) {
@Override public void Func_evaluate(Bry_bfr bfr, Xop_ctx ctx, Xot_invk caller, Xot_invk self, byte[] src) {
byte[] argx = Eval_argx(ctx, src, caller, self);
Hash_adp_bry regy = Xol_lang_stub_.Regy();
if (argx.length == 0) return; // {{#language:}} should return ""; note that byte[0] will fail in Match_exact

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.xowa.xtns.pfuncs.langs; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
import org.junit.*;
public class Pfunc_language_tst {
private Xop_fxt fxt = new Xop_fxt();
private final Xop_fxt fxt = new Xop_fxt();
@Before public void init() {fxt.Reset();}
@Test public void English() {fxt.Test_parse_tmpl_str_test("{{#language:en}}" , "{{test}}" , "English");}
@Test public void English_case() {fxt.Test_parse_tmpl_str_test("{{#language:eN}}" , "{{test}}" , "English");}

View File

@@ -20,7 +20,7 @@ import gplx.xowa.langs.*; import gplx.xowa.langs.kwds.*;
import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
public class Pfunc_plural extends Pf_func_base {
@Override public boolean Func_require_colon_arg() {return true;}
@Override public void Func_evaluate(Xop_ctx ctx, byte[] src, Xot_invk caller, Xot_invk self, Bry_bfr bfr) {// REF.MW: CoreParserFunctions.php
@Override public void Func_evaluate(Bry_bfr bfr, Xop_ctx ctx, Xot_invk caller, Xot_invk self, byte[] src) {// REF.MW: CoreParserFunctions.php
byte[] number = Eval_argx(ctx, src, caller, self);
int self_args_len = self.Args_len();
int arg_idx = Pf_func_.Eq_(number, Ary_Num_1) ? 0 : 1;

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.xowa.xtns.pfuncs.langs; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
import org.junit.*;
public class Pfunc_plural_tst {
private Xop_fxt fxt = new Xop_fxt();
private final Xop_fxt fxt = new Xop_fxt();
@Before public void init() {fxt.Reset();}
@Test public void Singular() {fxt.Test_parse_tmpl_str_test("{{plural:1|wiki|wikis}}" , "{{test}}" , "wiki");}
@Test public void Plural() {fxt.Test_parse_tmpl_str_test("{{plural:2|wiki|wikis}}" , "{{test}}" , "wikis");}

View File

@@ -23,7 +23,7 @@ public class Pf_formatnum extends Pf_func_base {
@Override public int Id() {return Xol_kwd_grp_.Id_str_formatnum;}
@Override public Pf_func New(int id, byte[] name) {return new Pf_formatnum().Name_(name);}
@Override public boolean Func_require_colon_arg() {return true;}
@Override public void Func_evaluate(Xop_ctx ctx, byte[] src, Xot_invk caller, Xot_invk self, Bry_bfr bfr) {
@Override public void Func_evaluate(Bry_bfr bfr, Xop_ctx ctx, Xot_invk caller, Xot_invk self, byte[] src) {
Xol_lang_itm lang = ctx.Wiki().Lang();
int self_args_len = self.Args_len();
byte[] argx = Eval_argx(ctx, src, caller, self);

View File

@@ -19,7 +19,7 @@ package gplx.xowa.xtns.pfuncs.numbers; import gplx.*; import gplx.xowa.*; import
import org.junit.*;
import gplx.core.intls.*; import gplx.xowa.langs.numbers.*;
public class Pf_formatnum_de_tst {
private Xop_fxt fxt = new Xop_fxt();
private final Xop_fxt fxt = new Xop_fxt();
@Before public void init() {
fxt.Reset();
fxt.Init_lang_numbers_separators(".", ",");

View File

@@ -19,7 +19,7 @@ package gplx.xowa.xtns.pfuncs.numbers; import gplx.*; import gplx.xowa.*; import
import org.junit.*;
import gplx.core.intls.*;
public class Pf_formatnum_en_tst {
private Xop_fxt fxt = new Xop_fxt();
private final Xop_fxt fxt = new Xop_fxt();
@Before public void init() {fxt.Reset();}
@Test public void Len_4() {fxt.Test_parse_tmpl_str_test("{{formatnum:1234}}" , "{{test}}" , "1,234");}
@Test public void Len_7() {fxt.Test_parse_tmpl_str_test("{{formatnum:1234567}}" , "{{test}}" , "1,234,567");}

Some files were not shown because too many files have changed in this diff Show More