mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
v1.7.2.1
This commit is contained in:
@@ -16,10 +16,11 @@ 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; import gplx.*;
|
||||
import gplx.core.btries.*;
|
||||
class Xop_nl_lxr implements Xop_lxr {
|
||||
public byte Lxr_tid() {return Xop_lxr_.Tid_nl;}
|
||||
public void Init_by_wiki(Xow_wiki wiki, ByteTrieMgr_fast core_trie) {core_trie.Add(Byte_ascii.NewLine, this);}
|
||||
public void Init_by_lang(Xol_lang lang, ByteTrieMgr_fast core_trie) {}
|
||||
public void Init_by_wiki(Xow_wiki wiki, Btrie_fast_mgr core_trie) {core_trie.Add(Byte_ascii.NewLine, this);}
|
||||
public void Init_by_lang(Xol_lang lang, 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) {
|
||||
if (bgn_pos == Xop_parser_.Doc_bgn_bos) return ctx.Lxr_make_txt_(cur_pos); // simulated nl at beginning of every parse
|
||||
int trim_category_pos = Scan_fwd_for_ctg(ctx, src, cur_pos, src_len);
|
||||
@@ -95,8 +96,8 @@ class Xop_nl_lxr implements Xop_lxr {
|
||||
if ( Bry_.Eq_itm(src, src_len, i + 1, Byte_ascii.Brack_bgn) // [[
|
||||
&& i + 2 < src_len) {
|
||||
int ttl_bgn = Bry_finder.Find_fwd_while(src, i + 2, src_len, Byte_ascii.Space);
|
||||
ByteTrieMgr_slim ctg_trie = ctx.Wiki().Ns_mgr().Category_trie();
|
||||
Object ctg_ns = ctg_trie.MatchAtCur(src, ttl_bgn, src_len);
|
||||
Btrie_slim_mgr ctg_trie = ctx.Wiki().Ns_mgr().Category_trie();
|
||||
Object ctg_ns = ctg_trie.Match_bgn(src, ttl_bgn, src_len);
|
||||
if (ctg_ns != null // "[[Category" found
|
||||
&& Bry_.Eq_itm(src, src_len, ctg_trie.Match_pos(), Byte_ascii.Colon)) { // check that next char is :
|
||||
return i;// return pos of 1st [
|
||||
|
||||
@@ -16,15 +16,16 @@ 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; import gplx.*;
|
||||
import gplx.core.btries.*;
|
||||
class Xop_nl_tab_lxr implements Xop_lxr {
|
||||
public byte Lxr_tid() {return Xop_lxr_.Tid_nl_tab;}
|
||||
public void Init_by_wiki(Xow_wiki wiki, ByteTrieMgr_fast core_trie) {core_trie.Add(Hook_nl_tab, this);} private static final byte[] Hook_nl_tab = new byte[] {Byte_ascii.NewLine, Byte_ascii.Tab};
|
||||
public void Init_by_lang(Xol_lang lang, ByteTrieMgr_fast core_trie) {}
|
||||
public void Init_by_wiki(Xow_wiki wiki, Btrie_fast_mgr core_trie) {core_trie.Add(Hook_nl_tab, this);} private static final byte[] Hook_nl_tab = new byte[] {Byte_ascii.NewLine, Byte_ascii.Tab};
|
||||
public void Init_by_lang(Xol_lang lang, 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) {
|
||||
int non_ws_pos = Bry_finder.Find_fwd_while_space_or_tab(src, cur_pos, src_len);
|
||||
if (non_ws_pos < src_len) { // bounds check
|
||||
ByteTrieMgr_slim tblw_trie = ctx.App().Utl_trie_tblw_ws();
|
||||
Object tblw_obj = tblw_trie.MatchAtCur(src, non_ws_pos, src_len);
|
||||
Btrie_slim_mgr tblw_trie = ctx.App().Utl_trie_tblw_ws();
|
||||
Object tblw_obj = tblw_trie.Match_bgn(src, non_ws_pos, src_len);
|
||||
if (tblw_obj != null) {
|
||||
Xop_tblw_ws_itm tblw_itm = (Xop_tblw_ws_itm)tblw_obj;
|
||||
byte itm_type = tblw_itm.Tblw_type();
|
||||
|
||||
@@ -156,7 +156,7 @@ public class Xop_para_wkr implements Xop_ctx_wkr {
|
||||
}
|
||||
public int Process_pre(Xop_ctx ctx, Xop_tkn_mkr tkn_mkr, Xop_root_tkn root, byte[] src, int src_len, int bgn_pos, int cur_pos, int txt_pos) {
|
||||
Dd_clear(ctx);
|
||||
Object o = ctx.App().Utl_trie_tblw_ws().MatchAtCur(src, txt_pos, src_len);
|
||||
Object o = ctx.App().Utl_trie_tblw_ws().Match_bgn(src, txt_pos, src_len);
|
||||
if (o != null) { // tblw_ws found
|
||||
Xop_tblw_ws_itm ws_itm = (Xop_tblw_ws_itm)o;
|
||||
byte tblw_type = ws_itm.Tblw_type();
|
||||
|
||||
@@ -16,10 +16,11 @@ 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; import gplx.*;
|
||||
import gplx.core.btries.*;
|
||||
class Xop_pre_lxr implements Xop_lxr {
|
||||
public byte Lxr_tid() {return Xop_lxr_.Tid_pre;}
|
||||
public void Init_by_wiki(Xow_wiki wiki, ByteTrieMgr_fast core_trie) {core_trie.Add(Hook_space, this);} // NOTE: do not treat \n\t as shorthand pre; EX:pl.w:Main_Page; DATE:2014-05-06
|
||||
public void Init_by_lang(Xol_lang lang, ByteTrieMgr_fast core_trie) {}
|
||||
public void Init_by_wiki(Xow_wiki wiki, Btrie_fast_mgr core_trie) {core_trie.Add(Hook_space, this);} // NOTE: do not treat \n\t as shorthand pre; EX:pl.w:Main_Page; DATE:2014-05-06
|
||||
public void Init_by_lang(Xol_lang lang, 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) {
|
||||
if (!ctx.Para().Enabled()) { // para disabled; "\n\s" should just be "\n\s"; NOTE: para disabled in <gallery>
|
||||
if (bgn_pos != Xop_parser_.Doc_bgn_bos) // don't add \n if BOS; EX: "<BOS> a" should be " ", not "\n "
|
||||
|
||||
Reference in New Issue
Block a user