mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
v2.11.1.1
This commit is contained in:
@@ -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.parsers.tmpls; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*;
|
||||
import gplx.xowa.htmls.*;
|
||||
public class Arg_itm_tkn_null extends Xop_tkn_null implements Arg_itm_tkn { public int Dat_bgn() {return -1;}
|
||||
public int Dat_end() {return -1;} public Arg_itm_tkn Dat_end_(int v) {return this;}
|
||||
public Arg_itm_tkn Dat_rng_(int bgn, int end) {return this;}
|
||||
|
||||
@@ -38,5 +38,5 @@ class Arg_itm_tkn_mock extends Arg_itm_tkn_base {
|
||||
this.Dat_ary_(dat_ary);
|
||||
this.val = v;
|
||||
} String val;
|
||||
@Override public boolean Tmpl_evaluate(Xop_ctx ctx, byte[] src, Xot_invk caller, Bry_bfr bfr) {bfr.Add_str(val); return true;}
|
||||
@Override public boolean Tmpl_evaluate(Xop_ctx ctx, byte[] src, Xot_invk caller, Bry_bfr bfr) {bfr.Add_str_u8(val); 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.parsers.tmpls; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*;
|
||||
import gplx.core.log_msgs.*;
|
||||
public class Xop_curly_log {
|
||||
private static final Gfo_msg_grp owner = Gfo_msg_grp_.new_(Xoa_app_.Nde, "curly");
|
||||
public static final Gfo_msg_itm
|
||||
|
||||
@@ -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.parsers.tmpls; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*;
|
||||
import gplx.core.log_msgs.*;
|
||||
public class Xop_tmpl_log {
|
||||
private static final Gfo_msg_grp owner = Gfo_msg_grp_.new_(Xoa_app_.Nde, "tmpl");
|
||||
public static final Gfo_msg_itm
|
||||
|
||||
@@ -41,12 +41,12 @@ public class Xot_defn_tmpl implements Xot_defn {
|
||||
int src_len = src.length;
|
||||
while (true) {
|
||||
int find_bgn = Bry_find_.Find_fwd(src, Bry_onlyinclude_bgn, pos, src_len);
|
||||
if (find_bgn == Bry_.NotFound) {
|
||||
if (find_bgn == Bry_find_.Not_found) {
|
||||
break;
|
||||
}
|
||||
int find_bgn_lhs = find_bgn + Bry_onlyinclude_bgn_len;
|
||||
int find_end = Bry_find_.Find_fwd(src, Bry_onlyinclude_end, find_bgn_lhs, src_len);
|
||||
if (find_end == Bry_.NotFound) {
|
||||
if (find_end == Bry_find_.Not_found) {
|
||||
break;
|
||||
}
|
||||
bfr.Add_mid(src, find_bgn_lhs, find_end);
|
||||
|
||||
@@ -94,9 +94,9 @@ public class Xot_defn_trace_dbg implements Xot_defn_trace {
|
||||
String s = (String)argKeys.Get_at(i);
|
||||
String key = String_.GetStrBefore(s, "=");
|
||||
String val = String_.GetStrAfter(s, "=");
|
||||
bfr.Add_byte_repeat(Byte_ascii.Space, indent + 2).Add_str(key)
|
||||
bfr.Add_byte_repeat(Byte_ascii.Space, indent + 2).Add_str_u8(key)
|
||||
.Add_byte_repeat(Byte_ascii.Space, key_max - String_.Len(key))
|
||||
.Add_byte(Byte_ascii.Colon).Add_byte(Byte_ascii.Space).Add_str(val).Add_byte_nl();
|
||||
.Add_byte(Byte_ascii.Colon).Add_byte(Byte_ascii.Space).Add_str_u8(val).Add_byte_nl();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ public class Xot_invk_tkn extends Xop_tkn_itm_base implements Xot_invk {
|
||||
// ignore "{{Template:"; EX: {{Template:a}} is the same thing as {{a}}
|
||||
boolean template_prefix_found = false;
|
||||
int tmpl_ns_len = wiki.Ns_mgr().Tmpls_get_w_colon(name_ary, name_bgn, name_ary_len);
|
||||
if (tmpl_ns_len != Bry_.NotFound) {
|
||||
if (tmpl_ns_len != Bry_find_.Not_found) {
|
||||
name_ary = Bry_.Mid(name_ary, name_bgn + tmpl_ns_len, name_ary_len);
|
||||
name_ary_len = name_ary.length;
|
||||
name_bgn = 0;
|
||||
@@ -124,7 +124,7 @@ public class Xot_invk_tkn extends Xop_tkn_itm_base implements Xot_invk {
|
||||
case Xot_defn_.Tid_func:
|
||||
if (defn.Defn_require_colon_arg()) {
|
||||
colon_pos = Bry_find_.Find_fwd(name_ary, Byte_ascii.Colon);
|
||||
if (colon_pos == Bry_.NotFound)
|
||||
if (colon_pos == Bry_find_.Not_found)
|
||||
defn = Xot_defn_.Null;
|
||||
}
|
||||
else {
|
||||
@@ -134,7 +134,7 @@ public class Xot_invk_tkn extends Xop_tkn_itm_base implements Xot_invk {
|
||||
case Xot_defn_.Tid_raw:
|
||||
case Xot_defn_.Tid_msg:
|
||||
int raw_colon_pos = Bry_find_.Find_fwd(name_ary, Byte_ascii.Colon);
|
||||
if (raw_colon_pos == Bry_.NotFound) {} // colon missing; EX: {{raw}}; noop and assume template name; DATE:2014-02-11
|
||||
if (raw_colon_pos == Bry_find_.Not_found) {} // colon missing; EX: {{raw}}; noop and assume template name; DATE:2014-02-11
|
||||
else { // colon present;
|
||||
name_ary = Bry_.Mid(name_ary, finder.Subst_end() + 1, name_ary_len); // chop off "raw"; +1 is for ":"; note that +1 is in bounds b/c raw_colon was found
|
||||
name_ary_len = name_ary.length;
|
||||
|
||||
@@ -435,7 +435,7 @@ public class Xot_invk_wkr_basic_tst {
|
||||
}
|
||||
@Test public void Tmpl_case_match() { // PURPOSE: template name should match by case; EX:es.d:eclipse; DATE:2014-02-12
|
||||
fxt.Init_defn_clear();
|
||||
fxt.Init_defn_add("CASE_MATCH", "found", Xow_ns_case_.Id_all);
|
||||
fxt.Init_defn_add("CASE_MATCH", "found", Xow_ns_case_.Tid__all);
|
||||
fxt.Test_parse_tmpl_str("{{case_match}}", "[[:Template:case_match]]"); // Xot_invk_tkn will do 2 searches: "test" and "Test"
|
||||
fxt.Test_parse_tmpl_str("{{cASE_MATCH}}", "found"); // Xot_invk_tkn will do 2 searches: "tEST" and "TEST"
|
||||
fxt.Init_defn_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.parsers.tmpls; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*;
|
||||
import gplx.core.log_msgs.*;
|
||||
public class Xot_prm_log {
|
||||
private static final Gfo_msg_grp owner = Gfo_msg_grp_.new_(Xoa_app_.Nde, "tmpl_defn_arg");
|
||||
public static final Gfo_msg_itm
|
||||
|
||||
Reference in New Issue
Block a user