1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00
This commit is contained in:
gnosygnu
2015-06-28 23:29:30 -04:00
parent bf44bcf3c6
commit d858b74d64
254 changed files with 2058 additions and 1191 deletions

View File

@@ -194,8 +194,8 @@ public class Xoa_ttl { // PAGE:en.w:http://en.wikipedia.org/wiki/Help:Link; REF.
qarg_bgn = -1; // always reset qarg; handles ttls which have question_mark which are premptively assumed to be qarg; PAGE:en.w:Portal:Organized_Labour/Did_You_Know?/1 DATE:2014-06-08
}
break; // flag last leaf_bgn
case Byte_ascii.NewLine: // NOTE: for now, treat nl just like space; not sure if it should accept "a\nb" or "\nab"; need to handle trailing \n for "Argentina\n\n" in {{Infobox settlement|pushpin_map=Argentina|pushpin_label_position=|pushpin_map_alt=|pushpin_map_caption=Location of Salta in Argentina}};
case Byte_ascii.Space: case Byte_ascii.Tab: case Byte_ascii.CarriageReturn: // added \t, \r; DATE:2013-03-27
case Byte_ascii.Nl: // NOTE: for now, treat nl just like space; not sure if it should accept "a\nb" or "\nab"; need to handle trailing \n for "Argentina\n\n" in {{Infobox settlement|pushpin_map=Argentina|pushpin_label_position=|pushpin_map_alt=|pushpin_map_caption=Location of Salta in Argentina}};
case Byte_ascii.Space: case Byte_ascii.Tab: case Byte_ascii.Cr: // added \t, \r; DATE:2013-03-27
case Byte_ascii.Underline:if (ltr_bgn != -1) add_ws = true; ++cur;//cur = ttlTrie.Match_pos();
continue; // only mark add_ws if ltr_seen; this ignores ws at bgn; also, note "continue"
case Byte_ascii.Question:
@@ -411,7 +411,7 @@ class Xoa_ttl_trie {
rv.Add(Byte_ascii.Underline , Byte_obj_val.new_(Id_underline));
rv.Add(Byte_ascii.Amp , Byte_obj_val.new_(Id_amp));
rv.Add(Xop_comm_lxr.Bgn_ary , Byte_obj_val.new_(Id_comment_bgn));
rv.Add(Byte_ascii.NewLine , Byte_obj_val.new_(Id_newLine));
rv.Add(Byte_ascii.Nl , Byte_obj_val.new_(Id_newLine));
rv.Add(Byte_ascii.Brack_bgn , Byte_obj_val.new_(Id_invalid));
rv.Add(Byte_ascii.Curly_bgn , Byte_obj_val.new_(Id_invalid));
return rv;

View File

@@ -23,7 +23,7 @@ public class Xop_ctx_ {
int src_len = src.length;
if (end > src_len) end = src_len;
byte[] rv = Bry_.Mid(src, bgn, end);
rv = Bry_.Replace(rv, Byte_ascii.NewLine, Byte_ascii.Tab); // change nl to tab so text editor will show one warning per line
rv = Bry_.Replace(rv, Byte_ascii.Nl, Byte_ascii.Tab); // change nl to tab so text editor will show one warning per line
return String_.new_u8(rv);
}
}

View File

@@ -27,7 +27,7 @@ class Xop_colon_lxr implements Xop_lxr {
int prv_pos = cur_pos -1 ;
if ( ctx.Cur_tkn_tid() != Xop_tkn_itm_.Tid_lnki // ignore if inside link
&& prv_pos > 0
&& src[prv_pos] != Byte_ascii.NewLine // only consider ":" which are not preceded by \n; DATE:2014-07-11 TODO: emulate Parser.php|findColonNoLinks which does much more logic to see if ";a:b" construct should apply
&& src[prv_pos] != Byte_ascii.Nl // only consider ":" which are not preceded by \n; DATE:2014-07-11 TODO: emulate Parser.php|findColonNoLinks which does much more logic to see if ";a:b" construct should apply
) {
listCtx.Dd_chk_(false);
return listCtx.MakeTkn_bgn(ctx, tkn_mkr, root, src, src_len, bgn_pos, cur_pos);

View File

@@ -116,7 +116,7 @@ public class Xop_parser { // NOTE: parsers are reused; do not keep any read-writ
ctx.Parse_tid_(parse_tid_old);
}
public int Parse_to_src_end(Xop_root_tkn root, Xop_ctx ctx, Xop_tkn_mkr tkn_mkr, byte[] src, Btrie_fast_mgr trie, int pos, int len) {
byte b = pos == -1 ? Byte_ascii.NewLine : src[pos]; // simulate newLine at bgn of src; needed for lxrs which rely on \n (EX: "=a=")
byte b = pos == -1 ? Byte_ascii.Nl : src[pos]; // simulate newLine at bgn of src; needed for lxrs which rely on \n (EX: "=a=")
int txt_bgn = pos == -1 ? 0 : pos; Xop_tkn_itm txt_tkn = null;
while (true) {
Object o = trie.Match_bgn_w_byte(b, src, pos, len);
@@ -137,7 +137,7 @@ public class Xop_parser { // NOTE: parsers are reused; do not keep any read-writ
return pos;
}
public int Parse_to_stack_end(Xop_root_tkn root, Xop_ctx ctx, Xop_tkn_mkr tkn_mkr, byte[] src, int src_len, Btrie_fast_mgr trie, int pos, int end) {
byte b = pos == -1 ? Byte_ascii.NewLine : src[pos]; // simulate newLine at bgn of src; needed for lxrs which rely on \n (EX: "=a=")
byte b = pos == -1 ? Byte_ascii.Nl : src[pos]; // simulate newLine at bgn of src; needed for lxrs which rely on \n (EX: "=a=")
int txt_bgn = pos == -1 ? 0 : pos; Xop_tkn_itm txt_tkn = null;
Xop_lxr lxr = null;
while (true) {

View File

@@ -92,7 +92,7 @@ class Xop_redirect_mgr_ {
public static int Get_kwd_end_or_end(byte[] src, int bgn, int end) { // get end of kwd
for (int i = bgn; i < end; ++i) {
switch (src[i]) {
case Byte_ascii.NewLine: case Byte_ascii.Space: case Byte_ascii.Tab:
case Byte_ascii.Nl: case Byte_ascii.Space: case Byte_ascii.Tab:
case Byte_ascii.Brack_bgn: case Byte_ascii.Colon:
return i; // ASSUME: kwd does not have these chars
default:
@@ -105,7 +105,7 @@ class Xop_redirect_mgr_ {
boolean colon_null = true;
for (int i = bgn; i < end; ++i) {
switch (src[i]) {
case Byte_ascii.NewLine: case Byte_ascii.Space: case Byte_ascii.Tab: break; // skip all ws
case Byte_ascii.Nl: case Byte_ascii.Space: case Byte_ascii.Tab: break; // skip all ws
case Byte_ascii.Colon: // allow 1 colon
if (colon_null)
colon_null = false;