mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
v3.1.5.1
This commit is contained in:
@@ -325,9 +325,9 @@ public class Xop_ctx {
|
||||
return rv;
|
||||
}
|
||||
private static void new_copy(Xop_ctx src, Xop_ctx trg) {
|
||||
trg.Lnki().File_wkr_(src.Lnki().File_wkr()); // always share file_wkr between sub contexts
|
||||
trg.tmpl_output = src.tmpl_output; // share bfr for optimization purposes
|
||||
trg.ref_ignore = src.ref_ignore; // copy ref_ignore; needed for refs inside poem else duplicate refs; it.s:La_Secchia_rapita/Canto_primo; DATE:2015-12-03
|
||||
trg.Lnki().File_logger_(src.Lnki().File_logger()); // always share lnki_logger between sub contexts
|
||||
trg.tmpl_output = src.tmpl_output; // share bfr for optimization purposes
|
||||
trg.ref_ignore = src.ref_ignore; // copy ref_ignore; needed for refs inside poem else duplicate refs; it.s:La_Secchia_rapita/Canto_primo; DATE:2015-12-03
|
||||
trg.references_group = src.references_group;
|
||||
trg.cur_page.Ref_mgr_(src.cur_page.Ref_mgr());
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.parsers.lnkis; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*;
|
||||
import gplx.core.btries.*; import gplx.core.primitives.*;
|
||||
import gplx.xowa.wikis.nss.*;
|
||||
import gplx.xowa.wikis.*; import gplx.xowa.parsers.lnkis.redlinks.*; import gplx.xowa.xtns.pfuncs.ttls.*; import gplx.xowa.xtns.relatedSites.*;
|
||||
import gplx.xowa.wikis.*; import gplx.xowa.parsers.lnkis.files.*; import gplx.xowa.xtns.pfuncs.ttls.*; import gplx.xowa.xtns.relatedSites.*;
|
||||
import gplx.xowa.parsers.tmpls.*; import gplx.xowa.parsers.miscs.*;
|
||||
public class Xop_lnki_wkr implements Xop_ctx_wkr, Xop_arg_wkr {
|
||||
private Arg_bldr arg_bldr = Arg_bldr.Instance;
|
||||
@@ -29,7 +29,7 @@ public class Xop_lnki_wkr implements Xop_ctx_wkr, Xop_arg_wkr {
|
||||
sites_regy_mgr = ctx.Wiki().Xtn_mgr().Xtn_sites().Regy_mgr(); if (!sites_regy_mgr.Xtn_mgr().Enabled()) sites_regy_mgr = null; // sets sites_xtn_mgr status for page; see below
|
||||
}
|
||||
public void Page_end(Xop_ctx ctx, Xop_root_tkn root, byte[] src, int src_len) {}
|
||||
public Xopg_redlink_logger File_wkr() {return file_wkr;} public Xop_lnki_wkr File_wkr_(Xopg_redlink_logger v) {file_wkr = v; return this;} private Xopg_redlink_logger file_wkr;
|
||||
public Xop_file_logger File_logger() {return lnki_logger;} public Xop_lnki_wkr File_logger_(Xop_file_logger v) {lnki_logger = v; return this;} private Xop_file_logger lnki_logger = Xop_file_logger_.Noop;
|
||||
public void Auto_close(Xop_ctx ctx, Xop_tkn_mkr tkn_mkr, Xop_root_tkn root, byte[] src, int src_len, int bgn_pos, int cur_pos, Xop_tkn_itm tkn) {
|
||||
Xop_lnki_tkn lnki = (Xop_lnki_tkn)tkn;
|
||||
lnki.Tkn_tid_to_txt();
|
||||
@@ -72,7 +72,7 @@ public class Xop_lnki_wkr implements Xop_ctx_wkr, Xop_arg_wkr {
|
||||
}
|
||||
if (lnki_is_file) {
|
||||
ctx.Page().Lnki_list().Add(lnki);
|
||||
if (file_wkr != null) file_wkr.Wkr_exec(ctx, src, lnki, gplx.xowa.bldrs.cmds.files.Xob_lnki_src_tid.Tid_file);
|
||||
lnki_logger.Log_file(ctx, lnki, Xop_file_logger_.Tid__file);
|
||||
}
|
||||
Xoa_ttl lnki_ttl = lnki.Ttl();
|
||||
if ( lnki_ttl.Wik_bgn() != -1 // lnki is xwiki
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
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.parsers.lnkis.files; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*; import gplx.xowa.parsers.lnkis.*;
|
||||
public interface Xop_file_logger {
|
||||
void Log_file(Xop_ctx ctx, Xop_lnki_tkn lnki, byte caller_tid);
|
||||
}
|
||||
class Xop_file_logger__noop implements Xop_file_logger {
|
||||
public void Log_file(Xop_ctx ctx, Xop_lnki_tkn lnki, byte caller_tid) {}
|
||||
}
|
||||
@@ -15,7 +15,8 @@ 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.parsers.lnkis.redlinks; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*; import gplx.xowa.parsers.lnkis.*;
|
||||
public interface Xopg_redlink_logger {
|
||||
void Wkr_exec(Xop_ctx ctx, byte[] src, Xop_lnki_tkn lnki, byte lnki_src_tid);
|
||||
package gplx.xowa.parsers.lnkis.files; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*; import gplx.xowa.parsers.lnkis.*;
|
||||
public class Xop_file_logger_ {
|
||||
public static final Xop_file_logger Noop = new Xop_file_logger__noop();
|
||||
public static final byte Tid__file = 0, Tid__media = 1, Tid__gallery = 2, Tid__imap = 3, Tid__pgbnr_main = 4;
|
||||
}
|
||||
50
400_xowa/src/gplx/xowa/parsers/tmpls/Xop_func_arg_itm.java
Normal file
50
400_xowa/src/gplx/xowa/parsers/tmpls/Xop_func_arg_itm.java
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
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.parsers.tmpls; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*;
|
||||
import gplx.xowa.xtns.pfuncs.*;
|
||||
public class Xop_func_arg_itm {
|
||||
public byte[] key;
|
||||
public byte[] val;
|
||||
public void Set(Bry_bfr bfr, Xop_ctx ctx, byte[] src, Xot_invk caller, Xot_invk self, Arg_nde_tkn arg) {
|
||||
Pf_func_.Eval_arg_or(bfr, ctx, src, caller, self, arg, null);
|
||||
key = val = Bry_.Empty;
|
||||
int len = bfr.Len(); byte[] bry = bfr.Bfr();
|
||||
int bgn = -1, end = -1; boolean mode_is_key = true;
|
||||
for (int i = 0; i < len; ++i) {
|
||||
byte b = bry[i];
|
||||
switch (b) {
|
||||
case Byte_ascii.Eq:
|
||||
if (mode_is_key) {
|
||||
mode_is_key = false;
|
||||
key = Bry_.Mid(bry, bgn, end);
|
||||
bgn = end = -1;
|
||||
}
|
||||
break;
|
||||
case Byte_ascii.Tab: case Byte_ascii.Nl: case Byte_ascii.Cr: case Byte_ascii.Space:
|
||||
break;
|
||||
default:
|
||||
if (bgn == -1) bgn = i;
|
||||
end = i + 1;
|
||||
break;
|
||||
}
|
||||
if (bgn != -1) // guard against 'key='
|
||||
val = Bry_.Mid(bry, bgn, end);
|
||||
}
|
||||
bfr.Clear();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user