mirror of
https://github.com/gnosygnu/xowa.git
synced 2024-10-27 20:34:16 +00:00
Htxt: Set src_bgn at start of block, not after video element [#369]
This commit is contained in:
parent
790e82ac9e
commit
f40f227454
@ -53,6 +53,8 @@ public class Xoh_img_data implements Xoh_data_itm {
|
|||||||
public boolean Init_by_parse(Xoh_hdoc_wkr hdoc_wkr, Xoh_hdoc_ctx hctx, Gfh_tag_rdr tag_rdr, byte[] src, Gfh_tag anch_head, Gfh_tag unused) {
|
public boolean Init_by_parse(Xoh_hdoc_wkr hdoc_wkr, Xoh_hdoc_ctx hctx, Gfh_tag_rdr tag_rdr, byte[] src, Gfh_tag anch_head, Gfh_tag unused) {
|
||||||
Gfh_tag img_tag = anch_head;
|
Gfh_tag img_tag = anch_head;
|
||||||
Bry_err_wkr err_wkr = tag_rdr.Err_wkr();
|
Bry_err_wkr err_wkr = tag_rdr.Err_wkr();
|
||||||
|
// NOTE: src_bgn must be set at bgn of data; bug wherein it was being set after video / audio tag below; ISSUE#:369; DATE:2019-03-07
|
||||||
|
this.src_bgn = anch_head.Src_bgn(); // <a
|
||||||
this.img_wo_anch = anch_head.Name_id() == Gfh_tag_.Id__img;
|
this.img_wo_anch = anch_head.Name_id() == Gfh_tag_.Id__img;
|
||||||
if (img_wo_anch) {
|
if (img_wo_anch) {
|
||||||
Gfh_atr xowa_title = anch_head.Atrs__get_by_or_empty(Xoh_img_xoimg_data.Bry__data_xowa_title); // data-xowa-title='A.png'
|
Gfh_atr xowa_title = anch_head.Atrs__get_by_or_empty(Xoh_img_xoimg_data.Bry__data_xowa_title); // data-xowa-title='A.png'
|
||||||
@ -65,7 +67,6 @@ public class Xoh_img_data implements Xoh_data_itm {
|
|||||||
tag_rdr.Tag__move_fwd_head(); // next <div>
|
tag_rdr.Tag__move_fwd_head(); // next <div>
|
||||||
anch_head = tag_rdr.Tag__move_fwd_head(); // next <div>
|
anch_head = tag_rdr.Tag__move_fwd_head(); // next <div>
|
||||||
}
|
}
|
||||||
this.src_bgn = anch_head.Src_bgn(); // <a
|
|
||||||
if (!anch_href.Parse(err_wkr, hctx, src, anch_head)) return false; // href='/wiki/File:A.png'
|
if (!anch_href.Parse(err_wkr, hctx, src, anch_head)) return false; // href='/wiki/File:A.png'
|
||||||
if (!anch_cls.Parse(err_wkr, src, anch_head)) return false; // class='image'
|
if (!anch_cls.Parse(err_wkr, src, anch_head)) return false; // class='image'
|
||||||
Gfh_atr anch_title = anch_head.Atrs__get_by_or_empty(Gfh_atr_.Bry__title); // title='abc'
|
Gfh_atr anch_title = anch_head.Atrs__get_by_or_empty(Gfh_atr_.Bry__title); // title='abc'
|
||||||
|
@ -36,6 +36,33 @@ public class Xoh_img_make__dump__tst {
|
|||||||
.Imgs__add("en.w", "A.png", Xop_lnki_type.Id_null, 0.5, 220, 110, -1, -1)
|
.Imgs__add("en.w", "A.png", Xop_lnki_type.Id_null, 0.5, 220, 110, -1, -1)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@Test public void Media_div() {
|
||||||
|
String orig = String_.Concat_lines_nl("<div class='thumb tright'>"
|
||||||
|
, "<div class='thumbinner' style='width:220px;'>"
|
||||||
|
, "<div class='xowa_media_div'>"
|
||||||
|
, "<div><a href='/wiki/File:A.ogv' class='image' title='A.ogv' xowa_title='A.ogv'><img src='file:////home/lnxusr/xowa/file/commons.wikimedia.org/thumb/4/2/8/6/A.ogv/220px.jpg' width='220' height='165' alt=''></a></div>"
|
||||||
|
, "<div><a href='' xowa_title='A.ogv' class='xowa_media_play' style='width:218px;max-width:220px;' alt='Play sound'></a></div>"
|
||||||
|
, "</div>"
|
||||||
|
, "<div class='thumbcaption'>"
|
||||||
|
, "<div class='magnify'><a href='/wiki/File:A.ogv' class='@gplx.Internal protected' title='abcde'></a></div>"
|
||||||
|
, "xyz</div>"
|
||||||
|
, "</div>"
|
||||||
|
, "</div>");
|
||||||
|
String expd = String_.Concat_lines_nl("<div class='thumb tright'>"
|
||||||
|
, "<div class='thumbinner' style='width:220px;'>"
|
||||||
|
, "<div class='xowa_media_div'>"
|
||||||
|
, "<div><a href='/wiki/File:A.ogv' class='image' title='A.ogv' xowa_title='A.ogv'><img id='xoimg_0' src='file:////home/lnxusr/xowa/file/commons.wikimedia.org/thumb/4/2/8/6/A.ogv/220px.jpg' width='220' height='165' alt=''></a></div>"
|
||||||
|
, "<div><a id='xowa_file_play_0' href='' xowa_title='A.ogv' class='xowa_media_play' style='width:218px;max-width:220px;' alt='Play sound'></a></div>"
|
||||||
|
, "</div>"
|
||||||
|
, "<div class='thumbcaption'>"
|
||||||
|
, "<div class='magnify'><a href='/wiki/File:A.ogv' class='@gplx.Internal protected' title='abcde'></a></div>"
|
||||||
|
, "xyz</div>"
|
||||||
|
, "</div>"
|
||||||
|
, "</div>");
|
||||||
|
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)
|
||||||
|
);
|
||||||
|
}
|
||||||
// @Test public void Html_exists__y__cache() {
|
// @Test public void Html_exists__y__cache() {
|
||||||
// String
|
// String
|
||||||
// orig = "<a href='/wiki/File:A.png' class='image' title='abc'><img alt='abc' data-xoimg='0|220|110|0.5|-1|-1' src='file:///mem/xowa/file/en.wikipedia.org/thumb/7/0/A.png/220px.png' width='220' height='110'/></a>"
|
// orig = "<a href='/wiki/File:A.png' class='image' title='abc'><img alt='abc' data-xoimg='0|220|110|0.5|-1|-1' src='file:///mem/xowa/file/en.wikipedia.org/thumb/7/0/A.png/220px.png' width='220' height='110'/></a>"
|
||||||
|
Loading…
Reference in New Issue
Block a user