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-09-27 23:04:13 -04:00
parent fa70c05354
commit 8e18af05b6
84 changed files with 2795 additions and 507 deletions

View File

@@ -18,7 +18,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.xowa.parsers.xndes; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*;
import org.junit.*; import gplx.core.tests.*;
public class Xop_xatr_parser_tst {
@Test public void Kv_quote_double() {fxt.tst_("a=\"b\"", fxt.new_atr_("a", "b"));} private Xop_xatr_parser_fxt fxt = new Xop_xatr_parser_fxt();
private final Xop_xatr_parser_fxt fxt = new Xop_xatr_parser_fxt();
@Test public void Kv_quote_double() {fxt.tst_("a=\"b\"", fxt.new_atr_("a", "b"));}
@Test public void Kv_quote_single() {fxt.tst_("a='b'", fxt.new_atr_("a", "b"));}
@Test public void Kv_quote_none() {fxt.tst_("a=b", fxt.new_atr_("a", "b"));}
@Test public void Kv_empty() {fxt.tst_("a=''", fxt.new_atr_("a", ""));}

View File

@@ -49,12 +49,12 @@ class Xop_xatr_whitelist_fxt {
public void Clear() {
if (whitelist_mgr == null) whitelist_mgr = new Xop_xatr_whitelist_mgr().Ini();
} private Xop_xatr_whitelist_mgr whitelist_mgr;
public void Whitelist(byte tag_id, String key_str, boolean expd) {
public void Whitelist(int tag_id, String key_str, boolean expd) {
byte[] key_bry = Bry_.new_a7(key_str);
atr_itm.Key_rng_(0, key_bry.length);
Tfds.Eq(expd, whitelist_mgr.Chk(tag_id, key_bry, atr_itm), key_str);
} private Xop_xatr_itm atr_itm = new Xop_xatr_itm(0, 0);
public void Whitelist(byte tag_id, String key_str, String val_str, boolean expd) {
public void Whitelist(int tag_id, String key_str, String val_str, boolean expd) {
byte[] key_bry = Bry_.new_a7(key_str);
atr_itm.Key_rng_(0, key_bry.length);
atr_itm.Val_bry_(Bry_.new_a7(val_str));

View File

@@ -22,32 +22,33 @@ public class Xop_xnde_tag {
this.id = id;
this.name_bry = Bry_.new_a7(name_str);
this.name_str = name_str;
name_len = name_bry.length;
xtn_end_tag = Bry_.Add(Xop_xnde_tag_.XtnEndTag_bgn, name_bry); // always force endtag; needed for <noinclude>
xtn_end_tag_tmp = new byte[xtn_end_tag.length]; Array_.Copy(xtn_end_tag, xtn_end_tag_tmp);
this.name_len = name_bry.length;
this.xtn_end_tag = Bry_.Add(Xop_xnde_tag_.Xtn_end_tag_bgn, name_bry); // always force endtag; needed for <noinclude>
this.xtn_end_tag_tmp = new byte[xtn_end_tag.length]; Array_.Copy(xtn_end_tag, xtn_end_tag_tmp);
}
public int Id() {return id;} public Xop_xnde_tag Id_(int v) {id = v; return this;} private int id;
public byte[] Name_bry() {return name_bry;} private byte[] name_bry;
public String Name_str() {return name_str;} private String name_str;
public int Name_len() {return name_len;} private int name_len;
public int Id() {return id;} private final int id;
public byte[] Name_bry() {return name_bry;} private final byte[] name_bry;
public String Name_str() {return name_str;} private final String name_str;
public int Name_len() {return name_len;} private final int name_len;
public byte[] Xtn_end_tag() {return xtn_end_tag;} private final byte[] xtn_end_tag;
public byte[] Xtn_end_tag_tmp() {return xtn_end_tag_tmp;} private final byte[] xtn_end_tag_tmp;
public boolean Xtn() {return xtn;} public Xop_xnde_tag Xtn_() {xtn = true; return this;} private boolean xtn;
public boolean Xtn_mw() {return xtn_mw;} public Xop_xnde_tag Xtn_mw_() {xtn_mw = true; xtn = true; return this;} private boolean xtn_mw; // NOTE: Xtn_mw_() marks both xtn and xtn_mw as true
public byte[] XtnEndTag() {return xtn_end_tag;} private byte[] xtn_end_tag;
public byte[] XtnEndTag_tmp() {return xtn_end_tag_tmp;} private byte[] xtn_end_tag_tmp;
public int BgnNdeMode() {return bgnNdeMode;} private int bgnNdeMode = Xop_xnde_tag_.BgnNdeMode_normal;
public Xop_xnde_tag BgnNdeMode_inline_() {bgnNdeMode = Xop_xnde_tag_.BgnNdeMode_inline; return this;}
public int EndNdeMode() {return endNdeMode;} private int endNdeMode = Xop_xnde_tag_.EndNdeMode_normal;
public Xop_xnde_tag EndNdeMode_inline_() {endNdeMode = Xop_xnde_tag_.EndNdeMode_inline; return this;}
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 int Bgn_nde_mode() {return bgn_nde_mode;} private int bgn_nde_mode = Xop_xnde_tag_.Bgn_nde_mode_normal;
public Xop_xnde_tag Bgn_nde_mode_inline_() {bgn_nde_mode = Xop_xnde_tag_.Bgn_nde_mode_inline; return this;}
public int End_nde_mode() {return end_nde_mode;} private int end_nde_mode = Xop_xnde_tag_.End_nde_mode_normal;
public Xop_xnde_tag End_nde_mode_inline_() {end_nde_mode = Xop_xnde_tag_.End_nde_mode_inline; return this;}
public Xop_xnde_tag End_nde_mode_escape_() {end_nde_mode = Xop_xnde_tag_.End_nde_mode_escape; return this;}
public boolean Single_only() {return single_only;} public Xop_xnde_tag Single_only_() {single_only = true; return this;} private boolean single_only;
public boolean Tbl_sub() {return tbl_sub;} public Xop_xnde_tag Tbl_sub_() {tbl_sub = true; return this;} private boolean tbl_sub;
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 No_inline() {return no_inline;} public Xop_xnde_tag No_inline_() {no_inline = true; return this;} private boolean no_inline;
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;
public boolean Section() {return section;} public Xop_xnde_tag Section_() {section = true; return this;} private boolean section;
public boolean Repeat_ends() {return repeat_ends;} public Xop_xnde_tag Repeat_ends_() {repeat_ends = true; return this;} private boolean repeat_ends;
public boolean Repeat_mids() {return repeat_mids;} public Xop_xnde_tag Repeat_mids_() {repeat_mids = true; return this;} private boolean repeat_mids;
public boolean Empty_ignored() {return empty_ignored;} public Xop_xnde_tag Empty_ignored_() {empty_ignored = true; return this;} private boolean empty_ignored;
public boolean Single_only_html() {return single_only_html;} public Xop_xnde_tag Single_only_html_() {single_only_html = true; return this;} private boolean single_only_html;
public boolean Raw() {return raw;} public Xop_xnde_tag Raw_() {raw = true; return this;} private boolean raw;
public static final byte Block_noop = 0, Block_bgn = 1, Block_end = 2;
public byte Block_open() {return block_open;} private byte block_open = Block_noop;

View File

@@ -18,12 +18,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.xowa.parsers.xndes; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*;
import gplx.xowa.langs.*;
public class Xop_xnde_tag_ {
public static final int EndNdeMode_normal = 0, EndNdeMode_inline = 1, EndNdeMode_escape = 2; // escape is for hr which does not support </hr>
public static final int BgnNdeMode_normal = 0, BgnNdeMode_inline = 1;
public static final int End_nde_mode_normal = 0, End_nde_mode_inline = 1, End_nde_mode_escape = 2; // escape is for hr which does not support </hr>
public static final int Bgn_nde_mode_normal = 0, Bgn_nde_mode_inline = 1;
public static final byte[] Name_onlyinclude = Bry_.new_a7("onlyinclude");
public static final byte[] XtnEndTag_bgn = Bry_.new_a7("</");//, XtnEndTag_end = Bry_.new_a7(">");
public static final byte
Tid_b = 0
public static final byte[] Xtn_end_tag_bgn = Bry_.new_a7("</");//, Xtn_end_tag_end = Bry_.new_a7(">");
public static final int
Tid__null = -1
, Tid_b = 0
, Tid_strong = 1
, Tid_i = 2
, Tid_em = 3
@@ -147,64 +148,64 @@ public class Xop_xnde_tag_ {
return rv;
}
public static final Xop_xnde_tag
Tag_b = new_(Tid_b, "b").NoInline_()
, Tag_strong = new_(Tid_strong, "strong").NoInline_()
, Tag_i = new_(Tid_i, "i").NoInline_()
, Tag_em = new_(Tid_em, "em").NoInline_()
, Tag_cite = new_(Tid_cite, "cite").NoInline_()
, Tag_dfn = new_(Tid_dfn, "dfn").NoInline_()
, Tag_var = new_(Tid_var, "var").NoInline_()
, Tag_u = new_(Tid_u, "u").NoInline_().Repeat_ends_() // PAGE:en.b:Textbook_of_Psychiatry/Alcoholism_and_Psychoactive_Substance_Use_Disorders; DATE:2014-09-05
, Tag_ins = new_(Tid_ins, "ins").NoInline_()
, Tag_abbr = new_(Tid_abbr, "abbr").NoInline_()
, 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_()
, 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_().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_()
, 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_b = new_(Tid_b, "b").No_inline_()
, Tag_strong = new_(Tid_strong, "strong").No_inline_()
, Tag_i = new_(Tid_i, "i").No_inline_()
, Tag_em = new_(Tid_em, "em").No_inline_()
, Tag_cite = new_(Tid_cite, "cite").No_inline_()
, Tag_dfn = new_(Tid_dfn, "dfn").No_inline_()
, Tag_var = new_(Tid_var, "var").No_inline_()
, Tag_u = new_(Tid_u, "u").No_inline_().Repeat_ends_() // PAGE:en.b:Textbook_of_Psychiatry/Alcoholism_and_Psychoactive_Substance_Use_Disorders; DATE:2014-09-05
, Tag_ins = new_(Tid_ins, "ins").No_inline_()
, Tag_abbr = new_(Tid_abbr, "abbr").No_inline_()
, Tag_strike = new_(Tid_strike, "strike").No_inline_()
, Tag_del = new_(Tid_del, "del").No_inline_()
, Tag_s = new_(Tid_s, "s").No_inline_()
, Tag_sub = new_(Tid_sub, "sub").No_inline_()
, Tag_sup = new_(Tid_sup, "sup").No_inline_()
, Tag_big = new_(Tid_big, "big").No_inline_()
, Tag_small = new_(Tid_small, "small").No_inline_()
, Tag_code = new_(Tid_code, "code").No_inline_().Repeat_ends_()
, Tag_tt = new_(Tid_tt, "tt").No_inline_().Repeat_ends_()
, Tag_kbd = new_(Tid_kbd, "kbd").No_inline_()
, Tag_samp = new_(Tid_samp, "samp").No_inline_()
, Tag_blockquote = new_(Tid_blockquote, "blockquote").No_inline_().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").No_inline_().Section_().Xtn_().Raw_().Block_open_bgn_().Block_close_end_().Ignore_empty_().Xtn_skips_template_args_()
, Tag_font = new_(Tid_font, "font").No_inline_()
, Tag_center = new_(Tid_center, "center").No_inline_().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").No_inline_().Section_().Block_open_bgn_().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_()
, Tag_h2 = new_(Tid_h2, "h2").NoInline_().Section_().Block_open_bgn_().Block_close_end_()
, Tag_h3 = new_(Tid_h3, "h3").NoInline_().Section_().Block_open_bgn_().Block_close_end_()
, 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_hr = new_(Tid_hr, "hr").Single_only_().Single_only_html_().Bgn_nde_mode_inline_().Inline_by_backslash_().End_nde_mode_escape_().Section_().Block_close_end_()
, Tag_br = new_(Tid_br, "br").Single_only_().Single_only_html_().Bgn_nde_mode_inline_().Inline_by_backslash_().End_nde_mode_inline_().Section_()
, Tag_h1 = new_(Tid_h1, "h1").No_inline_().Section_().Block_open_bgn_().Block_close_end_()
, Tag_h2 = new_(Tid_h2, "h2").No_inline_().Section_().Block_open_bgn_().Block_close_end_()
, Tag_h3 = new_(Tid_h3, "h3").No_inline_().Section_().Block_open_bgn_().Block_close_end_()
, Tag_h4 = new_(Tid_h4, "h4").No_inline_().Section_().Block_open_bgn_().Block_close_end_()
, Tag_h5 = new_(Tid_h5, "h5").No_inline_().Section_().Block_open_bgn_().Block_close_end_()
, Tag_h6 = new_(Tid_h6, "h6").No_inline_().Section_().Block_open_bgn_().Block_close_end_()
, 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_().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_ol = new_(Tid_ol, "ol").No_inline_().Block_open_bgn_().Block_close_end_()
, Tag_ul = new_(Tid_ul, "ul").No_inline_().Block_open_bgn_().Block_close_end_()
, Tag_dl = new_(Tid_dl, "dl").No_inline_()
, Tag_table = new_(Tid_table, "table").No_inline_().Block_open_bgn_().Block_close_end_()
, Tag_tr = new_(Tid_tr, "tr").Tbl_sub_().Block_open_bgn_().Block_open_end_()
, Tag_td = new_(Tid_td, "td").Tbl_sub_().Block_open_end_().Block_close_bgn_()
, Tag_th = new_(Tid_th, "th").Tbl_sub_().Block_open_end_().Block_close_bgn_()
, Tag_thead = new_(Tid_thead, "thead")
, Tag_tfoot = new_(Tid_tfoot, "tfoot")
, Tag_tbody = new_(Tid_tbody, "tbody")
, Tag_caption = new_(Tid_caption, "caption").NoInline_().TblSub_()
, Tag_caption = new_(Tid_caption, "caption").No_inline_().Tbl_sub_()
, Tag_colgroup = new_(Tid_colgroup, "colgroup")
, Tag_col = new_(Tid_col, "col")
, Tag_a = new_(Tid_a, "a").Restricted_()
, Tag_img = new_(Tid_img, "img").Restricted_() // NOTE: was .Xtn() DATE:2014-11-06
, Tag_ruby = new_(Tid_ruby, "ruby").NoInline_()
, Tag_rt = new_(Tid_rt, "rt").NoInline_()
, Tag_rb = new_(Tid_rb, "rb").NoInline_()
, Tag_rp = new_(Tid_rp, "rp").NoInline_()
, Tag_img = new_(Tid_img, "img").Single_only_html_().Restricted_() // NOTE: was .Xtn() DATE:2014-11-06
, Tag_ruby = new_(Tid_ruby, "ruby").No_inline_()
, Tag_rt = new_(Tid_rt, "rt").No_inline_()
, Tag_rb = new_(Tid_rb, "rb").No_inline_()
, Tag_rp = new_(Tid_rp, "rp").No_inline_()
, Tag_includeonly = new_(Tid_includeonly, "includeonly")
, Tag_noinclude = new_(Tid_noinclude, "noinclude")
, Tag_onlyinclude = new_(Tid_onlyinclude, "onlyinclude")
@@ -245,8 +246,8 @@ public class Xop_xnde_tag_ {
, Tag_bdi = new_(Tid_bdi, "bdi")
, 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_().Section_().Block_open_bgn_().Block_close_end_()
, Tag_wbr = new_(Tid_wbr, "wbr").Single_only_().Single_only_html_()
, Tag_bdo = new_(Tid_bdo, "bdo").No_inline_().Section_().Block_open_bgn_().Block_close_end_()
, Tag_listing_buy = new_(Tid_listing_buy, "buy").Xtn_mw_()
, Tag_listing_do = new_(Tid_listing_do, "do").Xtn_mw_()
, Tag_listing_drink = new_(Tid_listing_drink, "drink").Xtn_mw_()

View File

@@ -22,11 +22,11 @@ public class Xop_xnde_tag_lang {
lang_code = Int_obj_ref.new_(lang_code_int);
this.name_str = name_str;
this.name_bry = Bry_.new_u8(name_str);
this.xtnEndTag_tmp = Bry_.Add(Xop_xnde_tag_.XtnEndTag_bgn, name_bry);
this.xtnEndTag_tmp = Bry_.Add(Xop_xnde_tag_.Xtn_end_tag_bgn, name_bry);
}
public Int_obj_ref Lang_code() {return lang_code;} private Int_obj_ref lang_code;
public String Name_str() {return name_str;} private String name_str;
public byte[] Name_bry() {return name_bry;} private byte[] name_bry;
public byte[] XtnEndTag_tmp() {return xtnEndTag_tmp;} private byte[] xtnEndTag_tmp;
public byte[] Xtn_end_tag_tmp() {return xtnEndTag_tmp;} private byte[] xtnEndTag_tmp;
public static final Xop_xnde_tag_lang _ = new Xop_xnde_tag_lang(-1, String_.Empty);
}

View File

@@ -106,7 +106,7 @@ public class Xop_xnde_tkn extends Xop_tkn_itm_base implements Xop_tblw_tkn {
this.Subs_get(i).Tmpl_evaluate(ctx, src, caller, bfr);
bfr.Add_mid(src, tag_close_bgn, tag_close_end); // write tag_end
if (tag_close_bgn == Int_.Min_value) {// xtn is unclosed; add a </xtn> else rest of page will be gobbled; PAGE:en.w:Provinces_and_territories_of_Canada DATE:2014-11-13
bfr.Add(tag.XtnEndTag());
bfr.Add(tag.Xtn_end_tag());
bfr.Add(Byte_ascii.Gt_bry);
}
}

View File

@@ -71,10 +71,10 @@ public class Xop_xnde_wkr implements Xop_ctx_wkr {
case Byte_ascii.Tab: case Byte_ascii.Nl: case Byte_ascii.Cr: case Byte_ascii.Space:
++atrs_bgn_pos; // set bgn_pos to be after ws
break;
case Byte_ascii.Slash: case Byte_ascii.Gt:
case Byte_ascii.Slash: case Byte_ascii.Angle_end:
++atrs_bgn_pos; // set bgn_pos to be after char
break;
case Byte_ascii.Backslash:
case Byte_ascii.Backslash: // NOTE: MW treats \ as /; EX: <br\>" -> "<br/>
++tag_end_pos;
break;
case Byte_ascii.Dollar:// handles <br$2>;
@@ -246,7 +246,7 @@ public class Xop_xnde_wkr implements Xop_ctx_wkr {
}
}
int end_rhs = -1, findPos = gtPos;
byte[] end_bry = Xop_xnde_tag_.Tag_noinclude.XtnEndTag(); int end_bry_len = end_bry.length;
byte[] end_bry = Xop_xnde_tag_.Tag_noinclude.Xtn_end_tag(); int end_bry_len = end_bry.length;
if (tag_is_closing) // </noinclude>; no end tag to search for; DATE:2014-05-02
end_rhs = gtPos;
else { // <noinclude>; search for end tag
@@ -281,7 +281,7 @@ public class Xop_xnde_wkr implements Xop_ctx_wkr {
break;
case Byte_ascii.Backslash: // allow <br\>; EX:w:Mosquito
if (tag.Inline_by_backslash())
src[tag_end_pos] = Byte_ascii.Slash;
src[tag_end_pos] = Byte_ascii.Slash;
break;
case Byte_ascii.Gt: // ">" "normal" tag; noop
break;
@@ -323,7 +323,7 @@ public class Xop_xnde_wkr implements Xop_ctx_wkr {
boolean tag_ignore = false;
int tagId = tag.Id();
if (tagId == Xop_xnde_tag_.Tid_table || tag.TblSub()) { // tbl tag; EX: <table>,<tr>,<td>,<th>
if (tagId == Xop_xnde_tag_.Tid_table || tag.Tbl_sub()) { // tbl tag; EX: <table>,<tr>,<td>,<th>
Tblw_bgn(ctx, tkn_mkr, root, src, src_len, bgn_pos, gtPos + 1, tagId, atrs_bgn, atrs_end);
return gtPos + 1;
}
@@ -338,8 +338,8 @@ 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.SingleOnly()) inline = true; // <br></br> not allowed; convert <br> to <br/> </br> will be escaped
else if (tag.NoInline() && inline) {
else if (tag.Single_only()) inline = true; // <br></br> not allowed; convert <br> to <br/> </br> will be escaped
else if (tag.No_inline() && 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);
End_tag(ctx, root, xnde_inline, src, src_len, bgn_pos, gtPos, tagId, false, tag);
ctx.Msg_log().Add_itm_none(Xop_xnde_log.No_inline, src, bgn_pos, gtPos);
@@ -347,7 +347,7 @@ public class Xop_xnde_wkr implements Xop_ctx_wkr {
}
Xop_xnde_tkn xnde = null;
xnde = Xnde_bgn(ctx, tkn_mkr, root, tag, inline ? Xop_xnde_tkn.CloseMode_inline : Xop_xnde_tkn.CloseMode_open, src, bgn_pos, open_tag_end, atrs_bgn, atrs_end, atrs);
if (!inline && tag.BgnNdeMode() != Xop_xnde_tag_.BgnNdeMode_inline)
if (!inline && tag.Bgn_nde_mode() != Xop_xnde_tag_.Bgn_nde_mode_inline)
ctx.Stack_add(xnde);
if (tag_ignore)
xnde.Tag_visible_(false);
@@ -414,7 +414,7 @@ public class Xop_xnde_wkr implements Xop_ctx_wkr {
Xop_xnde_tkn bgn_nde = (Xop_xnde_tkn)ctx.Stack_get(prv_xnde_pos);
int bgn_tag_id = bgn_nde == null ? -1 : bgn_nde.Tag().Id();
int end_nde_mode = end_tag.EndNdeMode();
int end_nde_mode = end_tag.End_nde_mode();
boolean force_end_tag_to_match_bgn_tag = false;
switch (bgn_tag_id) {
case Xop_xnde_tag_.Tid_sub: if (end_tag_id == Xop_xnde_tag_.Tid_sup) force_end_tag_to_match_bgn_tag = true; break;
@@ -426,7 +426,7 @@ public class Xop_xnde_wkr implements Xop_ctx_wkr {
end_tag_id = bgn_tag_id;
ctx.Msg_log().Add_itm_none(Xop_xnde_log.Sub_sup_swapped, src, bgn_pos, cur_pos);
}
if (end_tag_id == Xop_xnde_tag_.Tid_table || end_tag.TblSub()) {
if (end_tag_id == Xop_xnde_tag_.Tid_table || end_tag.Tbl_sub()) {
Tblw_end(ctx, tkn_mkr, root, src, src_len, bgn_pos, cur_pos, end_tag_id);
return cur_pos;
}
@@ -437,10 +437,10 @@ public class Xop_xnde_wkr implements Xop_ctx_wkr {
return cur_pos;
}
switch (end_nde_mode) {
case Xop_xnde_tag_.EndNdeMode_inline: // PATCH.WP: allows </br>, </br/> and many other variants
case Xop_xnde_tag_.End_nde_mode_inline: // PATCH.WP: allows </br>, </br/> and many other variants
Xnde_bgn(ctx, tkn_mkr, root, end_tag, Xop_xnde_tkn.CloseMode_inline, src, bgn_pos, cur_pos, Int_.Min_value, Int_.Min_value, null); // NOTE: atrs is null b/c </br> will never have atrs
return cur_pos;
case Xop_xnde_tag_.EndNdeMode_escape: // handle </hr>
case Xop_xnde_tag_.End_nde_mode_escape: // handle </hr>
ctx.Lxr_make_(false);
ctx.Msg_log().Add_itm_none(Xop_xnde_log.Escaped_xnde, src, bgn_pos, cur_pos - 1);
return cur_pos;
@@ -576,13 +576,13 @@ public class Xop_xnde_wkr implements Xop_ctx_wkr {
xnde.Tag_close_rng_(open_end, open_end); // NOTE: inline tag, so set TagClose to open_end; should noop
}
else {
byte[] close_bry = tag.XtnEndTag_tmp(); // get tmp bry (so as not to new)
byte[] close_bry = tag.Xtn_end_tag_tmp(); // get tmp bry (so as not to new)
if (tag.Langs() != null) { // cur tag has langs; EX:<section>; DATE:2014-07-18
Xop_xnde_tag_lang tag_lang = tag.Langs_get(ctx.Lang().Case_mgr(), ctx.Cur_page().Lang().Lang_id(), src, name_bgn, name_end);
if (tag_lang == null) // tag does not match lang; EX:<trecho> and lang=de;
return ctx.Lxr_make_txt_(open_end);
if (tag_lang != Xop_xnde_tag_lang._) // tag matches; note Xop_xnde_tag_lang._ is a wildcard match; EX:<section>
close_bry = tag_lang.XtnEndTag_tmp();
close_bry = tag_lang.Xtn_end_tag_tmp();
}
int src_offset = open_bgn - 1; // open bgn to start at <; -2 to ignore </ ; +1 to include <
int close_ary_len = close_bry.length;