diff --git a/400_xowa/src/gplx/xowa/addons/apps/cfgs/mgrs/types/Xocfg_type_mgr.java b/400_xowa/src/gplx/xowa/addons/apps/cfgs/mgrs/types/Xocfg_type_mgr.java index e05f7a781..55fdee0fa 100644 --- a/400_xowa/src/gplx/xowa/addons/apps/cfgs/mgrs/types/Xocfg_type_mgr.java +++ b/400_xowa/src/gplx/xowa/addons/apps/cfgs/mgrs/types/Xocfg_type_mgr.java @@ -26,7 +26,7 @@ public class Xocfg_type_mgr { this.Lists__add("list:xowa.wiki.database.zip_mode", Keyval_.new_("raw", "text"), Keyval_.new_("gzip"), Keyval_.new_("bzip2"), Keyval_.new_("xz")); this.Lists__add("list:xowa.html.wiki.portal.missing_class", Keyval_.new_("", "Show as blue link"), Keyval_.new_("new", "Show as red link"), Keyval_.new_("xowa_display_none", "Hide")); this.Lists__add("list:xowa.html.category.basic.missing_class", "normal", "hide", "red_link"); - this.Lists__add("list:xowa.html.tidy.general.engine", "tidy", "jtidy"); + this.Lists__add("list:xowa.html.tidy.engine", "tidy", "jtidy"); this.Lists__add("list:xowa.addon.http_server.file_retrieve_mode", Keyval_.new_("wait"), Keyval_.new_("skip"), Keyval_.new_("async_server", "async server")); this.Lists__add("list:xowa.addon.search_suggest.html_bar.search_mode", "Search", "AllPages", "AllPages_(v2)"); this.Lists__add("list:xowa.addon.math.renderer", Keyval_.new_("mathjax","MathJax"), Keyval_.new_("latex", "LaTeX")); diff --git a/400_xowa/src/gplx/xowa/htmls/Xow_html_mgr.java b/400_xowa/src/gplx/xowa/htmls/Xow_html_mgr.java index edbbb1a5a..131ef05b5 100644 --- a/400_xowa/src/gplx/xowa/htmls/Xow_html_mgr.java +++ b/400_xowa/src/gplx/xowa/htmls/Xow_html_mgr.java @@ -38,7 +38,7 @@ public class Xow_html_mgr implements Gfo_invk { public void Init_by_wiki(Xowe_wiki wiki) { html_wtr.Init_by_wiki(wiki); module_mgr.Init_by_wiki(wiki); - tidy_mgr.Init_by_wiki(wiki.Appe()); + tidy_mgr.Init_by_wiki(wiki); portal_mgr.Init_by_wiki(wiki); page_wtr_mgr.Init_by_wiki(wiki); } diff --git a/400_xowa/src/gplx/xowa/htmls/core/htmls/tidy/Xow_tidy_mgr.java b/400_xowa/src/gplx/xowa/htmls/core/htmls/tidy/Xow_tidy_mgr.java index a2e14402c..61b7ebf69 100644 --- a/400_xowa/src/gplx/xowa/htmls/core/htmls/tidy/Xow_tidy_mgr.java +++ b/400_xowa/src/gplx/xowa/htmls/core/htmls/tidy/Xow_tidy_mgr.java @@ -18,21 +18,15 @@ along with this program. If not, see . package gplx.xowa.htmls.core.htmls.tidy; import gplx.*; import gplx.xowa.*; import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.*; import gplx.xowa.htmls.core.htmls.*; import gplx.core.envs.*; import gplx.langs.htmls.*; -public class Xow_tidy_mgr implements Gfo_evt_itm, Xow_tidy_mgr_interface { - private Xoae_app app; private Xoh_tidy_wkr_tidy tidy_cmd = new Xoh_tidy_wkr_tidy(); // NOTE: app-level; not thread-safe; needed b/c of Options and exe/args DATE:2016-07-12 - private boolean enabled = true; private Xoh_tidy_wkr wkr = Xoh_tidy_wkr_.Wkr_null; // TEST: set default wkr to null - public Xow_tidy_mgr() {this.evt_mgr = new Gfo_evt_mgr(this);} - public Gfo_evt_mgr Evt_mgr() {return evt_mgr;} private final Gfo_evt_mgr evt_mgr; - private void Engine_(String v) { - if (String_.Eq(v, "tidy")) wkr = new Xoh_tidy_wkr_tidy(); // NOTE: app-level; not thread-safe; needed b/c of Options and exe/args DATE:2016-07-12 - else if (String_.Eq(v, "jtidy")) wkr = new Xoh_tidy_wkr_jtidy(); - else throw Err_.new_unhandled_default(v); - wkr.Init_by_app(app); - } - public void Init_by_wiki(Xoae_app app) { - this.app = app; - tidy_cmd.Init_by_app(app); - Process_adp.ini_(this, app.Usr_dlg(), tidy_cmd, app.Url_cmd_eval(), Process_adp.Run_mode_sync_timeout, 1 * 60, "~{<>bin_plat_dir<>}tidy" + Op_sys.Cur().Fsys_dir_spr_str() + "tidy", Xoh_tidy_wkr_tidy.Args_fmt, "source", "target"); +public class Xow_tidy_mgr implements Gfo_invk, Xow_tidy_mgr_interface { + private Xoae_app app; + private final Xoh_tidy_wkr_tidy wkr__tidy = new Xoh_tidy_wkr_tidy(); // NOTE: app-level; not thread-safe; needed b/c of Options and exe/args DATE:2016-07-12 + private final Xoh_tidy_wkr_jtidy wkr__jtidy = new Xoh_tidy_wkr_jtidy(); + private Xoh_tidy_wkr wkr = Xoh_tidy_wkr_.Wkr_null; // TEST: set default wkr to null + private boolean enabled = true; + public void Init_by_wiki(Xowe_wiki wiki) { + this.app = wiki.Appe(); + Process_adp.ini_(this, app.Usr_dlg(), wkr__tidy, app.Url_cmd_eval(), Process_adp.Run_mode_sync_timeout, 1 * 60, "~{<>bin_plat_dir<>}tidy" + Op_sys.Cur().Fsys_dir_spr_str() + "tidy", Xoh_tidy_wkr_tidy.Args_fmt, "source", "target"); app.Cfg().Bind_many_app(this, Cfg__enabled, Cfg__engine, Cfg__cmd); } public void Exec_tidy(Bry_bfr bfr, boolean indent, byte[] page_url) { @@ -45,8 +39,14 @@ public class Xow_tidy_mgr implements Gfo_evt_itm, Xow_tidy_mgr_interface { } public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) { if (ctx.Match(k, Cfg__enabled)) this.enabled = m.ReadYn("v"); - else if (ctx.Match(k, Cfg__engine)) Engine_(m.ReadStr("v")); - else if (ctx.Match(k, Cfg__cmd)) gplx.xowa.apps.progs.Xoa_prog_mgr.Init_cmd(m.ReadStr("v"), tidy_cmd); + else if (ctx.Match(k, Cfg__cmd)) gplx.xowa.apps.progs.Xoa_prog_mgr.Init_cmd(m.ReadStr("v"), wkr__tidy); + else if (ctx.Match(k, Cfg__engine)) { + String engine_str = m.ReadStr("v"); + if (String_.Eq(engine_str, "tidy")) wkr = wkr__tidy; // NOTE: app-level; not thread-safe; needed b/c of Options and exe/args DATE:2016-07-12 + else if (String_.Eq(engine_str, "jtidy")) wkr = wkr__jtidy; + else throw Err_.new_unhandled_default(engine_str); + wkr.Init_by_app(app); + } else return Gfo_invk_.Rv_unhandled; return this; }