Score: Check for missing src for score generated images [#577]

pull/620/head
gnosygnu 5 years ago
parent 1bffdadbaf
commit fca507568f

@ -114,6 +114,7 @@ public class Byte_ascii {
, Lt_bry = new byte[] {Byte_ascii.Lt}
, Gt_bry = new byte[] {Byte_ascii.Gt}
, Question_bry = new byte[] {Byte_ascii.Question}
, Backslash_bry = new byte[] {Byte_ascii.Backslash}
, Brack_bgn_bry = new byte[] {Byte_ascii.Brack_bgn}
, Brack_end_bry = new byte[] {Byte_ascii.Brack_end}
, Apos_bry = new byte[] {Byte_ascii.Apos}

@ -100,7 +100,7 @@ public class Xow_hdump_mgr__load implements Gfo_invk {
}
return src;
}
private void Fill_page(Xoae_page wpg, Xoh_page hpg) {
public void Fill_page(Xoae_page wpg, Xoh_page hpg) {
Xopg_html_data html_data = wpg.Html_data();
html_data.Display_ttl_(tmp_hpg.Display_ttl());
html_data.Content_sub_(tmp_hpg.Content_sub());
@ -127,8 +127,9 @@ public class Xow_hdump_mgr__load implements Gfo_invk {
int len = src_imgs.Len();
for (int i = 0; i < len; ++i) {
gplx.xowa.files.Xof_fsdb_itm itm = src_imgs.Get_at(i);
if (itm.Orig_ttl() == null) continue; // skip any images without a src; occurs for <score> when lilypond not available; ISSUE#:577 DATE:2019-09-30
wpg.Hdump_mgr().Imgs().Add(itm);
if (!Io_mgr.Instance.ExistsFil(itm.Html_view_url())) // if exists, don't add to file_queue; needed for packed; PAGE:en.w:Mexico; DATE:2016-08-14
if (!Io_mgr.Instance.ExistsFil(itm.Html_view_url()))// if exists, don't add to file_queue; needed for packed; PAGE:en.w:Mexico; DATE:2016-08-14
wpg.File_queue().Add(itm); // add to file_queue for http_server
}

@ -22,6 +22,7 @@ public class Xoh_make_fxt {
private final Xowe_wiki wiki;
private final Xoh_make_mgr make_mgr;
private final Gfo_test_list_base expd_redlinks = new Gfo_test_list_base();
private Xoh_page actl;
public Xoh_make_fxt() {
// set member reference
this.wiki = parser_fxt.Wiki();
@ -75,7 +76,7 @@ public class Xoh_make_fxt {
html = String_.Replace(html, "'", "\"");
// init hpg
Xoh_page actl = new Xoh_page();
actl = new Xoh_page();
actl.Ctor_by_hview(parser_fxt.Wiki(), Xoa_url.blank(), parser_fxt.Wiki().Ttl_parse(Xoa_page_.Main_page_bry), 1);
// run make
@ -92,4 +93,7 @@ public class Xoh_make_fxt {
// check redlinks
expd_redlinks.Test(wiki.Html__hdump_mgr().Load_mgr().Make_mgr().Hctx().Page().Html_data().Redlink_list());
}
public void Exec__Fill_page() {
wiki.Html__hdump_mgr().Load_mgr().Fill_page(parser_fxt.Page(), actl);
}
}

@ -0,0 +1,64 @@
/*
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.scores; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
import gplx.xowa.htmls.core.htmls.*; import gplx.xowa.htmls.core.makes.tests.*;
class Score_html_fxt {
private final Xoh_make_fxt make_fxt = new Xoh_make_fxt();
private final Xop_fxt parser_fxt = new Xop_fxt();
private boolean hdump = false;
public void Clear() {
parser_fxt.Reset();
make_fxt.Clear();
}
public Score_html_fxt Hdump_n_() {return Hdump_(Bool_.N);}
public Score_html_fxt Hdump_y_() {return Hdump_(Bool_.Y);}
private Score_html_fxt Hdump_(boolean v) {
this.hdump = v;
return this;
}
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) {
parser_fxt.Hctx_(Xoh_wtr_ctx.Hdump);
parser_fxt.Test_html_full_str(wtxt, save);
make_fxt.Test__make(save, make_fxt.Page_chkr().Body_(load));
}
public void Exec__Fill_page() {
make_fxt.Exec__Fill_page();
}
public String Basic__wtxt() {
return "<score>\\relative c' { f d f a d f e d cis a cis e a g f e }</score>";
}
public String Basic__html(boolean dir_has_value) {
String img_id = hdump && dir_has_value ? "xoimg_0" : "xowa_score_0_img";
String img_atrs = hdump && dir_has_value ? " alt=\"\"" : " src=\"\" ";
return String_.Concat_lines_nl
( ""
, "<div id=\"xowa_score_0_pre\" class=\"xowa-score-lilypond\">"
, " <pre style=\"overflow:auto\">\\relative c&#39; { f d f a d f e d cis a cis e a g f e }"
, "</pre>"
, "</div>"
, ""
, "<p>"
, " <a id=\"xowa_score_0_a\" href=\"\" xowa_title=\"\">"
, " <img id=\"" + img_id + "\"" + img_atrs + "/>"
, " </a>"
, "</p>"
);
}
}

@ -0,0 +1,29 @@
/*
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.scores; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
import org.junit.*;
public class Score_html_tst {
private final Score_html_fxt fxt = new Score_html_fxt();
@Before public void init() {
fxt.Clear();
}
@Test public void Basic() {
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.Exec__Fill_page();
}
}
Loading…
Cancel
Save