mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
v2.11.1.1
This commit is contained in:
@@ -16,6 +16,7 @@ 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.miscs; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*;
|
||||
import gplx.core.log_msgs.*;
|
||||
public class Xop_comm_log {
|
||||
private static final Gfo_msg_grp owner = Gfo_msg_grp_.new_(Xoa_app_.Nde, "comment");
|
||||
public static final Gfo_msg_itm
|
||||
|
||||
@@ -61,9 +61,9 @@ public class Xop_eq_lxr implements Xop_lxr {
|
||||
hdr_like = ws_end == src_len || src[ws_end] == Byte_ascii.Nl; // hdr_like if next char \n or eos
|
||||
if (!hdr_like) {
|
||||
int ctg_end = Xop_nl_lxr.Scan_fwd_for_ctg(ctx, src, cur_pos, src_len); // check if ==[[Category:A]]; DATE:2014-04-17
|
||||
if ( ctg_end != Bry_.NotFound) { // [[Category: found
|
||||
if ( ctg_end != Bry_find_.Not_found) { // [[Category: found
|
||||
ctg_end = Bry_find_.Find_fwd(src, Xop_tkn_.Lnki_end, ctg_end, src_len);
|
||||
if (ctg_end != Bry_.NotFound) { // ]] found; note that this should do more validation; EX: [[Category:]] should not be valid; DATE:2014-04-17
|
||||
if (ctg_end != Bry_find_.Not_found) { // ]] found; note that this should do more validation; EX: [[Category:]] should not be valid; DATE:2014-04-17
|
||||
ctg_end += Xop_tkn_.Lnki_end_len;
|
||||
ctg_end = Bry_find_.Find_fwd_while_space_or_tab(src, ctg_end, src_len);
|
||||
if (ctg_end == src_len || src[ctg_end] == Byte_ascii.Nl) // hdr_like if ]]\n after [[Category:A]]
|
||||
|
||||
@@ -1,35 +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.parsers.miscs; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*;
|
||||
import gplx.core.btries.*; import gplx.xowa.langs.*;
|
||||
public class Xop_macro_lxr implements Xop_lxr {
|
||||
public Xop_macro_lxr() {}
|
||||
public int Lxr_tid() {return Xop_lxr_.Tid_macro;}
|
||||
public void Init_by_wiki(Xowe_wiki wiki, Btrie_fast_mgr core_trie) {core_trie.Add(Byte_ascii.Tab, this); core_trie.Add(Xop_tab_tkn.Bry_tab_ent, this);}
|
||||
public void Init_by_lang(Xol_lang_itm lang, Btrie_fast_mgr core_trie) {}
|
||||
public void Term(Btrie_fast_mgr core_trie) {}
|
||||
public int Make_tkn(Xop_ctx ctx, Xop_tkn_mkr tkn_mkr, Xop_root_tkn root, byte[] src, int src_len, int bgn_pos, int cur_pos) {
|
||||
cur_pos = Bry_find_.Find_fwd_while(src, cur_pos, src_len, Byte_ascii.Tab);
|
||||
src[bgn_pos] = Byte_ascii.Tab; // HACK: SEE:NOTE_1:tabs
|
||||
for (int i = bgn_pos + 1; i < cur_pos; i++)
|
||||
src[i] = Byte_ascii.Space;
|
||||
ctx.Subs_add(root, tkn_mkr.Tab(bgn_pos, cur_pos));
|
||||
return cur_pos;
|
||||
}
|
||||
public static final Xop_tab_lxr Instance = new Xop_tab_lxr();
|
||||
}
|
||||
@@ -16,6 +16,7 @@ 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.miscs; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*;
|
||||
import gplx.core.log_msgs.*;
|
||||
public class Xop_misc_log {
|
||||
private static final Gfo_msg_grp owner = Gfo_msg_grp_.new_(Xoa_app_.Nde, "super");
|
||||
public static final Gfo_msg_itm
|
||||
|
||||
@@ -17,12 +17,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.parsers.miscs; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*;
|
||||
import gplx.core.btries.*; import gplx.xowa.parsers.tmpls.*;
|
||||
import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.htmls.*;
|
||||
public class Xop_space_tkn extends Xop_tkn_itm_base {
|
||||
public Xop_space_tkn(boolean immutable, int bgn, int end) {this.Tkn_ini_pos(immutable, bgn, end);}
|
||||
@Override public byte Tkn_tid() {return Xop_tkn_itm_.Tid_space;}
|
||||
@Override public Xop_tkn_itm Tkn_clone(Xop_ctx ctx, int bgn, int end) {
|
||||
return ctx.Tkn_mkr().Space_mutable(bgn, end);
|
||||
}
|
||||
public Xop_space_tkn(boolean immutable, int bgn, int end) {this.Tkn_ini_pos(immutable, bgn, end);}
|
||||
@Override public byte Tkn_tid() {return Xop_tkn_itm_.Tid_space;}
|
||||
@Override public Xop_tkn_itm Tkn_clone(Xop_ctx ctx, int bgn, int end) {return ctx.Tkn_mkr().Space_mutable(bgn, end);}
|
||||
@Override public boolean Tmpl_evaluate(Xop_ctx ctx, byte[] src, Xot_invk caller, Bry_bfr bfr) {
|
||||
if (this.Tkn_immutable()) {
|
||||
bfr.Add_byte(Byte_ascii.Space);
|
||||
@@ -31,5 +30,7 @@ public class Xop_space_tkn extends Xop_tkn_itm_base {
|
||||
else
|
||||
return super.Tmpl_evaluate(ctx, src, caller, bfr);
|
||||
}
|
||||
Xop_space_tkn() {}
|
||||
@Override public void Html__write(Bry_bfr bfr, Xoh_html_wtr wtr, Xowe_wiki wiki, Xoae_page page, Xop_ctx ctx, Xoh_wtr_ctx hctx, Xoh_html_wtr_cfg cfg, Xop_tkn_grp grp, int sub_idx, byte[] src) {
|
||||
bfr.Add_byte_repeat(Byte_ascii.Space, this.Src_end_grp(grp, sub_idx) - this.Src_bgn_grp(grp, sub_idx)); // NOTE: lnki.caption will convert \n to \s; see Xop_nl_lxr; PAGE:en.w:Schwarzschild radius
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user