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,54 +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.addons.wikis.pages.randoms.specials; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.wikis.*; import gplx.xowa.addons.wikis.pages.*; import gplx.xowa.addons.wikis.pages.randoms.*;
|
||||
import org.junit.*; import gplx.xowa.specials.*;
|
||||
public class Rndm_root_special_tst {
|
||||
@Before public void init() {fxt.Clear();} private Rndm_root_special_fxt fxt = new Rndm_root_special_fxt();
|
||||
@Test public void Ns_main() {
|
||||
fxt.Init_create_page("A");
|
||||
fxt.Init_create_page("A/B/C");
|
||||
fxt.Test_open("Special:RandomRootPage/Main", "A"); // NOTE: result will always be "A"; "A" -> "A"; "A/B/C" -> "A"
|
||||
}
|
||||
@Test public void Ns_help() {
|
||||
fxt.Init_create_page("Help:A");
|
||||
fxt.Init_create_page("Help:A/B/C");
|
||||
fxt.Test_open("Special:RandomRootPage/Help", "Help:A");
|
||||
}
|
||||
}
|
||||
class Rndm_root_special_fxt {
|
||||
private Xop_fxt parser_fxt; private Rndm_root_special special_page; private Xowe_wiki wiki;
|
||||
public void Clear() {
|
||||
parser_fxt = new Xop_fxt();
|
||||
parser_fxt.Reset();
|
||||
wiki = parser_fxt.Wiki();
|
||||
special_page = new gplx.xowa.addons.wikis.pages.randoms.specials.Rndm_root_special();
|
||||
}
|
||||
public void Init_create_page(String page) {parser_fxt.Init_page_create(page, page);}
|
||||
public void Test_open(String special_url, String expd) {
|
||||
Xoae_page page = Test_special_open(wiki, special_page, special_url);
|
||||
Tfds.Eq(expd, String_.new_a7(page.Url().Page_bry()));
|
||||
Tfds.Eq(expd, String_.new_a7(page.Db().Text().Text_bry()));
|
||||
}
|
||||
public static Xoae_page Test_special_open(Xowe_wiki wiki, Xow_special_page special_page, String special_url) {
|
||||
Xoae_page page = wiki.Parser_mgr().Ctx().Page();
|
||||
Xoa_url url = wiki.Utl__url_parser().Parse(Bry_.new_u8(special_url));
|
||||
page.Url_(url);
|
||||
Xoa_ttl ttl = Xoa_ttl.Parse(wiki, Bry_.new_a7(special_url));
|
||||
page.Ttl_(ttl);
|
||||
special_page.Special__gen(wiki, page, url, ttl);
|
||||
return page;
|
||||
}
|
||||
}
|
||||
@@ -1,50 +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.addons.wikis.pages.syncs.core.loaders; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.wikis.*; import gplx.xowa.addons.wikis.pages.*; import gplx.xowa.addons.wikis.pages.syncs.*; import gplx.xowa.addons.wikis.pages.syncs.core.*;
|
||||
import gplx.core.tests.*;
|
||||
import gplx.langs.htmls.*; import gplx.xowa.htmls.*;
|
||||
import gplx.xowa.files.*; import gplx.xowa.files.repos.*;
|
||||
import gplx.xowa.addons.wikis.pages.syncs.core.parsers.*;
|
||||
public class Xosync_page_loader__fxt {
|
||||
private final Xosync_page_loader mgr = new Xosync_page_loader();
|
||||
private final Bry_bfr tmp_bfr = Bry_bfr_.New();
|
||||
private final Xoh_page hpg = new Xoh_page();
|
||||
private Xowe_wiki wiki;
|
||||
public void Clear() {
|
||||
Xoae_app app = Xoa_app_fxt.Make__app__edit();
|
||||
this.wiki = Xoa_app_fxt.Make__wiki__edit(app);
|
||||
hpg.Clear();
|
||||
}
|
||||
public Xosync_page_loader__fxt Exec__parse(String raw) {
|
||||
mgr.Parse(wiki, hpg, Bry_.new_u8(raw));
|
||||
return this;
|
||||
}
|
||||
public Xosync_page_loader__fxt Test__html(String expd) {
|
||||
Gftest.Eq__ary__lines(expd, hpg.Db().Html().Html_bry(), "converted html");
|
||||
return this;
|
||||
}
|
||||
public Xof_fsdb_itm Make__fsdb(boolean repo_is_commons, boolean file_is_orig, String file_ttl, String orig_ext_str, int file_w, double file_time, int file_page) {
|
||||
Xof_fsdb_itm itm = new Xof_fsdb_itm();
|
||||
Xof_ext orig_ext = Xof_ext_.new_by_ext_(Bry_.new_u8(orig_ext_str));
|
||||
itm.Init_by_wm_parse(wiki.Domain_itm().Abrv_xo(), repo_is_commons, file_is_orig, Bry_.new_u8(file_ttl), orig_ext, file_w, file_time, file_page);
|
||||
return itm;
|
||||
}
|
||||
public Xosync_page_loader__fxt Test__fsdb(Xof_fsdb_itm expd) {
|
||||
Xof_fsdb_itm actl = (Xof_fsdb_itm)hpg.Img_mgr().Get_at(0);
|
||||
Gftest.Eq__str(Xosync_hdoc_parser__fxt.To_str(tmp_bfr, expd), Xosync_hdoc_parser__fxt.To_str(tmp_bfr, actl));
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,39 +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.addons.wikis.pages.syncs.core.loaders; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.wikis.*; import gplx.xowa.addons.wikis.pages.*; import gplx.xowa.addons.wikis.pages.syncs.*; import gplx.xowa.addons.wikis.pages.syncs.core.*;
|
||||
import org.junit.*;
|
||||
import gplx.langs.htmls.*;
|
||||
public class Xosync_page_loader__tst {
|
||||
@Before public void init() {fxt.Clear();} private final Xosync_page_loader__fxt fxt = new Xosync_page_loader__fxt();
|
||||
@Test public void File() {
|
||||
fxt.Exec__parse(Gfh_utl.Replace_apos("a<img src='xowa:/file/commons.wikimedia.org/thumb/4/a/6/9/Commons-logo.svg/12px.png' width='12' height='20'>b"))
|
||||
.Test__html(Gfh_utl.Replace_apos("a<img id='xoimg_0' src='file:///mem/xowa/file/commons.wikimedia.org/thumb/4/a/6/9/Commons-logo.svg/12px.png' width='12' height='20'>b"))
|
||||
.Test__fsdb(fxt.Make__fsdb(Bool_.Y, Bool_.N, "Commons-logo.svg", "svg", 12, -1, -1))
|
||||
;
|
||||
}
|
||||
@Test public void Math() {
|
||||
fxt.Exec__parse(Gfh_utl.Replace_apos("a<img src='xowa:/math/596f8baf206a81478afd4194b44138715dc1a05c' width='12' height='20'>b"))
|
||||
.Test__html(Gfh_utl.Replace_apos("a<img id='xoimg_0' src='file:///mem/xowa/file/math/596f8baf206a81478afd4194b44138715dc1a05c' width='12' height='20'>b"))
|
||||
.Test__fsdb(fxt.Make__fsdb(Bool_.Y, Bool_.Y, "596f8baf206a81478afd4194b44138715dc1a05c", "svg", -1, -1, -1))
|
||||
;
|
||||
}
|
||||
@Test public void Ogg() {
|
||||
fxt.Exec__parse(Gfh_utl.Replace_apos("a<img src='xowa:/file/commons.wikimedia.org/thumb/4/2/7/e/A.ogg/320px.jpg'>b"))
|
||||
.Test__html(Gfh_utl.Replace_apos("a<img id='xoimg_0' src='file:///mem/xowa/file/commons.wikimedia.org/thumb/4/2/7/e/A.ogg/320px.jpg'>b"))
|
||||
.Test__fsdb(fxt.Make__fsdb(Bool_.Y, Bool_.N, "A.ogg", "ogv", 320, -1, -1))
|
||||
;
|
||||
}
|
||||
}
|
||||
@@ -1,45 +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.addons.wikis.pages.syncs.core.parsers; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.wikis.*; import gplx.xowa.addons.wikis.pages.*; import gplx.xowa.addons.wikis.pages.syncs.*; import gplx.xowa.addons.wikis.pages.syncs.core.*;
|
||||
import org.junit.*;
|
||||
import gplx.langs.htmls.*;
|
||||
public class Xosync_hdoc_parser__err__tst {
|
||||
@Before public void init() {fxt.Clear();} private final Xosync_hdoc_parser__fxt fxt = new Xosync_hdoc_parser__fxt();
|
||||
@Test public void Url_does_not_start_with_upload_wikimedia_org() {
|
||||
fxt.Exec__parse(Gfh_utl.Replace_apos("<img src='//fail/wikipedia/commons/thumb/7/70/A.png/220px-A.png'>"))
|
||||
.Test__html(Gfh_utl.Replace_apos("<!--wm.parse:img src does not start with known sequence--><img src='//fail/wikipedia/commons/thumb/7/70/A.png/220px-A.png'>"));
|
||||
}
|
||||
@Test public void Unknown_repo() {
|
||||
fxt.Exec__parse(Gfh_utl.Replace_apos("<img src='//upload.wikimedia.org/wiktionary/fr/thumb/7/70/A.png/220px-A.png'>"))
|
||||
.Test__html(Gfh_utl.Replace_apos("<!--wm.parse:unknown repo--><img src='//upload.wikimedia.org/wiktionary/fr/thumb/7/70/A.png/220px-A.png'>"));
|
||||
}
|
||||
@Test public void Bad_md5() {
|
||||
fxt.Exec__parse(Gfh_utl.Replace_apos("<img src='//upload.wikimedia.org/wikipedia/commons/thumb/fail/A.png/220px-A.png'>"))
|
||||
.Test__html(Gfh_utl.Replace_apos("<!--wm.parse:invalid md5--><img src='//upload.wikimedia.org/wikipedia/commons/thumb/fail/A.png/220px-A.png'>"));
|
||||
}
|
||||
@Test public void Missing_px() {
|
||||
fxt.Exec__parse(Gfh_utl.Replace_apos("<img src='//upload.wikimedia.org/wikipedia/commons/thumb/7/70/A.png/220-A.png'>"))
|
||||
.Test__html(Gfh_utl.Replace_apos("<!--wm.parse:missing px--><img src='//upload.wikimedia.org/wikipedia/commons/thumb/7/70/A.png/220-A.png'>"));
|
||||
}
|
||||
@Test public void Bad_file_w() {
|
||||
fxt.Exec__parse(Gfh_utl.Replace_apos("<img src='//upload.wikimedia.org/wikipedia/commons/thumb/7/70/A.png/220_fail_px-A.png'>"))
|
||||
.Test__html(Gfh_utl.Replace_apos("<!--wm.parse:invalid file_w--><img src='//upload.wikimedia.org/wikipedia/commons/thumb/7/70/A.png/220_fail_px-A.png'>"));
|
||||
}
|
||||
@Test public void Comment() {
|
||||
fxt.Exec__parse(Gfh_utl.Replace_apos("<i>a<!-- - --></i><b>b</b><i>c</i>"))
|
||||
.Test__html(Gfh_utl.Replace_apos("<i>a</i><b>b</b><i>c</i>"));
|
||||
}
|
||||
}
|
||||
@@ -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.addons.wikis.pages.syncs.core.parsers; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.wikis.*; import gplx.xowa.addons.wikis.pages.*; import gplx.xowa.addons.wikis.pages.syncs.*; import gplx.xowa.addons.wikis.pages.syncs.core.*;
|
||||
import org.junit.*;
|
||||
import gplx.langs.htmls.*;
|
||||
public class Xosync_hdoc_parser__file__tst {
|
||||
@Before public void init() {fxt.Clear();} private final Xosync_hdoc_parser__fxt fxt = new Xosync_hdoc_parser__fxt();
|
||||
@Test public void Commons__thumb() {
|
||||
fxt.Exec__parse(Gfh_utl.Replace_apos("<img src='//upload.wikimedia.org/wikipedia/commons/thumb/7/70/A.png/320px-A.png'>"))
|
||||
.Test__html(Gfh_utl.Replace_apos("<img src='xowa:/file/commons.wikimedia.org/thumb/7/0/1/c/A.png/320px.png'>"))
|
||||
.Test__fsdb(fxt.Make__fsdb(Bool_.Y, Bool_.N, "A.png", 320, -1, -1));
|
||||
}
|
||||
@Test public void Url_encoded() {
|
||||
fxt.Exec__parse(Gfh_utl.Replace_apos("<img src='//upload.wikimedia.org/wikipedia/commons/thumb/9/91/A%2CB.png/320px-A%2CB.png'>"))
|
||||
.Test__html(Gfh_utl.Replace_apos("<img src='xowa:/file/commons.wikimedia.org/thumb/9/1/0/8/A%2CB.png/320px.png'>"))
|
||||
.Test__fsdb(fxt.Make__fsdb(Bool_.Y, Bool_.N, "A,B.png", 320, -1, -1));
|
||||
}
|
||||
@Test public void Local__orig() {
|
||||
fxt.Exec__parse(Gfh_utl.Replace_apos("<img src='//upload.wikimedia.org/wikipedia/en/7/70/A.png'>"))
|
||||
.Test__html(Gfh_utl.Replace_apos("<img src='xowa:/file/en.wikipedia.org/orig/7/0/1/c/A.png'>"))
|
||||
.Test__fsdb(fxt.Make__fsdb(Bool_.N, Bool_.Y, "A.png", -1, -1, -1));
|
||||
}
|
||||
@Test public void Svg() {
|
||||
fxt.Exec__parse(Gfh_utl.Replace_apos("<img src='//upload.wikimedia.org/wikipedia/commons/thumb/7/75/A.svg/12px-A.svg.png'>"))
|
||||
.Test__html(Gfh_utl.Replace_apos("<img src='xowa:/file/commons.wikimedia.org/thumb/7/5/9/a/A.svg/12px.png'>"))
|
||||
.Test__fsdb(fxt.Make__fsdb(Bool_.Y, Bool_.N, "A.svg", 12, -1, -1));
|
||||
}
|
||||
@Test public void Ogg() {
|
||||
fxt.Exec__parse(Gfh_utl.Replace_apos("<img src='//upload.wikimedia.org/wikipedia/commons/thumb/4/42/A.ogg/320px--A.ogg.jpg'>"))
|
||||
.Test__html(Gfh_utl.Replace_apos("<img src='xowa:/file/commons.wikimedia.org/thumb/4/2/7/e/A.ogg/320px.jpg'>"))
|
||||
.Test__fsdb(fxt.Make__fsdb(Bool_.Y, Bool_.N, "A.ogg", "ogv", 320, -1, -1));
|
||||
}
|
||||
@Test public void Ogg__time() {
|
||||
fxt.Exec__parse(Gfh_utl.Replace_apos("<img src='//upload.wikimedia.org/wikipedia/commons/thumb/4/42/A.ogg/320px-seek%3D1.2-A.ogg.jpg'>"))
|
||||
.Test__html(Gfh_utl.Replace_apos("<img src='xowa:/file/commons.wikimedia.org/thumb/4/2/7/e/A.ogg/320px-1.2.jpg'>"))
|
||||
.Test__fsdb(fxt.Make__fsdb(Bool_.Y, Bool_.N, "A.ogg", "ogv", 320, 1.2, -1));
|
||||
}
|
||||
@Test public void Pdf__page() {
|
||||
fxt.Exec__parse(Gfh_utl.Replace_apos("<img src='//upload.wikimedia.org/wikipedia/commons/thumb/7/76/A.djvu/page1-320px-A.djvu.jpg'>"))
|
||||
.Test__html(Gfh_utl.Replace_apos("<img src='xowa:/file/commons.wikimedia.org/thumb/7/6/9/a/A.djvu/320px-1.jpg'>"))
|
||||
.Test__fsdb(fxt.Make__fsdb(Bool_.Y, Bool_.N, "A.djvu", 320, -1, 1));
|
||||
}
|
||||
}
|
||||
@@ -1,69 +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.addons.wikis.pages.syncs.core.parsers; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.wikis.*; import gplx.xowa.addons.wikis.pages.*; import gplx.xowa.addons.wikis.pages.syncs.*; import gplx.xowa.addons.wikis.pages.syncs.core.*;
|
||||
import gplx.core.tests.*;
|
||||
import gplx.langs.htmls.*; import gplx.xowa.htmls.*;
|
||||
import gplx.xowa.files.*; import gplx.xowa.files.repos.*;
|
||||
public class Xosync_hdoc_parser__fxt {
|
||||
private final Xosync_update_mgr mgr = new Xosync_update_mgr();
|
||||
private final Bry_bfr tmp_bfr = Bry_bfr_.New();
|
||||
private final Xoh_page hpg = new Xoh_page();
|
||||
private Xowe_wiki wiki;
|
||||
public void Clear() {
|
||||
Xoae_app app = Xoa_app_fxt.Make__app__edit();
|
||||
this.wiki = Xoa_app_fxt.Make__wiki__edit(app);
|
||||
Xoa_app_fxt.repo2_(app, wiki);
|
||||
mgr.Init_by_app(app);
|
||||
mgr.Init_by_page(wiki, hpg);
|
||||
}
|
||||
public Xosync_hdoc_parser__fxt Exec__parse(String raw) {
|
||||
mgr.Parse(hpg, wiki, Bry_.Empty, Bry_.new_u8(raw));
|
||||
return this;
|
||||
}
|
||||
public Xosync_hdoc_parser__fxt Test__html(String expd) {
|
||||
Gftest.Eq__ary__lines(expd, hpg.Db().Html().Html_bry(), "converted html");
|
||||
return this;
|
||||
}
|
||||
public Xof_fsdb_itm Make__fsdb(boolean repo_is_commons, boolean file_is_orig, String file_ttl, int file_w, double file_time, int file_page) {
|
||||
return Make__fsdb(repo_is_commons, file_is_orig, file_ttl, Xof_ext_.new_by_ttl_(Bry_.new_u8(file_ttl)), file_w, file_time, file_page);
|
||||
}
|
||||
public Xof_fsdb_itm Make__fsdb(boolean repo_is_commons, boolean file_is_orig, String file_ttl, String file_ext, int file_w, double file_time, int file_page) {
|
||||
return Make__fsdb(repo_is_commons, file_is_orig, file_ttl, Xof_ext_.new_by_ext_(Bry_.new_u8(file_ext)), file_w, file_time, file_page);
|
||||
}
|
||||
public Xof_fsdb_itm Make__fsdb(boolean repo_is_commons, boolean file_is_orig, String file_ttl, Xof_ext file_ext, int file_w, double file_time, int file_page) {
|
||||
Xof_fsdb_itm itm = new Xof_fsdb_itm();
|
||||
itm.Init_by_wm_parse(wiki.Domain_itm().Abrv_xo(), repo_is_commons, file_is_orig, Bry_.new_u8(file_ttl), file_ext, file_w, file_time, file_page);
|
||||
return itm;
|
||||
}
|
||||
public Xosync_hdoc_parser__fxt Test__fsdb(Xof_fsdb_itm expd) {
|
||||
Xof_fsdb_itm actl = (Xof_fsdb_itm)hpg.Hdump_mgr().Imgs().Get_at(0);
|
||||
Gftest.Eq__str(To_str(tmp_bfr, expd), To_str(tmp_bfr, actl));
|
||||
return this;
|
||||
}
|
||||
public static String To_str(Bry_bfr tmp_bfr, Xof_fsdb_itm itm) {
|
||||
To_bfr(tmp_bfr, itm);
|
||||
return tmp_bfr.To_str_and_clear();
|
||||
}
|
||||
private static void To_bfr(Bry_bfr bfr, Xof_fsdb_itm itm) {
|
||||
bfr.Add_str_a7(itm.Orig_repo_id() == Xof_repo_tid_.Tid__remote ? "remote" : "local").Add_byte_pipe();
|
||||
bfr.Add_str_a7(itm.File_is_orig() ? "orig" : "thumb").Add_byte_pipe();
|
||||
bfr.Add(itm.Orig_ttl()).Add_byte_pipe();
|
||||
bfr.Add(itm.Orig_ext().Ext()).Add_byte_pipe();
|
||||
bfr.Add_int_variable(itm.File_w()).Add_byte_pipe();
|
||||
bfr.Add_double(itm.Lnki_time()).Add_byte_pipe();
|
||||
bfr.Add_int_variable(itm.Lnki_page()).Add_byte_pipe();
|
||||
}
|
||||
}
|
||||
@@ -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.addons.wikis.pages.syncs.core.parsers; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.wikis.*; import gplx.xowa.addons.wikis.pages.*; import gplx.xowa.addons.wikis.pages.syncs.*; import gplx.xowa.addons.wikis.pages.syncs.core.*;
|
||||
import org.junit.*;
|
||||
import gplx.langs.htmls.*;
|
||||
public class Xosync_hdoc_parser__misc__tst {
|
||||
@Before public void init() {fxt.Clear();} private final Xosync_hdoc_parser__fxt fxt = new Xosync_hdoc_parser__fxt();
|
||||
@Test public void Math() {
|
||||
fxt.Exec__parse(Gfh_utl.Replace_apos("<img src='https://wikimedia.org/api/rest_v1/media/math/render/svg/596f8baf206a81478afd4194b44138715dc1a05c' class='mwe-math-fallback-image-inline' aria-hidden='true' style='vertical-align: -2.005ex; width:16.822ex; height:6.176ex;' alt='R_{H}=a\\left({\\frac {m}{3M}}\\right)^{\\frac {1}{3}}'>"))
|
||||
.Test__html(Gfh_utl.Replace_apos("<img src='xowa:/math/596f8baf206a81478afd4194b44138715dc1a05c.svg' class='mwe-math-fallback-image-inline' aria-hidden='true' style='vertical-align: -2.005ex; width:16.822ex; height:6.176ex;' alt='R_{H}=a\\left({\\frac {m}{3M}}\\right)^{\\frac {1}{3}}'>"))
|
||||
.Test__fsdb(fxt.Make__fsdb(Bool_.Y, Bool_.Y, "596f8baf206a81478afd4194b44138715dc1a05c.svg", -1, -1, -1));
|
||||
}
|
||||
}
|
||||
@@ -1,39 +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.addons.wikis.pages.syncs.core.parsers; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.wikis.*; import gplx.xowa.addons.wikis.pages.*; import gplx.xowa.addons.wikis.pages.syncs.*; import gplx.xowa.addons.wikis.pages.syncs.core.*;
|
||||
import org.junit.*;
|
||||
import gplx.langs.htmls.*;
|
||||
public class Xosync_hdoc_parser__tst {
|
||||
@Before public void init() {fxt.Clear();} private final Xosync_hdoc_parser__fxt fxt = new Xosync_hdoc_parser__fxt();
|
||||
@Test public void Remove_edit() {
|
||||
fxt.Exec__parse(Gfh_utl.Replace_apos_concat_lines
|
||||
( "<h2><span class='mw-headline' id='Section_1'>Section_1</span>"
|
||||
, "<span class='mw-editsection'>"
|
||||
, "<span class='mw-editsection-bracket'>[</span><a href='/w/index.php?title=Page_1&action=edit&section=1' title='Edit section: Section_1'>edit</a>"
|
||||
, "<span class='mw-editsection-bracket'>]</span>"
|
||||
, "</span>"
|
||||
, "</h2>"
|
||||
)).Test__html(Gfh_utl.Replace_apos_concat_lines
|
||||
( "<h2><span class='mw-headline' id='Section_1'>Section_1</span>"
|
||||
, ""
|
||||
, "</h2>"
|
||||
));
|
||||
}
|
||||
// @Test public void Smoke() {
|
||||
// fxt.Exec__parse(Io_mgr.Instance.LoadFilStr("C:\\xowa\\dev\\wm.updater.src.html"));
|
||||
// Io_mgr.Instance.SaveFilBry("C:\\xowa\\dev\\wm.updater.trg.html", fxt.Hdoc().Converted());
|
||||
// }
|
||||
}
|
||||
Reference in New Issue
Block a user