mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
v2.11.1.1
This commit is contained in:
@@ -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.xtns.gallery; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.langs.htmls.*; import gplx.xowa.htmls.hdumps.abrvs.*;
|
||||
import gplx.langs.htmls.*; import gplx.xowa.htmls.core.makes.*;
|
||||
public interface Gallery_box_w_fmtr_arg extends Bry_fmtr_arg {
|
||||
Gallery_box_w_fmtr_arg Init(int uid, int width);
|
||||
}
|
||||
@@ -34,7 +34,7 @@ class Gallery_box_w_fmtr_arg__hdump implements Gallery_box_w_fmtr_arg {
|
||||
private int uid;
|
||||
public Gallery_box_w_fmtr_arg Init(int uid, int width) {this.uid = uid; return this;}
|
||||
public void Fmt__do(Bry_bfr bfr) {
|
||||
bfr.Add(Xohd_abrv_.Key_gallery_box_w);
|
||||
bfr.Add(Xoh_make_trie_.Bry__gallery_box_w);
|
||||
bfr.Add_int_variable(uid);
|
||||
bfr.Add_byte_apos();
|
||||
}
|
||||
@@ -56,7 +56,7 @@ class Gallery_img_pad_fmtr_arg__hdump implements Gallery_img_pad_fmtr_arg {
|
||||
private int uid;
|
||||
public Gallery_img_pad_fmtr_arg Init(int uid, int width) {this.uid = uid; return this;}
|
||||
public void Fmt__do(Bry_bfr bfr) {
|
||||
bfr.Add(Xohd_abrv_.Key_gallery_img_pad);
|
||||
bfr.Add(Xoh_make_trie_.Bry__gallery_img_pad);
|
||||
bfr.Add_int_variable(uid);
|
||||
bfr.Add_byte_apos();
|
||||
}
|
||||
|
||||
@@ -16,7 +16,8 @@ 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.xtns.gallery; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.xowa.files.*; import gplx.xowa.htmls.*; import gplx.xowa.htmls.lnkis.*; import gplx.xowa.htmls.hdumps.core.*; import gplx.xowa.htmls.hdumps.pages.*; import gplx.xowa.parsers.lnkis.*;
|
||||
import gplx.xowa.files.*; import gplx.xowa.htmls.core.wkrs.lnkis.htmls.*; import gplx.xowa.htmls.core.makes.imgs.*; import gplx.xowa.wikis.pages.*; import gplx.xowa.parsers.lnkis.*;
|
||||
import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.htmls.*;
|
||||
import gplx.xowa.parsers.*;
|
||||
public class Gallery_html_wtr {
|
||||
private final Xoh_arg_img_core img_core_fmtr_basic = new Xoh_arg_img_core__basic(), img_core_fmtr_hdump = new Xoh_arg_img_core__hdump();
|
||||
@@ -87,12 +88,12 @@ 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_.NotFound // 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()));
|
||||
byte[] lnki_href = app.Html__href_wtr().Build_to_bry(wiki, lnki_link_ttl);
|
||||
byte[] lnki_alt = itm.Alt_bgn() == Bry_.NotFound ? lnki_ttl : Xoh_html_wtr_escaper.Escape(app.Parser_amp_mgr(), tmp_bfr, Bry_.Mid(src, itm.Alt_bgn(), itm.Alt_end()));
|
||||
byte[] lnki_alt = itm.Alt_bgn() == Bry_find_.Not_found ? lnki_ttl : Xoh_html_wtr_escaper.Escape(app.Parser_amp_mgr(), tmp_bfr, Bry_.Mid(src, itm.Alt_bgn(), itm.Alt_end()));
|
||||
img_core_fmtr.Init(itm_elem_id, html_src, html_w, html_h);
|
||||
int itm_margin = Gallery_html_wtr_utl.Calc_vpad(mgr.Itm_h(), html_h);
|
||||
Gallery_html_wtr_.Itm_img_fmtr.Bld_bfr_many(itm_bfr
|
||||
@@ -105,7 +106,7 @@ public class Gallery_html_wtr {
|
||||
, lnki_alt
|
||||
);
|
||||
if (hctx_is_hdump)
|
||||
hdump_imgs.Imgs_add_img(new Xohd_data_itm__gallery_itm().Data_init_gallery(itm_div_w, itm_box_w, itm_margin), xfer_itm, Xohd_data_itm__gallery_itm.Tid_gallery);
|
||||
hdump_imgs.Imgs_add_img(new Xohd_img_itm__gallery_itm().Data_init_gallery(itm_div_w, itm_box_w, itm_margin), xfer_itm, Xohd_img_itm__gallery_itm.Tid_gallery);
|
||||
}
|
||||
else {
|
||||
Gallery_html_wtr_.Itm_txt_fmtr.Bld_bfr_many(itm_bfr
|
||||
|
||||
@@ -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.xtns.gallery; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.xowa.files.*; import gplx.xowa.files.gui.*; import gplx.xowa.guis.views.*; import gplx.xowa.htmls.*;
|
||||
import gplx.xowa.files.*; import gplx.xowa.files.gui.*; import gplx.xowa.guis.views.*; import gplx.xowa.htmls.core.htmls.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.lnkis.*;
|
||||
public class Gallery_itm implements Js_img_wkr {
|
||||
private Gallery_xnde xnde; private Xof_file_itm xfer_itm; private Xowe_wiki wiki; private Xop_ctx ctx; private byte[] src; private byte[] gallery_li_id_bry; private int gallery_itm_idx;
|
||||
@@ -35,7 +35,7 @@ public class Gallery_itm implements Js_img_wkr {
|
||||
public Xop_lnki_tkn Lnki_tkn() {return lnki_tkn;} public Gallery_itm Lnki_tkn_(Xop_lnki_tkn v) {lnki_tkn = v; return this;} private Xop_lnki_tkn lnki_tkn;
|
||||
public Gallery_itm Reset() {
|
||||
ttl = null;
|
||||
ttl_bgn = ttl_end = alt_bgn = alt_end = link_bgn = link_end = page_bgn = page_end = Bry_.NotFound;
|
||||
ttl_bgn = ttl_end = alt_bgn = alt_end = link_bgn = link_end = page_bgn = page_end = Bry_find_.Not_found;
|
||||
caption_bry = null; // NOTE: use null instead of ""; more legible tests
|
||||
caption_tkn = null;
|
||||
ext = null;
|
||||
|
||||
@@ -165,7 +165,7 @@ public class Gallery_itm_parser {
|
||||
int fld_end = cur_pos;
|
||||
if (cur_fld != Fld_caption) {
|
||||
int non_ws_pos = Bry_find_.Find_bwd_non_ws_or_not_found(src, cur_pos - 1, itm_bgn) + 1; // SEE:non_ws_pos
|
||||
if (non_ws_pos != Bry_.NotFound + 1)
|
||||
if (non_ws_pos != Bry_find_.Not_found + 1)
|
||||
fld_end = non_ws_pos;
|
||||
}
|
||||
switch (cur_fld) {
|
||||
|
||||
@@ -107,6 +107,6 @@ class Gallery_itm_parser_fxt {
|
||||
return rv;
|
||||
}
|
||||
private String Xto_str_ary_itm(byte[] src, int bgn, int end) {
|
||||
return bgn == Bry_.NotFound && end == Bry_.NotFound ? null : String_.new_u8(src, bgn, end);
|
||||
return bgn == Bry_find_.Not_found && end == Bry_find_.Not_found ? null : String_.new_u8(src, bgn, end);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.xtns.gallery; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.langs.htmls.*; import gplx.xowa.htmls.*; import gplx.xowa.htmls.modules.*; import gplx.xowa.files.*; import gplx.xowa.htmls.hdumps.abrvs.*; import gplx.xowa.htmls.hdumps.core.*;
|
||||
import gplx.langs.htmls.*; import gplx.xowa.htmls.core.htmls.*; import gplx.xowa.htmls.modules.*; import gplx.xowa.files.*; import gplx.xowa.htmls.core.makes.*; import gplx.xowa.htmls.core.makes.imgs.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.xndes.*; import gplx.xowa.parsers.htmls.*; import gplx.xowa.parsers.lnkis.*;
|
||||
public abstract class Gallery_mgr_base {
|
||||
private Gallery_box_w_fmtr_arg__basic box_w_fmtr__basic = new Gallery_box_w_fmtr_arg__basic(); private Gallery_box_w_fmtr_arg__hdump box_w_fmtr__hdump = new Gallery_box_w_fmtr_arg__hdump();
|
||||
@@ -60,7 +60,7 @@ public abstract class Gallery_mgr_base {
|
||||
if (itms_per_row > 0) {
|
||||
int max_width = itms_per_row * (itm_default_w + this.Get_all_padding());
|
||||
box_style = Fmt_and_add(tmp_bfr, box_style_max_width_fmtr, box_style, max_width);
|
||||
page.Hdump_data().Imgs_add(new Xohd_data_itm__gallery_mgr(gallery_uid, max_width));
|
||||
page.Hdump_data().Imgs_add(new Xohd_img_itm__gallery_mgr(gallery_uid, max_width));
|
||||
}
|
||||
byte[] box_cls = Fmt_and_add(tmp_bfr, box_cls_fmtr, xnde.Atr_cls(), this.Tid_bry());
|
||||
byte[] gallery_ul_id = tmp_bfr.Add(box_id_prefix_bry).Add_int_variable(gallery_uid).To_bry_and_clear();
|
||||
@@ -111,11 +111,11 @@ public abstract class Gallery_mgr_base {
|
||||
html_w_expand = lnki_w_orig; html_h_expand = lnki_h_orig; // reset lnki_w_orig / lnki_h_orig else large captions
|
||||
}
|
||||
else {
|
||||
byte[] alt = itm.Alt_bgn() == Bry_.NotFound && Bry_.Len_eq_0(itm_caption) // if ( $alt == '' && $text == '' ) $imageParameters['alt'] = $nt->getText();
|
||||
byte[] alt = itm.Alt_bgn() == Bry_find_.Not_found && Bry_.Len_eq_0(itm_caption) // if ( $alt == '' && $text == '' ) $imageParameters['alt'] = $nt->getText();
|
||||
? itm.Ttl().Page_txt()
|
||||
: Xoh_html_wtr_escaper.Escape(app.Parser_amp_mgr(), tmp_bfr, Bry_.Mid(src, itm.Alt_bgn(), itm.Alt_end()))
|
||||
;
|
||||
Xoa_ttl href_ttl = itm.Link_bgn() == Bry_.NotFound
|
||||
Xoa_ttl href_ttl = itm.Link_bgn() == Bry_find_.Not_found
|
||||
? ttl
|
||||
: Xoa_ttl.parse(wiki, Bry_.Mid(src, itm.Link_bgn(), itm.Link_end()))
|
||||
;
|
||||
@@ -151,7 +151,7 @@ public abstract class Gallery_mgr_base {
|
||||
Wrap_gallery_text(bfr, itm_caption, html_w_expand, html_h_expand);
|
||||
bfr.Add(itm_li_end_bry);
|
||||
if (hctx_is_hdump)
|
||||
page.Hdump_data().Imgs_add_img(new Xohd_data_itm__gallery_itm().Data_init_gallery(itm_div_width, img_div_w, vpad), xfer_itm, Xohd_data_itm__gallery_itm.Tid_gallery);
|
||||
page.Hdump_data().Imgs_add_img(new Xohd_img_itm__gallery_itm().Data_init_gallery(itm_div_width, img_div_w, vpad), xfer_itm, Xohd_img_itm__gallery_itm.Tid_gallery);
|
||||
}
|
||||
private static final byte[]
|
||||
Wrap_gallery_text_bgn = Bry_.new_a7("\n <div class=\"gallerytext\">") // NOTE: The newline after <div class="gallerytext"> is needed to accommodate htmltidy
|
||||
@@ -191,16 +191,16 @@ public abstract class Gallery_mgr_base {
|
||||
}
|
||||
private static void Box_hdr_write(Bry_bfr bfr, Xop_xatr_whitelist_mgr whitelist_mgr, byte[] src, byte[] gallery_ul_uid, byte[] cls, byte[] style, List_adp xatr_list, boolean hctx_is_hdump, int uid) {
|
||||
bfr.Add_byte(Byte_ascii.Lt).Add(Html_tag_.Ul_name_bry);
|
||||
Html_wtr.Write_atr_bry(bfr, Html_atr_.Id_bry, gallery_ul_uid);
|
||||
Html_wtr.Write_atr_bry(bfr, Html_atr_.Cls_bry, cls);
|
||||
Html_wtr.Write_atr_bry(bfr, Html_atr_.Bry__id, gallery_ul_uid);
|
||||
Html_wtr.Write_atr_bry(bfr, Html_atr_.Bry__class, cls);
|
||||
if (hctx_is_hdump) {
|
||||
bfr.Add_byte_space();
|
||||
bfr.Add(Xohd_abrv_.Key_gallery_box_max);
|
||||
bfr.Add(Xoh_make_trie_.Bry__gallery_box_max);
|
||||
bfr.Add_int_variable(uid);
|
||||
bfr.Add_byte_apos();
|
||||
}
|
||||
else
|
||||
Html_wtr.Write_atr_bry(bfr, Html_atr_.Style_bry, style);
|
||||
Html_wtr.Write_atr_bry(bfr, Html_atr_.Bry__style, style);
|
||||
if (xatr_list != null) {
|
||||
int len = xatr_list.Count();
|
||||
for (int i = 0; i < len; i++) {
|
||||
|
||||
@@ -19,7 +19,7 @@ package gplx.xowa.xtns.gallery; import gplx.*; import gplx.xowa.*; import gplx.x
|
||||
import gplx.core.primitives.*; import gplx.dbs.cfgs.*;
|
||||
import gplx.fsdb.meta.*;
|
||||
import gplx.xowa.parsers.logs.*;
|
||||
import gplx.xowa.htmls.*; import gplx.xowa.files.*; import gplx.xowa.files.fsdb.*;
|
||||
import gplx.xowa.htmls.core.htmls.*; import gplx.xowa.files.*; import gplx.xowa.files.fsdb.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.xndes.*; import gplx.xowa.parsers.htmls.*;
|
||||
public class Gallery_xnde implements Xox_xnde, Mwh_atr_itm_owner {
|
||||
private Gallery_xtn_mgr xtn_mgr;
|
||||
|
||||
Reference in New Issue
Block a user