1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2024-10-27 20:34:16 +00:00

Cfg: Fix 'tidy' binary cmd

This commit is contained in:
gnosygnu 2016-12-22 22:21:38 -05:00
parent 7fd6b6c254
commit c2b4d8523f
3 changed files with 19 additions and 19 deletions

View File

@ -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.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.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.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.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.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")); this.Lists__add("list:xowa.addon.math.renderer", Keyval_.new_("mathjax","MathJax"), Keyval_.new_("latex", "LaTeX"));

View File

@ -38,7 +38,7 @@ public class Xow_html_mgr implements Gfo_invk {
public void Init_by_wiki(Xowe_wiki wiki) { public void Init_by_wiki(Xowe_wiki wiki) {
html_wtr.Init_by_wiki(wiki); html_wtr.Init_by_wiki(wiki);
module_mgr.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); portal_mgr.Init_by_wiki(wiki);
page_wtr_mgr.Init_by_wiki(wiki); page_wtr_mgr.Init_by_wiki(wiki);
} }

View File

@ -18,21 +18,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
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.*; 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.core.envs.*;
import gplx.langs.htmls.*; import gplx.langs.htmls.*;
public class Xow_tidy_mgr implements Gfo_evt_itm, Xow_tidy_mgr_interface { public class Xow_tidy_mgr implements Gfo_invk, 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 Xoae_app app;
private boolean enabled = true; private Xoh_tidy_wkr wkr = Xoh_tidy_wkr_.Wkr_null; // TEST: set default wkr to null 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
public Xow_tidy_mgr() {this.evt_mgr = new Gfo_evt_mgr(this);} private final Xoh_tidy_wkr_jtidy wkr__jtidy = new Xoh_tidy_wkr_jtidy();
public Gfo_evt_mgr Evt_mgr() {return evt_mgr;} private final Gfo_evt_mgr evt_mgr; private Xoh_tidy_wkr wkr = Xoh_tidy_wkr_.Wkr_null; // TEST: set default wkr to null
private void Engine_(String v) { private boolean enabled = true;
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 public void Init_by_wiki(Xowe_wiki wiki) {
else if (String_.Eq(v, "jtidy")) wkr = new Xoh_tidy_wkr_jtidy(); this.app = wiki.Appe();
else throw Err_.new_unhandled_default(v); 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");
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");
app.Cfg().Bind_many_app(this, Cfg__enabled, Cfg__engine, Cfg__cmd); app.Cfg().Bind_many_app(this, Cfg__enabled, Cfg__engine, Cfg__cmd);
} }
public void Exec_tidy(Bry_bfr bfr, boolean indent, byte[] page_url) { 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) { public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Cfg__enabled)) this.enabled = m.ReadYn("v"); 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"), wkr__tidy);
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__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; else return Gfo_invk_.Rv_unhandled;
return this; return this;
} }