1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00

'v3.7.4.1'

This commit is contained in:
gnosygnu
2016-07-25 21:59:51 -04:00
parent 7a851a41a5
commit 8e91ac0bc4
175 changed files with 2079 additions and 933 deletions

View File

@@ -62,35 +62,33 @@ public class Xot_defn_tmpl implements Xot_defn {
}
public void Parse_tmpl(Xop_ctx ctx) {ctx.Wiki().Parser_mgr().Main().Parse_text_to_defn(this, ctx, ctx.Tkn_mkr(), ns, name, data_raw);} boolean onlyinclude_parsed = false;
public boolean Tmpl_evaluate(Xop_ctx ctx, Xot_invk caller, Bry_bfr bfr) {
// synchronized (this) { // LOCK:DELETE; DATE:2016-07-06
if (root == null) Parse_tmpl(ctx);
Xoae_page page = ctx.Page();
if (!page.Tmpl_stack_add(full_name)) {
bfr.Add_str_a7("<!-- template loop detected:" + gplx.langs.htmls.Gfh_utl.Escape_html_as_str(String_.new_u8(name)) + " -->");
Xoa_app_.Usr_dlg().Log_many("", "", "template loop detected: url=~{0} name=~{1}", ctx.Page().Url().To_str(), name);
return false;
if (root == null) Parse_tmpl(ctx);
Xoae_page page = ctx.Page();
if (!page.Tmpl_stack_add(full_name)) {
bfr.Add_str_a7("<!-- template loop detected:" + gplx.langs.htmls.Gfh_utl.Escape_html_as_str(String_.new_u8(name)) + " -->");
Xoa_app_.Usr_dlg().Log_many("", "", "template loop detected: url=~{0} name=~{1}", ctx.Page().Url().To_str(), name);
return false;
}
boolean rv = true;
if (onlyInclude_exists) {
Xowe_wiki wiki = ctx.Wiki();
if (!onlyinclude_parsed) {
onlyinclude_parsed = true;
byte[] new_data = Extract_onlyinclude(data_raw, wiki.Utl__bfr_mkr());
Xop_ctx new_ctx = Xop_ctx.New__sub(wiki, ctx, page); // COMMENT:changed from ctx.Page() to page; DATE:2016-07-11
Xot_defn_tmpl tmpl = wiki.Parser_mgr().Main().Parse_text_to_defn_obj(new_ctx, new_ctx.Tkn_mkr(), wiki.Ns_mgr().Ns_template(), Bry_.Empty, new_data);
tmpl.Root().Tmpl_compile(new_ctx, new_data, Xot_compile_data.Null);
data_raw = new_data;
root = tmpl.Root();
}
boolean rv = true;
if (onlyInclude_exists) {
Xowe_wiki wiki = ctx.Wiki();
if (!onlyinclude_parsed) {
onlyinclude_parsed = true;
byte[] new_data = Extract_onlyinclude(data_raw, wiki.Utl__bfr_mkr());
Xop_ctx new_ctx = Xop_ctx.New__sub(wiki, ctx, page); // COMMENT:changed from ctx.Page() to page; DATE:2016-07-11
Xot_defn_tmpl tmpl = wiki.Parser_mgr().Main().Parse_text_to_defn_obj(new_ctx, new_ctx.Tkn_mkr(), wiki.Ns_mgr().Ns_template(), Bry_.Empty, new_data);
tmpl.Root().Tmpl_compile(new_ctx, new_data, Xot_compile_data.Null);
data_raw = new_data;
root = tmpl.Root();
}
}
int subs_len = root.Subs_len();
for (int i = 0; i < subs_len; i++) {
boolean result = root.Subs_get(i).Tmpl_evaluate(ctx, data_raw, caller, bfr);
if (!result) rv = false;
}
page.Tmpl_stack_del();
return rv;
// }
}
int subs_len = root.Subs_len();
for (int i = 0; i < subs_len; i++) {
boolean result = root.Subs_get(i).Tmpl_evaluate(ctx, data_raw, caller, bfr);
if (!result) rv = false;
}
page.Tmpl_stack_del();
return rv;
}
public Xot_defn Clone(int id, byte[] name) {throw Err_.new_unimplemented();}
boolean onlyInclude_exists;

View File

@@ -20,7 +20,7 @@ import gplx.core.primitives.*;
import gplx.xowa.xtns.scribunto.*;
public class Xot_invk_temp implements Xot_invk {
private List_adp list = List_adp_.New();
private Hash_adp_bry arg_key_hash;
private Hash_adp_bry arg_key_hash;
private Hash_adp arg_idx_hash; private Int_obj_ref arg_idx_ref;
Xot_invk_temp() {}
public Xot_invk_temp(boolean root_frame) {this.root_frame = root_frame;}

View File

@@ -233,7 +233,7 @@ public class Xot_invk_tkn extends Xop_tkn_itm_base implements Xot_invk {
}
if (ignore_hash.Get_by_bry(name_ary) == null) {
if (Pfunc_rel2abs.Rel2abs_ttl(name_ary, name_bgn, name_ary_len)) {// rel_path; EX: {{/../Peer page}}; DATE:2013-03-27
Bry_bfr tmp_bfr = ctx.App().Utl__bfr_mkr().Get_b512();
Bry_bfr tmp_bfr = ctx.Wiki().Utl__bfr_mkr().Get_b512();
name_ary = Pfunc_rel2abs.Rel2abs(tmp_bfr, Bry_.Mid(name_ary, name_bgn, name_ary_len), ctx.Page().Ttl().Raw());
tmp_bfr.Mkr_rls();
return SubEval(ctx, wiki, bfr, name_ary, caller, src);

View File

@@ -21,7 +21,7 @@ import gplx.xowa.parsers.xndes.*; import gplx.xowa.parsers.miscs.*;
public class Xot_tmpl_wtr {
public byte[] Write_all(Xop_ctx ctx, Xop_root_tkn root, byte[] src) {
// synchronized (this) { // THREAD:added synchronized after "failed to write tkn" DATE:2015-04-29
Bry_bfr rslt_bfr = ctx.App().Utl__bfr_mkr().Get_m001();
Bry_bfr rslt_bfr = ctx.Wiki().Utl__bfr_mkr().Get_m001();
ctx.Tmpl_output_(rslt_bfr);
rslt_bfr.Reset_if_gt(Io_mgr.Len_mb);
Write_tkn(ctx, src, src.length, rslt_bfr, root);
@@ -68,7 +68,7 @@ public class Xot_tmpl_wtr {
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();
Bry_bfr tmp_bfr = ctx.Wiki().Utl__bfr_mkr().Get_k004();
int nowiki_content_bgn = xnde.Tag_open_end(), nowiki_content_end = xnde.Tag_close_bgn();
boolean escaped = gplx.xowa.parsers.tmpls.Nowiki_escape_itm.Escape(tmp_bfr, src, nowiki_content_bgn, nowiki_content_end);
rslt_bfr.Add_bfr_or_mid(escaped, tmp_bfr, src, nowiki_content_bgn, nowiki_content_end);