mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
'v3.6.3.1'
This commit is contained in:
@@ -19,7 +19,7 @@ package gplx.xowa.htmls; import gplx.*; import gplx.xowa.*;
|
||||
public class Xoh_cmd_mgr {
|
||||
public int Count() {return cmds.Count();}
|
||||
public void Clear() {cmds.Clear();}
|
||||
public void Add(Xoh_cmd_itm itm) {cmds.Add(itm);} List_adp cmds = List_adp_.new_();
|
||||
public void Add(Xoh_cmd_itm itm) {cmds.Add(itm);} List_adp cmds = List_adp_.New();
|
||||
public void Exec(Xoae_app app, Xoae_page page) {
|
||||
int len = cmds.Count();
|
||||
if (len == 0) return;
|
||||
|
||||
@@ -18,22 +18,22 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.htmls; import gplx.*; import gplx.xowa.*;
|
||||
import gplx.xowa.htmls.core.htmls.tidy.*; import gplx.xowa.htmls.js.*; import gplx.xowa.htmls.skins.*;
|
||||
import gplx.xowa.parsers.xndes.*;
|
||||
public class Xoh_html_mgr implements GfoInvkAble {
|
||||
public class Xoh_html_mgr implements Gfo_invk {
|
||||
public Xoh_html_mgr(Xoae_app app) {
|
||||
js_cleaner = new Xoh_js_cleaner(app);
|
||||
}
|
||||
public void Init_by_app(Xoae_app app) {
|
||||
tidy_mgr.Init_by_app(app);
|
||||
}
|
||||
public Xop_xatr_whitelist_mgr Whitelist_mgr() {return whitelist_mgr;} private final Xop_xatr_whitelist_mgr whitelist_mgr = new Xop_xatr_whitelist_mgr().Ini();
|
||||
public Xoh_page_mgr Page_mgr() {return page_mgr;} private final Xoh_page_mgr page_mgr = new Xoh_page_mgr();
|
||||
public Xoh_tidy_mgr Tidy_mgr() {return tidy_mgr;} private final Xoh_tidy_mgr tidy_mgr = new Xoh_tidy_mgr();
|
||||
public Xoh_js_cleaner Js_cleaner() {return js_cleaner;} private final Xoh_js_cleaner js_cleaner;
|
||||
public Xoh_skin_mgr Skin_mgr() {return skin_mgr;} private final Xoh_skin_mgr skin_mgr = new Xoh_skin_mgr();
|
||||
public Xop_xatr_whitelist_mgr Whitelist_mgr() {return whitelist_mgr;} private final Xop_xatr_whitelist_mgr whitelist_mgr = new Xop_xatr_whitelist_mgr().Ini();
|
||||
public Xoh_page_mgr Page_mgr() {return page_mgr;} private final Xoh_page_mgr page_mgr = new Xoh_page_mgr();
|
||||
public Xoh_tidy_mgr Tidy_mgr() {return tidy_mgr;} private final Xoh_tidy_mgr tidy_mgr = new Xoh_tidy_mgr();
|
||||
public Xoh_js_cleaner Js_cleaner() {return js_cleaner;} private final Xoh_js_cleaner js_cleaner;
|
||||
public Xoh_skin_mgr Skin_mgr() {return skin_mgr;} private final Xoh_skin_mgr skin_mgr = new Xoh_skin_mgr();
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_page)) return page_mgr;
|
||||
else if (ctx.Match(k, Invk_tidy)) return tidy_mgr;
|
||||
else if (ctx.Match(k, Invk_skins)) return skin_mgr;
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
} private static final String Invk_page = "page", Invk_tidy = "tidy", Invk_skins = "skins";
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.htmls; import gplx.*; import gplx.xowa.*;
|
||||
import gplx.xowa.files.*;
|
||||
public class Xoh_img_mgr {
|
||||
private final List_adp list = List_adp_.new_();
|
||||
private final List_adp list = List_adp_.New();
|
||||
private int uid_nxt = -1;
|
||||
public void Clear() {
|
||||
this.uid_nxt = -1;
|
||||
@@ -40,5 +40,5 @@ public class Xoh_img_mgr {
|
||||
}
|
||||
}
|
||||
public static final String Str__html_uid = "xoimg_";
|
||||
public static final byte[] Bry__html_uid = Bry_.new_a7(Str__html_uid);
|
||||
public static final byte[] Bry__html_uid = Bry_.new_a7(Str__html_uid);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.htmls; import gplx.*; import gplx.xowa.*;
|
||||
import gplx.core.primitives.*;
|
||||
import gplx.xowa.wikis.domains.*;
|
||||
public class Xoh_imgs_mgr implements GfoInvkAble {
|
||||
public class Xoh_imgs_mgr implements Gfo_invk {
|
||||
public Xoh_imgs_mgr(Xow_html_mgr html_mgr) {wiki_is_default = html_mgr.Wiki().Domain_tid() == Xow_domain_tid_.Int__home;} private boolean wiki_is_default;
|
||||
public Bool_obj_ref Alt_in_caption() {return alt_in_caption;} Bool_obj_ref alt_in_caption = Bool_obj_ref.y_();
|
||||
public Bool_obj_ref Alt_defaults_to_caption() {return alt_defaults_to_caption;} Bool_obj_ref alt_defaults_to_caption = Bool_obj_ref.y_();
|
||||
@@ -28,7 +28,7 @@ public class Xoh_imgs_mgr implements GfoInvkAble {
|
||||
else if (ctx.Match(k, Invk_alt_in_caption_)) alt_in_caption = Modify(wiki_is_default, alt_in_caption, m.ReadYn("v"));
|
||||
else if (ctx.Match(k, Invk_alt_defaults_to_caption)) return Yn.To_str(alt_defaults_to_caption.Val());
|
||||
else if (ctx.Match(k, Invk_alt_defaults_to_caption_)) alt_defaults_to_caption = Modify(wiki_is_default, alt_defaults_to_caption, m.ReadYn("v"));
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
}
|
||||
public static final String Invk_alt_in_caption = "alt_in_caption", Invk_alt_in_caption_ = "alt_in_caption_", Invk_alt_defaults_to_caption = "alt_defaults_to_caption", Invk_alt_defaults_to_caption_ = "alt_defaults_to_caption_";
|
||||
|
||||
@@ -23,6 +23,7 @@ public class Xoh_page implements Xoa_page {
|
||||
public Xow_wiki Wiki() {return wiki;} private Xow_wiki wiki;
|
||||
public Xoa_url Url() {return page_url;} private Xoa_url page_url;
|
||||
public Xoa_ttl Ttl() {return page_ttl;} private Xoa_ttl page_ttl;
|
||||
|
||||
// props
|
||||
public boolean Exists() {return exists;} public Xoh_page Exists_n_() {exists = false; return this;} private boolean exists = true;
|
||||
public int Page_id() {return page_id;} private int page_id;
|
||||
@@ -41,6 +42,8 @@ public class Xoh_page implements Xoa_page {
|
||||
public void Xtn_gallery_packed_exists_y_() {}
|
||||
public Xopg_revision_data Revision_data() {return revision_data;} private Xopg_revision_data revision_data = new Xopg_revision_data();
|
||||
public Xopg_html_data Html_data() {return html_data;} private Xopg_html_data html_data = new Xopg_html_data();
|
||||
public byte[] Redirect_to_ttl() {return redirect_to_ttl;} private byte[] redirect_to_ttl; public void Redirect_to_ttl_(byte[] v) {this.redirect_to_ttl = v;}
|
||||
|
||||
|
||||
// util
|
||||
public Xoa_page__commons_mgr Commons_mgr() {return commons_mgr;} private final Xoa_page__commons_mgr commons_mgr = new Xoa_page__commons_mgr();
|
||||
|
||||
@@ -18,8 +18,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.htmls; import gplx.*; import gplx.xowa.*;
|
||||
import gplx.core.brys.fmtrs.*;
|
||||
import gplx.xowa.htmls.portal.*;
|
||||
public class Xoh_page_mgr implements GfoInvkAble {
|
||||
public Xoh_subpages_bldr Subpages_bldr() {return subpages_bldr;} private final Xoh_subpages_bldr subpages_bldr = new Xoh_subpages_bldr();
|
||||
public class Xoh_page_mgr implements Gfo_invk {
|
||||
public Xoh_subpages_bldr Subpages_bldr() {return subpages_bldr;} private final Xoh_subpages_bldr subpages_bldr = new Xoh_subpages_bldr();
|
||||
public boolean Font_enabled() {return font_enabled;} private boolean font_enabled = false;
|
||||
public void Font_enabled_(boolean v) {font_enabled = v;}
|
||||
public String Font_name() {return font_name;} private String font_name = "Arial";
|
||||
@@ -28,15 +28,15 @@ public class Xoh_page_mgr implements GfoInvkAble {
|
||||
font_size = v;
|
||||
this.Font_css_bry_update();
|
||||
}
|
||||
public Bry_fmtr Font_css_fmtr() {return font_css_fmtr;} private final Bry_fmtr font_css_fmtr = Bry_fmtr.new_("body {font-family: ~{font_name}; font-size: ~{font_size}px;}", "font_name", "font_size");
|
||||
public Bry_fmtr Content_code_fmtr() {return content_code_fmtr;} private final Bry_fmtr content_code_fmtr = Bry_fmtr.new_("<pre>~{page_text}</pre>", "page_text");
|
||||
public Bry_fmtr Font_css_fmtr() {return font_css_fmtr;} private final Bry_fmtr font_css_fmtr = Bry_fmtr.new_("body {font-family: ~{font_name}; font-size: ~{font_size}px;}", "font_name", "font_size");
|
||||
public Bry_fmtr Content_code_fmtr() {return content_code_fmtr;} private final Bry_fmtr content_code_fmtr = Bry_fmtr.new_("<pre>~{page_text}</pre>", "page_text");
|
||||
private void Font_css_fmtr_(byte[] bry) {
|
||||
font_css_fmtr.Fmt_(bry);
|
||||
Font_css_bry_update();
|
||||
}
|
||||
public byte[] Font_css_bry() {return font_css_bry;}
|
||||
public void Font_css_bry_update() {
|
||||
font_css_bry = font_css_fmtr.Bld_bry_many(Bry_bfr.new_(), font_name, font_size);
|
||||
font_css_bry = font_css_fmtr.Bld_bry_many(Bry_bfr_.New(), font_name, font_size);
|
||||
} private byte[] font_css_bry = Bry_.Empty;
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_font_name)) return font_name;
|
||||
@@ -49,7 +49,7 @@ public class Xoh_page_mgr implements GfoInvkAble {
|
||||
else if (ctx.Match(k, Invk_font_enabled_)) font_enabled = m.ReadYn("v");
|
||||
else if (ctx.Match(k, Invk_content_code_fmt)) return String_.new_u8(content_code_fmtr.Fmt());
|
||||
else if (ctx.Match(k, Invk_content_code_fmt_)) content_code_fmtr.Fmt_(m.ReadBry("v"));
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
}
|
||||
private static final String Invk_font_name = "font_name", Invk_font_name_ = "font_name_", Invk_font_size = "font_size", Invk_font_size_ = "font_size_"
|
||||
|
||||
@@ -18,8 +18,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.htmls; import gplx.*; import gplx.xowa.*;
|
||||
import gplx.core.brys.fmtrs.*;
|
||||
import gplx.xowa.wikis.pages.*;
|
||||
public class Xoh_page_wtr_mgr implements GfoInvkAble {
|
||||
private final Bry_bfr tmp_bfr = Bry_bfr.reset_(255);
|
||||
public class Xoh_page_wtr_mgr implements Gfo_invk {
|
||||
private final Bry_bfr tmp_bfr = Bry_bfr_.Reset(255);
|
||||
private Xoh_page_wtr_wkr edit_wtr, html_wtr, read_wtr;
|
||||
public Xoh_page_wtr_mgr(boolean html_capable) {
|
||||
this.html_capable = html_capable;
|
||||
@@ -66,7 +66,7 @@ public class Xoh_page_wtr_mgr implements GfoInvkAble {
|
||||
else if (ctx.Match(k, Invk_page_edit_)) page_edit_fmtr.Fmt_(m.ReadBry("v"));
|
||||
else if (ctx.Match(k, Invk_page_html_)) page_html_fmtr.Fmt_(m.ReadBry("v"));
|
||||
else if (ctx.Match(k, Invk_xowa_div_edit_rename_)) div_edit_rename_fmtr.Fmt_(m.ReadBry("v"));
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
}
|
||||
private Bry_fmtr div_edit_rename_fmtr = Bry_fmtr.new_(String_.Concat_lines_nl
|
||||
|
||||
@@ -24,7 +24,7 @@ public class Xoh_page_wtr_mgr_tst {
|
||||
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}"));
|
||||
Gfo_invk_.Invk_by_val(portal_mgr, Xow_portal_mgr.Invk_div_logo_, Bry_.new_a7("~{portal_nav_main_href}"));
|
||||
portal_mgr.Init_assert();
|
||||
Xoh_page_wtr_mgr page_wtr_mgr = new Xoh_page_wtr_mgr(true);
|
||||
page_wtr_mgr.Gen(wiki.Parser_mgr().Ctx().Page(), Xopg_page_.Tid_read);
|
||||
|
||||
@@ -22,15 +22,15 @@ 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 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;
|
||||
private Xoae_app app; private Xowe_wiki wiki; 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;
|
||||
public byte[] Write_page(Xoae_page page, Xop_ctx ctx, Bry_bfr bfr) {
|
||||
synchronized (thread_lock_1) {
|
||||
this.page = page; this.ctx = ctx; this.wiki = page.Wikie(); this.app = wiki.Appe();
|
||||
this.page = page; this.wiki = page.Wikie(); this.app = wiki.Appe();
|
||||
ctx.Page_(page); // HACK: must update page for toc_mgr; WHEN: Xoae_page rewrite
|
||||
Bry_fmtr fmtr = null;
|
||||
if (mgr.Html_capable()) {
|
||||
@@ -45,27 +45,27 @@ public class Xoh_page_wtr_wkr {
|
||||
}
|
||||
Bry_bfr page_bfr = Xoa_app_.Utl__bfr_mkr().Get_m001(); // NOTE: get separate page bfr to output page; do not reuse tmp_bfr b/c it will be used inside Fmt_do
|
||||
Xoh_wtr_ctx hctx = null;
|
||||
if (page_mode == Xopg_page_.Tid_html && wiki.App().Api_root().Html().Page().View_html_generates_hdump()) {
|
||||
if (page_mode == Xopg_page_.Tid_html && wiki.App().Api_root().Wiki().Hdump().Html_mode().Tid_is_hdump_save()) {
|
||||
hctx = Xoh_wtr_ctx.Hdump;
|
||||
Write_body(page_bfr, hctx, page);
|
||||
Write_page_by_tid(hctx, page_mode, bfr, mgr.Page_html_fmtr(), Gfh_utl.Escape_html_as_bry(page_bfr.To_bry_and_clear()));
|
||||
Write_body(page_bfr, ctx, hctx, page);
|
||||
Write_page_by_tid(ctx, hctx, page_mode, bfr, mgr.Page_html_fmtr(), Gfh_utl.Escape_html_as_bry(page_bfr.To_bry_and_clear()));
|
||||
}
|
||||
else {
|
||||
hctx = Xoh_wtr_ctx.Basic;
|
||||
Write_body(page_bfr, hctx, page);
|
||||
Write_page_by_tid(hctx, view_mode, bfr, fmtr, page_bfr.To_bry_and_rls());
|
||||
Write_body(page_bfr, ctx, hctx, page);
|
||||
Write_page_by_tid(ctx, hctx, view_mode, bfr, fmtr, page_bfr.To_bry_and_rls());
|
||||
if (page_mode == Xopg_page_.Tid_html) // if html, write page again, but wrap it in html skin this time
|
||||
Write_page_by_tid(hctx, page_mode, bfr, mgr.Page_html_fmtr(), Gfh_utl.Escape_html_as_bry(bfr.To_bry_and_clear()));
|
||||
Write_page_by_tid(ctx, hctx, page_mode, bfr, mgr.Page_html_fmtr(), Gfh_utl.Escape_html_as_bry(bfr.To_bry_and_clear()));
|
||||
wdata_lang_wtr.Page_(null);
|
||||
}
|
||||
}
|
||||
else
|
||||
Write_body(bfr, Xoh_wtr_ctx.Basic, page);
|
||||
Write_body(bfr, ctx, Xoh_wtr_ctx.Basic, page);
|
||||
this.page = null;
|
||||
return bfr.To_bry_and_clear();
|
||||
}
|
||||
}
|
||||
private void Write_page_by_tid(Xoh_wtr_ctx hctx, byte html_gen_tid, Bry_bfr bfr, Bry_fmtr fmtr, byte[] page_data) {
|
||||
private void Write_page_by_tid(Xop_ctx ctx, Xoh_wtr_ctx hctx, byte html_gen_tid, Bry_bfr bfr, Bry_fmtr fmtr, byte[] page_data) {
|
||||
// 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;}
|
||||
@@ -105,7 +105,7 @@ public class Xoh_page_wtr_wkr {
|
||||
Xoh_page_wtr_wkr_.Bld_head_end(bfr, tmp_bfr, page); // add after </head>
|
||||
Xoh_page_wtr_wkr_.Bld_html_end(bfr, tmp_bfr, page); // add after </html>
|
||||
}
|
||||
public void Write_body(Bry_bfr bfr, Xoh_wtr_ctx hctx, Xoae_page page) {
|
||||
public void Write_body(Bry_bfr bfr, Xop_ctx ctx, Xoh_wtr_ctx hctx, Xoae_page page) {
|
||||
synchronized (thread_lock_2) {
|
||||
this.page = page; this.wiki = page.Wikie(); this.app = wiki.Appe();
|
||||
Xoa_ttl page_ttl = page.Ttl(); int page_ns_id = page_ttl.Ns().Id();
|
||||
@@ -121,7 +121,7 @@ public class Xoh_page_wtr_wkr {
|
||||
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.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;
|
||||
case Xow_page_tid.Tid_wikitext: Write_body_wikitext (bfr, app, wiki, data_raw, ctx, hctx, page, page_tid, page_ns_id); break;
|
||||
}
|
||||
}
|
||||
if ( wiki.Domain_tid() != Xow_domain_tid_.Int__home // allow home wiki to use javascript
|
||||
@@ -130,7 +130,7 @@ public class Xoh_page_wtr_wkr {
|
||||
}
|
||||
}
|
||||
}
|
||||
private void Write_body_wikitext(Bry_bfr bfr, Xoae_app app, Xowe_wiki wiki, byte[] data_raw, Xoh_wtr_ctx hctx, Xoae_page page, byte page_tid, int ns_id) {
|
||||
private void Write_body_wikitext(Bry_bfr bfr, Xoae_app app, Xowe_wiki wiki, byte[] data_raw, Xop_ctx ctx, Xoh_wtr_ctx hctx, Xoae_page page, byte page_tid, int ns_id) {
|
||||
// dump and exit if pre-generated html from html dumps
|
||||
byte[] hdump_data = page.Hdump_data().Body();
|
||||
if (Bry_.Len_gt_0(hdump_data)) {
|
||||
|
||||
@@ -17,8 +17,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.htmls; import gplx.*; import gplx.xowa.*;
|
||||
import gplx.langs.htmls.*; import gplx.xowa.xtns.relatedSites.*;
|
||||
import gplx.xowa.wikis.nss.*;
|
||||
import gplx.xowa.parsers.utils.*;
|
||||
import gplx.xowa.wikis.nss.*; import gplx.xowa.wikis.pages.*; import gplx.xowa.wikis.pages.tags.*;
|
||||
import gplx.xowa.parsers.utils.*;
|
||||
public class Xoh_page_wtr_wkr_ {
|
||||
public static byte[] Bld_page_content_sub(Xoae_app app, Xowe_wiki wiki, Xoae_page page, Bry_bfr tmp_bfr) {
|
||||
byte[] subpages = app.Html_mgr().Page_mgr().Subpages_bldr().Bld(wiki.Ns_mgr(), page.Ttl());
|
||||
@@ -27,8 +27,8 @@ public class Xoh_page_wtr_wkr_ {
|
||||
return Bry_.Add(subpages, page_content_sub, redirect_msg);
|
||||
}
|
||||
public static byte[] Bld_page_name(Bry_bfr tmp_bfr, Xoa_ttl ttl, byte[] display_ttl) {
|
||||
if (display_ttl != null) return display_ttl; // display_ttl explicitly set; use it
|
||||
if (ttl.Ns().Id() == Xow_ns_.Tid__special) { // special: omit query args, else excessively long titles: EX:"Special:Search/earth?fulltext=y&xowa page index=1"
|
||||
if (Bry_.Len_gt_0(display_ttl)) return display_ttl; // display_ttl explicitly set; use it
|
||||
if (ttl.Ns().Id() == Xow_ns_.Tid__special) { // special: omit query args, else excessively long titles: EX:"Special:Search/earth?fulltext=y&xowa page index=1"
|
||||
tmp_bfr.Add(ttl.Ns().Name_ui_w_colon()).Add(ttl.Page_txt_wo_qargs());
|
||||
return tmp_bfr.To_bry_and_clear();
|
||||
}
|
||||
@@ -36,7 +36,7 @@ public class Xoh_page_wtr_wkr_ {
|
||||
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, Bry_bfr tmp_bfr, Xoae_page page) {
|
||||
byte[] head_end = page.Html_data().Custom_head_tags().To_html(tmp_bfr);
|
||||
byte[] head_end = Xopg_tag_wtr.Write(tmp_bfr, Bool_.Y, Xopg_tag_wtr_cbk_.Basic, page.Html_data().Custom_head_tags());
|
||||
if (Bry_.Len_eq_0(head_end)) return;
|
||||
int insert_pos = Bry_find_.Find_fwd(html_bfr.Bfr(), Gfh_tag_.Head_rhs);
|
||||
if (insert_pos == Bry_find_.Not_found) {
|
||||
@@ -46,7 +46,7 @@ public class Xoh_page_wtr_wkr_ {
|
||||
html_bfr.Insert_at(insert_pos, head_end);
|
||||
}
|
||||
public static void Bld_html_end(Bry_bfr html_bfr, Bry_bfr tmp_bfr, Xoae_page page) {
|
||||
byte[] html_end = page.Html_data().Custom_tail_tags().To_html(tmp_bfr);
|
||||
byte[] html_end = Xopg_tag_wtr.Write(tmp_bfr, Bool_.Y, Xopg_tag_wtr_cbk_.Basic, page.Html_data().Custom_tail_tags());
|
||||
if (html_end == null) return;
|
||||
int insert_pos = Bry_find_.Find_bwd(html_bfr.Bfr(), Gfh_tag_.Html_rhs, html_bfr.Len());
|
||||
if (insert_pos == Bry_find_.Not_found) {
|
||||
|
||||
@@ -46,7 +46,7 @@ class Xoh_page_wtr_fxt {
|
||||
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;
|
||||
} private Bry_bfr tmp_bfr = Bry_bfr_.Reset(255); private Xowe_wiki wiki;
|
||||
public Xoae_app App() {return app;} private Xoae_app app;
|
||||
public void Test_page_name_by_display(String ttl, String display, String expd) {
|
||||
Tfds.Eq(expd, String_.new_a7(Xoh_page_wtr_wkr_.Bld_page_name(tmp_bfr, Xoa_ttl.parse(wiki, Bry_.new_a7(ttl)), Bry_.new_a7(display))));
|
||||
@@ -60,7 +60,7 @@ class Xoh_page_wtr_fxt {
|
||||
page.Data_raw_(Bry_.new_u8(raw));
|
||||
Xoh_page_wtr_mgr mgr = wiki.Html_mgr().Page_wtr_mgr();
|
||||
Xoh_page_wtr_wkr wkr = mgr.Wkr(Xopg_page_.Tid_edit);
|
||||
wkr.Write_body(tmp_bfr, Xoh_wtr_ctx.Basic, page);
|
||||
wkr.Write_body(tmp_bfr, wiki.Parser_mgr().Ctx(), Xoh_wtr_ctx.Basic, page);
|
||||
Tfds.Eq(expd, tmp_bfr.To_str_and_clear());
|
||||
}
|
||||
public void Test_read(String page_name, String page_text, String expd) {
|
||||
@@ -70,7 +70,7 @@ class Xoh_page_wtr_fxt {
|
||||
page.Data_raw_(Bry_.new_u8(page_text));
|
||||
Xoh_page_wtr_mgr mgr = wiki.Html_mgr().Page_wtr_mgr();
|
||||
Xoh_page_wtr_wkr wkr = mgr.Wkr(Xopg_page_.Tid_read);
|
||||
wkr.Write_body(tmp_bfr, Xoh_wtr_ctx.Basic, page);
|
||||
wkr.Write_body(tmp_bfr, wiki.Parser_mgr().Ctx(), Xoh_wtr_ctx.Basic, page);
|
||||
Tfds.Eq(expd, tmp_bfr.To_str_and_clear());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ class Xoh_ctg_mgr_fxt {
|
||||
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_();
|
||||
} private Xohp_ctg_grp_mgr ctg_grp_mgr; Xoae_app app; Xowe_wiki wiki; Bry_bfr tmp_bfr = Bry_bfr_.New();
|
||||
public Xoh_ctg_mgr_fxt Init_ctgs(String... v) {init_ctgs = v; return this;} private String[] init_ctgs;
|
||||
public void Test_html(String expd) {
|
||||
byte[][] ctgs_bry_ary = Bry_.Ary(init_ctgs);
|
||||
|
||||
@@ -16,15 +16,16 @@ 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; import gplx.*; import gplx.xowa.*;
|
||||
import gplx.gfui.kits.core.*;
|
||||
import gplx.xowa.langs.*;
|
||||
import gplx.xowa.wikis.ctgs.*; import gplx.xowa.xtns.gallery.*;
|
||||
import gplx.xowa.htmls.portal.*; import gplx.xowa.htmls.tocs.*; import gplx.xowa.wikis.modules.*; import gplx.xowa.htmls.core.htmls.*; import gplx.xowa.htmls.core.hzips.*;
|
||||
public class Xow_html_mgr implements GfoInvkAble {
|
||||
public class Xow_html_mgr implements Gfo_invk {
|
||||
public Xow_html_mgr(Xowe_wiki wiki) {
|
||||
this.wiki = wiki;
|
||||
html_wtr = new Xoh_html_wtr(wiki, this);
|
||||
Xoae_app app = wiki.Appe();
|
||||
page_wtr_mgr = new Xoh_page_wtr_mgr(app.Gui_mgr().Kit().Tid() != gplx.gfui.Gfui_kit_.Swing_tid); // reverse logic to handle swt,drd but not mem
|
||||
page_wtr_mgr = new Xoh_page_wtr_mgr(app.Gui_mgr().Kit().Tid() != Gfui_kit_.Swing_tid); // reverse logic to handle swt,drd but not mem
|
||||
Io_url file_dir = app.Fsys_mgr().Bin_xowa_file_dir().GenSubDir_nest("mediawiki.file");
|
||||
img_media_play_btn = gplx.langs.htmls.encoders.Gfo_url_encoder_.Fsys_lnx.Encode_to_file_protocol(file_dir.GenSubFil("play.png"));
|
||||
img_media_info_btn = gplx.langs.htmls.encoders.Gfo_url_encoder_.Fsys_lnx.Encode_to_file_protocol(file_dir.GenSubFil("info.png"));
|
||||
@@ -64,7 +65,7 @@ public class Xow_html_mgr implements GfoInvkAble {
|
||||
else if (ctx.Match(k, Invk_imgs)) return imgs_mgr;
|
||||
else if (ctx.Match(k, Invk_ns_ctg)) return ns_ctg;
|
||||
else if (ctx.Match(k, Invk_modules)) return module_mgr;
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
}
|
||||
public static final String
|
||||
Invk_article = "article"
|
||||
|
||||
@@ -19,12 +19,12 @@ package gplx.xowa.htmls.bridges.dbuis.fmtrs; import gplx.*; import gplx.xowa.*;
|
||||
import gplx.core.brys.fmtrs.*;
|
||||
import gplx.xowa.htmls.bridges.dbuis.tbls.*;
|
||||
public class Dbui_tbl_fmtr {
|
||||
private final Dbui_head_cell_fmtr head_cell_fmtr = new Dbui_head_cell_fmtr();
|
||||
private final Dbui_row_fmtr row_fmtr = new Dbui_row_fmtr();
|
||||
private final Dbui_head_cell_fmtr head_cell_fmtr = new Dbui_head_cell_fmtr();
|
||||
private final Dbui_row_fmtr row_fmtr = new Dbui_row_fmtr();
|
||||
public void Write(Bry_bfr bfr, Dbui_tbl_itm tbl, byte[] origin_html, byte[] delete_confirm_msg, Dbui_row_itm[] rows) {
|
||||
tbl_fmtr.Bld_bfr_many(bfr, tbl.Key(), Dbui_tbl_itm_.Calc_width(tbl), origin_html, delete_confirm_msg, head_cell_fmtr.Init(tbl), row_fmtr.Init(tbl, rows));
|
||||
}
|
||||
private static final Bry_fmtr tbl_fmtr = Bry_fmtr.new_(String_.Concat_lines_nl_skip_last
|
||||
private static final Bry_fmtr tbl_fmtr = Bry_fmtr.new_(String_.Concat_lines_nl_skip_last
|
||||
( ""
|
||||
, "<div class='xo_tbl xo_sortable' data-dbui-tbl_key='~{tbl_key}'~{delete_confirm_msg} style='width: ~{width}px;'>"
|
||||
, " <div class='xo_row xo_header'>"
|
||||
@@ -44,15 +44,15 @@ class Dbui_head_cell_fmtr implements gplx.core.brys.Bfr_arg {
|
||||
}
|
||||
bfr.Add_str_a7("\n <div class='xo_head xo_resizable_col' style='width:50px;'> </div>"); // btns headers
|
||||
}
|
||||
private static final Bry_fmtr fmtr = Bry_fmtr.new_(String_.Concat_lines_nl_skip_last
|
||||
private static final Bry_fmtr fmtr = Bry_fmtr.new_(String_.Concat_lines_nl_skip_last
|
||||
( ""
|
||||
, " <div class='xo_head xo_resizable_col' style='width:~{width}px;'>~{display}</div>"
|
||||
), "width", "display");
|
||||
}
|
||||
class Dbui_row_fmtr implements gplx.core.brys.Bfr_arg {
|
||||
private final Dbui_cells_fmtr cells_fmtr = new Dbui_cells_fmtr();
|
||||
private final Dbui_val_fmtr val_fmtr = Dbui_val_fmtr_.new_view();
|
||||
private final Bry_bfr row_key_bfr = Bry_bfr.new_(255);
|
||||
private final Dbui_cells_fmtr cells_fmtr = new Dbui_cells_fmtr();
|
||||
private final Dbui_val_fmtr val_fmtr = Dbui_val_fmtr_.new_view();
|
||||
private final Bry_bfr row_key_bfr = Bry_bfr_.New_w_size(255);
|
||||
private Dbui_tbl_itm tbl; private Dbui_row_itm[] rows;
|
||||
public Dbui_row_fmtr Init(Dbui_tbl_itm tbl, Dbui_row_itm[] rows) {this.tbl = tbl; this.rows = rows; return this;}
|
||||
public void Bfr_arg__add(Bry_bfr bfr) {
|
||||
@@ -66,7 +66,7 @@ class Dbui_row_fmtr implements gplx.core.brys.Bfr_arg {
|
||||
fmtr.Bld_bfr_many(bfr, row_key, row.Pkey(), cells_fmtr.Init(row_key, row));
|
||||
}
|
||||
}
|
||||
private static final Bry_fmtr fmtr = Bry_fmtr.new_(String_.Concat_lines_nl_skip_last
|
||||
private static final Bry_fmtr fmtr = Bry_fmtr.new_(String_.Concat_lines_nl_skip_last
|
||||
( ""
|
||||
, " <div id='~{row_key}' class='xo_row xo_draggable' data-dbui-row_pkey='~{pkey}'>~{cells}"
|
||||
, " </div>"
|
||||
|
||||
@@ -19,7 +19,7 @@ package gplx.xowa.htmls.bridges.dbuis.fmtrs; import gplx.*; import gplx.xowa.*;
|
||||
import gplx.xowa.htmls.bridges.dbuis.tbls.*;
|
||||
import org.junit.*;
|
||||
public class Dbui_tbl_fmtr_tst {
|
||||
@Before public void init() {fxt.Clear();} private final Dbui_tbl_fmtr_fxt fxt = new Dbui_tbl_fmtr_fxt();
|
||||
@Before public void init() {fxt.Clear();} private final Dbui_tbl_fmtr_fxt fxt = new Dbui_tbl_fmtr_fxt();
|
||||
@Test public void Basic() {
|
||||
// fxt.Test_write
|
||||
// ( fxt.Make_tbl()
|
||||
@@ -28,8 +28,8 @@ public class Dbui_tbl_fmtr_tst {
|
||||
}
|
||||
}
|
||||
class Dbui_tbl_fmtr_fxt {
|
||||
private final Bry_bfr bfr = Bry_bfr.new_(255);
|
||||
private final Dbui_tbl_fmtr tbl_fmtr = new Dbui_tbl_fmtr();
|
||||
private final Bry_bfr bfr = Bry_bfr_.New_w_size(255);
|
||||
private final Dbui_tbl_fmtr tbl_fmtr = new Dbui_tbl_fmtr();
|
||||
public void Clear() {}
|
||||
public Dbui_tbl_itm Make_tbl() {
|
||||
return null;
|
||||
|
||||
@@ -20,17 +20,17 @@ import gplx.core.ios.*;
|
||||
import gplx.xowa.htmls.core.hzips.*;
|
||||
import gplx.xowa.wikis.data.*;
|
||||
public class Xow_hdump_mgr {
|
||||
private final Xoh_page tmp_hpg = new Xoh_page(); private final Bry_bfr tmp_bfr = Bry_bfr.reset_(255);
|
||||
private final Io_stream_zip_mgr zip_mgr = new Io_stream_zip_mgr();
|
||||
private final Xoh_page tmp_hpg = new Xoh_page(); private final Bry_bfr tmp_bfr = Bry_bfr_.Reset(255);
|
||||
private final Io_stream_zip_mgr zip_mgr = new Io_stream_zip_mgr();
|
||||
public Xow_hdump_mgr(Xow_wiki wiki) {
|
||||
this.save_mgr = new Xow_hdump_mgr__save(wiki, hzip_mgr, zip_mgr, tmp_hpg);
|
||||
this.load_mgr = new Xow_hdump_mgr__load(wiki, hzip_mgr, zip_mgr, tmp_hpg, tmp_bfr);
|
||||
}
|
||||
public Xow_hdump_mgr__save Save_mgr() {return save_mgr;} private Xow_hdump_mgr__save save_mgr;
|
||||
public Xow_hdump_mgr__load Load_mgr() {return load_mgr;} private Xow_hdump_mgr__load load_mgr;
|
||||
public Xoh_hzip_mgr Hzip_mgr() {return hzip_mgr;} private final Xoh_hzip_mgr hzip_mgr = new Xoh_hzip_mgr();
|
||||
public Xoh_hzip_mgr Hzip_mgr() {return hzip_mgr;} private final Xoh_hzip_mgr hzip_mgr = new Xoh_hzip_mgr();
|
||||
public void Init_by_db(Xow_wiki wiki) {
|
||||
byte dflt_zip_tid = gplx.core.ios.Io_stream_.Tid_raw;
|
||||
byte dflt_zip_tid = gplx.core.ios.streams.Io_stream_.Tid_raw;
|
||||
boolean dflt_hzip_enable = false;
|
||||
boolean mode_is_b256 = false;
|
||||
if (wiki.Data__core_mgr() != null) { // TEST: handle null data mgr
|
||||
|
||||
@@ -29,10 +29,11 @@ public class Xow_hdump_mgr__load {
|
||||
this.make_mgr = new Xoh_make_mgr(wiki.App().Usr_dlg(), wiki.App().Fsys_mgr(), gplx.langs.htmls.encoders.Gfo_url_encoder_.Fsys_lnx, wiki.Domain_bry());
|
||||
}
|
||||
public Xoh_make_mgr Make_mgr() {return make_mgr;} private final Xoh_make_mgr make_mgr;
|
||||
public void Load(Xoae_page wpg) {
|
||||
public void Load_by_edit(Xoae_page wpg) {
|
||||
tmp_hpg.Init(wpg.Wiki(), wpg.Url(), wpg.Ttl(), wpg.Revision_data().Id());
|
||||
Load(tmp_hpg, wpg.Ttl());
|
||||
wpg.Hdump_data().Body_(tmp_hpg.Body());
|
||||
// wpg.Root_(new Xop_root_tkn());
|
||||
wpg.Root_(new gplx.xowa.parsers.Xop_root_tkn()); // HACK: set root, else load page will fail
|
||||
Fill_page(wpg, tmp_hpg);
|
||||
}
|
||||
public boolean Load(Xoh_page hpg, Xoa_ttl ttl) {
|
||||
@@ -50,7 +51,7 @@ public class Xow_hdump_mgr__load {
|
||||
hpg.Body_(page_override);
|
||||
return true;
|
||||
}
|
||||
Xowd_db_file html_db = wiki.Data__core_mgr().Dbs__get_by_id(tmp_dbpg.Html_db_id());
|
||||
Xow_db_file html_db = wiki.Data__core_mgr().Dbs__get_by_id_or_fail(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);
|
||||
@@ -59,7 +60,7 @@ public class Xow_hdump_mgr__load {
|
||||
}
|
||||
public byte[] Decode_as_bry(Bry_bfr bfr, Xoh_page hpg, byte[] src, boolean mode_is_diff) {hzip_mgr.Hctx().Mode_is_diff_(mode_is_diff); hzip_mgr.Decode(bfr, wiki, hpg, src); return bfr.To_bry_and_clear();}
|
||||
private byte[] Parse(Xoh_page hpg, int zip_tid, int hzip_tid, byte[] src) {
|
||||
if (zip_tid > gplx.core.ios.Io_stream_.Tid_raw)
|
||||
if (zip_tid > gplx.core.ios.streams.Io_stream_.Tid_raw)
|
||||
src = zip_mgr.Unzip((byte)zip_tid, src);
|
||||
if (hzip_tid == Xoh_hzip_dict_.Hzip__v1) {
|
||||
src = override_mgr__html.Get_or_same(hpg.Ttl().Page_db(), src);
|
||||
@@ -82,6 +83,15 @@ public class Xow_hdump_mgr__load {
|
||||
wpg_head.Itm__popups().Bind_hover_area_ (hpg_head.Imap_exists());
|
||||
wpg_head.Itm__gallery().Enabled_ (hpg_head.Gallery_packed_exists());
|
||||
wpg_head.Itm__hiero().Enabled_ (hpg_head.Hiero_exists());
|
||||
|
||||
// transfer images from Xoh_page to Xoae_page
|
||||
Xoh_img_mgr src_imgs = hpg.Img_mgr();
|
||||
int len = src_imgs.Len();
|
||||
for (int i = 0; i < len; ++i) {
|
||||
gplx.xowa.files.Xof_fsdb_itm itm = src_imgs.Get_at(i);
|
||||
wpg.Hdump_data().Imgs().Add(itm);
|
||||
wpg.File_queue().Add(itm); // add to file_queue for http_server
|
||||
}
|
||||
}
|
||||
private static boolean Load__fail(Xoh_page hpg) {hpg.Exists_n_(); return false;}
|
||||
private static boolean Load__dbpg(Xow_wiki wiki, Xowd_page_itm dbpg, Xoh_page hpg, Xoa_ttl ttl) {
|
||||
|
||||
@@ -107,7 +107,7 @@ public class Xow_hdump_mgr__load_tst {
|
||||
// }
|
||||
}
|
||||
class Xodb_hdump_mgr__base_fxt {
|
||||
protected Bry_bfr bfr = Bry_bfr.reset_(255);
|
||||
protected Bry_bfr bfr = Bry_bfr_.Reset(255);
|
||||
protected Xowe_wiki wiki; protected Xoae_page page;
|
||||
private Xow_hdump_mgr hdump_mgr;
|
||||
public Xop_fxt Fxt() {return fxt;} protected Xop_fxt fxt;
|
||||
@@ -117,7 +117,7 @@ class Xodb_hdump_mgr__base_fxt {
|
||||
wiki = fxt.Wiki();
|
||||
page = wiki.Parser_mgr().Ctx().Page();
|
||||
hdump_mgr = wiki.Html__hdump_mgr();
|
||||
hdump_mgr.Init_by_db(gplx.core.ios.Io_stream_.Tid_raw, false, false);
|
||||
hdump_mgr.Init_by_db(gplx.core.ios.streams.Io_stream_.Tid_raw, false, false);
|
||||
}
|
||||
fxt.Reset();
|
||||
page.Revision_data().Id_(0);
|
||||
@@ -135,7 +135,7 @@ class Xodb_hdump_mgr__base_fxt {
|
||||
}
|
||||
}
|
||||
class Xohd_hdump_wtr_fxt extends Xodb_hdump_mgr__base_fxt {
|
||||
private List_adp expd_itms_xfers = List_adp_.new_();
|
||||
private List_adp expd_itms_xfers = List_adp_.New();
|
||||
@Override public void Clear_end() {expd_itms_xfers.Clear();}
|
||||
public void Expd_itms_xfers(Xohd_img_itm__base... itms) {expd_itms_xfers.Add_many((Object[])itms);}
|
||||
public void Test_write_all (String raw, String expd_html) {Test_write(Bool_.N, raw, expd_html);}
|
||||
|
||||
@@ -19,8 +19,8 @@ package gplx.xowa.htmls.core; import gplx.*; import gplx.xowa.*; import gplx.xow
|
||||
import gplx.xowa.htmls.core.htmls.*; import gplx.xowa.htmls.core.wkrs.*; import gplx.xowa.htmls.core.hzips.*; import gplx.xowa.htmls.heads.*;
|
||||
import gplx.core.ios.*; import gplx.core.primitives.*; import gplx.xowa.wikis.data.*; import gplx.xowa.wikis.pages.*;
|
||||
public class Xow_hdump_mgr__save {
|
||||
private final Xow_wiki wiki; private final Xoh_hzip_mgr hzip_mgr; private final Io_stream_zip_mgr zip_mgr;
|
||||
private final Xoh_page tmp_hpg; private final Xoh_hzip_bfr tmp_bfr = Xoh_hzip_bfr.New_txt(32); private Bool_obj_ref html_db_is_new = Bool_obj_ref.n_();
|
||||
private final Xow_wiki wiki; private final Xoh_hzip_mgr hzip_mgr; private final Io_stream_zip_mgr zip_mgr;
|
||||
private final Xoh_page tmp_hpg; private final Xoh_hzip_bfr tmp_bfr = Xoh_hzip_bfr.New_txt(32); private Bool_obj_ref html_db_is_new = Bool_obj_ref.n_();
|
||||
private int dflt_zip_tid, dflt_hzip_tid;
|
||||
public Xow_hdump_mgr__save(Xow_wiki wiki, Xoh_hzip_mgr hzip_mgr, Io_stream_zip_mgr zip_mgr, Xoh_page tmp_hpg) {
|
||||
this.wiki = wiki; this.hzip_mgr = hzip_mgr; this.zip_mgr = zip_mgr; this.tmp_hpg = tmp_hpg;
|
||||
@@ -33,11 +33,11 @@ public class Xow_hdump_mgr__save {
|
||||
synchronized (tmp_hpg) {
|
||||
Bld_hdump(page);
|
||||
tmp_hpg.Ctor_by_page(tmp_bfr, page);
|
||||
Xowd_db_file html_db = Get_html_db(wiki, page, html_db_is_new.Val_n_());
|
||||
Xow_db_file html_db = Get_html_db(wiki, page, html_db_is_new.Val_n_());
|
||||
return Save(tmp_hpg, html_db, html_db_is_new.Val());
|
||||
}
|
||||
}
|
||||
public int Save(Xoh_page hpg, Xowd_db_file html_db, boolean insert) {
|
||||
public int Save(Xoh_page hpg, Xow_db_file html_db, boolean insert) {
|
||||
byte[] db_body = Write(tmp_bfr, wiki, hpg, hzip_mgr, zip_mgr, dflt_zip_tid, dflt_hzip_tid, hpg.Body());
|
||||
if (insert) html_db.Tbl__html().Insert(hpg, dflt_zip_tid, dflt_hzip_tid, db_body);
|
||||
else html_db.Tbl__html().Update(hpg, dflt_zip_tid, dflt_hzip_tid, db_body);
|
||||
@@ -45,30 +45,30 @@ public class Xow_hdump_mgr__save {
|
||||
}
|
||||
public void Bld_hdump(Xoae_page page) {
|
||||
page.File_queue().Clear(); // need to reset uid to 0, else xowa_file_# will keep incrementing upwards
|
||||
wiki.Html__wtr_mgr().Wkr(Xopg_page_.Tid_read).Write_body(tmp_bfr, Xoh_wtr_ctx.Hdump, page); // save as hdump_fmt
|
||||
wiki.Html__wtr_mgr().Wkr(Xopg_page_.Tid_read).Write_body(tmp_bfr, page.Wikie().Parser_mgr().Ctx(), Xoh_wtr_ctx.Hdump, page); // save as hdump_fmt
|
||||
page.Hdump_data().Body_(tmp_bfr.To_bry_and_clear());
|
||||
}
|
||||
private byte[] Write(Xoh_hzip_bfr bfr, Xow_wiki wiki, Xoh_page hpg, Xoh_hzip_mgr hzip_mgr, Io_stream_zip_mgr zip_mgr, int zip_tid, int hzip_tid, byte[] src) {
|
||||
if (hzip_tid != Xoh_hzip_dict_.Hzip__none) src = hzip_mgr.Encode_as_bry((Xoh_hzip_bfr)bfr.Clear(), wiki, hpg, src);
|
||||
src_as_hzip = src;
|
||||
if (zip_tid > gplx.core.ios.Io_stream_.Tid_raw)
|
||||
if (zip_tid > gplx.core.ios.streams.Io_stream_.Tid_raw)
|
||||
src = zip_mgr.Zip((byte)zip_tid, src);
|
||||
return src;
|
||||
}
|
||||
private static Xowd_db_file Get_html_db(Xow_wiki wiki, Xoae_page page, Bool_obj_ref html_db_is_new) {
|
||||
Xowd_db_file rv = Xowd_db_file.Null;
|
||||
Xowd_db_mgr core_data_mgr = wiki.Data__core_mgr();
|
||||
private static Xow_db_file Get_html_db(Xow_wiki wiki, Xoae_page page, Bool_obj_ref html_db_is_new) {
|
||||
Xow_db_file rv = Xow_db_file.Null;
|
||||
Xow_db_mgr core_data_mgr = wiki.Data__core_mgr();
|
||||
int html_db_id = page.Revision_data().Html_db_id();
|
||||
if (html_db_id == -1) {
|
||||
html_db_is_new.Val_y_();
|
||||
rv = core_data_mgr.Db__html();
|
||||
if (rv == null) rv = core_data_mgr.Dbs__make_by_tid(Xowd_db_file_.Tid_html_data);
|
||||
if (rv == null) rv = core_data_mgr.Dbs__make_by_tid(Xow_db_file_.Tid__html_data);
|
||||
html_db_id = rv.Id();
|
||||
page.Revision_data().Html_db_id_(html_db_id);
|
||||
core_data_mgr.Tbl__page().Update__html_db_id(page.Revision_data().Id(), html_db_id);
|
||||
}
|
||||
else {
|
||||
rv = core_data_mgr.Dbs__get_by_id(html_db_id);
|
||||
rv = core_data_mgr.Dbs__get_by_id_or_fail(html_db_id);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -21,12 +21,12 @@ import gplx.dbs.*; import gplx.xowa.bldrs.*; import gplx.xowa.bldrs.cmds.*;
|
||||
import gplx.xowa.htmls.core.*; import gplx.xowa.htmls.core.htmls.*; import gplx.xowa.htmls.core.dbs.*; import gplx.xowa.htmls.core.hzips.*;
|
||||
import gplx.xowa.wikis.nss.*; import gplx.xowa.wikis.pages.*; import gplx.xowa.wikis.dbs.*; import gplx.xowa.wikis.data.*;
|
||||
import gplx.xowa.apps.apis.xowa.bldrs.imports.*;
|
||||
public class Xob_hdump_bldr implements GfoInvkAble {
|
||||
public class Xob_hdump_bldr implements Gfo_invk {
|
||||
private boolean enabled, hzip_enabled, hzip_diff, hzip_b256; private byte zip_tid = Byte_.Max_value_127;
|
||||
private Xowe_wiki wiki; private Xow_hdump_mgr hdump_mgr;
|
||||
private Xob_ns_to_db_mgr ns_to_db_mgr; int prv_row_len = 0;
|
||||
private Xoh_stat_tbl stats_tbl; private Xoh_stat_itm tmp_stat_itm;
|
||||
private final Xoh_page tmp_hpg = new Xoh_page(); private final Bry_bfr tmp_bfr = Bry_bfr.new_();
|
||||
private final Xoh_page tmp_hpg = new Xoh_page(); private final Bry_bfr tmp_bfr = Bry_bfr_.New();
|
||||
private boolean op_sys_is_wnt;
|
||||
public boolean Init(Xowe_wiki wiki, Db_conn make_conn) {
|
||||
if (!enabled) return false;
|
||||
@@ -36,18 +36,18 @@ public class Xob_hdump_bldr implements GfoInvkAble {
|
||||
Xoapi_import import_cfg = wiki.Appe().Api_root().Bldr().Wiki().Import();
|
||||
if (zip_tid == Byte_.Max_value_127) zip_tid = import_cfg.Zip_tid_html();
|
||||
hdump_mgr.Init_by_db(zip_tid, hzip_enabled, hzip_b256);
|
||||
Xowd_db_mgr core_data_mgr = wiki.Db_mgr_as_sql().Core_data_mgr();
|
||||
Xow_db_mgr core_data_mgr = wiki.Db_mgr_as_sql().Core_data_mgr();
|
||||
this.ns_to_db_mgr = new Xob_ns_to_db_mgr(new Xob_ns_to_db_wkr__html(core_data_mgr.Db__core()), core_data_mgr, import_cfg.Html_db_max());
|
||||
Xob_ns_file_itm.Init_ns_bldr_data(Xowd_db_file_.Tid_html_data, wiki.Ns_mgr(), gplx.xowa.apps.apis.xowa.bldrs.imports.Xoapi_import.Ns_file_map__each);
|
||||
Xob_ns_file_itm.Init_ns_bldr_data(Xow_db_file_.Tid__html_data, wiki.Ns_mgr(), gplx.xowa.apps.apis.xowa.bldrs.imports.Xoapi_import.Ns_file_map__each);
|
||||
return true;
|
||||
}
|
||||
public void Insert(Xoae_page page) {
|
||||
tmp_hpg.Clear(); // NOTE: must clear tmp_hpg or else will leak memory during mass build; DATE:2016-01-09
|
||||
page.File_queue().Clear(); // need to reset uid to 0, else xowa_file_# will resume from last
|
||||
wiki.Html_mgr().Page_wtr_mgr().Wkr(Xopg_page_.Tid_read).Write_body(tmp_bfr, Xoh_wtr_ctx.Hdump, page); // write to html in hdump mode
|
||||
wiki.Html_mgr().Page_wtr_mgr().Wkr(Xopg_page_.Tid_read).Write_body(tmp_bfr, wiki.Parser_mgr().Ctx(), Xoh_wtr_ctx.Hdump, page); // write to html in hdump mode
|
||||
byte[] orig_bry = tmp_bfr.To_bry_and_clear();
|
||||
page.Hdump_data().Body_(orig_bry); // write to body bry
|
||||
Xowd_db_file html_db = ns_to_db_mgr.Get_by_ns(page.Ttl().Ns().Bldr_data(), prv_row_len); // get html_db
|
||||
Xow_db_file html_db = ns_to_db_mgr.Get_by_ns(page.Ttl().Ns().Bldr_data(), prv_row_len); // get html_db
|
||||
this.prv_row_len = hdump_mgr.Save_mgr().Save(tmp_hpg.Ctor_by_page(tmp_bfr, page), html_db, true); // save to db
|
||||
if (hzip_diff) Hzip_exec(orig_bry);
|
||||
stats_tbl.Insert(tmp_hpg, tmp_stat_itm, page.Root().Root_src().length, tmp_hpg.Body().length, prv_row_len); // save stats
|
||||
@@ -70,7 +70,7 @@ public class Xob_hdump_bldr implements GfoInvkAble {
|
||||
else if (ctx.Match(k, Invk_hzip_enabled_)) hzip_enabled = m.ReadYn("v");
|
||||
else if (ctx.Match(k, Invk_hzip_diff_)) hzip_diff = m.ReadYn("v");
|
||||
else if (ctx.Match(k, Invk_hzip_b256_)) hzip_b256 = m.ReadYn("v");
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
}
|
||||
private static final String Invk_enabled_ = "enabled_", Invk_zip_tid_ = "zip_tid_", Invk_hzip_enabled_ = "hzip_enabled_", Invk_hzip_diff_ = "hzip_diff_", Invk_hzip_b256_ = "hzip_b256_";
|
||||
|
||||
@@ -22,14 +22,14 @@ import gplx.xowa.files.*;
|
||||
import gplx.xowa.guis.*;
|
||||
class Xob_hdump_img_cmd extends Xob_itm_basic_base implements Xob_cmd {
|
||||
public Xob_hdump_img_cmd(Xob_bldr bldr, Xowe_wiki wiki) {this.Cmd_ctor(bldr, wiki);}
|
||||
public String Cmd_key() {return Key_const;} public static final String Key_const = "hdump.make.imgs";
|
||||
public String Cmd_key() {return Key_const;} public static final String Key_const = "hdump.make.imgs";
|
||||
public void Cmd_init(Xob_bldr bldr) {}
|
||||
public void Cmd_bgn(Xob_bldr bldr) {}
|
||||
public void Cmd_run() {Exec_main();}
|
||||
public void Cmd_end() {}
|
||||
public void Cmd_term() {}
|
||||
private void Exec_main() {
|
||||
Bry_bfr bfr = Bry_bfr.reset_(Io_mgr.Len_mb);
|
||||
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_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());
|
||||
@@ -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_clause = 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"
|
||||
@@ -83,7 +83,7 @@ interface Page_async_cmd {
|
||||
}
|
||||
// class Page_async_cmd__img : Page_async_cmd {
|
||||
// private Xoh_page hpg;
|
||||
// private List_adp missing = List_adp_.new_();
|
||||
// private List_adp missing = List_adp_.New();
|
||||
// public Page_async_cmd__img(Xoh_page hpg) {this.hpg = hpg;}
|
||||
// public void Prep() {
|
||||
//// int len = hpg.Img_count();
|
||||
|
||||
@@ -18,8 +18,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.htmls.core.bldrs; import gplx.*; import gplx.xowa.*; import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.*;
|
||||
import gplx.dbs.*;
|
||||
class Xob_link_dump_tbl implements Rls_able {
|
||||
public static final String Tbl_name = "link_dump"; private static final Dbmeta_fld_list flds = Dbmeta_fld_list.new_();
|
||||
public static final String
|
||||
public static final String Tbl_name = "link_dump"; private static final Dbmeta_fld_list flds = new Dbmeta_fld_list();
|
||||
public static final String
|
||||
Fld_uid = flds.Add_int_pkey_autonum("uid")
|
||||
, Fld_src_page_id = flds.Add_int("src_page_id")
|
||||
, Fld_src_html_uid = flds.Add_int("src_html_uid")
|
||||
@@ -32,7 +32,7 @@ class Xob_link_dump_tbl implements Rls_able {
|
||||
this.conn = conn;
|
||||
conn.Rls_reg(this);
|
||||
}
|
||||
public Db_conn Conn() {return conn;} private final Db_conn conn;
|
||||
public Db_conn Conn() {return conn;} private final Db_conn conn;
|
||||
public void Create_tbl() {conn.Meta_tbl_create(Dbmeta_tbl_itm.New(Tbl_name, flds));}
|
||||
public void Create_idx_1() {
|
||||
conn.Meta_idx_create
|
||||
|
||||
@@ -19,15 +19,15 @@ 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;
|
||||
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) {
|
||||
private final Xow_db_file page_db;
|
||||
public Xob_ns_to_db_wkr__html(Xow_db_file page_db) {this.page_db = page_db;}
|
||||
public byte Db_tid() {return Xow_db_file_.Tid__html_data;}
|
||||
public void Tbl_init(Xow_db_file db) {
|
||||
Xoh_page_tbl tbl = db.Tbl__html();
|
||||
tbl.Create_tbl();
|
||||
tbl.Insert_bgn();
|
||||
}
|
||||
public void Tbl_term(Xowd_db_file db) {
|
||||
public void Tbl_term(Xow_db_file db) {
|
||||
db.Tbl__text().Insert_end();
|
||||
Db_conn db_conn = db.Conn();
|
||||
new Db_attach_mgr(page_db.Conn(), new Db_attach_itm("html_db", db.Url()))
|
||||
|
||||
@@ -26,16 +26,16 @@ public class Xob_redlink_mkr_cmd extends Xob_itm_basic_base implements Xob_cmd {
|
||||
public String Cmd_key() {return Xob_cmd_keys.Key_html_redlinks;}
|
||||
public void Cmd_run() {Read_data();}
|
||||
private void Read_data() {
|
||||
Bry_bfr bfr = Bry_bfr.reset_(255);
|
||||
Bry_bfr bfr = Bry_bfr_.Reset(255);
|
||||
wiki.Init_assert();
|
||||
Xowd_db_file core_db = wiki.Data__core_mgr().Db__core();
|
||||
Xow_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_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);
|
||||
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()) {
|
||||
@@ -70,7 +70,7 @@ 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_clause = 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"
|
||||
@@ -86,7 +86,7 @@ public class Xob_redlink_mkr_cmd extends Xob_itm_basic_base implements Xob_cmd {
|
||||
public void Cmd_term() {}
|
||||
@Override public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_commit_interval_)) commit_interval = m.ReadInt("v");
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
} private static final String Invk_commit_interval_ = "commit_interval_";
|
||||
}
|
||||
|
||||
38
400_xowa/src/gplx/xowa/htmls/core/dbs/Xoh_page_row.java
Normal file
38
400_xowa/src/gplx/xowa/htmls/core/dbs/Xoh_page_row.java
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
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.dbs; import gplx.*; import gplx.xowa.*; import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.*;
|
||||
public class Xoh_page_row {
|
||||
public void Load(int page_id, int head_flag, int body_flag, byte[] display_ttl, byte[] content_sub, byte[] sidebar_div, byte[] body) {
|
||||
this.page_id = page_id;
|
||||
this.head_flag = head_flag;
|
||||
this.body_flag = body_flag;
|
||||
this.display_ttl = display_ttl;
|
||||
this.content_sub = content_sub;
|
||||
this.sidebar_div = sidebar_div;
|
||||
this.body = body;
|
||||
}
|
||||
public int Page_id() {return page_id;} private int page_id;
|
||||
public int Head_flag() {return head_flag;} private int head_flag;
|
||||
public int Body_flag() {return body_flag;} private int body_flag;
|
||||
public byte[] Display_ttl() {return display_ttl;} private byte[] display_ttl;
|
||||
public byte[] Content_sub() {return content_sub;} private byte[] content_sub;
|
||||
public byte[] Sidebar_div() {return sidebar_div;} private byte[] sidebar_div;
|
||||
public byte[] Body() {return body;} private byte[] body;
|
||||
|
||||
public static final int Db_row_size_fixed = (3 * 4); // page_id, head_flag, body_flag
|
||||
}
|
||||
@@ -18,10 +18,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.htmls.core.dbs; import gplx.*; import gplx.xowa.*; import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.*;
|
||||
import gplx.dbs.*; import gplx.core.brys.*;
|
||||
public class Xoh_page_tbl implements Rls_able {
|
||||
private final String tbl_name = "html"; private final Dbmeta_fld_list flds = Dbmeta_fld_list.new_();
|
||||
private final String fld_page_id, fld_head_flag, fld_body_flag, fld_display_ttl, fld_content_sub, fld_sidebar_div, fld_body;
|
||||
private final Db_conn conn; private Db_stmt stmt_select, stmt_insert, stmt_delete, stmt_update;
|
||||
private final Int_flag_bldr body_flag_bldr = new Int_flag_bldr().Pow_ary_bld_(3, 2); // 8 different zip types; 4 different hzip types
|
||||
private final String fld_page_id, fld_head_flag, fld_body_flag, fld_display_ttl, fld_content_sub, fld_sidebar_div, fld_body;
|
||||
private Db_stmt stmt_select, stmt_insert, stmt_delete, stmt_update;
|
||||
private final Int_flag_bldr body_flag_bldr = new Int_flag_bldr().Pow_ary_bld_(3, 2); // 8 different zip types; 4 different hzip types
|
||||
public Xoh_page_tbl(Db_conn conn) {
|
||||
this.conn = conn;
|
||||
this.fld_page_id = flds.Add_int_pkey("page_id");
|
||||
@@ -33,14 +32,19 @@ public class Xoh_page_tbl implements Rls_able {
|
||||
this.fld_body = flds.Add_bry("body");
|
||||
conn.Rls_reg(this);
|
||||
}
|
||||
public Db_conn Conn() {return conn;}
|
||||
public Db_conn Conn() {return conn;} private final Db_conn conn;
|
||||
public String Tbl_name() {return tbl_name;} private final String tbl_name = "html";
|
||||
public Dbmeta_fld_list Flds() {return flds;} private final Dbmeta_fld_list flds = new Dbmeta_fld_list();
|
||||
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);}
|
||||
public void Insert(int page_id, int head_flag, int zip_tid, int hzip_tid, byte[] display_ttl, byte[] content_sub, byte[] sidebar_div, byte[] body) {
|
||||
if (stmt_insert == null) stmt_insert = conn.Stmt_insert(tbl_name, flds);
|
||||
int body_flag = body_flag_bldr.Set(0, zip_tid).Set(1, hzip_tid).Encode();
|
||||
Insert(page_id, head_flag, body_flag, display_ttl, content_sub, sidebar_div, body);
|
||||
}
|
||||
public void Insert(int page_id, int head_flag, int body_flag, byte[] display_ttl, byte[] content_sub, byte[] sidebar_div, byte[] body) {
|
||||
if (stmt_insert == null) stmt_insert = conn.Stmt_insert(tbl_name, flds);
|
||||
stmt_insert.Clear().Val_int(fld_page_id, page_id);
|
||||
Fill_stmt(stmt_insert, head_flag, body_flag, display_ttl, content_sub, sidebar_div, body);
|
||||
stmt_insert.Exec_insert();
|
||||
@@ -71,13 +75,33 @@ public class Xoh_page_tbl implements Rls_able {
|
||||
}
|
||||
finally {rdr.Rls();}
|
||||
}
|
||||
public boolean Select_as_row(Xoh_page_row rv, int page_id) {
|
||||
if (stmt_select == null) stmt_select = conn.Stmt_select(tbl_name, flds, fld_page_id);
|
||||
Db_rdr rdr = stmt_select.Clear().Crt_int(fld_page_id, page_id).Exec_select__rls_manual();
|
||||
try {
|
||||
if (rdr.Move_next()) {
|
||||
rv.Load
|
||||
( page_id
|
||||
, rdr.Read_int(fld_head_flag)
|
||||
, rdr.Read_int(fld_body_flag)
|
||||
, rdr.Read_bry_by_str(fld_display_ttl)
|
||||
, rdr.Read_bry_by_str(fld_content_sub)
|
||||
, rdr.Read_bry_by_str(fld_sidebar_div)
|
||||
, rdr.Read_bry(fld_body)
|
||||
);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
finally {rdr.Rls();}
|
||||
}
|
||||
public void Rls() {
|
||||
stmt_insert = Db_stmt_.Rls(stmt_insert);
|
||||
stmt_delete = Db_stmt_.Rls(stmt_delete);
|
||||
stmt_select = Db_stmt_.Rls(stmt_select);
|
||||
stmt_update = Db_stmt_.Rls(stmt_update);
|
||||
}
|
||||
private void Fill_stmt(Db_stmt stmt, int head_flag, int body_flag, byte[] display_ttl, byte[] content_sub, byte[] sidebar_div, byte[] body) {
|
||||
public void Fill_stmt(Db_stmt stmt, int head_flag, int body_flag, byte[] display_ttl, byte[] content_sub, byte[] sidebar_div, byte[] body) {
|
||||
stmt.Val_int(fld_head_flag, head_flag).Val_int(fld_body_flag, body_flag)
|
||||
.Val_bry_as_str(fld_display_ttl, Bry_.Coalesce_to_empty(display_ttl)).Val_bry_as_str(fld_content_sub, Bry_.Coalesce_to_empty(content_sub)).Val_bry_as_str(fld_sidebar_div, Bry_.Coalesce_to_empty(sidebar_div)).Val_bry(fld_body, body);
|
||||
}
|
||||
|
||||
@@ -18,9 +18,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.htmls.core.dbs; import gplx.*; import gplx.xowa.*; import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.*;
|
||||
import gplx.dbs.*;
|
||||
public class Xoh_redlink_tbl implements Rls_able {
|
||||
private final String tbl_name = "html_redlink"; private final Dbmeta_fld_list flds = Dbmeta_fld_list.new_();
|
||||
private final String fld_page_id, fld_redlink_uids;
|
||||
private final Db_conn conn; private Db_stmt stmt_select, stmt_insert, stmt_delete, stmt_update;
|
||||
private final String tbl_name = "html_redlink"; private final Dbmeta_fld_list flds = new Dbmeta_fld_list();
|
||||
private final String fld_page_id, fld_redlink_uids;
|
||||
private final Db_conn conn; private Db_stmt stmt_select, stmt_insert, stmt_delete, stmt_update;
|
||||
public Xoh_redlink_tbl(Db_conn conn) {
|
||||
this.conn = conn;
|
||||
this.fld_page_id = flds.Add_int_pkey("page_id");
|
||||
|
||||
@@ -19,7 +19,7 @@ package gplx.xowa.htmls.core.htmls.tidy; import gplx.*; import gplx.xowa.*; impo
|
||||
import gplx.core.envs.*;
|
||||
import gplx.langs.htmls.*;
|
||||
import gplx.xowa.apps.fsys.*;
|
||||
public class Xoh_tidy_mgr implements GfoInvkAble {
|
||||
public class Xoh_tidy_mgr implements Gfo_invk {
|
||||
private Xoh_tidy_wkr wkr = Xoh_tidy_wkr_.Wkr_null; // TEST: set default wkr to null
|
||||
private Xoh_tidy_wkr_tidy wkr_tidy = new Xoh_tidy_wkr_tidy(); private Xoh_tidy_wkr_jtidy wkr_jtidy = new Xoh_tidy_wkr_jtidy();
|
||||
public void Init_by_app(Xoae_app app) {
|
||||
@@ -52,7 +52,7 @@ public class Xoh_tidy_mgr implements GfoInvkAble {
|
||||
else if (ctx.Match(k, Invk_engine_type_)) Wkr_tid_(Xoh_tidy_wkr_.Xto_tid(m.ReadStr("v")));
|
||||
else if (ctx.Match(k, Invk_engine_type_list)) return Xoh_tidy_wkr_.Options__list;
|
||||
else if (ctx.Match(k, Invk_lib)) return wkr_tidy;
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
}
|
||||
private static final String
|
||||
@@ -71,7 +71,7 @@ public class Xoh_tidy_mgr implements GfoInvkAble {
|
||||
bfr.Delete_rng_to_end(find);
|
||||
return true;
|
||||
}
|
||||
private static final byte[] // MW:includes/parser/Tidy.php|getWrapped
|
||||
private static final byte[] // MW:includes/parser/Tidy.php|getWrapped
|
||||
Wrap_bgn = Bry_.new_a7
|
||||
( "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"
|
||||
+ "<html>"
|
||||
|
||||
@@ -72,7 +72,7 @@ public class Xoh_tidy_mgr_tst {
|
||||
}
|
||||
}
|
||||
class Xoh_tidy_mgr_fxt {
|
||||
private Bry_bfr bfr = Bry_bfr.reset_(255);
|
||||
private Bry_bfr bfr = Bry_bfr_.Reset(255);
|
||||
public void Clear() {
|
||||
bfr.Clear();
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ package gplx.xowa.htmls.core.htmls.utls; import gplx.*; import gplx.xowa.*; impo
|
||||
import gplx.langs.htmls.*;
|
||||
public class Xoh_anchor_kv_bldr {
|
||||
private byte[] base_url; private boolean has_qarg;
|
||||
private final Bry_bfr tmp_bfr = Bry_bfr.new_(16), apos_bfr = Bry_bfr.new_(16);
|
||||
private final Bry_bfr tmp_bfr = Bry_bfr_.New_w_size(16), apos_bfr = Bry_bfr_.New_w_size(16);
|
||||
public Xoh_anchor_kv_bldr Init_w_qarg(byte[] base_url) {return Init(Bool_.Y, base_url);}
|
||||
public Xoh_anchor_kv_bldr Init(boolean has_qarg, byte[] base_url) {
|
||||
this.has_qarg = has_qarg; this.base_url = base_url;
|
||||
|
||||
@@ -19,7 +19,7 @@ package gplx.xowa.htmls.core.htmls.utls; import gplx.*; import gplx.xowa.*; impo
|
||||
import gplx.langs.htmls.*; import gplx.xowa.htmls.hrefs.*;
|
||||
public class Xoh_lnki_bldr {
|
||||
private final Xoa_app app; private final Xoh_href_wtr href_wtr; private final byte[] img_root_dir;
|
||||
private final Bry_bfr tmp_bfr = Bry_bfr.reset_(255);
|
||||
private final Bry_bfr tmp_bfr = Bry_bfr_.Reset(255);
|
||||
private byte[] href, title, id, caption;
|
||||
private byte[] img_rel_path; private int img_w, img_h; private boolean img_pos_is_left;
|
||||
public Xoh_lnki_bldr(Xoa_app app, Xoh_href_wtr href_wtr) {
|
||||
|
||||
@@ -18,7 +18,7 @@ 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.*;
|
||||
import org.junit.*; import gplx.core.encoders.*;
|
||||
public class Xoh_hzip_int__tst {
|
||||
private final Xoh_hzip_int__fxt fxt = new Xoh_hzip_int__fxt();
|
||||
private final Xoh_hzip_int__fxt fxt = new Xoh_hzip_int__fxt();
|
||||
@Test public void Reqd__1() {
|
||||
fxt.Test__encode(1, 0, "!");
|
||||
fxt.Test__encode(1, 84, "u");
|
||||
@@ -37,8 +37,8 @@ public class Xoh_hzip_int__tst {
|
||||
}
|
||||
}
|
||||
class Xoh_hzip_int__fxt {
|
||||
private final Bry_bfr bfr = Bry_bfr.new_();
|
||||
private final gplx.core.primitives.Int_obj_ref count_ref = gplx.core.primitives.Int_obj_ref.neg1_();
|
||||
private final Bry_bfr bfr = Bry_bfr_.New();
|
||||
private final gplx.core.primitives.Int_obj_ref count_ref = gplx.core.primitives.Int_obj_ref.New_neg1();
|
||||
public void Test__encode(int reqd, int val, String expd) {
|
||||
Gfo_hzip_int_.Encode(reqd, bfr, val);
|
||||
byte[] actl = bfr.To_bry_and_clear();
|
||||
|
||||
@@ -18,7 +18,7 @@ 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.*;
|
||||
import org.junit.*;
|
||||
public class Xoh_hzip_int_tst {
|
||||
private final Xoh_hzip_int_fxt fxt = new Xoh_hzip_int_fxt();
|
||||
private final Xoh_hzip_int_fxt fxt = new Xoh_hzip_int_fxt();
|
||||
@Test public void B256__reqd__1() {
|
||||
fxt.Init__b256();
|
||||
fxt.Test__b256(1, 0 , 0);
|
||||
@@ -65,9 +65,9 @@ public class Xoh_hzip_int_tst {
|
||||
}
|
||||
}
|
||||
class Xoh_hzip_int_fxt {
|
||||
private final Bry_bfr bfr = Bry_bfr.new_();
|
||||
private final gplx.core.primitives.Int_obj_ref count_ref = gplx.core.primitives.Int_obj_ref.neg1_();
|
||||
private final Xoh_hzip_int hzint = new Xoh_hzip_int();
|
||||
private final Bry_bfr bfr = Bry_bfr_.New();
|
||||
private final gplx.core.primitives.Int_obj_ref count_ref = gplx.core.primitives.Int_obj_ref.New_neg1();
|
||||
private final Xoh_hzip_int hzint = new Xoh_hzip_int();
|
||||
public void Init__b256() {hzint.Mode_is_b256_(Bool_.Y);}
|
||||
public void Init__b085() {hzint.Mode_is_b256_(Bool_.N);}
|
||||
public void Test__b256(int reqd, int val, int... expd_ints) {
|
||||
|
||||
@@ -19,8 +19,8 @@ package gplx.xowa.htmls.core.hzips; import gplx.*; import gplx.xowa.*; import gp
|
||||
import gplx.dbs.*; import gplx.dbs.engines.sqlite.*; import gplx.xowa.htmls.core.makes.imgs.*; import gplx.xowa.htmls.core.hzips.*;
|
||||
import gplx.xowa.wikis.pages.*;
|
||||
public class Xoh_stat_tbl implements Rls_able {
|
||||
private static final String tbl_name = "hdump_stats"; private static final Dbmeta_fld_list flds = Dbmeta_fld_list.new_();
|
||||
private static final String
|
||||
private static final String tbl_name = "hdump_stats"; private static final Dbmeta_fld_list flds = new Dbmeta_fld_list();
|
||||
private static final String
|
||||
fld_page_id = flds.Add_int_pkey("page_id"), fld_wtxt_len = flds.Add_int("wtxt_len"), fld_row_orig_len = flds.Add_int("row_orig_len"), fld_row_zip_len = flds.Add_int("row_zip_len")
|
||||
, fld_body_len = flds.Add_int("body_len"), fld_display_ttl_len = flds.Add_int("display_ttl_len"), fld_content_sub_len = flds.Add_int("content_sub_len"), fld_sidebar_div_len = flds.Add_int("sidebar_div_len")
|
||||
, fld_js_math = flds.Add_int("js_math"), fld_js_imap = flds.Add_int("js_imap"), fld_js_packed = flds.Add_int("js_packed"), fld_js_hiero = flds.Add_int("js_hiero")
|
||||
@@ -29,7 +29,7 @@ public class Xoh_stat_tbl implements Rls_able {
|
||||
, fld_hdr_1 = flds.Add_int("hdr_1"), fld_hdr_2 = flds.Add_int("hdr_2"), fld_hdr_3 = flds.Add_int("hdr_3"), fld_hdr_4 = flds.Add_int("hdr_4"), fld_hdr_5 = flds.Add_int("hdr_5"), fld_hdr_6 = flds.Add_int("hdr_6")
|
||||
, fld_img_full = flds.Add_int("img_full")
|
||||
;
|
||||
private final Db_conn conn; private Db_stmt stmt_insert;
|
||||
private final Db_conn conn; private Db_stmt stmt_insert;
|
||||
public Xoh_stat_tbl(Db_conn conn) {
|
||||
this.conn = conn;
|
||||
this.Create_tbl();
|
||||
|
||||
@@ -23,12 +23,12 @@ import gplx.xowa.wikis.domains.*; import gplx.xowa.wikis.ttls.*; import gplx.xow
|
||||
import gplx.xowa.htmls.core.wkrs.*;
|
||||
import gplx.xowa.htmls.core.hzips.*;
|
||||
public class Xoh_make_mgr {
|
||||
private final Xoh_hzip_bfr bfr = Xoh_hzip_bfr.New_txt(255); private final Bry_bfr tmp_bfr = Bry_bfr.reset_(255); private final Bry_rdr_old bry_rdr = new Bry_rdr_old(); private Gfo_usr_dlg usr_dlg = Gfo_usr_dlg_.Instance;
|
||||
private Xoh_cfg_file cfg_file; private final Xof_url_bldr url_bldr = Xof_url_bldr.new_v2(); private Xoh_file_html_fmtr__base html_fmtr;
|
||||
private final byte[] root_dir, file_dir; private byte[] file_dir_comm, file_dir_wiki, hiero_img_dir; private final byte[] wiki_domain;
|
||||
private final Bry_rdr parser = new Bry_rdr();
|
||||
private final Xoh_hdoc_ctx hctx = new Xoh_hdoc_ctx();
|
||||
private final Xoh_hdoc_parser make_parser = new Xoh_hdoc_parser(new Xoh_hdoc_wkr__make());
|
||||
private final Xoh_hzip_bfr bfr = Xoh_hzip_bfr.New_txt(255); private final Bry_bfr tmp_bfr = Bry_bfr_.Reset(255); private final Bry_rdr_old bry_rdr = new Bry_rdr_old(); private Gfo_usr_dlg usr_dlg = Gfo_usr_dlg_.Instance;
|
||||
private Xoh_cfg_file cfg_file; private final Xof_url_bldr url_bldr = Xof_url_bldr.new_v2(); private Xoh_file_html_fmtr__base html_fmtr;
|
||||
private final byte[] root_dir, file_dir; private byte[] file_dir_comm, file_dir_wiki, hiero_img_dir; private final byte[] wiki_domain;
|
||||
private final Bry_rdr parser = new Bry_rdr();
|
||||
private final Xoh_hdoc_ctx hctx = new Xoh_hdoc_ctx();
|
||||
private final Xoh_hdoc_parser make_parser = new Xoh_hdoc_parser(new Xoh_hdoc_wkr__make());
|
||||
public Xoh_make_mgr(Gfo_usr_dlg usr_dlg, Xoa_fsys_mgr fsys_mgr, Gfo_url_encoder fsys_encoder, byte[] wiki_domain) {
|
||||
this.usr_dlg = usr_dlg;
|
||||
this.root_dir = fsys_mgr.Root_dir().To_http_file_bry();
|
||||
@@ -139,6 +139,6 @@ public class Xoh_make_mgr {
|
||||
} catch (Exception e) {Xoa_app_.Usr_dlg().Warn_many("", "", "abrv.read: page=~{0} itm=~{1} err=~{2}", hpg.Url_bry_safe(), img == null ? "<NULL>" : img.Data_print(), Err_.Message_gplx_full(e));}
|
||||
return rv;
|
||||
}
|
||||
public static final Bry_fmtr fmtr_img = Bry_fmtr.new_("src='~{src}' width='~{w}' height='~{h}'", "src", "w", "h");
|
||||
private static final Btrie_slim_mgr trie = Xoh_make_trie_.new_trie();
|
||||
public static final Bry_fmtr fmtr_img = Bry_fmtr.new_("src='~{src}' width='~{w}' height='~{h}'", "src", "w", "h");
|
||||
private static final Btrie_slim_mgr trie = Xoh_make_trie_.new_trie();
|
||||
}
|
||||
|
||||
@@ -18,8 +18,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.htmls.core.makes; import gplx.*; import gplx.xowa.*; import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.*;
|
||||
import gplx.core.primitives.*; import gplx.xowa.htmls.core.makes.imgs.*; import gplx.xowa.files.*; import gplx.xowa.parsers.lnkis.*;
|
||||
class Xoh_make_mgr_fxt {
|
||||
private final List_adp img_list = List_adp_.new_();
|
||||
private final Xoh_page hpg = new Xoh_page();
|
||||
private final List_adp img_list = List_adp_.New();
|
||||
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.Make__app__edit();
|
||||
@@ -54,7 +54,7 @@ class Xoh_make_mgr_fxt {
|
||||
public Xoh_make_mgr_fxt Init_data_redlink(int... uids) {
|
||||
int uids_len = uids.length;
|
||||
for (int i = 0; i < uids_len; ++i) {
|
||||
Int_obj_ref redlink_uid = Int_obj_ref.new_(uids[i]);
|
||||
Int_obj_ref redlink_uid = Int_obj_ref.New(uids[i]);
|
||||
hpg.Redlink_uids().Add(redlink_uid, redlink_uid);
|
||||
}
|
||||
return this;
|
||||
|
||||
@@ -19,9 +19,9 @@ package gplx.xowa.htmls.core.makes.tests; import gplx.*; import gplx.xowa.*; imp
|
||||
import gplx.xowa.htmls.sections.*;
|
||||
import gplx.xowa.files.*;
|
||||
public class Xoh_page_chkr {
|
||||
private final Xoh_section_mgr expd_section_mgr = new Xoh_section_mgr();
|
||||
private final Xoh_img_mgr expd_img_mgr = new Xoh_img_mgr();
|
||||
private final Bry_bfr bfr = Bry_bfr.new_();
|
||||
private final Xoh_section_mgr expd_section_mgr = new Xoh_section_mgr();
|
||||
private final Xoh_img_mgr expd_img_mgr = new Xoh_img_mgr();
|
||||
private final Bry_bfr bfr = Bry_bfr_.New();
|
||||
public void Clear() {
|
||||
expd_img_mgr.Clear();
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public class Xoh_hdoc_ctx {
|
||||
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 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 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 byte[] Page__url() {return page__url;} private byte[] page__url;
|
||||
@@ -68,6 +68,8 @@ public class Xoh_hdoc_ctx {
|
||||
this.uid__lnki = 1; // NOTE: should be 0, but for historical reasons, 1st lnki starts at 2; EX: id='xowa_lnki_2'
|
||||
this.uid__gly = -1;
|
||||
}
|
||||
|
||||
public void Test__file__mgr_(Xou_cache_finder v) {this.file__mgr = v;}
|
||||
public static final int Invalid = -1;
|
||||
private static final byte[] Fsys__res__drd = Bry_.new_a7("file:///android_asset/xowa/");
|
||||
}
|
||||
|
||||
@@ -17,12 +17,13 @@ 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.xowa.files.caches.*;
|
||||
public class Xoh_hzip_fxt {
|
||||
private final Xowe_wiki wiki;
|
||||
private final Xop_fxt parser_fxt = new Xop_fxt();
|
||||
private final Xoh_hzip_bfr bfr = Xoh_hzip_bfr.New_txt(32);
|
||||
private final Xoh_hzip_mgr hzip_mgr;
|
||||
private final Xoh_page hpg = new Xoh_page();
|
||||
private final Xowe_wiki wiki;
|
||||
private final Xop_fxt parser_fxt = new Xop_fxt();
|
||||
private final Xoh_hzip_bfr bfr = Xoh_hzip_bfr.New_txt(32);
|
||||
private final Xoh_hzip_mgr hzip_mgr;
|
||||
private final Xoh_page hpg = new Xoh_page();
|
||||
private boolean mode_is_b256;
|
||||
public Xoh_hzip_fxt() {
|
||||
this.wiki = parser_fxt.Wiki();
|
||||
@@ -36,6 +37,14 @@ public class Xoh_hzip_fxt {
|
||||
public Xoh_hzip_fxt Init_mode_diff_y_() {hzip_mgr.Hctx().Mode_is_diff_(Bool_.Y); return this;}
|
||||
public void Clear() {hpg.Clear();}
|
||||
public void Init_wiki_installed(String domain) {parser_fxt.Init_xwiki_add_user_(domain);}
|
||||
public Xou_cache_finder_mem Init_file_mgr__mem() {
|
||||
Xou_cache_finder_mem rv = Xou_cache_finder_.New_mem();
|
||||
hzip_mgr.Hctx().Test__file__mgr_(rv);
|
||||
return rv;
|
||||
}
|
||||
public void Init_file_mgr__noop() {
|
||||
hzip_mgr.Hctx().Test__file__mgr_(Xou_cache_finder_.Noop);
|
||||
}
|
||||
public Xowe_wiki Init_wiki_alias(String alias, String 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);
|
||||
|
||||
@@ -21,7 +21,7 @@ import gplx.langs.htmls.*; import gplx.langs.htmls.docs.*; import gplx.langs.htm
|
||||
import gplx.xowa.htmls.core.hzips.*;
|
||||
import gplx.xowa.xtns.gallery.*;
|
||||
public class Xoh_gly_grp_data implements Gfh_class_parser_wkr, Gfh_style_wkr {
|
||||
private final List_adp itms_list = List_adp_.new_();
|
||||
private final List_adp itms_list = List_adp_.New();
|
||||
public int Src_bgn() {return src_bgn;} private int src_bgn;
|
||||
public int Src_end() {return src_end;} private int src_end;
|
||||
public int Gly_tid() {return gly_tid;} private int gly_tid;
|
||||
@@ -129,8 +129,8 @@ public class Xoh_gly_grp_data implements Gfh_class_parser_wkr, Gfh_style_wkr {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public static final byte[] Atr__cls__gallery = Bry_.new_a7("gallery");
|
||||
private static final byte[] Atr__cls__mw_gallery = Bry_.new_a7("mw-gallery-"), Atr__cls__gallerybox = Bry_.new_a7("gallerybox")
|
||||
public static final byte[] Atr__cls__gallery = Bry_.new_a7("gallery");
|
||||
private static final byte[] Atr__cls__mw_gallery = Bry_.new_a7("mw-gallery-"), Atr__cls__gallerybox = Bry_.new_a7("gallerybox")
|
||||
, Style__max_width = Bry_.new_a7("max-width"), Style___width = Bry_.new_a7("_width")
|
||||
;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ import gplx.xowa.wikis.nss.*; import gplx.xowa.wikis.ttls.*;
|
||||
import gplx.xowa.files.*; import gplx.xowa.files.repos.*;
|
||||
import gplx.xowa.xtns.gallery.*;
|
||||
public class Xoh_gly_hzip implements Xoh_hzip_wkr, Gfo_poolable_itm {
|
||||
private final Xoh_gly_grp_wtr grp_wtr = new Xoh_gly_grp_wtr();
|
||||
private final Xoh_gly_grp_wtr grp_wtr = new Xoh_gly_grp_wtr();
|
||||
public int Tid() {return Xoh_hzip_dict_.Tid__gly;}
|
||||
public String Key() {return Xoh_hzip_dict_.Key__gly;}
|
||||
public byte[] Hook() {return hook;} private byte[] hook;
|
||||
@@ -94,7 +94,7 @@ public class Xoh_gly_hzip implements Xoh_hzip_wkr, Gfo_poolable_itm {
|
||||
}
|
||||
public void Pool__rls () {pool_mgr.Rls_fast(pool_idx);} private Gfo_poolable_mgr pool_mgr; private int pool_idx;
|
||||
public Gfo_poolable_itm Pool__make (Gfo_poolable_mgr mgr, int idx, Object[] args) {Xoh_gly_hzip rv = new Xoh_gly_hzip(); rv.pool_mgr = mgr; rv.pool_idx = idx; rv.hook = (byte[])args[0]; return rv;}
|
||||
private final Int_flag_bldr flag_bldr = new Int_flag_bldr().Pow_ary_bld_(1, 1, 1, 1, 3);
|
||||
private final Int_flag_bldr flag_bldr = new Int_flag_bldr().Pow_ary_bld_(1, 1, 1, 1, 3);
|
||||
private static final int // SERIALIZED
|
||||
Flag__ul__style_w_diff = 0
|
||||
, Flag__ul__xtra_atr = 1
|
||||
|
||||
@@ -99,9 +99,9 @@ public class Xoh_gly_itm_data {
|
||||
tag_rdr.Pos_(capt_tail_end);
|
||||
return true;
|
||||
}
|
||||
private static final byte[] Atr__cls__gallerytext = Bry_.new_a7("gallerytext"), Bry__p__rhs = Bry_.new_a7("</p>\n");
|
||||
private static final byte[] Atr__cls__gallerytext = Bry_.new_a7("gallerytext"), Bry__p__rhs = Bry_.new_a7("</p>\n");
|
||||
public static final byte Capt_tid__p = 0, Capt_tid__br = 1, Capt_tid__empty = 2, Capt_tid__null = 3;
|
||||
private static final Btrie_slim_mgr Capt_tid__trie = Btrie_slim_mgr.ci_a7()
|
||||
private static final Btrie_slim_mgr Capt_tid__trie = Btrie_slim_mgr.ci_a7()
|
||||
.Add_bry_byte(Gfh_tag_.P_lhs , Capt_tid__p)
|
||||
.Add_bry_byte(Gfh_tag_.Br_lhs , Capt_tid__br)
|
||||
;
|
||||
|
||||
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.htmls.core.wkrs.glys; 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.core.primitives.*; import gplx.xowa.htmls.core.hzips.*;
|
||||
public class Xoh_gly_itm_wtr_tst {
|
||||
private final Xoh_gly_itm_wtr_fxt fxt = new Xoh_gly_itm_wtr_fxt();
|
||||
private final Xoh_gly_itm_wtr_fxt fxt = new Xoh_gly_itm_wtr_fxt();
|
||||
@Test public void Basic() {
|
||||
fxt.Init__gly(0, 155, 150, 5, "caption");
|
||||
fxt.Init__img("/wiki/File:A.png", "A.png", "0|120|120|-1|-1|-1");
|
||||
@@ -38,8 +38,8 @@ public class Xoh_gly_itm_wtr_tst {
|
||||
}
|
||||
}
|
||||
class Xoh_gly_itm_wtr_fxt {
|
||||
private final Xoh_gly_itm_wtr wtr = new Xoh_gly_itm_wtr();
|
||||
private final Bry_bfr tmp_bfr = Bry_bfr.new_();
|
||||
private final Xoh_gly_itm_wtr wtr = new Xoh_gly_itm_wtr();
|
||||
private final Bry_bfr tmp_bfr = Bry_bfr_.New();
|
||||
public void Init__gly(int id, int itm_w, int file_div_w, int file_div_margin, String caption) {
|
||||
wtr.Init(Bool_.N, id, itm_w, file_div_w, file_div_margin, Xoh_gly_itm_data.Capt_tid__p, Bry_.new_a7(caption));
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ import gplx.xowa.htmls.core.wkrs.bfr_args.*; import gplx.xowa.htmls.core.wkrs.im
|
||||
import gplx.xowa.wikis.nss.*; import gplx.xowa.wikis.ttls.*;
|
||||
import gplx.xowa.files.*; import gplx.xowa.files.repos.*;
|
||||
public class Xoh_img_hzip implements Xoh_hzip_wkr, Gfo_poolable_itm {
|
||||
private final Bry_bfr tmp_bfr = Bry_bfr.new_(32);
|
||||
private final Xoh_img_xoimg_hzip xoimg = new Xoh_img_xoimg_hzip();
|
||||
private final Bry_bfr tmp_bfr = Bry_bfr_.New_w_size(32);
|
||||
private final Xoh_img_xoimg_hzip xoimg = new Xoh_img_xoimg_hzip();
|
||||
public int Tid() {return Xoh_hzip_dict_.Tid__img;}
|
||||
public String Key() {return Xoh_hzip_dict_.Key__img;}
|
||||
public byte[] Hook() {return hook;} private byte[] hook;
|
||||
@@ -234,7 +234,7 @@ public class Xoh_img_hzip implements Xoh_hzip_wkr, Gfo_poolable_itm {
|
||||
public void Pool__rls () {pool_mgr.Rls_fast(pool_idx);} private Gfo_poolable_mgr pool_mgr; private int pool_idx;
|
||||
public Gfo_poolable_itm Pool__make (Gfo_poolable_mgr mgr, int idx, Object[] args) {Xoh_img_hzip rv = new Xoh_img_hzip(); rv.pool_mgr = mgr; rv.pool_idx = idx; rv.hook = (byte[])args[0]; return rv;}
|
||||
public static int Md5_depth = 2;
|
||||
private final Int_flag_bldr flag_bldr = new Int_flag_bldr().Pow_ary_bld_(1, 1, 1, 1, 1, 1 , 1 , 1, 1, 1 , 1 , 2, 1, 1 , 1, 1, 2, 2);
|
||||
private final Int_flag_bldr flag_bldr = new Int_flag_bldr().Pow_ary_bld_(1, 1, 1, 1, 1, 1 , 1 , 1, 1, 1 , 1 , 2, 1, 1 , 1, 1, 2, 2);
|
||||
private static final int // SERIALIZED
|
||||
Flag__img__imap_exists = 0
|
||||
, Flag__img__wo_anch = 1
|
||||
|
||||
@@ -18,7 +18,7 @@ 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 gplx.xowa.wikis.nss.*;
|
||||
public class Xoh_img_hzip__dump__tst {
|
||||
private final Xoh_hzip_fxt fxt = new Xoh_hzip_fxt().Init_mode_diff_y_();
|
||||
private final Xoh_hzip_fxt fxt = new Xoh_hzip_fxt().Init_mode_diff_y_();
|
||||
@Before public void Clear() {fxt.Clear();}
|
||||
@Test public void Basic() { // [[File:A.png|border|class=other|220px|abc]]
|
||||
fxt.Test__bicode
|
||||
|
||||
@@ -21,11 +21,11 @@ import gplx.langs.htmls.*; import gplx.langs.htmls.docs.*; import gplx.langs.htm
|
||||
import gplx.xowa.htmls.core.hzips.*; import gplx.xowa.htmls.core.wkrs.bfr_args.*; import gplx.xowa.htmls.core.wkrs.imgs.atrs.*;
|
||||
import gplx.xowa.files.*; import gplx.xowa.xtns.imaps.*;
|
||||
public class Xoh_img_wtr implements Bfr_arg, Xoh_wtr_itm {
|
||||
private final Bfr_arg_clearable[] arg_ary;
|
||||
private final Bfr_arg__hatr_arg img_xowa_image = new Bfr_arg__hatr_arg(Xoh_img_xoimg_data.Bry__data_xowa_image);
|
||||
private final Bfr_arg__hatr_id img_id = Bfr_arg__hatr_id.New_id(Xoh_img_mgr.Bry__html_uid), vid_play_id = Bfr_arg__hatr_id.New_id("xowa_file_play_"), img_imap_usemap = new Bfr_arg__hatr_id(Imap_xtn_mgr.Bry__usemap__name, Imap_xtn_mgr.Bry__usemap__prefix);
|
||||
private final Bfr_arg__hatr_int img_w = new Bfr_arg__hatr_int(Gfh_atr_.Bry__width), img_h = new Bfr_arg__hatr_int(Gfh_atr_.Bry__height);
|
||||
private final Bfr_arg__hatr_bry
|
||||
private final Bfr_arg_clearable[] arg_ary;
|
||||
private final Bfr_arg__hatr_arg img_xowa_image = new Bfr_arg__hatr_arg(Xoh_img_xoimg_data.Bry__data_xowa_image);
|
||||
private final Bfr_arg__hatr_id img_id = Bfr_arg__hatr_id.New_id(Xoh_img_mgr.Bry__html_uid), vid_play_id = Bfr_arg__hatr_id.New_id("xowa_file_play_"), img_imap_usemap = new Bfr_arg__hatr_id(Imap_xtn_mgr.Bry__usemap__name, Imap_xtn_mgr.Bry__usemap__prefix);
|
||||
private final Bfr_arg__hatr_int img_w = new Bfr_arg__hatr_int(Gfh_atr_.Bry__width), img_h = new Bfr_arg__hatr_int(Gfh_atr_.Bry__height);
|
||||
private final Bfr_arg__hatr_bry
|
||||
anch_href = new Bfr_arg__hatr_bry(Gfh_atr_.Bry__href)
|
||||
, anch_rel = new Bfr_arg__hatr_bry(Gfh_atr_.Bry__rel)
|
||||
, anch_xowa_title = new Bfr_arg__hatr_bry(Xoh_img_data.Bry__atr__xowa_title)
|
||||
@@ -58,7 +58,7 @@ public class Xoh_img_wtr implements Bfr_arg, Xoh_wtr_itm {
|
||||
Init_by_decode(hpg, hctx, src, data);
|
||||
this.Bfr_arg__add(bfr);
|
||||
}
|
||||
private static final byte[] Bry__qarg__esc = Bry_.new_a7("%3F");
|
||||
private static final byte[] Bry__qarg__esc = Bry_.new_a7("%3F");
|
||||
public boolean Init_by_decode(Xoh_page hpg, Xoh_hdoc_ctx hctx, byte[] src, Xoh_data_itm data_itm) {
|
||||
Xoh_img_data data = (Xoh_img_data)data_itm;
|
||||
this.Clear();
|
||||
@@ -113,13 +113,13 @@ public class Xoh_img_wtr implements Bfr_arg, Xoh_wtr_itm {
|
||||
if (img_is_vid) bfr.Add(Vid__bry__bgn);
|
||||
img_fmtr.Bld_bfr_many(bfr, (Object[])arg_ary);
|
||||
if (img_is_vid)
|
||||
vid_fmtr.Bld_bfr_many(bfr, vid_play_id, anch_xowa_title, xowa_root_dir, 218, 220); // TODO: hardcode widths; need to update via js from fsdb
|
||||
vid_fmtr.Bld_bfr_many(bfr, vid_play_id, anch_xowa_title, xowa_root_dir, 218, 220); // TODO_OLD: hardcode widths; need to update via js from fsdb
|
||||
}
|
||||
}
|
||||
public void Pool__rls () {pool_mgr.Rls_fast(pool_idx);} private Gfo_poolable_mgr pool_mgr; private int pool_idx;
|
||||
public Gfo_poolable_itm Pool__make (Gfo_poolable_mgr mgr, int idx, Object[] args) {Xoh_img_wtr rv = new Xoh_img_wtr(); rv.pool_mgr = mgr; rv.pool_idx = idx; return rv;}
|
||||
private static final byte[] Vid__bry__bgn = Bry_.new_a7("<div class=\"xowa_media_div\">\n<div>");
|
||||
private static final Bry_fmtr
|
||||
private static final byte[] Vid__bry__bgn = Bry_.new_a7("<div class=\"xowa_media_div\">\n<div>");
|
||||
private static final Bry_fmtr
|
||||
img_fmtr = Bry_fmtr.new_
|
||||
( "<a~{anch_href}~{anch_rel}~{anch_cls}~{anch_title}~{anch_xowa_title}><img~{img_id}~{img_xowa_title}~{img_xowa_image}~{img_src}~{img_w}~{img_h}~{img_cls}~{img_alt}></a>"
|
||||
, "anch_href", "anch_rel", "anch_cls", "anch_title", "anch_xowa_title", "img_id", "img_xowa_title", "img_xowa_image", "img_src", "img_w", "img_h", "img_cls", "img_alt")
|
||||
|
||||
@@ -19,7 +19,7 @@ package gplx.xowa.htmls.core.wkrs.imgs.atrs; import gplx.*; import gplx.xowa.*;
|
||||
import gplx.core.brys.*;
|
||||
import gplx.langs.htmls.*; import gplx.langs.htmls.docs.*;
|
||||
public class Xoh_img_xoimg_data implements Bfr_arg_clearable {
|
||||
private final Bry_rdr rdr = new Bry_rdr().Dflt_dlm_(Byte_ascii.Pipe);
|
||||
private final Bry_rdr rdr = new Bry_rdr().Dflt_dlm_(Byte_ascii.Pipe);
|
||||
public int Val_bgn() {return val_bgn;} private int val_bgn;
|
||||
public int Val_end() {return val_end;} private int val_end;
|
||||
public boolean Val_dat_exists() {return val_dat_exists;} private boolean val_dat_exists;
|
||||
@@ -88,7 +88,7 @@ public class Xoh_img_xoimg_data implements Bfr_arg_clearable {
|
||||
bfr.Add_double(lnki_time).Add_byte_pipe();
|
||||
bfr.Add_int_variable(lnki_page);
|
||||
}
|
||||
public static final byte[]
|
||||
public static final byte[]
|
||||
Bry__data_xowa_image = Bry_.new_a7("data-xoimg")
|
||||
, Bry__data_xowa_title = Bry_.new_a7("data-xowa-title")
|
||||
;
|
||||
|
||||
@@ -55,7 +55,7 @@ public class Xoh_img_xoimg_hzip {
|
||||
int page = page_exists ? rdr.Read_hzip_int(2) : Xof_lnki_page.Null;
|
||||
arg.Set(tid, w, h, upright, time, page);
|
||||
}
|
||||
private final Int_flag_bldr flag_bldr = new Int_flag_bldr().Pow_ary_bld_( 1, 1 , 1, 1, 1, 3);
|
||||
private final Int_flag_bldr flag_bldr = new Int_flag_bldr().Pow_ary_bld_( 1, 1 , 1, 1, 1, 3);
|
||||
private static final int // SERIALIZED
|
||||
Flag__page_exists = 0
|
||||
, Flag__time_exists = 1
|
||||
|
||||
@@ -16,7 +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.lnkes; import gplx.*; import gplx.xowa.*; import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.*; import gplx.xowa.htmls.core.wkrs.*;
|
||||
import gplx.core.btries.*; import gplx.core.net.*; import gplx.langs.htmls.encoders.*; import gplx.xowa.apps.urls.*;
|
||||
import gplx.core.btries.*; import gplx.core.net.*; import gplx.core.net.qargs.*; import gplx.langs.htmls.encoders.*; import gplx.xowa.apps.urls.*;
|
||||
import gplx.langs.htmls.*; import gplx.xowa.htmls.hrefs.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.lnkes.*;
|
||||
import gplx.xowa.htmls.core.htmls.*;
|
||||
@@ -72,7 +72,7 @@ public class Xoh_lnke_html {
|
||||
bfr.Add(Xoh_href_.Bry__site).Add(lnke_xwiki_wiki).Add(Xoh_href_.Bry__wiki)
|
||||
.Add(href_encoder.Encode(lnke.Lnke_xwiki_page())); // NOTE: must encode page; EX:%22%3D -> '">' which will end attribute; PAGE:en.w:List_of_Category_A_listed_buildings_in_West_Lothian DATE:2014-07-15
|
||||
if (lnke.Lnke_xwiki_qargs() != null)
|
||||
Gfo_qarg_mgr.Concat_bfr(bfr, href_encoder, lnke.Lnke_xwiki_qargs()); // NOTE: must encode args
|
||||
Gfo_qarg_mgr_old.Concat_bfr(bfr, href_encoder, lnke.Lnke_xwiki_qargs()); // NOTE: must encode args
|
||||
return ctx.Wiki().App().Xwiki_mgr__missing(lnke_xwiki_wiki); // write "external" if hdump or xwiki is missing
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ import gplx.xowa.htmls.core.hzips.*; import gplx.xowa.htmls.core.wkrs.lnkis.anch
|
||||
import gplx.langs.htmls.*; import gplx.xowa.htmls.hrefs.*; import gplx.xowa.wikis.ttls.*;
|
||||
import gplx.xowa.wikis.nss.*; import gplx.xowa.parsers.lnkis.*;
|
||||
public class Xoh_lnki_hzip implements Xoh_hzip_wkr, Gfo_poolable_itm {
|
||||
private final Bry_bfr tmp_bfr = Bry_bfr.new_(32);
|
||||
private final Bry_bfr tmp_bfr = Bry_bfr_.New_w_size(32);
|
||||
public int Tid() {return Xoh_hzip_dict_.Tid__lnki;}
|
||||
public String Key() {return Xoh_hzip_dict_.Key__lnki;}
|
||||
public byte[] Hook() {return hook;} private byte[] hook;
|
||||
|
||||
@@ -22,9 +22,9 @@ import gplx.xowa.files.*; import gplx.xowa.htmls.core.makes.*; import gplx.xowa.
|
||||
import gplx.xowa.htmls.core.htmls.*;
|
||||
import gplx.xowa.parsers.lnkis.*;
|
||||
public class Xoh_file_html_fmtr__base implements Xoh_file_img_wkr {
|
||||
protected final Xoh_arg_img_core arg_img_core;
|
||||
private Bry_bfr scratch_bfr = Bry_bfr.reset_(128);
|
||||
private final Bfr_arg__hatr_id thm_file_id = Bfr_arg__hatr_id.New_id("xowa_file_div_"), thm_play_id = Bfr_arg__hatr_id.New_id("xowa_file_play_");
|
||||
protected final Xoh_arg_img_core arg_img_core;
|
||||
private Bry_bfr scratch_bfr = Bry_bfr_.Reset(128);
|
||||
private final Bfr_arg__hatr_id thm_file_id = Bfr_arg__hatr_id.New_id("xowa_file_div_"), thm_play_id = Bfr_arg__hatr_id.New_id("xowa_file_play_");
|
||||
public Xoh_file_html_fmtr__base() {
|
||||
arg_img_core = New_arg_img_core();
|
||||
}
|
||||
@@ -33,7 +33,7 @@ public class Xoh_file_html_fmtr__base implements Xoh_file_img_wkr {
|
||||
if (mode_is_hdump) a_href = Bry_.Empty;
|
||||
fmtr_full_media.Bld_bfr_many(tmp_bfr, a_href, a_title, html);
|
||||
}
|
||||
private final Bry_fmtr fmtr_full_media = Bry_fmtr.new_(String_.Concat_lines_nl_skip_last
|
||||
private final Bry_fmtr fmtr_full_media = Bry_fmtr.new_(String_.Concat_lines_nl_skip_last
|
||||
( "<a href=\"~{a_href}\" xowa_title=\"~{a_xowa_title}\">~{html}"
|
||||
, "</a>"
|
||||
), "a_href", "a_xowa_title", "html"
|
||||
@@ -75,7 +75,7 @@ public class Xoh_file_html_fmtr__base implements Xoh_file_img_wkr {
|
||||
thm_file_id.Set(uid);
|
||||
fmtr_thumb_core.Bld_bfr_many(tmp_bfr, thm_file_id, div1_halign, scratch_bfr.To_bry_and_clear(), div2_content);
|
||||
}
|
||||
private static final byte[] Bry_style_bgn = Bry_.new_a7("style=\"width:"), Bry_style_end = Bry_.new_a7("px;\"");
|
||||
private static final byte[] Bry_style_bgn = Bry_.new_a7("style=\"width:"), Bry_style_end = Bry_.new_a7("px;\"");
|
||||
protected Bry_fmtr fmtr_thumb_core = Bry_fmtr.new_(String_.Concat_lines_nl_skip_last // REF.MW: Linker.php|makeImageLink2
|
||||
( "<div class=\"thumb t~{div1_halign}\">"
|
||||
, " <div~{div_id} class=\"thumbinner\" ~{style}>"
|
||||
@@ -93,7 +93,7 @@ public class Xoh_file_html_fmtr__base implements Xoh_file_img_wkr {
|
||||
), "magnify_btn", "caption");
|
||||
|
||||
public void Html_thumb_file_image(Bry_bfr tmp_bfr, byte[] thumb_image, byte[] caption, byte[] alt) {fmtr_thumb_file_image.Bld_bfr_many(tmp_bfr, thumb_image, caption, alt);}
|
||||
private final Bry_fmtr fmtr_thumb_file_image = Bry_fmtr.new_(" ~{thumb_image}~{caption}~{alt}", "thumb_image", "caption", "alt");
|
||||
private final Bry_fmtr fmtr_thumb_file_image = Bry_fmtr.new_(" ~{thumb_image}~{caption}~{alt}", "thumb_image", "caption", "alt");
|
||||
|
||||
public void Html_thumb_file_audio(Bry_bfr tmp_bfr, byte[] caption, byte[] alt, byte[] play_btn, byte[] audio_info) {fmtr_thumb_file_audio.Bld_bfr_many(tmp_bfr, caption, alt, play_btn, audio_info);}
|
||||
private Bry_fmtr fmtr_thumb_file_audio = Bry_fmtr.new_(String_.Concat_lines_nl_skip_last
|
||||
@@ -102,7 +102,7 @@ public class Xoh_file_html_fmtr__base implements Xoh_file_img_wkr {
|
||||
), "caption", "alt", "play_btn", "audio_info");
|
||||
|
||||
public void Html_thumb_file_video(Bry_bfr tmp_bfr, byte[] play_btn, byte[] video_thumb, byte[] caption, byte[] alt) {fmtr_thumb_file_video.Bld_bfr_many(tmp_bfr, caption, alt, play_btn, video_thumb);}
|
||||
private final Bry_fmtr fmtr_thumb_file_video = Bry_fmtr.new_(String_.Concat_lines_nl_skip_last
|
||||
private final Bry_fmtr fmtr_thumb_file_video = Bry_fmtr.new_(String_.Concat_lines_nl_skip_last
|
||||
( " <div class=\"xowa_media_div\">"
|
||||
, " <div>~{video_thumb}"
|
||||
, " </div>~{play_btn}"
|
||||
@@ -121,7 +121,7 @@ public class Xoh_file_html_fmtr__base implements Xoh_file_img_wkr {
|
||||
@gplx.Virtual public void Html_thumb_part_magnify(Bry_bfr tmp_bfr, int uid, byte[] a_href, byte[] a_title, byte[] img_src) {
|
||||
fmtr_thumb_part_magnify.Bld_bfr_many(tmp_bfr, a_href, a_title);
|
||||
}
|
||||
private final Bry_fmtr fmtr_thumb_part_magnify = Bry_fmtr.new_(String_.Concat_lines_nl_skip_last
|
||||
private final Bry_fmtr fmtr_thumb_part_magnify = Bry_fmtr.new_(String_.Concat_lines_nl_skip_last
|
||||
( ""
|
||||
, "<div class=\"magnify\"><a href=\"~{a_href}\" class=\"internal\" title=\"~{a_title}\"></a></div>"
|
||||
), "a_href", "a_title");
|
||||
@@ -131,7 +131,7 @@ public class Xoh_file_html_fmtr__base implements Xoh_file_img_wkr {
|
||||
img_src = Bry_.Empty;
|
||||
fmtr_thumb_part_info.Bld_bfr_many(tmp_bfr, a_href, img_src);
|
||||
}
|
||||
private final Bry_fmtr fmtr_thumb_part_info = Bry_fmtr.new_(String_.Concat_lines_nl_skip_last
|
||||
private final Bry_fmtr fmtr_thumb_part_info = Bry_fmtr.new_(String_.Concat_lines_nl_skip_last
|
||||
( ""
|
||||
, "<div><a href=\"~{a_href}\" class=\"xowa_media_info\" title=\"About this file\"></a></div>"
|
||||
), "a_href", "img_src");
|
||||
@@ -146,12 +146,12 @@ public class Xoh_file_html_fmtr__base implements Xoh_file_img_wkr {
|
||||
thm_play_id.Set(uid);
|
||||
fmtr_thumb_part_play.Bld_bfr_many(tmp_bfr, thm_play_id, a_width, a_max_width, a_href, a_xowa_title);
|
||||
}
|
||||
private final Bry_fmtr fmtr_thumb_part_play = Bry_fmtr.new_(String_.Concat_lines_nl_skip_last
|
||||
private final Bry_fmtr fmtr_thumb_part_play = Bry_fmtr.new_(String_.Concat_lines_nl_skip_last
|
||||
( ""
|
||||
, "<div><a~{id} href=\"~{a_href}\" xowa_title=\"~{a_xowa_title}\" class=\"xowa_media_play\" style=\"width:~{a_width}px;max-width:~{a_max_width}px;\" alt=\"Play sound\"></a></div>"
|
||||
), "id", "a_width", "a_max_width", "a_href", "a_xowa_title");
|
||||
|
||||
public static final Xoh_file_html_fmtr__base Base = new Xoh_file_html_fmtr__base();
|
||||
public static final Xoh_file_html_fmtr__base Base = new Xoh_file_html_fmtr__base();
|
||||
public static byte[] Escape_xowa_title(byte[] lnki_ttl) {
|
||||
return Xoa_ttl.Replace_spaces(gplx.langs.htmls.encoders.Gfo_url_encoder_.Href_quotes.Encode(lnki_ttl)); // must encode xowa_title, particularly quotes; EX: xowa_title="A"b.png"; PAGE:en.w:Earth DATE:2015-11-27
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ import gplx.xowa.files.*; import gplx.xowa.htmls.core.makes.*;
|
||||
import gplx.xowa.htmls.core.wkrs.imgs.atrs.*;
|
||||
import gplx.xowa.parsers.lnkis.*;
|
||||
public class Xoh_file_html_fmtr__hdump extends Xoh_file_html_fmtr__base {
|
||||
private final Bry_bfr tmp_bfr = Bry_bfr.reset_(128);
|
||||
private final Bry_bfr tmp_bfr = Bry_bfr_.Reset(128);
|
||||
@Override public void Html_full_img(Bry_bfr bfr, gplx.xowa.htmls.core.htmls.Xoh_wtr_ctx hctx, Xoae_page page, byte[] src, Xof_file_itm xfer_itm
|
||||
, int uid, byte[] a_href, boolean a_href_is_file, byte a_cls, byte a_rel, byte[] a_title, byte[] a_xowa_title
|
||||
, int img_w, int img_h, byte[] img_src, byte[] img_alt, byte img_cls, byte[] img_cls_other) {
|
||||
@@ -58,12 +58,12 @@ public class Xoh_file_html_fmtr__hdump extends Xoh_file_html_fmtr__base {
|
||||
, "a_href", "a_class", "a_rel", "a_title", "a_xowa_title", "img_alt", "img_xoimg", "data_xowa_title", "data_xowa_image", "img_class"
|
||||
)
|
||||
;
|
||||
private static final Bry_fmt fmtr_anch_n = Bry_fmt.New
|
||||
private static final Bry_fmt fmtr_anch_n = Bry_fmt.New
|
||||
( "<img~{data_xowa_title}~{data_xowa_image} src=\"\" width=\"0\" height=\"0\"~{img_class} alt=\"~{img_alt}\"~{img_xtra_atrs}/>"
|
||||
, "data_xowa_title", "data_xowa_image", "img_class", "img_alt", "img_xtra_atrs"
|
||||
);
|
||||
// public override void Html_full_media(Bry_bfr tmp_bfr, byte[] a_href, byte[] a_title, Bfr_arg html) {
|
||||
// fmtr_full_media.Bld_bfr_many(tmp_bfr, a_href, a_title, html);
|
||||
// }
|
||||
public static final Xoh_file_html_fmtr__hdump Hdump = new Xoh_file_html_fmtr__hdump(); Xoh_file_html_fmtr__hdump() {}
|
||||
public static final Xoh_file_html_fmtr__hdump Hdump = new Xoh_file_html_fmtr__hdump(); Xoh_file_html_fmtr__hdump() {}
|
||||
}
|
||||
|
||||
@@ -22,9 +22,9 @@ import gplx.xowa.langs.*; import gplx.xowa.langs.msgs.*;
|
||||
import gplx.xowa.wikis.nss.*; import gplx.xowa.files.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.lnkis.*; import gplx.xowa.parsers.tmpls.*;
|
||||
public class Xoh_file_wtr__basic {
|
||||
private final Xowe_wiki wiki; private final Xow_html_mgr html_mgr; private final Xoh_html_wtr html_wtr; private final Bry_bfr_mkr bfr_mkr; private final Bry_bfr scratch_bfr = Bry_bfr.reset_(Io_mgr.Len_kb);
|
||||
private final Xoh_lnki_text_fmtr media_alt_fmtr, caption_fmtr;
|
||||
private final Xop_link_parser tmp_link_parser = new Xop_link_parser(); private Xoa_url tmp_url = Xoa_url.blank(); private final Xoh_lnki_title_fmtr anchor_title_wkr = new Xoh_lnki_title_fmtr();
|
||||
private final Xowe_wiki wiki; private final Xow_html_mgr html_mgr; private final Xoh_html_wtr html_wtr; private final Bry_bfr_mkr bfr_mkr; private final Bry_bfr scratch_bfr = Bry_bfr_.Reset(Io_mgr.Len_kb);
|
||||
private final Xoh_lnki_text_fmtr media_alt_fmtr, caption_fmtr;
|
||||
private final Xop_link_parser tmp_link_parser = new Xop_link_parser(); private Xoa_url tmp_url = Xoa_url.blank(); private final Xoh_lnki_title_fmtr anchor_title_wkr = new Xoh_lnki_title_fmtr();
|
||||
private Xoh_file_html_fmtr__base html_fmtr = Xoh_file_html_fmtr__base.Base;
|
||||
private Xoae_page page; private boolean cfg_alt_defaults_to_caption;
|
||||
public Xoh_file_wtr__basic(Xowe_wiki wiki, Xow_html_mgr html_mgr, Xoh_html_wtr html_wtr) {
|
||||
@@ -43,7 +43,7 @@ public class Xoh_file_wtr__basic {
|
||||
int div_width = xfer_itm.Html_w();
|
||||
if (div_width < 1 && wiki.File_mgr().Version_2_y()) // NOTE: html_w is -1 for v2 and missing files; use lnki_w if available; primarily affects audio files with specified width; [[File:A.oga|30px]]; DATE:2014-05-03
|
||||
div_width = xfer_itm.Lnki_w();
|
||||
if (div_width < 1)
|
||||
if (div_width < 1) // && hctx.Mode_is_hdump() // TODO: should manually insert?
|
||||
div_width = wiki.Html_mgr().Img_thumb_width();
|
||||
int lnki_halign = lnki.Align_h();
|
||||
if (lnki_halign == Xop_lnki_align_h_.Null)
|
||||
@@ -55,7 +55,10 @@ public class Xoh_file_wtr__basic {
|
||||
byte[] lnki_ttl = lnki.Ttl().Page_txt();
|
||||
Xof_ext orig_ext = xfer_itm.Orig_ext();
|
||||
boolean lnki_is_thumbable = Xop_lnki_type.Id_is_thumbable(lnki.Lnki_type());
|
||||
if (lnki_is_thumbable && !xfer_itm.File_exists()) // "non-found" thumbs should default to 220; otherwise large "non-found" thumbs will create large boxes; PAGE:en.w:Wikipedia:Featured_picture_candidates/September_Morn "|1000000x260px"; DATE:2014-09-24
|
||||
if ( lnki_is_thumbable
|
||||
&& ( !xfer_itm.File_exists() // "non-found" thumbs should default to 220; otherwise large "non-found" thumbs will create large boxes; PAGE:en.w:Wikipedia:Featured_picture_candidates/September_Morn "|1000000x260px"; DATE:2014-09-24
|
||||
&& !hctx.Mode_is_hdump()) // ignore for hdump mode b/c all images are "non-found"; DATE:2016-05-30
|
||||
)
|
||||
div_width = Xof_img_size.Thumb_width_img;
|
||||
if ( html_mgr.Img_suppress_missing_src() // option to suppress src when file is missing
|
||||
&& !xfer_itm.File_exists() // file is missing; wipe values and wait for "correct" info before regenerating; mostly to handle unknown redirects
|
||||
@@ -235,7 +238,7 @@ public class Xoh_file_wtr__basic {
|
||||
return tmp_bfr.To_bry_and_clear();
|
||||
}
|
||||
public static final int Play_btn_max_width = 1024;
|
||||
private static final byte[]
|
||||
private static final byte[]
|
||||
Div_center_bgn = Bry_.new_a7("<div class=\"center\">")
|
||||
, Div_float_none = Bry_.new_a7("<div class=\"floatnone\">")
|
||||
, Div_float_left = Bry_.new_a7("<div class=\"floatleft\">")
|
||||
|
||||
@@ -31,8 +31,8 @@ public class Xoh_lnki_title_fmtr_tst {
|
||||
}
|
||||
}
|
||||
class Xoh_lnki_title_fmtr_fxt {
|
||||
private final Xop_fxt fxt = new Xop_fxt();
|
||||
Bry_bfr bfr = Bry_bfr.new_();
|
||||
private final Xop_fxt fxt = new Xop_fxt();
|
||||
Bry_bfr bfr = Bry_bfr_.New();
|
||||
Xoh_lnki_title_fmtr title_wkr = new Xoh_lnki_title_fmtr();
|
||||
public Xoh_lnki_title_fmtr_fxt Clear() {return this;}
|
||||
public void Test_parse(String raw, String expd) {
|
||||
|
||||
@@ -19,9 +19,9 @@ package gplx.xowa.htmls.core.wkrs.thms; import gplx.*; import gplx.xowa.*; impor
|
||||
import gplx.core.primitives.*; import gplx.core.brys.*; import gplx.core.threads.poolables.*; import gplx.core.encoders.*;
|
||||
import gplx.xowa.htmls.core.hzips.*; import gplx.xowa.htmls.core.wkrs.imgs.*; import gplx.xowa.htmls.core.wkrs.thms.divs.*;
|
||||
public class Xoh_thm_hzip implements Xoh_hzip_wkr, Gfo_poolable_itm {
|
||||
private final Xoh_img_hzip img_hzip = new Xoh_img_hzip();
|
||||
private final Xoh_thm_wtr wtr = new Xoh_thm_wtr();
|
||||
private final Bry_obj_ref capt_1 = Bry_obj_ref.New_empty();
|
||||
private final Xoh_img_hzip img_hzip = new Xoh_img_hzip();
|
||||
private final Xoh_thm_wtr wtr = new Xoh_thm_wtr();
|
||||
private final Bry_obj_ref capt_1 = Bry_obj_ref.New_empty();
|
||||
public int Tid() {return Xoh_hzip_dict_.Tid__thm;}
|
||||
public String Key() {return Xoh_hzip_dict_.Key__thm;}
|
||||
public byte[] Hook() {return hook;} private byte[] hook;
|
||||
@@ -64,12 +64,15 @@ public class Xoh_thm_hzip implements Xoh_hzip_wkr, Gfo_poolable_itm {
|
||||
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);
|
||||
int fsdb_w = img_hzip.Wtr().Fsdb_itm().Html_w();
|
||||
if (fsdb_w > 0) // fsdb_w has value; this occurs when itm is found in user's file_cache; NOTE: do not do !div_1_width_exists b/c all thms have div_1_w; PAGE:en.w:Paris; DATE:2016-06-18
|
||||
div_1_width = fsdb_w; // override div_1_width, else widths will default to wrong value and not be auto-corrected by post-processing; DATE:2016-06-18
|
||||
wtr.Write(bfr, hpg, hctx, src, img_data.Img_is_vid(), div_0_align, div_1_width, img_hzip.Wtr(), img_hzip.Anch_href_bry(), capt_1, capt_2_exists, capt_2_is_tidy, capt_2_bry, capt_3_exists, capt_3_bry);
|
||||
img_data.Pool__rls();
|
||||
}
|
||||
public void Pool__rls () {pool_mgr.Rls_fast(pool_idx);} private Gfo_poolable_mgr pool_mgr; private int pool_idx;
|
||||
public Gfo_poolable_itm Pool__make (Gfo_poolable_mgr mgr, int idx, Object[] args) {Xoh_thm_hzip rv = new Xoh_thm_hzip(); rv.pool_mgr = mgr; rv.pool_idx = idx; rv.hook = (byte[])args[0]; return rv;}
|
||||
private final Int_flag_bldr flag_bldr = new Int_flag_bldr().Pow_ary_bld_(1, 1, 1, 1, 3);
|
||||
private final Int_flag_bldr flag_bldr = new Int_flag_bldr().Pow_ary_bld_(1, 1, 1, 1, 3);
|
||||
private static final int // SERIALIZED
|
||||
Flag__capt_3_exists = 0
|
||||
, Flag__capt_2_is_tidy = 1
|
||||
|
||||
@@ -17,6 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.htmls.core.wkrs.thms; 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.langs.htmls.*; import gplx.xowa.htmls.core.hzips.*;
|
||||
import gplx.xowa.files.*; import gplx.xowa.files.caches.*; import gplx.xowa.parsers.lnkis.*;
|
||||
public class Xoh_thm_hzip_tst {
|
||||
private final Xoh_hzip_fxt fxt = new Xoh_hzip_fxt().Init_mode_diff_y_();
|
||||
@Before public void setup() {fxt.Clear();}
|
||||
@@ -302,6 +303,27 @@ public class Xoh_thm_hzip_tst {
|
||||
, "</div>"
|
||||
));
|
||||
}
|
||||
@Test public void Div_width_uses_img_width() {
|
||||
Xof_fsdb_itm itm = new Xof_fsdb_itm();
|
||||
itm.Init_at_lnki(Xof_exec_tid.Tid_wiki_page, Bry_.new_a7("en.w"), Bry_.new_a7("A.png"), Xop_lnki_type.Id_null, -1, 220, -1, -1, -1, 0);
|
||||
itm.Init_at_cache(true, 400, 440, Io_url_.mem_fil_("mem/A.png"));
|
||||
Xou_cache_finder_mem finder = fxt.Init_file_mgr__mem();
|
||||
finder.Add(itm);
|
||||
|
||||
fxt.Test__decode("~&3abc~abc~!uA.png~)#Sabc~", String_.Concat_lines_nl_skip_last
|
||||
( "<div class='thumb tleft'>"
|
||||
, "<div class='thumbinner' style='width:400px;'><a href='/wiki/File:A.png' class='image' xowa_title='A.png'><img data-xowa-title='A.png' data-xoimg='0|220|-1|-1|-1|-1' src='file:///mem/A.png' width='400' height='440' class='thumbimage' alt='abc'></a> "
|
||||
, "<div class='thumbcaption'>"
|
||||
, "<div class='magnify'><a href='/wiki/File:A.png' class='internal' title='Enlarge'></a></div>"
|
||||
, "abc</div>"
|
||||
, "<hr>"
|
||||
, "<div class='thumbcaption'>abc</div>"
|
||||
, "</div>"
|
||||
, "</div>"
|
||||
));
|
||||
|
||||
fxt.Init_file_mgr__noop();
|
||||
}
|
||||
// @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();
|
||||
|
||||
@@ -20,15 +20,15 @@ import gplx.core.primitives.*; import gplx.core.brys.*; import gplx.core.brys.fm
|
||||
import gplx.langs.htmls.*; import gplx.langs.htmls.docs.*;
|
||||
import gplx.xowa.htmls.core.wkrs.bfr_args.*; import gplx.xowa.htmls.core.wkrs.imgs.*; import gplx.xowa.htmls.core.wkrs.imgs.atrs.*;
|
||||
public class Xoh_thm_wtr implements gplx.core.brys.Bfr_arg {
|
||||
private final Bfr_arg__bry div_0_align = Bfr_arg__bry.New_empty();
|
||||
private final Bfr_arg__int div_1_width = new Bfr_arg__int(-1);
|
||||
private final Bfr_arg__hatr_id div_1_id = Bfr_arg__hatr_id.New_id("xothm_");
|
||||
private final Bfr_arg__hatr_bry div_2_href = new Bfr_arg__hatr_bry(Gfh_atr_.Bry__href);
|
||||
private final Bfr_arg__bry_ary div_2_magnify = new Bfr_arg__bry_ary();
|
||||
private final Bfr_arg__bry capt_2 = Bfr_arg__bry.New(Bry_.Empty);
|
||||
private final Bfr_arg__bry capt_3 = Bfr_arg__bry.New(Bry_.Empty);
|
||||
private final Bfr_arg__bry enlarge = Bfr_arg__bry.New(Bry_.Empty);
|
||||
private final Bry_bfr tmp_bfr = Bry_bfr.new_(255);
|
||||
private final Bfr_arg__bry div_0_align = Bfr_arg__bry.New_empty();
|
||||
private final Bfr_arg__int div_1_width = new Bfr_arg__int(-1);
|
||||
private final Bfr_arg__hatr_id div_1_id = Bfr_arg__hatr_id.New_id("xowa_file_div_"); // NOTE: "xowa_file_div_" used multiple times; DATE:2016-06-13
|
||||
private final Bfr_arg__hatr_bry div_2_href = new Bfr_arg__hatr_bry(Gfh_atr_.Bry__href);
|
||||
private final Bfr_arg__bry_ary div_2_magnify = new Bfr_arg__bry_ary();
|
||||
private final Bfr_arg__bry capt_2 = Bfr_arg__bry.New(Bry_.Empty);
|
||||
private final Bfr_arg__bry capt_3 = Bfr_arg__bry.New(Bry_.Empty);
|
||||
private final Bfr_arg__bry enlarge = Bfr_arg__bry.New(Bry_.Empty);
|
||||
private final Bry_bfr tmp_bfr = Bry_bfr_.New_w_size(255);
|
||||
private Bfr_arg div_1_img = Bfr_arg_.Noop, capt_1 = Bfr_arg_.Noop;
|
||||
private byte[] img_is_vid_nl, trailing_space;
|
||||
public Xoh_thm_wtr Clear() {
|
||||
@@ -74,19 +74,19 @@ public class Xoh_thm_wtr implements gplx.core.brys.Bfr_arg {
|
||||
public void Bfr_arg__add(Bry_bfr bfr) {
|
||||
fmtr.Bld_bfr_many(bfr, div_0_align, div_1_id, div_1_width, img_is_vid_nl, div_1_img, trailing_space, div_2_href, div_2_magnify, enlarge, capt_1, capt_2, capt_3);
|
||||
}
|
||||
private static final byte[] Bry__enlarge = Bry_.new_a7("Enlarge");
|
||||
private static final Bry_fmtr fmtr = Bry_fmtr.new_(String_.Concat_lines_nl_skip_last
|
||||
private static final byte[] Bry__enlarge = Bry_.new_a7("Enlarge");
|
||||
private static final Bry_fmtr fmtr = Bry_fmtr.new_(String_.Concat_lines_nl_skip_last
|
||||
( "<div class=\"thumb t~{div_0_align}\">"
|
||||
, "<div~{div_1_id} class=\"thumbinner\" style=\"width:~{div_1_width}px;\">~{img_is_vid_nl}~{div_1_img}~{trailing_space}" // NOTE: trailing space is intentional; matches jtidy behavior
|
||||
, "<div class=\"thumbcaption\">"
|
||||
, "<div class=\"magnify\"><a~{div_2_href} class=\"internal\" title=\"~{enlarge}\"></a></div>"
|
||||
, "~{capt_1}</div>~{capt_2}</div>~{capt_3}</div>"
|
||||
), "div_0_align", "div_1_id", "div_1_width", "img_is_vid_nl", "div_1_img", "trailing_space", "div_2_href", "div_2_magnify", "enlarge", "capt_1", "capt_2", "capt_3");
|
||||
private static final Bry_fmtr alt_fmtr = Bry_fmtr.new_(String_.Concat_lines_nl_skip_last
|
||||
private static final Bry_fmtr alt_fmtr = Bry_fmtr.new_(String_.Concat_lines_nl_skip_last
|
||||
( ""
|
||||
, "<hr>"
|
||||
, "<div class=\"thumbcaption\">~{alt}</div>"
|
||||
, ""
|
||||
), "alt");
|
||||
private static final byte[] bry_div_2_magnify = Bry_.new_a7("bin/any/xowa/file/mediawiki.file/magnify-clip.png");
|
||||
private static final byte[] bry_div_2_magnify = Bry_.new_a7("bin/any/xowa/file/mediawiki.file/magnify-clip.png");
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
// using gplx.xowa.wikis.dbs; using gplx.xowa.wikis.pages; using gplx.xowa.htmls.core.makes.imgs; using gplx.xowa.wikis.pages.skins;
|
||||
// using gplx.xowa.wikis.data; using gplx.xowa.wikis.data.tbls; using gplx.xowa.guis;
|
||||
// public class Xohd_page_html_mgr__load {
|
||||
// private final Bry_rdr_old rdr = new Bry_rdr_old(); private final List_adp rows = List_adp_.new_(), imgs = List_adp_.new_();
|
||||
// private final Bry_rdr_old rdr = new Bry_rdr_old(); private final List_adp rows = List_adp_.New(), imgs = List_adp_.New();
|
||||
// public void Load_page(Xow_wiki wiki, Xoh_page hpg, Xowd_html_tbl tbl, int page_id, Xoa_ttl page_ttl) {
|
||||
// Xoa_app_.Usr_dlg().Plog_many("", "", "hdump.load.text: ttl=~{0}", page_ttl.Full_db_as_str());
|
||||
// tbl.Select_by_page(rows, page_id);
|
||||
@@ -73,14 +73,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
// private void Load_data_redlink(Xoh_page hpg) {
|
||||
// Ordered_hash redlink_hash = hpg.Redlink_uids();
|
||||
// while (!rdr.Pos_is_eos()) {
|
||||
// Int_obj_ref redlink_uid = Int_obj_ref.new_(rdr.Read_int_to_pipe());
|
||||
// Int_obj_ref redlink_uid = Int_obj_ref.New(rdr.Read_int_to_pipe());
|
||||
// redlink_hash.Add(redlink_uid, redlink_uid);
|
||||
// }
|
||||
// }
|
||||
// private void Load_data_gallery(Xoh_page hpg) {
|
||||
// int uid = rdr.Read_int_to_pipe();
|
||||
// int box_max = rdr.Read_int_to_pipe();
|
||||
// hpg.Gallery_itms().Add_if_dupe_use_nth(uid, new Xohd_img_itm__gallery_mgr(uid, box_max)); // TODO: temporarily added b/c last build did not add gallery uid correctly
|
||||
// hpg.Gallery_itms().Add_if_dupe_use_nth(uid, new Xohd_img_itm__gallery_mgr(uid, box_max)); // TODO_OLD: temporarily added b/c last build did not add gallery uid correctly
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -17,9 +17,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.htmls.core.wkrs.xndes.atrs; import gplx.*; import gplx.xowa.*; import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.*; import gplx.xowa.htmls.core.wkrs.*; import gplx.xowa.htmls.core.wkrs.xndes.*;
|
||||
public class Xohz_atr_regy {
|
||||
private final Hash_adp_bry itm_regy = Hash_adp_bry.cs();
|
||||
private final Hash_adp_bry grp_regy = Hash_adp_bry.cs();
|
||||
private final List_adp tmp_list = List_adp_.new_();
|
||||
private final Hash_adp_bry itm_regy = Hash_adp_bry.cs();
|
||||
private final Hash_adp_bry grp_regy = Hash_adp_bry.cs();
|
||||
private final List_adp tmp_list = List_adp_.New();
|
||||
public Xohz_atr_regy Grps__add(byte[] grp_key, byte[]... sub_keys) {
|
||||
int sub_keys_len = sub_keys.length;
|
||||
for (int i = 0; i < sub_keys_len; ++i) {
|
||||
@@ -59,5 +59,5 @@ public class Xohz_atr_regy {
|
||||
}
|
||||
class Xohz_atr_grp {
|
||||
public Xohz_atr_grp(byte[][] subs) {this.subs = subs;}
|
||||
public byte[][] Subs() {return subs;} private final byte[][] subs;
|
||||
public byte[][] Subs() {return subs;} private final byte[][] subs;
|
||||
}
|
||||
|
||||
@@ -18,10 +18,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.htmls.core.wkrs.xndes.dicts; import gplx.*; import gplx.xowa.*; import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.*; import gplx.xowa.htmls.core.wkrs.*; import gplx.xowa.htmls.core.wkrs.xndes.*;
|
||||
import gplx.core.brys.*;
|
||||
public class Xoh_xnde_dict_grp {
|
||||
private final int id_len;
|
||||
private final int id_len;
|
||||
private int id_next = -1;
|
||||
private final Hash_adp_bry hash = Hash_adp_bry.cs();
|
||||
private final List_adp list = List_adp_.new_();
|
||||
private final Hash_adp_bry hash = Hash_adp_bry.cs();
|
||||
private final List_adp list = List_adp_.New();
|
||||
public Xoh_xnde_dict_grp(int id_len) {this.id_len = id_len;}
|
||||
public void Clear() {
|
||||
id_next = -1;
|
||||
@@ -68,5 +68,5 @@ public class Xoh_xnde_dict_grp {
|
||||
list.Add(rv);
|
||||
return rv;
|
||||
}
|
||||
public static final byte[] Bry__stop = Bry_.New_by_ints(255, 0);
|
||||
public static final byte[] Bry__stop = Bry_.New_by_ints(255, 0);
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ import gplx.xowa.htmls.core.hzips.*;
|
||||
// }
|
||||
// }
|
||||
// class Hz_regy {
|
||||
// private final Ordered_hash tag_hash = Ordered_hash_.New();
|
||||
// private final Ordered_hash tag_hash = Ordered_hash_.New();
|
||||
// public Hz_tag_itm Tags__get_or_new(int name_id) {
|
||||
// return null;
|
||||
// }
|
||||
@@ -125,7 +125,7 @@ import gplx.xowa.htmls.core.hzips.*;
|
||||
// }
|
||||
// }
|
||||
// class Hz_tag_hzip {
|
||||
// private static final byte[] Hook_tag = Bry_.new_a7("~z");
|
||||
// private static final byte[] Hook_tag = Bry_.new_a7("~z");
|
||||
// public void Encode(Bry_bfr bfr, Hz_regy regy, Gfh_tag htag) {
|
||||
// Hz_tag_itm ztag = regy.Tags__get_or_new(htag.Name_id());
|
||||
//
|
||||
@@ -155,7 +155,7 @@ import gplx.xowa.htmls.core.hzips.*;
|
||||
// public boolean Indexable() {return indexable;} private boolean indexable;
|
||||
// public Xohz_style_itm[] Atrs() {if (atr_ary_is_dirty) atr_ary = (Xohz_style_itm[])atr_list.To_ary(typeof(Xohz_style_itm)); return atr_ary;} private Xohz_style_itm[] atr_ary; private boolean atr_ary_is_dirty = false;
|
||||
// private void Add(byte[] text) {
|
||||
// if (atr_list == null) atr_list = List_adp_.new_();
|
||||
// if (atr_list == null) atr_list = List_adp_.New();
|
||||
// atr_list.Add(new Xohz_style_itm(atr_list.Count(), text, Bool_.Y, Bool_.Y));
|
||||
// }
|
||||
// }
|
||||
@@ -170,7 +170,7 @@ import gplx.xowa.htmls.core.hzips.*;
|
||||
// public boolean Indexable() {return indexable;} private boolean indexable;
|
||||
// public Xohz_style_val[] Itms() {if (ary_is_dirty) ary = (Xohz_style_val[])list.To_ary(typeof(Xohz_style_val)); return ary;} private Xohz_style_val[] ary; private boolean ary_is_dirty = false;
|
||||
// private void Itms__add(byte[] key) {
|
||||
// if (list == null) list = List_adp_.new_();
|
||||
// if (list == null) list = List_adp_.New();
|
||||
// ary_is_dirty = true;
|
||||
// list.Add(new Xohz_style_val(list.Count(), key, Bool_.Y));
|
||||
// }
|
||||
@@ -182,7 +182,7 @@ import gplx.xowa.htmls.core.hzips.*;
|
||||
// public Xohz_style_val(int uid, byte[] txt, boolean scope_is_doc) {
|
||||
// this.uid = uid; this.txt = txt; this.scope_is_doc = scope_is_doc;
|
||||
// }
|
||||
// public int Uid() {return uid;} private final int uid;
|
||||
// public byte[] Txt() {return txt;} private final byte[] txt;
|
||||
// public int Uid() {return uid;} private final int uid;
|
||||
// public byte[] Txt() {return txt;} private final byte[] txt;
|
||||
// public boolean Scope_is_doc() {return scope_is_doc;} private boolean scope_is_doc;
|
||||
// }
|
||||
|
||||
@@ -20,10 +20,10 @@ import gplx.core.brys.*;
|
||||
import gplx.langs.htmls.*; import gplx.langs.htmls.docs.*;
|
||||
import gplx.xowa.htmls.core.wkrs.xndes.atrs.*;
|
||||
public class Xohz_tag {
|
||||
private final byte[] key; private final int uid;
|
||||
private final Xohz_atr_itm[] zatr_ary; private final int zatr_ary_len; private final Ordered_hash zatr_hash = Ordered_hash_.New_bry();
|
||||
private final Int_flag_bldr flag_bldr = new Int_flag_bldr(); private final int flag_len; private int flag__tag_is_inline, flag__unknown_atrs_exist;
|
||||
private static final List_adp tmp_pow_ary_list = List_adp_.new_();
|
||||
private final byte[] key; private final int uid;
|
||||
private final Xohz_atr_itm[] zatr_ary; private final int zatr_ary_len; private final Ordered_hash zatr_hash = Ordered_hash_.New_bry();
|
||||
private final Int_flag_bldr flag_bldr = new Int_flag_bldr(); private final int flag_len; private int flag__tag_is_inline, flag__unknown_atrs_exist;
|
||||
private static final List_adp tmp_pow_ary_list = List_adp_.New();
|
||||
public Xohz_tag(int uid, byte[] key, int flag_len, Xohz_atr_itm... zatr_ary) {
|
||||
this.uid = uid; this.key = key;
|
||||
this.flag_len = flag_len;
|
||||
|
||||
@@ -19,9 +19,9 @@ package gplx.xowa.htmls.core.wkrs.xndes.tags; import gplx.*; import gplx.xowa.*;
|
||||
import gplx.core.primitives.*;
|
||||
import gplx.langs.htmls.*; import gplx.xowa.htmls.core.wkrs.xndes.atrs.*;
|
||||
public class Xohz_tag_regy {
|
||||
private final Ordered_hash keys = Ordered_hash_.New_bry();
|
||||
private final Hash_adp uids = Hash_adp_.new_(); private final Byte_obj_ref uids_ref = Byte_obj_ref.zero_();
|
||||
public Xohz_atr_regy Atr_regy() {return atr_regy;} private final Xohz_atr_regy atr_regy = new Xohz_atr_regy();
|
||||
private final Ordered_hash keys = Ordered_hash_.New_bry();
|
||||
private final Hash_adp uids = Hash_adp_.New(); private final Byte_obj_ref uids_ref = Byte_obj_ref.zero_();
|
||||
public Xohz_atr_regy Atr_regy() {return atr_regy;} private final Xohz_atr_regy atr_regy = new Xohz_atr_regy();
|
||||
public Xohz_tag Get_by_key(byte[] key) {return (Xohz_tag)keys.Get_by(key);}
|
||||
public Xohz_tag Get_by_uid(byte uid) {return (Xohz_tag)uids.Get_by(uids_ref.Val_(uid));}
|
||||
public Xohz_tag_regy Add(int uid, byte[] key, int flag_len, byte[] atr_key) {
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
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.css; import gplx.*; import gplx.xowa.*; import gplx.xowa.htmls.*;
|
||||
import gplx.xowa.wikis.*; import gplx.xowa.wikis.data.*;
|
||||
import gplx.xowa.bldrs.css.*;
|
||||
public class Xob_css_status {
|
||||
public int Update_tid() {return update_tid;} private int update_tid;
|
||||
public boolean Fs_exists() {return fs_exists;} private boolean fs_exists;
|
||||
public Io_url Fs_dir() {return fs_dir;} private Io_url fs_dir;
|
||||
public boolean Db_exists() {return db_exists;} private boolean db_exists;
|
||||
public void Fs_exists_(boolean fs_exists, Io_url fs_dir) {
|
||||
this.fs_exists = fs_exists;
|
||||
this.fs_dir = fs_dir;
|
||||
}
|
||||
public void Db_exists_(boolean db_exists) {
|
||||
this.db_exists = db_exists;
|
||||
}
|
||||
public void Update_tid_none_y_() {this.update_tid = Update_tid_none;}
|
||||
public void Update_tid_wmf_y_() {this.update_tid = Update_tid_wmf;}
|
||||
public void Update_tid_db_y_() {this.update_tid = Update_tid_db;}
|
||||
public static final int Update_tid_none = 0, Update_tid_db = 1, Update_tid_wmf = 2;
|
||||
public static Xob_css_status Chk(Xow_wiki wiki, Io_url css_dir, String key) {
|
||||
Xob_css_status rv = new Xob_css_status();
|
||||
Chk_fs(rv, wiki);
|
||||
Chk_db(rv, wiki, css_dir);
|
||||
return rv;
|
||||
}
|
||||
private static void Chk_fs(Xob_css_status rv, Xow_wiki wiki) {
|
||||
Io_url css_dir = wiki.App().Fsys_mgr().Wiki_css_dir(wiki.Domain_str()); // EX: /xowa/user/anonymous/wiki/en.wikipedia.org/html/
|
||||
Io_url css_fil_wiki = css_dir.GenSubFil(Xoa_css_extractor.Css_wiki_name); // EX: /xowa/user/anonymous/wiki/en.wikipedia.org/html/xowa_wiki.css
|
||||
boolean exists = Io_mgr.Instance.ExistsFil(css_fil_wiki);
|
||||
rv.Fs_exists_(exists, css_dir);
|
||||
}
|
||||
private static void Chk_db(Xob_css_status rv, Xow_wiki wiki, Io_url css_dir) {
|
||||
Xowd_db_mgr core_db_mgr = wiki.Data__core_mgr();
|
||||
if ( core_db_mgr == null
|
||||
|| core_db_mgr.Props() != null
|
||||
|| !core_db_mgr.Props().Schema_is_1()
|
||||
|| core_db_mgr.Tbl__cfg().Select_yn_or(Xow_cfg_consts.Grp__wiki_schema, Xowd_db_file_schema_props.Key__tbl_css_core, Bool_.N)
|
||||
) {
|
||||
rv.Db_exists_(false);
|
||||
if (rv.Fs_exists())
|
||||
rv.Update_tid_none_y_(); // v1_db and fs_exists; don't do update; legacy behavior
|
||||
else
|
||||
rv.Update_tid_wmf_y_(); // v1_db and fs_missing; update from wmf; legacy behavior
|
||||
}
|
||||
if (rv.Fs_exists()) {
|
||||
DateAdp fs_timestamp = Timestamp_load(css_dir);
|
||||
DateAdp db_timestamp = DateAdp_.Now();
|
||||
if (db_timestamp.compareTo(fs_timestamp) == CompareAble_.More)
|
||||
rv.Update_tid_db_y_(); // v2_db and later_version; update from db
|
||||
else
|
||||
rv.Update_tid_none_y_(); // v2_db and current version; noop
|
||||
}
|
||||
}
|
||||
public static void Timestamp_save(Io_url css_dir, DateAdp time) {
|
||||
Io_mgr.Instance.SaveFilStr(css_dir.GenSubFil(Timestamp_filename), time.XtoStr_fmt_yyyyMMdd_HHmmss());
|
||||
}
|
||||
public static DateAdp Timestamp_load(Io_url css_dir) {
|
||||
String rv = Io_mgr.Instance.LoadFilStr(css_dir.GenSubFil(Timestamp_filename));
|
||||
return rv == null ? DateAdp_.MinValue : DateAdp_.parse_iso8561_or(rv, DateAdp_.MinValue);
|
||||
}
|
||||
private static final String Timestamp_filename = "xowa.css.timestamp.txt";
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
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.css; import gplx.*; import gplx.xowa.*; import gplx.xowa.htmls.*;
|
||||
import gplx.xowa.wikis.*; import gplx.xowa.wikis.data.*; import gplx.xowa.wikis.data.tbls.*;
|
||||
public class Xow_css_mgr {
|
||||
private final Xow_wiki wiki;
|
||||
private boolean db_css_exists;
|
||||
private Xowd_css_core_tbl css_core_tbl; private Xowd_css_file_tbl css_file_tbl;
|
||||
public Xow_css_mgr(Xow_wiki wiki) {this.wiki = wiki;}
|
||||
public void Init_by_wiki() {
|
||||
Gfo_usr_dlg usr_dlg = Xoa_app_.Usr_dlg();
|
||||
Xowd_db_mgr core_db_mgr = wiki.Data__core_mgr();
|
||||
if (core_db_mgr == null) {
|
||||
usr_dlg.Log_many("", "", "db.css.exists; css_missing b/c tdb; wiki=~{0}", wiki.Domain_str());
|
||||
return;
|
||||
}
|
||||
if ( core_db_mgr.Props() == null
|
||||
|| core_db_mgr.Props().Schema_is_1()) {
|
||||
usr_dlg.Log_many("", "", "db.css.exists; css_missing b/c v1; wiki=~{0}", wiki.Domain_str());
|
||||
return;
|
||||
}
|
||||
Xowd_db_file core_db = core_db_mgr.Db__core();
|
||||
this.css_core_tbl = core_db.Tbl__css_core();
|
||||
this.css_file_tbl = core_db.Tbl__css_file();
|
||||
if ( core_db == null
|
||||
|| !core_db.Conn().Meta_tbl_exists(css_core_tbl.Tbl_name())
|
||||
) {
|
||||
usr_dlg.Log_many("", "", "db.css.exists; css_missing b/c v2 w/o css; wiki=~{0}", wiki.Domain_str());
|
||||
return;
|
||||
}
|
||||
this.db_css_exists = true;
|
||||
}
|
||||
public void Db_del_all() {
|
||||
if (!db_css_exists) {Xoa_app_.Usr_dlg().Log_many("", "", "db.css.del_all; del_all skipped; wiki=~{0}", wiki.Domain_str()); return;}
|
||||
css_core_tbl.Delete_all();
|
||||
css_file_tbl.Delete_all();
|
||||
}
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
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.css; import gplx.*; import gplx.xowa.*; import gplx.xowa.htmls.*;
|
||||
import gplx.core.envs.*;
|
||||
import gplx.dbs.*;
|
||||
import gplx.xowa.wikis.*; import gplx.xowa.wikis.data.*; import gplx.xowa.wikis.data.tbls.*;
|
||||
import gplx.xowa.bldrs.css.*;
|
||||
public class Xowd_css_core_mgr {
|
||||
public static void Set(Xowd_css_core_tbl core_tbl, Xowd_css_file_tbl file_tbl, Io_url css_dir, String key) {
|
||||
Db_conn conn = core_tbl.Conn();
|
||||
Io_url[] file_list = Io_mgr.Instance.QueryDir_args(css_dir).Recur_().ExecAsUrlAry();
|
||||
try {
|
||||
conn.Txn_bgn("schema__css_core__set");
|
||||
int css_id = core_tbl.Select_id_by_key(key);
|
||||
DateAdp updated_on = DateAdp_.Now().XtoUtc();
|
||||
if (css_id == -1)
|
||||
css_id = core_tbl.Insert(key, updated_on);
|
||||
else {
|
||||
core_tbl.Update(css_id, key, updated_on);
|
||||
file_tbl.Delete(css_id);
|
||||
}
|
||||
for (Io_url file : file_list) {
|
||||
String path = Op_sys.Fsys_path_to_lnx(file.GenRelUrl_orEmpty(css_dir));
|
||||
byte[] data = Io_mgr.Instance.LoadFilBry(file);
|
||||
file_tbl.Insert(css_id, path, data);
|
||||
}
|
||||
conn.Txn_end();
|
||||
}
|
||||
catch (Exception e) {conn.Txn_cxl(); throw e;}
|
||||
}
|
||||
public static boolean Get(Xowd_css_core_tbl core_tbl, Xowd_css_file_tbl file_tbl, Io_url css_dir, String key) {
|
||||
String dbg = "enter";
|
||||
try {
|
||||
int css_id = core_tbl.Select_id_by_key(key);
|
||||
dbg += ";css_id";
|
||||
if (css_id == Xowd_css_core_tbl.Id_null) return false; // unknown key; return false (not found)
|
||||
dbg += ";select_by_owner";
|
||||
Xowd_css_file_itm[] file_list = file_tbl.Select_by_owner(css_id);
|
||||
dbg += ";file_list:" + file_list.length;
|
||||
// Io_mgr.Instance.DeleteDirDeep(css_dir); // NOTE: do not delete existing files; just overwrite;
|
||||
int len = file_list.length;
|
||||
if (len == 0) return false; // no css files in db
|
||||
for (int i = 0; i < len; ++i) {
|
||||
Xowd_css_file_itm file = file_list[i];
|
||||
dbg += ";file_url:" + file.Path();
|
||||
Io_url file_url = Io_url_.new_fil_(css_dir.Gen_sub_path_for_os(file.Path()));
|
||||
if (file.Data() == null) continue; // NOTE: sqlite will return 0 length fields as NULL; if no data, just ignore, else error below
|
||||
Io_mgr.Instance.SaveFilBry(file_url, file.Data());
|
||||
dbg += ";file_data:" + file.Data().length;
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e) {throw Err_.new_exc(e, "css", "Xowd_css_core_mgr.Get failed", "dbg", dbg, "err", Err_.Message_gplx_log(e));}
|
||||
}
|
||||
public static final String Key_default = "xowa.default", Key_mobile = "xowa.mobile";
|
||||
}
|
||||
@@ -1,120 +0,0 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
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.css; import gplx.*; import gplx.xowa.*; import gplx.xowa.htmls.*;
|
||||
import org.junit.*; import gplx.core.ios.*; import gplx.dbs.*; import gplx.xowa.wikis.data.tbls.*;
|
||||
public class Xowd_css_core_mgr_tst {
|
||||
@Before public void init() {fxt.Clear();} private Xowd_css_core_mgr_fxt fxt = new Xowd_css_core_mgr_fxt();
|
||||
@Test public void Basic() {
|
||||
Xowd_css_core_itm[] skin_ary = fxt.Make_skin_ary
|
||||
( fxt.Make_skin_itm(1, "desktop", "20010101_050200")
|
||||
);
|
||||
Xowd_css_file_itm[] file_ary = fxt.Make_file_ary
|
||||
( fxt.Make_file_itm(1, "a.css", "a_data")
|
||||
, fxt.Make_file_itm(1, "b/b.png", "b/b_data")
|
||||
);
|
||||
Io_url src_dir = Io_url_.mem_dir_("mem/src/");
|
||||
fxt.Init_fs(src_dir, file_ary);
|
||||
fxt.Exec_set(src_dir, "desktop");
|
||||
fxt.Test_skin_tbl(skin_ary);
|
||||
fxt.Test_file_tbl(file_ary);
|
||||
|
||||
Io_url trg_dir = Io_url_.mem_dir_("mem/trg/");
|
||||
fxt.Exec_get(trg_dir, "desktop");
|
||||
fxt.Test_fs(trg_dir, file_ary);
|
||||
}
|
||||
@Test public void Update() { // update css files; keep same skin_id; insert new files
|
||||
Xowd_css_core_itm[] skin_ary = fxt.Make_skin_ary
|
||||
( fxt.Make_skin_itm(1, "desktop", "20010101_050500")
|
||||
);
|
||||
Xowd_css_file_itm[] file_ary = fxt.Make_file_ary
|
||||
( fxt.Make_file_itm(1, "a.css", "a_data")
|
||||
, fxt.Make_file_itm(1, "b/b.png", "b/b_data")
|
||||
);
|
||||
Io_url src_dir = Io_url_.mem_dir_("mem/src/");
|
||||
fxt.Init_fs(src_dir, file_ary);
|
||||
fxt.Exec_set(src_dir, "desktop");
|
||||
|
||||
file_ary = fxt.Make_file_ary
|
||||
( fxt.Make_file_itm(1, "a1.css", "a1_data")
|
||||
, fxt.Make_file_itm(1, "b/b1.png", "b/b1_data")
|
||||
);
|
||||
Io_mgr.Instance.DeleteDirDeep(src_dir);
|
||||
fxt.Init_fs(src_dir, file_ary);
|
||||
fxt.Exec_set(src_dir, "desktop");
|
||||
fxt.Test_skin_tbl(skin_ary);
|
||||
fxt.Test_file_tbl(file_ary);
|
||||
}
|
||||
}
|
||||
class Xowd_css_core_mgr_fxt {
|
||||
private final Bry_bfr bfr = Bry_bfr.reset_(32);
|
||||
private Xowd_css_core_tbl core_tbl; private Xowd_css_file_tbl file_tbl;
|
||||
public void Clear() {
|
||||
Tfds.Now_enabled_y_();
|
||||
Io_mgr.Instance.InitEngine_mem();
|
||||
Db_conn_bldr.Instance.Reg_default_mem();
|
||||
Db_conn conn = Db_conn_bldr.Instance.New(Io_url_.mem_fil_("mem/db/css.sqlite3"));
|
||||
this.core_tbl = new Xowd_css_core_tbl(conn);
|
||||
this.file_tbl = new Xowd_css_file_tbl(conn);
|
||||
core_tbl.Create_tbl();
|
||||
file_tbl.Create_tbl();
|
||||
}
|
||||
public Xowd_css_core_itm Make_skin_itm(int id, String key, String updated_on) {return new Xowd_css_core_itm(id, key, DateAdp_.parse_gplx(updated_on));}
|
||||
public Xowd_css_file_itm Make_file_itm(int skin_id, String path, String data) {return new Xowd_css_file_itm(skin_id, path, Bry_.new_u8(data));}
|
||||
public Xowd_css_file_itm[] Make_file_ary(Xowd_css_file_itm... ary) {return ary;}
|
||||
public Xowd_css_core_itm[] Make_skin_ary(Xowd_css_core_itm... ary) {return ary;}
|
||||
public void Init_fs(Io_url css_dir, Xowd_css_file_itm[] file_ary) {
|
||||
for (Xowd_css_file_itm itm : file_ary)
|
||||
Io_mgr.Instance.SaveFilBry(css_dir.GenSubFil(itm.Path()), itm.Data());
|
||||
}
|
||||
public void Exec_set(Io_url css_dir, String key) {Xowd_css_core_mgr.Set(core_tbl, file_tbl, css_dir, key);}
|
||||
public void Exec_get(Io_url css_dir, String key) {Xowd_css_core_mgr.Get(core_tbl, file_tbl, css_dir, key);}
|
||||
public void Test_skin_tbl(Xowd_css_core_itm[] expd) {
|
||||
Xowd_css_core_itm[] actl = core_tbl.Select_all();
|
||||
Tfds.Eq_str_lines(To_str(expd), To_str(actl));
|
||||
}
|
||||
public void Test_file_tbl(Xowd_css_file_itm[] expd) {
|
||||
Xowd_css_file_itm[] actl = file_tbl.Select_all();
|
||||
Tfds.Eq_str_lines(To_str(expd), To_str(actl));
|
||||
}
|
||||
public void Test_fs(Io_url css_dir, Xowd_css_file_itm[] expd) {
|
||||
Io_url[] actl = Io_mgr.Instance.QueryDir_args(css_dir).Recur_().ExecAsUrlAry();
|
||||
int len = expd.length;
|
||||
Tfds.Eq(len, actl.length);
|
||||
for (int i = 0; i < len; ++i) {
|
||||
Xowd_css_file_itm expd_itm = expd[i];
|
||||
Tfds.Eq_bry(expd_itm.Data(), Io_mgr.Instance.LoadFilBry(actl[i]));
|
||||
}
|
||||
}
|
||||
private String To_str(Xowd_css_file_itm[] ary) {
|
||||
int len = ary.length;
|
||||
for (int i = 0; i < len; ++i) {
|
||||
Xowd_css_file_itm itm = ary[i];
|
||||
bfr.Add_int_variable(itm.Css_id()).Add_byte_pipe().Add_str_u8(itm.Path()).Add_byte_pipe().Add(itm.Data()).Add_byte_nl();
|
||||
}
|
||||
return bfr.To_str_and_clear();
|
||||
}
|
||||
private String To_str(Xowd_css_core_itm[] ary) {
|
||||
Bry_bfr bfr = Bry_bfr.new_();
|
||||
int len = ary.length;
|
||||
for (int i = 0; i < len; ++i) {
|
||||
Xowd_css_core_itm itm = ary[i];
|
||||
bfr.Add_int_variable(itm.Id()).Add_byte_pipe().Add_str_u8(itm.Key()).Add_byte_pipe().Add_str_u8(itm.Updated_on().XtoStr_fmt_yyyyMMdd_HHmmss()).Add_byte_nl();
|
||||
}
|
||||
return bfr.To_str_and_clear();
|
||||
}
|
||||
}
|
||||
@@ -172,7 +172,7 @@ public class Xoh_head_mgr implements gplx.core.brys.Bfr_arg {
|
||||
}
|
||||
}
|
||||
class Xoh_head_wkr {
|
||||
private final List_adp list = List_adp_.size_(Xoh_head_itm__base.Idx__max);
|
||||
private final List_adp list = List_adp_.New_w_size(Xoh_head_itm__base.Idx__max);
|
||||
public int Len() {return list.Count();}
|
||||
public void Clear() {list.Clear();}
|
||||
public void Add(Xoh_head_itm__base itm) {list.Add(itm);}
|
||||
|
||||
@@ -120,9 +120,9 @@ public class Xoh_head_mgr_tst {
|
||||
}
|
||||
}
|
||||
class Xoh_head_mgr_fxt {
|
||||
private final Xop_fxt fxt = new Xop_fxt();
|
||||
private final Xop_fxt fxt = new Xop_fxt();
|
||||
private Xoh_head_mgr mgr;
|
||||
private Bry_bfr bfr = Bry_bfr.reset_(255);
|
||||
private Bry_bfr bfr = Bry_bfr_.Reset(255);
|
||||
public Xowe_wiki Wiki() {return wiki;} private Xowe_wiki wiki;
|
||||
public Xoh_head_mgr Mgr() {return mgr;}
|
||||
public Xol_lang_itm Make_lang(String key) {return wiki.Appe().Lang_mgr().Get_by_or_new(Bry_.new_a7(key));}
|
||||
|
||||
@@ -44,7 +44,7 @@ public class Xoh_head_wtr_tst {
|
||||
}
|
||||
}
|
||||
class Xoh_head_wtr_fxt {
|
||||
private Bry_bfr bfr = Bry_bfr.reset_(255);
|
||||
private Bry_bfr bfr = Bry_bfr_.Reset(255);
|
||||
public Xoh_head_wtr Wtr() {return wtr;} private Xoh_head_wtr wtr = new Xoh_head_wtr();
|
||||
public void Clear() {
|
||||
wtr.Init(bfr);
|
||||
|
||||
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.htmls.heads; import gplx.*; import gplx.xowa.*; import gplx.xowa.htmls.*;
|
||||
import gplx.core.brys.fmtrs.*;
|
||||
import gplx.xowa.langs.*; import gplx.xowa.langs.msgs.*; import gplx.xowa.langs.numbers.*;
|
||||
public class Xow_fragment_mgr implements GfoInvkAble {
|
||||
public class Xow_fragment_mgr implements Gfo_invk {
|
||||
public Xow_fragment_mgr(Xowe_wiki wiki) {this.wiki = wiki;} private Xowe_wiki wiki;
|
||||
public byte[] Html_js_edit_toolbar() {return html_js_edit_toolbar;} private byte[] html_js_edit_toolbar;
|
||||
private Bry_fmtr html_js_edit_toolbar_fmtr = Bry_fmtr.new_(String_.Concat_lines_nl
|
||||
@@ -40,7 +40,7 @@ public class Xow_fragment_mgr implements GfoInvkAble {
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_html_js_edit_toolbar_fmt_)) html_js_edit_toolbar_fmtr.Fmt_(m.ReadBry("v"));
|
||||
else if (ctx.Match(k, Invk_html_js_edit_toolbar)) return html_js_edit_toolbar;
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
}
|
||||
public static final String Invk_html_js_edit_toolbar_fmt_ = "html_js_edit_toolbar_fmt_", Invk_html_js_edit_toolbar = "html_js_edit_toolbar";
|
||||
|
||||
@@ -51,7 +51,7 @@ class Xow_fragment_mgr_fxt {
|
||||
public void Test_fragment(String key, String expd) {Test_fragment(wiki.Lang(), key, expd);}
|
||||
public void Test_fragment(Xol_lang_itm lang, String key, String expd) {
|
||||
wiki.Fragment_mgr().Evt_lang_changed(lang);
|
||||
byte[] actl = (byte[])GfoInvkAble_.InvkCmd(wiki.Fragment_mgr(), key);
|
||||
byte[] actl = (byte[])Gfo_invk_.Invk_by_key(wiki.Fragment_mgr(), key);
|
||||
Tfds.Eq_str_lines(expd, String_.new_u8(actl));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ import gplx.core.brys.fmtrs.*;
|
||||
import gplx.langs.htmls.encoders.*; import gplx.xowa.htmls.core.htmls.*;
|
||||
import gplx.xowa.wikis.xwikis.*;
|
||||
public class Xoh_href_wtr {
|
||||
private final Bry_bfr encoder_bfr = Bry_bfr.reset_(255), tmp_bfr = Bry_bfr.reset_(255);
|
||||
private final Bry_bfr encoder_bfr = Bry_bfr_.Reset(255), tmp_bfr = Bry_bfr_.Reset(255);
|
||||
private final Gfo_url_encoder encoder = Gfo_url_encoder_.Href;
|
||||
public byte[] Build_to_bry(Xow_wiki wiki, Xoa_ttl ttl) {
|
||||
synchronized (tmp_bfr) {
|
||||
|
||||
@@ -19,7 +19,7 @@ package gplx.xowa.htmls.hrefs; import gplx.*; import gplx.xowa.*; import gplx.xo
|
||||
import org.junit.*;
|
||||
import gplx.core.net.*; import gplx.xowa.wikis.nss.*;
|
||||
public class Xoh_href_wtr_tst {
|
||||
private final Xoh_href_wtr_fxt fxt = new Xoh_href_wtr_fxt();
|
||||
private final Xoh_href_wtr_fxt fxt = new Xoh_href_wtr_fxt();
|
||||
@Test public void Xwiki_enc() {fxt.Test_build("wikt:abc?d" , "/site/en.wiktionary.org/wiki/abc%3Fd");}
|
||||
@Test public void Page_quote() {fxt.Test_build("a\"b\"c" , "/wiki/A%22b%22c");}
|
||||
@Test public void Page() {fxt.Test_build("abc" , "/wiki/Abc");}
|
||||
@@ -35,16 +35,16 @@ public class Xoh_href_wtr_tst {
|
||||
}
|
||||
}
|
||||
class Xoh_href_wtr_fxt {
|
||||
private final Xowe_wiki wiki;
|
||||
private final Bry_bfr tmp_bfr = Bry_bfr.reset_(255);
|
||||
private final Xoh_href_wtr href_wtr = new Xoh_href_wtr();
|
||||
private final Xowe_wiki wiki;
|
||||
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.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"));
|
||||
}
|
||||
public Xoae_app App() {return app;} private final Xoae_app app;
|
||||
public Xoae_app App() {return app;} private final Xoae_app app;
|
||||
public Xoh_href_wtr_fxt Prep_wiki_cs(String domain) {
|
||||
Xow_wiki wiki = app.Wiki_mgr().Get_by_or_make_init_n(Bry_.new_u8(domain));
|
||||
wiki.Ns_mgr().Ns_main().Case_match_(Xow_ns_case_.Tid__all);
|
||||
|
||||
@@ -21,11 +21,11 @@ import gplx.langs.jsons.*;
|
||||
import gplx.xowa.htmls.js.*;
|
||||
import gplx.xowa.guis.views.*;
|
||||
import gplx.xowa.parsers.*;
|
||||
public class Xoh_js_cbk implements GfoInvkAble {
|
||||
public class Xoh_js_cbk implements Gfo_invk {
|
||||
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();
|
||||
@@ -65,7 +65,7 @@ public class Xoh_js_cbk implements GfoInvkAble {
|
||||
Xowe_wiki wiki = html_itm.Owner_tab().Wiki();
|
||||
try {
|
||||
Xoa_ttl ttl = Xoa_ttl.parse(wiki, m.Args_getAt(0).Val_to_bry());
|
||||
Xoae_page page = wiki.Data_mgr().Get_page(ttl, false);
|
||||
Xoae_page page = wiki.Data_mgr().Load_page_by_ttl(ttl);
|
||||
return String_.new_u8(page.Data_raw());
|
||||
} catch (Exception e) {Err_.Noop(e); return null;}
|
||||
}
|
||||
@@ -187,7 +187,7 @@ public class Xoh_js_cbk implements GfoInvkAble {
|
||||
else if (ctx.Match(k, Invk_xowa_exec_test_as_array)) return Xowa_exec_test_as_array(m);
|
||||
else if (ctx.Match(k, Invk_exec_json)) return app.Html__bridge_mgr().Cmd_mgr().Exec(m);
|
||||
else if (ctx.Match(k, Invk_bldr_exec)) return app.Bldr().Exec_json((String)m.ReadValAt(0));
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
else return Gfo_invk_.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"
|
||||
, 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"
|
||||
|
||||
@@ -40,7 +40,7 @@ class Xoh_js_cbk_fxt {
|
||||
tab.Page_(page);
|
||||
Xoh_js_cbk exec = tab.Html_itm().Js_cbk();
|
||||
GfoMsg msg = GfoMsg_.new_cast_(Xoh_js_cbk.Invk_get_titles_meta).Add("ttl", ttl);
|
||||
String[][] actl = (String[][])GfoInvkAble_.InvkCmd_msg(exec, Xoh_js_cbk.Invk_get_titles_meta, msg);
|
||||
String[][] actl = (String[][])Gfo_invk_.Invk_by_msg(exec, Xoh_js_cbk.Invk_get_titles_meta, msg);
|
||||
Tfds.Eq_ary_str(expd, actl[0]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ public class Xoh_js_cbk_wdata_labels_tst {
|
||||
int args_len = args.length;
|
||||
for (int i = 0; i < args_len; i++)
|
||||
msg.Add("v", args[i]);
|
||||
String[] actl = (String[])GfoInvkAble_.InvkCmd_msg(exec, Xoh_js_cbk.Invk_wikidata_get_label, msg);
|
||||
String[] actl = (String[])Gfo_invk_.Invk_by_msg(exec, Xoh_js_cbk.Invk_wikidata_get_label, msg);
|
||||
Tfds.Eq_ary_str(expd, actl);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,16 +23,16 @@ import gplx.xowa.guis.views.*;
|
||||
import gplx.xowa.htmls.hrefs.*;
|
||||
import gplx.xowa.specials.*;
|
||||
import gplx.xowa.apps.apis.xowa.html.modules.*;
|
||||
public class Xow_popup_mgr implements GfoInvkAble, GfoEvObj {
|
||||
public class Xow_popup_mgr implements Gfo_invk, Gfo_evt_itm {
|
||||
private Xoae_app app; private Xowe_wiki wiki; private Js_wtr js_wtr = new Js_wtr();
|
||||
private int show_init_word_count = Xoapi_popups.Dflt_show_init_word_count, show_more_word_count = Xoapi_popups.Dflt_show_more_word_count;
|
||||
private Xoa_url tmp_url = Xoa_url.blank();
|
||||
private static final Object thread_lock = new Object(); private Xow_popup_itm async_itm; private GfoInvkAble async_cmd_show; private int async_id_next = 1;
|
||||
private static final Object thread_lock = new Object(); private Xow_popup_itm async_itm; private Gfo_invk async_cmd_show; private int async_id_next = 1;
|
||||
public Xow_popup_mgr(Xowe_wiki wiki) {
|
||||
this.wiki = wiki; this.app = wiki.Appe();
|
||||
ev_mgr = GfoEvMgr.new_(this);
|
||||
ev_mgr = new Gfo_evt_mgr(this);
|
||||
}
|
||||
public GfoEvMgr EvMgr() {return ev_mgr;} private GfoEvMgr ev_mgr;
|
||||
public Gfo_evt_mgr Evt_mgr() {return ev_mgr;} private Gfo_evt_mgr ev_mgr;
|
||||
public Xow_popup_parser Parser() {return parser;} private Xow_popup_parser parser = new Xow_popup_parser();
|
||||
public void Init_by_wiki(Xowe_wiki wiki) {
|
||||
parser.Init_by_wiki(wiki);
|
||||
@@ -54,7 +54,7 @@ public class Xow_popup_mgr implements GfoInvkAble, GfoEvObj {
|
||||
parser.Html_mkr().Fmtr_viewed().Fmt_(api_popups.Html_fmtr_viewed());
|
||||
parser.Html_mkr().Fmtr_wiki().Fmt_(api_popups.Html_fmtr_wiki());
|
||||
parser.Html_mkr().Fmtr_next_sect().Fmt_(api_popups.Html_fmtr_next_sect_fmt());
|
||||
GfoEvMgr_.SubSame_many(api_popups, this
|
||||
Gfo_evt_mgr_.Sub_same_many(api_popups, this
|
||||
, Xoapi_popups.Evt_show_init_word_count_changed, Xoapi_popups.Evt_show_more_word_count_changed , Xoapi_popups.Evt_show_all_if_less_than_changed
|
||||
, Xoapi_popups.Evt_scan_len_changed, Xoapi_popups.Evt_scan_max_changed
|
||||
, Xoapi_popups.Evt_read_til_stop_fwd_changed, Xoapi_popups.Evt_read_til_stop_bwd_changed, Xoapi_popups.Evt_stop_if_hdr_after_changed
|
||||
@@ -89,7 +89,7 @@ public class Xow_popup_mgr implements GfoInvkAble, GfoEvObj {
|
||||
if (async_itm != null) async_itm.Cancel();
|
||||
async_itm = new Xow_popup_itm(++async_id_next, href, Bry_.Empty, show_init_word_count);
|
||||
String id_str = async_itm.Popup_id();
|
||||
Thread_adp_.invk_(id_str, this, Invk_show_popup_async).Start();
|
||||
Thread_adp_.Start_by_key(id_str, this, Invk_show_popup_async);
|
||||
return id_str;
|
||||
}
|
||||
}
|
||||
@@ -128,7 +128,7 @@ public class Xow_popup_mgr implements GfoInvkAble, GfoEvObj {
|
||||
case Xow_ns_.Tid__file:
|
||||
return Bry_.Empty; // do not popup for media or file
|
||||
case Xow_ns_.Tid__special:
|
||||
if (!Xows_special_meta_.Itm__popup_history.Match_ttl(popup_ttl)) return Bry_.Empty; // do not popup for special, unless popupHistory; DATE:2015-04-20
|
||||
if (!Xow_special_meta_.Itm__popup_history.Match_ttl(popup_ttl)) return Bry_.Empty; // do not popup for special, unless popupHistory; DATE:2015-04-20
|
||||
break;
|
||||
}
|
||||
if (ns_allowed_regy.Count() > 0 && !ns_allowed_regy.Has(ns_allowed_regy_key.Val_(popup_ttl.Ns().Id()))) return Bry_.Empty;
|
||||
@@ -137,7 +137,7 @@ public class Xow_popup_mgr implements GfoInvkAble, GfoEvObj {
|
||||
while (gplx.xowa.guis.views.Load_page_wkr.Running() && ++wait_count < 100) {
|
||||
Thread_adp_.Sleep(10);
|
||||
}
|
||||
Xoae_page popup_page = popup_wiki.Data_mgr().Get_page(popup_ttl, false);
|
||||
Xoae_page popup_page = popup_wiki.Data_mgr().Load_page_by_ttl(popup_ttl);
|
||||
byte[] rv = popup_wiki.Html_mgr().Head_mgr().Popup_mgr().Parser().Parse(wiki, popup_page, cur_page.Tab_data().Tab(), itm);
|
||||
Update_progress_bar(app, cur_wiki, cur_page, itm);
|
||||
return rv;
|
||||
@@ -170,7 +170,7 @@ public class Xow_popup_mgr implements GfoInvkAble, GfoEvObj {
|
||||
}
|
||||
if (async_cmd_show == null)
|
||||
async_cmd_show = app.Gui_mgr().Kit().New_cmd_sync(this);
|
||||
GfoInvkAble_.InvkCmd(async_cmd_show, Invk_show_popup);
|
||||
Gfo_invk_.Invk_by_key(async_cmd_show, Invk_show_popup);
|
||||
}
|
||||
catch(Exception e) {
|
||||
app.Usr_dlg().Warn_many("", "", "failed to get popup: href=~{0} err=~{1}", async_itm.Page_href(), Err_.Message_gplx_full(e));
|
||||
@@ -190,7 +190,7 @@ public class Xow_popup_mgr implements GfoInvkAble, GfoEvObj {
|
||||
}
|
||||
}
|
||||
public static Int_obj_ref[] Ns_allowed_parse(Xowe_wiki wiki, byte[] raw) {
|
||||
List_adp rv = List_adp_.new_();
|
||||
List_adp rv = List_adp_.New();
|
||||
byte[][] ary = Bry_split_.Split(raw, Byte_ascii.Pipe);
|
||||
int ary_len = ary.length;
|
||||
Xow_ns_mgr ns_mgr = wiki.Ns_mgr();
|
||||
@@ -205,11 +205,11 @@ public class Xow_popup_mgr implements GfoInvkAble, GfoEvObj {
|
||||
wiki.Appe().Usr_dlg().Log_many("", "", "popup.ns_allowed: ns not in wiki: ns=~{0} wiki=~{1}", String_.new_u8(bry), wiki.Domain_str()); // ns may not be in wiki; EX: Portal and www.wikidata.org
|
||||
continue;
|
||||
}
|
||||
Int_obj_ref ns_id_itm = Int_obj_ref.new_(ns.Id());
|
||||
Int_obj_ref ns_id_itm = Int_obj_ref.New(ns.Id());
|
||||
rv.Add(ns_id_itm);
|
||||
}
|
||||
return (Int_obj_ref[])rv.To_ary(Int_obj_ref.class);
|
||||
} private Hash_adp ns_allowed_regy = Hash_adp_.new_(); private Int_obj_ref ns_allowed_regy_key = Int_obj_ref.zero_();
|
||||
} private Hash_adp ns_allowed_regy = Hash_adp_.New(); private Int_obj_ref ns_allowed_regy_key = Int_obj_ref.New_zero();
|
||||
private Xoae_page Cur_page() {return app.Gui_mgr().Browser_win().Active_page();}
|
||||
private Xowe_wiki Cur_wiki() {return app.Gui_mgr().Browser_win().Active_tab().Wiki();}
|
||||
private Xow_popup_itm Itms_get_or_null(Xoae_page page, String popup_id) {return (Xow_popup_itm)page.Popup_mgr().Itms().Get_by(popup_id);}
|
||||
@@ -232,15 +232,15 @@ public class Xow_popup_mgr implements GfoInvkAble, GfoEvObj {
|
||||
else if (ctx.Match(k, Xoapi_popups.Evt_html_fmtr_viewed_changed)) parser.Html_mkr().Fmtr_viewed().Fmt_(m.ReadBry("v"));
|
||||
else if (ctx.Match(k, Xoapi_popups.Evt_html_fmtr_wiki_changed)) parser.Html_mkr().Fmtr_wiki().Fmt_(m.ReadBry("v"));
|
||||
else if (ctx.Match(k, Xoapi_popups.Evt_html_fmtr_next_sect_changed)) parser.Html_mkr().Fmtr_next_sect().Fmt_(m.ReadBry("v"));
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
}
|
||||
public static final String Invk_show_popup_async = "show_popup_async", Invk_show_popup = "show_popup";
|
||||
private static final String
|
||||
private static final String
|
||||
Cbk_xowa_popups_show_update = "xowa_popups_show_update"
|
||||
, Cbk_xowa_popups_show_create = "xowa_popups_show_create"
|
||||
;
|
||||
private static final byte[]
|
||||
private static final byte[]
|
||||
Mode_show_more = Bry_.new_a7("more")
|
||||
, Mode_show_all = Bry_.new_a7("all")
|
||||
;
|
||||
@@ -258,17 +258,17 @@ class Xow_popup_mgr_ {
|
||||
class Load_popup_wkr implements Gfo_thread_wkr {
|
||||
private Xow_popup_itm itm; private Xoae_page cur_page; private Xoa_url tmp_url;
|
||||
private Hash_adp ns_allowed_regy;
|
||||
private Int_obj_ref ns_allowed_regy_key = Int_obj_ref.zero_();
|
||||
private Int_obj_ref ns_allowed_regy_key = Int_obj_ref.New_zero();
|
||||
public Load_popup_wkr(Xowe_wiki wiki, Xoae_page cur_page, Xow_popup_itm itm, Xoa_url tmp_url, Hash_adp ns_allowed_regy, Int_obj_ref ns_allowed_regy_key) {
|
||||
this.wiki = wiki; this.cur_page = cur_page; this.itm = itm; this.tmp_url = tmp_url; this.ns_allowed_regy = ns_allowed_regy; this.ns_allowed_regy_key = ns_allowed_regy_key;
|
||||
}
|
||||
public String Name() {return "xowa.load_popup_wkr";}
|
||||
public boolean Resume() {return false;}
|
||||
public String Thread__name() {return "xowa.load_popup_wkr";}
|
||||
public boolean Thread__resume() {return false;}
|
||||
public Xowe_wiki Wiki() {return wiki;} private Xowe_wiki wiki;
|
||||
public byte[] Rslt_bry() {return rslt_bry;} private byte[] rslt_bry;
|
||||
public boolean Rslt_done() {return rslt_done;} private boolean rslt_done;
|
||||
public void Rslt_(byte[] bry) {this.rslt_done = true; rslt_bry = bry;}
|
||||
public void Exec() {
|
||||
public void Thread__exec() {
|
||||
Xoae_app app = wiki.Appe();
|
||||
try {
|
||||
if (itm.Canceled()) return;
|
||||
@@ -283,12 +283,12 @@ class Load_popup_wkr implements Gfo_thread_wkr {
|
||||
case Xow_ns_.Tid__file:
|
||||
return; // do not popup for media or file
|
||||
case Xow_ns_.Tid__special:
|
||||
if (!Xows_special_meta_.Itm__popup_history.Match_ttl(popup_ttl)) return; // do not popup for special, unless popupHistory; DATE:2015-04-20
|
||||
if (!Xow_special_meta_.Itm__popup_history.Match_ttl(popup_ttl)) return; // do not popup for special, unless popupHistory; DATE:2015-04-20
|
||||
break;
|
||||
}
|
||||
if (ns_allowed_regy.Count() > 0 && !ns_allowed_regy.Has(ns_allowed_regy_key.Val_(popup_ttl.Ns().Id()))) return;
|
||||
itm.Init(popup_wiki.Domain_bry(), popup_ttl);
|
||||
Xoae_page popup_page = popup_wiki.Data_mgr().Get_page(popup_ttl, false);
|
||||
Xoae_page popup_page = popup_wiki.Data_mgr().Load_page_by_ttl(popup_ttl);
|
||||
byte[] rv = popup_wiki.Html_mgr().Head_mgr().Popup_mgr().Parser().Parse(wiki, popup_page, cur_page.Tab_data().Tab(), itm);
|
||||
Xow_popup_mgr.Update_progress_bar(app, wiki, cur_page, itm);
|
||||
Rslt_(rv);
|
||||
|
||||
@@ -24,8 +24,8 @@ public class Xow_popup_parser_data {
|
||||
public int Words_needed_max() {return words_needed_max;} private int words_needed_max;
|
||||
private int words_needed_min;
|
||||
public int Words_found() {return words_found;} private int words_found;
|
||||
public Bry_bfr Wrdx_bfr() {return wrdx_bfr;} private Bry_bfr wrdx_bfr = Bry_bfr.reset_(255);
|
||||
public Xow_popup_word[] Words_found_ary() {return (Xow_popup_word[])words_found_list.To_ary_and_clear(Xow_popup_word.class);} private List_adp words_found_list = List_adp_.new_();
|
||||
public Bry_bfr Wrdx_bfr() {return wrdx_bfr;} private Bry_bfr wrdx_bfr = Bry_bfr_.Reset(255);
|
||||
public Xow_popup_word[] Words_found_ary() {return (Xow_popup_word[])words_found_list.To_ary_and_clear(Xow_popup_word.class);} private List_adp words_found_list = List_adp_.New();
|
||||
public int Tmpl_loop_count() {return tmpl_loop_count;} private int tmpl_loop_count;
|
||||
public void Tmpl_loop_count_add() {++tmpl_loop_count;}
|
||||
private Xow_popup_itm popup_itm;
|
||||
|
||||
@@ -493,9 +493,16 @@ class Xop_popup_parser_fxt {
|
||||
public Xop_popup_parser_fxt Expd_tmpl_loop_count(int expd) {Tfds.Eq(expd, parser.Data().Tmpl_loop_count()); return this;}
|
||||
public Xop_popup_parser_fxt Test_ns_allowed(String raw, int... expd) {
|
||||
Int_obj_ref[] ids = Xow_popup_mgr.Ns_allowed_parse(wiki, Bry_.new_u8(raw));
|
||||
Tfds.Eq_ary(expd, Int_obj_ref.Ary_xto_int_ary(ids));
|
||||
Tfds.Eq_ary(expd, To_int_ary(ids));
|
||||
return this;
|
||||
}
|
||||
private static int[] To_int_ary(Int_obj_ref[] ary) {
|
||||
int len = ary.length;
|
||||
int[] rv = new int[len];
|
||||
for (int i = 0; i < len; ++i)
|
||||
rv[i] = ary[i].Val();
|
||||
return rv;
|
||||
}
|
||||
public void Test_parse(String raw, String expd) {Test_parse(raw, "Test_1", expd);}
|
||||
public void Test_parse(String raw, String ttl, String expd) {
|
||||
Xoae_page page = Xoae_page.New_edit(wiki, Xoa_ttl.parse(wiki, Bry_.new_a7(ttl)));
|
||||
@@ -506,7 +513,7 @@ class Xop_popup_parser_fxt {
|
||||
Tfds.Eq_str_lines(expd, String_.new_u8(actl));
|
||||
}
|
||||
public void Test_Assert_at_end(String raw, String expd) {
|
||||
if (test_bfr == null) test_bfr = Bry_bfr.new_();
|
||||
if (test_bfr == null) test_bfr = Bry_bfr_.New();
|
||||
test_bfr.Clear().Add_str_u8(raw);
|
||||
Bry_bfr_.Assert_at_end(test_bfr, Byte_ascii.Nl);
|
||||
Tfds.Eq(expd, test_bfr.To_str_and_clear());
|
||||
|
||||
@@ -24,7 +24,7 @@ public class Xop_keeplist_wiki {
|
||||
public boolean Enabled() {return enabled;} public void Enabled_(boolean v) {enabled = v;} private boolean enabled = false; // NOTE: default to false, b/c wikis that are not listed in cfg will not call Rules_seal
|
||||
public Xop_keeplist_rule[] Rules() {return rules;} private Xop_keeplist_rule[] rules; private int rules_len;
|
||||
public Xop_keeplist_wiki_srl Srl() {return srl;} private Xop_keeplist_wiki_srl srl;
|
||||
public void Rules_add(Xop_keeplist_rule rule) {rules_list.Add(rule);} private List_adp rules_list = List_adp_.new_();
|
||||
public void Rules_add(Xop_keeplist_rule rule) {rules_list.Add(rule);} private List_adp rules_list = List_adp_.New();
|
||||
public void Rules_seal() {
|
||||
this.rules = (Xop_keeplist_rule[])rules_list.To_ary_and_clear(Xop_keeplist_rule.class);
|
||||
this.rules_len = rules.length;
|
||||
|
||||
@@ -22,7 +22,7 @@ import gplx.xowa.files.*; import gplx.xowa.files.repos.*; import gplx.xowa.files
|
||||
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 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();
|
||||
|
||||
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.htmls.ns_files; import gplx.*; import gplx.xowa.*; import gplx.xowa.htmls.*;
|
||||
import org.junit.*; import gplx.xowa.files.*;
|
||||
public class Xoh_ns_file_page_mgr_tst {
|
||||
private final Xoh_ns_file_page_mgr_fxt fxt = new Xoh_ns_file_page_mgr_fxt();
|
||||
private final Xoh_ns_file_page_mgr_fxt fxt = new Xoh_ns_file_page_mgr_fxt();
|
||||
@Before public void init() {fxt.Reset();}
|
||||
@Test public void Image() {
|
||||
fxt.Ttl_str_("Test.png").Html_src_("mem/file/cur.png").Html_orig_src_("mem/file/orig.png").Html_w_(300).Html_h_(200).Html_file_size_(100)
|
||||
@@ -78,9 +78,9 @@ public class Xoh_ns_file_page_mgr_tst {
|
||||
}
|
||||
}
|
||||
class Xoh_ns_file_page_mgr_fxt {
|
||||
private final Xoh_ns_file_page_mgr wkr = new Xoh_ns_file_page_mgr();
|
||||
private final Xoh_ns_file_page_mgr wkr = new Xoh_ns_file_page_mgr();
|
||||
private Xoae_app app; private Xowe_wiki wiki; private Xoh_file_page_wtr opt;
|
||||
private final Xof_file_itm file = new Xof_fsdb_itm(); private final Bry_bfr bfr = Bry_bfr.new_();
|
||||
private final Xof_file_itm file = new Xof_fsdb_itm(); private final Bry_bfr bfr = Bry_bfr_.New();
|
||||
public Xoh_ns_file_page_mgr_fxt Ttl_str_(String v) {this.ttl_str = v; return this;} private String ttl_str;
|
||||
public Xoh_ns_file_page_mgr_fxt Html_src_(String v) {this.html_src = v; return this;} private String html_src;
|
||||
public Xoh_ns_file_page_mgr_fxt Html_orig_src_(String v) {this.html_orig_src = v; return this;} private String html_orig_src;
|
||||
@@ -102,8 +102,8 @@ class Xoh_ns_file_page_mgr_fxt {
|
||||
file.Init_at_hdoc(0, Xof_html_elem.Tid_img);
|
||||
wkr.Bld_html(wiki, bfr, file, ttl, opt, Bry_.To_a7_bry(html_file_size, 0), play_btn_icon); // TEST: must pass in elem_val b/c test only uses 2nd Bld_html while app uses 1st
|
||||
Tfds.Eq_str_lines(expd, bfr.To_str_and_clear());
|
||||
} static final byte[] play_btn_icon = Bry_.new_a7("file:///mem/xowa/bin/any/xowa/file/mediawiki.file/play.png");
|
||||
public static final String Hdr = String_.Concat_lines_nl_skip_last
|
||||
} static final byte[] play_btn_icon = Bry_.new_a7("file:///mem/xowa/bin/any/xowa/file/mediawiki.file/play.png");
|
||||
public static final String Hdr = String_.Concat_lines_nl_skip_last
|
||||
( "<ul id=\"filetoc\">"
|
||||
, " <li>"
|
||||
, " <a href=\"#file\">"
|
||||
|
||||
@@ -19,13 +19,13 @@ package gplx.xowa.htmls.portal; import gplx.*; import gplx.xowa.*; import gplx.x
|
||||
import gplx.core.brys.fmtrs.*;
|
||||
import gplx.xowa.wikis.domains.*; import gplx.xowa.wikis.xwikis.*;
|
||||
import gplx.xowa.files.xfers.*;
|
||||
public class Xoa_available_wikis_mgr implements GfoInvkAble {
|
||||
public class Xoa_available_wikis_mgr implements Gfo_invk {
|
||||
private Bry_fmtr itms_as_html_fmtr = Bry_fmtr.new_("\n <li><a href=\"/site/~{domain}/\"~{itm_cls}>~{domain}</a></li>", "domain", "itm_cls");
|
||||
public Xoa_available_wikis_mgr(Xoae_app app) {this.app = app;} private Xoae_app app;
|
||||
public String Itms_as_html() {
|
||||
if (itms_as_html == null) {
|
||||
String itm_cls = app.Api_root().Html().Modules().Popups().Enabled() ? " class='xowa-hover-off'" : "";
|
||||
Bry_bfr tmp_bfr = Bry_bfr.new_(); // NOTE: do not use app.Utl__bfr_mkr().Get_k004() as it is being used simultaneously by another caller; TODO: find call
|
||||
Bry_bfr tmp_bfr = Bry_bfr_.New(); // NOTE: do not use app.Utl__bfr_mkr().Get_k004() as it is being used simultaneously by another caller; TODO_OLD: find call
|
||||
Xow_xwiki_mgr xwiki_mgr = app.Usere().Wiki().Xwiki_mgr();
|
||||
xwiki_mgr.Sort_by_key();
|
||||
int len = xwiki_mgr.Len();
|
||||
@@ -48,7 +48,7 @@ public class Xoa_available_wikis_mgr implements GfoInvkAble {
|
||||
else if (ctx.Match(k, Invk_visible_)) visible = m.ReadYn("v");
|
||||
else if (ctx.Match(k, Invk_visible_toggle)) {visible = !visible; app.Gui_mgr().Browser_win().Active_html_box().Html_js_eval_proc_as_str("xowa-portal-wikis-visible-toggle", Bool_.To_str_lower(visible));}
|
||||
else if (ctx.Match(k, Invk_itms_as_html_fmtr_)) itms_as_html_fmtr.Fmt_(m.ReadBry("v"));
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
} private static final String Invk_visible = "visible", Invk_visible_ = "visible_", Invk_visible_toggle = "visible_toggle", Invk_itms_as_html = "itms_as_html", Invk_itms_as_html_fmtr_ = "itms_as_html_fmtr_", Invk_itms_refresh = "itms_refresh";
|
||||
}
|
||||
|
||||
@@ -16,11 +16,11 @@ 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.portal; import gplx.*; import gplx.xowa.*; import gplx.xowa.htmls.*;
|
||||
public class Xoa_portal_mgr implements GfoInvkAble {
|
||||
public class Xoa_portal_mgr implements Gfo_invk {
|
||||
public Xoa_portal_mgr(Xoae_app app) {wikis = new Xoa_available_wikis_mgr(app);}
|
||||
public Xoa_available_wikis_mgr Wikis() {return wikis;} private Xoa_available_wikis_mgr wikis;
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_wikis)) return wikis;
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
} private static final String Invk_wikis = "wikis";
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ public class Xoh_page_body_cls { // REF.MW:Skin.php|getPageClasses
|
||||
break;
|
||||
case Byte_ascii.Underline:
|
||||
if (trg_bfr == null) {
|
||||
trg_bfr = Bry_bfr.new_(src_len);
|
||||
trg_bfr = Bry_bfr_.New_w_size(src_len);
|
||||
trg_bfr.Add_mid(src, 0, i);
|
||||
}
|
||||
if (bgn != -1) {
|
||||
@@ -99,7 +99,7 @@ public class Xoh_page_body_cls { // REF.MW:Skin.php|getPageClasses
|
||||
int next = i + 1;
|
||||
if (next < src_len && src[next] == -96) {
|
||||
if (trg_bfr == null) {
|
||||
trg_bfr = Bry_bfr.new_(src_len);
|
||||
trg_bfr = Bry_bfr_.New_w_size(src_len);
|
||||
trg_bfr.Add_mid(src, 0, i);
|
||||
}
|
||||
trg_bfr.Add_byte(Byte_ascii.Underline);
|
||||
@@ -118,7 +118,7 @@ public class Xoh_page_body_cls { // REF.MW:Skin.php|getPageClasses
|
||||
if (bgn != -1) trg_bfr.Add_mid(src, bgn, src_len);
|
||||
return trg_bfr == null ? src : trg_bfr.To_bry_and_clear();
|
||||
}
|
||||
private static final byte[]
|
||||
private static final byte[]
|
||||
Bry_id_prefix = Bry_.new_a7("ns-")
|
||||
, Bry_type_special = Bry_.new_a7("ns-special")
|
||||
, Bry_type_talk = Bry_.new_a7("ns-talk")
|
||||
|
||||
@@ -45,7 +45,7 @@ class Xoh_page_body_cls_fxt {
|
||||
if (app == null) {
|
||||
app = Xoa_app_fxt.Make__app__edit();
|
||||
wiki = Xoa_app_fxt.Make__wiki__edit(app);
|
||||
tmp_bfr = Bry_bfr.reset_(255);
|
||||
tmp_bfr = Bry_bfr_.Reset(255);
|
||||
wiki.Ns_mgr().Add_new(Wdata_wiki_mgr.Ns_property, Wdata_wiki_mgr.Ns_property_name);
|
||||
}
|
||||
Xoa_ttl ttl = Xoa_ttl.parse(wiki, Bry_.new_u8(ttl_str));
|
||||
|
||||
@@ -17,8 +17,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.htmls.portal; import gplx.*; import gplx.xowa.*; import gplx.xowa.htmls.*;
|
||||
public class Xoh_rtl_utl {
|
||||
private static final int[] tmp_ary = new int[32]; // support no more than 16 items
|
||||
private static Bry_bfr bfr = Bry_bfr.reset_(32);
|
||||
private static final int[] tmp_ary = new int[32]; // support no more than 16 items
|
||||
private static Bry_bfr bfr = Bry_bfr_.Reset(32);
|
||||
public static byte[] Reverse_li(byte[] src) {
|
||||
int src_len = src.length;
|
||||
int pos = 0;
|
||||
@@ -64,7 +64,7 @@ public class Xoh_rtl_utl {
|
||||
}
|
||||
bfr.Add_mid(src, li_n_end, ul_end); // add from nth "</li>" -> "</ul>"
|
||||
}
|
||||
private static final byte[]
|
||||
private static final byte[]
|
||||
Ul_bgn = Bry_.new_a7("<ul")
|
||||
, Ul_end = Bry_.new_a7("</ul>")
|
||||
, Li_bgn = Bry_.new_a7("<li")
|
||||
|
||||
@@ -20,7 +20,7 @@ import gplx.core.brys.fmtrs.*;
|
||||
import gplx.xowa.htmls.hrefs.*;
|
||||
import gplx.xowa.wikis.nss.*;
|
||||
public class Xoh_subpages_bldr implements gplx.core.brys.Bfr_arg {
|
||||
private Bry_bfr tmp_bfr = Bry_bfr.reset_(255), ttl_bfr = Bry_bfr.reset_(255);
|
||||
private Bry_bfr tmp_bfr = Bry_bfr_.Reset(255), ttl_bfr = Bry_bfr_.Reset(255);
|
||||
private byte[][] segs;
|
||||
public byte[] Bld(Xow_ns_mgr ns_mgr, Xoa_ttl ttl) {
|
||||
Xow_ns ns = ttl.Ns();
|
||||
@@ -53,8 +53,8 @@ public class Xoh_subpages_bldr implements gplx.core.brys.Bfr_arg {
|
||||
}
|
||||
ttl_bfr.Clear();
|
||||
}
|
||||
private static final byte[] Dlm_1st = Bry_.new_a7("< "), Dlm_nth = Bry_.new_a7("‎ | ");
|
||||
private static final Bry_fmtr
|
||||
private static final byte[] Dlm_1st = Bry_.new_a7("< "), Dlm_nth = Bry_.new_a7("‎ | ");
|
||||
private static final Bry_fmtr
|
||||
fmtr_grp = Bry_fmtr.new_(String_.Concat_lines_nl_skip_last
|
||||
( "<span class=\"subpages\">~{itms}"
|
||||
, "</span>"
|
||||
|
||||
@@ -24,9 +24,9 @@ import gplx.xowa.wikis.domains.*;
|
||||
import gplx.xowa.htmls.hrefs.*;
|
||||
import gplx.xowa.apps.apis.xowa.html.*; import gplx.xowa.apps.apis.xowa.html.skins.*;
|
||||
import gplx.xowa.langs.vnts.*; import gplx.xowa.htmls.portal.vnts.*;
|
||||
public class Xow_portal_mgr implements GfoInvkAble {
|
||||
public class Xow_portal_mgr implements Gfo_invk {
|
||||
private Xowe_wiki wiki; private boolean lang_is_rtl; private Xoapi_toggle_itm toggle_itm;
|
||||
private final Vnt_mnu_grp_fmtr vnt_menu_fmtr = new Vnt_mnu_grp_fmtr();
|
||||
private final Vnt_mnu_grp_fmtr vnt_menu_fmtr = new Vnt_mnu_grp_fmtr();
|
||||
public Xow_portal_mgr(Xowe_wiki wiki) {
|
||||
this.wiki = wiki;
|
||||
this.sidebar_mgr = new Xowh_sidebar_mgr(wiki);
|
||||
@@ -102,7 +102,7 @@ public class Xow_portal_mgr implements GfoInvkAble {
|
||||
}
|
||||
div_view_fmtr.Bld_bfr_many(tmp_bfr, read_cls, edit_cls, html_cls, search_text);
|
||||
return tmp_bfr.To_bry_and_rls();
|
||||
} public static final byte[] Cls_selected_y = Bry_.new_a7("selected"), Cls_new = Bry_.new_a7("new"), Cls_display_none = Bry_.new_a7("xowa_display_none");
|
||||
} public static final byte[] Cls_selected_y = Bry_.new_a7("selected"), Cls_new = Bry_.new_a7("new"), Cls_display_none = Bry_.new_a7("xowa_display_none");
|
||||
public byte[] Div_logo_bry() {return div_logo_bry;} private byte[] div_logo_bry = Bry_.Empty;
|
||||
public byte[] Div_home_bry() {return api_skin != null && api_skin.Sidebar_home_enabled() ? div_home_bry : Bry_.Empty;} private byte[] div_home_bry = Bry_.Empty;
|
||||
public byte[] Div_wikis_bry(Bry_bfr_mkr bfr_mkr) {
|
||||
@@ -113,11 +113,11 @@ public class Xow_portal_mgr implements GfoInvkAble {
|
||||
return tmp_bfr.To_bry_and_rls();
|
||||
}
|
||||
public byte[] Missing_ns_cls() {return missing_ns_cls;} public Xow_portal_mgr Missing_ns_cls_(byte[] v) {missing_ns_cls = v; return this;} private byte[] missing_ns_cls; // NOTE: must be null due to Init check above
|
||||
private final Bry_fmtr div_personal_fmtr = Bry_fmtr.new_("~{portal_personal_subj_href};~{portal_personal_subj_text};~{portal_personal_talk_cls};~{portal_personal_talk_href};~{portal_personal_talk_cls};", "portal_personal_subj_href", "portal_personal_subj_text", "portal_personal_subj_cls", "portal_personal_talk_href", "portal_personal_talk_cls");
|
||||
private final Bry_fmtr div_ns_fmtr = Bry_fmtr.new_("~{portal_ns_subj_href};~{portal_ns_subj_cls};~{portal_ns_talk_href};~{portal_ns_talk_cls};~{portal_div_vnts}", "portal_ns_subj_href", "portal_ns_subj_cls", "portal_ns_talk_href", "portal_ns_talk_cls", "portal_div_vnts");
|
||||
private final Bry_fmtr div_view_fmtr = Bry_fmtr.new_("", "portal_view_read_cls", "portal_view_edit_cls", "portal_view_html_cls", "search_text");
|
||||
private final Bry_fmtr div_logo_fmtr = Bry_fmtr.new_("", "portal_nav_main_href", "portal_logo_url");
|
||||
private final Bry_fmtr div_wikis_fmtr = Bry_fmtr.new_("", "toggle_btn", "toggle_hdr");
|
||||
private final Bry_fmtr div_personal_fmtr = Bry_fmtr.new_("~{portal_personal_subj_href};~{portal_personal_subj_text};~{portal_personal_talk_cls};~{portal_personal_talk_href};~{portal_personal_talk_cls};", "portal_personal_subj_href", "portal_personal_subj_text", "portal_personal_subj_cls", "portal_personal_talk_href", "portal_personal_talk_cls");
|
||||
private final Bry_fmtr div_ns_fmtr = Bry_fmtr.new_("~{portal_ns_subj_href};~{portal_ns_subj_cls};~{portal_ns_talk_href};~{portal_ns_talk_cls};~{portal_div_vnts}", "portal_ns_subj_href", "portal_ns_subj_cls", "portal_ns_talk_href", "portal_ns_talk_cls", "portal_div_vnts");
|
||||
private final Bry_fmtr div_view_fmtr = Bry_fmtr.new_("", "portal_view_read_cls", "portal_view_edit_cls", "portal_view_html_cls", "search_text");
|
||||
private final Bry_fmtr div_logo_fmtr = Bry_fmtr.new_("", "portal_nav_main_href", "portal_logo_url");
|
||||
private final Bry_fmtr div_wikis_fmtr = Bry_fmtr.new_("", "toggle_btn", "toggle_hdr");
|
||||
private byte[] Reverse_li(byte[] bry) {
|
||||
return lang_is_rtl ? Xoh_rtl_utl.Reverse_li(bry) : bry;
|
||||
}
|
||||
@@ -131,7 +131,7 @@ public class Xow_portal_mgr implements GfoInvkAble {
|
||||
else if (ctx.Match(k, Invk_missing_ns_cls)) return String_.new_u8(missing_ns_cls);
|
||||
else if (ctx.Match(k, Invk_missing_ns_cls_)) missing_ns_cls = m.ReadBry("v");
|
||||
else if (ctx.Match(k, Invk_missing_ns_cls_list)) return Options_missing_ns_cls_list;
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
}
|
||||
private static final String Invk_div_personal_ = "div_personal_", Invk_div_view_ = "div_view_", Invk_div_ns_ = "div_ns_", Invk_div_home_ = "div_home_", Invk_div_wikis_ = "div_wikis_"
|
||||
@@ -139,8 +139,8 @@ public class Xow_portal_mgr implements GfoInvkAble {
|
||||
;
|
||||
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 final byte[] Missing_ns_cls_hide = Bry_.new_a7("xowa_display_none");
|
||||
private static final Bry_fmtr Div_jump_to_fmtr = Bry_fmtr.new_
|
||||
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>"
|
||||
, "jumpto", "jumptonavigation", "comma-separator", "jumptosearch");
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.htmls.portal.vnts; import gplx.*; import gplx.xowa.*; import gplx.xowa.htmls.*; import gplx.xowa.htmls.portal.*;
|
||||
import org.junit.*; import gplx.xowa.langs.vnts.*;
|
||||
public class Vnt_mnu_grp_fmtr_tst {
|
||||
@Before public void init() {fxt.Clear();} private final Vnt_mnu_grp_fmtr_fxt fxt = new Vnt_mnu_grp_fmtr_fxt();
|
||||
@Before public void init() {fxt.Clear();} private final Vnt_mnu_grp_fmtr_fxt fxt = new Vnt_mnu_grp_fmtr_fxt();
|
||||
@Test public void Basic() {
|
||||
// fxt.Test_to_str("Earth", "zh-hk", String_.Concat_lines_nl_skip_last
|
||||
// ( ""
|
||||
@@ -40,7 +40,7 @@ public class Vnt_mnu_grp_fmtr_tst {
|
||||
}
|
||||
}
|
||||
class Vnt_mnu_grp_fmtr_fxt {
|
||||
private final Xol_vnt_regy mgr = new Xol_vnt_regy();
|
||||
private final Xol_vnt_regy mgr = new Xol_vnt_regy();
|
||||
public void Clear() {
|
||||
this.Init_grp("Choose lang", "zh-hans", "Simplified", "zh-hant", "Traditional", "zh-cn", "China", "zh-hk", "Hong Kong", "zh-mo", "Macau", "zh-sg", "Singapore", "zh-tw", "Taiwan");
|
||||
}
|
||||
@@ -59,7 +59,7 @@ class Vnt_mnu_grp_fmtr_fxt {
|
||||
}
|
||||
public void Test_to_str(String page_href, String selected_vnt, String expd) {
|
||||
Vnt_mnu_grp_fmtr vnt_grp_fmtr = new Vnt_mnu_grp_fmtr();
|
||||
Bry_bfr bfr = Bry_bfr.new_();
|
||||
Bry_bfr bfr = Bry_bfr_.New();
|
||||
vnt_grp_fmtr.Init(mgr, Bry_.new_u8(page_href), Bry_.new_a7("zh.wikipedia.org"), Bry_.new_u8(selected_vnt));
|
||||
vnt_grp_fmtr.Bfr_arg__add(bfr);
|
||||
Tfds.Eq_str_lines(expd, bfr.To_str_and_clear());
|
||||
|
||||
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.htmls.sections; import gplx.*; import gplx.xowa.*; import gplx.xowa.htmls.*;
|
||||
public class Xoh_section_mgr {
|
||||
private final List_adp list = List_adp_.new_();
|
||||
private final List_adp list = List_adp_.New();
|
||||
public void Clear() {list.Clear();}
|
||||
public int Len() {return list.Count();}
|
||||
public Xoh_section_itm Get_at(int i) {return (Xoh_section_itm)list.Get_at(i);}
|
||||
|
||||
@@ -26,7 +26,7 @@ public class Xowh_sidebar_itm {
|
||||
public byte[] Accesskey() {return accesskey;} public Xowh_sidebar_itm Accesskey_(byte[] v) {accesskey = v; return this;} private byte[] accesskey;
|
||||
public byte[] Atr_accesskey_and_title() {return atr_accesskey_and_title;} public Xowh_sidebar_itm Atr_accesskey_and_title_(byte[] v) {atr_accesskey_and_title = v; return this;} private byte[] atr_accesskey_and_title = Bry_.Empty;
|
||||
public byte[] Text() {return text;} public Xowh_sidebar_itm Text_(byte[] v) {text = v; return this;} private byte[] text;
|
||||
public int Itms_len() {return itms.Count();} List_adp itms = List_adp_.new_();
|
||||
public int Itms_len() {return itms.Count();} List_adp itms = List_adp_.New();
|
||||
public Xowh_sidebar_itm Itms_get_at(int i) {return (Xowh_sidebar_itm)itms.Get_at(i);}
|
||||
public Xowh_sidebar_itm Itms_add(Xowh_sidebar_itm... ary) {
|
||||
int ary_len = ary.length;
|
||||
@@ -34,7 +34,7 @@ public class Xowh_sidebar_itm {
|
||||
itms.Add(ary[i]);
|
||||
return this;
|
||||
}
|
||||
public static final byte Tid_grp = 1, Tid_itm = 2; // NOTE: values are used by parse to indicate # of asterisks
|
||||
public static final byte Tid_grp = 1, Tid_itm = 2; // NOTE: values are used by parse to indicate # of asterisks
|
||||
}
|
||||
class Xowh_sidebar_grp_fmtr_arg implements gplx.core.brys.Bfr_arg {
|
||||
private Xowe_wiki wiki; private Xowh_sidebar_itm grp; private Bry_fmtr fmtr;
|
||||
|
||||
@@ -19,9 +19,9 @@ package gplx.xowa.htmls.sidebar; import gplx.*; import gplx.xowa.*; import gplx.
|
||||
import gplx.core.btries.*; import gplx.core.brys.fmtrs.*; import gplx.langs.htmls.encoders.*;
|
||||
import gplx.xowa.langs.*; import gplx.xowa.langs.msgs.*;
|
||||
import gplx.xowa.parsers.lnkis.*;
|
||||
public class Xowh_sidebar_mgr implements GfoInvkAble {
|
||||
public class Xowh_sidebar_mgr implements Gfo_invk {
|
||||
public Xowh_sidebar_mgr(Xowe_wiki wiki) {this.wiki = wiki;} private Xowe_wiki wiki;
|
||||
public int Grps_len() {return grps.Count();} List_adp grps = List_adp_.new_();
|
||||
public int Grps_len() {return grps.Count();} List_adp grps = List_adp_.New();
|
||||
public Xowh_sidebar_itm Grps_get_at(int i) {return (Xowh_sidebar_itm)grps.Get_at(i);}
|
||||
public byte[] Html_bry() {return html_bry;} private byte[] html_bry;
|
||||
public void Init() {
|
||||
@@ -122,17 +122,17 @@ public class Xowh_sidebar_mgr implements GfoInvkAble {
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_html_grp_fmt_)) html_grp_fmtr.Fmt_(m.ReadBry("v"));
|
||||
else if (ctx.Match(k, Invk_html_itm_fmt_)) html_itm_fmtr.Fmt_(m.ReadBry("v"));
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
} private static final String Invk_html_grp_fmt_ = "html_grp_fmt_", Invk_html_itm_fmt_ = "html_itm_fmt_";
|
||||
private static final byte[] CONST_id_prefix = Bry_.new_a7("n-");
|
||||
private static final byte[] CONST_id_prefix = Bry_.new_a7("n-");
|
||||
private static final byte Ignore_tid_search = 1, Ignore_tid_toolbox = 2, Ignore_tid_toolbox_end = 3, Ignore_tid_languages = 4;
|
||||
private static final Btrie_slim_mgr ignore_trie = Btrie_slim_mgr.ci_a7()
|
||||
private static final Btrie_slim_mgr ignore_trie = Btrie_slim_mgr.ci_a7()
|
||||
.Add_str_byte("SEARCH", Ignore_tid_search)
|
||||
.Add_str_byte("TOOLBOX", Ignore_tid_toolbox)
|
||||
.Add_str_byte("TOOLBOXEND", Ignore_tid_toolbox_end)
|
||||
.Add_str_byte("LANGUAGES", Ignore_tid_languages)
|
||||
;
|
||||
private static final String GRP_KEY = "xowa.wiki.gui.skin.mgr";
|
||||
private static final byte[] CONST_sidebar_ttl = Bry_.new_a7("Sidebar");
|
||||
private static final String GRP_KEY = "xowa.wiki.gui.skin.mgr";
|
||||
private static final byte[] CONST_sidebar_ttl = Bry_.new_a7("Sidebar");
|
||||
}
|
||||
|
||||
@@ -190,8 +190,8 @@ class Xowh_sidebar_mgr_fxt {
|
||||
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);
|
||||
bfr = Bry_bfr_.Reset(Io_mgr.Len_kb);
|
||||
comment_bfr = Bry_bfr_.Reset(Io_mgr.Len_kb);
|
||||
Init_popups_enabled_(false);
|
||||
// }
|
||||
return this;
|
||||
|
||||
@@ -17,15 +17,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.htmls.skins; import gplx.*; import gplx.xowa.*; import gplx.xowa.htmls.*;
|
||||
import gplx.core.brys.fmtrs.*;
|
||||
public class Xoh_skin_itm implements GfoInvkAble {
|
||||
private final Bry_fmtr fmtr = Bry_fmtr.new_();
|
||||
public class Xoh_skin_itm implements Gfo_invk {
|
||||
private final Bry_fmtr fmtr = Bry_fmtr.new_();
|
||||
public Xoh_skin_itm(String key, String fmt) {this.key = key; fmtr.Fmt_(fmt);}
|
||||
public String Key() {return key;} private final String key;
|
||||
public String Key() {return key;} private final String key;
|
||||
public void Fmt_(String v) {fmtr.Fmt_(v);}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_fmt)) return String_.new_u8(fmtr.Fmt());
|
||||
else if (ctx.Match(k, Invk_fmt_)) fmtr.Fmt_(m.ReadStr("v"));
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
}
|
||||
private static final String
|
||||
|
||||
@@ -16,8 +16,8 @@ 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.skins; import gplx.*; import gplx.xowa.*; import gplx.xowa.htmls.*;
|
||||
public class Xoh_skin_mgr implements GfoInvkAble {
|
||||
private final Xoh_skin_regy regy = new Xoh_skin_regy();
|
||||
public class Xoh_skin_mgr implements Gfo_invk {
|
||||
private final Xoh_skin_regy regy = new Xoh_skin_regy();
|
||||
public Xoh_skin_mgr() {
|
||||
read = make_and_add(regy, "read");
|
||||
edit = make_and_add(regy, "edit");
|
||||
@@ -34,7 +34,7 @@ public class Xoh_skin_mgr implements GfoInvkAble {
|
||||
else if (ctx.Match(k, Invk_html)) return html;
|
||||
else if (ctx.Match(k, Invk_html_)) html = regy.Get_by_key(m.ReadStr("v"));
|
||||
else if (ctx.Match(k, Invk_set)) regy.Set(m.ReadStr("key"), m.ReadStr("fmt"));
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
}
|
||||
private static final String
|
||||
|
||||
@@ -20,8 +20,8 @@ import gplx.core.brys.*; import gplx.core.primitives.*; import gplx.langs.htmls.
|
||||
import gplx.xowa.wikis.nss.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.amps.*; import gplx.xowa.parsers.hdrs.*; import gplx.xowa.parsers.xndes.*; import gplx.xowa.parsers.lnkis.*;
|
||||
public class Xow_hdr_mgr {
|
||||
private final Xoae_page page;
|
||||
private final Hash_adp hdrs_hash = Hash_adp_.new_(); private final Bry_bfr hdrs_bfr = Bry_bfr.reset_(255); private final Bry_obj_ref hdrs_ref = Bry_obj_ref.New_empty();
|
||||
private final Xoae_page page;
|
||||
private final Hash_adp hdrs_hash = Hash_adp_.New(); private final Bry_bfr hdrs_bfr = Bry_bfr_.Reset(255); private final Bry_obj_ref hdrs_ref = Bry_obj_ref.New_empty();
|
||||
private Xop_hdr_tkn[] hdrs_ary = new Xop_hdr_tkn[0]; private int hdrs_max, hdrs_len;
|
||||
public Xow_hdr_mgr(Xoae_page page) {this.page = page;}
|
||||
public boolean Toc_enabled() {
|
||||
|
||||
@@ -23,7 +23,7 @@ import gplx.xowa.htmls.core.htmls.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.apos.*; import gplx.xowa.parsers.amps.*; import gplx.xowa.parsers.hdrs.*; import gplx.xowa.parsers.xndes.*; import gplx.xowa.parsers.lnkis.*;
|
||||
public class Xow_toc_mgr implements gplx.core.brys.Bfr_arg {
|
||||
private static final int Toc_levels = 32; // assume 6 max levels * 5 max heading (9999.); add 2 for good measure
|
||||
private Xoae_page page; private Xop_toc_itm[] path_ary; private Bry_bfr path_bfr = Bry_bfr.reset_(Toc_levels);
|
||||
private Xoae_page page; private Xop_toc_itm[] path_ary; private Bry_bfr path_bfr = Bry_bfr_.Reset(Toc_levels);
|
||||
public Xow_toc_mgr() {
|
||||
path_ary = new Xop_toc_itm[Toc_levels];
|
||||
for (int i = 0; i < Toc_levels; i++)
|
||||
@@ -197,7 +197,7 @@ public class Xow_toc_mgr implements gplx.core.brys.Bfr_arg {
|
||||
byte[] bry_contents = page.Wikie().Msg_mgr().Val_by_id(Xol_msg_itm_.Id_toc);
|
||||
bfmtr_main.Bld_bfr_many(bfr, write_toc_cls ? Bry_toc_cls : Bry_.Empty, Bfr_arg_.New_bry(bry_contents), this);
|
||||
}
|
||||
private static final byte[]
|
||||
private static final byte[]
|
||||
Bry_list_bgn = Bry_.new_a7(" <ul>\n")
|
||||
, Bry_list_end = Bry_.new_a7(" </ul>\n")
|
||||
, Bry_item_end = Bry_.new_a7(" </li>\n")
|
||||
|
||||
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.htmls.tocs; import gplx.*; import gplx.xowa.*; import gplx.xowa.htmls.*;
|
||||
import org.junit.*; import gplx.xowa.parsers.*; import gplx.xowa.htmls.core.htmls.*;
|
||||
public class Xow_toc_mgr_tst {
|
||||
@Before public void init() {fxt.Clear();} private final Xow_toc_mgr_fxt fxt = new Xow_toc_mgr_fxt();
|
||||
@Before public void init() {fxt.Clear();} private final Xow_toc_mgr_fxt fxt = new Xow_toc_mgr_fxt();
|
||||
@Test public void Basic() {
|
||||
fxt.Test_html_toc(String_.Concat_lines_nl_skip_last
|
||||
( "==a=="
|
||||
@@ -502,8 +502,8 @@ public class Xow_toc_mgr_tst {
|
||||
}
|
||||
class Xow_toc_mgr_fxt {
|
||||
private Xow_toc_mgr toc_mgr = new Xow_toc_mgr();
|
||||
private Bry_bfr tmp = Bry_bfr.new_();
|
||||
public Xop_fxt Fxt() {return fxt;} private final Xop_fxt fxt = new Xop_fxt();
|
||||
private Bry_bfr tmp = Bry_bfr_.New();
|
||||
public Xop_fxt Fxt() {return fxt;} private final Xop_fxt fxt = new Xop_fxt();
|
||||
public void Clear() {
|
||||
fxt.Reset();
|
||||
toc_mgr.Clear();
|
||||
|
||||
Reference in New Issue
Block a user