diff --git a/400_xowa/src/gplx/xowa/files/Xof_fsdb_itm.java b/400_xowa/src/gplx/xowa/files/Xof_fsdb_itm.java index 946e09ffa..de5b6dcd4 100644 --- a/400_xowa/src/gplx/xowa/files/Xof_fsdb_itm.java +++ b/400_xowa/src/gplx/xowa/files/Xof_fsdb_itm.java @@ -180,6 +180,7 @@ public class Xof_fsdb_itm implements Xof_file_itm { bfr .Add_int_variable(html_uid); bfr.Add_byte_pipe().Add_int_variable(lnki_exec_tid); bfr.Add_byte_pipe().Add(lnki_wiki_abrv); + bfr.Add_byte_pipe().Add(lnki_ttl); bfr.Add_byte_pipe().Add_int_variable(lnki_type); bfr.Add_byte_pipe().Add_double(lnki_upright); bfr.Add_byte_pipe().Add_int_variable(lnki_upright_patch); diff --git a/400_xowa/src/gplx/xowa/htmls/core/wkrs/Xoh_hdoc_wkr__make.java b/400_xowa/src/gplx/xowa/htmls/core/wkrs/Xoh_hdoc_wkr__make.java index ced1906af..842bc6f18 100644 --- a/400_xowa/src/gplx/xowa/htmls/core/wkrs/Xoh_hdoc_wkr__make.java +++ b/400_xowa/src/gplx/xowa/htmls/core/wkrs/Xoh_hdoc_wkr__make.java @@ -72,8 +72,16 @@ public class Xoh_hdoc_wkr__make implements Xoh_hdoc_wkr { bfr.Add_mid(src, img_data.Src_end(), data.Src_end()); } public void On_gly (gplx.xowa.htmls.core.wkrs.glys.Xoh_gly_grp_data data) { - // section; add entire src, and enable gallery flage - bfr.Add_mid(src, data.Src_bgn(), data.Src_end()); + // section; loop itms and call wkr__img on each image while concatenating anything inbetween + int prv = data.Src_bgn(); + int len = data.Itms__len(); + for (int i = 0; i < len; i++) { + gplx.xowa.htmls.core.wkrs.glys.Xoh_gly_itm_data itm = data.Itms__get_at(i); + bfr.Add_mid(src, prv, itm.Img_data().Src_bgn()); + prv = itm.Img_data().Src_end(); + wkr__img.Init_by_parse(bfr, hpg, hctx, src, (Xoh_img_data)itm.Img_data()); + } + bfr.Add_mid(src, prv, data.Src_end()); hpg.Xtn__gallery_exists_y_(); } public boolean Process_parse(Xoh_data_itm data) { diff --git a/400_xowa/src/gplx/xowa/htmls/core/wkrs/glys/Xoh_gly_make__basic__tst.java b/400_xowa/src/gplx/xowa/htmls/core/wkrs/glys/Xoh_gly_make__basic__tst.java new file mode 100644 index 000000000..26848e17d --- /dev/null +++ b/400_xowa/src/gplx/xowa/htmls/core/wkrs/glys/Xoh_gly_make__basic__tst.java @@ -0,0 +1,73 @@ +/* +XOWA: the XOWA Offline Wiki Application +Copyright (C) 2012-2017 gnosygnu@gmail.com + +XOWA is licensed under the terms of the General Public License (GPL) Version 3, +or alternatively under the terms of the Apache License Version 2.0. + +You may use XOWA according to either of these licenses as is most appropriate +for your project on a case-by-case basis. + +The terms of each license can be found in the source code repository: + +GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt +Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt +*/ +package gplx.xowa.htmls.core.wkrs.glys; import gplx.*; import gplx.xowa.*; import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.*; import gplx.xowa.htmls.core.wkrs.*; +import org.junit.*; import gplx.xowa.htmls.core.makes.tests.*; import gplx.xowa.parsers.lnkis.*; +public class Xoh_gly_make__basic__tst { + private final Xoh_make_fxt fxt = new Xoh_make_fxt(); + @Before public void Init() {fxt.Clear();} + @Test public void Media_div() { + String orig = String_.Concat_lines_nl_skip_last + ( "abc"); + String expd = String_.Concat_lines_nl_skip_last + ( "abc"); + fxt.Test__make(orig, fxt.Page_chkr().Body_(expd) + .Imgs__add("en.w", "A.png", Xop_lnki_type.Id_null, -1, 120, 120, -1, -1) + .Imgs__add("en.w", "B.png", Xop_lnki_type.Id_null, -1, 120, 120, -1, -1) + ); + } +} diff --git a/400_xowa/src/gplx/xowa/htmls/core/wkrs/imgs/Xoh_img_make__dump__tst.java b/400_xowa/src/gplx/xowa/htmls/core/wkrs/imgs/Xoh_img_make__dump__tst.java index 4ff5c1d4f..79cf6d399 100644 --- a/400_xowa/src/gplx/xowa/htmls/core/wkrs/imgs/Xoh_img_make__dump__tst.java +++ b/400_xowa/src/gplx/xowa/htmls/core/wkrs/imgs/Xoh_img_make__dump__tst.java @@ -33,7 +33,7 @@ public class Xoh_img_make__dump__tst { , expd = "abc" ; fxt.Test__make(orig, fxt.Page_chkr().Body_(expd) - .Imgs__add("en.w", "A.png", Xop_lnki_type.Id_null, 0.5, 220, 110, -1, -1) + .Imgs__add("en.w", "Aé_b.png", Xop_lnki_type.Id_null, 0.5, 220, 110, -1, -1) ); } @Test public void Media_div() { @@ -60,7 +60,7 @@ public class Xoh_img_make__dump__tst { , "" , ""); fxt.Test__make(orig, fxt.Page_chkr().Body_(expd) - .Imgs__add("c", "A.png", Xop_lnki_type.Tid_orig_known, -1, 220, -1, -1, -1) + .Imgs__add("c", "A.ogv", Xop_lnki_type.Tid_orig_known, -1, 220, -1, -1, -1) ); } // @Test public void Html_exists__y__cache() { diff --git a/400_xowa/src/gplx/xowa/htmls/core/wkrs/imgs/Xoh_img_wtr.java b/400_xowa/src/gplx/xowa/htmls/core/wkrs/imgs/Xoh_img_wtr.java index 35296ba7c..ccef1d192 100644 --- a/400_xowa/src/gplx/xowa/htmls/core/wkrs/imgs/Xoh_img_wtr.java +++ b/400_xowa/src/gplx/xowa/htmls/core/wkrs/imgs/Xoh_img_wtr.java @@ -84,7 +84,10 @@ public class Xoh_img_wtr implements Bfr_arg, Xoh_wtr_itm { this.fsdb_itm = hpg.Img_mgr().Make_img(data.Img_is_gallery()); byte[] file_ttl_bry = data.Anch_xo_ttl().Val(); - byte[] lnki_ttl = Xoa_ttl.Replace_spaces(Gfo_url_encoder_.Href_quotes.Decode(data.Img_src().File_ttl_bry())); // NOTE: must decode for fsdb.lnki_ttl as well as xowa_title; EX: A%C3%A9b -> A�b + byte[] img_src_bry_temp = data.Img_src().File_ttl_bry(); + byte[] lnki_ttl = img_src_bry_temp == null // img_src will be empty for htxt; use file_ttl_bry instead; EX: '' DATE:2019-03-10 + ? file_ttl_bry + : Xoa_ttl.Replace_spaces(Gfo_url_encoder_.Href_quotes.Decode(img_src_bry_temp)); // NOTE: must decode for fsdb.lnki_ttl as well as xowa_title; EX: A%C3%A9b -> A�b boolean write_xowa_file_title = true; if (data.Img_pgbnr().Exists()) {