diff --git a/400_xowa/src/gplx/xowa/htmls/core/wkrs/lnkis/htmls/Xoh_file_wtr__image__basic__tst.java b/400_xowa/src/gplx/xowa/htmls/core/wkrs/lnkis/htmls/Xoh_file_wtr__image__basic__tst.java
index 60792850f..087c90161 100644
--- a/400_xowa/src/gplx/xowa/htmls/core/wkrs/lnkis/htmls/Xoh_file_wtr__image__basic__tst.java
+++ b/400_xowa/src/gplx/xowa/htmls/core/wkrs/lnkis/htmls/Xoh_file_wtr__image__basic__tst.java
@@ -330,40 +330,6 @@ public class Xoh_file_wtr__image__basic__tst {
fxt.Wiki().File__fsdb_mode().Tid__v2__bld__y_();
}
- @Test public void Imap() {
- Xof_file_fxt file_fxt = Xof_file_fxt.new_all(fxt.Wiki());
- file_fxt.Exec_orig_add(Bool_.Y, "A.png", Xof_ext_.Id_png, 320, 300, "");
- fxt.Wiki().File__fsdb_mode().Tid__v2__mp__y_();
- fxt.Hctx_(gplx.xowa.htmls.core.htmls.Xoh_wtr_ctx.Hdump);
-
- fxt.Test_parse_page_wiki_str
- ( String_.Concat_lines_nl_skip_last
- ( ""
- , "File:A.png|thumb|320px|a1"
- , "circle 0 0 5 [[B|b1]]"
- , "rect 0 0 4 8 [[C|c1]]"
- , "desc none"
- , ""
- )
- , String_.Concat_lines_nl_skip_last
- ( "
"
- , "
"
- , "
"
- , "
"
- , "

"
- , "
"
- , "
"
- , "
"
- , "
"
- ));
-
- fxt.Wiki().File__fsdb_mode().Tid__v2__bld__y_();
- }
private void Tst_img_title(String raw, String expd_ttl) {
String actl = fxt.Exec_parse_page_wiki_as_str(raw);
String actl_ttl = null;
diff --git a/400_xowa/src/gplx/xowa/xtns/imaps/Imap_addon.java b/400_xowa/src/gplx/xowa/xtns/imaps/Imap_addon.java
new file mode 100644
index 000000000..048a520ab
--- /dev/null
+++ b/400_xowa/src/gplx/xowa/xtns/imaps/Imap_addon.java
@@ -0,0 +1,28 @@
+/*
+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.xtns.imaps; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
+import gplx.xowa.addons.*;
+import gplx.xowa.bldrs.wkrs.*;
+import gplx.xowa.xtns.imaps.htmls.*;
+public class Imap_addon implements Xoax_addon_itm, Xoax_addon_itm__init {
+ public void Init_addon_by_app(Xoa_app app) {}
+ public void Init_addon_by_wiki(Xow_wiki wiki) {
+ Imap_desc_hdump_wkr hdump_wkr = new Imap_desc_hdump_wkr(wiki.App().Fsys_mgr());
+ wiki.Html__hdump_mgr().Wkrs().Add(hdump_wkr.Key(), hdump_wkr);
+ }
+
+ public String Addon__key() {return "xowa.imaps";}
+}
diff --git a/400_xowa/src/gplx/xowa/xtns/imaps/Imap_map.java b/400_xowa/src/gplx/xowa/xtns/imaps/Imap_map.java
index deb6a93c2..a0068841f 100644
--- a/400_xowa/src/gplx/xowa/xtns/imaps/Imap_map.java
+++ b/400_xowa/src/gplx/xowa/xtns/imaps/Imap_map.java
@@ -15,7 +15,7 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.xowa.xtns.imaps; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
import gplx.xowa.files.*; import gplx.xowa.guis.cbks.js.*;
-import gplx.xowa.htmls.core.htmls.*; import gplx.xowa.htmls.core.wkrs.imgs.atrs.*; import gplx.xowa.htmls.core.wkrs.lnkis.htmls.*;
+import gplx.langs.htmls.*; import gplx.xowa.htmls.core.htmls.*; import gplx.xowa.htmls.core.wkrs.imgs.atrs.*; import gplx.xowa.htmls.core.wkrs.lnkis.htmls.*;
import gplx.xowa.xtns.imaps.itms.*; import gplx.xowa.xtns.imaps.htmls.*;
public class Imap_map implements Xoh_file_fmtr, Js_img_wkr {
private byte img_cls_tid; private Imap_xtn_mgr xtn_mgr;
@@ -40,30 +40,24 @@ public class Imap_map implements Xoh_file_fmtr, Js_img_wkr {
this.a_href = a_href; this.img_alt = img_alt; this.img_cls_tid = img_cls; this.img_cls_other = img_cls_other;
xfer_itm.Html_img_wkr_(this);
xfer_itm.Html_elem_tid_(Xof_html_elem.Tid_imap);
+
if (hctx.Mode_is_hdump()) {
- if (xfer_itm.Orig_exists()) {
- img_w = xfer_itm.Html_w();
- img_h = xfer_itm.Html_h();
- }
- else {
- img_w = xfer_itm.Lnki_w(); // NOTE: hdump must dump lnki_w, not img_w; GUI will either (a) write -1 and update later thru js_wkr; (b) get correct img_w from cache; hdump can do neither (a) nor (b); DATE:2016-06-17
- img_h = xfer_itm.Lnki_h();
- }
+ img_src = Bry_.Empty; // ISSUE#:553 DATE:2019-09-07
}
- Write_imap_div(tmp_bfr, hctx, uid, img_w, img_h, img_src, xfer_itm.Orig_exists(), xfer_itm.Orig_w(), xfer_itm.Orig_h(), a_xowa_title);
+ Write_imap_div(tmp_bfr, hctx, uid, img_w, img_h, img_src, xfer_itm.Orig_w(), xfer_itm.Orig_h(), a_xowa_title);
}
public void Js_wkr__update_hdoc(Xoa_page page, Xog_js_wkr js_wkr, int html_uid
, int html_w, int html_h, Io_url html_view_url
, int orig_w, int orig_h, Xof_ext orig_ext, Io_url html_orig_url, byte[] lnki_ttl) {
Bry_bfr tmp_bfr = Bry_bfr_.Get();
try {
- Write_imap_div(tmp_bfr, Xoh_wtr_ctx.Basic, html_uid, html_w, html_h, html_view_url.To_http_file_bry(), orig_w > 0, orig_w, orig_h, lnki_ttl);
+ Write_imap_div(tmp_bfr, Xoh_wtr_ctx.Basic, html_uid, html_w, html_h, html_view_url.To_http_file_bry(), orig_w, orig_h, lnki_ttl);
js_wkr.Html_elem_replace_html("imap_div_" + Int_.To_str(html_uid), tmp_bfr.To_str_and_rls());
} finally {tmp_bfr.Mkr_rls();}
}
- private void Write_imap_div(Bry_bfr bfr, Xoh_wtr_ctx hctx, int html_uid, int html_w, int html_h, byte[] img_src, boolean orig_exists, int orig_w, int orig_h, byte[] lnki_ttl) {
+ private void Write_imap_div(Bry_bfr bfr, Xoh_wtr_ctx hctx, int html_uid, int html_w, int html_h, byte[] img_src, int orig_w, int orig_h, byte[] lnki_ttl) {
Imap_map_arg map_arg = new Imap_map_arg(id, shapes, Calc_scale(orig_w, orig_h, html_w, html_h));
- Imap_img_arg img_arg = new Imap_img_arg(hctx, xtn_mgr, this, html_uid, img_alt, img_src, html_w, html_h, Xoh_img_cls_.To_html(img_cls_tid, img_cls_other), a_href, lnki_ttl, orig_exists);
+ Imap_img_arg img_arg = new Imap_img_arg(hctx, xtn_mgr, this, html_uid, img_alt, img_src, html_w, html_h, Xoh_img_cls_.To_html(img_cls_tid, img_cls_other), a_href, lnki_ttl);
Imap_html_fmtrs.All.Bld_bfr_many(bfr, html_uid, Calc_desc_style(desc, html_w, html_h), map_arg, img_arg);
}
private static byte[] Calc_desc_style(Imap_part_desc desc, int html_w, int html_h) {
diff --git a/400_xowa/src/gplx/xowa/xtns/imaps/Imap_parser.java b/400_xowa/src/gplx/xowa/xtns/imaps/Imap_parser.java
index 1a76043da..34f54d32c 100644
--- a/400_xowa/src/gplx/xowa/xtns/imaps/Imap_parser.java
+++ b/400_xowa/src/gplx/xowa/xtns/imaps/Imap_parser.java
@@ -196,7 +196,7 @@ public class Imap_parser {
imap_img = new Imap_part_img(lnki_tkn);
lnki_tkn.Lnki_file_wkr_(imap);
wiki_ctx.Page().Lnki_list().Add(lnki_tkn);
- wiki_ctx.Lnki().File_logger().Log_file(wiki_ctx, lnki_tkn, Xop_file_logger_.Tid__imap); // NOTE: do not do imap_ctx.Lnki(); imap_ctx is brand new
+ wiki_ctx.Lnki().File_logger().Log_file(Xop_file_logger_.Tid__imap, wiki_ctx, lnki_tkn); // NOTE: do not do imap_ctx.Lnki(); imap_ctx is brand new
}
return img_end;
}
diff --git a/400_xowa/src/gplx/xowa/xtns/imaps/Imap_xtn_mgr.java b/400_xowa/src/gplx/xowa/xtns/imaps/Imap_xtn_mgr.java
index 3e7751f87..a343ad0f9 100644
--- a/400_xowa/src/gplx/xowa/xtns/imaps/Imap_xtn_mgr.java
+++ b/400_xowa/src/gplx/xowa/xtns/imaps/Imap_xtn_mgr.java
@@ -15,6 +15,7 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.xowa.xtns.imaps; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
import gplx.core.btries.*; import gplx.xowa.htmls.core.wkrs.lnkis.htmls.*;
+import gplx.xowa.apps.fsys.*;
import gplx.xowa.xtns.imaps.itms.*;
public class Imap_xtn_mgr extends Xox_mgr_base implements Gfo_invk {
private boolean init;
@@ -28,7 +29,7 @@ public class Imap_xtn_mgr extends Xox_mgr_base implements Gfo_invk {
if (desc_trie == null) {
this.desc_trie = Imap_desc_tid.New_trie(wiki);
this.desc_msg = wiki.Msg_mgr().Val_by_key_obj("imagemap_description");
- this.desc_icon_url = wiki.Appe().Fsys_mgr().Bin_xtns_dir().GenSubFil_nest("ImageMap", "imgs", "desc-20.png").To_http_file_bry();
+ this.desc_icon_url = Imap_xtn_mgr.Desc_icon_url(wiki.Appe().Fsys_mgr());
}
return desc_trie;
} private Btrie_slim_mgr desc_trie;
@@ -40,10 +41,11 @@ public class Imap_xtn_mgr extends Xox_mgr_base implements Gfo_invk {
}
@Override public void Xtn_init_by_wiki(Xowe_wiki wiki) {this.wiki = wiki;} private Xowe_wiki wiki;
@Override public Xox_mgr Xtn_clone_new() {return new Imap_xtn_mgr();}
+ public static byte[] Desc_icon_url(Xoa_fsys_mgr fsys_mgr) {return fsys_mgr.Bin_xtns_dir().GenSubFil_nest("ImageMap", "imgs", "desc-20.png").To_http_file_bry();}
public static final byte[]
- Bry__usemap__html = Bry_.new_a7(" usemap=\"#imagemap_1_")
+ Bry__usemap__html = Bry_.new_a7(" usemap=\"#imageMap_1_")
, Bry__usemap__name = Bry_.new_a7("usemap")
- , Bry__usemap__prefix = Bry_.new_a7("#imagemap_1_")
+ , Bry__usemap__prefix = Bry_.new_a7("#imageMap_1_")
;
}
diff --git a/400_xowa/src/gplx/xowa/xtns/imaps/htmls/Imap_desc_hdump_wkr.java b/400_xowa/src/gplx/xowa/xtns/imaps/htmls/Imap_desc_hdump_wkr.java
new file mode 100644
index 000000000..2a319cc23
--- /dev/null
+++ b/400_xowa/src/gplx/xowa/xtns/imaps/htmls/Imap_desc_hdump_wkr.java
@@ -0,0 +1,38 @@
+/*
+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.xtns.imaps.htmls; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.imaps.*;
+import gplx.xowa.apps.fsys.*;
+import gplx.xowa.htmls.hdumps.*; import gplx.xowa.htmls.core.wkrs.*; import gplx.langs.htmls.docs.*; import gplx.langs.htmls.*;
+public class Imap_desc_hdump_wkr implements Xoh_hdump_wkr {
+ private final byte[] desc_icon_url;
+ public Imap_desc_hdump_wkr(Xoa_fsys_mgr fsys_mgr) {
+ this.desc_icon_url = Imap_xtn_mgr.Desc_icon_url(fsys_mgr);
+ }
+ public byte[] Key() {return KEY;}
+ public int Process(Bry_bfr bfr, Xoh_hdoc_ctx hctx, Xoh_hdoc_wkr hdoc_wkr, Gfh_tag_rdr tag_rdr, byte[] src, Gfh_tag tag) {
+ Gfh_atr atr = tag.Atrs__get_by_or_empty(Gfh_atr_.Bry__src);
+ if (atr == Gfh_atr.Noop) {
+ tag_rdr.Err_wkr().Warn("hiero tag missing src; tag=" + tag.To_str());
+ bfr.Add_mid(src, tag.Src_bgn(), tag.Src_end());
+ }
+ else {
+ Xoh_hdump_wkr_utl.Write_tag_with_val_at_atr_bgn(bfr, src, tag, atr, desc_icon_url);
+ }
+ return tag.Src_end();
+ }
+ public static byte[] KEY = Bry_.new_a7("imap-desc-icon");
+ public static byte[] HDUMP_ATR = Xoh_hdump_wkr_utl.Build_hdump_atr(KEY);
+}
diff --git a/400_xowa/src/gplx/xowa/xtns/imaps/htmls/Imap_html__fxt.java b/400_xowa/src/gplx/xowa/xtns/imaps/htmls/Imap_html__fxt.java
new file mode 100644
index 000000000..538e75106
--- /dev/null
+++ b/400_xowa/src/gplx/xowa/xtns/imaps/htmls/Imap_html__fxt.java
@@ -0,0 +1,214 @@
+/*
+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.xtns.imaps.htmls; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.imaps.*;
+import gplx.xowa.files.*; import gplx.xowa.files.caches.*;
+import gplx.xowa.parsers.lnkis.*;
+import gplx.xowa.htmls.core.htmls.*; import gplx.xowa.htmls.core.makes.tests.*;
+import gplx.xowa.langs.msgs.*;
+class Imap_html__fxt {
+ private final Xoh_make_fxt make_fxt = new Xoh_make_fxt();
+ private final Xop_fxt parser_fxt;
+ private boolean hdump;
+ public Imap_html__fxt() {
+ this.parser_fxt = new Xop_fxt();
+ Xol_msg_itm msg = parser_fxt.Wiki().Msg_mgr().Get_or_make(Bry_.new_a7("imagemap_description"));
+ msg.Atrs_set(Bry_.new_a7("click here"), false, false);
+ }
+ public Imap_html__fxt Hdump_n_() {return Hdump_(Bool_.N);}
+ public Imap_html__fxt Hdump_y_() {return Hdump_(Bool_.Y);}
+ private Imap_html__fxt Hdump_(boolean v) {
+ this.hdump = v;
+ return this;
+ }
+ public Xop_fxt Fxt() {return parser_fxt;}
+ public void Test_html_full_str(String raw, String expd) {parser_fxt.Test_html_full_str(raw, expd);}
+ public void Test_html_full_frag(String raw, String expd) {parser_fxt.Test_html_full_frag(raw, expd);}
+ public String Frag_html_full() {
+ return String_.Concat_lines_nl_skip_last
+ ( ""
+ , "
"
+ , "

"
+ , "
"
+ );
+ }
+ public void Test__hview(String wtxt, String expd) {
+ parser_fxt.Hctx_(Xoh_wtr_ctx.Basic);
+ parser_fxt.Test_html_full_str(wtxt, expd);
+ }
+ public void Test__hdump(String wtxt, String save, String load, Xof_fsdb_itm[] fsdb_itms) {
+ parser_fxt.Hctx_(Xoh_wtr_ctx.Hdump);
+ parser_fxt.Test_html_full_str(wtxt, save);
+
+ make_fxt.Init__usr_cache(fsdb_itms);
+ make_fxt.Page_chkr().Clear();
+ for (Xof_fsdb_itm itm : fsdb_itms) {
+ make_fxt.Page_chkr().Imgs__add(String_.new_u8(itm.Lnki_wiki_abrv()), String_.new_u8(itm.Lnki_ttl()), itm.Lnki_type(), itm.Lnki_upright(), itm.Lnki_w(), itm.Lnki_h(), itm.Lnki_time(), itm.Lnki_page());
+ }
+ make_fxt.Test__make(save, make_fxt.Page_chkr().Body_(load));
+ }
+ public Xof_fsdb_itm[] Basic__fsdb() {
+ return new Xof_fsdb_itm[] {make_fxt.Init__fsdb_itm("en.w", "A.png", 123, 0, 123, 100, "mem/wiki/repo/trg/thumb/7/0/A.png/123px.png")};
+ }
+ public String Basic__wtxt() {
+ return String_.Concat_lines_nl_skip_last
+ ( ""
+ , "File:A.png|thumb|123px|a1"
+ , "circle 0 0 5 [[B|b1]]"
+ , "rect 0 0 4 8 [[C|c1]]"
+ , "desc none"
+ , ""
+ );
+ }
+ public String Basic__html(boolean dir_has_value) {
+ int mode = -1;
+ if (hdump) {
+ if (dir_has_value) {
+ mode = Mode__hload;
+ }
+ else {
+ mode = Mode__hsave;
+ }
+ }
+ else {
+ mode = Mode__hview;
+ }
+
+ String div_id = "", div_width = "";
+ String img_id = "", img_data = "", img_src = "", img_width = "", img_height = "";
+ String magnify_id = "";
+
+ switch (mode) {
+ case Mode__hview:
+ div_id = " id=\"xowa_file_div_0\"";
+ div_width = "220"; // NOTE:220px is default w for "non-found" thumb; DATE:2014-09-24
+ img_id = " id=\"xoimg_0\"";
+ img_data = "";
+ img_src = "file:///mem/wiki/repo/trg/thumb/7/0/A.png/123px.png";
+ img_width = "123";
+ img_height = "0";
+ magnify_id = "";
+ break;
+ case Mode__hsave:
+ div_id = "";
+ div_width = "123";
+ img_id = "";
+ img_data = " data-xowa-title=\"A.png\" data-xoimg=\"1|123|0|-1|-1|-1\"";
+ img_src = "";
+ img_width = "0";
+ img_height = "0";
+ magnify_id = "";
+ break;
+ case Mode__hload:
+ div_id = "";
+ div_width = "123";
+ img_id = " id=\"xoimg_0\"";
+ img_data = " data-xowa-title=\"A.png\" data-xoimg=\"1|123|0|-1|-1|-1\"";
+ img_src = "file:///mem/wiki/repo/trg/thumb/7/0/A.png/123px.png";
+ img_width = "123";
+ img_height = "100";
+ magnify_id = " id=\"xolnki_2\"";
+ break;
+ }
+ return String_.Concat_lines_nl_skip_last
+ ( ""
+ , "
"
+ , "
"
+ , "
"
+ , "

"
+ , "
"
+ , "
"
+ , "
"
+ , "
"
+ );
+ }
+ public String Desc__wtxt() {
+ make_fxt.Init__usr_cache(make_fxt.Init__fsdb_itm("en.w", "A.png", 123, 0, 123, 100, "mem/wiki/repo/trg/thumb/7/0/A.png/123px.png"));
+ make_fxt.Page_chkr().Imgs__add("en.w", "A.png", Xop_lnki_type.Id_none, -1, 123, 0, -1, -1);
+ return String_.Concat_lines_nl_skip_last
+ ( ""
+ , "File:A.png|123px|a1"
+ , "desc top-left"
+ , ""
+ );
+ }
+ public String Desc__html(boolean dir_has_value) {
+ int mode = -1;
+ if (hdump) {
+ if (dir_has_value) {
+ mode = Mode__hload;
+ }
+ else {
+ mode = Mode__hsave;
+ }
+ }
+ else {
+ mode = Mode__hview;
+ }
+
+ String img_id = "", img_data = "", img_src = "", img_width = "", img_height = "";
+ String desc_src = "", desc_hdump = "";
+
+ switch (mode) {
+ case Mode__hview:
+ img_id = " id=\"xoimg_0\"";
+ img_data = "";
+ img_src = "file:///mem/wiki/repo/trg/thumb/7/0/A.png/123px.png";
+ img_width = "123";
+ img_height = "0";
+ desc_src = "file:///mem/xowa/bin/any/xowa/xtns/ImageMap/imgs/desc-20.png";
+ desc_hdump = " ";
+ break;
+ case Mode__hsave:
+ img_id = "";
+ img_data = " data-xowa-title=\"A.png\" data-xoimg=\"1|123|0|-1|-1|-1\"";
+ img_src = "";
+ img_width = "0";
+ img_height = "0";
+ desc_src = "";
+ desc_hdump = " data-xowa-hdump='imap-desc-icon'";
+ break;
+ case Mode__hload:
+ img_id = " id=\"xoimg_0\"";
+ img_data = " data-xowa-title=\"A.png\" data-xoimg=\"1|123|0|-1|-1|-1\"";
+ img_src = "file:///mem/wiki/repo/trg/thumb/7/0/A.png/123px.png";
+ img_width = "123";
+ img_height = "100";
+ desc_src = "file:///mem/xowa/bin/any/xowa/xtns/ImageMap/imgs/desc-20.png";
+ desc_hdump = " data-xowa-hdump='imap-desc-icon'";
+ break;
+ }
+
+ return String_.Concat_lines_nl_skip_last
+ ( ""
+ , "
"
+ , "

"
+ , "
"
+ , "
"
+ );
+ }
+ private static final int Mode__hview = 0, Mode__hsave = 1, Mode__hload = 2;
+}
diff --git a/400_xowa/src/gplx/xowa/xtns/imaps/htmls/Imap_html__hdump__tst.java b/400_xowa/src/gplx/xowa/xtns/imaps/htmls/Imap_html__hdump__tst.java
deleted file mode 100644
index ce4bc72f5..000000000
--- a/400_xowa/src/gplx/xowa/xtns/imaps/htmls/Imap_html__hdump__tst.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
-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.xtns.imaps.htmls; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.imaps.*;
-import org.junit.*;
-import gplx.xowa.htmls.core.htmls.*;
-public class Imap_html__hdump__tst {
- @Before public void init() {fxt.Reset(); fxt.Fxt().Hctx_(Xoh_wtr_ctx.Hdump);} private final Imap_xnde_html_fxt fxt = new Imap_xnde_html_fxt();
- @Test public void Basic() {
- fxt.Test_html_full_str(String_.Concat_lines_nl_skip_last
- ( ""
- , "File:A.png|thumb|100x200px|a1"
- , "circle 0 0 5 [[B|b1]]"
- , "rect 0 0 4 8 [[C|c1]]"
- , "desc none"
- , ""
- ), String_.Concat_lines_nl_skip_last
- ( ""
- , "
" // NOTE:220px is default w for "non-found" thumb; DATE:2014-09-24
- , "
"
- , "
"
- , "

"
- , "
"
- , "
"
- , "
"
- , "
"
- ));
- }
-}
diff --git a/400_xowa/src/gplx/xowa/xtns/imaps/htmls/Imap_html__hview__tst.java b/400_xowa/src/gplx/xowa/xtns/imaps/htmls/Imap_html__hview__tst.java
index 69561c2bd..1cb43c98a 100644
--- a/400_xowa/src/gplx/xowa/xtns/imaps/htmls/Imap_html__hview__tst.java
+++ b/400_xowa/src/gplx/xowa/xtns/imaps/htmls/Imap_html__hview__tst.java
@@ -16,31 +16,11 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
package gplx.xowa.xtns.imaps.htmls; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.imaps.*;
import org.junit.*; import gplx.xowa.langs.*; import gplx.xowa.langs.msgs.*;
public class Imap_html__hview__tst {
- @Before public void init() {fxt.Reset();} private final Imap_xnde_html_fxt fxt = new Imap_xnde_html_fxt();
+ private final Imap_html__fxt fxt = new Imap_html__fxt();
@Test public void Basic() {
- fxt.Test_html_full_str(String_.Concat_lines_nl_skip_last
- ( ""
- , "File:A.png|thumb|123px|a1"
- , "circle 0 0 5 [[B|b1]]"
- , "rect 0 0 4 8 [[C|c1]]"
- , "desc none"
- , ""
- ), String_.Concat_lines_nl_skip_last
- ( ""
- , "
" // NOTE:220px is default w for "non-found" thumb; DATE:2014-09-24
- , "
"
- , "
"
- , "

"
- , "
"
- , "
"
- , "
"
- , "
"
- ));
+ String wtxt = fxt.Basic__wtxt();
+ fxt.Test__hview(wtxt, fxt.Hdump_n_().Basic__html(Bool_.Y));
+ fxt.Test__hdump(wtxt, fxt.Hdump_y_().Basic__html(Bool_.N), fxt.Basic__html(Bool_.Y), fxt.Basic__fsdb());
}
@Test public void Caption_xml() { // PURPOSE: xnde in caption was being escaped; PAGE:en.w:Council_of_Europe; DATE:2014-07-25
fxt.Test_html_full_frag("File:A.png|thumb|c\n", "c");
@@ -69,23 +49,9 @@ public class Imap_html__hview__tst {
));
}
@Test public void Desc() {
- fxt.Test_html_full_str(String_.Concat_lines_nl_skip_last
- ( ""
- , "File:A.png|123px|a1"
- , "desc top-left"
- , ""
- ), String_.Concat_lines_nl_skip_last
- ( ""
- , "
"
- , "

"
- , "
"
- , "
"
- ));
+ String wtxt = fxt.Desc__wtxt();
+ fxt.Test__hview(wtxt, fxt.Hdump_n_().Desc__html(Bool_.Y));
+ fxt.Test__hdump(wtxt, fxt.Hdump_y_().Desc__html(Bool_.N), fxt.Desc__html(Bool_.Y), fxt.Basic__fsdb());
}
@Test public void Lnke() { // PURPOSE: handle shapes with lnke; PAGE:en.w:Cholesterolt DATE:2014-07-25
fxt.Test_html_full_str(String_.Concat_lines_nl_skip_last
@@ -185,22 +151,3 @@ public class Imap_html__hview__tst {
), "id=\"cite_ref-0\"");
}
}
-class Imap_xnde_html_fxt {
- public void Reset() {
- fxt.Reset();
- Xol_msg_itm msg = fxt.Wiki().Msg_mgr().Get_or_make(Bry_.new_a7("imagemap_description"));
- msg.Atrs_set(Bry_.new_a7("click here"), false, false);
- }
- public Xop_fxt Fxt() {return fxt;} private final Xop_fxt fxt = new Xop_fxt();
- public void Test_html_full_str(String raw, String expd) {fxt.Test_html_full_str(raw, expd);}
- public void Test_html_full_frag(String raw, String expd) {fxt.Test_html_full_frag(raw, expd);}
- public String Frag_html_full() {
- return String_.Concat_lines_nl_skip_last
- ( ""
- , "
"
- , "

"
- , "
"
- );
- }
-}
diff --git a/400_xowa/src/gplx/xowa/xtns/imaps/htmls/Imap_html_fmtrs.java b/400_xowa/src/gplx/xowa/xtns/imaps/htmls/Imap_html_fmtrs.java
index b41dcec86..31a60b6c9 100644
--- a/400_xowa/src/gplx/xowa/xtns/imaps/htmls/Imap_html_fmtrs.java
+++ b/400_xowa/src/gplx/xowa/xtns/imaps/htmls/Imap_html_fmtrs.java
@@ -55,9 +55,9 @@ public class Imap_html_fmtrs {
( ""
, " "
- ), "margin_left", "margin_top", "img_href", "msg_desc", "icon_url"
+ ), "margin_left", "margin_top", "img_href", "msg_desc", "icon_url", "data_xowa_hdump"
);
}
diff --git a/400_xowa/src/gplx/xowa/xtns/imaps/htmls/Imap_img_arg.java b/400_xowa/src/gplx/xowa/xtns/imaps/htmls/Imap_img_arg.java
index f93615b2a..cbdba64ae 100644
--- a/400_xowa/src/gplx/xowa/xtns/imaps/htmls/Imap_img_arg.java
+++ b/400_xowa/src/gplx/xowa/xtns/imaps/htmls/Imap_img_arg.java
@@ -24,35 +24,28 @@ public class Imap_img_arg implements gplx.core.brys.Bfr_arg {
private final int img_elem_id, img_w, img_h;
private final byte[] img_alt, img_src, img_cls, img_href, lnki_ttl;
private final Int_2_ref margin_calc = new Int_2_ref();
- private final boolean orig_exists;
public Imap_img_arg(Xoh_wtr_ctx hctx, Imap_xtn_mgr xtn_mgr, Imap_map map
- , int img_elem_id, byte[] img_alt, byte[] img_src, int img_w, int img_h, byte[] img_cls, byte[] img_href, byte[] lnki_ttl, boolean orig_exists) {
+ , int img_elem_id, byte[] img_alt, byte[] img_src, int img_w, int img_h, byte[] img_cls, byte[] img_href, byte[] lnki_ttl) {
this.hctx = hctx; this.map = map; this.xtn_mgr = xtn_mgr;
this.img_elem_id = img_elem_id; this.img_w = img_w; this.img_h = img_h;
this.img_alt = img_alt; this.img_src = img_src; this.img_cls = img_cls; this.img_href = img_href;
this.lnki_ttl = lnki_ttl;
- this.orig_exists = orig_exists;
}
public void Bfr_arg__add(Bry_bfr bfr) {
Bry_fmtr fmtr = Imap_html_fmtrs.Img_anchor_none;
byte[] anchor_href = Bry_.Empty, anchor_text = Bry_.Empty;
Imap_part_dflt itm_dflt = map.Dflt();
- if (hctx.Mode_is_hdump()) {
+ byte[] img_href_tmp = img_href;
+ if (hctx.Mode_is_hdump()) {
Bry_bfr tmp_bfr = Bry_bfr_.Get();
try {
byte[] data_xowa_image = Xoh_file_fmtr__hdump.Bld_xowa_image_data(tmp_bfr, Xop_lnki_type.Id_none, img_w, img_h, Xop_lnki_tkn.Upright_null, Xof_lnki_time.Null, Xof_lnki_page.Null);
byte[] data_xowa_title = Gfh_atr_.Make(tmp_bfr, Xoh_img_xoimg_data.Bry__data_xowa_title, lnki_ttl);
byte[] usemap = tmp_bfr.Add(Imap_xtn_mgr.Bry__usemap__html).Add_int_variable(map.Id()).Add_byte_quote().To_bry_and_clear();
int img_w_tmp = img_w; int img_h_tmp = img_h;
- byte[] img_src_tmp = img_src;
- if (orig_exists) {
- data_xowa_image = data_xowa_title = Bry_.Empty;
- }
- else {
- img_w_tmp = img_h_tmp = 0;
- img_src_tmp = Bry_.Empty;
- }
- Xoh_file_fmtr__hdump.Add_anch_n(tmp_bfr, data_xowa_title, data_xowa_image, img_src_tmp, img_w_tmp, img_h_tmp, Xoh_img_cls_.Tid__none, Bry_.Empty, Bry_.Empty, usemap);
+ byte[] img_src_tmp = Bry_.Empty; // ISSUE#:553; DATE:2019-09-25
+ img_w_tmp = img_h_tmp = 0;
+ Xoh_file_fmtr__hdump.Add_anch_n(tmp_bfr, data_xowa_title, data_xowa_image, img_src_tmp, img_w_tmp, img_h_tmp, Xoh_img_cls_.Tid__none, Bry_.Empty, img_alt, usemap);
bfr.Add_byte_nl().Add_byte_repeat(Byte_ascii.Space, 6);
bfr.Add_bfr_and_clear(tmp_bfr);
} finally {tmp_bfr.Mkr_rls();}
@@ -69,8 +62,14 @@ public class Imap_img_arg implements gplx.core.brys.Bfr_arg {
}
Imap_part_desc itm_desc = map.Desc();
if (itm_desc != null) {
+ byte[] desc_icon_url = xtn_mgr.Desc_icon_url();
+ byte[] data_xowa_hdump = Bry_.Empty;
+ if (hctx.Mode_is_hdump()) {// ISSUE#:553 DATE:2019-09-07
+ desc_icon_url = Bry_.Empty;
+ data_xowa_hdump = Imap_desc_hdump_wkr.HDUMP_ATR;
+ }
Imap_desc_tid.Calc_margins(margin_calc, itm_desc.Desc_tid(), img_w, img_h);
- Imap_html_fmtrs.Desc_main.Bld_bfr_many(bfr, margin_calc.Val_0(), margin_calc.Val_1(), img_href, xtn_mgr.Desc_msg(), xtn_mgr.Desc_icon_url());
+ Imap_html_fmtrs.Desc_main.Bld_bfr_many(bfr, margin_calc.Val_0(), margin_calc.Val_1(), img_href_tmp, xtn_mgr.Desc_msg(), desc_icon_url, data_xowa_hdump);
}
}
}