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

'v3.8.5.1'

This commit is contained in:
gnosygnu
2016-08-29 23:31:58 -04:00
parent e4a2af026b
commit 232838c732
292 changed files with 4502 additions and 1838 deletions

View File

@@ -18,62 +18,66 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.langs.htmls; import gplx.*; import gplx.langs.*;
public class Gfh_tag_ { // NOTE: not serialized; used by tag_rdr
public static final int
Id__comment = -3
, Id__eos = -2
, Id__any = -1
, Id__unknown = 0
, Id__h1 = 1
, Id__h2 = 2
, Id__h3 = 3
, Id__h4 = 4
, Id__h5 = 5
, Id__h6 = 6
, Id__a = 7
, Id__span = 8
, Id__div = 9
, Id__img = 10
, Id__ul = 11
, Id__ol = 12
, Id__li = 13
, Id__dd = 14
, Id__dt = 15
, Id__p = 16
, Id__br = 17
, Id__hr = 18
, Id__table = 19
, Id__tr = 20
, Id__td = 21
, Id__th = 22
, Id__thead = 23
, Id__tbody = 24
, Id__caption = 25
, Id__pre = 26
, Id__small = 27
, Id__i = 28
, Id__b = 29
, Id__sup = 30
, Id__sub = 31
, Id__bdi = 32
, Id__font = 33
, Id__strong = 34
, Id__s = 35
, Id__abbr = 36
, Id__cite = 37
, Id__var = 38
, Id__u = 39
, Id__big = 40
, Id__del = 41
, Id__strike = 42
, Id__tt = 43
, Id__code = 44
, Id__wbr = 45
, Id__center = 46 // en.v:Vandalism_in_progress
, Id__dfn = 47
, Id__kbd = 48
, Id__samp = 49
, Id__ins = 50
, Id__em = 51
Id__comment = -3
, Id__eos = -2
, Id__any = -1
, Id__unknown = 0
, Id__h1 = 1
, Id__h2 = 2
, Id__h3 = 3
, Id__h4 = 4
, Id__h5 = 5
, Id__h6 = 6
, Id__a = 7
, Id__span = 8
, Id__div = 9
, Id__img = 10
, Id__ul = 11
, Id__ol = 12
, Id__li = 13
, Id__dd = 14
, Id__dt = 15
, Id__p = 16
, Id__br = 17
, Id__hr = 18
, Id__table = 19
, Id__tr = 20
, Id__td = 21
, Id__th = 22
, Id__thead = 23
, Id__tbody = 24
, Id__caption = 25
, Id__pre = 26
, Id__small = 27
, Id__i = 28
, Id__b = 29
, Id__sup = 30
, Id__sub = 31
, Id__bdi = 32
, Id__font = 33
, Id__strong = 34
, Id__s = 35
, Id__abbr = 36
, Id__cite = 37
, Id__var = 38
, Id__u = 39
, Id__big = 40
, Id__del = 41
, Id__strike = 42
, Id__tt = 43
, Id__code = 44
, Id__wbr = 45
, Id__center = 46 // not HTML5, but used by en.v:Vandalism_in_progress
, Id__dfn = 47
, Id__kbd = 48
, Id__samp = 49
, Id__ins = 50
, Id__em = 51
, Id__blockquote = 52
, Id__map = 53
, Id__bdo = 54
;
// private static final int Id__ary_max = 54;
public static final byte[]
Bry__a = Bry_.new_a7("a")
, Bry__ul = Bry_.new_a7("ul")
@@ -85,7 +89,18 @@ public class Gfh_tag_ { // NOTE: not serialized; used by tag_rdr
, Bry__script = Bry_.new_a7("script")
, Bry__xowa_any = Bry_.new_a7("xowa_any")
, Bry__xowa_comment = Bry_.new_a7("xowa_comment")
, Bry__img = Bry_.new_a7("img")
;
// private static final Gfh_tag_meta[] Ary = new Gfh_tag_meta[Id__ary_max];
// private static final Hash_adp_bry tags_by_bry = Hash_adp_bry.ci_a7();
// public static Gfh_tag_meta New_tag(int id, String key_str) {
// Gfh_tag_meta rv = new Gfh_tag_meta(id, key_str);
// Ary[id] = rv;
// tags_by_bry.Add_bry_int(rv.Key_bry(), id);
// return rv;
// }
public static final Hash_adp_bry Hash = Hash_adp_bry.ci_a7()
.Add_bry_int(Bry__a , Id__a)
.Add_str_int("h1" , Id__h1)
@@ -138,6 +153,9 @@ public class Gfh_tag_ { // NOTE: not serialized; used by tag_rdr
.Add_str_int("samp" , Id__samp)
.Add_str_int("ins" , Id__ins)
.Add_str_int("em" , Id__em)
.Add_str_int("blockquote" , Id__blockquote)
.Add_str_int("map" , Id__map)
.Add_str_int("bdo" , Id__bdo)
;
public static String To_str(int tid) {
switch (tid) {
@@ -196,6 +214,9 @@ public class Gfh_tag_ { // NOTE: not serialized; used by tag_rdr
case Id__samp: return "samp";
case Id__ins: return "ins";
case Id__em: return "em";
case Id__blockquote: return "blockquote";
case Id__map: return "map";
case Id__bdo: return "bdo";
default: throw Err_.new_unhandled(tid);
}
}

View File

@@ -0,0 +1,28 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
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.langs.htmls; import gplx.*; import gplx.langs.*;
public class Gfh_tag_meta {
public Gfh_tag_meta(int id, String key_str) {
this.id = id;
this.key_str = key_str;
this.key_bry = Bry_.new_u8(key_str);
}
public int Id() {return id;} private final int id;
public String Key_str() {return key_str;} private final String key_str;
public byte[] Key_bry() {return key_bry;} private final byte[] key_bry;
}

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.langs.htmls; import gplx.*; import gplx.langs.*;
import gplx.core.primitives.*; import gplx.core.btries.*; import gplx.langs.htmls.encoders.*;
import gplx.langs.htmls.entitys.*;
public class Gfh_utl {
public class Gfh_utl {// TS:Gfo_url_encoder is TS
private static final Gfo_url_encoder encoder_id = Gfo_url_encoder_.Id;
public static String Encode_id_as_str(byte[] key) {return String_.new_u8(Encode_id_as_bry(key));}
public static byte[] Encode_id_as_bry(byte[] key) {

View File

@@ -20,6 +20,7 @@ import gplx.xowa.parsers.htmls.*; import gplx.langs.htmls.styles.*; import gplx.
public class Gfh_tag implements Mwh_atr_wkr {
private Gfh_tag_rdr tag_rdr;
private Ordered_hash atrs_hash; private boolean atrs_null; private int atrs_bgn, atrs_end;
private final Gfh_style_wkr__val_as_int style_wkr = new Gfh_style_wkr__val_as_int();
public Gfh_tag Init(Gfh_tag_rdr tag_rdr, byte[] src, boolean tag_is_tail, boolean tag_is_inline, int src_bgn, int src_end, int atrs_bgn, int atrs_end, int name_id, byte[] name_bry) {
this.tag_rdr = tag_rdr; this.src = src; this.atrs_null = true;
this.tag_is_tail = tag_is_tail; this.tag_is_inline = tag_is_inline;
@@ -79,7 +80,6 @@ public class Gfh_tag implements Mwh_atr_wkr {
byte rv = Gfh_class_.Find_1st(src, cls_atr.Val_bgn(), cls_atr.Val_end(), hash); if (rv == Byte_.Max_value_127) return or;
return rv;
}
private static final Gfh_style_wkr__val_as_int style_wkr = new Gfh_style_wkr__val_as_int();
public int Atrs__style_get_as_int(byte[] key) {
if (atrs_null) Atrs__make();
Gfh_atr rv = (Gfh_atr)atrs_hash.Get_by(Gfh_atr_.Bry__style); if (rv == null) return -1;

View File

@@ -113,6 +113,7 @@ public class Gfh_tag_rdr {
}
}
public Gfh_tag Tag__move_fwd_tail(byte[] find_tag_bry) {return Tag__find(Bool_.Y, Bool_.N, Bool_.Y, pos, src_end, find_tag_bry);}
public Gfh_tag Tag__peek_fwd_tail(byte[] find_tag_bry) {return Tag__find(Bool_.N, Bool_.N, Bool_.Y, pos, src_end, find_tag_bry);}
private Gfh_tag Tag__find(boolean move, boolean bwd, boolean tail, int rng_bgn, int rng_end, byte[] find_tag_bry) {
int tmp = rng_bgn;
int stop_pos = rng_end; int adj = 1;

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.langs.htmls.encoders; import gplx.*; import gplx.langs.*; import gplx.langs.htmls.*;
import gplx.core.btries.*;
import gplx.langs.htmls.*;
public class Gfo_url_encoder implements Url_encoder_interface {
public class Gfo_url_encoder implements Url_encoder_interface { // TS; Gfo_url_encoder_itm[] are read-only; anchor_encoder is effectively read-only
private final Gfo_url_encoder_itm[] encode_ary, decode_ary; private final Gfo_url_encoder anchor_encoder;
public Gfo_url_encoder(Gfo_url_encoder_itm[] encode_ary, Gfo_url_encoder_itm[] decode_ary, Gfo_url_encoder anchor_encoder) {
this.encode_ary = encode_ary; this.decode_ary = decode_ary; this.anchor_encoder = anchor_encoder;

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.langs.htmls.styles; import gplx.*; import gplx.langs.*; import gplx.langs.htmls.*;
import org.junit.*;
public class Gfh_style_parser__tst {
private final Gfh_style_parser__fxt fxt = new Gfh_style_parser__fxt();
private final Gfh_style_parser__fxt fxt = new Gfh_style_parser__fxt();
@Test public void Basic() {
fxt.Test__parse("k_0:v_0" , fxt.Make("k_0", "v_0"));
fxt.Test__parse("k_0:v_0;" , fxt.Make("k_0", "v_0"));
@@ -41,7 +41,7 @@ public class Gfh_style_parser__tst {
}
}
class Gfh_style_parser__fxt {
private final Gfh_style_wkr__ary wkr = Gfh_style_wkr__ary.Instance;
private final Gfh_style_wkr__ary wkr = new Gfh_style_wkr__ary();
public Gfh_style_itm Make(String k, String v) {return new Gfh_style_itm(-1, Bry_.new_u8(k), Bry_.new_u8(v));}
public void Test__parse(String src_str, Gfh_style_itm... expd) {
byte[] src_bry = Bry_.new_u8(src_str);

View File

@@ -28,5 +28,4 @@ public class Gfh_style_wkr__ary implements Gfh_style_wkr {
Gfh_style_parser_.Parse(src, src_bgn, src_end, this);
return (Gfh_style_itm[])list.To_ary_and_clear(Gfh_style_itm.class);
}
public static final Gfh_style_wkr__ary Instance = new Gfh_style_wkr__ary(); Gfh_style_wkr__ary() {}
}