From c3c9d4ad1e2c4bf02139ab7ab8d4dbf1459409a0 Mon Sep 17 00:00:00 2001 From: gnosygnu Date: Fri, 10 Apr 2020 07:53:45 -0400 Subject: [PATCH] Html: Do not add '\n' to media anchor links [#703] --- .../wkrs/lnkis/htmls/Xoh_file_fmtr__basic.java | 2 +- .../lnkis/htmls/Xoh_file_wtr__media__tst.java | 15 +++++---------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/400_xowa/src/gplx/xowa/htmls/core/wkrs/lnkis/htmls/Xoh_file_fmtr__basic.java b/400_xowa/src/gplx/xowa/htmls/core/wkrs/lnkis/htmls/Xoh_file_fmtr__basic.java index b1c4c8763..8c7570abc 100644 --- a/400_xowa/src/gplx/xowa/htmls/core/wkrs/lnkis/htmls/Xoh_file_fmtr__basic.java +++ b/400_xowa/src/gplx/xowa/htmls/core/wkrs/lnkis/htmls/Xoh_file_fmtr__basic.java @@ -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("~{html}\n"); + private final Bry_fmt fmtr_full_media = Bry_fmt.Auto("~{html}"); // changed from '~{html}\n' 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 diff --git a/400_xowa/src/gplx/xowa/htmls/core/wkrs/lnkis/htmls/Xoh_file_wtr__media__tst.java b/400_xowa/src/gplx/xowa/htmls/core/wkrs/lnkis/htmls/Xoh_file_wtr__media__tst.java index eb28734be..e06806553 100644 --- a/400_xowa/src/gplx/xowa/htmls/core/wkrs/lnkis/htmls/Xoh_file_wtr__media__tst.java +++ b/400_xowa/src/gplx/xowa/htmls/core/wkrs/lnkis/htmls/Xoh_file_wtr__media__tst.java @@ -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 - ( "Media:A.png" - , "" + ( "Media:A.png" )); } @Test public void Nested_caption() { // PAGE:en.w:Beethoven; @@ -29,8 +28,7 @@ public class Xoh_file_wtr__media__tst { , "
" , " \"\"" , "
" - , "
b media_caption" - , " c" + , "
b media_caption c" , "
" , "
" , "" @@ -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 - ( "b" - , "" + ( "b" )); } @Test public void Literal() { fxt.Test_parse_page_wiki_str("[[:Media:A.ogg|b]]", String_.Concat_lines_nl_skip_last - ( "b" - , "" + ( "b" )); } @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 - ( "b" - , "" + ( "b" )); 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);