mirror of
https://github.com/gnosygnu/xowa.git
synced 2025-06-02 15:34:37 +00:00
'v3.6.4.2'
This commit is contained in:
parent
b3c2d3bb5f
commit
1a4ca00c0b
@ -62,4 +62,9 @@ public class Fsm_bin_mgr {
|
||||
for (int i = 0; i < len; ++i)
|
||||
this.Dbs__get_at(i).Conn().Txn_end();
|
||||
}
|
||||
public void Rls() {
|
||||
int len = db_hash.Len();
|
||||
for (int i = 0; i < len; ++i)
|
||||
this.Dbs__get_at(i).Conn().Rls_conn();
|
||||
}
|
||||
}
|
||||
|
@ -57,6 +57,10 @@ public class Fsm_mnt_itm {
|
||||
}
|
||||
public void Txn_bgn() {atr_mgr.Txn_bgn(); bin_mgr.Txn_bgn();}
|
||||
public void Txn_end() {atr_mgr.Txn_end(); bin_mgr.Txn_end();}
|
||||
public void Rls() {
|
||||
atr_mgr.Db__core().Conn().Rls_conn();
|
||||
bin_mgr.Rls();
|
||||
}
|
||||
}
|
||||
class Fsm_mnt_itm_ {
|
||||
public static void Patch_next_id(Fsm_mnt_itm abc_mgr, String name) {
|
||||
|
@ -41,6 +41,12 @@ public class Fsm_mnt_mgr implements Gfo_invk {
|
||||
public Fsm_mnt_itm Mnts__get_insert() {return mnt_ary[insert_idx];} public void Mnts__get_insert_idx_(int v) {insert_idx = v;} private int insert_idx = Mnt_idx_user;
|
||||
public Fsm_bin_fil Bins__at(int mnt_id, int bin_db_id) {return mnt_ary[mnt_id].Bin_mgr().Dbs__get_by_or_null(bin_db_id);}
|
||||
public int Patch_upright() {return patch_upright_tid;} private int patch_upright_tid = Xof_patch_upright_tid_.Tid_all;
|
||||
public void Rls() {
|
||||
for (int i = 0; i < mnt_ary_len; ++i) {
|
||||
Fsm_mnt_itm mnt = mnt_ary[i];
|
||||
mnt.Rls();
|
||||
}
|
||||
}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {return Gfo_invk_.Rv_unhandled;}
|
||||
public static final int Mnt_idx_main = 0, Mnt_idx_user = 1, Insert_to_bin_null = -1;
|
||||
public static void Patch(Db_cfg_tbl cfg_tbl) {
|
||||
|
@ -16,12 +16,13 @@ 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.langs.htmls; import gplx.*; import gplx.langs.*;
|
||||
public class Gfh_tag_ {
|
||||
public class Gfh_tag_ { // NOTE: not serialized; used by tag_rdr
|
||||
public static final int
|
||||
Id__comment = -3
|
||||
, Id__eos = -2
|
||||
, Id__any = -1
|
||||
, Id__unknown = 0
|
||||
, Id__h1 = 1
|
||||
, Id__h2 = 2
|
||||
, Id__h3 = 3
|
||||
, Id__h4 = 4
|
||||
@ -32,16 +33,25 @@ public class Gfh_tag_ {
|
||||
, Id__div = 9
|
||||
, Id__img = 10
|
||||
, Id__ul = 11
|
||||
, Id__li = 12
|
||||
, Id__p = 13
|
||||
, Id__br = 14
|
||||
, Id__hr = 15
|
||||
, Id__td = 16
|
||||
, Id__pre = 17
|
||||
, Id__small = 18
|
||||
, Id__i = 19
|
||||
, Id__b = 20
|
||||
, Id__sup = 21
|
||||
, Id__ol = 12
|
||||
, Id__li = 13
|
||||
, Id__dd = 14
|
||||
, Id__dt = 15
|
||||
, Id__p = 16
|
||||
, Id__br = 17
|
||||
, Id__hr = 18
|
||||
, Id__table = 19
|
||||
, Id__tr = 20
|
||||
, Id__td = 21
|
||||
, Id__th = 22
|
||||
, Id__thead = 23
|
||||
, Id__tbody = 24
|
||||
, Id__caption = 25
|
||||
, Id__pre = 26
|
||||
, Id__small = 27
|
||||
, Id__i = 28
|
||||
, Id__b = 29
|
||||
, Id__sup = 30
|
||||
;
|
||||
public static final byte[]
|
||||
Bry__a = Bry_.new_a7("a")
|
||||
@ -55,6 +65,7 @@ public class Gfh_tag_ {
|
||||
;
|
||||
public static final Hash_adp_bry Hash = Hash_adp_bry.ci_a7()
|
||||
.Add_bry_int(Bry__a , Id__a)
|
||||
.Add_str_int("h1" , Id__h1)
|
||||
.Add_str_int("h2" , Id__h2)
|
||||
.Add_str_int("h3" , Id__h3)
|
||||
.Add_str_int("h4" , Id__h4)
|
||||
@ -66,8 +77,17 @@ public class Gfh_tag_ {
|
||||
.Add_str_int("br" , Id__br)
|
||||
.Add_str_int("hr" , Id__hr)
|
||||
.Add_str_int("ul" , Id__ul)
|
||||
.Add_str_int("ol" , Id__ol)
|
||||
.Add_str_int("li" , Id__li)
|
||||
.Add_str_int("dd" , Id__dd)
|
||||
.Add_str_int("dt" , Id__dt)
|
||||
.Add_str_int("table" , Id__table)
|
||||
.Add_str_int("tr" , Id__tr)
|
||||
.Add_str_int("td" , Id__td)
|
||||
.Add_str_int("th" , Id__th)
|
||||
.Add_str_int("thead" , Id__thead)
|
||||
.Add_str_int("tbody" , Id__tbody)
|
||||
.Add_str_int("caption" , Id__caption)
|
||||
.Add_str_int("p" , Id__p)
|
||||
.Add_str_int("pre" , Id__pre)
|
||||
.Add_str_int("small" , Id__small)
|
||||
@ -81,6 +101,7 @@ public class Gfh_tag_ {
|
||||
case Id__any: return "any";
|
||||
case Id__unknown: return "unknown";
|
||||
case Id__comment: return "comment";
|
||||
case Id__h1: return "h1";
|
||||
case Id__h2: return "h2";
|
||||
case Id__h3: return "h2";
|
||||
case Id__h4: return "h2";
|
||||
@ -93,9 +114,18 @@ public class Gfh_tag_ {
|
||||
case Id__p: return "p";
|
||||
case Id__br: return "br";
|
||||
case Id__hr: return "hr";
|
||||
case Id__td: return "td";
|
||||
case Id__ul: return "ul";
|
||||
case Id__ol: return "ol";
|
||||
case Id__li: return "li";
|
||||
case Id__dd: return "dd";
|
||||
case Id__dt: return "dt";
|
||||
case Id__table: return "table";
|
||||
case Id__tr: return "tr";
|
||||
case Id__td: return "td";
|
||||
case Id__th: return "th";
|
||||
case Id__thead: return "thead";
|
||||
case Id__tbody: return "tbody";
|
||||
case Id__caption: return "caption";
|
||||
case Id__pre: return "pre";
|
||||
case Id__small: return "small";
|
||||
case Id__i: return "i";
|
||||
|
@ -34,7 +34,7 @@ public class Xoa_app_ {
|
||||
}
|
||||
}
|
||||
public static final String Name = "xowa";
|
||||
public static final String Version = "3.6.4.1";
|
||||
public static final String Version = "3.6.4.2";
|
||||
public static String Build_date = "2012-12-30 00:00:00";
|
||||
public static String Op_sys_str;
|
||||
public static String User_agent = "";
|
||||
|
@ -54,4 +54,5 @@ public interface Xow_wiki extends Xow_ttl_parser, Gfo_invk {
|
||||
Xow_url_parser Utl__url_parser();
|
||||
Xoax_addon_mgr Addon_mgr();
|
||||
void Init_needed_y_();
|
||||
void Rls();
|
||||
}
|
||||
|
@ -218,12 +218,16 @@ public class Xowe_wiki implements Xow_wiki, Gfo_invk, Gfo_evt_itm {
|
||||
app.Site_cfg_mgr().Load(this);
|
||||
}
|
||||
public void Rls() {
|
||||
if (rls_list == null) return;
|
||||
int len = rls_list.Count();
|
||||
for (int i = 0; i < len; i++) {
|
||||
Rls_able rls = (Rls_able)rls_list.Get_at(i);
|
||||
rls.Rls();
|
||||
if (rls_list != null) {
|
||||
int len = rls_list.Count();
|
||||
for (int i = 0; i < len; i++) {
|
||||
Rls_able rls = (Rls_able)rls_list.Get_at(i);
|
||||
rls.Rls();
|
||||
}
|
||||
}
|
||||
Xow_db_mgr core_db_mgr = this.Data__core_mgr();
|
||||
if (core_db_mgr != null) core_db_mgr.Rls();
|
||||
file_mgr.Rls();
|
||||
}
|
||||
public void Init_needed_y_() {this.init_needed = true;}
|
||||
private void Copy_cfg(Xowe_wiki wiki) {html_mgr.Copy_cfg(wiki.Html_mgr());}
|
||||
|
@ -70,7 +70,7 @@ public class Xobc_step_map_tbl implements Db_tbl {
|
||||
}
|
||||
public List_adp Select_all(int task_id) {
|
||||
List_adp rv = List_adp_.New();
|
||||
Db_rdr rdr = conn.Stmt_select(tbl_name, flds, fld_task_id).Crt_int(fld_task_id, task_id).Exec_select__rls_auto();
|
||||
Db_rdr rdr = conn.Stmt_select_order(tbl_name, flds, String_.Ary(fld_task_id), fld_step_seqn).Crt_int(fld_task_id, task_id).Exec_select__rls_auto();
|
||||
try {
|
||||
while (rdr.Move_next()) {
|
||||
rv.Add(rdr.Read_int("step_id"));
|
||||
|
@ -53,6 +53,7 @@ public class Xobc_work_task_tbl implements Db_tbl {
|
||||
task.Task_status_(cmd_id == Xobc_cmd__base.Seqn__0 ? gplx.core.progs.Gfo_prog_ui_.Status__init : gplx.core.progs.Gfo_prog_ui_.Status__working);
|
||||
task_mgr.Step_mgr().Load(task, step_id, cmd_id);
|
||||
}
|
||||
work_regy.Sort();
|
||||
} finally {rdr.Rls();}
|
||||
}
|
||||
public void Insert(int task_id, int task_seqn, int step_id, int cmd_id) {
|
||||
|
@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.addons.bldrs.centrals.tasks; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.bldrs.*; import gplx.xowa.addons.bldrs.centrals.*;
|
||||
import gplx.core.gfobjs.*;
|
||||
import gplx.xowa.addons.bldrs.centrals.cmds.*; import gplx.xowa.addons.bldrs.centrals.steps.*;
|
||||
public class Xobc_task_itm {
|
||||
public class Xobc_task_itm implements gplx.CompareAble {
|
||||
public Xobc_task_itm(int task_id, int task_seqn, int step_count, String task_key, String task_name) {
|
||||
this.task_id = task_id; this.task_seqn = task_seqn;
|
||||
this.step_count = step_count;
|
||||
@ -35,6 +35,7 @@ public class Xobc_task_itm {
|
||||
public boolean Step_is_last() {return step.Step_seqn() == step_count - 1;}
|
||||
public void Task_status_(byte v) {task_status = v;} // called when task moves from init -> working -> suspended -> done
|
||||
public void Task_seqn_(int v) {this.task_seqn = v;} // called when task is init'd from db, or added to list
|
||||
public int compareTo(Object obj) {Xobc_task_itm comp = (Xobc_task_itm)obj; return Int_.Compare(task_seqn, comp.task_seqn);}
|
||||
|
||||
public Gfobj_nde Save_to(Gfobj_nde nde) {
|
||||
nde.Add_int ("task_id" , task_id);
|
||||
|
@ -28,6 +28,7 @@ public abstract class Xobc_task_regy__base {
|
||||
public Xobc_task_itm Get_at(int i) {return (Xobc_task_itm)hash.Get_at(i);}
|
||||
public Xobc_task_itm Get_by(int i) {return (Xobc_task_itm)hash.Get_by(i);}
|
||||
public void Del_by(int i) {hash.Del(i);}
|
||||
public void Sort() {hash.Sort();}
|
||||
|
||||
public void Save_to(Gfobj_ary ary) {
|
||||
int len = hash.Len();
|
||||
|
@ -56,7 +56,7 @@ public class Xow_file_mgr implements Gfo_invk {
|
||||
public void Version_1_y_() {version = Version_1;} // TEST:
|
||||
public void Version_2_y_() {version = Version_2;} // TEST:
|
||||
public void Fsdb_mgr_(Xof_fsdb_mgr fsdb_mgr) {
|
||||
this.fsdb_mgr = fsdb_mgr;
|
||||
this.fsdb_mgr = fsdb_mgr;
|
||||
version = Version_2;
|
||||
}
|
||||
public int Patch_upright() {
|
||||
@ -131,6 +131,10 @@ public class Xow_file_mgr implements Gfo_invk {
|
||||
orig_mgr.Init_by_wiki(wiki, fsdb_mode, db_core.File__orig_tbl_ary(), Xof_url_bldr.new_v2());
|
||||
fsdb_mgr.Init_by_wiki(wiki);
|
||||
}
|
||||
public void Rls() {
|
||||
fsdb_mgr.Rls();
|
||||
db_core = null;
|
||||
}
|
||||
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_repos)) return repo_mgr;
|
||||
|
@ -54,6 +54,9 @@ public class Xof_bin_mgr {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public void Rls() {
|
||||
mnt_mgr.Rls();
|
||||
}
|
||||
public boolean Find_to_url_as_bool(int exec_tid, Xof_fsdb_itm fsdb) {return Find_as(Bool_.Y, rdr_wrapper, exec_tid, fsdb);}
|
||||
// public boolean Find_to_url_as_bool3(int exec_tid, Xof_fsdb_itm fsdb) {return Find_to_url(exec_tid, fsdb) != Io_url_.Empty;}
|
||||
// private Io_url Find_to_url(int exec_tid, Xof_fsdb_itm fsdb) {
|
||||
|
@ -23,4 +23,5 @@ public interface Xof_fsdb_mgr {
|
||||
Fsm_mnt_mgr Mnt_mgr();
|
||||
void Init_by_wiki(Xow_wiki wiki);
|
||||
void Fsdb_search_by_list(List_adp itms, Xow_wiki wiki, Xoa_page page, Xog_js_wkr js_wkr);
|
||||
void Rls();
|
||||
}
|
||||
|
@ -62,6 +62,10 @@ public class Xof_fsdb_mgr__sql implements Xof_fsdb_mgr, Gfo_invk {
|
||||
Xof_file_wkr.Show_img(fsdb, usr_dlg, wiki.File__bin_mgr(), wiki.File__mnt_mgr(), cache_mgr, wiki.File__repo_mgr(), js_wkr, img_size, url_bldr, page);
|
||||
}
|
||||
}
|
||||
public void Rls() {
|
||||
if (bin_mgr != null) bin_mgr.Rls();
|
||||
init = false;
|
||||
}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_mnt_mgr)) return mnt_mgr;
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
|
@ -67,8 +67,18 @@ class Xoh_toc_wtr {
|
||||
switch (tag_id) {
|
||||
case Gfh_tag_.Id__eos: // eos; return;
|
||||
return;
|
||||
case Gfh_tag_.Id__i: // always print tag
|
||||
case Gfh_tag_.Id__b:
|
||||
case Gfh_tag_.Id__comment: // never print tag
|
||||
case Gfh_tag_.Id__img:
|
||||
case Gfh_tag_.Id__br: case Gfh_tag_.Id__hr: // always ignore in TOC text; EX: en.wikipedia.org/wiki/Magnetic_resonance_imaging; ====''T''<span style="display:inline-block; margin-bottom:-0.3em; vertical-align:-0.4em; line-height:1.2em; font-size:85%; text-align:left;">*<br />2</span>-weighted MRI====
|
||||
case Gfh_tag_.Id__h1: case Gfh_tag_.Id__h2: case Gfh_tag_.Id__h3: case Gfh_tag_.Id__h4: case Gfh_tag_.Id__h5: case Gfh_tag_.Id__h6:
|
||||
case Gfh_tag_.Id__ul: case Gfh_tag_.Id__ol: case Gfh_tag_.Id__dd: case Gfh_tag_.Id__dt: case Gfh_tag_.Id__li:
|
||||
case Gfh_tag_.Id__table: case Gfh_tag_.Id__tr: case Gfh_tag_.Id__td: case Gfh_tag_.Id__th: case Gfh_tag_.Id__thead: case Gfh_tag_.Id__tbody: case Gfh_tag_.Id__caption:
|
||||
// case Gfh_tag_.Id__ref: // NOTE: don't bother printing references; NOTE: should never show up
|
||||
print_tag = false;
|
||||
recurse = false;
|
||||
break;
|
||||
case Gfh_tag_.Id__b: // always print tag
|
||||
case Gfh_tag_.Id__i:
|
||||
print_tag = true;
|
||||
break;
|
||||
case Gfh_tag_.Id__small: // only print tag if not nested
|
||||
@ -79,13 +89,6 @@ class Xoh_toc_wtr {
|
||||
print_tag = true;
|
||||
break;
|
||||
}
|
||||
case Gfh_tag_.Id__comment: // never print tag
|
||||
case Gfh_tag_.Id__img:
|
||||
case Gfh_tag_.Id__br:
|
||||
case Gfh_tag_.Id__hr:
|
||||
print_tag = false;
|
||||
recurse = false;
|
||||
break;
|
||||
case Gfh_tag_.Id__a: // a never prints tag; also, also, do not recurse if ref
|
||||
print_tag = false;
|
||||
byte[] href_val = lhs.Atrs__get_as_bry(Gfh_atr_.Bry__href);
|
||||
|
@ -0,0 +1,36 @@
|
||||
/*
|
||||
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.tocs; import gplx.*; import gplx.xowa.*; import gplx.xowa.htmls.*;
|
||||
import org.junit.*; import gplx.core.tests.*;
|
||||
public class Xoh_toc_wtr__anch__tst {
|
||||
@Before public void init() {fxt.Clear();} private final Xoh_toc_wtr_fxt fxt = new Xoh_toc_wtr_fxt();
|
||||
@Test public void Caption() {
|
||||
fxt.Test__convert("<a href=\"/wiki/A\">b</a>", "b");
|
||||
}
|
||||
@Test public void Ref() { // PURPOSE: ref contents should not print in TOC; DATE:2013-07-23
|
||||
fxt.Test__convert("a<sup id=\"cite_ref-0\" class=\"reference\"><a href=\"#cite_note-0\">[1]</a></sup>", "a");
|
||||
}
|
||||
@Test public void Category() { // PURPOSE: literal Category should show in in TOC; EX: de.w:1234; DATE:2014-01-21
|
||||
fxt.Test__convert("A<a href=\"/wiki/Category:B\">Category:B</a>", "ACategory:B");
|
||||
}
|
||||
@Test public void File() { // PURPOSE: file should not show in in TOC; EX: tr.w:D<EFBFBD>nya_Miraslari; DATE:2014-06-06
|
||||
fxt.Test__convert
|
||||
( "<a href=\"/wiki/File:A.png\" class=\"image\" xowa_title=\"A.png\"><img id=\"xoimg_0\" alt=\"\" src=\"file:///mem/wiki/repo/trg/orig/7/0/A.png\" width=\"0\" height=\"0\" /></a> b"
|
||||
, "b");
|
||||
}
|
||||
}
|
@ -17,7 +17,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.core.tests.*;
|
||||
public class Xoh_toc_wtr_tst {
|
||||
public class Xoh_toc_wtr__keep__tst {
|
||||
@Before public void init() {fxt.Clear();} private final Xoh_toc_wtr_fxt fxt = new Xoh_toc_wtr_fxt();
|
||||
@Test public void Basic() {
|
||||
fxt.Test__convert("a b c", "a b c");
|
||||
@ -25,39 +25,15 @@ public class Xoh_toc_wtr_tst {
|
||||
@Test public void Ws() {
|
||||
fxt.Test__convert(" a b ", "a b");
|
||||
}
|
||||
@Test public void Comment() {
|
||||
fxt.Test__convert("<!--a-->", "");
|
||||
}
|
||||
@Test public void Comment__many() {
|
||||
fxt.Test__convert("1<!--2-->3<!--4-->5", "135");
|
||||
}
|
||||
@Test public void Comment__dangling() {
|
||||
fxt.Test__convert("1<!--2-->3<!--4->5", "13<!--4->5");
|
||||
}
|
||||
@Test public void Apos__italic() {
|
||||
fxt.Test__convert("<i>a</i>", "<i>a</i>");
|
||||
}
|
||||
@Test public void Lnki__caption() {
|
||||
fxt.Test__convert("<a href=\"/wiki/A\">b</a>", "b");
|
||||
}
|
||||
@Test public void Lnki__caption__nest() {
|
||||
fxt.Test__convert("<a href=\"/wiki/A\">b<i>c</i>d</a>", "b<i>c</i>d");
|
||||
}
|
||||
@Test public void Xnde__small() {
|
||||
fxt.Test__convert("<small>a</small>", "a");
|
||||
}
|
||||
@Test public void Xnde__sup() {
|
||||
fxt.Test__convert("<sup>a</sup>", "a");
|
||||
}
|
||||
@Test public void Xnde__nest__xnde() { // <sup> removed but not <small>
|
||||
fxt.Test__convert("a <sup>b<small>c</small>d</sup> e", "a b<small>c</small>d e");
|
||||
}
|
||||
@Test public void Xnde__nest__lnki() { // <small> and <a> removed
|
||||
fxt.Test__convert("<small><a href=\"/wiki/A\">b</a></small>", "b");
|
||||
}
|
||||
@Test public void Amp__ncr() {
|
||||
fxt.Test__convert("[a]", "[a]");
|
||||
}
|
||||
@Test public void Italic() {
|
||||
fxt.Test__convert("<i>a</i>", "<i>a</i>");
|
||||
}
|
||||
@Test public void Caption() {
|
||||
fxt.Test__convert("<a href=\"/wiki/A\">b</a>", "b");
|
||||
}
|
||||
@Test public void Ref() { // PURPOSE: ref contents should not print in TOC; DATE:2013-07-23
|
||||
fxt.Test__convert("a<sup id=\"cite_ref-0\" class=\"reference\"><a href=\"#cite_note-0\">[1]</a></sup>", "a");
|
||||
}
|
||||
@ -69,12 +45,6 @@ public class Xoh_toc_wtr_tst {
|
||||
( "<a href=\"/wiki/File:A.png\" class=\"image\" xowa_title=\"A.png\"><img id=\"xoimg_0\" alt=\"\" src=\"file:///mem/wiki/repo/trg/orig/7/0/A.png\" width=\"0\" height=\"0\" /></a> b"
|
||||
, "b");
|
||||
}
|
||||
@Test public void Xnde__nest__inline() { // PURPOSE: do not render inline xndes; EX: Magnetic_resonance_imaging
|
||||
fxt.Test__convert("a<span id='b'>b<br/></span>", "ab");
|
||||
}
|
||||
@Test public void Translate_w_comment() { // PURPOSE: <translate> is an xtn and parses its innerText separately; meanwhile, toc_mgr defaults to using the innerText to build toc; EX:Wikidata:Introduction; DATE:2013-07-16
|
||||
fxt.Test__convert("<translate><!--b-->ac</translate>", "ac");
|
||||
}
|
||||
}
|
||||
class Xoh_toc_wtr_fxt {
|
||||
private final Xoh_toc_wtr wtr = new Xoh_toc_wtr();
|
@ -0,0 +1,34 @@
|
||||
/*
|
||||
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.tocs; import gplx.*; import gplx.xowa.*; import gplx.xowa.htmls.*;
|
||||
import org.junit.*; import gplx.core.tests.*;
|
||||
public class Xoh_toc_wtr__nest__tst {
|
||||
@Before public void init() {fxt.Clear();} private final Xoh_toc_wtr_fxt fxt = new Xoh_toc_wtr_fxt();
|
||||
@Test public void Xnde__xnde() { // <sup> removed but not <small>
|
||||
fxt.Test__convert("a <sup>b<small>c</small>d</sup> e", "a b<small>c</small>d e");
|
||||
}
|
||||
@Test public void Xnde__inline() { // PURPOSE: do not render inline xndes; EX: Magnetic_resonance_imaging
|
||||
fxt.Test__convert("a<span id='b'>b<br/></span>", "ab");
|
||||
}
|
||||
@Test public void Xnde__lnki() { // <small> and <a> removed
|
||||
fxt.Test__convert("<small><a href=\"/wiki/A\">b</a></small>", "b");
|
||||
}
|
||||
@Test public void Lnki__xnde() {
|
||||
fxt.Test__convert("<a href=\"/wiki/A\">b<i>c</i>d</a>", "b<i>c</i>d");
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
/*
|
||||
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.tocs; import gplx.*; import gplx.xowa.*; import gplx.xowa.htmls.*;
|
||||
import org.junit.*; import gplx.core.tests.*;
|
||||
public class Xoh_toc_wtr__skip__tst {
|
||||
@Before public void init() {fxt.Clear();} private final Xoh_toc_wtr_fxt fxt = new Xoh_toc_wtr_fxt();
|
||||
@Test public void Comment() {
|
||||
fxt.Test__convert("<!--a-->", "");
|
||||
}
|
||||
@Test public void Comment__many() {
|
||||
fxt.Test__convert("1<!--2-->3<!--4-->5", "135");
|
||||
}
|
||||
@Test public void Comment__dangling() {
|
||||
fxt.Test__convert("1<!--2-->3<!--4->5", "13<!--4->5");
|
||||
}
|
||||
@Test public void Br() {
|
||||
fxt.Test__convert("a<br/>b", "ab");
|
||||
}
|
||||
@Test public void H2() {
|
||||
fxt.Test__convert("a<h2>b</h2>c", "ac");
|
||||
}
|
||||
@Test public void Li() {
|
||||
fxt.Test__convert("a<ul><li>b</li></ul>c", "ac");
|
||||
}
|
||||
@Test public void Table() {
|
||||
fxt.Test__convert("a<table><tr><td>b</td></tr></table>c", "ac");
|
||||
}
|
||||
@Test public void Xnde__small() {
|
||||
fxt.Test__convert("<small>a</small>", "a");
|
||||
}
|
||||
@Test public void Xnde__sup() {
|
||||
fxt.Test__convert("<sup>a</sup>", "a");
|
||||
}
|
||||
@Test public void Translate() { // PURPOSE: <translate> is an xtn and parses its innerText separately; meanwhile, toc_mgr defaults to using the innerText to build toc; EX:Wikidata:Introduction; DATE:2013-07-16
|
||||
fxt.Test__convert("<translate><!--b-->ac</translate>", "ac");
|
||||
}
|
||||
}
|
@ -26,11 +26,19 @@ public class Xoa_wiki_mgr_ {
|
||||
Io_url wiki_root_dir = url.OwnerDir();
|
||||
Xow_wiki rv = wiki_mgr.Make(wiki_domain, wiki_root_dir);
|
||||
wiki_mgr.Add(rv);
|
||||
rv.Init_by_wiki(); // must init for Modified_latest
|
||||
rv.Init_by_wiki(); // must init for Modified_latest
|
||||
String wiki_date = rv.Props().Modified_latest__yyyy_MM_dd();
|
||||
app.User().User_db_mgr().Site_mgr().Import(rv.Domain_str(), rv.Domain_str(), wiki_root_dir.Raw(), wiki_date, "");
|
||||
conn.Rls_conn();
|
||||
rv.Init_needed_y_(); // rls wiki else noop connection will hang around
|
||||
if (app.Tid_is_edit()) {
|
||||
// get_or_new wiki and mark it offline so it can show up in wikis sidebar
|
||||
gplx.xowa.wikis.xwikis.Xow_xwiki_itm xwiki = app.User().Wikii().Xwiki_mgr().Get_by_key(wiki_domain);
|
||||
if (xwiki == null)
|
||||
xwiki = app.User().Wikii().Xwiki_mgr().Add_by_atrs(wiki_domain, wiki_domain);
|
||||
xwiki.Offline_(true);
|
||||
((Xoae_app)app).Gui_mgr().Html_mgr().Portal_mgr().Wikis().Itms_reset(); // dirty wiki list so that next refresh will load itm
|
||||
}
|
||||
rv.Rls(); // rls wiki, else open connections will cause later file copies to fail; DATE:2016-06-26
|
||||
rv.Init_needed_y_(); // mark Init_needed_y_(), else wiki may have NOOP connection which will hang around on next release
|
||||
return rv;
|
||||
}
|
||||
public static final String Invk__import_by_url = "import_by_url";
|
||||
|
@ -106,6 +106,10 @@ public class Xowv_wiki implements Xow_wiki, Xow_ttl_parser, Gfo_invk {
|
||||
data_mgr__core_mgr.Init_by_make(props, info_session);
|
||||
html__hdump_mgr.Init_by_db(this);
|
||||
}
|
||||
public void Rls() {
|
||||
data_mgr__core_mgr.Rls();
|
||||
fsdb_mgr.Rls();
|
||||
}
|
||||
public void Pages_get(Xoh_page rv, Gfo_url url, Xoa_ttl ttl) {
|
||||
if (init_needed) Init_by_wiki();
|
||||
if (ttl.Ns().Id_is_special())
|
||||
|
@ -20,8 +20,8 @@ import gplx.core.net.*; import gplx.xowa.htmls.hrefs.*;
|
||||
import gplx.xowa.langs.*;
|
||||
import gplx.xowa.wikis.domains.*; import gplx.xowa.wikis.xwikis.parsers.*; import gplx.xowa.wikis.xwikis.sitelinks.*;
|
||||
public class Xow_xwiki_mgr {
|
||||
private final Ordered_hash list = Ordered_hash_.New_bry(); private final Hash_adp_bry hash = Hash_adp_bry.ci_a7();
|
||||
private final Xow_wiki wiki;
|
||||
private final Ordered_hash list = Ordered_hash_.New_bry(); private final Hash_adp_bry hash = Hash_adp_bry.ci_a7();
|
||||
private final Xow_wiki wiki;
|
||||
public Xow_xwiki_mgr(Xow_wiki wiki) {
|
||||
this.wiki = wiki;
|
||||
this.xwiki_domain_tid = Xwiki_tid(wiki.Domain_tid());
|
||||
@ -88,5 +88,5 @@ public class Xow_xwiki_mgr {
|
||||
return url.Segs__get_at_1st();
|
||||
}
|
||||
public static byte[] Bld_url_fmt(byte[] domain_bry) {return Bry_.Add(gplx.core.net.Gfo_protocol_itm.Itm_https.Text_bry(), domain_bry, Bry__url_fmt_end);}
|
||||
private static final byte[] Bry__url_fmt_end = Bry_.new_a7("/wiki/~{0}");
|
||||
private static final byte[] Bry__url_fmt_end = Bry_.new_a7("/wiki/~{0}");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user