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
2015-08-30 22:57:59 -04:00
parent ed911e3de5
commit 5fc4eb41ec
579 changed files with 2460 additions and 1564 deletions

View File

@@ -38,7 +38,7 @@ class Xot_defn_trace_fxt {
Xop_ctx ctx = fxt.Ctx();
ctx.Defn_trace().Clear();
byte[] src = Bry_.new_u8(raw);
ctx.Cur_page().Ttl_(Xoa_ttl.parse_(fxt.Wiki(), Bry_.new_a7("test")));
ctx.Cur_page().Ttl_(Xoa_ttl.parse(fxt.Wiki(), Bry_.new_a7("test")));
Xop_root_tkn root = ctx.Tkn_mkr().Root(src);
fxt.Parser().Parse_page_all_clear(root, ctx, ctx.Tkn_mkr(), src);
ctx.Defn_trace().Print(src, tmp);

View File

@@ -70,7 +70,7 @@ public class Xot_invk_mock implements Xot_invk {
if (Type_adp_.Eq_typeSafe(kv_key_obj, Int_.Cls_ref_type)) // key is int; EX: 1 => val
nde_tkn = new Arg_nde_tkn_mock(null, kv.Val_to_str_or_empty()); // add w/o key
else if (Type_adp_.Eq_typeSafe(kv.Val(), Bool_.Cls_ref_type)) { // val is boolean; EX: key => true || key => false
boolean kv_val_bool = Bool_.cast_(kv.Val());
boolean kv_val_bool = Bool_.cast(kv.Val());
if (kv_val_bool)
nde_tkn = new Arg_nde_tkn_mock(kv_key_str, "1"); // true => 1 (PHP behavior)
else

View File

@@ -52,8 +52,8 @@ public class Xot_invk_temp implements Xot_invk {
public void Args_add_by_key(byte[] key, Arg_nde_tkn arg) {
if (arg_key_hash == null) arg_key_hash = Hash_adp_bry.cs(); // PERF: lazy
arg_key_hash.Add_if_dupe_use_nth(key, arg);
int key_as_int = Bry_.To_int_or(key, Int_.MinValue);
if (key_as_int != Int_.MinValue) // key is int; add it to arg_idx_hash; EX:{{A|1=a}} vs {{A|a}}; DATE:2014-07-23
int key_as_int = Bry_.To_int_or(key, Int_.Min_value);
if (key_as_int != Int_.Min_value) // key is int; add it to arg_idx_hash; EX:{{A|1=a}} vs {{A|a}}; DATE:2014-07-23
Arg_idx_hash_add(key_as_int - List_adp_.Base1, arg);
}
public void Args_add_by_idx(Arg_nde_tkn arg) {Arg_idx_hash_add(++args_add_by_idx, arg);} private int args_add_by_idx = -1; // NOTE: args_add_by_idx needs to be a separate variable; keeps track of args which don't have a key;

View File

@@ -171,7 +171,7 @@ public class Xot_invk_tkn extends Xop_tkn_itm_base implements Xot_invk {
defn = wiki.Cache_mgr().Defn_cache().Get_by_key(name_ary);
if (defn == null) {
if (name_ary_len != 0 ) { // name_ary_len != 0 for direct template inclusions; PAGE:en.w:Human evolution and {{:Human evolution/Species chart}}; && ctx.Tmpl_whitelist().Has(name_ary)
Xoa_ttl ttl = Xoa_ttl.parse_(wiki, Bry_.Add(wiki.Ns_mgr().Ns_template().Name_db_w_colon(), name_ary));
Xoa_ttl ttl = Xoa_ttl.parse(wiki, Bry_.Add(wiki.Ns_mgr().Ns_template().Name_db_w_colon(), name_ary));
if (ttl == null) { // ttl is not valid; just output orig; REF.MW:Parser.php|braceSubstitution|if ( !$found ) $text = $frame->virtualBracketedImplode( '{{', '|', '}}', $titleWithSpaces, $args );
byte[] missing_ttl
= subst_found || template_prefix_found // if "subst:" or "Template:" found, use orig name; DATE:2014-03-31
@@ -196,7 +196,7 @@ public class Xot_invk_tkn extends Xop_tkn_itm_base implements Xot_invk {
Xowd_page_itm page = lang.Vnt_mgr().Convert_ttl(wiki, wiki.Ns_mgr().Ns_template(), name_ary);
if (page != Xowd_page_itm.Null) {
name_ary = page.Ttl_page_db();
Xoa_ttl ttl = Xoa_ttl.parse_(wiki, Bry_.Add(wiki.Ns_mgr().Ns_template().Name_db_w_colon(), name_ary));
Xoa_ttl ttl = Xoa_ttl.parse(wiki, Bry_.Add(wiki.Ns_mgr().Ns_template().Name_db_w_colon(), name_ary));
if (ttl == null) { // ttl is not valid; just output orig; REF.MW:Parser.php|braceSubstitution|if ( !$found ) $text = $frame->virtualBracketedImplode( '{{', '|', '}}', $titleWithSpaces, $args );
bfr.Add(Xop_curly_bgn_lxr.Hook).Add(name_ary).Add(Xop_curly_end_lxr.Hook);
return false;
@@ -333,7 +333,7 @@ public class Xot_invk_tkn extends Xop_tkn_itm_base implements Xot_invk {
}
}
private boolean Transclude(Xop_ctx ctx, Xowe_wiki wiki, Bry_bfr bfr, byte[] name_ary, Xot_invk caller, byte[] src) {
Xoa_ttl page_ttl = Xoa_ttl.parse_(wiki, name_ary); if (page_ttl == null) return false; // ttl not valid; EX: {{:[[abc]]}}
Xoa_ttl page_ttl = Xoa_ttl.parse(wiki, name_ary); if (page_ttl == null) return false; // ttl not valid; EX: {{:[[abc]]}}
byte[] transclude_src = null;
if (page_ttl.Ns().Id_tmpl()) { // ttl is template; check tmpl_regy first before going to data_mgr
Xot_defn_tmpl tmpl = (Xot_defn_tmpl)wiki.Cache_mgr().Defn_cache().Get_by_key(page_ttl.Page_db());
@@ -387,7 +387,7 @@ public class Xot_invk_tkn extends Xop_tkn_itm_base implements Xot_invk {
bfr.Add(Xop_tkn_.Lnki_bgn).Add_byte(Byte_ascii.Colon).Add(template_ns_name).Add_byte(Byte_ascii.Colon).Add(name_ary).Add(Xop_tkn_.Lnki_end);
}
private boolean SubEval(Xop_ctx ctx, Xowe_wiki wiki, Bry_bfr bfr, byte[] name_ary, Xot_invk caller, byte[] src_for_tkn) {
Xoa_ttl page_ttl = Xoa_ttl.parse_(wiki, name_ary); if (page_ttl == null) return false; // ttl not valid; EX: {{:[[abc]]}}
Xoa_ttl page_ttl = Xoa_ttl.parse(wiki, name_ary); if (page_ttl == null) return false; // ttl not valid; EX: {{:[[abc]]}}
Xot_defn_tmpl transclude_tmpl = null;
switch (page_ttl.Ns().Id()) {
case Xow_ns_.Id_template: // ttl is template not in cache, or some other ns; do load

View File

@@ -63,7 +63,7 @@ public class Xot_tmpl_wtr {
case Xop_xnde_tag_.Tid_includeonly: // noop; DATE:2014-02-12
break;
case Xop_xnde_tag_.Tid_nowiki: {
if (xnde.Tag_close_bgn() == Int_.MinValue)
if (xnde.Tag_close_bgn() == Int_.Min_value)
rslt_bfr.Add_mid(src, tkn.Src_bgn(), tkn.Src_end()); // write src from bgn/end
else { // NOTE: if nowiki then "deactivate" all xndes by swapping out < for &lt; nowiki_xnde_frag; DATE:2013-01-27
Bry_bfr tmp_bfr = ctx.Wiki().Appe().Utl__bfr_mkr().Get_k004();