mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
v1.9.5.1
This commit is contained in:
@@ -23,7 +23,7 @@ public class Xop_xatr_parser { // REF.MW:Sanitizer.php|decodeTagAttributes;MW_AT
|
||||
private int atr_bgn = -1, key_bgn = -1, key_end = -1, eq_pos = -1, val_bgn = -1, val_end = -1; boolean valid = true;
|
||||
private byte quote_byte = Byte_ascii.Nil;
|
||||
private Hash_adp_bry repeated_atrs_hash = Hash_adp_bry.ci_ascii_(); // ASCII:xnde_atrs
|
||||
private Bry_bfr key_bfr = Bry_bfr.new_(), val_bfr = Bry_bfr.new_(); boolean key_bfr_on = false, val_bfr_on = false;
|
||||
private Bry_bfr key_bfr = Bry_bfr.new_(), val_bfr = Bry_bfr.new_(); boolean key_bfr_on = false, val_bfr_on = false, ws_is_before_val = false;
|
||||
public Bry_obj_ref Bry_obj() {return bry_ref;} private Bry_obj_ref bry_ref = Bry_obj_ref.null_();
|
||||
public int Xnde_find_gt_find(byte[] src, int pos, int end) {
|
||||
bry_ref.Val_(null);
|
||||
@@ -84,6 +84,7 @@ public class Xop_xatr_parser { // REF.MW:Sanitizer.php|decodeTagAttributes;MW_AT
|
||||
mode = Mode_atr_bgn;
|
||||
val_bfr.Clear();
|
||||
val_bfr_on = false;
|
||||
ws_is_before_val = false;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
@@ -219,6 +220,7 @@ public class Xop_xatr_parser { // REF.MW:Sanitizer.php|decodeTagAttributes;MW_AT
|
||||
case Mode_val_bgn:
|
||||
switch (b) {
|
||||
case Byte_ascii.Space: case Byte_ascii.NewLine: case Byte_ascii.Tab: // skip-ws
|
||||
ws_is_before_val = true;
|
||||
break;
|
||||
case Byte_ascii.Quote: case Byte_ascii.Apos:
|
||||
mode = Mode_val_quote; quote_byte = b; prv_is_ws = false;
|
||||
@@ -262,15 +264,11 @@ public class Xop_xatr_parser { // REF.MW:Sanitizer.php|decodeTagAttributes;MW_AT
|
||||
Make(log_mgr, src, i + 1); // NOTE: set atr_end *after* quote
|
||||
}
|
||||
prv_is_ws = false; if (val_bfr_on) val_bfr.Add_byte(b); // INLINE: add char
|
||||
// else {
|
||||
// if (!val_bfr_on) val_bfr.Add_mid(src, val_bgn, i + 1); // +1 to include '
|
||||
// val_bfr_on = true;
|
||||
// }
|
||||
break;
|
||||
case Byte_ascii.Lt: // "<" try to find nowiki inside atr
|
||||
int gt_pos = Xnde_find_gt(log_mgr, src, i, end);
|
||||
if (gt_pos == String_.Find_none) {
|
||||
// valid = false; mode = Mode_invalid; // DELETE: 2012-11-13; unpaired < should not mark atr invalid; EX: style='margin:1em<f'
|
||||
// valid = false; mode = Mode_invalid; // DELETE: 2012-11-13; unpaired < should not mark atr invalid; EX: style='margin:1em<f'
|
||||
if (!val_bfr_on) val_bfr.Add_mid(src, val_bgn, i + 1); // +1 to include <
|
||||
val_bfr_on = true;
|
||||
}
|
||||
@@ -292,23 +290,12 @@ public class Xop_xatr_parser { // REF.MW:Sanitizer.php|decodeTagAttributes;MW_AT
|
||||
prv_is_ws = true; val_bfr.Add_byte(Byte_ascii.Space);
|
||||
}
|
||||
break;
|
||||
// case Byte_ascii.Space: // DELETE: 2012-10-14: no test to support this construct; causes problems with "a b c"
|
||||
// if (prv_is_ws) {
|
||||
// if (!val_bfr_on) {
|
||||
// val_bfr.Add_mid(src, val_bgn, i);
|
||||
// val_bfr_on = true;
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// prv_is_ws = true;
|
||||
// }
|
||||
// break;
|
||||
default:
|
||||
prv_is_ws = false; if (val_bfr_on) val_bfr.Add_byte(b); // INLINE: add char
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case Mode_val_raw:
|
||||
case Mode_val_raw: // no quotes; EX:a=bcd
|
||||
switch (b) {
|
||||
case Byte_ascii.Num_0: case Byte_ascii.Num_1: case Byte_ascii.Num_2: case Byte_ascii.Num_3: case Byte_ascii.Num_4:
|
||||
case Byte_ascii.Num_5: case Byte_ascii.Num_6: case Byte_ascii.Num_7: case Byte_ascii.Num_8: case Byte_ascii.Num_9:
|
||||
@@ -334,6 +321,18 @@ public class Xop_xatr_parser { // REF.MW:Sanitizer.php|decodeTagAttributes;MW_AT
|
||||
val_end = i;
|
||||
Make(log_mgr, src, i);
|
||||
break;
|
||||
case Byte_ascii.Eq: // EX:"a= b=c" or "a=b=c"; PAGE:en.w:2013_in_American_television
|
||||
if (ws_is_before_val) { // "a= b=c"; discard 1st and resume at 2nd
|
||||
int old_val_bgn = val_bgn;
|
||||
valid = false; mode = Mode_invalid; Make(log_mgr, src, val_bgn); // invalidate cur atr; EX:"a="
|
||||
atr_bgn = key_bgn = old_val_bgn; // reset atr / key to new atr; EX: "b"
|
||||
key_end = i;
|
||||
mode = Mode_val_bgn; // set mode to val_bgn (basically, put after =)
|
||||
}
|
||||
else { // "a=b=c"; discard all
|
||||
valid = false; mode = Mode_invalid;
|
||||
}
|
||||
break;
|
||||
case Byte_ascii.Lt:
|
||||
val_end = i;
|
||||
Make(log_mgr, src, i);
|
||||
@@ -375,7 +374,7 @@ public class Xop_xatr_parser { // REF.MW:Sanitizer.php|decodeTagAttributes;MW_AT
|
||||
xatrs.Add(xatr);
|
||||
mode = Mode_atr_bgn; quote_byte = Byte_ascii.Nil; valid = true;
|
||||
atr_bgn = key_bgn = val_bgn = key_end = val_end = eq_pos = -1;
|
||||
val_bfr_on = key_bfr_on = false;
|
||||
val_bfr_on = key_bfr_on = ws_is_before_val = false;
|
||||
}
|
||||
private void Invalidate_repeated_atr(Xop_xatr_itm cur, byte[] key_bry) {
|
||||
Xop_xatr_itm prv = (Xop_xatr_itm)repeated_atrs_hash.Fetch(key_bry);
|
||||
|
||||
@@ -42,12 +42,14 @@ public class Xop_xatr_parser_tst {
|
||||
@Test public void Quote_ws_nl() {fxt.tst_("a='b\nc'", fxt.new_atr_("a", "b c"));}
|
||||
@Test public void Quote_ws_mult() {fxt.tst_("a='b c'", fxt.new_atr_("a", "b c"));}
|
||||
@Test public void Quote_ws_mult_mult() {fxt.tst_("a='b c d'", fxt.new_atr_("a", "b c d"));} // PURPOSE: fix wherein 1st-gobble gobbled rest of spaces (was b cd)
|
||||
@Test public void Quote_apos() {fxt.tst_("a=\"b c'd\"", fxt.new_atr_("a", "b c'd"));} // PURPOSE: fix wherein apos was gobbled up; EX: s:Alice's_Adventures_in_Wonderland; DATE:2013-11-22
|
||||
@Test public void Quote_apos_2() {fxt.tst_("a=\"b'c d\"", fxt.new_atr_("a", "b'c d"));} // PURPOSE: fix wherein apos was causing "'b'c d"; EX:s:Grimm's_Household_Tales,_Volume_1; DATE:2013-12-22
|
||||
@Test public void Quote_apos() {fxt.tst_("a=\"b c'd\"", fxt.new_atr_("a", "b c'd"));} // PURPOSE: fix wherein apos was gobbled up; PAGE:en.s:Alice's_Adventures_in_Wonderland; DATE:2013-11-22
|
||||
@Test public void Quote_apos_2() {fxt.tst_("a=\"b'c d\"", fxt.new_atr_("a", "b'c d"));} // PURPOSE: fix wherein apos was causing "'b'c d"; PAGE:en.s:Grimm's_Household_Tales,_Volume_1; DATE:2013-12-22
|
||||
@Test public void Multiple() {fxt.tst_("a b1 c", fxt.new_atr_("a", "a"), fxt.new_atr_("b1", "b1"), fxt.new_atr_("c", "c"));}
|
||||
@Test public void Ws() {fxt.tst_("a = 'b'", fxt.new_atr_("a", "b"));} // PURPOSE: fix wherein multiple space was causing "a=a"; EX:fr.s:La_Sculpture_dans_les_cimetières_de_Paris/Père-Lachaise; DATE:2014-01-18
|
||||
@Test public void Ws() {fxt.tst_("a = 'b'", fxt.new_atr_("a", "b"));} // PURPOSE: fix wherein multiple space was causing "a=a"; PAGE:fr.s:La_Sculpture_dans_les_cimetières_de_Paris/Père-Lachaise; DATE:2014-01-18
|
||||
@Test public void Dangling_eos() {fxt.tst_("a='b' c='d", fxt.new_atr_("a", "b"), fxt.new_invalid_(6, 10));} // PURPOSE: handle dangling quote at eos; PAGE:en.w:Aubervilliers DATE:2014-06-25
|
||||
@Test public void Dangling_bos() {fxt.tst_("a='b c=d", fxt.new_invalid_(0, 4), fxt.new_atr_("c", "d"));} // PURPOSE: handle dangling quote at bos; resume at next valid atr; PAGE:en.w:Aubervilliers DATE:2014-06-25
|
||||
@Test public void Invalid_incomplete() {fxt.tst_("a= c=d", fxt.new_invalid_(0, 3), fxt.new_atr_("c", "d"));} // PURPOSE: discard xatr if incomplete and followed by valid atr; PAGE:en.w:2013_in_American_television DATE:2014-09-25
|
||||
@Test public void Invalid_incomplete_2() {fxt.tst_("a=c=d", fxt.new_invalid_(0, 5));} // PURPOSE: variation of above; per MW regex, missing space invalidates entire attribute; DATE:2014-09-25
|
||||
/*
|
||||
TODO:
|
||||
change ws to be end; EX: "a=b c=d" atr1 ends at 4 (not 3)
|
||||
|
||||
@@ -39,7 +39,6 @@ public class Xop_xnde_tag {
|
||||
public Xop_xnde_tag EndNdeMode_escape_() {endNdeMode = Xop_xnde_tag_.EndNdeMode_escape; return this;}
|
||||
public boolean SingleOnly() {return singleOnly;} public Xop_xnde_tag SingleOnly_() {singleOnly = true; return this;} private boolean singleOnly;
|
||||
public boolean TblSub() {return tblSub;} public Xop_xnde_tag TblSub_() {tblSub = true; return this;} private boolean tblSub;
|
||||
public boolean Nest() {return nest;} public Xop_xnde_tag Nest_() {nest = true; return this;} private boolean nest;
|
||||
public boolean Restricted() {return restricted;} public Xop_xnde_tag Restricted_() {restricted = true; return this;} private boolean restricted;
|
||||
public boolean NoInline() {return noInline;} public Xop_xnde_tag NoInline_() {noInline = true; return this;} private boolean noInline;
|
||||
public boolean Inline_by_backslash() {return inline_by_backslash;} public Xop_xnde_tag Inline_by_backslash_() {inline_by_backslash = true; return this;} private boolean inline_by_backslash;
|
||||
|
||||
@@ -156,21 +156,21 @@ public class Xop_xnde_tag_ {
|
||||
, Tag_strike = new_(Tid_strike, "strike").NoInline_()
|
||||
, Tag_del = new_(Tid_del, "del").NoInline_()
|
||||
, Tag_s = new_(Tid_s, "s").NoInline_()
|
||||
, Tag_sub = new_(Tid_sub, "sub").NoInline_().Nest_()
|
||||
, Tag_sup = new_(Tid_sup, "sup").NoInline_().Nest_()
|
||||
, Tag_big = new_(Tid_big, "big").NoInline_().Nest_()
|
||||
, Tag_small = new_(Tid_small, "small").NoInline_().Nest_()
|
||||
, Tag_sub = new_(Tid_sub, "sub").NoInline_()
|
||||
, Tag_sup = new_(Tid_sup, "sup").NoInline_()
|
||||
, Tag_big = new_(Tid_big, "big").NoInline_()
|
||||
, Tag_small = new_(Tid_small, "small").NoInline_()
|
||||
, Tag_code = new_(Tid_code, "code").NoInline_().Repeat_ends_()
|
||||
, Tag_tt = new_(Tid_tt, "tt").NoInline_().Repeat_ends_()
|
||||
, Tag_kbd = new_(Tid_kbd, "kbd").NoInline_()
|
||||
, Tag_samp = new_(Tid_samp, "samp").NoInline_()
|
||||
, Tag_blockquote = new_(Tid_blockquote, "blockquote").NoInline_().Repeat_mids_().Nest_().Section_().Block_open_bgn_().Block_close_end_() // NOTE: should be open_end_, but leaving for now; DATE:2014-03-11; added Repeat_mids_(); PAGE:en.w:Ring_a_Ring_o'_Roses DATE:2014-06-26
|
||||
, Tag_blockquote = new_(Tid_blockquote, "blockquote").NoInline_().Repeat_mids_().Section_().Block_open_bgn_().Block_close_end_() // NOTE: should be open_end_, but leaving for now; DATE:2014-03-11; added Repeat_mids_(); PAGE:en.w:Ring_a_Ring_o'_Roses DATE:2014-06-26
|
||||
, Tag_pre = new_(Tid_pre, "pre").NoInline_().Section_().Xtn_().Raw_().Block_open_bgn_().Block_close_end_().Ignore_empty_().Xtn_skips_template_args_()
|
||||
, Tag_font = new_(Tid_font, "font").NoInline_().Nest_()
|
||||
, Tag_center = new_(Tid_center, "center").NoInline_().Nest_().Block_open_end_().Block_close_end_() // removed .Repeat_ends_(); added Nest_(); EX: w:Burr Truss; DATE:2012-12-12
|
||||
, Tag_font = new_(Tid_font, "font").NoInline_()
|
||||
, Tag_center = new_(Tid_center, "center").NoInline_().Block_open_end_().Block_close_end_() // removed .Repeat_ends_(); added Nest_(); EX: w:Burr Truss; DATE:2012-12-12
|
||||
, Tag_p = new_(Tid_p, "p").NoInline_().Section_().Block_open_bgn_().Block_close_end_()
|
||||
, Tag_span = new_(Tid_span, "span").Nest_().Section_()
|
||||
, Tag_div = new_(Tid_div, "div").Nest_().Section_().Block_open_end_().Block_close_end_()
|
||||
, Tag_span = new_(Tid_span, "span").Section_()
|
||||
, Tag_div = new_(Tid_div, "div").Section_().Block_open_end_().Block_close_end_()
|
||||
, Tag_hr = new_(Tid_hr, "hr").SingleOnly_().BgnNdeMode_inline_().Inline_by_backslash_().EndNdeMode_escape_().Section_().Block_close_end_()
|
||||
, Tag_br = new_(Tid_br, "br").SingleOnly_().BgnNdeMode_inline_().Inline_by_backslash_().EndNdeMode_inline_().Section_()
|
||||
, Tag_h1 = new_(Tid_h1, "h1").NoInline_().Section_().Block_open_bgn_().Block_close_end_()
|
||||
@@ -179,16 +179,16 @@ public class Xop_xnde_tag_ {
|
||||
, Tag_h4 = new_(Tid_h4, "h4").NoInline_().Section_().Block_open_bgn_().Block_close_end_()
|
||||
, Tag_h5 = new_(Tid_h5, "h5").NoInline_().Section_().Block_open_bgn_().Block_close_end_()
|
||||
, Tag_h6 = new_(Tid_h6, "h6").NoInline_().Section_().Block_open_bgn_().Block_close_end_()
|
||||
, Tag_li = new_(Tid_li, "li").Repeat_mids_().Empty_ignored_().Block_open_bgn_().Block_close_end_().Nest_() // added .Nest() DATE:2014-06-26
|
||||
, Tag_li = new_(Tid_li, "li").Repeat_mids_().Empty_ignored_().Block_open_bgn_().Block_close_end_()
|
||||
, Tag_dt = new_(Tid_dt, "dt").Repeat_mids_()
|
||||
, Tag_dd = new_(Tid_dd, "dd").Repeat_mids_()
|
||||
, Tag_ol = new_(Tid_ol, "ol").NoInline_().Nest_().Block_open_bgn_().Block_close_end_()
|
||||
, Tag_ul = new_(Tid_ul, "ul").NoInline_().Nest_().Block_open_bgn_().Block_close_end_()
|
||||
, Tag_dl = new_(Tid_dl, "dl").NoInline_().Nest_()
|
||||
, Tag_table = new_(Tid_table, "table").NoInline_().Nest_().Block_open_bgn_().Block_close_end_()
|
||||
, Tag_tr = new_(Tid_tr, "tr").Nest_().TblSub_().Block_open_bgn_().Block_open_end_()
|
||||
, Tag_td = new_(Tid_td, "td").Nest_().TblSub_().Block_open_end_().Block_close_bgn_()
|
||||
, Tag_th = new_(Tid_th, "th").Nest_().TblSub_().Block_open_end_().Block_close_bgn_()
|
||||
, Tag_ol = new_(Tid_ol, "ol").NoInline_().Block_open_bgn_().Block_close_end_()
|
||||
, Tag_ul = new_(Tid_ul, "ul").NoInline_().Block_open_bgn_().Block_close_end_()
|
||||
, Tag_dl = new_(Tid_dl, "dl").NoInline_()
|
||||
, Tag_table = new_(Tid_table, "table").NoInline_().Block_open_bgn_().Block_close_end_()
|
||||
, Tag_tr = new_(Tid_tr, "tr").TblSub_().Block_open_bgn_().Block_open_end_()
|
||||
, Tag_td = new_(Tid_td, "td").TblSub_().Block_open_end_().Block_close_bgn_()
|
||||
, Tag_th = new_(Tid_th, "th").TblSub_().Block_open_end_().Block_close_bgn_()
|
||||
, Tag_thead = new_(Tid_thead, "thead")
|
||||
, Tag_tfoot = new_(Tid_tfoot, "tfoot")
|
||||
, Tag_tbody = new_(Tid_tbody, "tbody")
|
||||
@@ -208,8 +208,8 @@ public class Xop_xnde_tag_ {
|
||||
, Tag_xowa_cmd = new_(Tid_xowa_cmd, "xowa_cmd").Xtn_()
|
||||
, Tag_poem = new_(Tid_poem, "poem").Xtn_().Xtn_auto_close_()
|
||||
, Tag_math = new_(Tid_math, "math").Xtn_()
|
||||
, Tag_ref = new_(Tid_ref, "ref").Xtn_().Nest_()
|
||||
, Tag_references = new_(Tid_references, "references").Xtn_().Nest_()
|
||||
, Tag_ref = new_(Tid_ref, "ref").Xtn_()
|
||||
, Tag_references = new_(Tid_references, "references").Xtn_()
|
||||
, Tag_source = new_(Tid_source, "source").Xtn_().Block_open_bgn_().Block_close_end_() // deactivate pre; pre; PAGE:en.w:Comment_(computer_programming); DATE:2014-06-23
|
||||
, Tag_syntaxHighlight = new_(Tid_syntaxHighlight, "syntaxHighlight").Xtn_().Block_open_bgn_().Block_close_end_() // deactivate pre; pre; PAGE:en.w:Comment_(computer_programming); DATE:2014-06-23
|
||||
, Tag_gallery = new_(Tid_gallery, "gallery").Xtn_().Block_open_bgn_().Block_close_end_().Xtn_auto_close_()
|
||||
@@ -242,7 +242,7 @@ public class Xop_xnde_tag_ {
|
||||
, Tag_data = new_(Tid_data, "data")
|
||||
, Tag_mark = new_(Tid_mark, "mark")
|
||||
, Tag_wbr = new_(Tid_wbr, "wbr").SingleOnly_()
|
||||
, Tag_bdo = new_(Tid_bdo, "bdo").NoInline_().Nest_().Section_().Block_open_bgn_().Block_close_end_()
|
||||
, Tag_bdo = new_(Tid_bdo, "bdo").NoInline_().Section_().Block_open_bgn_().Block_close_end_()
|
||||
, Tag_listing_buy = new_(Tid_listing_buy, "buy").Xtn_()
|
||||
, Tag_listing_do = new_(Tid_listing_do, "do").Xtn_()
|
||||
, Tag_listing_drink = new_(Tid_listing_drink, "drink").Xtn_()
|
||||
|
||||
@@ -23,8 +23,7 @@ public class Xop_xnde_wkr implements Xop_ctx_wkr {
|
||||
public boolean Pre_at_bos() {return pre_at_bos;} public void Pre_at_bos_(boolean v) {pre_at_bos = v;} private boolean pre_at_bos;
|
||||
public void Page_bgn(Xop_ctx ctx, Xop_root_tkn root) {}
|
||||
public void Page_end(Xop_ctx ctx, Xop_root_tkn root, byte[] src, int src_len) {this.Clear();}
|
||||
private void Clear() {
|
||||
|
||||
private void Clear() {
|
||||
pre_at_bos = false;
|
||||
}
|
||||
public void AutoClose(Xop_ctx ctx, Xop_root_tkn root, byte[] src, int src_len, int bgn_pos, int cur_pos, Xop_tkn_itm tkn, int closing_tkn_tid) {
|
||||
@@ -338,7 +337,6 @@ public class Xop_xnde_wkr implements Xop_ctx_wkr {
|
||||
else if (tagId == prv_xnde_tagId && tag.Repeat_mids()) { // EX: "<li>a<li>b" -> "<li>a</li><li>b"
|
||||
End_tag(ctx, root, prv_xnde, src, src_len, bgn_pos - 1, bgn_pos - 1, tagId, true, tag);
|
||||
}
|
||||
else if (!tag.Nest() && Stack_find_xnde(ctx, tagId)) return ctx.Lxr_make_log_(Xop_xnde_log.Invalid_nest, src, bgn_pos, gtPos);
|
||||
else if (tag.SingleOnly()) inline = true; // <br></br> not allowed; convert <br> to <br/> </br> will be escaped
|
||||
else if (tag.NoInline() && inline) {
|
||||
Xop_xnde_tkn xnde_inline = Xnde_bgn(ctx, tkn_mkr, root, tag, Xop_xnde_tkn.CloseMode_open, src, bgn_pos, open_tag_end, atrs_bgn, atrs_end, atrs);
|
||||
|
||||
@@ -68,15 +68,6 @@ public class Xop_xnde_wkr__basic_tst {
|
||||
@Test public void Escaped() {
|
||||
fxt.Init_log_(Xop_xnde_log.Escaped_xnde).Test_parse_page_wiki("<div></span></div>", fxt.tkn_xnde_(0, 18).Subs_(fxt.tkn_bry_(5, 12)));// TIDY.dangling: tidy will correct dangling node; DATE:2014-07-22
|
||||
}
|
||||
@Test public void Nest() {// REVISIT: 2nd <b> should be converted to </b>; other </b> ignored; WHEN: with example
|
||||
fxt.Init_log_(Xop_xnde_log.Invalid_nest, Xop_xnde_log.Escaped_xnde).Test_parse_page_wiki("a<b>b<b>c</b>d</b>e"
|
||||
, fxt.tkn_txt_ ( 0, 1)
|
||||
, fxt.tkn_xnde_ ( 1, 13).Subs_(fxt.tkn_txt_(4, 9))
|
||||
, fxt.tkn_txt_ (13, 14)
|
||||
, fxt.tkn_bry_(14, 18) // TIDY.dangling: tidy will correct dangling node; DATE:2014-07-22
|
||||
, fxt.tkn_txt_ (18, 19)
|
||||
);
|
||||
}
|
||||
@Test public void Xtn() {
|
||||
fxt.Test_parse_page_wiki("<math><div></math>", fxt.tkn_xnde_(0, 18).Subs_(fxt.tkn_txt_(6, 11))); // NOTE: no dangling nde b/c .Xtn skips
|
||||
}
|
||||
|
||||
@@ -30,9 +30,9 @@ public class Xop_xnde_wkr__err_dangling_tst {
|
||||
}
|
||||
@Test public void Nested() {
|
||||
fxt.Test_parse_page_wiki_str
|
||||
( "<div><div><center>a</div></div>"
|
||||
, "<div><div><center>a</center></div></div>"
|
||||
);
|
||||
( "<div><div><center>a</div></div>"
|
||||
, "<div><div><center>a</center></div></div>"
|
||||
);
|
||||
}
|
||||
@Test public void Center() {
|
||||
fxt.Init_log_(Xop_xnde_log.Dangling_xnde).Test_parse_page_wiki("a<center>b"
|
||||
@@ -47,6 +47,12 @@ public class Xop_xnde_wkr__err_dangling_tst {
|
||||
, fxt.tkn_xnde_ (5, 13).Subs_(fxt.tkn_txt_(8, 9))
|
||||
);
|
||||
}
|
||||
@Test public void Alternating() { // PURPOSE: confirmation test for alternating dangling nodes; PAGE:en.w:Portal:Pornography/Selected_historical_image/Archive; DATE:2014-09-24
|
||||
fxt.Test_parse_page_wiki_str
|
||||
( "c<b><i>d<b><i>e"
|
||||
, "c<b><i>d<b><i>e</i></b></i></b>"
|
||||
);
|
||||
}
|
||||
@Test public void Li() { // PURPOSE: auto-close <li>; NOTE: no longer encloses in <ul/>; DATE:2014-06-26
|
||||
fxt.Test_parse_page_wiki_str
|
||||
( "<li>a<li>b"
|
||||
|
||||
@@ -69,15 +69,15 @@ public class Xop_xnde_wkr__include_basic_tst {
|
||||
<includeonly>-({{{1}}}={{{1}}}round-5)-({{{1}}}={{{1}}}round-4)-({{{1}}}={{{1}}}round-3)-({{{1}}}={{{1}}}round-2)-({{{1}}}={{{1}}}round-1)</includeonly><noinclude>
|
||||
{{pp-template}}Called by {{lt|precision/0}}</noinclude>
|
||||
|
||||
==includeonly==
|
||||
==includeonly -- aka: do not eval in template ==
|
||||
main: a<includeonly>b</includeonly>c<br/>
|
||||
tmpl: {{mwo_include_only|a|b|c}}
|
||||
|
||||
==noinclude==
|
||||
==noinclude -- aka: eval in template only==
|
||||
main: a<noinclude>b</noinclude>c<br/>
|
||||
tmpl: {{mwo_no_include|a|b|c}}
|
||||
|
||||
==onlyinclude==
|
||||
==onlyinclude -- aka: only include in template only (ignore everything else) ==
|
||||
main: a<onlyinclude>b</onlyinclude>c<br/>
|
||||
tmpl: {{mwo_only_include|a|b|c}}
|
||||
*/
|
||||
@@ -172,10 +172,6 @@ public class Xop_xnde_wkr__include_uncommon_tst {
|
||||
( "<pre>a</pre>"
|
||||
));
|
||||
}
|
||||
@Test public void Noinclude_inline_w_space_inside_safesubst() { // PURPOSE: "<noinclude />" did not work with safesubst b/c of space; PAGE:en.w:Wikipedia:Featured_picture_candidates; DATE:2014-06-24
|
||||
fxt.Test_parse_tmpl_str_test("{{SAFESUBST:<noinclude />#if:val_exists|y|n}}", "{{test}}", "y");
|
||||
}
|
||||
|
||||
// @Test public void Pre_and_includeonly2() {
|
||||
// fxt.Init_defn_add("pre2", "<pre<includeonly></includeonly>><nowiki>{{{1}}}</nowiki></pre>");
|
||||
// fxt.Test_parse_page_all_str
|
||||
@@ -184,4 +180,15 @@ public class Xop_xnde_wkr__include_uncommon_tst {
|
||||
// ( "<pre>a</pre>"
|
||||
// ));
|
||||
// }
|
||||
@Test public void Noinclude_inline_w_space_inside_safesubst() { // PURPOSE: "<noinclude />" did not work with safesubst b/c of space; PAGE:en.w:Wikipedia:Featured_picture_candidates; DATE:2014-06-24
|
||||
fxt.Test_parse_tmpl_str_test("{{SAFESUBST:<noinclude />#if:val_exists|y|n}}", "{{test}}", "y");
|
||||
}
|
||||
@Test public void Subst() {// PURPOSE: handle subst-includeonly-subst combination; PAGE:pt.w:Argentina DATE:2014-09-24
|
||||
fxt.Init_defn_clear();
|
||||
fxt.Init_defn_add("test", "{{<includeonly>subst:</includeonly>#switch:1|1=y|default=n}}");
|
||||
//fxt.Init_defn_add("test", "{{subst:#switch:1|1=y|default=n}}"); // keeping around for debugging purposes
|
||||
//fxt.Init_defn_add("test", "{{<includeonly>#switch:</includeonly>1|1=y|default=n}}"); // keeping around for debugging purposes
|
||||
fxt.Test_parse_page_all_str("{{test}}", "{{subst:#switch:1|1=y|default=n}}"); // note that subst is preserved b/c of <includeonly>
|
||||
fxt.Test_parse_page_all_str("{{subst:test}}", "y"); // note that expression is evaluated b/c of subst:
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user