mirror of
https://github.com/gnosygnu/xowa.git
synced 2024-10-27 20:34:16 +00:00
Html: Do not add '\n' to media anchor links [#703]
This commit is contained in:
parent
5a35f3b05b
commit
c3c9d4ad1e
@ -27,7 +27,7 @@ public class Xoh_file_fmtr__basic implements Xoh_file_fmtr {
|
||||
if (mode_is_hdump) a_href = Bry_.Empty;
|
||||
fmtr_full_media.Bld_many(bfr, a_href, a_title, a_html);
|
||||
}
|
||||
private final Bry_fmt fmtr_full_media = Bry_fmt.Auto("<a href=\"~{a_href}\" xowa_title=\"~{a_xowa_title}\">~{html}\n</a>");
|
||||
private final Bry_fmt fmtr_full_media = Bry_fmt.Auto("<a href=\"~{a_href}\" xowa_title=\"~{a_xowa_title}\">~{html}</a>"); // changed from '~{html}\n</a>' due to extra whitespace; ISSUE#:703; PAGE:en.w:Poland; DATE:2020-04-10
|
||||
|
||||
@gplx.Virtual public void Add_full_img(Bry_bfr bfr, Xoh_wtr_ctx hctx, Xoae_page page, byte[] src, Xof_file_itm xfer_itm, int uid
|
||||
, byte[] a_href, boolean a_href_is_file, byte a_cls, byte a_rel, byte[] a_title, byte[] a_xowa_title
|
||||
|
@ -19,8 +19,7 @@ public class Xoh_file_wtr__media__tst {
|
||||
@Before public void init() {fxt.Reset();} private final Xop_fxt fxt = new Xop_fxt();
|
||||
@Test public void Page_only() { // if no caption, then use page name; DATE:2017-05-20
|
||||
fxt.Test_parse_page_wiki_str("[[Media:A.png]]", String_.Concat_lines_nl_skip_last
|
||||
( "<a href=\"file:///mem/wiki/repo/trg/orig/7/0/A.png\" xowa_title=\"A.png\">Media:A.png"
|
||||
, "</a>"
|
||||
( "<a href=\"file:///mem/wiki/repo/trg/orig/7/0/A.png\" xowa_title=\"A.png\">Media:A.png</a>"
|
||||
));
|
||||
}
|
||||
@Test public void Nested_caption() { // PAGE:en.w:Beethoven;
|
||||
@ -29,8 +28,7 @@ public class Xoh_file_wtr__media__tst {
|
||||
, " <div id=\"xowa_file_div_0\" class=\"thumbinner\" style=\"width:220px;\">"
|
||||
, " <a href=\"/wiki/File:A.png\" class=\"image\" xowa_title=\"A.png\"><img id=\"xoimg_0\" alt=\"\" src=\"file:///mem/wiki/repo/trg/thumb/7/0/A.png/220px.png\" width=\"0\" height=\"0\" /></a>"
|
||||
, " <div class=\"thumbcaption\">"
|
||||
, "<div class=\"magnify\"><a href=\"/wiki/File:A.png\" class=\"internal\" title=\"Enlarge\"></a></div>b <a href=\"file:///mem/wiki/repo/trg/orig/4/2/A.ogg\" xowa_title=\"A.ogg\">media_caption"
|
||||
, "</a> c"
|
||||
, "<div class=\"magnify\"><a href=\"/wiki/File:A.png\" class=\"internal\" title=\"Enlarge\"></a></div>b <a href=\"file:///mem/wiki/repo/trg/orig/4/2/A.ogg\" xowa_title=\"A.ogg\">media_caption</a> c"
|
||||
, " </div>"
|
||||
, " </div>"
|
||||
, "</div>"
|
||||
@ -39,21 +37,18 @@ public class Xoh_file_wtr__media__tst {
|
||||
}
|
||||
@Test public void Caption() {
|
||||
fxt.Test_parse_page_wiki_str("[[Media:A.png|b]]", String_.Concat_lines_nl_skip_last
|
||||
( "<a href=\"file:///mem/wiki/repo/trg/orig/7/0/A.png\" xowa_title=\"A.png\">b"
|
||||
, "</a>"
|
||||
( "<a href=\"file:///mem/wiki/repo/trg/orig/7/0/A.png\" xowa_title=\"A.png\">b</a>"
|
||||
));
|
||||
}
|
||||
@Test public void Literal() {
|
||||
fxt.Test_parse_page_wiki_str("[[:Media:A.ogg|b]]", String_.Concat_lines_nl_skip_last
|
||||
( "<a href=\"file:///mem/wiki/repo/trg/orig/4/2/A.ogg\" xowa_title=\"A.ogg\">b"
|
||||
, "</a>"
|
||||
( "<a href=\"file:///mem/wiki/repo/trg/orig/4/2/A.ogg\" xowa_title=\"A.ogg\">b</a>"
|
||||
));
|
||||
}
|
||||
@Test public void Literal_w_missing() {
|
||||
fxt.Wiki().Html_mgr().Img_suppress_missing_src_(true); // simulate missing file; DATE:2014-01-30
|
||||
fxt.Test_parse_page_wiki_str("[[Media:A.pdf|b]]", String_.Concat_lines_nl_skip_last
|
||||
( "<a href=\"file:///mem/wiki/repo/trg/orig/e/f/A.pdf\" xowa_title=\"A.pdf\">b"
|
||||
, "</a>"
|
||||
( "<a href=\"file:///mem/wiki/repo/trg/orig/e/f/A.pdf\" xowa_title=\"A.pdf\">b</a>"
|
||||
));
|
||||
Tfds.Eq(0, fxt.Page().File_queue().Count()); // make sure media does not add to queue
|
||||
fxt.Wiki().Html_mgr().Img_suppress_missing_src_(false);
|
||||
|
Loading…
Reference in New Issue
Block a user