mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
v2.7.3.1
This commit is contained in:
@@ -38,7 +38,7 @@ public class Xop_amp_mgr {
|
||||
boolean ncr_is_hex = itm.Tid() == Xop_amp_trie_itm.Tid_num_hex;
|
||||
boolean pass = Parse_as_int(ncr_is_hex, src, src_len, amp_pos, cur_pos);
|
||||
return pass ? tkn_mkr.Amp_num(amp_pos, rslt_pos, rslt_val) : null;
|
||||
default: throw Exc_.new_unhandled(itm.Tid());
|
||||
default: throw Err_.new_unhandled(itm.Tid());
|
||||
}
|
||||
}
|
||||
public boolean Parse_as_int(boolean ncr_is_hex, byte[] src, int src_len, int amp_pos, int int_bgn) {
|
||||
@@ -106,7 +106,7 @@ public class Xop_amp_mgr {
|
||||
pos = rslt_pos;
|
||||
break;
|
||||
default:
|
||||
throw Exc_.new_unhandled(amp_itm.Tid());
|
||||
throw Err_.new_unhandled(amp_itm.Tid());
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ public class Xop_apos_dat {
|
||||
case Xop_apos_tkn_.State_dual: cmd = Xop_apos_tkn_.Cmd_i_end; state = Xop_apos_tkn_.State_b; dual_cmd = Xop_apos_tkn_.Cmd_bi_bgn; break;
|
||||
case Xop_apos_tkn_.State_b: cmd = Xop_apos_tkn_.Cmd_i_bgn; state = Xop_apos_tkn_.State_bi; break;
|
||||
case Xop_apos_tkn_.State_nil: cmd = Xop_apos_tkn_.Cmd_i_bgn; state = Xop_apos_tkn_.State_i; break;
|
||||
default: throw Exc_.new_unhandled(state);
|
||||
default: throw Err_.new_unhandled(state);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -61,7 +61,7 @@ public class Xop_apos_dat {
|
||||
case Xop_apos_tkn_.State_dual: cmd = Xop_apos_tkn_.Cmd_b_end; state = Xop_apos_tkn_.State_i; break; // NOTE: dual_cmd = Cmd_ib_bgn is implied
|
||||
case Xop_apos_tkn_.State_i: cmd = Xop_apos_tkn_.Cmd_b_bgn; state = Xop_apos_tkn_.State_ib; break;
|
||||
case Xop_apos_tkn_.State_nil: cmd = Xop_apos_tkn_.Cmd_b_bgn; state = Xop_apos_tkn_.State_b; break;
|
||||
default: throw Exc_.new_unhandled(state);
|
||||
default: throw Err_.new_unhandled(state);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -73,11 +73,11 @@ public class Xop_apos_dat {
|
||||
case Xop_apos_tkn_.State_ib: cmd = Xop_apos_tkn_.Cmd_bi_end; state = Xop_apos_tkn_.State_nil; break;
|
||||
case Xop_apos_tkn_.State_dual: cmd = Xop_apos_tkn_.Cmd_bi_end; state = Xop_apos_tkn_.State_nil; break; // NOTE: dual_cmd = Cmd_ib_bgn is implied
|
||||
case Xop_apos_tkn_.State_nil: cmd = Xop_apos_tkn_.Cmd_ib_bgn; state = Xop_apos_tkn_.State_dual; break;
|
||||
default: throw Exc_.new_unhandled(state);
|
||||
default: throw Err_.new_unhandled(state);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: throw Exc_.new_unhandled(apos_len);
|
||||
default: throw Err_.new_unhandled(apos_len);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ public class Xop_apos_wkr implements Xop_ctx_wkr {
|
||||
break;
|
||||
}
|
||||
if (dat.Dual_cmd() != 0) { // earlier dual tkn assumed to be <i><b>; </i> encountered so change dual to <b><i>
|
||||
if (dual_tkn == null) throw Exc_.new_("dual tkn is null"); // should never happen
|
||||
if (dual_tkn == null) throw Err_.new_wo_type("dual tkn is null"); // should never happen
|
||||
dual_tkn.Apos_cmd_(dat.Dual_cmd());
|
||||
dual_tkn = null;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public class Xop_list_tkn_ {
|
||||
case List_itmTyp_ol: return Byt_ol;
|
||||
case List_itmTyp_dt:
|
||||
case List_itmTyp_dd: return Byt_dl;
|
||||
default: throw Exc_.new_unhandled(b);
|
||||
default: throw Err_.new_unhandled(b);
|
||||
}
|
||||
}
|
||||
public static byte[] XmlTag_itm(byte b) {
|
||||
@@ -39,7 +39,7 @@ public class Xop_list_tkn_ {
|
||||
case List_itmTyp_ol: return Byt_li;
|
||||
case List_itmTyp_dt: return Byt_dt;
|
||||
case List_itmTyp_dd: return Byt_dd;
|
||||
default: throw Exc_.new_unhandled(b);
|
||||
default: throw Err_.new_unhandled(b);
|
||||
}
|
||||
}
|
||||
public static byte Char_lst(byte b) {
|
||||
@@ -48,7 +48,7 @@ public class Xop_list_tkn_ {
|
||||
case List_itmTyp_ol: return Byte_ascii.Hash;
|
||||
case List_itmTyp_dt: return Byte_ascii.Semic;
|
||||
case List_itmTyp_dd: return Byte_ascii.Colon;
|
||||
default: throw Exc_.new_unhandled(b);
|
||||
default: throw Err_.new_unhandled(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ public class Xop_list_wkr implements Xop_ctx_wkr {
|
||||
if (stop) break;
|
||||
}
|
||||
for (int i = 0; i < Max_list_depth; i++)
|
||||
curSymAry[i] = Byte_ascii.Nil;
|
||||
curSymAry[i] = Byte_ascii.Null;
|
||||
curSymLen = 0;
|
||||
SymAry_fill_overflow = true;
|
||||
return cur_pos;
|
||||
|
||||
@@ -29,7 +29,7 @@ public class Xop_list_wkr_ {
|
||||
case Byte_ascii.Hash:
|
||||
case Byte_ascii.Semic: return b;
|
||||
case Byte_ascii.Colon: return Byte_ascii.Semic;
|
||||
default: throw Exc_.new_unhandled(b);
|
||||
default: throw Err_.new_unhandled(b);
|
||||
}
|
||||
}
|
||||
public static void Close_list_if_present(Xop_ctx ctx, Xop_root_tkn root, byte[] src, int bgn_pos, int cur_pos) {// close all list tkns on stack; EX: ***\n should close all 3 stars; used to only close 1
|
||||
|
||||
@@ -61,7 +61,7 @@ public class Xop_lnke_wkr_brack_tst {
|
||||
));
|
||||
}
|
||||
@Test public void Encode_xwiki() { // PURPOSE: href title and args should always be encoded; PAGE:en.w:List_of_Category_A_listed_buildings_in_West_Lothian DATE:2014-07-15
|
||||
fxt.App().Usere().Wiki().Xwiki_mgr().Add_full(Bry_.new_u8("commons.wikimedia.org"), Bry_.new_u8("commons.wikimedia.org"));
|
||||
fxt.App().Usere().Wiki().Xwiki_mgr().Add_full(Bry_.new_a7("commons.wikimedia.org"), Bry_.new_a7("commons.wikimedia.org"));
|
||||
fxt.Test_parse_page_wiki_str // encode page
|
||||
( "[http://commons.wikimedia.org/%22%3E_A B]"
|
||||
, "<a href=\"/site/commons.wikimedia.org/wiki/%22%3E_A\">B</a>" // '%22%3E' not '">'
|
||||
|
||||
@@ -36,7 +36,7 @@ public class Xop_lnke_wkr_relative_tst {
|
||||
fxt.Test_parse_page_wiki_str("[//en.wikipedia.org/wiki/Category:A A]", "<a href=\"/site/en.wikipedia.org/wiki/Category:A\">A</a>");
|
||||
}
|
||||
@Test public void Relurl() {
|
||||
fxt.App().Usere().Wiki().Xwiki_mgr().Add_full(Bry_.new_u8("en.wikipedia.org"), Bry_.new_u8("en.wikipedia.org"));
|
||||
fxt.App().Usere().Wiki().Xwiki_mgr().Add_full(Bry_.new_a7("en.wikipedia.org"), Bry_.new_a7("en.wikipedia.org"));
|
||||
fxt.Test_parse_page_wiki_str("[[//en.wikipedia.org/ a]]", "[<a href=\"/site/en.wikipedia.org/wiki/\">a</a>]");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,11 +20,11 @@ import org.junit.*;
|
||||
public class Xop_lnke_wkr_xwiki_tst {
|
||||
@Before public void init() {fxt.Reset();} private Xop_fxt fxt = new Xop_fxt();
|
||||
@Test public void Xwiki() {
|
||||
fxt.App().Usere().Wiki().Xwiki_mgr().Add_full(Bry_.new_u8("en.wikipedia.org"), Bry_.new_u8("en.wikipedia.org"));
|
||||
fxt.App().Usere().Wiki().Xwiki_mgr().Add_full(Bry_.new_a7("en.wikipedia.org"), Bry_.new_a7("en.wikipedia.org"));
|
||||
fxt.Test_parse_page_wiki_str("[http://en.wikipedia.org/wiki/A a]", "<a href=\"/site/en.wikipedia.org/wiki/A\">a</a>");
|
||||
}
|
||||
@Test public void Xwiki_relative() {
|
||||
fxt.App().Usere().Wiki().Xwiki_mgr().Add_full(Bry_.new_u8("en.wikipedia.org"), Bry_.new_u8("en.wikipedia.org"));
|
||||
fxt.App().Usere().Wiki().Xwiki_mgr().Add_full(Bry_.new_a7("en.wikipedia.org"), Bry_.new_a7("en.wikipedia.org"));
|
||||
fxt.Test_parse_page_wiki_str("[//en.wikipedia.org/ a]", "<a href=\"/site/en.wikipedia.org/wiki/\">a</a>");
|
||||
}
|
||||
@Test public void Xwiki_qarg() {// DATE:2013-02-02
|
||||
@@ -32,12 +32,12 @@ public class Xop_lnke_wkr_xwiki_tst {
|
||||
fxt.Test_parse_page_wiki_str("http://en.wikipedia.org/wiki/Special:Allpages?from=Earth", "<a href=\"/site/en.wikipedia.org/wiki/Special:Allpages?from=Earth\">http://en.wikipedia.org/wiki/Special:Allpages?from=Earth</a>");
|
||||
}
|
||||
@Test public void Lang_prefix() {
|
||||
fxt.App().Usere().Wiki().Xwiki_mgr().Add_full(Bry_.new_u8("en.wikipedia.org"), Bry_.new_u8("en.wikipedia.org"));
|
||||
fxt.App().Usere().Wiki().Xwiki_mgr().Add_full(Bry_.new_a7("en.wikipedia.org"), Bry_.new_a7("en.wikipedia.org"));
|
||||
fxt.Wiki().Xwiki_mgr().Add_full(Bry_.new_a7("fr"), Bry_.new_a7("fr.wikipedia.org"));
|
||||
fxt.Test_parse_page_wiki_str("[http://en.wikipedia.org/wiki/fr:A a]", "<a href=\"/site/fr.wikipedia.org/wiki/A\">a</a>");
|
||||
}
|
||||
@Test public void Xwiki_query_arg() {
|
||||
fxt.App().Usere().Wiki().Xwiki_mgr().Add_full(Bry_.new_u8("en.wikipedia.org"), Bry_.new_u8("en.wikipedia.org"));
|
||||
fxt.App().Usere().Wiki().Xwiki_mgr().Add_full(Bry_.new_a7("en.wikipedia.org"), Bry_.new_a7("en.wikipedia.org"));
|
||||
fxt.Test_parse_page_wiki_str("[http://en.wikipedia.org/wiki/A?action=edit a]", "<a href=\"/site/en.wikipedia.org/wiki/A?action=edit\">a</a>");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ public class Xop_tblw_wkr implements Xop_ctx_wkr {
|
||||
else
|
||||
return Xop_tblw_wkr.Handle_false_tblw_match(ctx, root, src, bgn_pos, cur_pos, tkn_mkr.Txt(bgn_pos + 1, cur_pos), true); // +1 to skip "\n" in "\n|}" (don't convert \n to text); DATE:2014-02-19
|
||||
}
|
||||
default: throw Exc_.new_unhandled(wlxr_type);
|
||||
default: throw Err_.new_unhandled(wlxr_type);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user