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

Minor refactorings

This commit is contained in:
gnosygnu
2018-12-29 09:36:32 -05:00
parent 87cb6b5a01
commit b86228d6f2
14 changed files with 19 additions and 65 deletions

View File

@@ -29,7 +29,7 @@ public class Indicator_xnde implements Xox_xnde, Mwh_atr_itm_owner1 {
}
public void Xtn_parse(Xowe_wiki wiki, Xop_ctx ctx, Xop_root_tkn root, byte[] src, Xop_xnde_tkn xnde) {
Xox_xnde_.Xatr__set(wiki, this, xatrs_hash, src, xnde);
this.html = Xop_parser_.Parse_text_to_html(wiki, ctx, ctx.Page(), ctx.Page().Ttl(), Bry_.Mid(src, xnde.Tag_open_end(), xnde.Tag_close_bgn()), false);
this.html = Xop_parser_.Parse_text_to_html(wiki, ctx, ctx.Page(), Bry_.Mid(src, xnde.Tag_open_end(), xnde.Tag_close_bgn()), false);
Indicator_html_bldr html_bldr = ctx.Page().Html_data().Indicators();
if (this.name != null) html_bldr.Add(this); // NOTE: must do null-check b/c Add will use Name as key for hashtable
}

View File

@@ -45,10 +45,13 @@ public class Pfunc_tag extends Pf_func_base {// REF:/includes/parser/CoreParserF
Eval_attrs(ctx, wiki, caller, self, src, args_len, html_wkr);
// process body
byte[] body = args_len == 0
? Bry_.Empty
: Pf_func_.Eval_arg_or_empty(ctx, src, caller, self, args_len, 0);
html_wkr.Tag__process_body(body);
byte[] body = Bry_.Empty;
if (args_len > 0) {
body = Pf_func_.Eval_arg_or_empty(ctx, src, caller, self, args_len, 0);
// REF.MW: $inner = $frame->expand( array_shift( $args ) );
// body = Xop_parser_.Parse_text_to_html(wiki, ctx, ctx.Page(), body, false);
}
html_wkr.Tag__process_body(body);
// add to UNIQ hash; DATE:2017-03-31
byte[] val = html_wkr.Tag__build(ctx.Wiki(), ctx);

View File

@@ -51,4 +51,6 @@ public class Pfunc_tag_tst {
, "</ol>"
));
}
// TODO: handle; $inner = $frame->expand( array_shift( $args ) );
// @Test public void Nowiki() {fxt.Test_html_full_str("{{#tag:pre|<nowiki>a<i>b</i>c</nowiki>}}" , "<pre>a&lt;i&gt;b&lt;/i&gt;c</pre>");}// PURPOSE: body should get evaluated; DATE:2018-12-28
}

View File

@@ -33,7 +33,6 @@ class Pxd_itm_dow_name extends Pxd_itm_base implements Pxd_itm_prototype {
@Override public boolean Eval(Pxd_parser state) {return true;}
@Override public boolean Time_ini(Pxd_date_bldr bldr) {
DateAdp cur = bldr.To_date();
int cur_dow = cur.DayOfWeek();
// adj = requested_dow - cur_dow; EX: requesting Friday, and today is Wednesday; adj = 2 (4 - 2); DATE:2014-05-02
int adj = dow_idx - cur.DayOfWeek();

View File

@@ -90,7 +90,7 @@ public class Random_selection_xnde implements Xox_xnde, Mwh_atr_itm_owner2 {
if (!Bry_.Eq(atr_before, Bry_.Empty)) option_bry = Bry_.Add(atr_before, option_bry);
if (!Bry_.Eq(atr_after , Bry_.Empty)) option_bry = Bry_.Add(option_bry, atr_after);
this.val = Xop_parser_.Parse_text_to_html(wiki, ctx, ctx.Page(), ctx.Page().Ttl(), option_bry, false);
this.val = Xop_parser_.Parse_text_to_html(wiki, ctx, ctx.Page(), option_bry, false);
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, Xoae_page wpg, Xop_xnde_tkn xnde, byte[] src) {

View File

@@ -44,7 +44,7 @@ public class Tabber_xnde implements Xox_xnde {
else {
tab_head = Bry_.Mid(tab_itm, 0, eq_pos);
tab_body = Bry_.Mid(tab_itm, eq_pos + 1, tab_itm_len);
tab_body = Xop_parser_.Parse_text_to_html(wiki, ctx, ctx.Page(), ctx.Page().Ttl(), tab_body, false);
tab_body = Xop_parser_.Parse_text_to_html(wiki, ctx, ctx.Page(), tab_body, false);
}
tab_itms_list.Add(new Tabber_tab_itm(Bool_.N, tab_head, tab_body));
}

View File

@@ -123,7 +123,7 @@ class Tabview_tab_itm {
gplx.xowa.wikis.caches.Xow_page_cache_itm page_itm = wiki.Cache_mgr().Page_cache().Get_or_load_as_itm(page_ttl);
if (page_itm == null) return null;
page_body = page_itm.Wtxt__redirect_or_direct();
page_body = Xop_parser_.Parse_text_to_html(wiki, ctx, ctx.Page(), ctx.Page().Ttl(), page_body, false);
page_body = Xop_parser_.Parse_text_to_html(wiki, ctx, ctx.Page(), page_body, false);
break;
case 1:
tab_name = args_itm;