mirror of https://github.com/gnosygnu/xowa
RandomRootPage: Do not fail to find page for some random selections; also, do not show 'Redirected from redirected_title' [#719]
parent
a6331f5c89
commit
a2fe75f402
@ -0,0 +1,20 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2020 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.dbs.wkrs;
|
||||
|
||||
public interface SqlWkr {
|
||||
String Key();
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2020 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.dbs.wkrs;
|
||||
|
||||
import gplx.dbs.Db_conn;
|
||||
import gplx.dbs.wkrs.randoms.SqlRandomWkr;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class SqlWkrMgr {
|
||||
private final Map<String, SqlWkr> map = new HashMap<>();
|
||||
private final Db_conn conn;
|
||||
public SqlWkrMgr(Db_conn conn) {
|
||||
this.conn = conn;
|
||||
}
|
||||
public SqlWkr Get(String key) {
|
||||
return map.get(key);
|
||||
}
|
||||
public void Set(SqlWkr wkr) {
|
||||
map.put(wkr.Key(), wkr);
|
||||
}
|
||||
|
||||
public Object ExecRandomObj(String select, String from, String where) {
|
||||
SqlRandomWkr wkr = (SqlRandomWkr)map.get(SqlWkrMgr.WKR_RANDOM);
|
||||
return wkr.SelectRandomRow(conn, select, from, where)[0];
|
||||
}
|
||||
|
||||
public static final String WKR_RANDOM = "random";
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2020 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.dbs.wkrs.randoms;
|
||||
|
||||
import gplx.dbs.Db_conn;
|
||||
import gplx.dbs.wkrs.SqlWkr;
|
||||
|
||||
public interface SqlRandomWkr extends SqlWkr {
|
||||
Object[] SelectRandomRow(Db_conn conn, String select, String from, String where);
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2020 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.dbs.wkrs.randoms;
|
||||
|
||||
import gplx.RandomAdp_;
|
||||
import gplx.dbs.Db_conn;
|
||||
import gplx.dbs.Db_rdr;
|
||||
import gplx.dbs.Db_rdr_;
|
||||
import gplx.dbs.wkrs.SqlWkrMgr;
|
||||
|
||||
public class SqliteRandomWkr implements SqlRandomWkr {
|
||||
@Override public String Key() {return SqlWkrMgr.WKR_RANDOM;}
|
||||
|
||||
// NOTE: selects only 1 random row to simplify method signature
|
||||
// * uses COUNT, LIMIT, OFFSET, so should also work for MySQL
|
||||
// * to return many rows, look at https://stackoverflow.com/questions/4114940/select-random-rows-in-sqlite
|
||||
// EX: SELECT * FROM table WHERE id IN (SELECT id FROM table ORDER BY RANDOM() LIMIT x)
|
||||
// Also, note that SQLite does not support TYPE_FORWARD_ONLY so can't jump back and forth thru ResultSet
|
||||
@Override public Object[] SelectRandomRow(Db_conn conn, String select, String from, String where) {
|
||||
Db_rdr rdr = Db_rdr_.Empty;
|
||||
try {
|
||||
String sqlSuffix = ("FROM " + from + " WHERE " + where);
|
||||
|
||||
// get rowCount of resultSet
|
||||
rdr = conn.Stmt_sql("SELECT COUNT(*) AS RowCount " + sqlSuffix).Exec_select__rls_auto();
|
||||
int rowCount = rdr.Read_int("RowCount");
|
||||
|
||||
// get random row
|
||||
int random = RandomAdp_.new_().Next(rowCount);
|
||||
rdr = conn.Stmt_sql("SELECT " + select + " " + sqlSuffix + " LIMIT 1 OFFSET " + random).Exec_select__rls_auto();
|
||||
|
||||
// return result
|
||||
int fldsLen = rdr.Fld_len();
|
||||
Object[] rv = new Object[fldsLen];
|
||||
for (int i = 0; i < fldsLen; i++) {
|
||||
rv[i] = rdr.Read_at(i);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
catch (Exception exc) { // for debugging; should log
|
||||
throw exc;
|
||||
}
|
||||
finally {
|
||||
rdr.Rls();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2020 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.dbs.wkrs.randoms;
|
||||
|
||||
import gplx.dbs.Db_conn;
|
||||
import gplx.dbs.wkrs.SqlWkrMgr;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TestRandomWkr implements SqlRandomWkr {
|
||||
private final List<Object[]> list = new ArrayList<>();
|
||||
private int index = 0;
|
||||
public void AddRow(Object... ary) {
|
||||
list.add(ary);
|
||||
}
|
||||
public void Clear() {
|
||||
list.clear();
|
||||
index = 0;
|
||||
}
|
||||
public String SelectRandomRowSelect() {return selectRandomRowSelect;} private String selectRandomRowSelect;
|
||||
public String SelectRandomRowFrom() {return selectRandomRowFrom;} private String selectRandomRowFrom;
|
||||
public String SelectRandomRowWhere() {return selectRandomRowWhere;} private String selectRandomRowWhere;
|
||||
|
||||
@Override public String Key() {return SqlWkrMgr.WKR_RANDOM;}
|
||||
@Override public Object[] SelectRandomRow(Db_conn conn, String select, String from, String where) {
|
||||
this.selectRandomRowSelect = select;
|
||||
this.selectRandomRowFrom = from;
|
||||
this.selectRandomRowWhere = where;
|
||||
return list.get(index++);
|
||||
}
|
||||
|
||||
public static TestRandomWkr New(Db_conn conn) {
|
||||
TestRandomWkr wkr = new TestRandomWkr();
|
||||
conn.WkrMgr().Set(wkr);
|
||||
return wkr;
|
||||
}
|
||||
}
|
@ -1,33 +1,66 @@
|
||||
/*
|
||||
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 gplx.xowa.wikis.nss.*; import gplx.xowa.specials.*;
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2020 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.Bry_;
|
||||
import gplx.String_;
|
||||
import gplx.xowa.Xoa_page;
|
||||
import gplx.xowa.Xoa_ttl;
|
||||
import gplx.xowa.Xoa_url;
|
||||
import gplx.xowa.Xoae_page;
|
||||
import gplx.xowa.Xow_wiki;
|
||||
import gplx.xowa.Xowe_wiki;
|
||||
import gplx.xowa.specials.Xow_special_meta;
|
||||
import gplx.xowa.specials.Xow_special_meta_;
|
||||
import gplx.xowa.specials.Xow_special_page;
|
||||
import gplx.xowa.wikis.data.tbls.Xowd_page_tbl;
|
||||
import gplx.xowa.wikis.nss.Xow_ns;
|
||||
|
||||
public class Rndm_root_special implements Xow_special_page {
|
||||
public void Special__gen(Xow_wiki wikii, Xoa_page pagei, Xoa_url url, Xoa_ttl ttl) {
|
||||
@Override public Xow_special_meta Special__meta() {return new Xow_special_meta(Xow_special_meta_.Src__mw, SPECIAL_KEY);}
|
||||
@Override public Xow_special_page Special__clone() {return this;}
|
||||
@Override public void Special__gen(Xow_wiki wikii, Xoa_page pagei, Xoa_url url, Xoa_ttl ttl) {
|
||||
// get ns
|
||||
Xowe_wiki wiki = (Xowe_wiki)wikii; Xoae_page page = (Xoae_page)pagei;
|
||||
Xow_ns ns = wiki.Ns_mgr().Names_get_or_main(ttl.Rest_txt());
|
||||
// Rndm_addon.Get(wiki).Mgr().Regy().Get_rndm_page_by_ns(ns);
|
||||
byte[] random_ttl_bry = wiki.Db_mgr().Load_mgr().Find_random_ttl(ns);
|
||||
byte[] root_bry = Xoa_ttl.Parse(wiki, random_ttl_bry).Root_txt();
|
||||
wiki.Data_mgr().Redirect(page, ns.Gen_ttl(root_bry));
|
||||
|
||||
// get random ttl
|
||||
String randomTitleString = selectRandomTitle(wiki, ns.Id());
|
||||
wiki.Data_mgr().RedirectWithoutLoading(page, ns.Gen_ttl(Bry_.new_u8(randomTitleString)));
|
||||
}
|
||||
|
||||
private String selectRandomTitle(Xow_wiki wiki, int ns_id) {
|
||||
// ISSUE#:719; find pages without "/" and not redirect
|
||||
// REF.MW:https://github.com/wikimedia/mediawiki/blob/master/includes/specials/SpecialRandomrootpage.php
|
||||
Xowd_page_tbl pageTbl = wiki.Data__core_mgr().Db__core().Tbl__page();
|
||||
String where = String_.Format
|
||||
("p.{0} = {1} AND p.{2} = {3} AND p.{4} NOT LIKE '%/%'"
|
||||
, pageTbl.Fld_page_ns(), ns_id
|
||||
, pageTbl.Fld_redirect_id(), Xowd_page_tbl.INVALID_PAGE_ID
|
||||
, pageTbl.Fld_page_title()
|
||||
);
|
||||
|
||||
return (String)pageTbl.Conn().WkrMgr().ExecRandomObj
|
||||
( pageTbl.Fld_page_title()
|
||||
, pageTbl.Tbl_name() + " p"
|
||||
, where
|
||||
);
|
||||
}
|
||||
|
||||
public static final String SPECIAL_KEY = "RandomRootPage";
|
||||
public static final byte[] Display_ttl = Bry_.new_a7("Random Root Page");
|
||||
public Xow_special_meta Special__meta() {return new Xow_special_meta(Xow_special_meta_.Src__mw, SPECIAL_KEY);}
|
||||
public static final Xow_special_page Prototype = new Rndm_root_special();
|
||||
public Xow_special_page Special__clone() {return this;}
|
||||
public static final byte[] Display_ttl = Bry_.new_a7("Random Root Page");
|
||||
public static final Xow_special_page Prototype = new Rndm_root_special();
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2020 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.Bry_;
|
||||
import gplx.String_;
|
||||
import gplx.core.tests.Gftest;
|
||||
import gplx.dbs.wkrs.randoms.TestRandomWkr;
|
||||
import gplx.xowa.Xoa_app_fxt;
|
||||
import gplx.xowa.Xoa_test_;
|
||||
import gplx.xowa.Xoa_ttl;
|
||||
import gplx.xowa.Xoa_url;
|
||||
import gplx.xowa.Xoae_app;
|
||||
import gplx.xowa.Xoae_page;
|
||||
import gplx.xowa.Xop_fxt;
|
||||
import gplx.xowa.Xowe_wiki;
|
||||
import gplx.xowa.specials.Xow_special_page;
|
||||
import gplx.xowa.wikis.nss.Xow_ns_;
|
||||
import org.junit.Test;
|
||||
|
||||
public class Rndm_root_specialTest {
|
||||
private final RandomRootTstr tstr = new RandomRootTstr();
|
||||
@Test public void NsMain() {
|
||||
tstr.InitCreatePage("A", "A/B/C");
|
||||
tstr.Test("Special:RandomRootPage/Main", Xow_ns_.Tid__main, "A"); // NOTE: will always be rootPage; EX: "A" -> "A"; "A/B/C" -> "A"
|
||||
}
|
||||
@Test public void NsHelp() {
|
||||
tstr.InitCreatePage("Help:A", "Help:A/B/C");
|
||||
tstr.Test("Special:RandomRootPage/Help", Xow_ns_.Tid__help, "Help:A");
|
||||
}
|
||||
}
|
||||
class RandomRootTstr {
|
||||
private Xowe_wiki wiki;
|
||||
private Xop_fxt parserTstr;
|
||||
private TestRandomWkr testRandomWkr;
|
||||
public RandomRootTstr() {
|
||||
// init db-aware wiki
|
||||
Xoae_app app = Xoa_app_fxt.Make__app__edit();
|
||||
this.wiki = Xoa_app_fxt.Make__wiki__edit(app);
|
||||
Xoa_test_.Init__db__edit(wiki);
|
||||
wiki.Data__core_mgr().Db__text().Tbl__text().Create_tbl(); // NOTE: need to call text.Create_tbl b/c Init__db__edit does not create it
|
||||
|
||||
// init parserTstr
|
||||
this.parserTstr = new Xop_fxt(app, wiki);
|
||||
|
||||
// init testRandomWkr
|
||||
this.testRandomWkr = TestRandomWkr.New(wiki.Data__core_mgr().Db__core().Conn());
|
||||
}
|
||||
public void InitCreatePage(String... ary) {
|
||||
for (String page : ary) {
|
||||
parserTstr.Init_page_create(page, page);
|
||||
|
||||
// add ttl.Root to the testRandomWkr
|
||||
Xoa_ttl pageTtl = wiki.Ttl_parse(Bry_.new_u8(page));
|
||||
testRandomWkr.AddRow(String_.new_u8(pageTtl.Root_txt()));
|
||||
}
|
||||
}
|
||||
public void Test(String special_url, int expd_ns, String expd) {
|
||||
// call Special:RandomRoot
|
||||
Rndm_root_special special_page = new gplx.xowa.addons.wikis.pages.randoms.specials.Rndm_root_special();
|
||||
Xoae_page page = Test_special_open(wiki, special_page, special_url);
|
||||
|
||||
// test sql
|
||||
Gftest.Eq__str("page_title", testRandomWkr.SelectRandomRowSelect());
|
||||
Gftest.Eq__str("page p", testRandomWkr.SelectRandomRowFrom());
|
||||
Gftest.Eq__str("p.page_namespace = " + expd_ns + " AND p.page_redirect_id = -1 AND p.page_title NOT LIKE '%/%'", testRandomWkr.SelectRandomRowWhere());
|
||||
|
||||
// test page
|
||||
Gftest.Eq__str(expd, page.Url().Page_bry());
|
||||
Gftest.Eq__str("", page.Db().Text().Text_bry()); // ISSUE#:719:redirect should not load page else redirect info will get lost; EX:"Redirected from trg_ttl" instead of "Redirected from src_ttl"; PAGE:en.s; DATE:2020-05-13
|
||||
}
|
||||
public static Xoae_page Test_special_open(Xowe_wiki wiki, Xow_special_page special_page, String special_url) {
|
||||
Xoae_page page = Init_page(wiki, special_url);
|
||||
special_page.Special__gen(wiki, page, page.Url(), page.Ttl());
|
||||
return page;
|
||||
}
|
||||
private static Xoae_page Init_page(Xowe_wiki wiki, String url_str) {
|
||||
// basic boot-strapping to make sure ctx.Page has .Url and .Ttl
|
||||
byte[] url_bry = Bry_.new_u8(url_str);
|
||||
Xoae_page page = wiki.Parser_mgr().Ctx().Page();
|
||||
page.Url_(wiki.Utl__url_parser().Parse(url_bry));
|
||||
page.Ttl_(Xoa_ttl.Parse(wiki, url_bry));
|
||||
return page;
|
||||
}
|
||||
}
|
Loading…
Reference in new issue