mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
'v3.8.2.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; import gplx.*; import gplx.xowa.*;
|
||||
import gplx.langs.htmls.entitys.*;
|
||||
import gplx.xowa.parsers.apos.*; import gplx.xowa.parsers.amps.*; import gplx.xowa.parsers.lnkes.*; import gplx.xowa.parsers.hdrs.*; import gplx.xowa.parsers.lists.*; import gplx.xowa.parsers.tblws.*;
|
||||
import gplx.xowa.parsers.paras.*; import gplx.xowa.parsers.xndes.*; import gplx.xowa.parsers.lnkis.*; import gplx.xowa.parsers.tmpls.*; import gplx.xowa.parsers.miscs.*; import gplx.xowa.parsers.vnts.*; import gplx.xowa.xtns.cites.*;
|
||||
public class Xop_tkn_mkr {
|
||||
@@ -25,7 +26,7 @@ public class Xop_tkn_mkr {
|
||||
public Xop_space_tkn Space_mutable(int bgn, int end) {return new Xop_space_tkn(false, bgn, end);}
|
||||
public Xop_apos_tkn Apos(int bgn, int end
|
||||
, int aposLen, int typ, int cmd, int lit_apos) {return new Xop_apos_tkn(bgn, end, aposLen, typ, cmd, lit_apos);}
|
||||
public Xop_tkn_itm Amp_txt(int bgn, int end, Xop_amp_trie_itm itm) {return new Xop_amp_tkn_ent(bgn, end, itm);}
|
||||
public Xop_tkn_itm Amp_txt(int bgn, int end, Gfh_entity_itm itm) {return new Xop_amp_tkn_ent(bgn, end, itm);}
|
||||
public Xop_tkn_itm Amp_num(int bgn, int end, int val_int, byte[] val_bry) {return new Xop_amp_tkn_num(bgn, end, val_int, val_bry);}
|
||||
public Xop_tkn_itm Amp_num(int bgn, int end, int val_int) {return new Xop_amp_tkn_num(bgn, end, val_int, gplx.core.intls.Utf16_.Encode_int_to_bry(val_int));}
|
||||
public Xop_nl_tkn NewLine(int bgn, int end, byte nl_typ, int nl_len) {return new Xop_nl_tkn(bgn, end, nl_typ, nl_len);}
|
||||
|
||||
@@ -22,9 +22,10 @@ import gplx.xowa.xtns.pfuncs.exprs.*; import gplx.xowa.xtns.math.*;
|
||||
public class Xop_tmp_mgr {
|
||||
public Xof_math_itm Math_itm() {return math_itm;} private final Xof_math_itm math_itm = new Xof_math_itm();
|
||||
public Xof_xfer_itm Xfer_itm() {return xfer_itm;} private final Xof_xfer_itm xfer_itm = new Xof_xfer_itm();
|
||||
public Gfo_number_parser Pfunc_num_parser_0() {return num_parser_0;} private final Gfo_number_parser num_parser_0 = new Gfo_number_parser().Hex_enabled_(true);
|
||||
public Gfo_number_parser Pfunc_num_parser_1() {return num_parser_1;} private final Gfo_number_parser num_parser_1 = new Gfo_number_parser().Hex_enabled_(true);
|
||||
public Gfo_number_parser Pfunc_num_parser_0() {return num_parser_0;} private final Gfo_number_parser num_parser_0 = new Gfo_number_parser().Hex_enabled_(true);
|
||||
public Gfo_number_parser Pfunc_num_parser_1() {return num_parser_1;} private final Gfo_number_parser num_parser_1 = new Gfo_number_parser().Hex_enabled_(true);
|
||||
public Pfunc_expr_shunter Expr_shunter() {return expr_shunter;} private final Pfunc_expr_shunter expr_shunter = new Pfunc_expr_shunter();
|
||||
public Btrie_slim_mgr Xnde__xtn_end() {return xnde__xtn_end;} private final Btrie_slim_mgr xnde__xtn_end = Btrie_slim_mgr.ci_a7(); // NOTE:ci.ascii:MW_const.en; listed XML node names are en
|
||||
public Btrie_rv Xnde__trv() {return xnde__trv;} private final Btrie_rv xnde__trv = new Btrie_rv();
|
||||
public Int_obj_ref Pfunc_rel2abs() {return pfunc_rel2abs;} private final Int_obj_ref pfunc_rel2abs = Int_obj_ref.New_zero();
|
||||
}
|
||||
|
||||
@@ -17,17 +17,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.parsers.amps; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*;
|
||||
import gplx.core.btries.*;
|
||||
import gplx.langs.htmls.entitys.*;
|
||||
public class Xop_amp_mgr { // TS
|
||||
private static final Btrie_rv trv = new Btrie_rv();
|
||||
public Btrie_slim_mgr Amp_trie() {return amp_trie;} private final Btrie_slim_mgr amp_trie = Xop_amp_trie.Instance;
|
||||
public Btrie_slim_mgr Amp_trie() {return amp_trie;} private final Btrie_slim_mgr amp_trie = Gfh_entity_trie.Instance;
|
||||
public Xop_amp_mgr_rslt Parse_tkn(Xop_tkn_mkr tkn_mkr, byte[] src, int src_len, int amp_pos, int bgn) {
|
||||
int fail_pos = amp_pos + 1; // default to fail pos which is after &
|
||||
|
||||
// check amp_trie; EX: 'lt'
|
||||
Xop_amp_mgr_rslt rv = new Xop_amp_mgr_rslt();
|
||||
Xop_amp_trie_itm itm; int cur;
|
||||
Gfh_entity_itm itm; int cur;
|
||||
synchronized (trv) {
|
||||
itm = (Xop_amp_trie_itm)amp_trie.Match_at(trv, src, bgn, src_len);
|
||||
itm = (Gfh_entity_itm)amp_trie.Match_at(trv, src, bgn, src_len);
|
||||
cur = trv.Pos();
|
||||
}
|
||||
|
||||
@@ -39,15 +40,15 @@ public class Xop_amp_mgr { // TS
|
||||
// check itm
|
||||
switch (itm.Tid()) {
|
||||
// letters; EX: '<'
|
||||
case Xop_amp_trie_itm.Tid_name_std:
|
||||
case Xop_amp_trie_itm.Tid_name_xowa:
|
||||
case Gfh_entity_itm.Tid_name_std:
|
||||
case Gfh_entity_itm.Tid_name_xowa:
|
||||
rv.Pos_(cur);
|
||||
rv.Tkn_(tkn_mkr.Amp_txt(amp_pos, cur, itm));
|
||||
return rv;
|
||||
// numbers; EX: '{' 'ģ'
|
||||
case Xop_amp_trie_itm.Tid_num_hex:
|
||||
case Xop_amp_trie_itm.Tid_num_dec:
|
||||
boolean ncr_is_hex = itm.Tid() == Xop_amp_trie_itm.Tid_num_hex;
|
||||
case Gfh_entity_itm.Tid_num_hex:
|
||||
case Gfh_entity_itm.Tid_num_dec:
|
||||
boolean ncr_is_hex = itm.Tid() == Gfh_entity_itm.Tid_num_hex;
|
||||
boolean pass = Parse_ncr(rv, ncr_is_hex, src, src_len, amp_pos, cur);
|
||||
if (pass) { // NOTE: do not set rv.Pos_(); will be set by Parse_ncr
|
||||
rv.Tkn_(tkn_mkr.Amp_num(amp_pos, rv.Pos(), rv.Val()));
|
||||
@@ -119,16 +120,16 @@ public class Xop_amp_mgr { // TS
|
||||
}
|
||||
bfr.Add_mid(src, 0, pos);
|
||||
}
|
||||
Xop_amp_trie_itm amp_itm = (Xop_amp_trie_itm)amp_obj;
|
||||
Gfh_entity_itm amp_itm = (Gfh_entity_itm)amp_obj;
|
||||
switch (amp_itm.Tid()) {
|
||||
case Xop_amp_trie_itm.Tid_name_std:
|
||||
case Xop_amp_trie_itm.Tid_name_xowa:
|
||||
case Gfh_entity_itm.Tid_name_std:
|
||||
case Gfh_entity_itm.Tid_name_xowa:
|
||||
bfr.Add(amp_itm.U8_bry());
|
||||
pos = amp_pos;
|
||||
break;
|
||||
case Xop_amp_trie_itm.Tid_num_hex:
|
||||
case Xop_amp_trie_itm.Tid_num_dec:
|
||||
boolean ncr_is_hex = amp_itm.Tid() == Xop_amp_trie_itm.Tid_num_hex;
|
||||
case Gfh_entity_itm.Tid_num_hex:
|
||||
case Gfh_entity_itm.Tid_num_dec:
|
||||
boolean ncr_is_hex = amp_itm.Tid() == Gfh_entity_itm.Tid_num_hex;
|
||||
int int_bgn = amp_pos;
|
||||
if (amp_rv == null)
|
||||
amp_rv = new Xop_amp_mgr_rslt();
|
||||
|
||||
@@ -16,16 +16,17 @@ 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.amps; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*;
|
||||
import gplx.langs.htmls.entitys.*;
|
||||
public class Xop_amp_tkn_ent extends Xop_tkn_itm_base {
|
||||
private Xop_amp_trie_itm html_ref_itm;
|
||||
public Xop_amp_tkn_ent(int bgn, int end, Xop_amp_trie_itm html_ref_itm) {
|
||||
private Gfh_entity_itm html_ref_itm;
|
||||
public Xop_amp_tkn_ent(int bgn, int end, Gfh_entity_itm html_ref_itm) {
|
||||
this.html_ref_itm = html_ref_itm;
|
||||
this.Tkn_ini_pos(false, bgn, end);
|
||||
}
|
||||
@Override public byte Tkn_tid() {return Xop_tkn_itm_.Tid_html_ref;}
|
||||
public int Char_int() {return html_ref_itm.Char_int();}
|
||||
public byte[] Xml_name_bry() {return html_ref_itm.Xml_name_bry();}
|
||||
public boolean Itm_is_custom() {return html_ref_itm.Tid() == Xop_amp_trie_itm.Tid_name_xowa;}
|
||||
public boolean Itm_is_custom() {return html_ref_itm.Tid() == Gfh_entity_itm.Tid_name_xowa;}
|
||||
public void Print_ncr(Bry_bfr bfr) {html_ref_itm.Print_ncr(bfr);}
|
||||
public void Print_literal(Bry_bfr bfr) {html_ref_itm.Print_literal(bfr);}
|
||||
}
|
||||
|
||||
@@ -1,317 +0,0 @@
|
||||
/*
|
||||
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.xowa.parsers.amps; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*;
|
||||
import gplx.core.btries.*;
|
||||
public class Xop_amp_trie { // TS
|
||||
public static final String // NOTE: top_define; entities needed for <nowiki> escaping
|
||||
Str__xowa_lt = "&xowa_lt;"
|
||||
, Str__xowa_brack_bgn = "&xowa_brack_bgn;"
|
||||
, Str__xowa_brack_end = "&xowa_brack_end;"
|
||||
, Str__xowa_pipe = "&xowa_pipe;"
|
||||
, Str__xowa_apos = "&xowa_apos;"
|
||||
, Str__xowa_colon = "&xowa_colon;"
|
||||
, Str__xowa_underline = "&xowa_underline;"
|
||||
, Str__xowa_asterisk = "&xowa_asterisk;"
|
||||
, Str__xowa_space = "&xowa_space;"
|
||||
, Str__xowa_nl = "&xowa_nl;"
|
||||
, Str__xowa_dash = "&xowa_dash;"
|
||||
;
|
||||
public static final Btrie_slim_mgr Instance = New(); Xop_amp_trie() {}
|
||||
private static Btrie_slim_mgr New() {// REF.MW: Sanitizer|$wgHtmlEntities; NOTE:added apos
|
||||
Btrie_slim_mgr rv = Btrie_slim_mgr.cs();
|
||||
Add_name(rv, Bool_.Y, 60, Str__xowa_lt);
|
||||
Add_name(rv, Bool_.Y, 91, Str__xowa_brack_bgn);
|
||||
Add_name(rv, Bool_.Y, 93, Str__xowa_brack_end);
|
||||
Add_name(rv, Bool_.Y, 124, Str__xowa_pipe);
|
||||
Add_name(rv, Bool_.Y, 39, Str__xowa_apos);
|
||||
Add_name(rv, Bool_.Y, 58, Str__xowa_colon);
|
||||
Add_name(rv, Bool_.Y, 95, Str__xowa_underline);
|
||||
Add_name(rv, Bool_.Y, 42, Str__xowa_asterisk);
|
||||
Add_name(rv, Bool_.Y, 32, Str__xowa_space);
|
||||
Add_name(rv, Bool_.Y, 10, Str__xowa_nl);
|
||||
Add_name(rv, Bool_.Y, 45, Str__xowa_dash);
|
||||
Add_name(rv, Bool_.N, 39, "'");
|
||||
Add_name(rv, Bool_.N, 193, "Á");
|
||||
Add_name(rv, Bool_.N, 225, "á");
|
||||
Add_name(rv, Bool_.N, 194, "Â");
|
||||
Add_name(rv, Bool_.N, 226, "â");
|
||||
Add_name(rv, Bool_.N, 180, "´");
|
||||
Add_name(rv, Bool_.N, 198, "Æ");
|
||||
Add_name(rv, Bool_.N, 230, "æ");
|
||||
Add_name(rv, Bool_.N, 192, "À");
|
||||
Add_name(rv, Bool_.N, 224, "à");
|
||||
Add_name(rv, Bool_.N, 8501, "ℵ");
|
||||
Add_name(rv, Bool_.N, 913, "Α");
|
||||
Add_name(rv, Bool_.N, 945, "α");
|
||||
Add_name(rv, Bool_.N, 38, "&");
|
||||
Add_name(rv, Bool_.N, 8743, "∧");
|
||||
Add_name(rv, Bool_.N, 8736, "∠");
|
||||
Add_name(rv, Bool_.N, 197, "Å");
|
||||
Add_name(rv, Bool_.N, 229, "å");
|
||||
Add_name(rv, Bool_.N, 8776, "≈");
|
||||
Add_name(rv, Bool_.N, 195, "Ã");
|
||||
Add_name(rv, Bool_.N, 227, "ã");
|
||||
Add_name(rv, Bool_.N, 196, "Ä");
|
||||
Add_name(rv, Bool_.N, 228, "ä");
|
||||
Add_name(rv, Bool_.N, 8222, "„");
|
||||
Add_name(rv, Bool_.N, 914, "Β");
|
||||
Add_name(rv, Bool_.N, 946, "β");
|
||||
Add_name(rv, Bool_.N, 166, "¦");
|
||||
Add_name(rv, Bool_.N, 8226, "•");
|
||||
Add_name(rv, Bool_.N, 8745, "∩");
|
||||
Add_name(rv, Bool_.N, 199, "Ç");
|
||||
Add_name(rv, Bool_.N, 231, "ç");
|
||||
Add_name(rv, Bool_.N, 184, "¸");
|
||||
Add_name(rv, Bool_.N, 162, "¢");
|
||||
Add_name(rv, Bool_.N, 935, "Χ");
|
||||
Add_name(rv, Bool_.N, 967, "χ");
|
||||
Add_name(rv, Bool_.N, 710, "ˆ");
|
||||
Add_name(rv, Bool_.N, 9827, "♣");
|
||||
Add_name(rv, Bool_.N, 8773, "≅");
|
||||
Add_name(rv, Bool_.N, 169, "©");
|
||||
Add_name(rv, Bool_.N, 8629, "↵");
|
||||
Add_name(rv, Bool_.N, 8746, "∪");
|
||||
Add_name(rv, Bool_.N, 164, "¤");
|
||||
Add_name(rv, Bool_.N, 8224, "†");
|
||||
Add_name(rv, Bool_.N, 8225, "‡");
|
||||
Add_name(rv, Bool_.N, 8595, "↓");
|
||||
Add_name(rv, Bool_.N, 8659, "⇓");
|
||||
Add_name(rv, Bool_.N, 176, "°");
|
||||
Add_name(rv, Bool_.N, 916, "Δ");
|
||||
Add_name(rv, Bool_.N, 948, "δ");
|
||||
Add_name(rv, Bool_.N, 9830, "♦");
|
||||
Add_name(rv, Bool_.N, 247, "÷");
|
||||
Add_name(rv, Bool_.N, 201, "É");
|
||||
Add_name(rv, Bool_.N, 233, "é");
|
||||
Add_name(rv, Bool_.N, 202, "Ê");
|
||||
Add_name(rv, Bool_.N, 234, "ê");
|
||||
Add_name(rv, Bool_.N, 200, "È");
|
||||
Add_name(rv, Bool_.N, 232, "è");
|
||||
Add_name(rv, Bool_.N, 8709, "∅");
|
||||
Add_name(rv, Bool_.N, 8195, " ");
|
||||
Add_name(rv, Bool_.N, 8194, " ");
|
||||
Add_name(rv, Bool_.N, 917, "Ε");
|
||||
Add_name(rv, Bool_.N, 949, "ε");
|
||||
Add_name(rv, Bool_.N, 8801, "≡");
|
||||
Add_name(rv, Bool_.N, 919, "Η");
|
||||
Add_name(rv, Bool_.N, 951, "η");
|
||||
Add_name(rv, Bool_.N, 208, "Ð");
|
||||
Add_name(rv, Bool_.N, 240, "ð");
|
||||
Add_name(rv, Bool_.N, 203, "Ë");
|
||||
Add_name(rv, Bool_.N, 235, "ë");
|
||||
Add_name(rv, Bool_.N, 8364, "€");
|
||||
Add_name(rv, Bool_.N, 8707, "∃");
|
||||
Add_name(rv, Bool_.N, 402, "ƒ");
|
||||
Add_name(rv, Bool_.N, 8704, "∀");
|
||||
Add_name(rv, Bool_.N, 189, "½");
|
||||
Add_name(rv, Bool_.N, 188, "¼");
|
||||
Add_name(rv, Bool_.N, 190, "¾");
|
||||
Add_name(rv, Bool_.N, 8260, "⁄");
|
||||
Add_name(rv, Bool_.N, 915, "Γ");
|
||||
Add_name(rv, Bool_.N, 947, "γ");
|
||||
Add_name(rv, Bool_.N, 8805, "≥");
|
||||
Add_name(rv, Bool_.N, 62, ">");
|
||||
Add_name(rv, Bool_.N, 8596, "↔");
|
||||
Add_name(rv, Bool_.N, 8660, "⇔");
|
||||
Add_name(rv, Bool_.N, 9829, "♥");
|
||||
Add_name(rv, Bool_.N, 8230, "…");
|
||||
Add_name(rv, Bool_.N, 205, "Í");
|
||||
Add_name(rv, Bool_.N, 237, "í");
|
||||
Add_name(rv, Bool_.N, 206, "Î");
|
||||
Add_name(rv, Bool_.N, 238, "î");
|
||||
Add_name(rv, Bool_.N, 161, "¡");
|
||||
Add_name(rv, Bool_.N, 204, "Ì");
|
||||
Add_name(rv, Bool_.N, 236, "ì");
|
||||
Add_name(rv, Bool_.N, 8465, "ℑ");
|
||||
Add_name(rv, Bool_.N, 8734, "∞");
|
||||
Add_name(rv, Bool_.N, 8747, "∫");
|
||||
Add_name(rv, Bool_.N, 921, "Ι");
|
||||
Add_name(rv, Bool_.N, 953, "ι");
|
||||
Add_name(rv, Bool_.N, 191, "¿");
|
||||
Add_name(rv, Bool_.N, 8712, "∈");
|
||||
Add_name(rv, Bool_.N, 207, "Ï");
|
||||
Add_name(rv, Bool_.N, 239, "ï");
|
||||
Add_name(rv, Bool_.N, 922, "Κ");
|
||||
Add_name(rv, Bool_.N, 954, "κ");
|
||||
Add_name(rv, Bool_.N, 923, "Λ");
|
||||
Add_name(rv, Bool_.N, 955, "λ");
|
||||
Add_name(rv, Bool_.N, 9001, "⟨");
|
||||
Add_name(rv, Bool_.N, 171, "«");
|
||||
Add_name(rv, Bool_.N, 8592, "←");
|
||||
Add_name(rv, Bool_.N, 8656, "⇐");
|
||||
Add_name(rv, Bool_.N, 8968, "⌈");
|
||||
Add_name(rv, Bool_.N, 8220, "“");
|
||||
Add_name(rv, Bool_.N, 8804, "≤");
|
||||
Add_name(rv, Bool_.N, 8970, "⌊");
|
||||
Add_name(rv, Bool_.N, 8727, "∗");
|
||||
Add_name(rv, Bool_.N, 9674, "◊");
|
||||
Add_name(rv, Bool_.N, 8206, "‎");
|
||||
Add_name(rv, Bool_.N, 8249, "‹");
|
||||
Add_name(rv, Bool_.N, 8216, "‘");
|
||||
Add_name(rv, Bool_.N, 60, "<");
|
||||
Add_name(rv, Bool_.N, 175, "¯");
|
||||
Add_name(rv, Bool_.N, 8212, "—");
|
||||
Add_name(rv, Bool_.N, 181, "µ");
|
||||
Add_name(rv, Bool_.N, 183, "·");
|
||||
Add_name(rv, Bool_.N, 8722, "−");
|
||||
Add_name(rv, Bool_.N, 924, "Μ");
|
||||
Add_name(rv, Bool_.N, 956, "μ");
|
||||
Add_name(rv, Bool_.N, 8711, "∇");
|
||||
Add_name(rv, Bool_.N, 160, " ");
|
||||
Add_name(rv, Bool_.N, 8211, "–");
|
||||
Add_name(rv, Bool_.N, 8800, "≠");
|
||||
Add_name(rv, Bool_.N, 8715, "∋");
|
||||
Add_name(rv, Bool_.N, 172, "¬");
|
||||
Add_name(rv, Bool_.N, 8713, "∉");
|
||||
Add_name(rv, Bool_.N, 8836, "⊄");
|
||||
Add_name(rv, Bool_.N, 209, "Ñ");
|
||||
Add_name(rv, Bool_.N, 241, "ñ");
|
||||
Add_name(rv, Bool_.N, 925, "Ν");
|
||||
Add_name(rv, Bool_.N, 957, "ν");
|
||||
Add_name(rv, Bool_.N, 211, "Ó");
|
||||
Add_name(rv, Bool_.N, 243, "ó");
|
||||
Add_name(rv, Bool_.N, 212, "Ô");
|
||||
Add_name(rv, Bool_.N, 244, "ô");
|
||||
Add_name(rv, Bool_.N, 338, "Œ");
|
||||
Add_name(rv, Bool_.N, 339, "œ");
|
||||
Add_name(rv, Bool_.N, 210, "Ò");
|
||||
Add_name(rv, Bool_.N, 242, "ò");
|
||||
Add_name(rv, Bool_.N, 8254, "‾");
|
||||
Add_name(rv, Bool_.N, 937, "Ω");
|
||||
Add_name(rv, Bool_.N, 969, "ω");
|
||||
Add_name(rv, Bool_.N, 927, "Ο");
|
||||
Add_name(rv, Bool_.N, 959, "ο");
|
||||
Add_name(rv, Bool_.N, 8853, "⊕");
|
||||
Add_name(rv, Bool_.N, 8744, "∨");
|
||||
Add_name(rv, Bool_.N, 170, "ª");
|
||||
Add_name(rv, Bool_.N, 186, "º");
|
||||
Add_name(rv, Bool_.N, 216, "Ø");
|
||||
Add_name(rv, Bool_.N, 248, "ø");
|
||||
Add_name(rv, Bool_.N, 213, "Õ");
|
||||
Add_name(rv, Bool_.N, 245, "õ");
|
||||
Add_name(rv, Bool_.N, 8855, "⊗");
|
||||
Add_name(rv, Bool_.N, 214, "Ö");
|
||||
Add_name(rv, Bool_.N, 246, "ö");
|
||||
Add_name(rv, Bool_.N, 182, "¶");
|
||||
Add_name(rv, Bool_.N, 8706, "∂");
|
||||
Add_name(rv, Bool_.N, 8240, "‰");
|
||||
Add_name(rv, Bool_.N, 8869, "⊥");
|
||||
Add_name(rv, Bool_.N, 934, "Φ");
|
||||
Add_name(rv, Bool_.N, 966, "φ");
|
||||
Add_name(rv, Bool_.N, 928, "Π");
|
||||
Add_name(rv, Bool_.N, 960, "π");
|
||||
Add_name(rv, Bool_.N, 982, "ϖ");
|
||||
Add_name(rv, Bool_.N, 177, "±");
|
||||
Add_name(rv, Bool_.N, 163, "£");
|
||||
Add_name(rv, Bool_.N, 8242, "′");
|
||||
Add_name(rv, Bool_.N, 8243, "″");
|
||||
Add_name(rv, Bool_.N, 8719, "∏");
|
||||
Add_name(rv, Bool_.N, 8733, "∝");
|
||||
Add_name(rv, Bool_.N, 936, "Ψ");
|
||||
Add_name(rv, Bool_.N, 968, "ψ");
|
||||
Add_name(rv, Bool_.N, 34, """);
|
||||
Add_name(rv, Bool_.N, 8730, "√");
|
||||
Add_name(rv, Bool_.N, 9002, "⟩");
|
||||
Add_name(rv, Bool_.N, 187, "»");
|
||||
Add_name(rv, Bool_.N, 8594, "→");
|
||||
Add_name(rv, Bool_.N, 8658, "⇒");
|
||||
Add_name(rv, Bool_.N, 8969, "⌉");
|
||||
Add_name(rv, Bool_.N, 8221, "”");
|
||||
Add_name(rv, Bool_.N, 8476, "ℜ");
|
||||
Add_name(rv, Bool_.N, 174, "®");
|
||||
Add_name(rv, Bool_.N, 8971, "⌋");
|
||||
Add_name(rv, Bool_.N, 929, "Ρ");
|
||||
Add_name(rv, Bool_.N, 961, "ρ");
|
||||
Add_name(rv, Bool_.N, 8207, "‏");
|
||||
Add_name(rv, Bool_.N, 8250, "›");
|
||||
Add_name(rv, Bool_.N, 8217, "’");
|
||||
Add_name(rv, Bool_.N, 8218, "‚");
|
||||
Add_name(rv, Bool_.N, 352, "Š");
|
||||
Add_name(rv, Bool_.N, 353, "š");
|
||||
Add_name(rv, Bool_.N, 8901, "⋅");
|
||||
Add_name(rv, Bool_.N, 167, "§");
|
||||
Add_name(rv, Bool_.N, 173, "­");
|
||||
Add_name(rv, Bool_.N, 931, "Σ");
|
||||
Add_name(rv, Bool_.N, 963, "σ");
|
||||
Add_name(rv, Bool_.N, 962, "ς");
|
||||
Add_name(rv, Bool_.N, 8764, "∼");
|
||||
Add_name(rv, Bool_.N, 9824, "♠");
|
||||
Add_name(rv, Bool_.N, 8834, "⊂");
|
||||
Add_name(rv, Bool_.N, 8838, "⊆");
|
||||
Add_name(rv, Bool_.N, 8721, "∑");
|
||||
Add_name(rv, Bool_.N, 8835, "⊃");
|
||||
Add_name(rv, Bool_.N, 185, "¹");
|
||||
Add_name(rv, Bool_.N, 178, "²");
|
||||
Add_name(rv, Bool_.N, 179, "³");
|
||||
Add_name(rv, Bool_.N, 8839, "⊇");
|
||||
Add_name(rv, Bool_.N, 223, "ß");
|
||||
Add_name(rv, Bool_.N, 932, "Τ");
|
||||
Add_name(rv, Bool_.N, 964, "τ");
|
||||
Add_name(rv, Bool_.N, 8756, "∴");
|
||||
Add_name(rv, Bool_.N, 920, "Θ");
|
||||
Add_name(rv, Bool_.N, 952, "θ");
|
||||
Add_name(rv, Bool_.N, 977, "ϑ");
|
||||
Add_name(rv, Bool_.N, 8201, " ");
|
||||
Add_name(rv, Bool_.N, 222, "Þ");
|
||||
Add_name(rv, Bool_.N, 254, "þ");
|
||||
Add_name(rv, Bool_.N, 732, "˜");
|
||||
Add_name(rv, Bool_.N, 215, "×");
|
||||
Add_name(rv, Bool_.N, 8482, "™");
|
||||
Add_name(rv, Bool_.N, 218, "Ú");
|
||||
Add_name(rv, Bool_.N, 250, "ú");
|
||||
Add_name(rv, Bool_.N, 8593, "↑");
|
||||
Add_name(rv, Bool_.N, 8657, "⇑");
|
||||
Add_name(rv, Bool_.N, 219, "Û");
|
||||
Add_name(rv, Bool_.N, 251, "û");
|
||||
Add_name(rv, Bool_.N, 217, "Ù");
|
||||
Add_name(rv, Bool_.N, 249, "ù");
|
||||
Add_name(rv, Bool_.N, 168, "¨");
|
||||
Add_name(rv, Bool_.N, 978, "ϒ");
|
||||
Add_name(rv, Bool_.N, 933, "Υ");
|
||||
Add_name(rv, Bool_.N, 965, "υ");
|
||||
Add_name(rv, Bool_.N, 220, "Ü");
|
||||
Add_name(rv, Bool_.N, 252, "ü");
|
||||
Add_name(rv, Bool_.N, 8472, "℘");
|
||||
Add_name(rv, Bool_.N, 926, "Ξ");
|
||||
Add_name(rv, Bool_.N, 958, "ξ");
|
||||
Add_name(rv, Bool_.N, 221, "Ý");
|
||||
Add_name(rv, Bool_.N, 253, "ý");
|
||||
Add_name(rv, Bool_.N, 165, "¥");
|
||||
Add_name(rv, Bool_.N, 376, "Ÿ");
|
||||
Add_name(rv, Bool_.N, 255, "ÿ");
|
||||
Add_name(rv, Bool_.N, 918, "Ζ");
|
||||
Add_name(rv, Bool_.N, 950, "ζ");
|
||||
Add_name(rv, Bool_.N, 8205, "‍");
|
||||
Add_name(rv, Bool_.N, 8204, "‌");
|
||||
Add_prefix(rv, Xop_amp_trie_itm.Tid_num_hex, "#x");
|
||||
Add_prefix(rv, Xop_amp_trie_itm.Tid_num_hex, "#X");
|
||||
Add_prefix(rv, Xop_amp_trie_itm.Tid_num_dec, "#");
|
||||
return rv;
|
||||
}
|
||||
private static void Add_name(Btrie_slim_mgr trie, boolean tid_is_xowa, int char_int, String xml_name_str) {
|
||||
byte itm_tid = tid_is_xowa ? Xop_amp_trie_itm.Tid_name_xowa : Xop_amp_trie_itm.Tid_name_std;
|
||||
byte[] xml_name_bry = Bry_.new_a7(xml_name_str);
|
||||
byte[] key = Bry_.Mid(xml_name_bry, 1, xml_name_bry.length); // ignore & for purpose of trie; EX: "amp;"; NOTE: must keep trailing ";" else "& " will be valid;
|
||||
trie.Add_obj(key, new Xop_amp_trie_itm(itm_tid, char_int, xml_name_bry));
|
||||
}
|
||||
private static void Add_prefix(Btrie_slim_mgr trie, byte prefix_type, String prefix) {
|
||||
byte[] prefix_ary = Bry_.new_u8(prefix);
|
||||
Xop_amp_trie_itm itm = new Xop_amp_trie_itm(prefix_type, Xop_amp_trie_itm.Char_int_null, prefix_ary);
|
||||
trie.Add_obj(prefix_ary, itm);
|
||||
}
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
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.xowa.parsers.amps; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*;
|
||||
import gplx.langs.htmls.*; import gplx.xowa.htmls.core.wkrs.lnkis.htmls.*;
|
||||
public class Xop_amp_trie_itm { // TS
|
||||
public Xop_amp_trie_itm(byte tid, int char_int, byte[] xml_name_bry) {
|
||||
this.tid = tid;
|
||||
this.char_int = char_int;
|
||||
this.u8_bry = gplx.core.intls.Utf16_.Encode_int_to_bry(char_int);
|
||||
this.xml_name_bry = xml_name_bry;
|
||||
this.key_name_len = xml_name_bry.length - 2; // 2 for & and ;
|
||||
}
|
||||
public byte Tid() {return tid;} private final byte tid;
|
||||
public int Char_int() {return char_int;} private final int char_int; // val; EX: 160
|
||||
public byte[] U8_bry() {return u8_bry;} private final byte[] u8_bry; // EX: new byte[] {192, 160}; (C2, A0)
|
||||
public byte[] Xml_name_bry() {return xml_name_bry;} private final byte[] xml_name_bry; // EX: " "
|
||||
public int Key_name_len() {return key_name_len;} private final int key_name_len; // EX: "nbsp".Len
|
||||
|
||||
public void Print_ncr(Bry_bfr bfr) {
|
||||
switch (char_int) {
|
||||
case Byte_ascii.Lt: case Byte_ascii.Gt: case Byte_ascii.Quote: case Byte_ascii.Amp:
|
||||
bfr.Add(xml_name_bry); // NOTE: never write actual char; EX: "<" should be written as "<", not "<"
|
||||
break;
|
||||
default:
|
||||
bfr.Add(Xoh_lnki_title_fmtr.Escape_bgn); // &#
|
||||
bfr.Add_int_variable(char_int); // 160
|
||||
bfr.Add_byte(Byte_ascii.Semic); // ;
|
||||
break;
|
||||
}
|
||||
}
|
||||
public void Print_literal(Bry_bfr bfr) {
|
||||
switch (char_int) {
|
||||
case Byte_ascii.Lt: bfr.Add(Gfh_entity_.Lt_bry); break; // NOTE: never write actual char; EX: "<" should be written as "<", not "<"; MW does same; DATE:2014-11-07
|
||||
case Byte_ascii.Gt: bfr.Add(Gfh_entity_.Gt_bry); break;
|
||||
case Byte_ascii.Quote: bfr.Add(Gfh_entity_.Quote_bry); break;
|
||||
case Byte_ascii.Amp: bfr.Add(Gfh_entity_.Amp_bry); break;
|
||||
default: bfr.Add(u8_bry); break; // write literal; EX: "[" not "["
|
||||
}
|
||||
}
|
||||
public static final byte Tid_name_std = 1, Tid_name_xowa = 2, Tid_num_hex = 3, Tid_num_dec = 4;
|
||||
public static final int Char_int_null = -1;
|
||||
}
|
||||
@@ -50,7 +50,7 @@ public class Xop_lnki_tkn extends Xop_tkn_itm_base implements gplx.xowa.wikis.pa
|
||||
public int Pipe_count() {return pipe_count;} private int pipe_count;
|
||||
public boolean Pipe_count_is_zero() {return pipe_count++ == 0;}
|
||||
public boolean Xtn_sites_link() {return xtn_sites_link;} public void Xtn_sites_link_(boolean v) {xtn_sites_link = v;} private boolean xtn_sites_link;
|
||||
public Xoh_file_img_wkr Lnki_file_wkr() {return lnki_file_wkr;} public void Lnki_file_wkr_(Xoh_file_img_wkr v) {lnki_file_wkr = v;} private Xoh_file_img_wkr lnki_file_wkr;
|
||||
public Xoh_file_fmtr Lnki_file_wkr() {return lnki_file_wkr;} public void Lnki_file_wkr_(Xoh_file_fmtr v) {lnki_file_wkr = v;} private Xoh_file_fmtr lnki_file_wkr;
|
||||
public byte[] Target;
|
||||
public byte[] Ttl_ary() {
|
||||
return ttl.ForceLiteralLink() || ns_id != Xow_ns_.Tid__main // if [[:]] or non-main (Category, Template)
|
||||
|
||||
@@ -22,7 +22,6 @@ import gplx.xowa.wikis.nss.*;
|
||||
import gplx.xowa.wikis.*; import gplx.xowa.xtns.pfuncs.ttls.*; import gplx.xowa.xtns.relatedSites.*;
|
||||
import gplx.xowa.parsers.tmpls.*; import gplx.xowa.wikis.pages.lnkis.*;
|
||||
public class Xop_lnki_wkr_ {
|
||||
private static final Int_obj_ref rel2abs_tid = Int_obj_ref.New_zero();
|
||||
public static final int Invalidate_lnki_len = 128;
|
||||
public static int Invalidate_lnki(Xop_ctx ctx, byte[] src, Xop_root_tkn root, Xop_lnki_tkn lnki, int cur_pos) {
|
||||
lnki.Tkn_tid_to_txt(); // convert initial "[[" to text; note that this lnki has no pipes as pipe_lxr does similar check; EX: [[<invalid>]]; DATE:2014-03-26
|
||||
@@ -48,7 +47,8 @@ public class Xop_lnki_wkr_ {
|
||||
if (page_ttl.Ns().Subpages_enabled()
|
||||
&& Pfunc_rel2abs.Rel2abs_ttl(ttl_bry, 0, ttl_bry_len)) { // Linker.php|normalizeSubpageLink
|
||||
Bry_bfr tmp_bfr = ctx.Wiki().Utl__bfr_mkr().Get_b512();
|
||||
byte[] new_bry = Pfunc_rel2abs.Rel2abs(tmp_bfr, ttl_bry, page_ttl.Raw(), rel2abs_tid.Val_zero_());
|
||||
Int_obj_ref rel2abs_tid = ctx.Tmp_mgr().Pfunc_rel2abs().Val_zero_();
|
||||
byte[] new_bry = Pfunc_rel2abs.Rel2abs(tmp_bfr, ttl_bry, page_ttl.Raw(), rel2abs_tid);
|
||||
lnki.Subpage_tid_(rel2abs_tid.Val());
|
||||
lnki.Subpage_slash_at_end_(Bry_.Get_at_end(ttl_bry) == Byte_ascii.Slash);
|
||||
ttl_bry = new_bry;
|
||||
|
||||
@@ -16,7 +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.btries.*; import gplx.langs.htmls.*; import gplx.xowa.parsers.amps.*;
|
||||
import gplx.core.btries.*; import gplx.langs.htmls.entitys.*; import gplx.xowa.parsers.amps.*;
|
||||
public class Nowiki_escape_itm {
|
||||
public Nowiki_escape_itm(byte[] src, byte[] trg) {this.src = src; this.trg = trg; this.src_adj = src.length - 1;}
|
||||
private int src_adj;
|
||||
@@ -48,17 +48,17 @@ public class Nowiki_escape_itm {
|
||||
private static Btrie_slim_mgr New_trie() {
|
||||
byte[] pre_bry = new byte[] {Byte_ascii.Nl, Byte_ascii.Space}; // NOTE: must go before New_trie
|
||||
Btrie_slim_mgr rv = Btrie_slim_mgr.cs();
|
||||
New_trie_itm(rv, Byte_ascii.Lt_bry , Xop_amp_trie.Str__xowa_lt);
|
||||
New_trie_itm(rv, Byte_ascii.Brack_bgn_bry , Xop_amp_trie.Str__xowa_brack_bgn);
|
||||
New_trie_itm(rv, Byte_ascii.Brack_end_bry , Xop_amp_trie.Str__xowa_brack_end);// PAGE:en.w: Tall_poppy_syndrome DATE:2014-07-23
|
||||
New_trie_itm(rv, Byte_ascii.Pipe_bry , Xop_amp_trie.Str__xowa_pipe);
|
||||
New_trie_itm(rv, Byte_ascii.Apos_bry , Xop_amp_trie.Str__xowa_apos); // NOTE: for backward compatibility, use ' note that amp_wkr will turn ' -> ' but ' -> '; DATE:2014-07-03
|
||||
New_trie_itm(rv, Byte_ascii.Colon_bry , Xop_amp_trie.Str__xowa_colon);
|
||||
New_trie_itm(rv, Byte_ascii.Underline_bry , Xop_amp_trie.Str__xowa_underline);
|
||||
New_trie_itm(rv, Byte_ascii.Star_bry , Xop_amp_trie.Str__xowa_asterisk);
|
||||
New_trie_itm(rv, Byte_ascii.Dash_bry , Xop_amp_trie.Str__xowa_dash); // needed to handle "|<nowiki>-</nowiki>"; PAGE:de.w:Liste_von_Vereinen_und_Vereinigungen_von_Gl<47>ubigen_(r<>misch-katholische_Kirche) DATE:2015-01-08
|
||||
New_trie_itm(rv, Byte_ascii.Space_bry , Xop_amp_trie.Str__xowa_space);
|
||||
New_trie_itm(rv, Byte_ascii.Nl_bry , Xop_amp_trie.Str__xowa_nl);
|
||||
New_trie_itm(rv, Byte_ascii.Lt_bry , Gfh_entity_trie.Str__xowa_lt);
|
||||
New_trie_itm(rv, Byte_ascii.Brack_bgn_bry , Gfh_entity_trie.Str__xowa_brack_bgn);
|
||||
New_trie_itm(rv, Byte_ascii.Brack_end_bry , Gfh_entity_trie.Str__xowa_brack_end);// PAGE:en.w: Tall_poppy_syndrome DATE:2014-07-23
|
||||
New_trie_itm(rv, Byte_ascii.Pipe_bry , Gfh_entity_trie.Str__xowa_pipe);
|
||||
New_trie_itm(rv, Byte_ascii.Apos_bry , Gfh_entity_trie.Str__xowa_apos); // NOTE: for backward compatibility, use ' note that amp_wkr will turn ' -> ' but ' -> '; DATE:2014-07-03
|
||||
New_trie_itm(rv, Byte_ascii.Colon_bry , Gfh_entity_trie.Str__xowa_colon);
|
||||
New_trie_itm(rv, Byte_ascii.Underline_bry , Gfh_entity_trie.Str__xowa_underline);
|
||||
New_trie_itm(rv, Byte_ascii.Star_bry , Gfh_entity_trie.Str__xowa_asterisk);
|
||||
New_trie_itm(rv, Byte_ascii.Dash_bry , Gfh_entity_trie.Str__xowa_dash); // needed to handle "|<nowiki>-</nowiki>"; PAGE:de.w:Liste_von_Vereinen_und_Vereinigungen_von_Gl<47>ubigen_(r<>misch-katholische_Kirche) DATE:2015-01-08
|
||||
New_trie_itm(rv, Byte_ascii.Space_bry , Gfh_entity_trie.Str__xowa_space);
|
||||
New_trie_itm(rv, Byte_ascii.Nl_bry , Gfh_entity_trie.Str__xowa_nl);
|
||||
New_trie_itm(rv, pre_bry , pre_bry);
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.parsers.utils; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*;
|
||||
import gplx.core.btries.*; import gplx.xowa.parsers.amps.*; import gplx.core.log_msgs.*;
|
||||
import gplx.langs.htmls.entitys.*;
|
||||
public class Xop_sanitizer {
|
||||
private Btrie_slim_mgr trie = Btrie_slim_mgr.cs(), amp_trie;
|
||||
private Xop_amp_mgr amp_mgr;
|
||||
@@ -71,18 +72,18 @@ public class Xop_sanitizer {
|
||||
++pos;
|
||||
}
|
||||
else {
|
||||
Xop_amp_trie_itm itm = (Xop_amp_trie_itm)amp_obj;
|
||||
Gfh_entity_itm itm = (Gfh_entity_itm)amp_obj;
|
||||
byte itm_tid = itm.Tid();
|
||||
switch (itm_tid) {
|
||||
case Xop_amp_trie_itm.Tid_name_std:
|
||||
case Xop_amp_trie_itm.Tid_name_xowa:
|
||||
case Gfh_entity_itm.Tid_name_std:
|
||||
case Gfh_entity_itm.Tid_name_xowa:
|
||||
bfr.Add(itm.U8_bry());
|
||||
pos += itm.Key_name_len() + 1; // 1 for trailing ";"; EX: for " ", (a) pos is at "&", (b) "nbsp" is Key_name_len, (c) ";" needs + 1
|
||||
break;
|
||||
case Xop_amp_trie_itm.Tid_num_dec:
|
||||
case Xop_amp_trie_itm.Tid_num_hex:
|
||||
case Gfh_entity_itm.Tid_num_dec:
|
||||
case Gfh_entity_itm.Tid_num_hex:
|
||||
Xop_amp_mgr_rslt rv = new Xop_amp_mgr_rslt();
|
||||
amp_mgr.Parse_ncr(rv, itm_tid == Xop_amp_trie_itm.Tid_num_hex, src, end, pos - 1, pos + itm.Xml_name_bry().length);
|
||||
amp_mgr.Parse_ncr(rv, itm_tid == Gfh_entity_itm.Tid_num_hex, src, end, pos - 1, pos + itm.Xml_name_bry().length);
|
||||
if (rv.Pass())
|
||||
bfr.Add_u8_int(rv.Val());
|
||||
else
|
||||
|
||||
@@ -17,7 +17,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 gplx.core.btries.*; import gplx.core.envs.*; import gplx.xowa.apps.progs.*;
|
||||
import gplx.xowa.wikis.domains.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.strings.*; import gplx.langs.htmls.*;
|
||||
import gplx.xowa.wikis.domains.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.strings.*;
|
||||
import gplx.langs.htmls.entitys.*;
|
||||
import gplx.xowa.parsers.logs.*; import gplx.xowa.parsers.tblws.*; import gplx.xowa.parsers.lnkis.*; import gplx.xowa.parsers.miscs.*; import gplx.xowa.parsers.htmls.*;
|
||||
public class Xop_xnde_wkr implements Xop_ctx_wkr {
|
||||
public void Ctor_ctx(Xop_ctx ctx) {}
|
||||
@@ -97,6 +98,7 @@ public class Xop_xnde_wkr implements Xop_ctx_wkr {
|
||||
case Byte_ascii.Ltr_u: case Byte_ascii.Ltr_v: case Byte_ascii.Ltr_w: case Byte_ascii.Ltr_x: case Byte_ascii.Ltr_y: case Byte_ascii.Ltr_z:
|
||||
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:
|
||||
case Byte_ascii.Percent: // EX:<ref%s>; PAGE:pl.w:Scynk_nadrzewny; DATE:2016-08-07
|
||||
tag_obj = null;
|
||||
break;
|
||||
}
|
||||
@@ -319,7 +321,7 @@ public class Xop_xnde_wkr implements Xop_ctx_wkr {
|
||||
if ( page.Html_data().Html_restricted()
|
||||
&& page.Wiki().Domain_tid() != Xow_domain_tid_.Int__home) {
|
||||
int end_pos = gtPos + 1;
|
||||
ctx.Subs_add(root, tkn_mkr.Bry_raw(bgn_pos, end_pos, Bry_.Add(gplx.langs.htmls.Gfh_entity_.Lt_bry, Bry_.Mid(src, bgn_pos + 1, end_pos)))); // +1 to skip <
|
||||
ctx.Subs_add(root, tkn_mkr.Bry_raw(bgn_pos, end_pos, Bry_.Add(Gfh_entity_.Lt_bry, Bry_.Mid(src, bgn_pos + 1, end_pos)))); // +1 to skip <
|
||||
return end_pos;
|
||||
}
|
||||
}
|
||||
@@ -479,7 +481,7 @@ public class Xop_xnde_wkr implements Xop_ctx_wkr {
|
||||
}
|
||||
}
|
||||
if (end_tag.Restricted()) // restricted tags (like <script>) are not placed on stack; for now, just write it out
|
||||
ctx.Subs_add(root, tkn_mkr.Bry_raw(bgn_pos, cur_pos, Bry_.Add(gplx.langs.htmls.Gfh_entity_.Lt_bry, Bry_.Mid(src, bgn_pos + 1, cur_pos)))); // +1 to skip <
|
||||
ctx.Subs_add(root, tkn_mkr.Bry_raw(bgn_pos, cur_pos, Bry_.Add(Gfh_entity_.Lt_bry, Bry_.Mid(src, bgn_pos + 1, cur_pos)))); // +1 to skip <
|
||||
else {
|
||||
if (pre2_pending) {
|
||||
pre2_pending = false;
|
||||
|
||||
@@ -18,7 +18,7 @@ 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.*;
|
||||
public class Xop_xnde_wkr__err_misc_tst {
|
||||
private final Xop_fxt fxt = new Xop_fxt();
|
||||
private final Xop_fxt fxt = new Xop_fxt();
|
||||
@After public void term() {fxt.Init_para_n_();}
|
||||
@Test public void Error_br_removed() {
|
||||
fxt.Init_para_y_();
|
||||
@@ -187,4 +187,7 @@ public class Xop_xnde_wkr__err_misc_tst {
|
||||
@Test public void Img_should_not_be_xtn() { // PURPOSE:<img> marked as .xtn; unclosed <img> was escaping rest of text; PAGE:de.w:Wikipedia:Technik/Archiv/2014 DATE:2014-11-06
|
||||
fxt.Test_parse_page_all_str("<img>''a''", "<img><i>a</i>");
|
||||
}
|
||||
@Test public void Invalid__percent() { // PURPOSE: invalidate xml tags with %; EX:<ref%s>; PAGE:pl.w:Scynk_nadrzewny; DATE:2016-08-07
|
||||
fxt.Test_parse_page_all_str("<b%>a</b>", "<b%>a</b>"); // NOTE: should be literally printed as <b%>, not transformed to <b>
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user