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

'v3.3.4.1'

This commit is contained in:
gnosygnu
2016-03-27 23:44:59 -04:00
parent de67253a9c
commit baaef32df2
903 changed files with 13339 additions and 8695 deletions

View File

@@ -69,8 +69,8 @@ class Gallery_itm_parser_fxt {
private Xoae_app app; private Xowe_wiki wiki;
private Gallery_itm_parser parser;
public Gallery_itm_parser_fxt Init() {
this.app = Xoa_app_fxt.app_();
this.wiki = Xoa_app_fxt.wiki_tst_(app);
this.app = Xoa_app_fxt.Make__app__edit();
this.wiki = Xoa_app_fxt.Make__wiki__edit(app);
parser = new Gallery_itm_parser();
parser.Init_by_wiki(wiki);
return this;
@@ -97,7 +97,7 @@ class Gallery_itm_parser_fxt {
Gallery_itm itm = (Gallery_itm)list.Get_at(i);
String[] ary = new String[5];
rv[i] = ary;
ary[0] = String_.new_u8(itm.Ttl().Full_txt());
ary[0] = String_.new_u8(itm.Ttl().Full_txt_w_ttl_case());
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());

View File

@@ -84,7 +84,6 @@ public abstract class Gallery_mgr_base {
Gallery_itm itm = (Gallery_itm)xnde.Itms_get_at(i);
Xoa_ttl ttl = itm.Ttl(); if (Bry_.Len_eq_0(ttl.Page_db())) return; // if file ttl is invalid, do not write; EX:File:#A.png; DATE:2016-01-12
byte[] itm_caption = itm.Caption_bry(); if (itm_caption == null) itm_caption = Bry_.Empty;
Xop_lnki_tkn lnki = itm.Lnki_tkn();
int lnki_w_orig = lnki.W(), lnki_h_orig = lnki.H(); // store orig lnki_w / lnki_w
this.Get_thumb_size(lnki, itm.Ext()); // packed=expand by 1.5;
@@ -138,7 +137,6 @@ public abstract class Gallery_mgr_base {
tmp_bfr.Add(itm_divs_end_bry);
itm_html = tmp_bfr.To_bry_and_clear();
}
byte[] show_filenames_link = Bry_.Empty;
if (xnde.Show_filename()) {
wiki.Html_mgr().Html_wtr().Lnki_wtr().Write_plain_by_bry
@@ -192,7 +190,7 @@ public abstract class Gallery_mgr_base {
int len = xatr_list.Count();
for (int i = 0; i < len; i++) {
Mwh_atr_itm xatr = (Mwh_atr_itm)xatr_list.Get_at(i);
if (!whitelist_mgr.Chk(Xop_xnde_tag_.Tid_ul, src, xatr)) continue;
if (!whitelist_mgr.Chk(Xop_xnde_tag_.Tid__ul, src, xatr)) continue;
byte[] key = xatr.Key_bry();
byte[] val = xatr.Val_as_bry();
Gfh_wtr.Write_atr_bry(bfr, key, val);

View File

@@ -22,7 +22,7 @@ public class Gallery_xnde_tst {
@Before public void init() {fxt.Reset(); fxt.Wiki().Xtn_mgr().Init_by_wiki(fxt.Wiki());}
@Test public void Lnki_no_caption() {
fxt.Test_parse_page_wiki("<gallery>File:A.png</gallery>"
, fxt.tkn_xnde_().Xnde_tagId_(Xop_xnde_tag_.Tid_gallery).Xnde_xtn_
, fxt.tkn_xnde_().Xnde_tagId_(Xop_xnde_tag_.Tid__gallery).Xnde_xtn_
( new_chkr_gallery_mgr().Expd_subs_
( new_chkr_gallery_itm().Expd_lnki_("File:A.png")
)
@@ -30,7 +30,7 @@ public class Gallery_xnde_tst {
}
@Test public void Lnki_1() {
fxt.Test_parse_page_wiki("<gallery>File:A.png|b</gallery>"
, fxt.tkn_xnde_().Xnde_tagId_(Xop_xnde_tag_.Tid_gallery).Xnde_xtn_
, fxt.tkn_xnde_().Xnde_tagId_(Xop_xnde_tag_.Tid__gallery).Xnde_xtn_
( new_chkr_gallery_mgr().Expd_subs_
( new_chkr_gallery_itm().Expd_lnki_("File:A.png")
)
@@ -38,7 +38,7 @@ public class Gallery_xnde_tst {
}
@Test public void Lnki_3() {
fxt.Test_parse_page_wiki("<gallery>File:A.png|a\nFile:B.png|b\nFile:C.png|c</gallery>"
, fxt.tkn_xnde_().Xnde_tagId_(Xop_xnde_tag_.Tid_gallery).Xnde_xtn_
, fxt.tkn_xnde_().Xnde_tagId_(Xop_xnde_tag_.Tid__gallery).Xnde_xtn_
( new_chkr_gallery_mgr().Expd_subs_
( new_chkr_gallery_itm().Expd_lnki_("File:A.png")
, new_chkr_gallery_itm().Expd_lnki_("File:B.png")
@@ -48,7 +48,7 @@ public class Gallery_xnde_tst {
}
@Test public void Ignore_newLines() {
fxt.Test_parse_page_wiki("<gallery>\n\n\nFile:A.png|a\n\n\nFile:B.png|b\n\n\n</gallery>"
, fxt.tkn_xnde_().Xnde_tagId_(Xop_xnde_tag_.Tid_gallery).Xnde_xtn_
, fxt.tkn_xnde_().Xnde_tagId_(Xop_xnde_tag_.Tid__gallery).Xnde_xtn_
( new_chkr_gallery_mgr().Expd_subs_
( new_chkr_gallery_itm().Expd_lnki_("File:A.png")
, new_chkr_gallery_itm().Expd_lnki_("File:B.png")
@@ -57,7 +57,7 @@ public class Gallery_xnde_tst {
}
@Test public void Only_first_pipe() {
fxt.Test_parse_page_wiki("<gallery>File:A.png|File:B.png|cc</gallery>"
, fxt.tkn_xnde_().Xnde_tagId_(Xop_xnde_tag_.Tid_gallery).Xnde_xtn_
, fxt.tkn_xnde_().Xnde_tagId_(Xop_xnde_tag_.Tid__gallery).Xnde_xtn_
( new_chkr_gallery_mgr().Expd_subs_
( new_chkr_gallery_itm().Expd_lnki_("File:A.png")
)
@@ -65,7 +65,7 @@ public class Gallery_xnde_tst {
}
@Test public void Invalid_lnki() {
fxt.Test_parse_page_wiki("<gallery>A.png|cc</gallery>"
, fxt.tkn_xnde_().Xnde_tagId_(Xop_xnde_tag_.Tid_gallery).Xnde_xtn_
, fxt.tkn_xnde_().Xnde_tagId_(Xop_xnde_tag_.Tid__gallery).Xnde_xtn_
( new_chkr_gallery_mgr().Expd_subs_
( new_chkr_gallery_itm().Expd_lnki_("File:A.png") // NOTE: MW converts "A.png" to "File:A.png"
)
@@ -73,7 +73,7 @@ public class Gallery_xnde_tst {
}
@Test public void File_only_trailing_nl() {
fxt.Test_parse_page_wiki("<gallery>File:A.png\n</gallery>"
, fxt.tkn_xnde_().Xnde_tagId_(Xop_xnde_tag_.Tid_gallery).Xnde_xtn_
, fxt.tkn_xnde_().Xnde_tagId_(Xop_xnde_tag_.Tid__gallery).Xnde_xtn_
( new_chkr_gallery_mgr().Expd_subs_
( new_chkr_gallery_itm().Expd_lnki_("File:A.png").Expd_caption_(null)
)
@@ -82,7 +82,7 @@ public class Gallery_xnde_tst {
@Test public void Invalid_curly() {
raw_src = "a\n";
fxt.Init_log_(Xop_ttl_log.Invalid_char).Test_parse_page_wiki("<gallery>File:A.png|" + raw_src + "}}</gallery>" // NOTE: }} is ignored since it is not a valid title
, fxt.tkn_xnde_().Xnde_tagId_(Xop_xnde_tag_.Tid_gallery).Xnde_xtn_
, fxt.tkn_xnde_().Xnde_tagId_(Xop_xnde_tag_.Tid__gallery).Xnde_xtn_
( new_chkr_gallery_mgr().Expd_subs_
( new_chkr_gallery_itm().Expd_lnki_("File:A.png").Expd_caption_("a")
)
@@ -91,7 +91,7 @@ public class Gallery_xnde_tst {
@Test public void Caption() {
raw_src = "a<br/>c";
fxt.Test_parse_page_wiki("<gallery>File:A.png|" + raw_src + "</gallery>"
, fxt.tkn_xnde_().Xnde_tagId_(Xop_xnde_tag_.Tid_gallery).Xnde_xtn_
, fxt.tkn_xnde_().Xnde_tagId_(Xop_xnde_tag_.Tid__gallery).Xnde_xtn_
( new_chkr_gallery_mgr().Expd_subs_
( new_chkr_gallery_itm().Expd_lnki_("File:A.png").Expd_caption_(raw_src)
)
@@ -103,7 +103,7 @@ public class Gallery_xnde_tst {
( "<gallery perrow=3>"
, "File:A.jpg|" + raw_src
, "</gallery>"
) , fxt.tkn_xnde_().Xnde_tagId_(Xop_xnde_tag_.Tid_gallery).Xnde_xtn_
) , fxt.tkn_xnde_().Xnde_tagId_(Xop_xnde_tag_.Tid__gallery).Xnde_xtn_
( new_chkr_gallery_mgr().Expd_subs_
( new_chkr_gallery_itm().Expd_lnki_("File:A.jpg").Expd_caption_(raw_src)
)
@@ -115,7 +115,7 @@ public class Gallery_xnde_tst {
( "<gallery>"
, "File:A.jpg|" + raw_src
, "</gallery>"
) , fxt.tkn_xnde_().Xnde_tagId_(Xop_xnde_tag_.Tid_gallery).Xnde_xtn_
) , fxt.tkn_xnde_().Xnde_tagId_(Xop_xnde_tag_.Tid__gallery).Xnde_xtn_
( new_chkr_gallery_mgr().Expd_subs_
( new_chkr_gallery_itm().Expd_lnki_("File:A.jpg").Expd_caption_("<center>a</center>")
)
@@ -127,7 +127,7 @@ public class Gallery_xnde_tst {
( "<gallery>"
, "<!-- deleted A.jpg|" + raw_src
, "</gallery>"
) , fxt.tkn_xnde_().Xnde_tagId_(Xop_xnde_tag_.Tid_gallery).Xnde_xtn_
) , fxt.tkn_xnde_().Xnde_tagId_(Xop_xnde_tag_.Tid__gallery).Xnde_xtn_
( new_chkr_gallery_mgr().Expd_subs_()
)
);
@@ -135,7 +135,7 @@ public class Gallery_xnde_tst {
@Test public void Misc_atr() { // make sure misc attribute doesn't fail
raw_src = "b";
fxt.Test_parse_page_wiki("<gallery id=a>File:A.png|" + raw_src + "</gallery>"
, fxt.tkn_xnde_().Xnde_tagId_(Xop_xnde_tag_.Tid_gallery).Xnde_xtn_
, fxt.tkn_xnde_().Xnde_tagId_(Xop_xnde_tag_.Tid__gallery).Xnde_xtn_
( new_chkr_gallery_mgr().Expd_subs_
( new_chkr_gallery_itm().Expd_lnki_("File:A.png").Expd_caption_(raw_src)
)