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

'v3.6.4.1'

This commit is contained in:
gnosygnu
2016-06-26 01:10:38 -04:00
parent 8afc115176
commit b3c2d3bb5f
108 changed files with 1813 additions and 873 deletions

View File

@@ -37,6 +37,11 @@ public class Gfh_tag_ {
, Id__br = 14
, Id__hr = 15
, Id__td = 16
, Id__pre = 17
, Id__small = 18
, Id__i = 19
, Id__b = 20
, Id__sup = 21
;
public static final byte[]
Bry__a = Bry_.new_a7("a")
@@ -64,6 +69,11 @@ public class Gfh_tag_ {
.Add_str_int("li" , Id__li)
.Add_str_int("td" , Id__td)
.Add_str_int("p" , Id__p)
.Add_str_int("pre" , Id__pre)
.Add_str_int("small" , Id__small)
.Add_str_int("i" , Id__i)
.Add_str_int("b" , Id__b)
.Add_str_int("sup" , Id__sup)
;
public static String To_str(int tid) {
switch (tid) {
@@ -86,6 +96,11 @@ public class Gfh_tag_ {
case Id__td: return "td";
case Id__ul: return "ul";
case Id__li: return "li";
case Id__pre: return "pre";
case Id__small: return "small";
case Id__i: return "i";
case Id__b: return "b";
case Id__sup: return "sup";
default: throw Err_.new_unhandled(tid);
}
}

View File

@@ -33,6 +33,9 @@ public class Gfh_tag_rdr {
tag__eos.Init(this, src, Bool_.N, Bool_.N, src_end, src_end, src_end, src_end, Gfh_tag_.Id__eos, Bry_.Empty);
err_wkr.Init_by_page(String_.new_u8(ctx_name), src);
}
public void Src_rng_(int src_bgn, int src_end) {
this.pos = src_bgn; this.src_end = src_end;
}
public int Pos() {return pos;} private int pos;
public void Pos_(int v) {this.pos = v;}
public void Atrs__make(Mwh_atr_wkr atr_wkr, int head_bgn, int head_end) {atr_parser.Parse(atr_wkr, -1, -1, src, head_bgn, head_end);}
@@ -58,6 +61,11 @@ public class Gfh_tag_rdr {
while (tmp != stop_pos) {
if (src[tmp] == Byte_ascii.Angle_bgn) {
rv = Tag__extract(move, tail, match_name_id, tmp);
if (rv.Name_id() == Gfh_tag_.Id__comment) { // ignore comments DATE:2016-06-25
tmp = rv.Src_end();
rv = null; // null rv, else rv will still be comment and may get returned to caller
continue;
}
if (Tag__match(move, bwd, tail, match_name_id, tmp_depth, rv))
break;
else {
@@ -82,12 +90,7 @@ public class Gfh_tag_rdr {
if ( tag_name_id != match_name_id // tag doesn't match requested
&& match_name_id != Gfh_tag_.Id__any // requested is not wildcard
) return false;
if (tag_name_id == Gfh_tag_.Id__comment) {
if (match_name_id == Gfh_tag_.Id__comment)
return true;
else
return false;
}
if (tag_name_id == Gfh_tag_.Id__comment) return true; // ignore comments
int depth = depth_obj.Val();
boolean tag_is_tail = tag.Tag_is_tail();
if (tail == tag_is_tail) {
@@ -141,6 +144,7 @@ public class Gfh_tag_rdr {
atrs_end = name_end;
inline = true;
loop = false;
++tag_end; // move tag_end after >
}
else {
name_end = tag_end = -1;

View File

@@ -28,7 +28,6 @@ public class Gfh_tag_rdr_tst {
}
@Test public void Comment() {
fxt.Init("1<!--2-->3<!--4-->5<div id='1'>6</div>");
fxt.Test__move_fwd_head(Gfh_tag_.Id__comment , "<!--2-->") ; fxt.Test__pos("3");
fxt.Test__move_fwd_head(Gfh_tag_.Id__any , "<div id='1'>") ; fxt.Test__pos("6");
}
@Test public void Meta() {
@@ -45,6 +44,10 @@ public class Gfh_tag_rdr_tst {
fxt.Test__move_fwd_head(Gfh_tag_.Id__div , "<div>") ; fxt.Test__pos("2");
fxt.Test__move_fwd_tail(Gfh_tag_.Id__div , "</div>") ; fxt.Test__pos("6");
}
@Test public void Inline() {
fxt.Init("1<br/>2");
fxt.Test__move_fwd_head(Gfh_tag_.Id__br , "<br/>") ; fxt.Test__pos("2");
}
}
class Gfh_tag_rdr_fxt {
private final Gfh_tag_rdr rdr = Gfh_tag_rdr.New__html();