mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
Command-line: Fix curid argument not working 2
This commit is contained in:
@@ -1,72 +0,0 @@
|
||||
/*
|
||||
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.translates; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import org.junit.*;
|
||||
public class Xop_languages_xnde_tst {
|
||||
@Before public void init() {
|
||||
Io_mgr.Instance.InitEngine_mem();
|
||||
fxt.Reset();
|
||||
fxt.Page_ttl_("Help:A");
|
||||
fxt.Init_page_create("Help:A", ""); // create for AllPages
|
||||
} private final Xop_fxt fxt = new Xop_fxt();
|
||||
@Test public void None() {
|
||||
fxt.Test_parse_page_all_str("<languages/>", ""); // empty
|
||||
}
|
||||
@Test public void Many() {
|
||||
fxt.Init_page_create("Help:A/de", "");
|
||||
fxt.Init_page_create("Help:A/en", "");
|
||||
fxt.Init_page_create("Help:A/fr", "");
|
||||
fxt.Test_parse_page_all_str("<languages/>", Many_expd);
|
||||
}
|
||||
@Test public void Many_english_implied() {
|
||||
fxt.Init_page_create("Help:A/de", "");
|
||||
fxt.Init_page_create("Help:A/fr", "");
|
||||
fxt.Test_parse_page_all_str("<languages/>", Many_expd);
|
||||
}
|
||||
@Test public void Current_is_french() {
|
||||
fxt.Init_page_create("Help:A/de", "");
|
||||
fxt.Init_page_create("Help:A/fr", "");
|
||||
fxt.Page_ttl_("Help:A/fr");
|
||||
fxt.Test_parse_page_all_str("<languages/>", String_.Concat_lines_nl
|
||||
( "<table>"
|
||||
, " <tbody>"
|
||||
, " <tr valign=\"top\">"
|
||||
, " <td class=\"mw-pt-languages-label\">Other languages:</td>"
|
||||
, " <td class=\"mw-pt-languages-list\">"
|
||||
, " <a href=\"/wiki/Help:A/de\" title=\"Help:A/de\">Deutsch</a> •"
|
||||
, " <a href=\"/wiki/Help:A\" title=\"Help:A\"><span class=\"mw-pt-languages-ui\">English</span></a> •"
|
||||
, " <a href=\"/wiki/Help:A/fr\" title=\"Help:A/fr\">Français</a> •"
|
||||
, " </td>"
|
||||
, " </tr>"
|
||||
, " </tbody>"
|
||||
, "</table>"
|
||||
));
|
||||
}
|
||||
private static final String Many_expd = String_.Concat_lines_nl
|
||||
( "<table>"
|
||||
, " <tbody>"
|
||||
, " <tr valign=\"top\">"
|
||||
, " <td class=\"mw-pt-languages-label\">Other languages:</td>"
|
||||
, " <td class=\"mw-pt-languages-list\">"
|
||||
, " <a href=\"/wiki/Help:A/de\" title=\"Help:A/de\">Deutsch</a> •"
|
||||
, " <a href=\"/wiki/Help:A\" title=\"Help:A\"><span class=\"mw-pt-languages-ui\">English</span></a> •"
|
||||
, " <a href=\"/wiki/Help:A/fr\" title=\"Help:A/fr\">Français</a> •"
|
||||
, " </td>"
|
||||
, " </tr>"
|
||||
, " </tbody>"
|
||||
, "</table>"
|
||||
);
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
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.translates; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import org.junit.*;
|
||||
public class Xop_mylanguage_page_tst {
|
||||
@Before public void init() {fxt.Clear();} private Xop_mylanguage_page_fxt fxt = new Xop_mylanguage_page_fxt();
|
||||
@Test public void Non_english_exists() {
|
||||
fxt.Init_create_page("Help:A/fr");
|
||||
fxt.Init_cur_lang("fr");
|
||||
fxt.Test_open("Special:MyLanguage/Help:A", "Help:A/fr");
|
||||
}
|
||||
@Test public void English() {
|
||||
fxt.Init_create_page("Help:A");
|
||||
fxt.Init_cur_lang("en");
|
||||
fxt.Test_open("Special:MyLanguage/Help:A", "Help:A");
|
||||
}
|
||||
@Test public void Non_english_absent() {
|
||||
fxt.Init_create_page("Help:A");
|
||||
fxt.Init_cur_lang("fr");
|
||||
fxt.Test_open("Special:MyLanguage/Help:A", "Help:A");
|
||||
}
|
||||
}
|
||||
class Xop_mylanguage_page_fxt {
|
||||
public void Clear() {
|
||||
parser_fxt = new Xop_fxt();
|
||||
parser_fxt.Reset();
|
||||
app = parser_fxt.App();
|
||||
wiki = parser_fxt.Wiki();
|
||||
special_page = wiki.Special_mgr().Page_mylanguage();
|
||||
} private Xop_fxt parser_fxt; private Xoae_app app; private Xop_mylanguage_page special_page; private Xowe_wiki wiki;
|
||||
public void Init_create_page(String page) {parser_fxt.Init_page_create(page, page);}
|
||||
public void Init_cur_lang(String lang) {app.Sys_cfg().Lang_(Bry_.new_a7(lang));}
|
||||
public void Test_open(String link, String expd) {
|
||||
Xoae_page page = parser_fxt.Ctx().Page();
|
||||
Xoa_url url = app.User().Wikii().Utl__url_parser().Parse(Bry_.new_u8(link));
|
||||
page.Url_(url);
|
||||
Xoa_ttl ttl = Xoa_ttl.Parse(wiki, Bry_.new_a7(link));
|
||||
page.Ttl_(ttl);
|
||||
special_page.Special__gen(wiki, page, url, ttl);
|
||||
Tfds.Eq(expd, String_.new_a7(page.Url().Page_bry()));
|
||||
Tfds.Eq(expd, String_.new_a7(page.Db().Text().Text_bry()));
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
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.translates; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import org.junit.*;
|
||||
public class Xop_translate_xnde_tst {
|
||||
@Before public void init() {fxt.Reset();} private final Xop_fxt fxt = new Xop_fxt();
|
||||
@Test public void Basic() {
|
||||
fxt.Test_parse_page_all_str("<translate> ''a'' </translate>", "<i>a</i>"); // NOTE: trim ws
|
||||
}
|
||||
@Test public void Header() {
|
||||
fxt.Test_parse_page_all_str("<translate>==a==</translate>", "<h2>a</h2>\n");
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
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.translates; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import org.junit.*;
|
||||
public class Xop_tvar_lxr_tst {
|
||||
@Before public void init() {fxt.Reset();} private final Xop_fxt fxt = new Xop_fxt();
|
||||
@Test public void Basic() {
|
||||
fxt.Test_parse_page_all_str("<tvar|1>''a''</>", "<i>a</i>");
|
||||
}
|
||||
@Test public void Missing_end() {
|
||||
fxt.Test_parse_page_all_str("<tvar|1>''a''</tvar>", "<tvar|1><i>a</i></tvar>");
|
||||
}
|
||||
@Test public void Templates() {
|
||||
fxt.Init_defn_add("A", "a");
|
||||
fxt.Test_parse_page_all_str("<tvar|1>{{A}}</>", "a");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user