1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00

Wiki: Support renamed folders (fix)

This commit is contained in:
gnosygnu
2017-02-06 22:12:56 -05:00
parent 6f9e92afff
commit 938beac9f9
4379 changed files with 0 additions and 327818 deletions

View File

@@ -1,34 +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.skins; import gplx.*; import gplx.xowa.*; import gplx.xowa.htmls.*;
import gplx.core.brys.fmtrs.*;
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 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 Gfo_invk_.Rv_unhandled;
return this;
}
private static final String
Invk_fmt = "fmt", Invk_fmt_ = "fmt_"
;
}

View File

@@ -1,51 +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.skins; import gplx.*; import gplx.xowa.*; import gplx.xowa.htmls.*;
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");
html = make_and_add(regy, "html");
}
public Xoh_skin_itm Read() {return read;} private Xoh_skin_itm read;
public Xoh_skin_itm Edit() {return edit;} private Xoh_skin_itm edit;
public Xoh_skin_itm Html() {return html;} private Xoh_skin_itm html;
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_read)) return read;
else if (ctx.Match(k, Invk_read_)) read = regy.Get_by_key(m.ReadStr("v"));
else if (ctx.Match(k, Invk_edit)) return edit;
else if (ctx.Match(k, Invk_edit_)) edit = regy.Get_by_key(m.ReadStr("v"));
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 Gfo_invk_.Rv_unhandled;
return this;
}
private static final String
Invk_read = "read", Invk_read_ = "read_"
, Invk_edit = "edit", Invk_edit_ = "edit_"
, Invk_html = "html", Invk_html_ = "html_"
, Invk_set = "set"
;
private static Xoh_skin_itm make_and_add(Xoh_skin_regy regy, String key) {
Xoh_skin_itm rv = new Xoh_skin_itm(key, key);
regy.Add(rv);
return rv;
}
}

View File

@@ -1,34 +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.skins; import gplx.*; import gplx.xowa.*; import gplx.xowa.htmls.*;
class Xoh_skin_regy {
private final Ordered_hash hash = Ordered_hash_.New();
public int Len() {return hash.Count();}
public Xoh_skin_itm Get_at(int i) {return (Xoh_skin_itm)hash.Get_at(i);}
public Xoh_skin_itm Get_by_key(String key) {return (Xoh_skin_itm)hash.Get_by(key);}
public void Set(String key, String fmt) {
Xoh_skin_itm itm = Get_by_key(key);
if (itm == null) {
itm = new Xoh_skin_itm(key, fmt);
Add(itm);
}
else
itm.Fmt_(fmt);
}
public void Add(Xoh_skin_itm itm) {hash.Add(itm.Key(), itm);}
}