mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
v2.6.5.1
This commit is contained in:
@@ -70,7 +70,7 @@ public class Xop_comm_lxr implements Xop_lxr {
|
||||
case Byte_ascii.Space:
|
||||
case Byte_ascii.Tab:
|
||||
break;
|
||||
case Byte_ascii.NewLine:
|
||||
case Byte_ascii.Nl:
|
||||
loop = false;
|
||||
nl_rhs = loop_pos;
|
||||
break;
|
||||
|
||||
@@ -24,7 +24,7 @@ public class Xop_cr_tkn extends Xop_tkn_itm_base {
|
||||
class Xop_cr_lxr implements Xop_lxr {
|
||||
public byte Lxr_tid() {return Xop_lxr_.Tid_cr;}
|
||||
public void Init_by_wiki(Xowe_wiki wiki, Btrie_fast_mgr core_trie) {
|
||||
core_trie.Add(Byte_ascii.CarriageReturn, this);
|
||||
core_trie.Add(Byte_ascii.Cr, 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) {
|
||||
|
||||
@@ -31,12 +31,12 @@ class Xop_eq_lxr implements Xop_lxr {
|
||||
if ( owner != null && owner.Tkn_tid() == Xop_tkn_itm_.Tid_tmpl_curly_bgn // inside curly
|
||||
&& eq_len > 1) { // only skip if at least "=="; don't want to skip "=" which could be kv delimiter; DATE:2014-04-17
|
||||
int prv_pos = bgn_pos - 1;
|
||||
if (prv_pos > -1 && src[prv_pos] == Byte_ascii.NewLine) // is prv char \n; EX: "\n==="
|
||||
if (prv_pos > -1 && src[prv_pos] == Byte_ascii.Nl) // is prv char \n; EX: "\n==="
|
||||
hdr_like = true;
|
||||
else {
|
||||
int eol_pos = Bry_finder.Find_fwd_while_space_or_tab(src, cur_pos, src_len); // skip trailing ws; EX: "== \n"; PAGE:nl.q:Geert_Wilders; DATE:2014-06-05
|
||||
if ( eol_pos == src_len // eos
|
||||
|| src[eol_pos] == Byte_ascii.NewLine // cur_pos is \n; EX: "===\n"
|
||||
|| src[eol_pos] == Byte_ascii.Nl // cur_pos is \n; EX: "===\n"
|
||||
) {
|
||||
hdr_like = true;
|
||||
cur_pos = eol_pos;
|
||||
@@ -56,7 +56,7 @@ class Xop_eq_lxr implements Xop_lxr {
|
||||
return cur_pos;
|
||||
}
|
||||
int ws_end = Bry_finder.Find_fwd_while_space_or_tab(src, cur_pos, src_len);
|
||||
hdr_like = ws_end == src_len || src[ws_end] == Byte_ascii.NewLine; // hdr_like if next char \n or eos
|
||||
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
|
||||
@@ -64,7 +64,7 @@ class Xop_eq_lxr implements Xop_lxr {
|
||||
if (ctg_end != Bry_.NotFound) { // ]] 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_finder.Find_fwd_while_space_or_tab(src, ctg_end, src_len);
|
||||
if (ctg_end == src_len || src[ctg_end] == Byte_ascii.NewLine) // hdr_like if ]]\n after [[Category:A]]
|
||||
if (ctg_end == src_len || src[ctg_end] == Byte_ascii.Nl) // hdr_like if ]]\n after [[Category:A]]
|
||||
hdr_like = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ package gplx.xowa; import gplx.*;
|
||||
import gplx.core.btries.*;
|
||||
public class Xop_hr_lxr implements Xop_lxr {
|
||||
public byte Lxr_tid() {return Xop_lxr_.Tid_hr;}
|
||||
public void Init_by_wiki(Xowe_wiki wiki, Btrie_fast_mgr parse_trie) {parse_trie.Add(Hook_ary, this);} static final byte[] Hook_ary = new byte[] {Byte_ascii.NewLine, Byte_ascii.Dash, Byte_ascii.Dash, Byte_ascii.Dash, Byte_ascii.Dash};
|
||||
public void Init_by_wiki(Xowe_wiki wiki, Btrie_fast_mgr parse_trie) {parse_trie.Add(Hook_ary, this);} static final byte[] Hook_ary = new byte[] {Byte_ascii.Nl, Byte_ascii.Dash, Byte_ascii.Dash, Byte_ascii.Dash, Byte_ascii.Dash};
|
||||
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 nl_adj = -1; // -1 to ignore nl at bgn for hr_len
|
||||
|
||||
@@ -31,7 +31,7 @@ public class Xop_under_lxr_tst {
|
||||
fxt.Test_parse_page_all_str("a__toc__b", "ab");
|
||||
}
|
||||
@Test public void Notoc_basic() {
|
||||
fxt.Wtr_cfg().Toc_show_(true); // NOTE: must enable in order for TOC to show (and to make sure NOTOC suppresses)
|
||||
fxt.Wtr_cfg().Toc__show_(Bool_.Y); // NOTE: must enable in order for TOC to show (and to make sure NOTOC suppresses)
|
||||
fxt.Test_parse_page_all_str(String_.Concat_lines_nl
|
||||
( "__NOTOC__"
|
||||
, "==a=="
|
||||
@@ -47,7 +47,7 @@ public class Xop_under_lxr_tst {
|
||||
, ""
|
||||
, "<h2><span class='mw-headline' id='d'>d</span></h2>"
|
||||
));
|
||||
fxt.Wtr_cfg().Toc_show_(false);
|
||||
fxt.Wtr_cfg().Toc__show_(Bool_.N);
|
||||
}
|
||||
@Test public void Ignore_pre() {
|
||||
fxt.Init_para_y_();
|
||||
|
||||
Reference in New Issue
Block a user