mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
v2.9.3.1
This commit is contained in:
@@ -52,7 +52,7 @@ public abstract class Xox_mgr_base implements Xox_mgr {
|
||||
Xox_mgr_base.Xtn_write_escape(app, bfr, src, xnde.Tag_open_end(), xnde.Tag_close_bgn());
|
||||
break;
|
||||
case Parse_content_tid_html:
|
||||
bfr.Add(ctx.Wiki().Parser().Parse_text_to_html(ctx, Bry_.Mid(src, xnde.Tag_open_end(), xnde.Tag_close_bgn())));
|
||||
bfr.Add(ctx.Wiki().Parser_mgr().Main().Parse_text_to_html(ctx, Bry_.Mid(src, xnde.Tag_open_end(), xnde.Tag_close_bgn())));
|
||||
break;
|
||||
case Parse_content_tid_none: default:
|
||||
break;
|
||||
|
||||
@@ -139,7 +139,7 @@ class Xoh_ref_list_fmtr implements Bry_fmtr_arg {
|
||||
byte[] backlabel
|
||||
= itm_idx_minor < cfg.Backlabels_len()
|
||||
? cfg.Backlabels()[itm.Idx_minor()]
|
||||
: wiki.Parser().Parse_text_to_html(wiki.Ctx(), wiki.Msg_mgr().Val_by_key_args(Ref_html_wtr_cfg.Msg_backlabels_err, itm.Idx_minor()))
|
||||
: wiki.Parser_mgr().Main().Parse_text_to_html(wiki.Parser_mgr().Ctx(), wiki.Msg_mgr().Val_by_key_args(Ref_html_wtr_cfg.Msg_backlabels_err, itm.Idx_minor()))
|
||||
;
|
||||
itm_fmtr.Bld_bfr_many(trg
|
||||
, fmtr.Atrs_(cfg.Itm_id_key_one(), itm.Name(), itm.Idx_major(), itm.Idx_minor())
|
||||
|
||||
@@ -16,7 +16,7 @@ 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.*;
|
||||
import org.junit.*;
|
||||
import org.junit.*; import gplx.core.tests.*;
|
||||
public class Ref_itm_mgr_tst {
|
||||
Ref_itm_mgr_fxt fxt = new Ref_itm_mgr_fxt();
|
||||
@Before public void init() {fxt.Clear();}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class Ref_nde implements Xox_xnde, Xop_xnde_atr_parser {
|
||||
if (ctx.Tid_is_popup()) return;
|
||||
Xop_xatr_itm.Xatr_parse(wiki.Appe(), this, xatrs_hash, wiki, src, xnde);
|
||||
if (xnde.CloseMode() == Xop_xnde_tkn.CloseMode_pair)
|
||||
body = wiki.Parser().Parse_text_to_wdom_old_ctx(ctx, Bry_.Mid(src, xnde.Tag_open_end(), xnde.Tag_close_bgn()), false);
|
||||
body = wiki.Parser_mgr().Main().Parse_text_to_wdom_old_ctx(ctx, Bry_.Mid(src, xnde.Tag_open_end(), xnde.Tag_close_bgn()), false);
|
||||
byte[] references_group = ctx.References_group(); // set by <references>
|
||||
if (references_group != null) {
|
||||
group = references_group; // override <ref group> with <references group>; note that MW throws an error if nested <ref> has different group than outer <references>; Cite error: <ref> tag in <references> has conflicting group attribute "a".
|
||||
|
||||
@@ -44,7 +44,7 @@ public class References_nde implements Xox_xnde, Xop_xnde_atr_parser {
|
||||
Xop_root_tkn sub_root = tkn_mkr.Root(src);
|
||||
boolean prv_recursing = ref_mgr.References__recursing();
|
||||
ref_mgr.References__recursing_(true);
|
||||
wiki.Parser().Parse_text_to_wdom(sub_root, references_ctx, tkn_mkr, references_src, Xop_parser_.Doc_bgn_char_0); // NOTE: parse inner contents, but root will be discarded; only picking up <ref> tags; DATE:2014-06-27
|
||||
wiki.Parser_mgr().Main().Parse_text_to_wdom(sub_root, references_ctx, tkn_mkr, references_src, Xop_parser_.Doc_bgn_char_0); // NOTE: parse inner contents, but root will be discarded; only picking up <ref> tags; DATE:2014-06-27
|
||||
ref_mgr.References__recursing_(prv_recursing);
|
||||
}
|
||||
list_idx = ref_mgr.Grps_get(group).Grp_seal(); // NOTE: needs to be sealed at end; else inner refs will end up in new group; EX: <references><ref>don't seal prematurely</ref></references>
|
||||
|
||||
@@ -17,8 +17,9 @@ 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.html.*; import gplx.xowa.html.*;
|
||||
import gplx.langs.htmls.*; import gplx.xowa.html.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.xndes.*;
|
||||
import gplx.xowa.nss.*;
|
||||
class Dpl_itm {
|
||||
public List_adp Ctg_includes() {return ctg_includes;} private List_adp ctg_includes;
|
||||
public List_adp Ctg_excludes() {return ctg_excludes;} private List_adp ctg_excludes;
|
||||
@@ -65,7 +66,7 @@ class Dpl_itm {
|
||||
key_id = Dpl_itm_keys.Parse(src, fld_bgn, fld_end, Dpl_itm_keys.Key_null);
|
||||
if (key_id == Dpl_itm_keys.Key_null) { // unknown key; warn and set pos to end of line; EX: "unknown=";
|
||||
Parse_missing_key(usr_dlg, page_ttl, src, fld_bgn, fld_end);
|
||||
fld_bgn = Bry_finder.Find_fwd(src, Byte_ascii.Nl, pos);
|
||||
fld_bgn = Bry_find_.Find_fwd(src, Byte_ascii.Nl, pos);
|
||||
if (fld_bgn == Bry_.NotFound) loop = false;
|
||||
}
|
||||
else { // known key; set pos to val_bgn
|
||||
@@ -96,7 +97,7 @@ class Dpl_itm {
|
||||
private static final byte Dlm_fld = Byte_ascii.Eq, Dlm_row = Byte_ascii.Nl;
|
||||
public void Parse_cmd(Xowe_wiki wiki, byte key_id, byte[] val) {
|
||||
sub_root.Clear();
|
||||
val = wiki.Parser().Parse_text_to_wtxt(sub_root, sub_ctx, sub_tkn_mkr, val);
|
||||
val = wiki.Parser_mgr().Main().Parse_text_to_wtxt(sub_root, sub_ctx, sub_tkn_mkr, val);
|
||||
switch (key_id) {
|
||||
case Dpl_itm_keys.Key_category: if (ctg_includes == null) ctg_includes = List_adp_.new_(); ctg_includes.Add(Xoa_ttl.Replace_spaces(val)); break;
|
||||
case Dpl_itm_keys.Key_notcategory: if (ctg_excludes == null) ctg_excludes = List_adp_.new_(); ctg_excludes.Add(Xoa_ttl.Replace_spaces(val)); break;
|
||||
|
||||
@@ -16,7 +16,7 @@ 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.dynamicPageList; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import org.junit.*; import gplx.core.strings.*;
|
||||
import org.junit.*; import gplx.core.strings.*; import gplx.xowa.cfgs.*; import gplx.xowa.nss.*;
|
||||
public class Dpl_xnde_tst {
|
||||
private Dpl_xnde_fxt fxt = new Dpl_xnde_fxt();
|
||||
@Before public void init() {fxt.Clear();}
|
||||
|
||||
@@ -16,6 +16,7 @@ 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.flaggedRevs; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.xowa.langs.*;
|
||||
import gplx.xowa.html.*; import gplx.xowa.pages.skins.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
|
||||
public class Pages_using_pending_changes_func extends Pf_func_base {
|
||||
|
||||
@@ -16,6 +16,7 @@ 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.flaggedRevs; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.xowa.langs.*;
|
||||
import gplx.xowa.html.*; import gplx.xowa.pages.skins.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
|
||||
public class Pending_change_level_func extends Pf_func_base {
|
||||
|
||||
@@ -16,7 +16,7 @@ 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.html.*; import gplx.xowa.html.hdumps.abrvs.*;
|
||||
import gplx.langs.htmls.*; import gplx.xowa.html.hdumps.abrvs.*;
|
||||
public interface Gallery_box_w_fmtr_arg extends Bry_fmtr_arg {
|
||||
Gallery_box_w_fmtr_arg Init(int uid, int width);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@ 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.*; import gplx.core.btries.*;
|
||||
import gplx.xowa.langs.*;
|
||||
import gplx.xowa.nss.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.lnkis.*; import gplx.xowa.parsers.lnkis.redlinks.*; import gplx.xowa.parsers.tmpls.*;
|
||||
import gplx.xowa.files.*;
|
||||
public class Gallery_itm_parser {
|
||||
@@ -30,7 +32,7 @@ public class Gallery_itm_parser {
|
||||
private Xop_ctx ctx;
|
||||
public Gallery_itm_parser Init_by_wiki(Xowe_wiki wiki) {
|
||||
this.wiki = wiki; Xol_lang lang = wiki.Lang();
|
||||
this.ctx = wiki.Ctx();
|
||||
this.ctx = wiki.Parser_mgr().Ctx();
|
||||
trie.Clear();
|
||||
Byte_obj_ref tmp_bref = Byte_obj_ref.zero_();
|
||||
Init_keyword(tmp_bref, lang, Xol_kwd_grp_.Id_img_alt, Fld_alt); // NOTE: MW uses "gallery-@gplx.Internal protected-alt" which just maps to "img-alt"
|
||||
@@ -72,7 +74,7 @@ public class Gallery_itm_parser {
|
||||
}
|
||||
byte[] lnki_caption = cur_itm.Caption_bry();
|
||||
if (Bry_.Len_gt_0(lnki_caption)) {
|
||||
Xop_root_tkn caption_tkn = wiki.Parser().Parse_text_to_wdom_old_ctx(ctx, lnki_caption, true);
|
||||
Xop_root_tkn caption_tkn = wiki.Parser_mgr().Main().Parse_text_to_wdom_old_ctx(ctx, lnki_caption, true);
|
||||
cur_itm.Caption_tkn_(caption_tkn);
|
||||
}
|
||||
Xopg_redlink_logger file_wkr = ctx.Lnki().File_wkr(); // NOTE: do not set file_wkr ref early (as member var); parse_all sets late
|
||||
@@ -162,7 +164,7 @@ public class Gallery_itm_parser {
|
||||
private void Fld_end() {
|
||||
int fld_end = cur_pos;
|
||||
if (cur_fld != Fld_caption) {
|
||||
int non_ws_pos = Bry_finder.Find_bwd_non_ws_or_not_found(src, cur_pos - 1, itm_bgn) + 1; // SEE:non_ws_pos
|
||||
int non_ws_pos = Bry_find_.Find_bwd_non_ws_or_not_found(src, cur_pos - 1, itm_bgn) + 1; // SEE:non_ws_pos
|
||||
if (non_ws_pos != Bry_.NotFound + 1)
|
||||
fld_end = non_ws_pos;
|
||||
}
|
||||
@@ -239,7 +241,7 @@ public class Gallery_itm_parser {
|
||||
}
|
||||
/*
|
||||
SEE:non_ws_pos;
|
||||
int non_ws_pos = Bry_finder.Find_bwd_non_ws(src, cur_pos - 1, itm_bgn) + 1;
|
||||
int non_ws_pos = Bry_find_.Find_bwd_non_ws(src, cur_pos - 1, itm_bgn) + 1;
|
||||
. -1 to start before cur_pos (which is usually pipe);
|
||||
. +1 to place after non_ws_char
|
||||
EX: text="b c |"; cur_pos = 4;
|
||||
|
||||
@@ -16,7 +16,7 @@ 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 org.junit.*;
|
||||
import org.junit.*; import gplx.xowa.langs.*;
|
||||
public class Gallery_itm_parser_tst {
|
||||
@Before public void init() {fxt.Init();} private Gallery_itm_parser_fxt fxt = new Gallery_itm_parser_fxt();
|
||||
@Test public void All() {fxt.Test_parse("File:A.png|a|alt=b|link=c" , fxt.Expd("File:A.png", "a" , "b" , "c"));}
|
||||
|
||||
@@ -16,7 +16,7 @@ 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.html.*; import gplx.xowa.html.*; import gplx.xowa.html.modules.*; import gplx.xowa.files.*; import gplx.xowa.html.hdumps.abrvs.*; import gplx.xowa.html.hdumps.core.*;
|
||||
import gplx.langs.htmls.*; import gplx.xowa.html.*; import gplx.xowa.html.modules.*; import gplx.xowa.files.*; import gplx.xowa.html.hdumps.abrvs.*; import gplx.xowa.html.hdumps.core.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.xndes.*; import gplx.xowa.parsers.lnkis.*;
|
||||
public abstract class Gallery_mgr_base {
|
||||
private Gallery_box_w_fmtr_arg__basic box_w_fmtr__basic = new Gallery_box_w_fmtr_arg__basic(); private Gallery_box_w_fmtr_arg__hdump box_w_fmtr__hdump = new Gallery_box_w_fmtr_arg__hdump();
|
||||
@@ -145,7 +145,7 @@ public abstract class Gallery_mgr_base {
|
||||
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;
|
||||
itm_li_bgn_fmtr.Bld_bfr_many(bfr, gallery_li_id, box_w_fmtr_arg.Init(img_uid, itm_div_width));
|
||||
bfr.Add(itm_html);
|
||||
wiki.Parser().Parse_text_to_html(tmp_bfr, page, true, itm_caption);
|
||||
wiki.Parser_mgr().Main().Parse_text_to_html(tmp_bfr, page, true, itm_caption);
|
||||
itm_caption = tmp_bfr.Xto_bry_and_clear();
|
||||
itm_caption = tmp_bfr.Add(show_filenames_link).Add(itm_caption).Xto_bry_and_clear();
|
||||
Wrap_gallery_text(bfr, itm_caption, html_w_expand, html_h_expand);
|
||||
|
||||
@@ -16,7 +16,7 @@ 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 org.junit.*; import gplx.xowa.parsers.xndes.*; import gplx.xowa.wikis.ttls.*;
|
||||
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;
|
||||
@Before public void init() {fxt.Reset(); fxt.Wiki().Xtn_mgr().Init_by_wiki(fxt.Wiki());}
|
||||
|
||||
@@ -17,6 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.xtns.geoCrumbs; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.xowa.langs.*;
|
||||
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;}
|
||||
@@ -27,7 +28,7 @@ public class Geoc_isin_func extends Pf_func_base {
|
||||
Xoa_ttl ttl = Xoa_ttl.parse(wiki, ttl_bry); if (ttl == null) return;
|
||||
byte[] lnki_ttl = Bry_.Add(Xop_tkn_.Lnki_bgn, ttl_bry, Xop_tkn_.Lnki_end); // make "[[ttl]]"
|
||||
Bry_bfr tmp_bfr = wiki.Utl__bfr_mkr().Get_b128();
|
||||
wiki.Parser().Parse_text_to_html(tmp_bfr, ctx.Cur_page(), false, lnki_ttl);
|
||||
wiki.Parser_mgr().Main().Parse_text_to_html(tmp_bfr, ctx.Cur_page(), false, lnki_ttl);
|
||||
ctx.Cur_page().Html_data().Content_sub_(tmp_bfr.To_bry_and_rls());
|
||||
}
|
||||
public static final Geoc_isin_func _ = new Geoc_isin_func();
|
||||
|
||||
@@ -17,6 +17,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 gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.xowa.langs.*;
|
||||
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
|
||||
|
||||
@@ -16,7 +16,7 @@ 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.hieros; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.srls.dsvs.*;
|
||||
import gplx.langs.dsvs.*;
|
||||
class Hiero_file_mgr implements GfoInvkAble {
|
||||
private Ordered_hash hash = Ordered_hash_.new_bry_();
|
||||
private Hiero_file_srl srl;
|
||||
|
||||
@@ -16,7 +16,7 @@ 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.hieros; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.html.*; import gplx.xowa.html.*;
|
||||
import gplx.langs.htmls.*; import gplx.xowa.html.*;
|
||||
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;
|
||||
|
||||
@@ -16,7 +16,7 @@ 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.hieros; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.html.*; import gplx.xowa.html.*;
|
||||
import gplx.langs.htmls.*; import gplx.xowa.html.*;
|
||||
class Hiero_html_wtr {
|
||||
private Hiero_phoneme_mgr phoneme_mgr;
|
||||
private Bry_bfr temp_bfr = Bry_bfr.reset_(255);
|
||||
|
||||
@@ -17,7 +17,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.xtns.hieros; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.core.primitives.*;
|
||||
import gplx.php.*; import gplx.srls.dsvs.*;
|
||||
import gplx.langs.phps.*; import gplx.langs.dsvs.*;
|
||||
import gplx.xowa.apps.gfss.*;
|
||||
public class Hiero_mw_tables_parser {
|
||||
private Php_parser parser = new Php_parser(); private Php_evaluator evaluator;
|
||||
private Php_text_itm_parser quote_parser = new Php_text_itm_parser();
|
||||
|
||||
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.xtns.hieros; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import org.junit.*;
|
||||
import gplx.intl.*;
|
||||
import gplx.core.intls.*;
|
||||
public class Hiero_mw_tables_parser_tst {
|
||||
@Before public void init() {fxt.Reset();} private Hiero_mw_tables_parser_fxt fxt = new Hiero_mw_tables_parser_fxt();
|
||||
@Test public void Basic() {// DATE:2014-04-19
|
||||
|
||||
@@ -16,7 +16,7 @@ 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.hieros; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.core.btries.*; import gplx.html.*; import gplx.xowa.html.*;
|
||||
import gplx.core.btries.*; import gplx.langs.htmls.*; import gplx.xowa.html.*;
|
||||
class Hiero_parser {
|
||||
private Btrie_slim_mgr trie = Btrie_slim_mgr.cs();
|
||||
private List_adp blocks = List_adp_.new_();
|
||||
@@ -40,8 +40,8 @@ class Hiero_parser {
|
||||
int new_pos = trie.Match_pos();
|
||||
switch (itm.Tid()) {
|
||||
case Hiero_parser_itm.Tid_comment:
|
||||
int end_comm = Bry_finder.Find_fwd(src, Html_tag_.Comm_end, new_pos, end);
|
||||
if (end_comm == Bry_finder.Not_found) // --> not found; for now, ignore <!--
|
||||
int end_comm = Bry_find_.Find_fwd(src, Html_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;
|
||||
|
||||
@@ -16,7 +16,7 @@ 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.hieros; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.srls.dsvs.*;
|
||||
import gplx.langs.dsvs.*;
|
||||
class Hiero_phoneme_mgr implements GfoInvkAble {
|
||||
private Ordered_hash hash = Ordered_hash_.new_bry_();
|
||||
private Hiero_phoneme_srl srl;
|
||||
|
||||
@@ -16,7 +16,7 @@ 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.hieros; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.srls.dsvs.*;
|
||||
import gplx.langs.dsvs.*;
|
||||
class Hiero_prefab_mgr implements GfoInvkAble {
|
||||
private Ordered_hash hash = Ordered_hash_.new_bry_();
|
||||
private Hiero_prefab_srl srl;
|
||||
|
||||
@@ -44,7 +44,7 @@ class Imap_desc_tid {
|
||||
private static byte[][] Parse_lang_types(Xowe_wiki wiki) {
|
||||
byte[] val = wiki.Msg_mgr().Val_by_key_obj("imagemap_desc_types");
|
||||
if (Bry_.Len_eq_0(val)) return null; // no msg in lang; return;
|
||||
byte[][] ary = Bry_.Split(val, Byte_ascii.Comma); // msg is 5 words concatenated by comma: EX:top-right,bottom-right-bottom-left,top-left,none
|
||||
byte[][] ary = Bry_split_.Split(val, Byte_ascii.Comma); // msg is 5 words concatenated by comma: EX:top-right,bottom-right-bottom-left,top-left,none
|
||||
int ary_len = ary.length;
|
||||
if (ary_len != 5) wiki.Appe().Usr_dlg().Warn_many("", "", "imap_desc does not have 5 items; wiki=~{0} val=~{1}", wiki.Domain_bry(), val);
|
||||
for (int i = 0; i < 5; ++i)
|
||||
|
||||
@@ -39,7 +39,7 @@ class Imap_link_owner_ {
|
||||
}
|
||||
case Xop_tkn_itm_.Tid_lnke: {
|
||||
Xop_lnke_tkn lnke = (Xop_lnke_tkn)tkn;
|
||||
Xop_ctx ctx = wiki.Ctx();
|
||||
Xop_ctx ctx = wiki.Parser_mgr().Ctx();
|
||||
int lnke_bgn = lnke.Lnke_bgn(), lnke_end = lnke.Lnke_end(); boolean proto_is_xowa = lnke.Proto_tid() == Gfo_protocol_itm.Tid_xowa;
|
||||
Xoh_lnke_wtr lnke_wtr = wiki.Html_mgr().Html_wtr().Lnke_wtr();
|
||||
lnke_wtr.Write_href(bfr, ctx, src, lnke, lnke_bgn, lnke_end, proto_is_xowa);
|
||||
|
||||
@@ -31,10 +31,10 @@ class Imap_parser {
|
||||
public Imap_parser(Imap_xtn_mgr xtn_mgr) {this.xtn_mgr = xtn_mgr;}
|
||||
public void Init(Xowe_wiki wiki, Xoa_url page_url, Gfo_usr_dlg usr_dlg) {
|
||||
this.app = wiki.Appe(); this.wiki = wiki; this.page_url = page_url; this.usr_dlg = usr_dlg;
|
||||
this.wiki_ctx = wiki.Ctx();
|
||||
this.wiki_ctx = wiki.Parser_mgr().Ctx();
|
||||
if (imap_ctx == null) {
|
||||
imap_ctx = Xop_ctx.new_(wiki);
|
||||
imap_root = app.Tkn_mkr().Root(Bry_.Empty);
|
||||
imap_root = app.Parser_mgr().Tkn_mkr().Root(Bry_.Empty);
|
||||
}
|
||||
}
|
||||
public void Clear() {
|
||||
@@ -54,11 +54,11 @@ class Imap_parser {
|
||||
itm_bgn = src_bgn; itm_end = src_bgn - 1;
|
||||
while (true) {
|
||||
if (itm_end == src_end) break;
|
||||
itm_bgn = Bry_finder.Trim_fwd_space_tab(src, itm_end + 1, src_end); // trim ws at start, and look for first char
|
||||
itm_bgn = Bry_find_.Trim_fwd_space_tab(src, itm_end + 1, src_end); // trim ws at start, and look for first char
|
||||
if (itm_bgn == src_end) break; // line is entirely ws and terminated by eos; EX: "\n EOS"
|
||||
itm_end = Bry_finder.Find_fwd_until(src, itm_bgn, src_end, Byte_ascii.Nl); // look for \n
|
||||
if (itm_end == Bry_finder.Not_found) itm_end = src_end; // no \n; make EOS = \n
|
||||
itm_end = Bry_finder.Trim_bwd_space_tab(src, itm_end, itm_bgn); // trim any ws at end
|
||||
itm_end = Bry_find_.Find_fwd_until(src, itm_bgn, src_end, Byte_ascii.Nl); // look for \n
|
||||
if (itm_end == Bry_find_.Not_found) itm_end = src_end; // no \n; make EOS = \n
|
||||
itm_end = Bry_find_.Trim_bwd_space_tab(src, itm_end, itm_bgn); // trim any ws at end
|
||||
if (itm_end - itm_bgn == 0) continue; // line is entirely ws; continue;
|
||||
byte b = src[itm_bgn];
|
||||
if (b == Byte_ascii.Hash) {
|
||||
@@ -92,7 +92,7 @@ class Imap_parser {
|
||||
private boolean Parse_desc(int itm_bgn, int itm_end) {
|
||||
xtn_mgr.Desc_assert();
|
||||
Btrie_slim_mgr trie = xtn_mgr.Desc_trie();
|
||||
byte tid_desc = Imap_desc_tid.parse(trie, src, Bry_finder.Trim_fwd_space_tab(src, itm_bgn, itm_end), Bry_finder.Trim_bwd_space_tab(src, itm_bgn, itm_end));
|
||||
byte tid_desc = Imap_desc_tid.parse(trie, src, Bry_find_.Trim_fwd_space_tab(src, itm_bgn, itm_end), Bry_find_.Trim_bwd_space_tab(src, itm_bgn, itm_end));
|
||||
switch (tid_desc) {
|
||||
case Imap_desc_tid.Tid_null: return Add_err(Bool_.N, itm_bgn, itm_end, "imagemap_invalid_coord");
|
||||
case Imap_desc_tid.Tid_none: return true;
|
||||
@@ -107,8 +107,8 @@ class Imap_parser {
|
||||
}
|
||||
private boolean Parse_shape(byte shape_tid, int tid_end_pos, int itm_bgn, int itm_end, int reqd_pts) {
|
||||
boolean shape_is_poly = shape_tid == Imap_itm_.Tid_shape_poly;
|
||||
int pos = Bry_finder.Trim_fwd_space_tab(src, tid_end_pos, itm_end); // gobble any leading spaces
|
||||
int grp_end = Bry_finder.Find_fwd(src, Byte_ascii.Brack_bgn, pos, itm_end); // find first "["; note that this is a lazy way of detecting start of lnki / lnke; MW has complicated regex, but hopefully this will be enough; DATE:2014-10-22
|
||||
int pos = Bry_find_.Trim_fwd_space_tab(src, tid_end_pos, itm_end); // gobble any leading spaces
|
||||
int grp_end = Bry_find_.Find_fwd(src, Byte_ascii.Brack_bgn, pos, itm_end); // find first "["; note that this is a lazy way of detecting start of lnki / lnke; MW has complicated regex, but hopefully this will be enough; DATE:2014-10-22
|
||||
if (grp_end == -1) {return Add_err(Bool_.Y, itm_bgn, itm_end, "imap_No valid link was found");}
|
||||
int num_bgn = -1, comma_pos = -1, pts_len = 0;
|
||||
while (true) {
|
||||
@@ -150,7 +150,7 @@ class Imap_parser {
|
||||
else {
|
||||
if (pts_len < reqd_pts) return Add_err(Bool_.Y, itm_bgn, itm_end, "imagemap_missing_coord");
|
||||
}
|
||||
pos = Bry_finder.Trim_fwd_space_tab(src, pos, itm_end);
|
||||
pos = Bry_find_.Trim_fwd_space_tab(src, pos, itm_end);
|
||||
Imap_itm_shape shape_itm = new Imap_itm_shape(shape_tid, (Double_obj_val[])pts.To_ary_and_clear(Double_obj_val.class));
|
||||
Init_link_owner(shape_itm, src, pos, itm_end);
|
||||
shapes.Add(shape_itm);
|
||||
@@ -172,7 +172,7 @@ class Imap_parser {
|
||||
private Xop_tkn_itm Parse_link(byte[] raw) {
|
||||
imap_root.Clear();
|
||||
imap_ctx.Clear();
|
||||
wiki.Parser().Parse_text_to_wdom(imap_root, imap_ctx, wiki.Appe().Tkn_mkr(), raw, 0);
|
||||
wiki.Parser_mgr().Main().Parse_text_to_wdom(imap_root, imap_ctx, wiki.Appe().Parser_mgr().Tkn_mkr(), raw, 0);
|
||||
int subs_len = imap_root.Subs_len();
|
||||
for (int i = 0; i < subs_len; ++i) {
|
||||
Xop_tkn_itm sub = imap_root.Subs_get(i);
|
||||
@@ -185,7 +185,7 @@ class Imap_parser {
|
||||
return null;
|
||||
}
|
||||
private int Parse_img(Imap_map imap, int itm_bgn, int itm_end, int src_end) {
|
||||
int img_bgn = Bry_finder.Trim_fwd_space_tab(src, itm_bgn, itm_end); // trim ws
|
||||
int img_bgn = Bry_find_.Trim_fwd_space_tab(src, itm_bgn, itm_end); // trim ws
|
||||
int img_end = Parse_img__get_img_end(itm_end, src_end);
|
||||
imap_img_src = Bry_.Add(Xop_tkn_.Lnki_bgn, Bry_.Mid(src, img_bgn, img_end), Xop_tkn_.Lnki_end);
|
||||
Xop_tkn_itm tkn_itm = Parse_link(imap_img_src); // NOTE: need to parse before imap_root.Data_mid() below
|
||||
@@ -208,7 +208,7 @@ class Imap_parser {
|
||||
int rv = line_end;
|
||||
int pos = line_end + 1;
|
||||
while (pos < src_end) {
|
||||
pos = Bry_finder.Trim_fwd_space_tab(src, pos, src_end); // trim ws
|
||||
pos = Bry_find_.Trim_fwd_space_tab(src, pos, src_end); // trim ws
|
||||
if (pos == src_end) break;
|
||||
byte b = src[pos];
|
||||
if (b == Byte_ascii.Nl) // new-line; end
|
||||
@@ -217,8 +217,8 @@ class Imap_parser {
|
||||
Object tid_obj = tid_trie.Match_bgn_w_byte(b, src, pos, src_end);
|
||||
if (tid_obj == null) { // not a known imap line; assume continuation of img line and skip to next line
|
||||
imap_ctx.Wiki().Appe().Usr_dlg().Note_many("", "", "image_map extending image over multiple lines; page=~{0} imageMap=~{1}", String_.new_u8(imap_ctx.Cur_page().Ttl().Full_txt()), String_.new_u8(imap_img_src));
|
||||
int next_line = Bry_finder.Find_fwd(src, Byte_ascii.Nl, pos);
|
||||
if (next_line == Bry_finder.Not_found) next_line = src_end;
|
||||
int next_line = Bry_find_.Find_fwd(src, Byte_ascii.Nl, pos);
|
||||
if (next_line == Bry_find_.Not_found) next_line = src_end;
|
||||
rv = next_line;
|
||||
pos = rv + 1;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ class Imap_fxt_base {
|
||||
@gplx.Virtual public void Reset() {
|
||||
app = Xoa_app_fxt.app_();
|
||||
wiki = Xoa_app_fxt.wiki_tst_(app);
|
||||
wiki.Ctx().Para().Enabled_n_();
|
||||
wiki.Parser_mgr().Ctx().Para().Enabled_n_();
|
||||
}
|
||||
public Imap_itm_shape itm_rect_(String link, double... pts_ary) {return itm_shape_(Imap_itm_.Tid_shape_rect, link, pts_ary);}
|
||||
public Imap_itm_shape itm_circle_(String link, double... pts_ary) {return itm_shape_(Imap_itm_.Tid_shape_circle, link, pts_ary);}
|
||||
@@ -58,7 +58,7 @@ class Imap_fxt_base {
|
||||
}
|
||||
private Xop_tkn_itm Make_link_tkn(byte[] src) {
|
||||
Xop_root_tkn root_tkn = new Xop_root_tkn();
|
||||
wiki.Parser().Parse_text_to_wdom(root_tkn, wiki.Ctx(), app.Tkn_mkr(), src, Xop_parser_.Doc_bgn_bos);
|
||||
wiki.Parser_mgr().Main().Parse_text_to_wdom(root_tkn, wiki.Parser_mgr().Ctx(), app.Parser_mgr().Tkn_mkr(), src, Xop_parser_.Doc_bgn_bos);
|
||||
return root_tkn.Subs_get(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ 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.imaps; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import org.junit.*;
|
||||
import org.junit.*; import gplx.xowa.langs.*;
|
||||
public class Imap_xnde_html_all_tst {
|
||||
@Before public void init() {fxt.Reset();} private Imap_xnde_html_fxt fxt = new Imap_xnde_html_fxt();
|
||||
@Test public void Basic() {
|
||||
|
||||
@@ -50,7 +50,7 @@ class Indicator_html_bldr_fxt {
|
||||
this.xtn_mgr = wiki.Xtn_mgr().Xtn_indicator();
|
||||
xtn_mgr.Enabled_y_();
|
||||
xtn_mgr.Xtn_init_by_wiki(wiki);
|
||||
this.page = wiki.Ctx().Cur_page();
|
||||
this.page = wiki.Parser_mgr().Ctx().Cur_page();
|
||||
}
|
||||
public void Init_indicator(String name, String html) {
|
||||
Indicator_xnde xnde = new Indicator_xnde();
|
||||
|
||||
@@ -16,7 +16,7 @@ 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.indicators; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.html.*; import gplx.xowa.wikis.*;
|
||||
import gplx.langs.htmls.*; import gplx.xowa.wikis.*;
|
||||
public class Indicator_xtn_mgr extends Xox_mgr_base {
|
||||
public Indicator_xtn_mgr() {
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.xtns.insiders; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.xowa.xtns.pfuncs.*; import gplx.xowa.pages.skins.*;
|
||||
import gplx.xowa.langs.*;
|
||||
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;}
|
||||
|
||||
@@ -16,8 +16,10 @@ 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.insiders; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.langs.htmls.encoders.*;
|
||||
import gplx.xowa.wikis.*; import gplx.xowa.wikis.xwikis.*; import gplx.xowa.pages.skins.*;
|
||||
import gplx.xowa.html.hrefs.*;
|
||||
import gplx.xowa.nss.*;
|
||||
class Insider_xtn_skin_itm implements Xopg_xtn_skin_itm {
|
||||
private List_adp itms = List_adp_.new_();
|
||||
private Insider_html_bldr html_bldr;
|
||||
|
||||
@@ -47,7 +47,7 @@ class Insider_html_bldr_fxt {
|
||||
this.xtn_mgr = wiki.Xtn_mgr().Xtn_insider();
|
||||
xtn_mgr.Enabled_y_();
|
||||
xtn_mgr.Xtn_init_by_wiki(wiki);
|
||||
this.page = wiki.Ctx().Cur_page();
|
||||
this.page = wiki.Parser_mgr().Ctx().Cur_page();
|
||||
skin_itm = new Insider_xtn_skin_itm(xtn_mgr.Html_bldr());
|
||||
page.Html_data().Xtn_skin_mgr().Add(skin_itm);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ 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.insiders; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.html.*; import gplx.xowa.wikis.*;
|
||||
import gplx.langs.htmls.*; import gplx.xowa.wikis.*;
|
||||
public class Insider_xtn_mgr extends Xox_mgr_base {
|
||||
public Insider_xtn_mgr() {
|
||||
html_bldr = new Insider_html_bldr(this);
|
||||
|
||||
@@ -17,7 +17,8 @@ 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 gplx.core.primitives.*;
|
||||
import gplx.html.*; import gplx.xowa.html.*;
|
||||
import gplx.langs.htmls.*; import gplx.xowa.html.*;
|
||||
import gplx.xowa.langs.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.xndes.*;
|
||||
public class Listing_xnde implements Xox_xnde, Xop_xnde_atr_parser {
|
||||
public Listing_xnde(int tag_id) {}
|
||||
@@ -64,7 +65,7 @@ public class Listing_xnde implements Xox_xnde, Xop_xnde_atr_parser {
|
||||
private Listing_xtn_mgr xtn_mgr;
|
||||
private byte[] html_output = Bry_.Empty;
|
||||
public void Xtn_parse(Xowe_wiki wiki, Xop_ctx ctx, Xop_root_tkn root, byte[] src, Xop_xnde_tkn xnde) {
|
||||
this.wiki = wiki; this.parser = wiki.Parser(); this.msg_mgr = wiki.Lang().Msg_mgr();
|
||||
this.wiki = wiki; this.parser = wiki.Parser_mgr().Main(); this.msg_mgr = wiki.Lang().Msg_mgr();
|
||||
xtn_mgr = (Listing_xtn_mgr)wiki.Xtn_mgr().Get_or_fail(Listing_xtn_mgr.Xtn_key_static);
|
||||
if (xtn_mgr == null || !xtn_mgr.Enabled()) return;
|
||||
Xoae_app app = wiki.Appe();
|
||||
@@ -103,7 +104,7 @@ public class Listing_xnde implements Xox_xnde, Xop_xnde_atr_parser {
|
||||
}
|
||||
bfr.Add(Xoa_consts.Invk_end); // "}}"
|
||||
Xop_ctx sub_ctx = Xop_ctx.new_sub_(wiki);
|
||||
html_output = wiki.Parser().Parse_text_to_html(sub_ctx, bfr.To_bry_and_rls());
|
||||
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) {
|
||||
@@ -203,7 +204,7 @@ public class Listing_xnde implements Xox_xnde, Xop_xnde_atr_parser {
|
||||
tmp_bfr.Add(rv); // rv is not message, but actually template precursor
|
||||
tmp_bfr.Add(Xoa_consts.Invk_end); // "}}"
|
||||
Xop_ctx sub_ctx = Xop_ctx.new_sub_(wiki);
|
||||
rv = wiki.Parser().Parse_text_to_html(sub_ctx, tmp_bfr.Xto_bry_and_clear());
|
||||
rv = wiki.Parser_mgr().Main().Parse_text_to_html(sub_ctx, tmp_bfr.Xto_bry_and_clear());
|
||||
Xol_msg_itm position_text = xtn_mgr.Position_text();
|
||||
if (Bry_.Len_eq_0(position_text.Val())) return rv;
|
||||
return position_text.Fmt(tmp_bfr, rv);
|
||||
|
||||
@@ -16,7 +16,7 @@ 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.listings; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import org.junit.*;
|
||||
import org.junit.*; import gplx.xowa.langs.*;
|
||||
public class Listing_xnde_basic_tst {
|
||||
private Xop_fxt fxt = new Xop_fxt();
|
||||
private Listing_xtn_mgr listings_xtn_mgr;
|
||||
|
||||
@@ -16,7 +16,8 @@ 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.listings; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.html.*;
|
||||
import gplx.langs.htmls.*;
|
||||
import gplx.xowa.langs.*;
|
||||
import gplx.xowa.wikis.*;
|
||||
import gplx.xowa.parsers.*;
|
||||
public class Listing_xtn_mgr extends Xox_mgr_base {
|
||||
@@ -71,7 +72,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().Parse_text_to_html(sub_ctx, rv);
|
||||
rv = wiki.Parser_mgr().Main().Parse_text_to_html(sub_ctx, rv);
|
||||
rv = Html_utl.Escape_html_as_bry(rv);
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -17,6 +17,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 gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.xowa.langs.*;
|
||||
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;}
|
||||
|
||||
@@ -17,6 +17,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 gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.xowa.langs.*;
|
||||
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;}
|
||||
|
||||
@@ -16,6 +16,7 @@ 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.lst; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.xowa.nss.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
|
||||
public class Lst_pfunc_wkr {
|
||||
private boolean mode_include = true;
|
||||
@@ -41,13 +42,13 @@ public class Lst_pfunc_wkr {
|
||||
if (src_page_bry == null) return; // {{#lst:missing}} -> ""
|
||||
Xoae_page page = ctx.Cur_page();
|
||||
if (!page.Tmpl_stack_add(src_ttl.Full_db())) return;
|
||||
defn_tmpl = wiki.Parser().Parse_text_to_defn_obj(sub_ctx, sub_ctx.Tkn_mkr(), src_ttl.Ns(), src_ttl_bry, src_page_bry); // NOTE: parse as tmpl to ignore <noinclude>
|
||||
defn_tmpl = wiki.Parser_mgr().Main().Parse_text_to_defn_obj(sub_ctx, sub_ctx.Tkn_mkr(), src_ttl.Ns(), src_ttl_bry, src_page_bry); // NOTE: parse as tmpl to ignore <noinclude>
|
||||
Bry_bfr tmp_bfr = wiki.Utl__bfr_mkr().Get_m001();
|
||||
page.Tmpl_stack_del(); // take template off stack; evaluate will never recurse, and will fail if ttl is still on stack; DATE:2014-03-10
|
||||
defn_tmpl.Tmpl_evaluate(sub_ctx, Xot_invk_temp.Page_is_caller, tmp_bfr);
|
||||
src = tmp_bfr.To_bry_and_rls();
|
||||
if (!page.Tmpl_stack_add(src_ttl.Full_db())) return; // put template back on stack;
|
||||
Xop_root_tkn root = wiki.Parser().Parse_text_to_wdom(sub_ctx, src, true); // NOTE: pass sub_ctx as old_ctx b/c entire document will be parsed, and references outside the section should be ignored;
|
||||
Xop_root_tkn root = wiki.Parser_mgr().Main().Parse_text_to_wdom(sub_ctx, src, true); // NOTE: pass sub_ctx as old_ctx b/c entire document will be parsed, and references outside the section should be ignored;
|
||||
src = root.Data_mid(); // NOTE: must set src to root.Data_mid() which is result of parse; else <nowiki> will break text; DATE:2013-07-11
|
||||
wiki.Cache_mgr().Lst_cache().Add(defn_tmpl, Xow_ns_case_.Id_all);
|
||||
page.Tmpl_stack_del();
|
||||
|
||||
@@ -18,6 +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 gplx.core.primitives.*;
|
||||
import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.xowa.langs.*;
|
||||
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;}
|
||||
|
||||
@@ -17,6 +17,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 gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.xowa.langs.*;
|
||||
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;}
|
||||
|
||||
@@ -17,6 +17,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 gplx.core.primitives.*;
|
||||
import gplx.xowa.langs.*;
|
||||
import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
|
||||
public class Map_geolink_func extends Pf_func_base {
|
||||
|
||||
@@ -151,7 +151,7 @@ class Map_math {// REF.MW:MapSources_math.php
|
||||
case Byte_ascii.Space:
|
||||
Parse_input_word(rv, src, ++word_idx, word_bgn, i);
|
||||
++words_len;
|
||||
i = Bry_finder.Find_fwd_while_space_or_tab(src, i, src_len);
|
||||
i = Bry_find_.Find_fwd_while_space_or_tab(src, i, src_len);
|
||||
word_bgn = i;
|
||||
break;
|
||||
}
|
||||
@@ -180,7 +180,7 @@ class Map_math {// REF.MW:MapSources_math.php
|
||||
private void Parse_input_word(double[] rv, byte[] input, int word_idx, int word_bgn, int word_end) {
|
||||
if (word_idx >= Input_units_len) return;
|
||||
byte unit_dlm = Input_units[word_idx];
|
||||
int pos = Bry_finder.Find_fwd(input, unit_dlm, word_bgn, word_end);
|
||||
int pos = Bry_find_.Find_fwd(input, unit_dlm, word_bgn, word_end);
|
||||
if (pos != Bry_.NotFound) // remove dlms from end of bry; EX: "123'" -> "123"
|
||||
word_end = pos;
|
||||
if (!Parse_input_word_is_compass(input[word_bgn])) { // if ( is_numeric( $v ) ) {
|
||||
|
||||
@@ -17,6 +17,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 gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.xowa.langs.*;
|
||||
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;}
|
||||
|
||||
@@ -54,10 +54,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.html.Html_entity_.Lt_bry; break;
|
||||
case Byte_ascii.Gt: if (mathjax) escaped = gplx.html.Html_entity_.Gt_bry; break;
|
||||
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.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.html.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.Html_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);
|
||||
|
||||
@@ -47,9 +47,9 @@ class Texvc_checker {
|
||||
Texvc_tkn arg_tkn = root.Subs__get_at(root_idx);
|
||||
// skip ws, dlm, lit
|
||||
int arg_tid = arg_tkn.Tid();
|
||||
switch (arg_tid) {
|
||||
case Texvc_tkn_.Tid__func:
|
||||
case Texvc_tkn_.Tid__curly:
|
||||
// switch (arg_tid) {
|
||||
// case Texvc_tkn_.Tid__func:
|
||||
// case Texvc_tkn_.Tid__curly:
|
||||
root.Regy__move(arg_tkn.Uid(), func_tkn.Uid());
|
||||
--root_len;
|
||||
--root_idx;
|
||||
@@ -57,8 +57,8 @@ class Texvc_checker {
|
||||
if (arg_tid == Texvc_tkn_.Tid__func) {
|
||||
Check_func(arg_tkn);
|
||||
}
|
||||
break;
|
||||
}
|
||||
// break;
|
||||
// }
|
||||
}
|
||||
List_adp_.Pop_last(func_stack);
|
||||
}
|
||||
|
||||
@@ -35,9 +35,9 @@ public class Texvc_checker_tst {
|
||||
);
|
||||
}
|
||||
@Test public void Mathrm() {
|
||||
// fxt.Test_check("\\mathrm\\frac{a}{b}" , "\\mathrm{\\frac{a}{b}}");
|
||||
// fxt.Test_check("\\mathrm\\frac a b}" , "\\mathrm{\\frac{a}{b}}");
|
||||
// fxt.Test_check("\\mathrm{\\frac{a}{b}}" , "\\mathrm{\\frac{a}{b}}");
|
||||
fxt.Test_check("\\mathrm\\frac{a}{b}" , "\\mathrm{\\frac{a}{b}}");
|
||||
fxt.Test_check("\\mathrm{\\frac{a}{b}}" , "\\mathrm{\\frac{a}{b}}");
|
||||
fxt.Test_check("\\frac a b" , "\\frac a b");
|
||||
}
|
||||
}
|
||||
class Texvc_checker_fxt extends Texvc_parser_fxt { private final Texvc_checker checker = new Texvc_checker();
|
||||
|
||||
@@ -28,7 +28,7 @@ class Texvc_lxr__curly_bgn implements Texvc_lxr {
|
||||
class Texvc_lxr__curly_end implements Texvc_lxr {
|
||||
public int Tid() {return Texvc_lxr_.Tid__curly_end;}
|
||||
public int Make_tkn(Texvc_ctx ctx, Texvc_root root, byte[] src, int src_len, int bgn_pos, int cur_pos) {
|
||||
int bgn_uid = ctx.Stack().Pop_or(-1);
|
||||
int bgn_uid = ctx.Stack().Pop_or_fail();
|
||||
root.Regy__take_from_root_end(bgn_uid);
|
||||
root.Regy__update_end(bgn_uid, cur_pos);
|
||||
return cur_pos;
|
||||
|
||||
@@ -37,12 +37,25 @@ public class Texvc_tkn__func implements Texvc_tkn {
|
||||
public int Subs__len() {return root.Regy__get_subs_len(uid);}
|
||||
public Texvc_tkn Subs__get_at(int i) {return root.Regy__get_subs_tkn(uid, i);}
|
||||
public void Print_tex_bry(Bry_bfr bfr, byte[] src, int indent) {
|
||||
if (tid != Texvc_func_itm_.Id__xowa_arg) // do not add func name if arg; EX: "{a}" vs "\alpha{a}"
|
||||
bfr.Add_byte_backslash().Add(func_itm.Key()); // funcs have pattern of "\key"; EX: "\alpha"
|
||||
if (func_itm.Id() != Texvc_func_itm_.Id__xowa_arg) // do not add func name if arg; EX: "{a}" vs "\alpha{a}"
|
||||
bfr.Add_byte_backslash().Add(func_itm.Key()); // funcs have pattern of "\key"; EX: "\alpha"
|
||||
int subs_len = Subs__len();
|
||||
for (int i = 0; i < subs_len; ++i) {
|
||||
Texvc_tkn sub_tkn = Subs__get_at(i);
|
||||
sub_tkn.Print_tex_bry(bfr, src, indent + 1);
|
||||
if (subs_len > 0) {
|
||||
boolean curly_added = false;
|
||||
for (int i = 0; i < subs_len; ++i) {
|
||||
Texvc_tkn sub_tkn = Subs__get_at(i);
|
||||
if (i == 0 && (sub_tkn.Tid() == Texvc_tkn_.Tid__func) && tid != Texvc_tkn_.Tid__curly) {
|
||||
bfr.Add_byte(Byte_ascii.Curly_bgn);
|
||||
curly_added = true;
|
||||
}
|
||||
if (sub_tkn.Tid() == Texvc_tkn_.Tid__curly)
|
||||
bfr.Add_byte(Byte_ascii.Curly_bgn);
|
||||
sub_tkn.Print_tex_bry(bfr, src, indent + 1);
|
||||
if (sub_tkn.Tid() == Texvc_tkn_.Tid__curly)
|
||||
bfr.Add_byte(Byte_ascii.Curly_end);
|
||||
}
|
||||
if (curly_added)
|
||||
bfr.Add_byte(Byte_ascii.Curly_end);
|
||||
}
|
||||
}
|
||||
public void Print_dbg_bry(Bry_bfr bfr, int indent) {
|
||||
|
||||
@@ -16,6 +16,8 @@ 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.pfuncs; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.core.primitives.*;
|
||||
import gplx.xowa.langs.*;
|
||||
import gplx.xowa.xtns.pfuncs.ifs.*; import gplx.xowa.xtns.pfuncs.times.*; import gplx.xowa.xtns.pfuncs.numbers.*; import gplx.xowa.xtns.pfuncs.ttls.*; import gplx.xowa.xtns.pfuncs.langs.*; import gplx.xowa.xtns.pfuncs.strings.*; import gplx.xowa.xtns.pfuncs.stringutils.*; import gplx.xowa.xtns.pfuncs.pages.*; import gplx.xowa.xtns.pfuncs.wikis.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
|
||||
public class Pf_func_ {
|
||||
|
||||
@@ -49,7 +49,7 @@ public abstract class Pf_func_base implements Pf_func {
|
||||
int subs_len = name_val_tkn.Subs_len();
|
||||
if (subs_len == 0) { // no subs; either {{#func}} or {{#func:}}
|
||||
int src_bgn = name_tkn.Src_bgn();
|
||||
int colon_pos = Bry_finder.Find_bwd(src, Byte_ascii.Colon, self.Src_end(), src_bgn); // look for ":"; NOTE: used to be src_bgn - 1, but this would always search one character too many; DATE:2014-02-11
|
||||
int colon_pos = Bry_find_.Find_bwd(src, Byte_ascii.Colon, self.Src_end(), src_bgn); // look for ":"; NOTE: used to be src_bgn - 1, but this would always search one character too many; DATE:2014-02-11
|
||||
if (colon_pos == Bry_.NotFound) // no colon; EX: {{#func}}
|
||||
return Eval_arg_or_null_is_null;
|
||||
else { // colon found; EX: {{#func:}}
|
||||
|
||||
@@ -16,6 +16,7 @@ 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.pfuncs.exprs; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.xowa.langs.*;
|
||||
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;}
|
||||
|
||||
@@ -16,6 +16,7 @@ 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.pfuncs.exprs; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.xowa.langs.*;
|
||||
import gplx.xowa.parsers.*;
|
||||
interface Expr_tkn {
|
||||
int Tid();
|
||||
|
||||
@@ -17,6 +17,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 gplx.core.btries.*;
|
||||
import gplx.xowa.langs.*;
|
||||
import gplx.xowa.parsers.*;
|
||||
public class Pfunc_expr_shunter {
|
||||
Btrie_fast_mgr trie = expression_();
|
||||
@@ -106,7 +107,7 @@ public class Pfunc_expr_shunter {
|
||||
case Expr_tkn_.Tid_operator:
|
||||
Func_tkn cur_prc = (Func_tkn)t;
|
||||
if (Byte_ascii.Is_ltr(cur_byt)) {
|
||||
int nxt_pos = Bry_finder.Find_fwd_while_letter(src, cur_pos, src_len);
|
||||
int nxt_pos = Bry_find_.Find_fwd_while_letter(src, cur_pos, src_len);
|
||||
if (nxt_pos > cur_pos)
|
||||
return Err_set(ctx, Xol_msg_itm_.Id_pfunc_expr_unrecognised_word, Bry_.Mid(src, bgn_pos, nxt_pos));
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ 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.pfuncs.ifs; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.xowa.langs.*;
|
||||
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;}
|
||||
|
||||
@@ -16,6 +16,7 @@ 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.pfuncs.ifs; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.xowa.langs.*;
|
||||
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;}
|
||||
|
||||
@@ -17,6 +17,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 gplx.core.primitives.*; import gplx.core.btries.*;
|
||||
import gplx.xowa.langs.*;
|
||||
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;}
|
||||
|
||||
@@ -16,6 +16,7 @@ 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.pfuncs.ifs; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.xowa.langs.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
|
||||
public class Pfunc_ifexist extends Pf_func_base {
|
||||
@Override public int Id() {return Xol_kwd_grp_.Id_xtn_iferror;}
|
||||
|
||||
@@ -16,7 +16,8 @@ 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.pfuncs.ifs; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.xowa.wmfs.apis.*; import gplx.xowa.wikis.data.tbls.*;
|
||||
import gplx.xowa.wms.apis.*; import gplx.xowa.wikis.data.tbls.*;
|
||||
import gplx.xowa.nss.*;
|
||||
public class Pfunc_ifexist_mgr {
|
||||
private Xowd_page_itm db_page = Xowd_page_itm.new_tmp();
|
||||
private Hash_adp regy = Hash_adp_bry.cs();
|
||||
@@ -44,7 +45,7 @@ public class Pfunc_ifexist_mgr {
|
||||
boolean rv = wiki.Db_mgr().Load_mgr().Load_by_ttl(db_page, ns, ttl_bry);
|
||||
if ( !rv
|
||||
&& wiki.Lang().Vnt_mgr().Enabled()) {
|
||||
Xowd_page_itm page = wiki.Lang().Vnt_mgr().Convert_ttl(wiki, ns, ttl_bry);
|
||||
Xowd_page_itm page = wiki.Lang().Vnt_mgr().Convert_mgr().Convert_ttl(wiki, ns, ttl_bry);
|
||||
if (page != Xowd_page_itm.Null)
|
||||
rv = page.Exists();
|
||||
}
|
||||
|
||||
@@ -17,6 +17,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 gplx.xowa.xtns.pfuncs.exprs.*;
|
||||
import gplx.xowa.langs.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
|
||||
public class Pfunc_ifexpr extends Pf_func_base {
|
||||
@Override public boolean Func_require_colon_arg() {return true;}
|
||||
|
||||
@@ -16,6 +16,7 @@ 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.pfuncs.ifs; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.xowa.langs.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
|
||||
public class Pfunc_switch extends Pf_func_base {
|
||||
@Override public int Id() {return Xol_kwd_grp_.Id_xtn_switch;}
|
||||
|
||||
@@ -16,7 +16,7 @@ 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.pfuncs.ifs; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import org.junit.*;
|
||||
import org.junit.*; import gplx.xowa.langs.*;
|
||||
public class Pfunc_switch_tst {
|
||||
@Before public void init() {fxt.Reset();} private 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");}
|
||||
|
||||
@@ -16,6 +16,7 @@ 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.pfuncs.ifs; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.xowa.langs.*;
|
||||
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) {
|
||||
|
||||
@@ -17,7 +17,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 gplx.core.primitives.*; import gplx.xowa.users.*;
|
||||
import gplx.xowa.langs.genders.*;
|
||||
import gplx.xowa.langs.*; import gplx.xowa.langs.genders.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
|
||||
public class Pfunc_gender extends Pf_func_base {
|
||||
@Override public int Id() {return Xol_kwd_grp_.Id_i18n_gender;}
|
||||
|
||||
@@ -16,6 +16,7 @@ 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.pfuncs.langs; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.xowa.langs.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
|
||||
public class Pfunc_grammar extends Pf_func_base {
|
||||
@Override public int Id() {return Xol_kwd_grp_.Id_i18n_grammar;}
|
||||
|
||||
@@ -16,7 +16,7 @@ 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.pfuncs.langs; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import org.junit.*;
|
||||
import org.junit.*; import gplx.xowa.langs.*;
|
||||
public class Pfunc_i18n_tst {
|
||||
@Before public void init() {fxt.Clear();} private Pfunc_i18n_fxt fxt = new Pfunc_i18n_fxt();
|
||||
@Test public void Casing() {fxt.lang_("de").Ini().Reg_func("fullurl", false, "VOLLSTÄNDIGE_URL").Load().Fxt().Test_parse_tmpl_str_test("{{vollstÄndige_url:a}}", "{{test}}" , "//de.wikipedia.org/wiki/A");}
|
||||
|
||||
@@ -16,7 +16,8 @@ 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.pfuncs.langs; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.php.*; import gplx.xowa.langs.msgs.*;
|
||||
import gplx.langs.phps.*;
|
||||
import gplx.xowa.langs.*; import gplx.xowa.langs.msgs.*;
|
||||
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;}
|
||||
|
||||
@@ -16,7 +16,7 @@ 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.pfuncs.langs; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import org.junit.*;
|
||||
import org.junit.*; import gplx.xowa.langs.*;
|
||||
public class Pfunc_int_tst {
|
||||
@Before public void init() {fxt.Reset();} private Pf_msg_mgr_fxt fxt = new Pf_msg_mgr_fxt();
|
||||
@Test public void Basic() {fxt.Test_parse_en("{{int:january}}" , "January");}
|
||||
|
||||
@@ -16,6 +16,7 @@ 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.pfuncs.langs; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.xowa.langs.*;
|
||||
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;}
|
||||
|
||||
@@ -16,7 +16,8 @@ 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.pfuncs.numbers; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.core.btries.*; import gplx.intl.*; import gplx.xowa.langs.numbers.*;
|
||||
import gplx.core.btries.*; import gplx.core.intls.*;
|
||||
import gplx.xowa.langs.*; import gplx.xowa.langs.numbers.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
|
||||
public class Pf_formatnum extends Pf_func_base {
|
||||
@Override public int Id() {return Xol_kwd_grp_.Id_str_formatnum;}
|
||||
|
||||
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.xtns.pfuncs.numbers; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import org.junit.*;
|
||||
import gplx.intl.*; import gplx.xowa.langs.numbers.*;
|
||||
import gplx.core.intls.*; import gplx.xowa.langs.numbers.*;
|
||||
public class Pf_formatnum_de_tst {
|
||||
private Xop_fxt fxt = new Xop_fxt();
|
||||
@Before public void init() {
|
||||
|
||||
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.xtns.pfuncs.numbers; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import org.junit.*;
|
||||
import gplx.intl.*;
|
||||
import gplx.core.intls.*;
|
||||
public class Pf_formatnum_en_tst {
|
||||
private Xop_fxt fxt = new Xop_fxt();
|
||||
@Before public void init() {fxt.Reset();}
|
||||
|
||||
@@ -16,8 +16,8 @@ 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.pfuncs.numbers; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import org.junit.*;
|
||||
import gplx.intl.*; import gplx.xowa.langs.numbers.*;
|
||||
import org.junit.*; import gplx.xowa.langs.*;
|
||||
import gplx.core.intls.*; import gplx.xowa.langs.numbers.*;
|
||||
public class Pf_formatnum_es_tst {
|
||||
private Xop_fxt fxt;
|
||||
@Before public void init() {
|
||||
|
||||
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.xtns.pfuncs.numbers; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import org.junit.*;
|
||||
import gplx.intl.*; import gplx.xowa.langs.numbers.*;
|
||||
import gplx.core.intls.*; import gplx.xowa.langs.*; import gplx.xowa.langs.numbers.*;
|
||||
public class Pf_formatnum_fa_tst {
|
||||
private Xop_fxt fxt;
|
||||
@Before public void init() {
|
||||
|
||||
@@ -16,6 +16,7 @@ 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.pfuncs.pages; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.xowa.langs.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
|
||||
public class Pfunc_defaultsort extends Pf_func_base {
|
||||
@Override public void Func_evaluate(Xop_ctx ctx, byte[] src, Xot_invk caller, Xot_invk self, Bry_bfr bb) {}
|
||||
|
||||
@@ -16,14 +16,15 @@ 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.pfuncs.pages; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.xowa.html.*; import gplx.xowa.langs.cases.*;
|
||||
import gplx.xowa.html.*;
|
||||
import gplx.xowa.langs.*; import gplx.xowa.langs.cases.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
|
||||
public class Pfunc_displaytitle extends Pf_func_base {
|
||||
@Override public int Id() {return Xol_kwd_grp_.Id_page_displaytitle;}
|
||||
@Override public Pf_func New(int id, byte[] name) {return new Pfunc_displaytitle().Name_(name);}
|
||||
@Override public void Func_evaluate(Xop_ctx ctx, byte[] src, Xot_invk caller, Xot_invk self, Bry_bfr bfr) {
|
||||
byte[] val_dat_ary = Eval_argx(ctx, src, caller, self);
|
||||
Xowe_wiki wiki = ctx.Wiki(); Xop_parser parser = wiki.Parser();
|
||||
Xowe_wiki wiki = ctx.Wiki(); Xop_parser parser = wiki.Parser_mgr().Main();
|
||||
Xop_ctx display_ttl_ctx = Xop_ctx.new_sub_(wiki);
|
||||
Xop_root_tkn display_ttl_root = parser.Parse_text_to_wdom(display_ttl_ctx, val_dat_ary, false);
|
||||
Bry_bfr tmp_bfr = wiki.Utl__bfr_mkr().Get_b512();
|
||||
|
||||
@@ -16,6 +16,7 @@ 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.pfuncs.pages; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.xowa.langs.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
|
||||
public class Pfunc_noeditsection extends Pf_func_base {
|
||||
@Override public void Func_evaluate(Xop_ctx ctx, byte[] src, Xot_invk caller, Xot_invk self, Bry_bfr bb) {}
|
||||
|
||||
@@ -16,6 +16,7 @@ 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.pfuncs.pages; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.xowa.langs.*;
|
||||
import gplx.xowa.pages.*; import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
|
||||
public class Pfunc_rev_props extends Pf_func_base {
|
||||
@Override public void Func_evaluate(Xop_ctx ctx, byte[] src, Xot_invk caller, Xot_invk self, Bry_bfr bfr) {
|
||||
|
||||
@@ -16,6 +16,7 @@ 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.pfuncs.strings; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.xowa.langs.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
|
||||
public class Pfunc_case extends Pf_func_base { // EX: {{lc:A}} -> a
|
||||
private boolean first; private int case_type;
|
||||
|
||||
@@ -16,7 +16,7 @@ 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.pfuncs.strings; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.intl.*;
|
||||
import gplx.core.intls.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
|
||||
public class Pfunc_pad extends Pf_func_base {
|
||||
@Override public void Func_evaluate(Xop_ctx ctx, byte[] src, Xot_invk caller, Xot_invk self, Bry_bfr bfr) {// REF.MW: CoreParserFunctions.php|pad
|
||||
@@ -37,7 +37,7 @@ public class Pfunc_pad extends Pf_func_base {
|
||||
if (pad_dir_right) bfr.Add(val);
|
||||
for (int val_idx = val_len; val_idx < pad_len_int; val_idx++) {
|
||||
byte b = pad_str[pad_idx];
|
||||
int b_len = gplx.intl.Utf8_.Len_of_char_by_1st_byte(b);
|
||||
int b_len = gplx.core.intls.Utf8_.Len_of_char_by_1st_byte(b);
|
||||
if (b_len == 1)
|
||||
bfr.Add_byte(b);
|
||||
else
|
||||
|
||||
@@ -17,6 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.xtns.pfuncs.strings; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.xowa.html.*;
|
||||
import gplx.xowa.langs.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.xndes.*; import gplx.xowa.parsers.tmpls.*;
|
||||
public class Pfunc_tag extends Pf_func_base {
|
||||
@Override public int Id() {return Xol_kwd_grp_.Id_misc_tag;}
|
||||
|
||||
@@ -16,6 +16,7 @@ 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.pfuncs.stringutils; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.xowa.langs.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
|
||||
public class Pfunc_count extends Pf_func_base {
|
||||
@Override public int Id() {return Xol_kwd_grp_.Id_strx_count;}
|
||||
@@ -32,8 +33,8 @@ public class Pfunc_count extends Pf_func_base {
|
||||
int pos = 0;
|
||||
int rv = 0;
|
||||
while (true) {
|
||||
int find_pos = Bry_finder.Find_fwd(src, find, pos, src_len);
|
||||
if (find_pos == Bry_finder.Not_found) break;
|
||||
int find_pos = Bry_find_.Find_fwd(src, find, pos, src_len);
|
||||
if (find_pos == Bry_find_.Not_found) break;
|
||||
pos = find_pos + find_len;
|
||||
++rv;
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ 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.pfuncs.stringutils; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.xowa.langs.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
|
||||
public class Pfunc_explode extends Pf_func_base {
|
||||
@Override public int Id() {return Xol_kwd_grp_.Id_strx_explode;}
|
||||
@@ -49,8 +50,8 @@ public class Pfunc_explode extends Pf_func_base {
|
||||
int src_len = src.length; int dlm_len = dlm.length;
|
||||
int pos = 0; int found = 0;
|
||||
while (true) {
|
||||
int find_pos = Bry_finder.Find_fwd(src, dlm, pos);
|
||||
if (find_pos == Bry_finder.Not_found) break;
|
||||
int find_pos = Bry_find_.Find_fwd(src, dlm, pos);
|
||||
if (find_pos == Bry_find_.Not_found) break;
|
||||
if (found == idx) return Bry_.Mid(src, pos, find_pos);
|
||||
pos = find_pos + dlm_len;
|
||||
++found;
|
||||
|
||||
@@ -16,6 +16,7 @@ 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.pfuncs.stringutils; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.xowa.langs.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
|
||||
public class Pfunc_len extends Pf_func_base {
|
||||
@Override public int Id() {return Xol_kwd_grp_.Id_strx_len;}
|
||||
@@ -23,7 +24,7 @@ public class Pfunc_len 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 trg) {
|
||||
byte[] str = Eval_argx(ctx, src, caller, self);
|
||||
int char_count = gplx.intl.Utf8_.Len_of_bry(str);
|
||||
int char_count = gplx.core.intls.Utf8_.Len_of_bry(str);
|
||||
trg.Add_int_variable(char_count);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ 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.pfuncs.stringutils; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.xowa.langs.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
|
||||
public class Pfunc_pos extends Pf_func_base {
|
||||
@Override public int Id() {return Xol_kwd_grp_.Id_strx_pos;}
|
||||
@@ -27,8 +28,8 @@ public class Pfunc_pos extends Pf_func_base {
|
||||
byte[] find = Pf_func_.Eval_arg_or(ctx, src, caller, self, self_args_len, 0, Byte_ascii.Space_bry); // MW: use " " if find is missing
|
||||
byte[] offset_bry = Pf_func_.Eval_arg_or(ctx, src, caller, self, self_args_len, 1, null);
|
||||
int offset = offset_bry == null ? 0 : Bry_.To_int_or_neg1(offset_bry);
|
||||
int pos = Bry_finder.Find_fwd(str, find, offset);
|
||||
if (pos != Bry_finder.Not_found)
|
||||
int pos = Bry_find_.Find_fwd(str, find, offset);
|
||||
if (pos != Bry_find_.Not_found)
|
||||
trg.Add_int_variable(pos);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ 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.pfuncs.stringutils; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.xowa.langs.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
|
||||
public class Pfunc_replace extends Pf_func_base {
|
||||
@Override public int Id() {return Xol_kwd_grp_.Id_strx_replace;}
|
||||
|
||||
@@ -16,6 +16,7 @@ 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.pfuncs.stringutils; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.xowa.langs.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
|
||||
public class Pfunc_rpos extends Pf_func_base {
|
||||
@Override public int Id() {return Xol_kwd_grp_.Id_strx_rpos;}
|
||||
@@ -27,8 +28,8 @@ public class Pfunc_rpos extends Pf_func_base {
|
||||
byte[] find = Pf_func_.Eval_arg_or(ctx, src, caller, self, self_args_len, 0, Byte_ascii.Space_bry); // MW: use " " if find is missing
|
||||
byte[] offset_bry = Pf_func_.Eval_arg_or(ctx, src, caller, self, self_args_len, 1, null);
|
||||
int offset = offset_bry == null ? str.length : Bry_.To_int_or_neg1(offset_bry);
|
||||
int pos = Bry_finder.Find_bwd(str, find, offset);
|
||||
if (pos == Bry_finder.Not_found) pos = -1;
|
||||
int pos = Bry_find_.Find_bwd(str, find, offset);
|
||||
if (pos == Bry_find_.Not_found) pos = -1;
|
||||
trg.Add_int_variable(pos);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ 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.pfuncs.stringutils; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.xowa.langs.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
|
||||
public class Pfunc_sub extends Pf_func_base {
|
||||
@Override public int Id() {return Xol_kwd_grp_.Id_strx_sub;}
|
||||
|
||||
@@ -16,6 +16,7 @@ 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.pfuncs.stringutils; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.xowa.langs.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
|
||||
public class Pfunc_urldecode extends Pf_func_base {
|
||||
@Override public int Id() {return Xol_kwd_grp_.Id_strx_urldecode;}
|
||||
|
||||
@@ -16,6 +16,7 @@ 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.pfuncs.times; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.xowa.langs.*;
|
||||
public interface Pft_fmt_itm {
|
||||
int TypeId();
|
||||
void Fmt(Bry_bfr bfr, Xowe_wiki wiki, Xol_lang lang, DateAdp date, Pft_func_formatdate_bldr bldr);
|
||||
|
||||
@@ -17,6 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.xtns.pfuncs.times; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.core.btries.*;
|
||||
import gplx.xowa.langs.*;
|
||||
import gplx.xowa.parsers.*;
|
||||
public class Pft_fmt_itm_ {
|
||||
public static final int
|
||||
@@ -203,7 +204,7 @@ public class Pft_fmt_itm_ {
|
||||
break;
|
||||
default:
|
||||
if (raw_bgn == String_.Pos_neg1) {raw_bgn = i; raw_byt = b;}
|
||||
i += gplx.intl.Utf8_.Len_of_char_by_1st_byte(b);
|
||||
i += gplx.core.intls.Utf8_.Len_of_char_by_1st_byte(b);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ 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.pfuncs.times; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.xowa.langs.*;
|
||||
class Pft_fmt_itm_roman implements Pft_fmt_itm {
|
||||
public int TypeId() {return Pft_fmt_itm_.Tid_roman;}
|
||||
public void Fmt(Bry_bfr bfr, Xowe_wiki wiki, Xol_lang lang, DateAdp date, Pft_func_formatdate_bldr bldr) {
|
||||
|
||||
@@ -16,6 +16,7 @@ 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.pfuncs.times; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.xowa.langs.*;
|
||||
class Pft_fmt_itm_seg_int implements Pft_fmt_itm {
|
||||
public Pft_fmt_itm_seg_int(int segIdx, int len, boolean fixed_len) {this.segIdx = segIdx; this.fixed_len = fixed_len; this.len = len;} private int segIdx, len; boolean fixed_len;
|
||||
public int TypeId() {return Pft_fmt_itm_.Tid_seg_int;}
|
||||
|
||||
@@ -16,6 +16,7 @@ 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.pfuncs.times; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.xowa.langs.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
|
||||
public class Pft_func_date_int extends Pf_func_base {
|
||||
public Pft_func_date_int(int id, int date_tid) {this.id = id; this.date_tid = date_tid;} private int date_tid;
|
||||
|
||||
@@ -17,6 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.xtns.pfuncs.times; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.core.btries.*;
|
||||
import gplx.xowa.langs.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
|
||||
public class Pft_func_formatdate extends Pf_func_base {
|
||||
@Override public int Id() {return Xol_kwd_grp_.Id_str_formatdate;}
|
||||
|
||||
@@ -16,6 +16,7 @@ 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.pfuncs.times; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.xowa.langs.*;
|
||||
public class Pft_func_formatdate_bldr {
|
||||
public int Idx_cur() {return idx_cur;} private int idx_cur;
|
||||
public Pft_func_formatdate_bldr Idx_nxt_(int v) {idx_nxt = v; return this;} private int idx_nxt;
|
||||
|
||||
@@ -16,7 +16,7 @@ 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.pfuncs.times; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import org.junit.*;
|
||||
import org.junit.*; import gplx.xowa.langs.*;
|
||||
public class Pft_func_time_basic_tst {
|
||||
@Before public void init() {fxt.Reset(); Tfds.Now_set(DateAdp_.new_(2012, 1, 2, 3, 4, 5, 6));} private Xop_fxt fxt = new Xop_fxt();
|
||||
@After public void term() {Tfds.Now_enabled_n_();}
|
||||
|
||||
@@ -16,7 +16,7 @@ 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.pfuncs.times; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import org.junit.*;
|
||||
import org.junit.*; import gplx.xowa.langs.*;
|
||||
public class Pft_func_time_foreign_tst {
|
||||
@Before public void init() {fxt.Clear();} private Pft_func_time_foreign_fxt fxt = new Pft_func_time_foreign_fxt();
|
||||
@After public void term() {fxt.Term();}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user