mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
v1.7.3.1
This commit is contained in:
@@ -162,7 +162,7 @@ public class Gallery_itm_parser {
|
||||
case Fld_ttl:
|
||||
cur_itm.Ttl_end_(fld_end);
|
||||
byte[] ttl_bry = Bry_.Mid(src, cur_itm.Ttl_bgn(), fld_end);
|
||||
ttl_bry = ctx.App().Url_converter_url_ttl().Decode(ttl_bry); // NOTE: must decode url-encoded entries; EX: "A%28b%29.png" -> "A(b).png"; DATE:2014-01-01
|
||||
ttl_bry = ctx.App().Encoder_mgr().Url_ttl().Decode(ttl_bry); // NOTE: must decode url-encoded entries; EX: "A%28b%29.png" -> "A(b).png"; DATE:2014-01-01
|
||||
Xoa_ttl ttl = Xoa_ttl.parse_(wiki, ttl_bry);
|
||||
if ( ttl == null // invalid ttl; EX: "<invalid>"
|
||||
|| ttl.Anch_bgn() == 1 // anchor-only ttl; EX: "#invalid"; DATE:2014-03-18
|
||||
|
||||
@@ -88,9 +88,9 @@ class Gallery_itm_parser_fxt {
|
||||
ListAdp actl = ListAdp_.new_();
|
||||
byte[] src = Bry_.new_ascii_(raw);
|
||||
parser.Parse_all(actl, Gallery_mgr_base_.New_by_mode(Gallery_mgr_base_.Traditional_tid), new Gallery_xnde(), src, 0, src.length);
|
||||
Tfds.Eq_ary(String_.Ary_flatten(expd), String_.Ary_flatten(X_to_str_ary(src, actl)));
|
||||
Tfds.Eq_ary(String_.Ary_flatten(expd), String_.Ary_flatten(Xto_str_ary(src, actl)));
|
||||
}
|
||||
private String[][] X_to_str_ary(byte[] src, ListAdp list) {
|
||||
private String[][] Xto_str_ary(byte[] src, ListAdp list) {
|
||||
int len = list.Count();
|
||||
String[][] rv = new String[len][];
|
||||
for (int i = 0; i < len; i++) {
|
||||
@@ -98,15 +98,15 @@ class Gallery_itm_parser_fxt {
|
||||
String[] ary = new String[5];
|
||||
rv[i] = ary;
|
||||
ary[0] = String_.new_utf8_(itm.Ttl().Full_txt());
|
||||
ary[2] = X_to_str_ary_itm(src, itm.Alt_bgn(), itm.Alt_end());
|
||||
ary[3] = X_to_str_ary_itm(src, itm.Link_bgn(), itm.Link_end());
|
||||
ary[4] = X_to_str_ary_itm(src, itm.Page_bgn(), itm.Page_end());
|
||||
ary[2] = Xto_str_ary_itm(src, itm.Alt_bgn(), itm.Alt_end());
|
||||
ary[3] = Xto_str_ary_itm(src, itm.Link_bgn(), itm.Link_end());
|
||||
ary[4] = Xto_str_ary_itm(src, itm.Page_bgn(), itm.Page_end());
|
||||
byte[] caption = itm.Caption_bry();
|
||||
ary[1] = caption == null ? null : String_.new_utf8_(caption);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
private String X_to_str_ary_itm(byte[] src, int bgn, int end) {
|
||||
private String Xto_str_ary_itm(byte[] src, int bgn, int end) {
|
||||
return bgn == Bry_.NotFound && end == Bry_.NotFound ? null : String_.new_utf8_(src, bgn, end);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ public class Gallery_xnde_tst {
|
||||
)
|
||||
));
|
||||
}
|
||||
@Test public void Err_pre() { // PURPOSE: leading ws was failing; EX.WP: Vlaardingen; "\nA.jpg| <center>Visbank</center>\n"
|
||||
@Test public void Err_pre() { // PURPOSE: leading ws was failing; PAGE:en.w:Vlaardingen; "\nA.jpg| <center>Visbank</center>\n"
|
||||
raw_src = " <center>a</center>";
|
||||
fxt.Test_parse_page_wiki(String_.Concat_lines_nl_skip_last
|
||||
( "<gallery>"
|
||||
@@ -121,7 +121,7 @@ public class Gallery_xnde_tst {
|
||||
)
|
||||
));
|
||||
}
|
||||
@Test public void Err_comment() { // PURPOSE: comment was being rendered; EX.WP: Perpetual motion; <!-- removed A.jpg|bcde -->
|
||||
@Test public void Err_comment() { // PURPOSE: comment was being rendered; PAGE:en.w:Perpetual motion; <!-- removed A.jpg|bcde -->
|
||||
raw_src = "b";
|
||||
fxt.Init_log_(Xop_ttl_log.Comment_eos).Test_parse_page_wiki(String_.Concat_lines_nl_skip_last
|
||||
( "<gallery>"
|
||||
|
||||
Reference in New Issue
Block a user