From ab4cbbd3c1428bb6d3d83d3e0c1976ef67046c45 Mon Sep 17 00:00:00 2001 From: gnosygnu Date: Wed, 20 Mar 2019 02:58:37 -0400 Subject: [PATCH] Htxt: Do not redlink interwiki links [#391] --- .../htmls/core/wkrs/Xoh_hdoc_wkr__make.java | 4 +-- .../wkrs/lnkis/Xoh_lnki_make__basic__tst.java | 36 +++++++++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 400_xowa/src/gplx/xowa/htmls/core/wkrs/lnkis/Xoh_lnki_make__basic__tst.java diff --git a/400_xowa/src/gplx/xowa/htmls/core/wkrs/Xoh_hdoc_wkr__make.java b/400_xowa/src/gplx/xowa/htmls/core/wkrs/Xoh_hdoc_wkr__make.java index 6ada1f788..384aa51a5 100644 --- a/400_xowa/src/gplx/xowa/htmls/core/wkrs/Xoh_hdoc_wkr__make.java +++ b/400_xowa/src/gplx/xowa/htmls/core/wkrs/Xoh_hdoc_wkr__make.java @@ -49,8 +49,8 @@ public class Xoh_hdoc_wkr__make implements Xoh_hdoc_wkr { } public void On_lnki(gplx.xowa.htmls.core.wkrs.lnkis.Xoh_lnki_data data) { // node - // handle "#" - if (data.Href_itm().Tid() == Xoh_anch_href_data.Tid__anch) { + // if not "/wiki/" link, just add html and exit; ISSUE#:391; DATE:2019-03-20 + if (data.Href_itm().Tid() != Xoh_anch_href_data.Tid__wiki) { bfr.Add_mid(src, data.Src_bgn(), data.Src_end()); return; } diff --git a/400_xowa/src/gplx/xowa/htmls/core/wkrs/lnkis/Xoh_lnki_make__basic__tst.java b/400_xowa/src/gplx/xowa/htmls/core/wkrs/lnkis/Xoh_lnki_make__basic__tst.java new file mode 100644 index 000000000..259f11f57 --- /dev/null +++ b/400_xowa/src/gplx/xowa/htmls/core/wkrs/lnkis/Xoh_lnki_make__basic__tst.java @@ -0,0 +1,36 @@ +/* +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.htmls.core.wkrs.lnkis; import gplx.*; import gplx.xowa.*; import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.*; import gplx.xowa.htmls.core.wkrs.*; +import org.junit.*; import gplx.xowa.htmls.core.makes.tests.*; import gplx.xowa.parsers.lnkis.*; +public class Xoh_lnki_make__basic__tst { + private final Xoh_make_fxt fxt = new Xoh_make_fxt(); + @Before public void Init() {fxt.Clear();} + @Test public void Wiki() { + fxt.Test__make("Help:A", fxt.Page_chkr().Body_("Help:A")); + } + @Test public void Anch() { + String orig = "#a"; + fxt.Test__make(orig, fxt.Page_chkr().Body_(orig)); + } + @Test public void Site() { + String orig = "wikt:A"; + fxt.Test__make(orig, fxt.Page_chkr().Body_(orig)); + } + @Test public void Inet() { + String orig = "b"; + fxt.Test__make(orig, fxt.Page_chkr().Body_(orig)); + } +}