1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00
This commit is contained in:
gnosygnu
2015-04-12 23:12:36 -04:00
parent 18dcd3f89e
commit 551120b906
171 changed files with 3625 additions and 1983 deletions

View File

@@ -224,6 +224,14 @@ public class Xow_ns_mgr implements GfoInvkAble, gplx.lists.ComparerAble {
private void Ords_sort_add(int ns_id) {
this.Add_new(ns_id, Bry_.XbyInt(ns_id), Xow_ns_case_.Id_1st, false); // NOTE: name and case_match are mostly useless defaults; note that in theory this proc should not be called (all siteInfos should be well-formed) but just in case, create items now so that Get_by_ord() does not fail
}
public byte[] Bld_ttl_w_ns(Bry_bfr bfr, boolean text_form, boolean literalize, int ns_id, byte[] ttl) {
if (ns_id == Xow_ns_.Id_main) return ttl;
Xow_ns ns = Ids_get_or_null(ns_id); if (ns == null) {Xoa_app_.Usr_dlg().Warn_many("", "", "ns_mgr:uknown ns_id; ns_id=~{0} ttl=~{1}", ns_id, ttl); return ttl;}
if (literalize) bfr.Add_byte(Byte_ascii.Colon); // NOTE: add : to literalize ns; EX: [[Category:A]] will get thrown into category list; [[:Category:A]] will print
bfr.Add(text_form ? ns.Name_txt_w_colon() : ns.Name_db_w_colon());
bfr.Add(ttl);
return bfr.Xto_bry_and_clear();
}
class Xow_ns_mgr_name_itm {
public Xow_ns_mgr_name_itm(byte[] name, Xow_ns ns) {this.name = name; this.name_len = name.length; this.ns = ns;}
public byte[] Name() {return name;} private byte[] name;

View File

@@ -17,10 +17,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa; import gplx.*;
import gplx.core.primitives.*;
import gplx.xowa.wikis.*; import gplx.xowa.wikis.ttls.*;
import gplx.xowa.wikis.data.*;
import gplx.xowa.wikis.*; import gplx.xowa.wikis.ttls.*; import gplx.xowa.wikis.data.*;
import gplx.xowa.files.*; import gplx.xowa.files.repos.*; import gplx.xowa.files.origs.*; import gplx.xowa.files.bins.*; import gplx.fsdb.meta.*;
import gplx.xowa.html.hzips.*; import gplx.xowa.html.hdumps.*;
import gplx.xowa.html.wtrs.*; import gplx.xowa.html.hzips.*; import gplx.xowa.html.hdumps.*;
public interface Xow_wiki extends Xow_ttl_parser {
byte[] Domain_bry(); // EX: en.wikipedia.org
String Domain_str();
@@ -39,4 +38,5 @@ public interface Xow_wiki extends Xow_ttl_parser {
boolean Html_mgr__hdump_enabled();
Xow_hzip_mgr Html_mgr__hzip_mgr();
Xohd_hdump_rdr Html_mgr__hdump_rdr();
Xoh_lnki_wtr_utl Html_mgr__lnki_wtr_utl();
}

View File

@@ -22,7 +22,7 @@ import gplx.fsdb.*;
import gplx.xowa.wikis.data.*; import gplx.xowa.wikis.data.tbls.*;
import gplx.xowa.files.*; import gplx.xowa.files.repos.*; import gplx.xowa.files.origs.*; import gplx.xowa.files.bins.*; import gplx.fsdb.meta.*;
import gplx.xowa.langs.vnts.*; import gplx.xowa.gui.views.*; import gplx.xowa.wikis.xwikis.*;
import gplx.xowa.html.hzips.*; import gplx.xowa.html.hdumps.*;
import gplx.xowa.html.wtrs.*; import gplx.xowa.html.hzips.*; import gplx.xowa.html.hdumps.*;
import gplx.xowa.setup.maints.*; import gplx.xowa.wikis.caches.*;
import gplx.xowa.bldrs.xmls.*; import gplx.xowa.xtns.pfuncs.*;
import gplx.xowa.tdbs.*;
@@ -40,6 +40,7 @@ public class Xowe_wiki implements Xow_wiki, GfoInvkAble {
html_mgr = new Xow_html_mgr(this);
this.html_mgr__hdump_rdr = new Xohd_hdump_rdr(app, this);
this.html_mgr__hdump_wtr = new Xohd_hdump_wtr(app, this);
this.html_mgr__lnki_wtr_utl = new Xoh_lnki_wtr_utl(this, app.Href_parser());
tdb_fsys_mgr = new Xotdb_fsys_mgr(wiki_dir, ns_mgr);
xwiki_domain_tid = Xwiki_tid(domain_tid);
@@ -100,6 +101,7 @@ public class Xowe_wiki implements Xow_wiki, GfoInvkAble {
public Xow_hzip_mgr Html_mgr__hzip_mgr() {return html_mgr.Hzip_mgr();}
public Xohd_hdump_rdr Html_mgr__hdump_rdr() {return html_mgr__hdump_rdr;} private final Xohd_hdump_rdr html_mgr__hdump_rdr;
public Xohd_hdump_wtr Html_mgr__hdump_wtr() {return html_mgr__hdump_wtr;} private final Xohd_hdump_wtr html_mgr__hdump_wtr;
public Xoh_lnki_wtr_utl Html_mgr__lnki_wtr_utl() {return html_mgr__lnki_wtr_utl;} private final Xoh_lnki_wtr_utl html_mgr__lnki_wtr_utl;
public Xow_xwiki_mgr Xwiki_mgr() {return xwiki_mgr;} private final Xow_xwiki_mgr xwiki_mgr;
public int Xwiki_domain_tid() {return xwiki_domain_tid;} private int xwiki_domain_tid;
@@ -162,7 +164,8 @@ public class Xowe_wiki implements Xow_wiki, GfoInvkAble {
public Xoae_page GetPageByTtl(Xoa_url url, Xoa_ttl ttl, Xog_tab_itm tab) {return GetPageByTtl(url, ttl, lang, tab, true);}
public Xoae_page GetPageByTtl(Xoa_url url, Xoa_ttl ttl, Xol_lang lang, Xog_tab_itm tab, boolean parse_page) {
if (init_needed) Init_wiki(app.User());
Xoae_page page = data_mgr.Get_page(url, ttl, false, false); // get page from data_mgr
Xoae_page page = Xoae_page.new_(this, ttl); page.Tab_data().Tab_(tab);
data_mgr.Get_page(page, url, ttl, false, false); // get page from data_mgr
if (page.Missing()) { // page doesn't exist
if (ttl.Ns().Id_file()) {
Xowe_wiki commons_wiki = app.Wiki_mgr().Get_by_key_or_null(commons_wiki_key);
@@ -174,7 +177,7 @@ public class Xowe_wiki implements Xow_wiki, GfoInvkAble {
return page.Missing_();
}
if (page.Missing()) return page; // NOTE: commons can return null page
page.Tab_(tab);
page.Tab_data().Tab_(tab);
page.Lang_(lang);
if (parse_page)
ParsePage(page, false); // NOTE: do not clear page b/c reused for search
@@ -240,13 +243,7 @@ public class Xowe_wiki implements Xow_wiki, GfoInvkAble {
app.Wiki_mgr().Scripts().Exec(this);
Bry_fmtr.Null.Eval_mgr().Enabled_(true);
app.Css_installer().Install_assert(Bool_.Y, this, user.Fsys_mgr().Wiki_html_dir(domain_str));
if (html_mgr__hdump_enabled) {
// if (db_mgr.Tid() == Xodb_mgr_txt.Tid_txt) this.Db_mgr_create_as_sql();
Xowd_html_tbl.Assert_col__page_html_db_id(Db_mgr_as_sql().Core_data_mgr()); // NOTE: must go above html_mgr.Init_by_wiki b/c Page_load will be done via messages
this.Db_mgr_as_sql().Core_data_mgr().Tbl__page().Hdump_enabled_(html_mgr__hdump_enabled);
html_mgr__hdump_rdr.Init_by_db(this.Data_mgr__core_mgr());
html_mgr__hdump_wtr.Init_by_db(this.Data_mgr__core_mgr());
}
Html_mgr__hdump_enabled_(html_mgr__hdump_enabled);
html_mgr.Init_by_wiki(this);
this.Copy_cfg(app.User().Wiki());
File_repos_assert(app, this);
@@ -255,6 +252,15 @@ public class Xowe_wiki implements Xow_wiki, GfoInvkAble {
app.Log_wtr().Log_msg_to_session_direct(log_bfr.Xto_str());
init_in_process = false;
}
private void Html_mgr__hdump_enabled_(boolean v) {
this.html_mgr__hdump_enabled = v;
if (html_mgr__hdump_enabled) {
// if (db_mgr.Tid() == Xodb_mgr_txt.Tid_txt) this.Db_mgr_create_as_sql();
Xowd_html_tbl.Assert_col__page_html_db_id(Db_mgr_as_sql().Core_data_mgr()); // NOTE: must go above html_mgr.Init_by_wiki b/c Page_load will be done via messages
html_mgr__hdump_rdr.Init_by_db(this.Data_mgr__core_mgr());
html_mgr__hdump_wtr.Init_by_db(this.Data_mgr__core_mgr());
}
}
public void Rls() {
if (rls_list == null) return;
int len = rls_list.Count();
@@ -291,7 +297,7 @@ public class Xowe_wiki implements Xow_wiki, GfoInvkAble {
else if (ctx.Match(k, Invk_maint)) return maint_mgr;
else if (ctx.Match(k, Invk_domain)) return domain_str;
else if (ctx.Match(k, Invk_xtns)) return xtn_mgr;
else if (ctx.Match(k, Invk_hdump_enabled_)) html_mgr__hdump_enabled = m.ReadYn("v");
else if (ctx.Match(k, Invk_hdump_enabled_)) this.html_mgr__hdump_enabled = m.ReadYn("v");
else return GfoInvkAble_.Rv_unhandled;
return this;
}