mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
v3.1.3.1
This commit is contained in:
@@ -89,7 +89,7 @@ public class Gallery_html_wtr {
|
||||
}
|
||||
byte[] lnki_ttl = lnki.Ttl().Page_txt();
|
||||
Xoa_ttl lnki_link_ttl = itm_ttl; // default href to ttl
|
||||
if ( itm.Link_bgn() != Bry_find_.Not_found // link is not -1; EX: "A.png" has no link specified
|
||||
if ( itm.Link_bgn() != Bry_find_.Not_found // link is not -1; EX: "A.png" has no link specified
|
||||
&& (itm.Link_end() - itm.Link_bgn()) > 0 // and link_end - link_bgn > 0; EX: "A.png|link="; DATE:2014-06-15
|
||||
)
|
||||
lnki_link_ttl = Xoa_ttl.parse(wiki, Bry_.Mid(src, itm.Link_bgn(), itm.Link_end()));
|
||||
|
||||
@@ -82,7 +82,7 @@ public abstract class Gallery_mgr_base {
|
||||
public static byte File_found_mode = Bool_.__byte;
|
||||
public void Write_html_itm(Bry_bfr bfr, Bry_bfr tmp_bfr, Xoae_app app, Xowe_wiki wiki, Xoae_page page, Xop_ctx ctx, Xoh_html_wtr html_wtr, Xoh_wtr_ctx hctx, byte[] src, Gallery_xnde xnde, byte[] gallery_ul_id, int i, Xof_file_itm xfer_itm, boolean hctx_is_hdump) {
|
||||
Gallery_itm itm = (Gallery_itm)xnde.Itms_get_at(i);
|
||||
Xoa_ttl ttl = itm.Ttl();
|
||||
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();
|
||||
@@ -187,14 +187,7 @@ public abstract class Gallery_mgr_base {
|
||||
if (!hctx_is_hdump)
|
||||
Gfh_wtr.Write_atr_bry(bfr, Gfh_atr_.Bry__id, gallery_ul_uid);
|
||||
Gfh_wtr.Write_atr_bry(bfr, Gfh_atr_.Bry__class, cls);
|
||||
// if (hctx_is_hdump) {
|
||||
// bfr.Add_byte_space();
|
||||
// bfr.Add(Xoh_make_trie_.Bry__gallery_box_max);
|
||||
// bfr.Add_int_variable(uid);
|
||||
// bfr.Add_byte_apos();
|
||||
// }
|
||||
// else
|
||||
Gfh_wtr.Write_atr_bry(bfr, Gfh_atr_.Bry__style, style);
|
||||
Gfh_wtr.Write_atr_bry(bfr, Gfh_atr_.Bry__style, style);
|
||||
if (xatr_list != null) {
|
||||
int len = xatr_list.Count();
|
||||
for (int i = 0; i < len; i++) {
|
||||
|
||||
@@ -133,7 +133,10 @@ public class Gallery_mgr_base_basic_tst {
|
||||
);
|
||||
}
|
||||
@Test public void Link_is_empty() { // PURPOSE: "link=" causes null pointer exception; DATE:2014-06-15
|
||||
fxt.Test_html_frag("<gallery>File:A.png|link=</gallery>", "href=\"/wiki/File:A.png\"");
|
||||
fxt.Test_html_frag("<gallery>File:A.png|link=</gallery>", String_.Concat_lines_nl_skip_last
|
||||
( "<div style=\"margin:15px auto;\">"
|
||||
, " <img id=\"xoimg_0\" alt=\"A.png\" src=\"file:///mem/wiki/repo/trg/thumb/7/0/A.png/120px.png\" width=\"120\" height=\"120\" />"
|
||||
));
|
||||
}
|
||||
@Test public void Dangling_autcloses() { // PURPOSE: dangling gallery should auto-close, not escape; PAGE:en.w:Wikipedia:Featured_pictures_thumbs_43 DATE:2014-08-23
|
||||
fxt.Test_html_frag("<gallery>File:A.png|b", "<ul id=\"xowa_gallery_ul_0\"");
|
||||
@@ -157,6 +160,13 @@ public class Gallery_mgr_base_basic_tst {
|
||||
// , "<li class='gallerycaption'>B</li>"
|
||||
// );
|
||||
// }
|
||||
@Test public void Invalid() { // PURPOSE: ignore invalid file names; DATE:2016-01-12
|
||||
fxt.Test_html_str("<gallery>File:#A.png|a</gallery>"
|
||||
, String_.Concat_lines_nl_skip_last
|
||||
( "<ul id=\"xowa_gallery_ul_0\" class=\"gallery mw-gallery-traditional\">"
|
||||
, "</ul>"
|
||||
));
|
||||
}
|
||||
}
|
||||
class Gallery_mgr_base_fxt {
|
||||
public void Reset() {
|
||||
|
||||
Reference in New Issue
Block a user