mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
'v3.3.4.1'
This commit is contained in:
@@ -34,7 +34,6 @@ public class Xoh_page implements Xoa_page {
|
||||
public byte[] Sidebar_div() {return sidebar_div;} private byte[] sidebar_div;
|
||||
public Xoh_section_mgr Section_mgr() {return section_mgr;} private final Xoh_section_mgr section_mgr = new Xoh_section_mgr();
|
||||
public Xoh_img_mgr Img_mgr() {return img_mgr;} private Xoh_img_mgr img_mgr = new Xoh_img_mgr();
|
||||
|
||||
public Ordered_hash Redlink_uids() {return redlink_uids;} private final Ordered_hash redlink_uids = Ordered_hash_.New();
|
||||
public Xohd_img_itm__base[] Img_itms() {return img_itms;} public void Img_itms_(Xohd_img_itm__base[] v) {this.img_itms = v;} private Xohd_img_itm__base[] img_itms = Xohd_img_itm__base.Ary_empty;
|
||||
public Ordered_hash Gallery_itms() {return gallery_itms;} private Ordered_hash gallery_itms = Ordered_hash_.New();
|
||||
|
||||
@@ -21,8 +21,8 @@ import gplx.xowa.guis.*; import gplx.xowa.htmls.*; import gplx.xowa.htmls.portal
|
||||
public class Xoh_page_wtr_mgr_tst {
|
||||
@Before public void init() {}
|
||||
@Test public void Logo_has_correct_main_page() { // PURPOSE: Logo href should be "/site/en.wikipedia.org/wiki/", not "/wiki/Main_Page"
|
||||
Xoae_app app = Xoa_app_fxt.app_();
|
||||
Xowe_wiki wiki = Xoa_app_fxt.wiki_tst_(app);
|
||||
Xoae_app app = Xoa_app_fxt.Make__app__edit();
|
||||
Xowe_wiki wiki = Xoa_app_fxt.Make__wiki__edit(app);
|
||||
Xow_portal_mgr portal_mgr = wiki.Html_mgr().Portal_mgr();
|
||||
GfoInvkAble_.InvkCmd_val(portal_mgr, Xow_portal_mgr.Invk_div_logo_, Bry_.new_a7("~{portal_nav_main_href}"));
|
||||
portal_mgr.Init_assert();
|
||||
|
||||
@@ -22,9 +22,9 @@ import gplx.xowa.wikis.pages.*; import gplx.xowa.wikis.pages.skins.*;
|
||||
import gplx.xowa.wikis.nss.*; import gplx.xowa.wikis.*; import gplx.xowa.wikis.domains.*; import gplx.xowa.parsers.*; import gplx.xowa.xtns.wdatas.*;
|
||||
import gplx.xowa.apps.gfs.*; import gplx.xowa.htmls.portal.*;
|
||||
public class Xoh_page_wtr_wkr {
|
||||
private final Bry_bfr tmp_bfr = Bry_bfr.reset_(255); private final Object thread_lock_1 = new Object(), thread_lock_2 = new Object();
|
||||
private final Xoh_page_wtr_mgr mgr; private final byte page_mode;
|
||||
private final Wdata_xwiki_link_wtr wdata_lang_wtr = new Wdata_xwiki_link_wtr(); // In other languages
|
||||
private final Bry_bfr tmp_bfr = Bry_bfr.reset_(255); private final Object thread_lock_1 = new Object(), thread_lock_2 = new Object();
|
||||
private final Xoh_page_wtr_mgr mgr; private final byte page_mode;
|
||||
private final Wdata_xwiki_link_wtr wdata_lang_wtr = new Wdata_xwiki_link_wtr(); // In other languages
|
||||
private Xoae_app app; private Xowe_wiki wiki; private Xop_ctx ctx; private Xoae_page page; private byte[] root_dir_bry;
|
||||
public Xoh_page_wtr_wkr(Xoh_page_wtr_mgr mgr, byte page_mode) {this.mgr = mgr; this.page_mode = page_mode;}
|
||||
public Xoh_page_wtr_wkr Ctgs_enabled_(boolean v) {ctgs_enabled = v; return this;} private boolean ctgs_enabled = true;
|
||||
@@ -69,7 +69,6 @@ public class Xoh_page_wtr_wkr {
|
||||
// if custom_html, use it and exit; needed for Default_tab
|
||||
byte[] custom_html = page.Html_data().Custom_html();
|
||||
if (custom_html != null) {bfr.Add(custom_html); return;}
|
||||
|
||||
// temp variables
|
||||
if (root_dir_bry == null) this.root_dir_bry = app.Fsys_mgr().Root_dir().To_http_file_bry();
|
||||
Xoa_ttl page_ttl = page.Ttl(); int page_ns_id = page_ttl.Ns().Id();
|
||||
@@ -121,7 +120,7 @@ public class Xoh_page_wtr_wkr {
|
||||
case Xow_page_tid.Tid_js:
|
||||
case Xow_page_tid.Tid_css:
|
||||
case Xow_page_tid.Tid_lua: Write_body_pre (bfr, app, wiki, data_raw, tmp_bfr); page_tid_uses_pre = true; break;
|
||||
case Xow_page_tid.Tid_json: app.Wiki_mgr().Wdata_mgr().Write_json_as_html(bfr, page_ttl.Page_db(), data_raw); break;
|
||||
case Xow_page_tid.Tid_json: app.Wiki_mgr().Wdata_mgr().Write_json_as_html(bfr, page_ttl.Full_db(), data_raw); break;
|
||||
case Xow_page_tid.Tid_wikitext: Write_body_wikitext (bfr, app, wiki, data_raw, hctx, page, page_tid, page_ns_id); break;
|
||||
}
|
||||
}
|
||||
@@ -138,26 +137,21 @@ public class Xoh_page_wtr_wkr {
|
||||
bfr.Add(hdump_data);
|
||||
return;
|
||||
}
|
||||
|
||||
// dump and exit if MediaWiki message;
|
||||
if (ns_id == Xow_ns_.Tid__mediawiki) { // if MediaWiki and wikitext, must be a message; convert args back to php; DATE:2014-06-13
|
||||
bfr.Add(Xoa_gfs_php_mgr.Xto_php(tmp_bfr, Bool_.N, data_raw));
|
||||
return;
|
||||
}
|
||||
|
||||
// if [[File]], add boilerplate header; note that html is XOWA-generated so does not need to be tidied
|
||||
if (ns_id == Xow_ns_.Tid__file) app.Ns_file_page_mgr().Bld_html(wiki, ctx, page, bfr, page.Ttl(), wiki.Cfg_file_page(), page.File_queue());
|
||||
|
||||
// get separate bfr; note that bfr already has <html> and <head> written to it, so this can't be passed to tidy; DATE:2014-06-11
|
||||
Bry_bfr tidy_bfr = app.Utl__bfr_mkr().Get_m001();
|
||||
|
||||
// write wikitext
|
||||
if (page.Root() != null) // NOTE: will be null if blank; occurs for one test: Logo_has_correct_main_page; DATE:2015-09-29
|
||||
wiki.Html_mgr().Html_wtr().Write_all(tidy_bfr, page.Wikie().Parser_mgr().Ctx(), hctx, page.Root().Data_mid(), page.Root());
|
||||
|
||||
// if [[Category]], render rest of html (Subcategories; Pages; Files); note that a category may have other html which requires wikitext processing
|
||||
if (ns_id == Xow_ns_.Tid__category) wiki.Html_mgr().Ns_ctg().Bld_html(wiki, page, hctx, tidy_bfr);
|
||||
|
||||
// tidy html
|
||||
gplx.xowa.htmls.core.htmls.tidy.Xoh_tidy_mgr tidy_mgr = app.Html_mgr().Tidy_mgr();
|
||||
if (tidy_mgr.Enabled()) tidy_mgr.Run_tidy_html(page, tidy_bfr, !hctx.Mode_is_hdump());
|
||||
@@ -165,7 +159,6 @@ public class Xoh_page_wtr_wkr {
|
||||
// add back to main bfr
|
||||
bfr.Add_bfr_and_clear(tidy_bfr);
|
||||
tidy_bfr.Mkr_rls();
|
||||
|
||||
// handle Categories at bottom of page; note that html is XOWA-generated so does not need to be tidied
|
||||
int ctgs_len = page.Category_list().length;
|
||||
if ( ctgs_enabled
|
||||
@@ -178,7 +171,6 @@ public class Xoh_page_wtr_wkr {
|
||||
else
|
||||
wiki.Html_mgr().Ctg_mgr().Bld(bfr, page, ctgs_len);
|
||||
}
|
||||
|
||||
// translate if variants are enabled
|
||||
Xol_vnt_mgr vnt_mgr = wiki.Lang().Vnt_mgr();
|
||||
if (vnt_mgr.Enabled()) bfr.Add(vnt_mgr.Convert_lang().Parse_page(vnt_mgr.Cur_itm(), page.Revision_data().Id(), bfr.To_bry_and_clear()));
|
||||
@@ -201,5 +193,5 @@ public class Xoh_page_wtr_wkr {
|
||||
if (data_raw_len > 0) // do not add nl if empty String
|
||||
bfr.Add_byte_nl(); // per MW:EditPage.php: "Ensure there's a newline at the end, otherwise adding lines is awkward."
|
||||
}
|
||||
private static final byte[] Content_editable_bry = Bry_.new_a7(" contenteditable=\"true\"");
|
||||
private static final byte[] Content_editable_bry = Bry_.new_a7(" contenteditable=\"true\"");
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ public class Xoh_page_wtr_wkr_ {
|
||||
return tmp_bfr.To_bry_and_clear();
|
||||
}
|
||||
else
|
||||
return ttl.Full_txt(); // NOTE: include ns with ttl as per defect d88a87b3
|
||||
return ttl.Full_txt_w_ttl_case(); // NOTE: include ns with ttl as per defect d88a87b3
|
||||
}
|
||||
public static void Bld_head_end(Bry_bfr html_bfr, Xoae_page page) {
|
||||
byte[] head_end = page.Html_data().Custom_head_end();
|
||||
|
||||
@@ -43,8 +43,8 @@ public class Xoh_page_wtr_wkr_tst {
|
||||
class Xoh_page_wtr_fxt {
|
||||
public void Clear() {
|
||||
if (app == null) {
|
||||
app = Xoa_app_fxt.app_();
|
||||
wiki = Xoa_app_fxt.wiki_tst_(app);
|
||||
app = Xoa_app_fxt.Make__app__edit();
|
||||
wiki = Xoa_app_fxt.Make__wiki__edit(app);
|
||||
}
|
||||
} private Bry_bfr tmp_bfr = Bry_bfr.reset_(255); private Xowe_wiki wiki;
|
||||
public Xoae_app App() {return app;} private Xoae_app app;
|
||||
|
||||
@@ -40,8 +40,8 @@ public class Xohp_ctg_grp_mgr_tst {
|
||||
}
|
||||
class Xoh_ctg_mgr_fxt {
|
||||
public Xoh_ctg_mgr_fxt Clear() {
|
||||
app = Xoa_app_fxt.app_();
|
||||
wiki = Xoa_app_fxt.wiki_tst_(app);
|
||||
app = Xoa_app_fxt.Make__app__edit();
|
||||
wiki = Xoa_app_fxt.Make__wiki__edit(app);
|
||||
ctg_grp_mgr = new Xohp_ctg_grp_mgr();
|
||||
return this;
|
||||
} private Xohp_ctg_grp_mgr ctg_grp_mgr; Xoae_app app; Xowe_wiki wiki; Bry_bfr tmp_bfr = Bry_bfr.new_();
|
||||
|
||||
@@ -50,7 +50,7 @@ public class Xow_hdump_mgr__load {
|
||||
hpg.Body_(page_override);
|
||||
return true;
|
||||
}
|
||||
Xowd_db_file html_db = wiki.Data__core_mgr().Dbs__get_at(tmp_dbpg.Html_db_id());
|
||||
Xowd_db_file html_db = wiki.Data__core_mgr().Dbs__get_by_id(tmp_dbpg.Html_db_id());
|
||||
if (!html_db.Tbl__html().Select_by_page(hpg)) return Load__fail(hpg); // nothing in "html" table
|
||||
byte[] src = Parse(hpg, hpg.Body_zip_tid(), hpg.Body_hzip_tid(), hpg.Body());
|
||||
hpg.Body_(src);
|
||||
|
||||
@@ -68,7 +68,7 @@ public class Xow_hdump_mgr__save {
|
||||
core_data_mgr.Tbl__page().Update__html_db_id(page.Revision_data().Id(), html_db_id);
|
||||
}
|
||||
else {
|
||||
rv = core_data_mgr.Dbs__get_at(html_db_id);
|
||||
rv = core_data_mgr.Dbs__get_by_id(html_db_id);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -30,8 +30,8 @@ class Xob_hdump_img_cmd extends Xob_itm_basic_base implements Xob_cmd {
|
||||
public void Cmd_term() {}
|
||||
private void Exec_main() {
|
||||
Bry_bfr bfr = Bry_bfr.reset_(Io_mgr.Len_mb);
|
||||
Db_conn conn = Xob_db_file.new__file_make(wiki.Fsys_mgr().Root_dir()).Conn();
|
||||
Db_rdr rdr = conn.Stmt_new(gplx.dbs.qrys.Db_qry_sql.rdr_(Sql_select_itm)).Exec_select__rls_auto();
|
||||
Db_conn conn = Xob_db_file.New__file_make(wiki.Fsys_mgr().Root_dir()).Conn();
|
||||
Db_rdr rdr = conn.Stmt_sql(Sql_select_clause).Exec_select__rls_auto();
|
||||
// html_tbl = new Xowd_html_tbl(conn, wiki.Db_mgr_as_sql().Core_data_mgr().Props().Zip_tid_text());
|
||||
int cur_page_id = -1;
|
||||
while (rdr.Move_next()) {
|
||||
@@ -57,7 +57,7 @@ class Xob_hdump_img_cmd extends Xob_itm_basic_base implements Xob_cmd {
|
||||
if (page_id == -1 || data.length == 0) return;
|
||||
// html_tbl.Insert(page_id, Xohd_img_tid.Tid_img, data);
|
||||
}
|
||||
private static final String Sql_select_itm = String_.Concat_lines_nl_skip_last
|
||||
private static final String Sql_select_clause = String_.Concat_lines_nl_skip_last
|
||||
( "SELECT lt.lnki_page_id"
|
||||
, ", lt.html_uid"
|
||||
, ", lt.lnki_ttl"
|
||||
|
||||
@@ -32,8 +32,8 @@ public class Xob_link_dump_cmd {
|
||||
tbl.Insert_end();
|
||||
tbl.Create_idx_1();
|
||||
Db_conn conn = tbl.Conn();
|
||||
Db_attach_cmd.new_(conn, "page_db", page_db_url)
|
||||
.Add_fmt("update trg_page_id", String_.Concat_lines_nl_skip_last
|
||||
new Db_attach_mgr(conn, new Db_attach_itm("page_db", page_db_url))
|
||||
.Exec_sql_w_msg("update trg_page_id", String_.Concat_lines_nl_skip_last
|
||||
( "REPLACE INTO link_dump"
|
||||
, "SELECT r.uid"
|
||||
, ", r.src_page_id"
|
||||
@@ -42,10 +42,9 @@ public class Xob_link_dump_cmd {
|
||||
, ", r.trg_ns"
|
||||
, ", r.trg_ttl"
|
||||
, "FROM link_dump r"
|
||||
, " LEFT JOIN page_db.page p ON r.trg_ns = p.page_namespace AND r.trg_ttl = p.page_title"
|
||||
, " LEFT JOIN <page_db>page p ON r.trg_ns = p.page_namespace AND r.trg_ttl = p.page_title"
|
||||
, ";"
|
||||
))
|
||||
.Exec();
|
||||
));;
|
||||
conn.Exec_sql("UPDATE link_dump SET trg_ns = -1 AND trg_ttl = '' WHERE trg_page_id != -1;");
|
||||
tbl.Create_idx_2();
|
||||
conn.Env_vacuum();
|
||||
|
||||
@@ -33,15 +33,15 @@ class Xob_link_dump_tbl implements Rls_able {
|
||||
conn.Rls_reg(this);
|
||||
}
|
||||
public Db_conn Conn() {return conn;} private final Db_conn conn;
|
||||
public void Create_tbl() {conn.Ddl_create_tbl(Dbmeta_tbl_itm.New(Tbl_name, flds));}
|
||||
public void Create_tbl() {conn.Meta_tbl_create(Dbmeta_tbl_itm.New(Tbl_name, flds));}
|
||||
public void Create_idx_1() {
|
||||
conn.Ddl_create_idx
|
||||
conn.Meta_idx_create
|
||||
( Dbmeta_idx_itm.new_normal_by_tbl(Tbl_name, "src", Fld_src_page_id, Fld_src_html_uid)
|
||||
, Dbmeta_idx_itm.new_normal_by_tbl(Tbl_name, "trg_temp", Fld_trg_ns, Fld_trg_ttl)
|
||||
);
|
||||
}
|
||||
public void Create_idx_2() {
|
||||
conn.Ddl_create_idx
|
||||
conn.Meta_idx_create
|
||||
( Dbmeta_idx_itm.new_normal_by_tbl(Tbl_name, "trg", Fld_trg_page_id, Fld_src_page_id, Fld_src_html_uid)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ package gplx.xowa.htmls.core.bldrs; import gplx.*; import gplx.xowa.*; import gp
|
||||
import gplx.dbs.*; import gplx.xowa.bldrs.*;
|
||||
import gplx.xowa.wikis.data.*; import gplx.xowa.wikis.data.tbls.*; import gplx.xowa.htmls.core.dbs.*;
|
||||
class Xob_ns_to_db_wkr__html implements Xob_ns_to_db_wkr {
|
||||
private final Xowd_db_file page_db;
|
||||
private final Xowd_db_file page_db;
|
||||
public Xob_ns_to_db_wkr__html(Xowd_db_file page_db) {this.page_db = page_db;}
|
||||
public byte Db_tid() {return Xowd_db_file_.Tid_html_data;}
|
||||
public void Tbl_init(Xowd_db_file db) {
|
||||
@@ -30,13 +30,12 @@ class Xob_ns_to_db_wkr__html implements Xob_ns_to_db_wkr {
|
||||
public void Tbl_term(Xowd_db_file db) {
|
||||
db.Tbl__text().Insert_end();
|
||||
Db_conn db_conn = db.Conn();
|
||||
Db_attach_cmd.new_(page_db.Conn(), "html_db", db.Url())
|
||||
.Add_fmt("hdump.update page.html_db_id", Sql_update_page_html_db_id, db.Id())
|
||||
.Exec();
|
||||
new Db_attach_mgr(page_db.Conn(), new Db_attach_itm("html_db", db.Url()))
|
||||
.Exec_sql_w_msg("hdump.update page.html_db_id", Sql_update_page_html_db_id, db.Id());
|
||||
db_conn.Rls_conn();
|
||||
}
|
||||
private static final String Sql_update_page_html_db_id = String_.Concat_lines_nl_skip_last
|
||||
( "REPLACE INTO page (page_id, page_namespace, page_title, page_is_redirect, page_touched, page_len, page_random_int, page_text_db_id, page_html_db_id, page_redirect_id)"
|
||||
private static final String Sql_update_page_html_db_id = String_.Concat_lines_nl_skip_last
|
||||
( "REPLACE INTO page (page_id, page_namespace, page_title, page_is_redirect, page_touched, page_len, page_random_int, page_text_db_id, page_html_db_id, page_redirect_id, page_score)"
|
||||
, "SELECT p.page_id"
|
||||
, ", p.page_namespace"
|
||||
, ", p.page_title"
|
||||
@@ -47,7 +46,8 @@ class Xob_ns_to_db_wkr__html implements Xob_ns_to_db_wkr {
|
||||
, ", p.page_text_db_id"
|
||||
, ", {0}"
|
||||
, ", p.page_redirect_id"
|
||||
, ", p.page_score"
|
||||
, "FROM page p"
|
||||
, " JOIN <attach_db>html h ON p.page_id = h.page_id"
|
||||
, " JOIN <html_db>html h ON p.page_id = h.page_id"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -29,20 +29,21 @@ public class Xob_redlink_mkr_cmd extends Xob_itm_basic_base implements Xob_cmd {
|
||||
Bry_bfr bfr = Bry_bfr.reset_(255);
|
||||
wiki.Init_assert();
|
||||
Xowd_db_file core_db = wiki.Data__core_mgr().Db__core();
|
||||
Xob_db_file link_dump_db = Xob_db_file.new__redlink(wiki.Fsys_mgr().Root_dir());
|
||||
Db_attach_rdr attach_rdr = new Db_attach_rdr(link_dump_db.Conn(), "page_db", core_db.Url());
|
||||
attach_rdr.Attach();
|
||||
Xob_db_file link_dump_db = Xob_db_file.New__redlink(wiki.Fsys_mgr().Root_dir());
|
||||
Db_attach_mgr attach_mgr = new Db_attach_mgr(link_dump_db.Conn(), new Db_attach_itm("page_db", wiki.Data__core_mgr().Db__core().Conn()));
|
||||
String attach_sql = attach_mgr.Resolve_sql(Sql_select_clause);
|
||||
attach_mgr.Attach();
|
||||
Xowd_page_tbl page_tbl = core_db.Tbl__page();
|
||||
int cur_html_db_id = -1, cur_page_id = -1;
|
||||
Xoh_redlink_tbl redlink_tbl = new Xoh_redlink_tbl(page_tbl.Conn());
|
||||
Db_rdr rdr = attach_rdr.Exec_as_rdr(Sql_select_itm);
|
||||
Xoh_redlink_tbl redlink_tbl = new Xoh_redlink_tbl(page_tbl.conn);
|
||||
Db_rdr rdr = link_dump_db.Conn().Exec_rdr(attach_sql);
|
||||
try {
|
||||
while (rdr.Move_next()) {
|
||||
// switch html_db if needed
|
||||
int html_db_id = rdr.Read_int(page_tbl.Fld_html_db_id());
|
||||
if (html_db_id != cur_html_db_id) {
|
||||
if (redlink_tbl != null) redlink_tbl.Conn().Txn_end();
|
||||
// redlink_tbl = wiki.Data__core_mgr().Dbs__get_at(html_db_id).Tbl__html_redlink();
|
||||
// redlink_tbl = wiki.Data__core_mgr().Dbs__get_by_id(html_db_id).Tbl__html_redlink();
|
||||
redlink_tbl.Conn().Txn_bgn("bldr__redlink");
|
||||
cur_html_db_id = html_db_id;
|
||||
}
|
||||
@@ -61,7 +62,7 @@ public class Xob_redlink_mkr_cmd extends Xob_itm_basic_base implements Xob_cmd {
|
||||
finally {rdr.Rls();}
|
||||
Commit(redlink_tbl, cur_page_id, bfr); // commit cur page
|
||||
redlink_tbl.Conn().Txn_end(); // close cur tbl
|
||||
attach_rdr.Detach();
|
||||
attach_mgr.Detach();
|
||||
}
|
||||
private void Commit(Xoh_redlink_tbl redlink_tbl, int cur_page_id, Bry_bfr bfr) {
|
||||
redlink_tbl.Insert(cur_page_id, bfr.To_bry_and_clear());
|
||||
@@ -69,12 +70,12 @@ public class Xob_redlink_mkr_cmd extends Xob_itm_basic_base implements Xob_cmd {
|
||||
if ((commit_count % commit_interval ) == 0)
|
||||
redlink_tbl.Conn().Txn_sav();
|
||||
}
|
||||
private static final String Sql_select_itm = String_.Concat_lines_nl_skip_last
|
||||
private static final String Sql_select_clause = String_.Concat_lines_nl_skip_last
|
||||
( "SELECT p.page_html_db_id"
|
||||
, ", p.page_id"
|
||||
, ", ld.src_html_uid"
|
||||
, "FROM link_dump ld"
|
||||
, " JOIN <attach_db>page p ON p.page_id = ld.src_page_id "
|
||||
, " JOIN <page_db>page p ON p.page_id = ld.src_page_id "
|
||||
, "WHERE ld.trg_page_id = -1"
|
||||
, "ORDER BY p.page_html_db_id, p.page_id"
|
||||
, ";"
|
||||
|
||||
@@ -34,7 +34,7 @@ public class Xoh_page_tbl implements Rls_able {
|
||||
conn.Rls_reg(this);
|
||||
}
|
||||
public Db_conn Conn() {return conn;}
|
||||
public void Create_tbl() {conn.Ddl_create_tbl(Dbmeta_tbl_itm.New(tbl_name, flds));}
|
||||
public void Create_tbl() {conn.Meta_tbl_create(Dbmeta_tbl_itm.New(tbl_name, flds));}
|
||||
public void Insert_bgn() {conn.Txn_bgn("html__insert"); stmt_insert = conn.Stmt_insert(tbl_name, flds);}
|
||||
public void Insert_end() {conn.Txn_end(); stmt_insert = Db_stmt_.Rls(stmt_insert);}
|
||||
public void Insert(Xoh_page hpg, int zip_tid, int hzip_tid, byte[] body) {Insert(hpg.Page_id(), hpg.Head_mgr().Flag(), zip_tid, hzip_tid, hpg.Display_ttl(), hpg.Content_sub(), hpg.Sidebar_div(), body);}
|
||||
|
||||
@@ -28,7 +28,7 @@ public class Xoh_redlink_tbl implements Rls_able {
|
||||
conn.Rls_reg(this);
|
||||
}
|
||||
public Db_conn Conn() {return conn;}
|
||||
public void Create_tbl() {conn.Ddl_create_tbl(Dbmeta_tbl_itm.New(tbl_name, flds));}
|
||||
public void Create_tbl() {conn.Meta_tbl_create(Dbmeta_tbl_itm.New(tbl_name, flds));}
|
||||
public void Insert_bgn() {conn.Txn_bgn("html_redlink__insert"); stmt_insert = conn.Stmt_insert(tbl_name, flds);}
|
||||
public void Insert_end() {conn.Txn_end(); stmt_insert = Db_stmt_.Rls(stmt_insert);}
|
||||
public void Insert(int page_id, byte[] redlink_uids) {
|
||||
|
||||
@@ -240,37 +240,37 @@ public class Xoh_html_wtr {
|
||||
Xop_xnde_tag tag = xnde.Tag();
|
||||
int tag_id = tag.Id();
|
||||
switch (tag_id) {
|
||||
case Xop_xnde_tag_.Tid_br:
|
||||
case Xop_xnde_tag_.Tid__br:
|
||||
if (xnde.Src_end() - xnde.Src_bgn() < 4
|
||||
|| xnde.Src_bgn() == -1)
|
||||
bfr.Add(Tag_br); else bfr.Add_mid(src, xnde.Src_bgn(), xnde.Src_end()); break;
|
||||
case Xop_xnde_tag_.Tid_hr: bfr.Add(Tag_hr); break;
|
||||
case Xop_xnde_tag_.Tid_includeonly: // NOTE: do not write tags or content
|
||||
case Xop_xnde_tag_.Tid__hr: bfr.Add(Tag_hr); break;
|
||||
case Xop_xnde_tag_.Tid__includeonly: // NOTE: do not write tags or content
|
||||
break;
|
||||
case Xop_xnde_tag_.Tid_noinclude: // NOTE: do not write tags
|
||||
case Xop_xnde_tag_.Tid_onlyinclude:
|
||||
case Xop_xnde_tag_.Tid__noinclude: // NOTE: do not write tags
|
||||
case Xop_xnde_tag_.Tid__onlyinclude:
|
||||
Xnde_subs_escape(ctx, hctx, bfr, src, xnde, false, false);
|
||||
break;
|
||||
case Xop_xnde_tag_.Tid_nowiki:
|
||||
case Xop_xnde_tag_.Tid__nowiki:
|
||||
Xnde_subs_escape(ctx, hctx, bfr, src, xnde, false, false);
|
||||
break;
|
||||
case Xop_xnde_tag_.Tid_b: case Xop_xnde_tag_.Tid_strong:
|
||||
case Xop_xnde_tag_.Tid_i: case Xop_xnde_tag_.Tid_em: case Xop_xnde_tag_.Tid_cite: case Xop_xnde_tag_.Tid_dfn: case Xop_xnde_tag_.Tid_var:
|
||||
case Xop_xnde_tag_.Tid_u: case Xop_xnde_tag_.Tid_ins: case Xop_xnde_tag_.Tid_abbr:
|
||||
case Xop_xnde_tag_.Tid_strike: case Xop_xnde_tag_.Tid_s: case Xop_xnde_tag_.Tid_del:
|
||||
case Xop_xnde_tag_.Tid_sub: case Xop_xnde_tag_.Tid_sup: case Xop_xnde_tag_.Tid_big: case Xop_xnde_tag_.Tid_small:
|
||||
case Xop_xnde_tag_.Tid_code: case Xop_xnde_tag_.Tid_tt: case Xop_xnde_tag_.Tid_kbd: case Xop_xnde_tag_.Tid_samp: case Xop_xnde_tag_.Tid_blockquote:
|
||||
case Xop_xnde_tag_.Tid_font: case Xop_xnde_tag_.Tid_center:
|
||||
case Xop_xnde_tag_.Tid_p: case Xop_xnde_tag_.Tid_span: case Xop_xnde_tag_.Tid_div:
|
||||
case Xop_xnde_tag_.Tid_h1: case Xop_xnde_tag_.Tid_h2: case Xop_xnde_tag_.Tid_h3: case Xop_xnde_tag_.Tid_h4: case Xop_xnde_tag_.Tid_h5: case Xop_xnde_tag_.Tid_h6:
|
||||
case Xop_xnde_tag_.Tid_dt: case Xop_xnde_tag_.Tid_dd: case Xop_xnde_tag_.Tid_ol: case Xop_xnde_tag_.Tid_ul: case Xop_xnde_tag_.Tid_dl:
|
||||
case Xop_xnde_tag_.Tid_table: case Xop_xnde_tag_.Tid_tr: case Xop_xnde_tag_.Tid_td: case Xop_xnde_tag_.Tid_th: case Xop_xnde_tag_.Tid_caption: case Xop_xnde_tag_.Tid_tbody:
|
||||
case Xop_xnde_tag_.Tid_ruby: case Xop_xnde_tag_.Tid_rt: case Xop_xnde_tag_.Tid_rb: case Xop_xnde_tag_.Tid_rp:
|
||||
case Xop_xnde_tag_.Tid_time: case Xop_xnde_tag_.Tid_bdi: case Xop_xnde_tag_.Tid_data: case Xop_xnde_tag_.Tid_mark: case Xop_xnde_tag_.Tid_wbr: case Xop_xnde_tag_.Tid_bdo: // HTML 5: write literally and let browser handle them
|
||||
case Xop_xnde_tag_.Tid_q:
|
||||
case Xop_xnde_tag_.Tid__b: case Xop_xnde_tag_.Tid__strong:
|
||||
case Xop_xnde_tag_.Tid__i: case Xop_xnde_tag_.Tid__em: case Xop_xnde_tag_.Tid__cite: case Xop_xnde_tag_.Tid__dfn: case Xop_xnde_tag_.Tid__var:
|
||||
case Xop_xnde_tag_.Tid__u: case Xop_xnde_tag_.Tid__ins: case Xop_xnde_tag_.Tid__abbr:
|
||||
case Xop_xnde_tag_.Tid__strike: case Xop_xnde_tag_.Tid__s: case Xop_xnde_tag_.Tid__del:
|
||||
case Xop_xnde_tag_.Tid__sub: case Xop_xnde_tag_.Tid__sup: case Xop_xnde_tag_.Tid__big: case Xop_xnde_tag_.Tid__small:
|
||||
case Xop_xnde_tag_.Tid__code: case Xop_xnde_tag_.Tid__tt: case Xop_xnde_tag_.Tid__kbd: case Xop_xnde_tag_.Tid__samp: case Xop_xnde_tag_.Tid__blockquote:
|
||||
case Xop_xnde_tag_.Tid__font: case Xop_xnde_tag_.Tid__center:
|
||||
case Xop_xnde_tag_.Tid__p: case Xop_xnde_tag_.Tid__span: case Xop_xnde_tag_.Tid__div:
|
||||
case Xop_xnde_tag_.Tid__h1: case Xop_xnde_tag_.Tid__h2: case Xop_xnde_tag_.Tid__h3: case Xop_xnde_tag_.Tid__h4: case Xop_xnde_tag_.Tid__h5: case Xop_xnde_tag_.Tid__h6:
|
||||
case Xop_xnde_tag_.Tid__dt: case Xop_xnde_tag_.Tid__dd: case Xop_xnde_tag_.Tid__ol: case Xop_xnde_tag_.Tid__ul: case Xop_xnde_tag_.Tid__dl:
|
||||
case Xop_xnde_tag_.Tid__table: case Xop_xnde_tag_.Tid__tr: case Xop_xnde_tag_.Tid__td: case Xop_xnde_tag_.Tid__th: case Xop_xnde_tag_.Tid__caption: case Xop_xnde_tag_.Tid__tbody:
|
||||
case Xop_xnde_tag_.Tid__ruby: case Xop_xnde_tag_.Tid__rt: case Xop_xnde_tag_.Tid__rb: case Xop_xnde_tag_.Tid__rp:
|
||||
case Xop_xnde_tag_.Tid__time: case Xop_xnde_tag_.Tid__bdi: case Xop_xnde_tag_.Tid__data: case Xop_xnde_tag_.Tid__mark: case Xop_xnde_tag_.Tid__wbr: case Xop_xnde_tag_.Tid__bdo: // HTML 5: write literally and let browser handle them
|
||||
case Xop_xnde_tag_.Tid__q:
|
||||
Write_xnde(bfr, ctx, hctx, xnde, tag, tag_id, src);
|
||||
break;
|
||||
case Xop_xnde_tag_.Tid_pre: {
|
||||
case Xop_xnde_tag_.Tid__pre: {
|
||||
if (xnde.Tag_open_end() == xnde.Tag_close_bgn()) return; // ignore empty tags, else blank pre line will be printed; DATE:2014-03-12
|
||||
byte[] name = tag.Name_bry();
|
||||
bfr.Add_byte(Byte_ascii.Angle_bgn).Add(name);
|
||||
@@ -280,7 +280,7 @@ public class Xoh_html_wtr {
|
||||
bfr.Add(Tag__end_bgn).Add(name).Add_byte(Byte_ascii.Angle_end);
|
||||
break;
|
||||
}
|
||||
case Xop_xnde_tag_.Tid_li: {
|
||||
case Xop_xnde_tag_.Tid__li: {
|
||||
byte[] name = tag.Name_bry();
|
||||
int bfr_len = bfr.Len();
|
||||
if (bfr_len > 0 && bfr.Bfr()[bfr_len - 1] != Byte_ascii.Nl) bfr.Add_byte_nl(); // NOTE: always add nl before li else some lists will merge and force long horizontal bar; EX:w:Music
|
||||
@@ -294,49 +294,52 @@ public class Xoh_html_wtr {
|
||||
bfr.Add(Tag__end_bgn).Add(name).Add_byte(Byte_ascii.Angle_end); // NOTE: inline is never written as <b/>; will be written as <b></b>; SEE: NOTE_1
|
||||
break;
|
||||
}
|
||||
case Xop_xnde_tag_.Tid_timeline: {
|
||||
case Xop_xnde_tag_.Tid__timeline: {
|
||||
bfr.Add_str_a7("<pre class='xowa-timeline'>");
|
||||
Xox_mgr_base.Xtn_write_escape(app, bfr, src, xnde.Tag_open_end(), xnde.Tag_close_bgn()); // NOTE: do not embed <timeline> tag inside pre, else timeline will render in black; EX:<pre><timeline>a</timeline></pre> will fail; DATE:2014-05-22
|
||||
bfr.Add_str_a7("</pre>");
|
||||
break;
|
||||
}
|
||||
case Xop_xnde_tag_.Tid_gallery:
|
||||
case Xop_xnde_tag_.Tid_poem:
|
||||
case Xop_xnde_tag_.Tid_hiero:
|
||||
case Xop_xnde_tag_.Tid_score:
|
||||
case Xop_xnde_tag_.Tid_ref:
|
||||
case Xop_xnde_tag_.Tid_references:
|
||||
case Xop_xnde_tag_.Tid_inputBox:
|
||||
case Xop_xnde_tag_.Tid_imageMap:
|
||||
case Xop_xnde_tag_.Tid_pages:
|
||||
case Xop_xnde_tag_.Tid_pagequality:
|
||||
case Xop_xnde_tag_.Tid_pagelist:
|
||||
case Xop_xnde_tag_.Tid_section:
|
||||
case Xop_xnde_tag_.Tid_translate:
|
||||
case Xop_xnde_tag_.Tid_dynamicPageList:
|
||||
case Xop_xnde_tag_.Tid_languages:
|
||||
case Xop_xnde_tag_.Tid_templateData:
|
||||
case Xop_xnde_tag_.Tid_source: // DATE:2015-09-29
|
||||
case Xop_xnde_tag_.Tid_syntaxHighlight:
|
||||
case Xop_xnde_tag_.Tid_listing_buy:
|
||||
case Xop_xnde_tag_.Tid_listing_do:
|
||||
case Xop_xnde_tag_.Tid_listing_drink:
|
||||
case Xop_xnde_tag_.Tid_listing_eat:
|
||||
case Xop_xnde_tag_.Tid_listing_listing:
|
||||
case Xop_xnde_tag_.Tid_listing_see:
|
||||
case Xop_xnde_tag_.Tid_listing_sleep:
|
||||
case Xop_xnde_tag_.Tid_xowa_cmd:
|
||||
case Xop_xnde_tag_.Tid_rss:
|
||||
case Xop_xnde_tag_.Tid_quiz:
|
||||
case Xop_xnde_tag_.Tid_math:
|
||||
case Xop_xnde_tag_.Tid_indicator:
|
||||
case Xop_xnde_tag_.Tid_xowa_html:
|
||||
case Xop_xnde_tag_.Tid_graph:
|
||||
case Xop_xnde_tag_.Tid__gallery:
|
||||
case Xop_xnde_tag_.Tid__poem:
|
||||
case Xop_xnde_tag_.Tid__hiero:
|
||||
case Xop_xnde_tag_.Tid__score:
|
||||
case Xop_xnde_tag_.Tid__ref:
|
||||
case Xop_xnde_tag_.Tid__references:
|
||||
case Xop_xnde_tag_.Tid__inputBox:
|
||||
case Xop_xnde_tag_.Tid__imageMap:
|
||||
case Xop_xnde_tag_.Tid__pages:
|
||||
case Xop_xnde_tag_.Tid__pagequality:
|
||||
case Xop_xnde_tag_.Tid__pagelist:
|
||||
case Xop_xnde_tag_.Tid__section:
|
||||
case Xop_xnde_tag_.Tid__translate:
|
||||
case Xop_xnde_tag_.Tid__dynamicPageList:
|
||||
case Xop_xnde_tag_.Tid__languages:
|
||||
case Xop_xnde_tag_.Tid__templateData:
|
||||
case Xop_xnde_tag_.Tid__source: // DATE:2015-09-29
|
||||
case Xop_xnde_tag_.Tid__syntaxHighlight:
|
||||
case Xop_xnde_tag_.Tid__listing_buy:
|
||||
case Xop_xnde_tag_.Tid__listing_do:
|
||||
case Xop_xnde_tag_.Tid__listing_drink:
|
||||
case Xop_xnde_tag_.Tid__listing_eat:
|
||||
case Xop_xnde_tag_.Tid__listing_listing:
|
||||
case Xop_xnde_tag_.Tid__listing_see:
|
||||
case Xop_xnde_tag_.Tid__listing_sleep:
|
||||
case Xop_xnde_tag_.Tid__xowa_cmd:
|
||||
case Xop_xnde_tag_.Tid__rss:
|
||||
case Xop_xnde_tag_.Tid__quiz:
|
||||
case Xop_xnde_tag_.Tid__math:
|
||||
case Xop_xnde_tag_.Tid__indicator:
|
||||
case Xop_xnde_tag_.Tid__xowa_html:
|
||||
case Xop_xnde_tag_.Tid__graph:
|
||||
case Xop_xnde_tag_.Tid__random_selection:
|
||||
case Xop_xnde_tag_.Tid__tabber:
|
||||
case Xop_xnde_tag_.Tid__tabview:
|
||||
Xox_xnde xtn = xnde.Xnde_xtn();
|
||||
xtn.Xtn_write(bfr, app, ctx, this, hctx, xnde, src);
|
||||
break;
|
||||
case Xop_xnde_tag_.Tid_xowa_tag_bgn:
|
||||
case Xop_xnde_tag_.Tid_xowa_tag_end:
|
||||
case Xop_xnde_tag_.Tid__xowa_tag_bgn:
|
||||
case Xop_xnde_tag_.Tid__xowa_tag_end:
|
||||
break;
|
||||
default: // unknown tag
|
||||
if (tag.Restricted()) { // a; img; script; etc..
|
||||
@@ -460,9 +463,9 @@ public class Xoh_html_wtr {
|
||||
case Xop_tkn_itm_.Tid_xnde:
|
||||
Xop_xnde_tkn sub_xnde = (Xop_xnde_tkn)sub;
|
||||
switch (sub_xnde.Tag().Id()) {
|
||||
case Xop_xnde_tag_.Tid_noinclude:
|
||||
case Xop_xnde_tag_.Tid_onlyinclude:
|
||||
case Xop_xnde_tag_.Tid_includeonly:
|
||||
case Xop_xnde_tag_.Tid__noinclude:
|
||||
case Xop_xnde_tag_.Tid__onlyinclude:
|
||||
case Xop_xnde_tag_.Tid__includeonly:
|
||||
break;
|
||||
default:
|
||||
byte[] tag_name = sub_xnde.Tag().Name_bry();
|
||||
|
||||
@@ -30,7 +30,7 @@ public class Xoh_html_wtr_escaper {
|
||||
switch (b) {
|
||||
case Byte_ascii.Lt:
|
||||
if (nowiki_skip) {
|
||||
byte[] nowiki_name = Xop_xnde_tag_.Tag_nowiki.Name_bry();
|
||||
byte[] nowiki_name = Xop_xnde_tag_.Tag__nowiki.Name_bry();
|
||||
int nowiki_name_len = nowiki_name.length;
|
||||
if (Bry_.Eq(src, i + 1, i + 1 + nowiki_name_len, nowiki_name)) { // <nowiki found;
|
||||
int end_gt = Escape_nowiki_skip(bfr, src, i, end, nowiki_name, nowiki_name_len);
|
||||
|
||||
@@ -34,7 +34,7 @@ public class Xoh_tidy_wkr_ {
|
||||
else if (String_.Eq(s, Key_null)) return Tid_null;
|
||||
else throw Err_.new_unimplemented();
|
||||
}
|
||||
public static KeyVal[] Options__list = KeyVal_.Ary(KeyVal_.new_(Key_tidy), KeyVal_.new_(Key_jtidy));
|
||||
public static Keyval[] Options__list = Keyval_.Ary(Keyval_.new_(Key_tidy), Keyval_.new_(Key_jtidy));
|
||||
}
|
||||
class Xoh_tidy_wkr_null implements Xoh_tidy_wkr {
|
||||
public byte Tid() {return Xoh_tidy_wkr_.Tid_null;}
|
||||
|
||||
@@ -50,6 +50,16 @@ class Jtidy_fxt {
|
||||
}
|
||||
class Test_mgr {
|
||||
public static void Eq_str(String expd, String actl) {
|
||||
// byte[] expd_bry = Bry_.new_u8(expd);
|
||||
// byte[] actl_bry = Bry_.new_u8(actl);
|
||||
// int expd_len = expd_bry.length;
|
||||
// int actl_len = actl_bry.length;
|
||||
// if (expd_len != actl_len) throw new RuntimeException(String.format("expd != actl; expd:%s actl:%s", Int_.To_str(expd_len), Int_.To_str(actl_len)));
|
||||
// for (int i = 0; i < expd_len; ++i) {
|
||||
// byte expd_byte = expd_bry[i];
|
||||
// byte actl_byte = actl_bry[i];
|
||||
// if (expd_byte != actl_byte) throw new RuntimeException(String.format("expd != actl; %s expd:%s actl:%s", Int_.To_str(i), Byte_.To_str(expd_byte), Byte_.To_str(actl_byte)));
|
||||
// }
|
||||
if (!expd.equals(actl)) throw new RuntimeException(String.format("expd != actl; expd:%s actl:%s", expd, actl));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,6 +55,7 @@ public class Xoh_lnki_bldr {
|
||||
this.caption = Gfh_utl.Escape_html_as_bry(tmp_bfr, text, Bool_.Y, Bool_.Y, Bool_.Y, Bool_.Y, Bool_.Y);
|
||||
return this;
|
||||
}
|
||||
public Xoh_lnki_bldr Caption_direct_(byte[] v) {this.caption = v; return this;}
|
||||
public byte[] Bld_to_bry() {
|
||||
Bld(tmp_bfr);
|
||||
byte[] rv = tmp_bfr.To_bry_and_clear();
|
||||
|
||||
@@ -17,5 +17,4 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.htmls.core.hzips; import gplx.*; import gplx.xowa.*; import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.*;
|
||||
public class Xoh_hzip_dict {
|
||||
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class Xoh_stat_tbl implements Rls_able {
|
||||
conn.Stmt_delete(tbl_name).Exec_delete(); // always zap table
|
||||
conn.Rls_reg(this);
|
||||
}
|
||||
public void Create_tbl() {conn.Ddl_create_tbl(Dbmeta_tbl_itm.New(tbl_name, flds, Dbmeta_idx_itm.new_unique_by_tbl(tbl_name, "pkey", fld_page_id)));}
|
||||
public void Create_tbl() {conn.Meta_tbl_create(Dbmeta_tbl_itm.New(tbl_name, flds, Dbmeta_idx_itm.new_unique_by_tbl(tbl_name, "pkey", fld_page_id)));}
|
||||
public void Rls() {
|
||||
stmt_insert = Db_stmt_.Rls(stmt_insert);
|
||||
}
|
||||
|
||||
@@ -22,8 +22,8 @@ class Xoh_make_mgr_fxt {
|
||||
private final Xoh_page hpg = new Xoh_page();
|
||||
private Xoh_make_mgr hswap_mgr; private Xowe_wiki wiki;
|
||||
public void Clear() {
|
||||
Xoae_app app = Xoa_app_fxt.app_();
|
||||
this.wiki = Xoa_app_fxt.wiki_tst_(app);
|
||||
Xoae_app app = Xoa_app_fxt.Make__app__edit();
|
||||
this.wiki = Xoa_app_fxt.Make__wiki__edit(app);
|
||||
this.wiki.Init_by_wiki();
|
||||
this.hswap_mgr = wiki.Html__hdump_mgr().Load_mgr().Make_mgr();
|
||||
}
|
||||
|
||||
@@ -29,17 +29,17 @@ public class Xoh_hdoc_ctx {
|
||||
public Xoa_app App() {return app;} private Xoa_app app;
|
||||
public byte[] Wiki__domain_bry() {return wiki__domain_bry;} private byte[] wiki__domain_bry;
|
||||
public Xow_ttl_parser Wiki__ttl_parser() {return wiki__ttl_parser;} private Xow_ttl_parser wiki__ttl_parser;
|
||||
public Xoa_url_parser Wiki__url_parser() {return wiki__url_parser;} private Xoa_url_parser wiki__url_parser;
|
||||
public Xow_url_parser Wiki__url_parser() {return wiki__url_parser;} private Xow_url_parser wiki__url_parser;
|
||||
public boolean Xwiki_mgr__missing(byte[] domain){return app.Xwiki_mgr__missing(domain);}
|
||||
public Xou_cache_finder File__mgr() {return file__mgr;} private Xou_cache_finder file__mgr = Xou_cache_finder_.Noop;
|
||||
public Xof_url_bldr File__url_bldr() {return file__url_bldr;} private final Xof_url_bldr file__url_bldr = new Xof_url_bldr();
|
||||
public Xof_url_bldr File__url_bldr() {return file__url_bldr;} private final Xof_url_bldr file__url_bldr = new Xof_url_bldr();
|
||||
public byte[] Page__url() {return page__url;} private byte[] page__url;
|
||||
public Xoh_pool_mgr__hzip Pool_mgr__hzip() {return pool_mgr__hzip;} private final Xoh_pool_mgr__hzip pool_mgr__hzip = new Xoh_pool_mgr__hzip();
|
||||
public Xoh_pool_mgr__data Pool_mgr__data() {return pool_mgr__data;} private final Xoh_pool_mgr__data pool_mgr__data = new Xoh_pool_mgr__data();
|
||||
public Xoh_pool_mgr__wtr Pool_mgr__wtr() {return pool_mgr__wtr;} private final Xoh_pool_mgr__wtr pool_mgr__wtr = new Xoh_pool_mgr__wtr();
|
||||
public Xoh_stat_itm Hzip__stat() {return hzip__stat;} private final Xoh_stat_itm hzip__stat = new Xoh_stat_itm();
|
||||
public Xohz_tag_regy Hzip__xnde__regy() {return hzip__xnde__regy;} private final Xohz_tag_regy hzip__xnde__regy = Xohz_tag_regy_.New_dflt();
|
||||
public Xoh_xnde_dict_reg Hzip__xnde__dict() {return hzip__xnde__dict;} private final Xoh_xnde_dict_reg hzip__xnde__dict = new Xoh_xnde_dict_reg();
|
||||
public Xoh_pool_mgr__hzip Pool_mgr__hzip() {return pool_mgr__hzip;} private final Xoh_pool_mgr__hzip pool_mgr__hzip = new Xoh_pool_mgr__hzip();
|
||||
public Xoh_pool_mgr__data Pool_mgr__data() {return pool_mgr__data;} private final Xoh_pool_mgr__data pool_mgr__data = new Xoh_pool_mgr__data();
|
||||
public Xoh_pool_mgr__wtr Pool_mgr__wtr() {return pool_mgr__wtr;} private final Xoh_pool_mgr__wtr pool_mgr__wtr = new Xoh_pool_mgr__wtr();
|
||||
public Xoh_stat_itm Hzip__stat() {return hzip__stat;} private final Xoh_stat_itm hzip__stat = new Xoh_stat_itm();
|
||||
public Xohz_tag_regy Hzip__xnde__regy() {return hzip__xnde__regy;} private final Xohz_tag_regy hzip__xnde__regy = Xohz_tag_regy_.New_dflt();
|
||||
public Xoh_xnde_dict_reg Hzip__xnde__dict() {return hzip__xnde__dict;} private final Xoh_xnde_dict_reg hzip__xnde__dict = new Xoh_xnde_dict_reg();
|
||||
public int Uid__lnki_nxt() {return ++uid__lnki;} private int uid__lnki;
|
||||
public int Uid__gly__nxt() {return ++uid__gly;} private int uid__gly;
|
||||
public boolean Mode_is_diff() {return mode_is_diff;} private boolean mode_is_diff; public void Mode_is_diff_(boolean v) {mode_is_diff = v;}
|
||||
@@ -69,5 +69,5 @@ public class Xoh_hdoc_ctx {
|
||||
this.uid__gly = -1;
|
||||
}
|
||||
public static final int Invalid = -1;
|
||||
private static final byte[] Fsys__res__drd = Bry_.new_a7("file:///android_asset/xowa/");
|
||||
private static final byte[] Fsys__res__drd = Bry_.new_a7("file:///android_asset/xowa/");
|
||||
}
|
||||
|
||||
@@ -16,8 +16,7 @@ You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.htmls.core.wkrs; import gplx.*; import gplx.xowa.*; import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.*;
|
||||
import gplx.langs.htmls.*;
|
||||
import gplx.xowa.htmls.core.hzips.*;
|
||||
import gplx.langs.htmls.*; import gplx.xowa.htmls.core.hzips.*;
|
||||
public class Xoh_hzip_fxt {
|
||||
private final Xowe_wiki wiki;
|
||||
private final Xop_fxt parser_fxt = new Xop_fxt();
|
||||
@@ -26,7 +25,6 @@ public class Xoh_hzip_fxt {
|
||||
private final Xoh_page hpg = new Xoh_page();
|
||||
private boolean mode_is_b256;
|
||||
public Xoh_hzip_fxt() {
|
||||
gplx.core.envs.Op_sys.Cur_is_drd_(); // force drd mode; needed for img_bare
|
||||
this.wiki = parser_fxt.Wiki();
|
||||
Xoa_app_fxt.repo2_(parser_fxt.App(), wiki); // needed else will be old "mem/wiki/repo/trg/thumb/" instead of standard "mem/file/en.wikipedia.org/thumb/"
|
||||
wiki.Html__hdump_mgr().Init_by_db(parser_fxt.Wiki());
|
||||
@@ -39,7 +37,7 @@ public class Xoh_hzip_fxt {
|
||||
public void Clear() {hpg.Clear();}
|
||||
public void Init_wiki_installed(String domain) {parser_fxt.Init_xwiki_add_user_(domain);}
|
||||
public Xowe_wiki Init_wiki_alias(String alias, String domain) {
|
||||
Xowe_wiki rv = Xoa_app_fxt.wiki_(parser_fxt.App(), domain);
|
||||
Xowe_wiki rv = Xoa_app_fxt.Make__wiki__edit(parser_fxt.App(), domain);
|
||||
parser_fxt.Wiki().Xwiki_mgr().Add_by_atrs(Bry_.new_u8(alias), Bry_.new_u8(domain), null);
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -25,8 +25,8 @@ public abstract class Xoh_itm_parser_fxt {
|
||||
protected byte[] src; protected int src_len;
|
||||
protected final Xoh_hdoc_ctx hctx = new Xoh_hdoc_ctx();
|
||||
public Xoh_itm_parser_fxt() {
|
||||
this.app = Xoa_app_fxt.app_();
|
||||
this.wiki = Xoa_app_fxt.wiki_tst_(app);
|
||||
this.app = Xoa_app_fxt.Make__app__edit();
|
||||
this.wiki = Xoa_app_fxt.Make__wiki__edit(app);
|
||||
hctx.Init_by_app(app);
|
||||
}
|
||||
private Xoh_itm_parser Parser() {return Parser_get();}
|
||||
|
||||
@@ -17,36 +17,36 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
//namespace gplx.xowa.htmls.core.wkrs.bfr_args {
|
||||
// using gplx.xowa.htmls.hrefs; using gplx.xowa.wikis.nss;
|
||||
// public class Bfr_arg__href : gplx.core.brys.Bfr_arg_clearable {
|
||||
// private byte[] val; private int val_bgn, val_end;
|
||||
// private int href_type;
|
||||
//// public void Clear() {
|
||||
//// href_type = Tid__null;
|
||||
//// }
|
||||
// public void Set_by_atr(gplx.langs.htmls.docs.Gfh_atr atr) {Set_by_mid(atr.Src(), atr.Val_bgn(), atr.Val_end());}
|
||||
// public void Set_by_mid(byte[] v, int bgn, int end) {this.val = v; this.href_type = Tid__mid; this.val_bgn = bgn; this.val_end = end;}
|
||||
// public void Set_by_raw(byte[] v) {this.val = v; this.href_type = Tid__raw;}
|
||||
// public void Set_by_page(byte[] v) {this.val = v; this.href_type = Tid__page;}
|
||||
// public void Set_by_file(byte[] v) {this.val = v; this.href_type = Tid__file;}
|
||||
// public void Bfr_arg__add(Bry_bfr bfr) {
|
||||
// if (val == null) return;
|
||||
// switch (href_type) {
|
||||
// case Tid__raw:
|
||||
// bfr.Add(val);
|
||||
// break;
|
||||
// case Tid__mid:
|
||||
// bfr.Add_mid(val, val_bgn, val_end);
|
||||
// break;
|
||||
// case Tid__page:
|
||||
// bfr.Add(Xoh_href_.Bry__wiki); // '/wiki/'
|
||||
// bfr.Add(val); // 'File:A.png'
|
||||
// break;
|
||||
// case Tid__file:
|
||||
// bfr.Add(Xoh_href_.Bry__wiki).Add(Xow_ns_.Bry__file).Add_byte_colon();
|
||||
// bfr.Add(val);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// private static final int Tid__null = 0, Tid__raw = 1, Tid__page = 2, Tid__file = 3, Tid__mid = 4;
|
||||
// }
|
||||
// public class Bfr_arg__href : gplx.core.brys.Bfr_arg_clearable {
|
||||
// private byte[] val; private int val_bgn, val_end;
|
||||
// private int href_type;
|
||||
//// public void Clear() {
|
||||
//// href_type = Tid__null;
|
||||
//// }
|
||||
// public void Set_by_atr(gplx.langs.htmls.docs.Gfh_atr atr) {Set_by_mid(atr.Src(), atr.Val_bgn(), atr.Val_end());}
|
||||
// public void Set_by_mid(byte[] v, int bgn, int end) {this.val = v; this.href_type = Tid__mid; this.val_bgn = bgn; this.val_end = end;}
|
||||
// public void Set_by_raw(byte[] v) {this.val = v; this.href_type = Tid__raw;}
|
||||
// public void Set_by_page(byte[] v) {this.val = v; this.href_type = Tid__page;}
|
||||
// public void Set_by_file(byte[] v) {this.val = v; this.href_type = Tid__file;}
|
||||
// public void Bfr_arg__add(Bry_bfr bfr) {
|
||||
// if (val == null) return;
|
||||
// switch (href_type) {
|
||||
// case Tid__raw:
|
||||
// bfr.Add(val);
|
||||
// break;
|
||||
// case Tid__mid:
|
||||
// bfr.Add_mid(val, val_bgn, val_end);
|
||||
// break;
|
||||
// case Tid__page:
|
||||
// bfr.Add(Xoh_href_.Bry__wiki); // '/wiki/'
|
||||
// bfr.Add(val); // 'File:A.png'
|
||||
// break;
|
||||
// case Tid__file:
|
||||
// bfr.Add(Xoh_href_.Bry__wiki).Add(Xow_ns_.Bry__file).Add_byte_colon();
|
||||
// bfr.Add(val);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// private static final int Tid__null = 0, Tid__raw = 1, Tid__page = 2, Tid__file = 3, Tid__mid = 4;
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -106,4 +106,4 @@ class Bfr_arg__hatr_gly_style implements Bfr_arg {
|
||||
, Style__frag_2 = Bry_.new_a7("_width:")
|
||||
, Style__frag_3 = Bry_.new_a7("px;")
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,6 @@ public class Xoh_gly_hzip implements Xoh_hzip_wkr, Gfo_poolable_itm {
|
||||
boolean xtra_style = flag_bldr.Set_as_bool(Flag__ul__xtra_style , data.Xtra_style_exists());
|
||||
flag_bldr.Set(Flag__gly_tid, data.Gly_tid());
|
||||
int itms_len = data.Itms__len();
|
||||
|
||||
bfr.Add(hook);
|
||||
Gfo_hzip_int_.Encode(1, bfr, flag_bldr.Encode());
|
||||
Gfo_hzip_int_.Encode(1, bfr, ul_style_max_w);
|
||||
|
||||
@@ -25,7 +25,6 @@ public class Xoh_img_bare_hzip implements Xoh_hzip_wkr, Gfo_poolable_itm {
|
||||
public Gfo_poolable_itm Encode1(Xoh_hzip_bfr bfr, Xoh_hdoc_wkr hdoc_wkr, Xoh_hdoc_ctx hctx, Xoh_page hpg, boolean wkr_is_root, byte[] src, Object data_obj) {
|
||||
Xoh_img_bare_data data = (Xoh_img_bare_data)data_obj;
|
||||
int img_tid = flag_bldr.Set_as_int(Flag__img_tid , data.Img_tid());
|
||||
|
||||
bfr.Add(hook);
|
||||
Gfo_hzip_int_.Encode(1, bfr, flag_bldr.Encode());
|
||||
switch (img_tid) {
|
||||
@@ -38,10 +37,8 @@ public class Xoh_img_bare_hzip implements Xoh_hzip_wkr, Gfo_poolable_itm {
|
||||
}
|
||||
public void Decode1(Bry_bfr bfr, Xoh_hdoc_wkr hdoc_wkr, Xoh_hdoc_ctx hctx, Xoh_page hpg, Bry_rdr rdr, byte[] src, int src_bgn, int src_end, Xoh_data_itm data_itm) {
|
||||
Xoh_img_bare_data data = (Xoh_img_bare_data)data_itm; data.Clear();
|
||||
|
||||
int flag = rdr.Read_hzip_int(1); flag_bldr.Decode(flag);
|
||||
int dir_tid = flag_bldr.Get_as_int(Flag__img_tid);
|
||||
|
||||
switch (dir_tid) {
|
||||
case Xoh_img_bare_data.Img_tid__hiero:
|
||||
int tag_0_bgn = rdr.Pos(), tag_0_end = rdr.Find_fwd_lr();
|
||||
|
||||
@@ -16,10 +16,18 @@ You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.htmls.core.wkrs.imgs; 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.hzips.*;
|
||||
import org.junit.*; import gplx.core.envs.*; import gplx.xowa.htmls.core.hzips.*;
|
||||
public class Xoh_img_bare_hzip__tst {
|
||||
private final Xoh_hzip_fxt fxt = new Xoh_hzip_fxt().Init_mode_diff_y_();
|
||||
@Before public void Clear() {fxt.Clear();}
|
||||
private int prv_os_tid = -1;
|
||||
@Before public void init() {
|
||||
fxt.Clear();
|
||||
prv_os_tid = Op_sys.Cur().Tid();
|
||||
Op_sys.Cur_(Op_sys.Drd.Tid()); // force drd mode; needed for img_bare
|
||||
}
|
||||
@After public void term() {
|
||||
Op_sys.Cur_(prv_os_tid); // revert back to previous mode; otherwise global Op_sys is set to Drd which will cause other tests to fail (notably tidy)
|
||||
}
|
||||
@Test public void Hiero() {
|
||||
fxt.Test__bicode
|
||||
( "~(!<img style=\"margin: 1px; height: 11px;\" src=\"~X1.png\" title=\"X1 [t]\" alt=\"t\">~"
|
||||
|
||||
@@ -45,7 +45,6 @@ public class Xoh_img_hzip implements Xoh_hzip_wkr, Gfo_poolable_itm {
|
||||
boolean img__alt_diff_from_anch_title = data.Img_alt__diff__anch_title();
|
||||
boolean file__src_exists = !img_xoimg.Val_dat_exists();
|
||||
boolean anch_href_diff_file = !img_wo_anch && !Bry_.Match(anch_page.Val(), anch_page.Val_bgn(), anch_page.Val_end(), anch_href.Ttl_page_db());
|
||||
|
||||
boolean img__imap_exists = flag_bldr.Set_as_bool(Flag__img__imap_exists , data.Img_imap_idx() != -1);
|
||||
flag_bldr.Set(Flag__img__wo_anch , img_wo_anch);
|
||||
flag_bldr.Set(Flag__img__is_vid , data.Img_is_vid());
|
||||
@@ -65,7 +64,6 @@ public class Xoh_img_hzip implements Xoh_hzip_wkr, Gfo_poolable_itm {
|
||||
flag_bldr.Set(Flag__img__cls_tid , img_cls.Cls_tid());
|
||||
flag_bldr.Set(Flag__anch__href_tid , anch_href.Tid());
|
||||
// Tfds.Dbg(flag_bldr.Encode(), Array_.To_str(flag_bldr.Val_ary()));
|
||||
|
||||
if (wkr_is_root) bfr.Add(hook);
|
||||
Gfo_hzip_int_.Encode(2, bfr, flag_bldr.Encode());
|
||||
if (img_wo_anch) bfr.Add_hzip_mid(anch_page.Val(), anch_page.Val_bgn(), anch_page.Val_end());
|
||||
@@ -116,7 +114,6 @@ public class Xoh_img_hzip implements Xoh_hzip_wkr, Gfo_poolable_itm {
|
||||
}
|
||||
public void Decode1(Bry_bfr bfr, Xoh_hdoc_wkr hdoc_wkr, Xoh_hdoc_ctx hctx, Xoh_page hpg, Bry_rdr rdr, byte[] src, int src_bgn, int src_end, Xoh_data_itm data_itm) {
|
||||
Xoh_img_data data = (Xoh_img_data)data_itm; data.Clear();
|
||||
|
||||
int flag = rdr.Read_hzip_int(2); flag_bldr.Decode(flag);
|
||||
boolean img_imap_exists = flag_bldr.Get_as_bool(Flag__img__imap_exists);
|
||||
boolean img_wo_anch = flag_bldr.Get_as_bool(Flag__img__wo_anch);
|
||||
@@ -154,7 +151,6 @@ public class Xoh_img_hzip implements Xoh_hzip_wkr, Gfo_poolable_itm {
|
||||
byte[] ns_custom_bry = null;
|
||||
if (anch__ns_is_custom) ns_custom_bry = rdr.Read_bry_to();
|
||||
int img_w = -1, img_h = -1, file_time = -1, file_page = -1;
|
||||
|
||||
if (file__src_exists) {
|
||||
img_w = rdr.Read_hzip_int(2) - Gfo_hzip_int_.Neg_1_adj;
|
||||
img_h = rdr.Read_hzip_int(2) - Gfo_hzip_int_.Neg_1_adj;
|
||||
@@ -181,7 +177,6 @@ public class Xoh_img_hzip implements Xoh_hzip_wkr, Gfo_poolable_itm {
|
||||
img_cls_other_end = rdr.Find_fwd_lr();
|
||||
}
|
||||
int img_imap_idx = img_imap_exists ? rdr.Read_hzip_int(1) : -1;
|
||||
|
||||
// transform values
|
||||
boolean anch_rel_is_nofollow = false;
|
||||
if (anch__href_tid == Xoh_anch_href_data.Tid__inet) {// external links should get rel=nofollow
|
||||
@@ -225,7 +220,6 @@ public class Xoh_img_hzip implements Xoh_hzip_wkr, Gfo_poolable_itm {
|
||||
}
|
||||
}
|
||||
this.anch_href_bry = tmp_bfr.To_bry_and_clear();
|
||||
|
||||
// NOTE: src must go underneath ttl
|
||||
Xof_url_bldr url_bldr = hctx.File__url_bldr();
|
||||
url_bldr.Init_by_root(file__repo_is_local ? hctx.Fsys__file__wiki() : hctx.Fsys__file__comm(), Byte_ascii.Slash, false, false, Md5_depth);
|
||||
|
||||
@@ -27,13 +27,11 @@ public class Xoh_lnke_hzip implements Xoh_hzip_wkr, Gfo_poolable_itm {
|
||||
boolean auto_exists = flag_bldr.Set_as_bool(Flag__auto_exists , data.Auto_exists());
|
||||
boolean capt_exists = flag_bldr.Set_as_bool(Flag__capt_exists , data.Capt_exists());
|
||||
byte lnke_tid = flag_bldr.Set_as_byte(Flag__lnke_tid , data.Lnke_tid());
|
||||
|
||||
bfr.Add(hook);
|
||||
bfr.Add_hzip_int(1, flag_bldr.Encode()); // add flag
|
||||
bfr.Add_hzip_mid(src, data.Href_bgn(), data.Href_end()); // add href
|
||||
if (auto_exists) bfr.Add_hzip_int(1, data.Auto_id()); // add autonumber
|
||||
if (capt_exists) bfr.Add_hzip_mid(src, data.Capt_bgn(), data.Capt_end()); // add caption
|
||||
|
||||
hctx.Hzip__stat().Lnke_add(lnke_tid);
|
||||
return this;
|
||||
}
|
||||
@@ -42,12 +40,10 @@ public class Xoh_lnke_hzip implements Xoh_hzip_wkr, Gfo_poolable_itm {
|
||||
boolean auto_exists = flag_bldr.Get_as_bool(Flag__auto_exists);
|
||||
boolean capt_exists = flag_bldr.Get_as_bool(Flag__capt_exists);
|
||||
byte lnke_tid = flag_bldr.Get_as_byte(Flag__lnke_tid);
|
||||
|
||||
int href_bgn = rdr.Pos(); int href_end = rdr.Find_fwd_lr();
|
||||
int auto_id = -1, capt_bgn = -1, capt_end = -1;
|
||||
if (auto_exists) auto_id = rdr.Read_hzip_int(1);
|
||||
if (capt_exists) {capt_bgn = rdr.Pos(); capt_end = rdr.Find_fwd_lr();}
|
||||
|
||||
Xoh_lnke_data data = (Xoh_lnke_data)data_itm;
|
||||
data.Init_by_decode(lnke_tid, auto_id, href_bgn, href_end, capt_bgn, capt_end, capt_exists);
|
||||
}
|
||||
|
||||
@@ -18,83 +18,83 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//namespace gplx.xowa.htmls.core.hzips.wkrs {
|
||||
// using gplx.core.btries;
|
||||
// using gplx.xowa.htmls.core.hzips;
|
||||
// public class Xoh_hzip_href {
|
||||
// public void Save(Bry_bfr bfr, Xoh_stat_itm stats, byte[] src, int src_len, int bgn, int pos, byte bgn_quote) {
|
||||
//// // ignore anchors; EX: "#a"
|
||||
//// int proto_bgn = pos;
|
||||
//// int proto_end = Bry_find_.Find_fwd(src, Byte_ascii.Colon, proto_bgn, src_len);
|
||||
//// byte proto_tid = Tid_proto_other;
|
||||
//// if (proto_end != Bry_find_.Not_found) {
|
||||
//// Object proto_obj = proto_trie.Match_exact(src, pos, proto_bgn);
|
||||
//// if (proto_obj != null)
|
||||
//// proto_tid = ((Byte_obj_val)proto_obj).Val();
|
||||
//// pos = Bry_find_.Find_fwd_while(src, proto_bgn + 1, src_len, Byte_ascii.Slash); // eat /; EX: http:// should position after /
|
||||
//// }
|
||||
//// // stats.Lnke_proto_reg(proto_tid, src, proto_bgn, proto_end);
|
||||
////
|
||||
//// int domain_bgn = pos;
|
||||
//// int domain_end = Bry_find_.Find_fwd(src, Byte_ascii.Slash, domain_bgn, src_len);
|
||||
//// if (domain_end == Bry_find_.Not_found) // href has no slash; assume entire String is domain EX: "www.a.org"
|
||||
//// domain_end = Bry_find_.Find_fwd(src, bgn_quote, pos, src_len);
|
||||
////
|
||||
//// int tld_pos = Bry_find_.Find_bwd(src, Byte_ascii.Dot, domain_bgn, src_len);
|
||||
//// byte tld_tid = Tid_tld_other;
|
||||
//// if (tld_pos != Bry_find_.Not_found) {
|
||||
//// Object tld_obj = tld_trie.Match_exact(src, domain_bgn, domain_end);
|
||||
//// if (tld_obj != null)
|
||||
//// tld_tid = ((Byte_obj_val)tld_obj).Val();
|
||||
//// pos = Bry_find_.Find_fwd_while(src, domain_bgn + 1, src_len, Byte_ascii.Slash); // eat /; EX: http:// should position after /
|
||||
//// }
|
||||
//// // stats.Lnke_tld_reg(tld_tid, src, domain_bgn, domain_end);
|
||||
// }
|
||||
// public static final byte // 2
|
||||
// Tid_proto_other = 0
|
||||
// , Tid_proto_http = 1
|
||||
// , Tid_proto_https = 2
|
||||
// ;
|
||||
// public static final byte // 3
|
||||
// Tid_tld_other = 0
|
||||
// , Tid_tld_com = 1
|
||||
// , Tid_tld_org = 2
|
||||
// , Tid_tld_net = 3
|
||||
// , Tid_tld_gov = 4
|
||||
// ;
|
||||
// public static final byte // 3
|
||||
// Tid_ext_other = 0
|
||||
// , Tid_ext_none = 1
|
||||
// , Tid_ext_htm = 2
|
||||
// , Tid_ext_html = 3
|
||||
// , Tid_ext_php = 4
|
||||
// , Tid_ext_jsp = 5
|
||||
// , Tid_ext_asp = 6
|
||||
// , Tid_ext_aspx = 7
|
||||
// ;
|
||||
//// private static final Btrie_slim_mgr proto_trie = Btrie_slim_mgr.ci_a7()
|
||||
//// .Add_str_byte("http", Tid_proto_http)
|
||||
//// .Add_str_byte("https", Tid_proto_http)
|
||||
//// ;
|
||||
//// private static final Btrie_slim_mgr tld_trie = Btrie_slim_mgr.ci_a7()
|
||||
//// .Add_str_byte("com", Tid_tld_com)
|
||||
//// .Add_str_byte("org", Tid_tld_org)
|
||||
//// .Add_str_byte("net", Tid_tld_net)
|
||||
//// .Add_str_byte("gov", Tid_tld_gov)
|
||||
//// ;
|
||||
//// private static final Btrie_slim_mgr ext_trie = Btrie_slim_mgr.ci_a7()
|
||||
//// .Add_str_byte("htm", Tid_ext_htm)
|
||||
//// .Add_str_byte("html", Tid_ext_html)
|
||||
//// .Add_str_byte("php", Tid_ext_php)
|
||||
//// .Add_str_byte("jsp", Tid_ext_jsp)
|
||||
//// .Add_str_byte("asp", Tid_ext_asp)
|
||||
//// .Add_str_byte("aspx", Tid_ext_aspx)
|
||||
//// ;
|
||||
// // <a href="/site/simple.wikipedia.org/wiki/Template:Solar_System?action=edit"><span title="Edit this template" style="">e</span></a> // xwiki [[simple:xx
|
||||
// // <a href="http://planetarynames.wr.usgs.gov/jsp/append5.jsp" class="external text" rel="nofollow">"Descriptor Terms (Feature Types)"</a>
|
||||
// /*
|
||||
// 0: proto,tld,ext
|
||||
// 1-n: domain
|
||||
// n: 0: domain_end
|
||||
// n: url remainder
|
||||
// n: 0: url_end
|
||||
// */
|
||||
// }
|
||||
// public class Xoh_hzip_href {
|
||||
// public void Save(Bry_bfr bfr, Xoh_stat_itm stats, byte[] src, int src_len, int bgn, int pos, byte bgn_quote) {
|
||||
//// // ignore anchors; EX: "#a"
|
||||
//// int proto_bgn = pos;
|
||||
//// int proto_end = Bry_find_.Find_fwd(src, Byte_ascii.Colon, proto_bgn, src_len);
|
||||
//// byte proto_tid = Tid_proto_other;
|
||||
//// if (proto_end != Bry_find_.Not_found) {
|
||||
//// Object proto_obj = proto_trie.Match_exact(src, pos, proto_bgn);
|
||||
//// if (proto_obj != null)
|
||||
//// proto_tid = ((Byte_obj_val)proto_obj).Val();
|
||||
//// pos = Bry_find_.Find_fwd_while(src, proto_bgn + 1, src_len, Byte_ascii.Slash); // eat /; EX: http:// should position after /
|
||||
//// }
|
||||
//// // stats.Lnke_proto_reg(proto_tid, src, proto_bgn, proto_end);
|
||||
////
|
||||
//// int domain_bgn = pos;
|
||||
//// int domain_end = Bry_find_.Find_fwd(src, Byte_ascii.Slash, domain_bgn, src_len);
|
||||
//// if (domain_end == Bry_find_.Not_found) // href has no slash; assume entire String is domain EX: "www.a.org"
|
||||
//// domain_end = Bry_find_.Find_fwd(src, bgn_quote, pos, src_len);
|
||||
////
|
||||
//// int tld_pos = Bry_find_.Find_bwd(src, Byte_ascii.Dot, domain_bgn, src_len);
|
||||
//// byte tld_tid = Tid_tld_other;
|
||||
//// if (tld_pos != Bry_find_.Not_found) {
|
||||
//// Object tld_obj = tld_trie.Match_exact(src, domain_bgn, domain_end);
|
||||
//// if (tld_obj != null)
|
||||
//// tld_tid = ((Byte_obj_val)tld_obj).Val();
|
||||
//// pos = Bry_find_.Find_fwd_while(src, domain_bgn + 1, src_len, Byte_ascii.Slash); // eat /; EX: http:// should position after /
|
||||
//// }
|
||||
//// // stats.Lnke_tld_reg(tld_tid, src, domain_bgn, domain_end);
|
||||
// }
|
||||
// public static final byte // 2
|
||||
// Tid_proto_other = 0
|
||||
// , Tid_proto_http = 1
|
||||
// , Tid_proto_https = 2
|
||||
// ;
|
||||
// public static final byte // 3
|
||||
// Tid_tld_other = 0
|
||||
// , Tid_tld_com = 1
|
||||
// , Tid_tld_org = 2
|
||||
// , Tid_tld_net = 3
|
||||
// , Tid_tld_gov = 4
|
||||
// ;
|
||||
// public static final byte // 3
|
||||
// Tid_ext_other = 0
|
||||
// , Tid_ext_none = 1
|
||||
// , Tid_ext_htm = 2
|
||||
// , Tid_ext_html = 3
|
||||
// , Tid_ext_php = 4
|
||||
// , Tid_ext_jsp = 5
|
||||
// , Tid_ext_asp = 6
|
||||
// , Tid_ext_aspx = 7
|
||||
// ;
|
||||
//// private static final Btrie_slim_mgr proto_trie = Btrie_slim_mgr.ci_a7()
|
||||
//// .Add_str_byte("http", Tid_proto_http)
|
||||
//// .Add_str_byte("https", Tid_proto_http)
|
||||
//// ;
|
||||
//// private static final Btrie_slim_mgr tld_trie = Btrie_slim_mgr.ci_a7()
|
||||
//// .Add_str_byte("com", Tid_tld_com)
|
||||
//// .Add_str_byte("org", Tid_tld_org)
|
||||
//// .Add_str_byte("net", Tid_tld_net)
|
||||
//// .Add_str_byte("gov", Tid_tld_gov)
|
||||
//// ;
|
||||
//// private static final Btrie_slim_mgr ext_trie = Btrie_slim_mgr.ci_a7()
|
||||
//// .Add_str_byte("htm", Tid_ext_htm)
|
||||
//// .Add_str_byte("html", Tid_ext_html)
|
||||
//// .Add_str_byte("php", Tid_ext_php)
|
||||
//// .Add_str_byte("jsp", Tid_ext_jsp)
|
||||
//// .Add_str_byte("asp", Tid_ext_asp)
|
||||
//// .Add_str_byte("aspx", Tid_ext_aspx)
|
||||
//// ;
|
||||
// // <a href="/site/simple.wikipedia.org/wiki/Template:Solar_System?action=edit"><span title="Edit this template" style="">e</span></a> // xwiki [[simple:xx
|
||||
// // <a href="http://planetarynames.wr.usgs.gov/jsp/append5.jsp" class="external text" rel="nofollow">"Descriptor Terms (Feature Types)"</a>
|
||||
// /*
|
||||
// 0: proto,tld,ext
|
||||
// 1-n: domain
|
||||
// n: 0: domain_end
|
||||
// n: url remainder
|
||||
// n: 0: url_end
|
||||
// */
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -40,7 +40,6 @@ public class Xoh_lnki_hzip implements Xoh_hzip_wkr, Gfo_poolable_itm {
|
||||
flag_bldr.Set_as_int(Flag__capt_cs0_tid , data.Capt_itm().Cs0_tid());
|
||||
byte text_type = flag_bldr.Set_as_byte(Flag__text_type , data.Text_tid());
|
||||
// Tfds.Dbg(flag_bldr.Encode(), Array_.To_str(flag_bldr.Val_ary()), text_type);
|
||||
|
||||
int bfr_bgn = bfr.Len();
|
||||
int flag = flag_bldr.Encode();
|
||||
bfr.Add(hook);
|
||||
@@ -60,7 +59,6 @@ public class Xoh_lnki_hzip implements Xoh_hzip_wkr, Gfo_poolable_itm {
|
||||
break;
|
||||
}
|
||||
if (title_tid == Xoh_lnki_data.Title__diff) bfr.Add_hzip_mid(src, data.Title_bgn(), data.Title_end());
|
||||
|
||||
hctx.Hzip__stat().Lnki_add(data.Src_end() - data.Src_bgn(), bfr.Len() - bfr_bgn, flag);
|
||||
return this;
|
||||
}
|
||||
@@ -77,7 +75,6 @@ public class Xoh_lnki_hzip implements Xoh_hzip_wkr, Gfo_poolable_itm {
|
||||
int capt_cs0_tid = flag_bldr.Get_as_int(Flag__capt_cs0_tid);
|
||||
byte text_type = flag_bldr.Get_as_byte(Flag__text_type);
|
||||
// Tfds.Dbg(cls_tid, title_missing_ns, ttl_is_main_page, ns_custom_exists, title_tid, capt_has_ns, ns_is_not_main, href_type, capt_cs0_tid, text_type);
|
||||
|
||||
int site_bgn = -1, site_end = -1; if (href_type == Xoh_anch_href_data.Tid__site) {site_bgn = rdr.Pos(); site_end = rdr.Find_fwd_lr();}
|
||||
int ns_id = ns_is_not_main ? Xoh_lnki_dict_.Ns_decode(rdr) : Xow_ns_.Tid__main;
|
||||
byte[] ns_custom_bry = ns_custom_exists ? rdr.Read_bry_to() : null;
|
||||
@@ -143,7 +140,6 @@ public class Xoh_lnki_hzip implements Xoh_hzip_wkr, Gfo_poolable_itm {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// gen html
|
||||
bfr.Add(Gfh_bldr_.Bry__a_lhs_w_href);
|
||||
switch (href_type) {
|
||||
|
||||
@@ -36,8 +36,8 @@ class Xoh_anch_capt_itm_fxt {
|
||||
private final Xoh_anch_capt_itm matcher = new Xoh_anch_capt_itm();
|
||||
private final Bry_rdr rdr = new Bry_rdr();
|
||||
public Xoh_anch_capt_itm_fxt() {
|
||||
Xoae_app app = Xoa_app_fxt.app_();
|
||||
this.wiki = Xoa_app_fxt.wiki_tst_(app);
|
||||
Xoae_app app = Xoa_app_fxt.Make__app__edit();
|
||||
this.wiki = Xoa_app_fxt.Make__wiki__edit(app);
|
||||
}
|
||||
public Xow_wiki Wiki() {return wiki;} private Xow_wiki wiki;
|
||||
public void Test__match(String page_str, String capt_str, int expd_tid) {Test__match(page_str, capt_str, expd_tid, -1);}
|
||||
|
||||
@@ -293,7 +293,7 @@ public class Xoh_file_wtr__image__tst {
|
||||
( "<img id=\"xoimg_0\" alt=\"abc\" src=\"file:///mem/wiki/repo/trg/thumb/7/0/A.png/11px.png\" width=\"11\" height=\"0\" />"
|
||||
));
|
||||
}
|
||||
@Test public void Link__lc() { // links to items in same namespace should automatically title-case words; DATE:2016-01-11
|
||||
@Test public void Link__lc() { // links to items in same Srch_rslt_cbk should automatically title-case words; DATE:2016-01-11
|
||||
fxt.Init_xwiki_add_wiki_and_user_("en", "en.wikipedia.org");
|
||||
fxt.Test_parse_page_wiki_str
|
||||
( "[[File:A.png|11px|link=en:Help:a?b=c#d|abc]]", String_.Concat_lines_nl_skip_last
|
||||
|
||||
@@ -48,7 +48,7 @@ public class Xoh_lnki_title_fmtr implements gplx.core.brys.Bfr_arg {
|
||||
default: // all other tkns, just iterate over subs for txt tkns
|
||||
if (tkn.Tkn_tid() == Xop_tkn_itm_.Tid_xnde) {
|
||||
Xop_xnde_tkn xnde = (Xop_xnde_tkn)tkn;
|
||||
if (xnde.Tag().Id() == Xop_xnde_tag_.Tid_ref) { // if ref, disable tkn
|
||||
if (xnde.Tag().Id() == Xop_xnde_tag_.Tid__ref) { // if ref, disable tkn
|
||||
gplx.xowa.xtns.cites.Ref_nde ref_xnde = (gplx.xowa.xtns.cites.Ref_nde)xnde.Xnde_xtn();
|
||||
ref_xnde.Exists_in_lnki_title_(true); // ref found during html_title_wkr's generation; mark ref; will be ignored by references_html_wtr later; DATE:2014-03-05
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ public class Xoh_lnki_wtr {
|
||||
private void Write_plain(Bry_bfr bfr, Xoh_wtr_ctx hctx, byte[] src, Xop_lnki_tkn lnki, Xoa_ttl lnki_ttl, Xop_lnki_caption_wtr caption_wkr) {
|
||||
byte[] ttl_bry = lnki.Ttl_ary();
|
||||
if (Bry_.Len_eq_0(ttl_bry)) ttl_bry = lnki_ttl.Full_txt_raw(); // NOTE: handles ttls like [[fr:]] and [[:fr;]] which have an empty Page_txt, but a valued Full_txt_raw
|
||||
if (Bry_.Eq(lnki_ttl.Full_txt(), page.Ttl().Full_txt())) { // lnki is same as pagename; bold; SEE: Month widget on day pages will bold current day; PAGE:en.w:January 1
|
||||
if (Bry_.Eq(lnki_ttl.Full_txt_by_orig(), page.Ttl().Full_txt_by_orig())) { // lnki is same as pagename; bold; SEE: Month widget on day pages will bold current day; PAGE:en.w:January 1
|
||||
if (lnki_ttl.Anch_bgn() == -1 && Bry_.Eq(lnki_ttl.Wik_txt(), page.Ttl().Wik_txt())) { // only bold if lnki is not pointing to anchor on same page; PAGE:en.w:Comet; [[Comet#Physical characteristics|ion tail]]
|
||||
bfr.Add(Gfh_tag_.B_lhs);
|
||||
Write_caption(bfr, ctx, hctx, src, lnki, ttl_bry, true, caption_wkr);
|
||||
@@ -109,13 +109,19 @@ public class Xoh_lnki_wtr {
|
||||
.Add_int_variable(lnki_html_id); // '1234'
|
||||
}
|
||||
if (cfg.Lnki__title()) {
|
||||
byte[] title_bry = lnki_ttl.Full_txt(); // NOTE: use Full_txt to (a) replace underscores with spaces; (b) get title casing; EX:[[roman_empire]] -> Roman empire; (c) include ns_name; EX: Help:A -> "title='Help:A'" not "title='A'"; DATE:2015-11-16
|
||||
byte[] title_bry = lnki_ttl.Full_txt_w_ttl_case(); // NOTE: use Full_txt to (a) replace underscores with spaces; (b) get title casing; EX:[[roman_empire]] -> Roman empire; (c) include ns_name; EX: Help:A -> "title='Help:A'" not "title='A'"; DATE:2015-11-16
|
||||
int title_len = title_bry.length;
|
||||
if (title_len > 0) {
|
||||
bfr .Add(Gfh_bldr_.Bry__title__nth); // '" title=\"'
|
||||
Gfh_utl.Escape_html_to_bfr(bfr, title_bry, 0, title_len, Bool_.N, Bool_.N, Bool_.N, Bool_.Y, Bool_.N); // escape title; DATE:2014-10-27
|
||||
}
|
||||
}
|
||||
if (wiki.Domain_tid() == gplx.xowa.wikis.domains.Xow_domain_tid_.Int__other) {
|
||||
if (lnki.Target != null) {
|
||||
bfr.Add_str_a7("\" target=\"");
|
||||
bfr.Add(lnki.Target);
|
||||
}
|
||||
}
|
||||
if (!hctx.Mode_is_hdump()) { // don't write visited for hdump
|
||||
if (cfg.Lnki__visited()
|
||||
&& history_mgr.Has(wiki.Domain_bry(), ttl_bry))
|
||||
@@ -172,8 +178,8 @@ public class Xoh_lnki_wtr {
|
||||
}
|
||||
public static byte[] Lnki_cls_visited(gplx.xowa.users.history.Xou_history_mgr history_mgr, byte[] wiki_key, byte[] page_ttl) {
|
||||
return history_mgr.Has(wiki_key, page_ttl) ? Lnki_cls_visited_bry : Bry_.Empty;
|
||||
} private static final byte[] Lnki_cls_visited_bry = Bry_.new_a7(" class=\"xowa-visited\"");
|
||||
private static final byte[] Bry_xowa_visited = Bry_.new_a7("\" class=\"xowa-visited");
|
||||
} private static final byte[] Lnki_cls_visited_bry = Bry_.new_a7(" class=\"xowa-visited\"");
|
||||
private static final byte[] Bry_xowa_visited = Bry_.new_a7("\" class=\"xowa-visited");
|
||||
public static final int Lnki_id_ignore = 0, Lnki_id_min = 1;
|
||||
}
|
||||
interface Xop_lnki_caption_wtr {
|
||||
|
||||
@@ -61,7 +61,6 @@ public class Xoh_thm_hzip implements Xoh_hzip_wkr, Gfo_poolable_itm {
|
||||
capt_1.Mid_(src, capt_1_bgn, capt_1_end);
|
||||
byte[] capt_2_bry = capt_2_exists ? rdr.Read_bry_to() : Bry_.Empty;
|
||||
byte[] capt_3_bry = capt_3_exists ? rdr.Read_bry_to() : Bry_.Empty;
|
||||
|
||||
Xoh_img_data img_data = (Xoh_img_data)hctx.Pool_mgr__data().Get_by_tid(Xoh_hzip_dict_.Tid__img);
|
||||
img_hzip.Decode1(bfr, hdoc_wkr, hctx, hpg, rdr, src, rdr.Pos(), src_end, img_data);
|
||||
img_hzip.Wtr().Init_by_decode(hpg, hctx, src, img_data);
|
||||
|
||||
@@ -302,16 +302,16 @@ public class Xoh_thm_hzip_tst {
|
||||
, "</div>"
|
||||
));
|
||||
}
|
||||
@Test public void Dump() {
|
||||
Xowe_wiki en_d = fxt.Init_wiki_alias("wikt", "en.wiktionary.org");
|
||||
gplx.xowa.wikis.nss.Xow_ns_mgr ns_mgr = en_d.Ns_mgr();
|
||||
ns_mgr.Ns_main().Case_match_(gplx.xowa.wikis.nss.Xow_ns_case_.Tid__all);
|
||||
|
||||
fxt.Wiki().Ns_mgr().Aliases_add(gplx.xowa.wikis.nss.Xow_ns_.Tid__portal, "WP");
|
||||
fxt.Wiki().Ns_mgr().Init();
|
||||
|
||||
fxt.Init_mode_is_b256_(Bool_.N);
|
||||
fxt.Exec_write_to_fsys(Io_url_.new_dir_("J:\\xowa\\research\\html\\"), "debug.html");
|
||||
fxt.Init_mode_is_b256_(Bool_.N);
|
||||
}
|
||||
// @Test public void Dump() {
|
||||
// Xowe_wiki en_d = fxt.Init_wiki_alias("wikt", "en.wiktionary.org");
|
||||
// gplx.xowa.wikis.nss.Xow_ns_mgr ns_mgr = en_d.Ns_mgr();
|
||||
// ns_mgr.Ns_main().Case_match_(gplx.xowa.wikis.nss.Xow_ns_case_.Tid__all);
|
||||
//
|
||||
// fxt.Wiki().Ns_mgr().Aliases_add(gplx.xowa.wikis.nss.Xow_ns_.Tid__portal, "WP");
|
||||
// fxt.Wiki().Ns_mgr().Init();
|
||||
//
|
||||
// fxt.Init_mode_is_b256_(Bool_.N);
|
||||
// fxt.Exec_write_to_fsys(Io_url_.new_dir_("J:\\xowa\\research\\html\\"), "debug.html");
|
||||
// fxt.Init_mode_is_b256_(Bool_.N);
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -72,4 +72,4 @@ public class Xoh_thm_caption_data {
|
||||
}
|
||||
public void Capt_3_(int bgn, int end) {this.capt_3_bgn = bgn; this.capt_3_end = end;}
|
||||
public static final byte[] Bry__div_1_tail_bgn = Bry_.new_a7("\n</div>");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,4 +43,4 @@ public class Xoh_thm_magnify_data {
|
||||
return true;
|
||||
}
|
||||
private static final byte[] Cls__magnify = Bry_.new_a7("magnify");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ public class Xoh_head_mgr implements gplx.core.brys.Bfr_arg {
|
||||
if (page.Hdr_mgr().Toc_enabled()) itm__toc.Enabled_y_();
|
||||
if (wiki.Html_mgr().Head_mgr().Itm__top_icon().Enabled_y()) itm__top_icon.Enabled_y_();
|
||||
if (wiki.Html_mgr().Head_mgr().Itm__title_rewrite().Enabled_y()) itm__title_rewrite.Enabled_y_();
|
||||
if (app.Gui_mgr().Search_suggest_mgr().Enabled()) itm__search_suggest.Enabled_y_();
|
||||
if (app.Gui_mgr().Search_cfg().Enabled()) itm__search_suggest.Enabled_y_();
|
||||
itm__css.Enabled_y_();
|
||||
itm__globals.Enabled_y_(); // for now, always mark this and rest as exists; DATE:2014-06-09
|
||||
itm__collapsible.Enabled_y_();
|
||||
|
||||
@@ -43,8 +43,8 @@ public class Xow_fragment_mgr_tst {
|
||||
class Xow_fragment_mgr_fxt {
|
||||
public void Clear() {
|
||||
if (wiki == null) {
|
||||
Xoae_app app = Xoa_app_fxt.app_();
|
||||
wiki = Xoa_app_fxt.wiki_tst_(app);
|
||||
Xoae_app app = Xoa_app_fxt.Make__app__edit();
|
||||
wiki = Xoa_app_fxt.Make__wiki__edit(app);
|
||||
}
|
||||
} private Xowe_wiki wiki;
|
||||
public Xol_lang_itm Make_lang(String key) {return wiki.Appe().Lang_mgr().Get_by_or_new(Bry_.new_a7(key));}
|
||||
@@ -54,4 +54,4 @@ class Xow_fragment_mgr_fxt {
|
||||
byte[] actl = (byte[])GfoInvkAble_.InvkCmd(wiki.Fragment_mgr(), key);
|
||||
Tfds.Eq_str_lines(expd, String_.new_u8(actl));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ public class Xoh_href_parser {
|
||||
if (ttl == null) // invalid ttl; null out page;
|
||||
tmp_page = Bry_.Empty;
|
||||
else
|
||||
tmp_page = ttl.Full_txt();
|
||||
tmp_page = ttl.Full_txt_w_ttl_case();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -73,7 +73,7 @@ public class Xoh_href_parser {
|
||||
}
|
||||
}
|
||||
private static final byte Seg_wiki_tid = 0, Seg_site_tid = 1, Seg_xcmd_tid = 2;
|
||||
private static final Btrie_slim_mgr btrie = Btrie_slim_mgr.ci_a7() // NOTE:ci.ascii:XO_const.en; /wiki/, /site/ etc.
|
||||
private static final Btrie_slim_mgr btrie = Btrie_slim_mgr.ci_a7() // NOTE:ci.ascii:XO_const.en; /wiki/, /site/ etc.
|
||||
.Add_bry_tid(Xoh_href_.Bry__wiki, Seg_wiki_tid)
|
||||
.Add_bry_tid(Xoh_href_.Bry__site, Seg_site_tid)
|
||||
.Add_bry_tid(Xoh_href_.Bry__xcmd, Seg_xcmd_tid);
|
||||
|
||||
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.htmls.hrefs; import gplx.*; import gplx.xowa.*; import gplx.xowa.htmls.*;
|
||||
import org.junit.*; import gplx.xowa.apps.urls.*; import gplx.xowa.wikis.nss.*;
|
||||
public class Xoh_href_parser_tst {
|
||||
private final Xoh_href_parser_fxt fxt = new Xoh_href_parser_fxt();
|
||||
private final Xoh_href_parser_fxt fxt = new Xoh_href_parser_fxt();
|
||||
@Test public void Wiki__basic() {
|
||||
fxt.Run_parse_by_href("/wiki/A").Chk_tid(Xoa_url_.Tid_page).Chk_to_str("en.wikipedia.org/wiki/A").Chk_wiki("en.wikipedia.org").Chk_page("A");
|
||||
}
|
||||
@@ -115,10 +115,10 @@ public class Xoh_href_parser_tst {
|
||||
// ;
|
||||
// }
|
||||
}
|
||||
class Xoh_href_parser_fxt extends Xoa_url_parser_fxt { private final Xoh_href_parser href_parser = new Xoh_href_parser();
|
||||
class Xoh_href_parser_fxt extends Xow_url_parser_fxt { private final Xoh_href_parser href_parser = new Xoh_href_parser();
|
||||
public Xoh_href_parser_fxt Run_parse_by_href(String raw) {
|
||||
href_parser.Parse_as_url(actl_url, Bry_.new_u8(raw), cur_wiki, Bry__page_1);
|
||||
return this;
|
||||
}
|
||||
private static final byte[] Bry__page_1 = Bry_.new_a7("Page 1");
|
||||
private static final byte[] Bry__page_1 = Bry_.new_a7("Page 1");
|
||||
}
|
||||
|
||||
@@ -39,8 +39,8 @@ class Xoh_href_wtr_fxt {
|
||||
private final Bry_bfr tmp_bfr = Bry_bfr.reset_(255);
|
||||
private final Xoh_href_wtr href_wtr = new Xoh_href_wtr();
|
||||
public Xoh_href_wtr_fxt() {
|
||||
this.app = Xoa_app_fxt.app_();
|
||||
this.wiki = Xoa_app_fxt.wiki_tst_(app);
|
||||
this.app = Xoa_app_fxt.Make__app__edit();
|
||||
this.wiki = Xoa_app_fxt.Make__wiki__edit(app);
|
||||
wiki.Xwiki_mgr().Add_by_csv(Bry_.new_a7("1|wikt|en.wiktionary.org"));
|
||||
app.Usere().Wiki().Xwiki_mgr().Add_by_csv(Bry_.new_a7("1|en.wiktionary.org|en.wiktionary.org"));
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ public class Xoh_js_cbk implements GfoInvkAble {
|
||||
private Xoae_app app;
|
||||
private Xog_html_itm html_itm;
|
||||
private Xop_root_tkn root = new Xop_root_tkn();
|
||||
private final Bry_bfr bfr = Bry_bfr.reset_(255);
|
||||
private final Bry_bfr bfr = Bry_bfr.reset_(255);
|
||||
public Xoh_js_cbk(Xog_html_itm html_itm) {this.html_itm = html_itm; this.app = html_itm.Owner_tab().Tab_mgr().Win().App();}
|
||||
private String Xowa_exec_test(GfoMsg m) { // concat args with pipe; EX: xowa_exec('proc', 'arg0', 'arg1'); -> proc|arg0|arg1
|
||||
bfr.Clear();
|
||||
@@ -91,7 +91,7 @@ public class Xoh_js_cbk implements GfoInvkAble {
|
||||
wiki.Db_mgr().Load_mgr().Load_by_ttl(tmp_page, ttl.Ns(), ttl.Page_db());
|
||||
}
|
||||
return String_.Ary(tmp_page.Exists() ? "1" : "0", Int_.To_str(tmp_page.Id()), Int_.To_str(tmp_page.Ns_id()), String_.new_u8(tmp_page.Ttl_page_db()), Bool_.To_str_lower(tmp_page.Redirected()), tmp_page.Modified_on().XtoStr_fmt("yyyy-MM-dd HH:mm:ss"), Int_.To_str(tmp_page.Text_len()));
|
||||
} private static final Xowd_page_itm tmp_page = Xowd_page_itm.new_tmp();
|
||||
} private static final Xowd_page_itm tmp_page = Xowd_page_itm.new_tmp();
|
||||
private String[][] Get_titles_meta(GfoMsg m) {
|
||||
Xowe_wiki wiki = html_itm.Owner_tab().Wiki();
|
||||
try {
|
||||
@@ -125,7 +125,9 @@ public class Xoh_js_cbk implements GfoInvkAble {
|
||||
Xowe_wiki wiki = html_itm.Owner_tab().Wiki();
|
||||
byte[] search_str = Bry_.new_u8((String)m.ReadValAt(0));
|
||||
byte[] cbk_func = Bry_.new_u8((String)m.ReadValAt(1));
|
||||
app.Gui_mgr().Search_suggest_mgr().Search(wiki, search_str, cbk_func);
|
||||
|
||||
|
||||
app.Gui_mgr().Search_cfg().Search(wiki, search_str, cbk_func);
|
||||
return "";
|
||||
}
|
||||
private String[] Wikidata_get_label(GfoMsg m) {
|
||||
@@ -141,7 +143,7 @@ public class Xoh_js_cbk implements GfoInvkAble {
|
||||
for (int i = 1; i < len; i++) {
|
||||
try {
|
||||
byte[] ttl_bry = m.Args_getAt(i).Val_to_bry();
|
||||
gplx.xowa.xtns.wdatas.Wdata_doc page = wdata_mgr.Pages_get(ttl_bry); if (page == null) continue;
|
||||
gplx.xowa.xtns.wdatas.Wdata_doc page = wdata_mgr.Doc_mgr.Get_by_xid_or_null(ttl_bry); if (page == null) continue;
|
||||
for (int j = 0; j < langs_len; j++) {
|
||||
byte[] lang_key = langs[j];
|
||||
if (Bry_.Eq(lang_key, Wikidata_get_label_xowa_ui_lang))
|
||||
@@ -170,7 +172,7 @@ public class Xoh_js_cbk implements GfoInvkAble {
|
||||
catch (Exception e) {Err_.Noop(e); return null;}
|
||||
return Object_.Xto_str_strict_or_empty(rv);
|
||||
}
|
||||
private static final byte[] Wikidata_get_label_xowa_ui_lang = Bry_.new_a7("xowa_ui_lang"), Wikidata_get_label_xowa_title = Bry_.new_a7("xowa_title");
|
||||
private static final byte[] Wikidata_get_label_xowa_ui_lang = Bry_.new_a7("xowa_ui_lang"), Wikidata_get_label_xowa_title = Bry_.new_a7("xowa_title");
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_parse_to_html)) return Parse_to_html(m);
|
||||
else if (ctx.Match(k, Invk_wikidata_get_label)) return Wikidata_get_label(m);
|
||||
@@ -188,7 +190,7 @@ public class Xoh_js_cbk implements GfoInvkAble {
|
||||
else if (ctx.Match(k, Invk_exec_json)) return app.Html__bridge_mgr().Cmd_mgr().Exec(m);
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
}
|
||||
public static final String Invk_parse_to_html = "parse_to_html", Invk_wikidata_get_label = "wikidata_get_label", Invk_get_page = "get_page", Invk_cmd = "cmd", Invk_scripts_exec = "scripts_exec"
|
||||
public static final String Invk_parse_to_html = "parse_to_html", Invk_wikidata_get_label = "wikidata_get_label", Invk_get_page = "get_page", Invk_cmd = "cmd", Invk_scripts_exec = "scripts_exec"
|
||||
, Invk_get_search_suggestions = "get_search_suggestions", Invk_get_titles_meta = "get_titles_meta", Invk_get_titles_exists = "get_titles_exists", Invk_get_current_url = "get_current_url"
|
||||
, Invk_xowa_exec_test = "xowa_exec_test", Invk_xowa_exec_test_as_array = "xowa_exec_test_as_array"
|
||||
, Invk_popups_get_async_bgn = "popups_get_async_bgn"
|
||||
|
||||
@@ -18,15 +18,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.htmls.js; import gplx.*; import gplx.xowa.*; import gplx.xowa.htmls.*;
|
||||
import org.junit.*; import gplx.langs.jsons.*; import gplx.xowa.xtns.wdatas.*;
|
||||
public class Xoh_js_cbk_wdata_labels_tst {
|
||||
@Before public void init() {fxt.Init();} private final Wdata_wiki_mgr_fxt fxt = new Wdata_wiki_mgr_fxt();
|
||||
@Before public void init() {fxt.Init();} private final Wdata_wiki_mgr_fxt fxt = new Wdata_wiki_mgr_fxt();
|
||||
@Test public void Basic() {
|
||||
fxt.Init_pages_add(fxt.Wdoc_bldr("q1").Add_label("en", "en_q1").Xto_wdoc());
|
||||
fxt.Init_pages_add(fxt.Wdoc_bldr("q2").Add_label("en", "en_q2").Xto_wdoc());
|
||||
fxt.Init_pages_add(fxt.Wdoc_bldr("Property:P1").Add_label("en", "en_property_p1").Xto_wdoc());
|
||||
fxt.Init__docs__add(fxt.Wdoc_bldr("q1").Add_label("en", "en_q1").Xto_wdoc());
|
||||
fxt.Init__docs__add(fxt.Wdoc_bldr("q2").Add_label("en", "en_q2").Xto_wdoc());
|
||||
fxt.Init__docs__add(fxt.Wdoc_bldr("Property:P1").Add_label("en", "en_property_p1").Xto_wdoc());
|
||||
Tst_wikidata_label_get(String_.Ary("en", "q1", "q2", "Property:P1"), String_.Ary("en_q1", "en_q2", "en_property_p1"));
|
||||
}
|
||||
@Test public void Outliers() {
|
||||
fxt.Init_pages_add(fxt.Wdoc_bldr("q1").Add_label("en", "en_q1").Add_label("de", "de_q1").Xto_wdoc());
|
||||
fxt.Init__docs__add(fxt.Wdoc_bldr("q1").Add_label("en", "en_q1").Add_label("de", "de_q1").Xto_wdoc());
|
||||
Tst_wikidata_label_get(String_.Ary("fr", "q1"), String_.Ary((String)null));
|
||||
Tst_wikidata_label_get(String_.Ary("de", "q1"), String_.Ary("de_q1"));
|
||||
Tst_wikidata_label_get(String_.Ary("xowa_title", "q1"), String_.Ary("q1"));
|
||||
@@ -41,12 +41,12 @@ public class Xoh_js_cbk_wdata_labels_tst {
|
||||
, " }"
|
||||
, "}"
|
||||
));
|
||||
fxt.Init_pages_add(d);
|
||||
fxt.Init__docs__add(d);
|
||||
Tst_wikidata_label_get(String_.Ary("en", "q1"), String_.Ary("\ta"));
|
||||
}
|
||||
private Wdata_doc doc_(String qid, String src) {
|
||||
Json_doc jdoc = fxt.Make_json(src);
|
||||
Xoae_app app = Xoa_app_fxt.app_();
|
||||
Xoae_app app = Xoa_app_fxt.Make__app__edit();
|
||||
Wdata_doc rv = new Wdata_doc(Bry_.new_a7(qid), app.Wiki_mgr().Wdata_mgr(), jdoc);
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public class Xoh_js_cleaner {
|
||||
if (cleaned != null) {
|
||||
bfr.Del_by(end - bgn);
|
||||
bfr.Add(cleaned);
|
||||
app.Usr_dlg().Log_many("", "", "javascript detected: wiki=~{0} ~{1}", wiki.Domain_str(), String_.new_u8(ttl.Full_txt()));
|
||||
app.Usr_dlg().Log_many("", "", "javascript detected: wiki=~{0} ~{1}", wiki.Domain_str(), String_.new_u8(ttl.Full_txt_w_ttl_case()));
|
||||
}
|
||||
}
|
||||
public byte[] Clean(Xowe_wiki wiki, byte[] src, int bgn, int end) {
|
||||
|
||||
@@ -28,8 +28,8 @@ public class Xoh_js_cleaner_tst {
|
||||
class Xoh_js_cleaner_fxt {
|
||||
public void Init() {
|
||||
if (mgr == null) {
|
||||
app = Xoa_app_fxt.app_();
|
||||
wiki = Xoa_app_fxt.wiki_tst_(app);
|
||||
app = Xoa_app_fxt.Make__app__edit();
|
||||
wiki = Xoa_app_fxt.Make__wiki__edit(app);
|
||||
mgr = app.Html_mgr().Js_cleaner();
|
||||
}
|
||||
} private Xoae_app app; Xowe_wiki wiki; Xoh_js_cleaner mgr;
|
||||
|
||||
@@ -43,7 +43,7 @@ public class Xow_popup_html_mkr {
|
||||
, hdom_bry
|
||||
, wiki.Lang().Dir_ltr_bry()
|
||||
, page_url
|
||||
, String_.new_u8(page.Ttl().Full_txt())
|
||||
, String_.new_u8(page.Ttl().Full_txt_w_ttl_case())
|
||||
, popup_itm.Popup_id()
|
||||
, Xow_popup_html_bldr_.Bld_fmtr_wiki(fmtr_wiki, wrdx_bfr, cur_wiki.Domain_bry(), page.Wiki().Domain_bry()) // NOTE: use cur_wiki, not page_wiki; DATE:2014-06-28
|
||||
, gplx.core.ios.Io_size_.To_str(page.Data_raw().length)
|
||||
@@ -62,7 +62,7 @@ class Xow_popup_html_bldr_ {
|
||||
}
|
||||
public static byte[] Bld_fmtr_viewed(Bry_fmtr fmtr, Xoae_app app, Xowe_wiki wiki, Bry_bfr wrdx_bfr, Xoa_ttl ttl) {
|
||||
byte[] view_time_item = Bry_.Empty;
|
||||
gplx.xowa.users.history.Xou_history_itm history_itm = app.Usere().History_mgr().Get_or_null(wiki.Domain_bry(), ttl.Full_txt());
|
||||
gplx.xowa.users.history.Xou_history_itm history_itm = app.Usere().History_mgr().Get_or_null(wiki.Domain_bry(), ttl.Full_txt_w_ttl_case());
|
||||
if (history_itm != null)
|
||||
view_time_item = fmtr.Bld_bry_many(wrdx_bfr, history_itm.View_end().XtoStr_fmt_yyyy_MM_dd_HH_mm_ss());
|
||||
return view_time_item;
|
||||
|
||||
@@ -25,7 +25,6 @@ public class Xow_popup_itm implements Cancelable {
|
||||
}
|
||||
public boolean Canceled() {return canceled;} private boolean canceled = false;
|
||||
public void Cancel() {canceled = true;}
|
||||
public void Cancel_reset() {canceled = false;}
|
||||
public byte Mode() {return mode;} private byte mode = Mode_tid_init;
|
||||
public Xow_popup_itm Mode_more_(int more_words) {
|
||||
mode = Mode_tid_more;
|
||||
|
||||
@@ -21,7 +21,7 @@ import gplx.core.js.*;
|
||||
import gplx.xowa.wikis.nss.*;
|
||||
import gplx.xowa.guis.views.*;
|
||||
import gplx.xowa.htmls.hrefs.*;
|
||||
import gplx.xowa.specials.*; import gplx.xowa.specials.search.*;
|
||||
import gplx.xowa.specials.*;
|
||||
import gplx.xowa.apps.apis.xowa.html.modules.*;
|
||||
public class Xow_popup_mgr implements GfoInvkAble, GfoEvObj {
|
||||
private Xoae_app app; private Xowe_wiki wiki; private Js_wtr js_wtr = new Js_wtr();
|
||||
|
||||
@@ -460,8 +460,8 @@ class Xop_popup_parser_fxt {
|
||||
private Xow_popup_parser parser; private Xowe_wiki wiki;
|
||||
private int word_min = 2;
|
||||
public void Clear() {
|
||||
Xoae_app app = Xoa_app_fxt.app_();
|
||||
this.wiki = Xoa_app_fxt.wiki_(app, "en.wiki");
|
||||
Xoae_app app = Xoa_app_fxt.Make__app__edit();
|
||||
this.wiki = Xoa_app_fxt.Make__wiki__edit(app, "en.wiki");
|
||||
parser = wiki.Html_mgr().Head_mgr().Popup_mgr().Parser();
|
||||
parser.Init_by_wiki(wiki);
|
||||
parser.Cfg().Tmpl_read_len_(4);
|
||||
|
||||
@@ -53,20 +53,20 @@ public class Xow_popup_wrdx_mkr {
|
||||
case Xop_tkn_itm_.Tid_xnde:
|
||||
xnde = (Xop_xnde_tkn)tkn;
|
||||
switch (xnde.Tag().Id()) {
|
||||
case Xop_xnde_tag_.Tid_div:
|
||||
case Xop_xnde_tag_.Tid_table: case Xop_xnde_tag_.Tid_tr: case Xop_xnde_tag_.Tid_td: case Xop_xnde_tag_.Tid_th:
|
||||
case Xop_xnde_tag_.Tid_caption: case Xop_xnde_tag_.Tid_thead: case Xop_xnde_tag_.Tid_tfoot: case Xop_xnde_tag_.Tid_tbody:
|
||||
case Xop_xnde_tag_.Tid_ref: case Xop_xnde_tag_.Tid_gallery: case Xop_xnde_tag_.Tid_imageMap: case Xop_xnde_tag_.Tid_timeline:
|
||||
case Xop_xnde_tag_.Tid_xowa_html: // needed for Help:Options, else \n at top of doc; DATE:2014-06-22
|
||||
case Xop_xnde_tag_.Tid__div:
|
||||
case Xop_xnde_tag_.Tid__table: case Xop_xnde_tag_.Tid__tr: case Xop_xnde_tag_.Tid__td: case Xop_xnde_tag_.Tid__th:
|
||||
case Xop_xnde_tag_.Tid__caption: case Xop_xnde_tag_.Tid__thead: case Xop_xnde_tag_.Tid__tfoot: case Xop_xnde_tag_.Tid__tbody:
|
||||
case Xop_xnde_tag_.Tid__ref: case Xop_xnde_tag_.Tid__gallery: case Xop_xnde_tag_.Tid__imageMap: case Xop_xnde_tag_.Tid__timeline:
|
||||
case Xop_xnde_tag_.Tid__xowa_html: // needed for Help:Options, else \n at top of doc; DATE:2014-06-22
|
||||
add_tkn = add_subs = false; // skip tblxs
|
||||
xnde = null;
|
||||
break;
|
||||
case Xop_xnde_tag_.Tid_math: // add <math> as one unit; PAGE:en.w:System_of_polynomial_equations DATE:2014-07-01
|
||||
case Xop_xnde_tag_.Tid__math: // add <math> as one unit; PAGE:en.w:System_of_polynomial_equations DATE:2014-07-01
|
||||
add_subs = false; // never recur
|
||||
xnde = null;
|
||||
data.Words_found_add(tkn); // treat it as one word
|
||||
break;
|
||||
case Xop_xnde_tag_.Tid_br:
|
||||
case Xop_xnde_tag_.Tid__br:
|
||||
add_tkn = false; // never add_tkn Src_bgn / Src_end; note add_subs should still be true; PAGE:en.q:Earth; DATE:2014-06-30
|
||||
if (wrdx_bfr.Len_eq_0()) // don't add <br/> to start of document; needed for Help:Options, but good to have everywhere; DATE:2014-06-22
|
||||
add_subs = false;
|
||||
|
||||
@@ -41,8 +41,8 @@ class Xop_keeplist_wiki_fxt {
|
||||
public void Clear() {
|
||||
}
|
||||
public Xop_keeplist_wiki keeplist_wiki_(String raw) {
|
||||
Xoae_app app = Xoa_app_fxt.app_();
|
||||
Xowe_wiki wiki = Xoa_app_fxt.wiki_(app, "enwiki");
|
||||
Xoae_app app = Xoa_app_fxt.Make__app__edit();
|
||||
Xowe_wiki wiki = Xoa_app_fxt.Make__wiki__edit(app, "enwiki");
|
||||
Xow_popup_mgr popup_mgr = wiki.Html_mgr().Head_mgr().Popup_mgr();
|
||||
popup_mgr.Init_by_wiki(wiki);
|
||||
popup_mgr.Parser().Tmpl_keeplist_init_(Bry_.new_u8(raw));
|
||||
|
||||
@@ -21,11 +21,11 @@ import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.wkrs.lnkis.htmls.*;
|
||||
import gplx.xowa.files.*; import gplx.xowa.files.repos.*; import gplx.xowa.files.xfers.*; import gplx.xowa.files.origs.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.lnkis.*;
|
||||
public class Xoh_ns_file_page_mgr implements gplx.core.brys.Bfr_arg {
|
||||
private Xoa_ttl ttl; private Xoh_file_page_wtr html_wtr; private final Xoh_file_page__other_resolutions alt_wtr = new Xoh_file_page__other_resolutions();
|
||||
private final Bry_bfr tmp_bfr = Bry_bfr.new_();
|
||||
private Xoa_ttl ttl; private Xoh_file_page_wtr html_wtr; private final Xoh_file_page__other_resolutions alt_wtr = new Xoh_file_page__other_resolutions();
|
||||
private final Bry_bfr tmp_bfr = Bry_bfr.new_();
|
||||
private Xow_repo_mgr repo_mgr;
|
||||
private Xof_file_itm xfer_itm; private byte[] file_size_bry; private byte[] play_btn_icon;
|
||||
private final Xof_img_size img_size = new Xof_img_size(); private final Xof_url_bldr url_bldr = Xof_url_bldr.new_v2();
|
||||
private final Xof_img_size img_size = new Xof_img_size(); private final Xof_url_bldr url_bldr = Xof_url_bldr.new_v2();
|
||||
public void Bld_html(Xowe_wiki cur_wiki, Xop_ctx ctx, Xoae_page page, Bry_bfr bfr, Xoa_ttl ttl, Xoh_file_page_wtr html_wtr, Xof_xfer_queue queue) {
|
||||
Xowe_wiki wiki = (Xowe_wiki)page.Commons_mgr().Source_wiki_or(cur_wiki);
|
||||
this.ttl = ttl; this.html_wtr = html_wtr; this.repo_mgr = wiki.File__repo_mgr();
|
||||
@@ -59,7 +59,7 @@ public class Xoh_ns_file_page_mgr implements gplx.core.brys.Bfr_arg {
|
||||
public void Bfr_arg__add(Bry_bfr bfr) {
|
||||
alt_wtr.Init_by_fmtr(repo_mgr, xfer_itm, html_wtr);
|
||||
Xof_ext orig_ext = xfer_itm.Orig_ext();
|
||||
byte[] alt_bry = gplx.langs.htmls.encoders.Gfo_url_encoder_.Http_url.Encode(ttl.Full_txt());
|
||||
byte[] alt_bry = gplx.langs.htmls.encoders.Gfo_url_encoder_.Http_url.Encode(ttl.Full_txt_w_ttl_case());
|
||||
byte[] xowa_title = gplx.langs.htmls.encoders.Gfo_url_encoder_.Http_url.Encode(ttl.Page_url());
|
||||
if (orig_ext.Id_is_thumbable_img())
|
||||
html_wtr.Html_main_img().Bld_bfr_many(bfr, xfer_itm.Orig_w(), xfer_itm.Orig_h(), xfer_itm.Html_orig_url().To_http_file_bry(), file_size_bry, orig_ext.Mime_type()
|
||||
@@ -71,8 +71,8 @@ public class Xoh_ns_file_page_mgr implements gplx.core.brys.Bfr_arg {
|
||||
else if (orig_ext.Id_is_audio())
|
||||
html_wtr.Html_main_aud().Bld_bfr_many(bfr, xfer_itm.Html_orig_url().To_http_file_bry(), xowa_title, xfer_itm.Html_w(), xfer_itm.Html_w(), play_btn_icon);
|
||||
}
|
||||
private static final byte[] Atr_class_image = Bry_.new_a7("image");
|
||||
private static final String Str_commons_notice = String_.Concat_lines_nl_skip_last
|
||||
private static final byte[] Atr_class_image = Bry_.new_a7("image");
|
||||
private static final String Str_commons_notice = String_.Concat_lines_nl_skip_last
|
||||
( "<table class='ambox ambox-delete' style=''>"
|
||||
, " <tr>"
|
||||
, " <td class='mbox-empty-cell'>"
|
||||
|
||||
@@ -89,8 +89,8 @@ class Xoh_ns_file_page_mgr_fxt {
|
||||
public Xoh_ns_file_page_mgr_fxt Html_file_size_(int v) {this.html_file_size = v; return this;} private int html_file_size;
|
||||
public void Reset() {
|
||||
if (app != null) return;
|
||||
app = Xoa_app_fxt.app_();
|
||||
wiki = Xoa_app_fxt.wiki_tst_(app);
|
||||
app = Xoa_app_fxt.Make__app__edit();
|
||||
wiki = Xoa_app_fxt.Make__wiki__edit(app);
|
||||
opt = new Xoh_file_page_wtr();
|
||||
}
|
||||
public void tst(String expd) {
|
||||
|
||||
@@ -43,8 +43,8 @@ class Xoh_page_body_cls_fxt {
|
||||
}
|
||||
public void Test_calc(byte page_tid, String ttl_str, String expd) {
|
||||
if (app == null) {
|
||||
app = Xoa_app_fxt.app_();
|
||||
wiki = Xoa_app_fxt.wiki_tst_(app);
|
||||
app = Xoa_app_fxt.Make__app__edit();
|
||||
wiki = Xoa_app_fxt.Make__wiki__edit(app);
|
||||
tmp_bfr = Bry_bfr.reset_(255);
|
||||
wiki.Ns_mgr().Add_new(Wdata_wiki_mgr.Ns_property, Wdata_wiki_mgr.Ns_property_name);
|
||||
}
|
||||
|
||||
@@ -38,8 +38,8 @@ class Xoh_subpages_bldr_fxt {
|
||||
private Xoh_subpages_bldr subpages_bldr = new Xoh_subpages_bldr();
|
||||
public Xowe_wiki Wiki() {return wiki;} private Xowe_wiki wiki;
|
||||
public void Init() {
|
||||
this.app = Xoa_app_fxt.app_();
|
||||
this.wiki = Xoa_app_fxt.wiki_tst_(app);
|
||||
this.app = Xoa_app_fxt.Make__app__edit();
|
||||
this.wiki = Xoa_app_fxt.Make__wiki__edit(app);
|
||||
wiki.Ns_mgr().Ids_get_or_null(Xow_ns_.Tid__help).Subpages_enabled_(true);
|
||||
}
|
||||
public void Test_bld(String ttl_str, String expd) {
|
||||
|
||||
@@ -138,7 +138,7 @@ public class Xow_portal_mgr implements GfoInvkAble {
|
||||
, Invk_missing_ns_cls = "missing_ns_cls", Invk_missing_ns_cls_ = "missing_ns_cls_", Invk_missing_ns_cls_list = "missing_ns_cls_list"
|
||||
;
|
||||
public static final String Invk_div_logo_ = "div_logo_";
|
||||
private static KeyVal[] Options_missing_ns_cls_list = KeyVal_.Ary(KeyVal_.new_("", "Show as blue link"), KeyVal_.new_("new", "Show as red link"), KeyVal_.new_("xowa_display_none", "Hide"));
|
||||
private static Keyval[] Options_missing_ns_cls_list = Keyval_.Ary(Keyval_.new_("", "Show as blue link"), Keyval_.new_("new", "Show as red link"), Keyval_.new_("xowa_display_none", "Hide"));
|
||||
private static final byte[] Missing_ns_cls_hide = Bry_.new_a7("xowa_display_none");
|
||||
private static final Bry_fmtr Div_jump_to_fmtr = Bry_fmtr.new_
|
||||
( "\n <div id=\"jump-to-nav\" class=\"mw-jump\">~{jumpto}<a href=\"#mw-navigation\">~{jumptonavigation}</a>~{comma-separator}<a href=\"#p-search\">~{jumptosearch}</a></div>"
|
||||
|
||||
@@ -33,8 +33,8 @@ public class Xow_portal_mgr_tst {
|
||||
class Xowh_portal_mgr_fxt {
|
||||
public void Init() {
|
||||
if (app == null) {
|
||||
app = Xoa_app_fxt.app_();
|
||||
wiki = Xoa_app_fxt.wiki_tst_(app);
|
||||
app = Xoa_app_fxt.Make__app__edit();
|
||||
wiki = Xoa_app_fxt.Make__wiki__edit(app);
|
||||
wiki.Ns_mgr().Ns_main().Exists_(true); // needed for ns
|
||||
wiki.Html_mgr().Portal_mgr().Init_assert(); // needed for personal
|
||||
}
|
||||
|
||||
@@ -187,8 +187,8 @@ class Xowh_sidebar_mgr_fxt {
|
||||
private Xoae_app app; private Xowe_wiki wiki; private Xowh_sidebar_mgr sidebar_mgr; private Bry_bfr bfr, comment_bfr;
|
||||
public Xowh_sidebar_mgr_fxt Clear() {
|
||||
// if (app == null) {
|
||||
app = Xoa_app_fxt.app_();
|
||||
wiki = Xoa_app_fxt.wiki_tst_(app);
|
||||
app = Xoa_app_fxt.Make__app__edit();
|
||||
wiki = Xoa_app_fxt.Make__wiki__edit(app);
|
||||
sidebar_mgr = wiki.Html_mgr().Portal_mgr().Sidebar_mgr();
|
||||
bfr = Bry_bfr.reset_(Io_mgr.Len_kb);
|
||||
comment_bfr = Bry_bfr.reset_(Io_mgr.Len_kb);
|
||||
@@ -257,4 +257,4 @@ class Xowh_sidebar_mgr_fxt {
|
||||
sb.Add(Xto_str(cur.Itms_get_at(i)));
|
||||
return sb.To_str_and_clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,19 +150,19 @@ public class Xow_toc_mgr implements gplx.core.brys.Bfr_arg {
|
||||
case Xop_tkn_itm_.Tid_xnde:
|
||||
Xop_xnde_tkn xnde = (Xop_xnde_tkn)sub;
|
||||
switch (xnde.Tag().Id()) {
|
||||
case Xop_xnde_tag_.Tid_br: // always ignore in TOC text; EX: en.wikipedia.org/wiki/Magnetic_resonance_imaging; ====''T''<span style="display:inline-block; margin-bottom:-0.3em; vertical-align:-0.4em; line-height:1.2em; font-size:85%; text-align:left;">*<br />2</span>-weighted MRI====
|
||||
case Xop_xnde_tag_.Tid_hr: // assumed, based on above
|
||||
case Xop_xnde_tag_.Tid_h1: case Xop_xnde_tag_.Tid_h2: case Xop_xnde_tag_.Tid_h3: case Xop_xnde_tag_.Tid_h4: case Xop_xnde_tag_.Tid_h5: case Xop_xnde_tag_.Tid_h6:
|
||||
case Xop_xnde_tag_.Tid_ul: case Xop_xnde_tag_.Tid_ol: case Xop_xnde_tag_.Tid_dd: case Xop_xnde_tag_.Tid_dt: case Xop_xnde_tag_.Tid_li:
|
||||
case Xop_xnde_tag_.Tid_table: case Xop_xnde_tag_.Tid_tr: case Xop_xnde_tag_.Tid_td: case Xop_xnde_tag_.Tid_th: case Xop_xnde_tag_.Tid_thead: case Xop_xnde_tag_.Tid_tbody: case Xop_xnde_tag_.Tid_caption:
|
||||
case Xop_xnde_tag_.Tid_ref: // NOTE: don't bother printing references
|
||||
// case Xop_xnde_tag_.Tid_pre: case Xop_xnde_tag_.Tid_blockquote:
|
||||
case Xop_xnde_tag_.Tid__br: // always ignore in TOC text; EX: en.wikipedia.org/wiki/Magnetic_resonance_imaging; ====''T''<span style="display:inline-block; margin-bottom:-0.3em; vertical-align:-0.4em; line-height:1.2em; font-size:85%; text-align:left;">*<br />2</span>-weighted MRI====
|
||||
case Xop_xnde_tag_.Tid__hr: // assumed, based on above
|
||||
case Xop_xnde_tag_.Tid__h1: case Xop_xnde_tag_.Tid__h2: case Xop_xnde_tag_.Tid__h3: case Xop_xnde_tag_.Tid__h4: case Xop_xnde_tag_.Tid__h5: case Xop_xnde_tag_.Tid__h6:
|
||||
case Xop_xnde_tag_.Tid__ul: case Xop_xnde_tag_.Tid__ol: case Xop_xnde_tag_.Tid__dd: case Xop_xnde_tag_.Tid__dt: case Xop_xnde_tag_.Tid__li:
|
||||
case Xop_xnde_tag_.Tid__table: case Xop_xnde_tag_.Tid__tr: case Xop_xnde_tag_.Tid__td: case Xop_xnde_tag_.Tid__th: case Xop_xnde_tag_.Tid__thead: case Xop_xnde_tag_.Tid__tbody: case Xop_xnde_tag_.Tid__caption:
|
||||
case Xop_xnde_tag_.Tid__ref: // NOTE: don't bother printing references
|
||||
// case Xop_xnde_tag_.Tid__pre: case Xop_xnde_tag_.Tid__blockquote:
|
||||
break;
|
||||
case Xop_xnde_tag_.Tid_b:
|
||||
case Xop_xnde_tag_.Tid_i:
|
||||
case Xop_xnde_tag_.Tid__b:
|
||||
case Xop_xnde_tag_.Tid__i:
|
||||
html_wtr.Write_tkn(bfr, ctx, html_wtr_opts, src, tkn, Xoh_html_wtr.Sub_idx_null, sub);
|
||||
break;
|
||||
case Xop_xnde_tag_.Tid_translate:
|
||||
case Xop_xnde_tag_.Tid__translate:
|
||||
gplx.xowa.xtns.translates.Xop_translate_xnde translate_xnde = (gplx.xowa.xtns.translates.Xop_translate_xnde)xnde.Xnde_xtn();
|
||||
html_wtr.Write_tkn(bfr, ctx, html_wtr_opts, translate_xnde.Xtn_root().Data_mid(), tkn, Xoh_html_wtr.Sub_idx_null, translate_xnde.Xtn_root());
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user