mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
Xomw: Change Php classes to Xophp; move to root namespace
This commit is contained in:
@@ -16,7 +16,6 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
package gplx.xowa.mediawiki.includes.parsers; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*; import gplx.xowa.mediawiki.includes.*;
|
||||
import gplx.core.btries.*;
|
||||
import gplx.langs.htmls.*;
|
||||
import gplx.xowa.mediawiki.includes.utls.*;
|
||||
public class Xomw_block_level_pass {
|
||||
private final Bry_bfr tmp = Bry_bfr_.New();
|
||||
private final Btrie_rv trv = new Btrie_rv();
|
||||
@@ -106,8 +105,8 @@ public class Xomw_block_level_pass {
|
||||
// If not in a <pre> element, scan for and figure out what prefixes are there.
|
||||
if (!in_pre) {
|
||||
// Multiple prefixes may abut each other for nested lists.
|
||||
prefix_len = Php_str_.Strspn_fwd__ary(src, block_chars_ary, line_bgn, line_end, line_end); // strspn($oLine, '*#:;');
|
||||
prefix = Php_str_.Substr(src, line_bgn, prefix_len);
|
||||
prefix_len = XophpString.strspn_fwd__ary(src, block_chars_ary, line_bgn, line_end, line_end); // strspn($oLine, '*#:;');
|
||||
prefix = XophpString.substr(src, line_bgn, prefix_len);
|
||||
|
||||
// eh?
|
||||
// ; and : are both from definition-lists, so they're equivalent
|
||||
@@ -130,7 +129,7 @@ public class Xomw_block_level_pass {
|
||||
int common_prefix_len = -1;
|
||||
if (prefix_len > 0 && Bry_.Eq(last_prefix, prefix2)) {
|
||||
// Same as the last item, so no need to deal with nesting or opening stuff
|
||||
bfr.Add(Next_item(Php_str_.Substr_byte(prefix, -1)));
|
||||
bfr.Add(Next_item(XophpString.substr_byte(prefix, -1)));
|
||||
para_stack = Para_stack__none;
|
||||
|
||||
if (prefix_len > 0 && prefix[prefix_len - 1] == Byte_ascii.Semic) {
|
||||
@@ -170,7 +169,7 @@ public class Xomw_block_level_pass {
|
||||
bfr.Add_byte_nl();
|
||||
}
|
||||
while (prefix_len > common_prefix_len) {
|
||||
byte c = Php_str_.Substr_byte(prefix, common_prefix_len, 1);
|
||||
byte c = XophpString.substr_byte(prefix, common_prefix_len, 1);
|
||||
bfr.Add(Open_list(c));
|
||||
|
||||
if (c == Byte_ascii.Semic) {
|
||||
@@ -195,8 +194,8 @@ public class Xomw_block_level_pass {
|
||||
// No prefix (not in list)--go to paragraph mode
|
||||
// XXX: use a stack for nestable elements like span, table and div
|
||||
int t_len = t.length;
|
||||
boolean open_match = Php_preg_.Match(open_match_trie, trv, t, 0, t_len) != null;
|
||||
boolean close_match = Php_preg_.Match(close_match_trie, trv, t, 0, t_len) != null;
|
||||
boolean open_match = XophpPreg.match(open_match_trie, trv, t, 0, t_len) != null;
|
||||
boolean close_match = XophpPreg.match(close_match_trie, trv, t, 0, t_len) != null;
|
||||
|
||||
if (open_match || close_match) {
|
||||
para_stack = Para_stack__none;
|
||||
@@ -208,7 +207,7 @@ public class Xomw_block_level_pass {
|
||||
int bq_offset = 0;
|
||||
// PORTED:preg_match('/<(\\/?)blockquote[\s>]/i', t, $bqMatch, PREG_OFFSET_CAPTURE, $bq_offset)
|
||||
while (true) {
|
||||
Object o = Php_preg_.Match(blockquote_trie, trv, t, bq_offset, t_len);
|
||||
Object o = XophpPreg.match(blockquote_trie, trv, t, bq_offset, t_len);
|
||||
if (o == null) { // no more blockquotes found; exit
|
||||
break;
|
||||
}
|
||||
@@ -221,7 +220,7 @@ public class Xomw_block_level_pass {
|
||||
in_block_elem = !close_match;
|
||||
}
|
||||
else if (!in_block_elem && !in_pre) {
|
||||
if ( Php_str_.Substr_byte(t, 0) == Byte_ascii.Space
|
||||
if ( XophpString.substr_byte(t, 0) == Byte_ascii.Space
|
||||
&& (last_section == Last_section__pre || Bry_.Trim(t) != Bry_.Empty)
|
||||
&& !in_blockquote
|
||||
) {
|
||||
@@ -391,17 +390,17 @@ public class Xomw_block_level_pass {
|
||||
// to prevent illegal overlapping.
|
||||
private int Find_colon_no_links(byte[] str, byte[] before, byte[] after) {
|
||||
int len = str.length;
|
||||
int colon_pos = Php_str_.Strpos(str, Byte_ascii.Colon, 0, len);
|
||||
int colon_pos = XophpString.strpos(str, Byte_ascii.Colon, 0, len);
|
||||
if (colon_pos == Bry_find_.Not_found) {
|
||||
// Nothing to find!
|
||||
return Bry_find_.Not_found;
|
||||
}
|
||||
|
||||
int lt_pos = Php_str_.Strpos(str, Byte_ascii.Angle_bgn, 0, len);
|
||||
int lt_pos = XophpString.strpos(str, Byte_ascii.Angle_bgn, 0, len);
|
||||
if (lt_pos == Bry_find_.Not_found || lt_pos > colon_pos) {
|
||||
// Easy; no tag nesting to worry about
|
||||
find_colon_no_links__before = Php_str_.Substr(str, 0, colon_pos);
|
||||
find_colon_no_links__after = Php_str_.Substr(str, colon_pos + 1);
|
||||
find_colon_no_links__before = XophpString.substr(str, 0, colon_pos);
|
||||
find_colon_no_links__after = XophpString.substr(str, colon_pos + 1);
|
||||
return colon_pos;
|
||||
}
|
||||
|
||||
@@ -421,25 +420,25 @@ public class Xomw_block_level_pass {
|
||||
case Byte_ascii.Colon:
|
||||
if (level == 0) {
|
||||
// We found it!
|
||||
find_colon_no_links__before = Php_str_.Substr(str, 0, i);
|
||||
find_colon_no_links__after = Php_str_.Substr(str, i + 1);
|
||||
find_colon_no_links__before = XophpString.substr(str, 0, i);
|
||||
find_colon_no_links__after = XophpString.substr(str, i + 1);
|
||||
return i;
|
||||
}
|
||||
// Embedded in a tag; don't break it.
|
||||
break;
|
||||
default:
|
||||
// Skip ahead looking for something interesting
|
||||
colon_pos = Php_str_.Strpos(str, Byte_ascii.Colon, i, len);
|
||||
colon_pos = XophpString.strpos(str, Byte_ascii.Colon, i, len);
|
||||
if (colon_pos == Bry_find_.Not_found) {
|
||||
// Nothing else interesting
|
||||
return Bry_find_.Not_found;
|
||||
}
|
||||
lt_pos = Php_str_.Strpos(str, Byte_ascii.Angle_bgn, i, len);
|
||||
lt_pos = XophpString.strpos(str, Byte_ascii.Angle_bgn, i, len);
|
||||
if (level == 0) {
|
||||
if (lt_pos == Bry_find_.Not_found || colon_pos < lt_pos) {
|
||||
// We found it!
|
||||
find_colon_no_links__before = Php_str_.Substr(str, 0, colon_pos);
|
||||
find_colon_no_links__after = Php_str_.Substr(str, colon_pos + 1);
|
||||
find_colon_no_links__before = XophpString.substr(str, 0, colon_pos);
|
||||
find_colon_no_links__after = XophpString.substr(str, colon_pos + 1);
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ import gplx.core.btries.*; import gplx.core.net.*;
|
||||
import gplx.xowa.mediawiki.includes.parsers.prepros.*; import gplx.xowa.mediawiki.includes.parsers.headings.*;
|
||||
import gplx.xowa.mediawiki.includes.parsers.quotes.*; import gplx.xowa.mediawiki.includes.parsers.tables.*; import gplx.xowa.mediawiki.includes.parsers.hrs.*; import gplx.xowa.mediawiki.includes.parsers.nbsps.*;
|
||||
import gplx.xowa.mediawiki.includes.parsers.lnkes.*; import gplx.xowa.mediawiki.includes.parsers.lnkis.*; import gplx.xowa.mediawiki.includes.parsers.magiclinks.*; import gplx.xowa.mediawiki.includes.parsers.doubleunders.*;
|
||||
import gplx.xowa.mediawiki.includes.utls.*; import gplx.xowa.mediawiki.includes.linkers.*;
|
||||
import gplx.xowa.mediawiki.includes.linkers.*;
|
||||
import gplx.xowa.mediawiki.includes.htmls.*;
|
||||
public class Xomw_parser implements XomwParserIface {
|
||||
private final Xomw_parser_ctx pctx = new Xomw_parser_ctx();
|
||||
|
||||
@@ -14,7 +14,6 @@ GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.xowa.mediawiki.includes.parsers.hrs; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*; import gplx.xowa.mediawiki.includes.*; import gplx.xowa.mediawiki.includes.parsers.*;
|
||||
import gplx.xowa.mediawiki.includes.utls.*;
|
||||
public class Xomw_hr_wkr {// THREAD.UNSAFE: caching for repeated calls
|
||||
private Bry_bfr bfr;
|
||||
public void replaceHrs(Xomw_parser_ctx pctx, Xomw_parser_bfr pbfr) { // REF.MW: text = preg_replace('/(^|\n)-----*/', '\\1<hr />', text);
|
||||
|
||||
@@ -15,7 +15,6 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.xowa.mediawiki.includes.parsers.lnkes; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*; import gplx.xowa.mediawiki.includes.*; import gplx.xowa.mediawiki.includes.parsers.*;
|
||||
import gplx.core.btries.*; import gplx.core.primitives.*;
|
||||
import gplx.xowa.mediawiki.includes.utls.*;
|
||||
import gplx.xowa.mediawiki.includes.htmls.*;
|
||||
/* TODO.XO
|
||||
* P3: $langObj->formatNum( ++$this->mAutonumber );
|
||||
@@ -165,7 +164,7 @@ public class Xomw_lnke_wkr {// THREAD.UNSAFE: caching for repeated calls
|
||||
// The characters '<' and '>' (which were escaped by
|
||||
// removeHTMLtags()) should not be included in
|
||||
// URLs, per RFC 2396.
|
||||
if (Php_preg_.Match(angle_entities_trie, trv, src, url_bgn, url_end) != null) {
|
||||
if (XophpPreg.match(angle_entities_trie, trv, src, url_bgn, url_end) != null) {
|
||||
int angle_bgn = trv.Match_bgn;
|
||||
text_bgn = angle_bgn;
|
||||
url_end = angle_bgn;
|
||||
|
||||
@@ -15,7 +15,6 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.xowa.mediawiki.includes.parsers.lnkis; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*; import gplx.xowa.mediawiki.includes.*; import gplx.xowa.mediawiki.includes.parsers.*;
|
||||
import gplx.core.btries.*; import gplx.core.primitives.*;
|
||||
import gplx.xowa.mediawiki.includes.utls.*;
|
||||
import gplx.xowa.wikis.nss.*; import gplx.xowa.wikis.xwikis.*;
|
||||
import gplx.xowa.mediawiki.includes.parsers.*; import gplx.xowa.mediawiki.includes.parsers.quotes.*;
|
||||
import gplx.xowa.mediawiki.includes.htmls.*; import gplx.xowa.mediawiki.includes.linkers.*;
|
||||
@@ -70,7 +69,7 @@ public class Xomw_lnki_wkr {// THREAD.UNSAFE: caching for repeated calls
|
||||
this.env = env;
|
||||
this.wiki = wiki;
|
||||
if (title_chars_for_lnki == null) {
|
||||
title_chars_for_lnki = (boolean[])Array_.Clone(Xomw_ttl_utl.Title_chars_valid());
|
||||
title_chars_for_lnki = (boolean[])Array_.Clone(XomwTitle.Title_chars_valid());
|
||||
// the % is needed to support urlencoded titles as well
|
||||
title_chars_for_lnki[Byte_ascii.Hash] = true;
|
||||
title_chars_for_lnki[Byte_ascii.Percent] = true;
|
||||
@@ -156,7 +155,7 @@ public class Xomw_lnki_wkr {// THREAD.UNSAFE: caching for repeated calls
|
||||
// PORTED.BGN: if (preg_match($e1, $line, $m)) && else if (preg_match($e1_img, $line, $m))
|
||||
// NOTE: both e1 and e1_img are effectively the same; e1_img allows nested "[["; EX: "[[A|b[[c]]d]]" will stop at "[[A|b"
|
||||
int ttl_bgn = cur;
|
||||
int ttl_end = Xomw_ttl_utl.Find_fwd_while_title(src, cur, src_end, title_chars_for_lnki);
|
||||
int ttl_end = XomwTitle.Find_fwd_while_title(src, cur, src_end, title_chars_for_lnki);
|
||||
cur = ttl_end;
|
||||
int capt_bgn = -1, capt_end = -1;
|
||||
int nxt_lnki = -1;
|
||||
@@ -590,7 +589,7 @@ public class Xomw_lnki_wkr {// THREAD.UNSAFE: caching for repeated calls
|
||||
break;
|
||||
default:
|
||||
// Most other things appear to be empty or numeric...
|
||||
validated = (val == null || Php_utl_.isnumeric(Bry_.Trim(val)));
|
||||
validated = (val == null || XophpUtility.isnumeric(Bry_.Trim(val)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -725,7 +724,7 @@ public class Xomw_lnki_wkr {// THREAD.UNSAFE: caching for repeated calls
|
||||
// Parsed a width param of imagelink like 300px or 200x300px
|
||||
// XO.MW.NOTE: for MW, "" -> null, null while "AxB" -> 0x0
|
||||
public void parseWidthParam(int[] img_size, byte[] src) {
|
||||
img_size[0] = img_size[1] = Php_utl_.Null_int;
|
||||
img_size[0] = img_size[1] = XophpUtility.Null_int;
|
||||
if (src == Bry_.Empty) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.xowa.mediawiki.includes.parsers.lnkis; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*; import gplx.xowa.mediawiki.includes.*; import gplx.xowa.mediawiki.includes.parsers.*;
|
||||
import gplx.xowa.mediawiki.includes.utls.*;
|
||||
public class Xomw_params_frame {
|
||||
public byte[] align = null;
|
||||
public byte[] valign = null;
|
||||
@@ -45,12 +44,12 @@ public class Xomw_params_frame {
|
||||
}
|
||||
public Xomw_params_frame Clear() {
|
||||
desc_link = false;
|
||||
upright = Php_utl_.Null_double;
|
||||
upright = XophpUtility.Null_double;
|
||||
align = valign = caption = frame = framed = frameless
|
||||
= thumbnail = manualthumb = alt = title = cls = img_cls
|
||||
= link_title = link_url = link_target = no_link
|
||||
= custom_url_link = custom_target_link = desc_query
|
||||
= Php_utl_.Null_bry;
|
||||
= XophpUtility.Null_bry;
|
||||
return this;
|
||||
}
|
||||
public void Copy_to(Xomw_params_frame src) {
|
||||
|
||||
@@ -14,7 +14,6 @@ GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.xowa.mediawiki.includes.parsers.lnkis; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*; import gplx.xowa.mediawiki.includes.*; import gplx.xowa.mediawiki.includes.parsers.*;
|
||||
import gplx.xowa.mediawiki.includes.utls.*;
|
||||
public class Xomw_params_handler {
|
||||
public int width;
|
||||
public int height;
|
||||
@@ -23,7 +22,7 @@ public class Xomw_params_handler {
|
||||
public int physicalHeight;
|
||||
public Xomw_params_handler Clear() {
|
||||
width = height = page
|
||||
= physicalWidth = physicalHeight = Php_utl_.Null_int;
|
||||
= physicalWidth = physicalHeight = XophpUtility.Null_int;
|
||||
return this;
|
||||
}
|
||||
public void Copy_to(Xomw_params_handler src) {
|
||||
|
||||
@@ -14,7 +14,6 @@ GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.xowa.mediawiki.includes.parsers.lnkis; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*; import gplx.xowa.mediawiki.includes.*; import gplx.xowa.mediawiki.includes.parsers.*;
|
||||
import gplx.xowa.mediawiki.includes.utls.*;
|
||||
public class Xomw_params_scalar {
|
||||
public int physicalWidth;
|
||||
public int physicalHeight;
|
||||
@@ -29,6 +28,6 @@ public class Xomw_params_scalar {
|
||||
public byte[] dstUrl;
|
||||
public byte[] interlace;
|
||||
public Xomw_params_scalar() {
|
||||
physicalWidth = physicalHeight = clientWidth = clientHeight = srcWidth = srcHeight = Php_utl_.Null_int;
|
||||
physicalWidth = physicalHeight = clientWidth = clientHeight = srcWidth = srcHeight = XophpUtility.Null_int;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.xowa.mediawiki.includes.parsers.magiclinks; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*; import gplx.xowa.mediawiki.includes.*; import gplx.xowa.mediawiki.includes.parsers.*;
|
||||
import gplx.core.primitives.*; import gplx.core.btries.*; import gplx.core.net.*;
|
||||
import gplx.xowa.mediawiki.includes.utls.*; import gplx.xowa.mediawiki.includes.htmls.*;
|
||||
import gplx.xowa.mediawiki.includes.htmls.*;
|
||||
import gplx.langs.regxs.*;
|
||||
// TODO.XO: this->getConverterLanguage()->markNoConversion($url, true),
|
||||
public class Xomw_magiclinks_wkr {
|
||||
@@ -224,12 +224,12 @@ public class Xomw_magiclinks_wkr {
|
||||
// XO.MW: if (strpos($url, '(') === false) {$sep .= ')';}
|
||||
url_separators[Byte_ascii.Paren_end] = Bry_find_.Find_fwd(url, Byte_ascii.Paren_bgn, 0, url_len) == Bry_find_.Not_found;
|
||||
|
||||
int num_sep_chars = Php_str_.Strspn_bwd__ary(url, url_separators, url_len, -1);
|
||||
int num_sep_chars = XophpString.strspn_bwd__ary(url, url_separators, url_len, -1);
|
||||
// Don't break a trailing HTML entity by moving the ; into $trail
|
||||
// This is in hot code, so use substr_compare to avoid having to
|
||||
// create a new String Object for the comparison
|
||||
// XO.MW.NOTE: ignore semic if part of entity; EX: "http://a.org'!."
|
||||
if (num_sep_chars > 0 && Php_str_.Substr_byte(url, -num_sep_chars) == Byte_ascii.Semic) {
|
||||
if (num_sep_chars > 0 && XophpString.substr_byte(url, -num_sep_chars) == Byte_ascii.Semic) {
|
||||
// more optimization: instead of running preg_match with a $
|
||||
// anchor, which can be slow, do the match on the reversed
|
||||
// String starting at the desired offset.
|
||||
@@ -241,8 +241,8 @@ public class Xomw_magiclinks_wkr {
|
||||
}
|
||||
|
||||
if (num_sep_chars > 0) {
|
||||
trail = Bry_.Add(Php_str_.Substr(url, -num_sep_chars), trail);
|
||||
url = Php_str_.Substr(url, 0, -num_sep_chars);
|
||||
trail = Bry_.Add(XophpString.substr(url, -num_sep_chars), trail);
|
||||
url = XophpString.substr(url, 0, -num_sep_chars);
|
||||
}
|
||||
|
||||
// Verify that we still have a real URL after trail removal, and
|
||||
|
||||
@@ -15,7 +15,6 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.xowa.mediawiki.includes.parsers.prepros; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*; import gplx.xowa.mediawiki.includes.*; import gplx.xowa.mediawiki.includes.parsers.*;
|
||||
import gplx.core.btries.*;
|
||||
import gplx.xowa.mediawiki.includes.utls.*;
|
||||
public class Xomw_prepro_wkr { // THREAD.UNSAFE: caching for repeated calls
|
||||
private final Bry_bfr tmp_bfr = Bry_bfr_.New();
|
||||
private final List_adp comments_list = List_adp_.New();
|
||||
@@ -287,11 +286,11 @@ public class Xomw_prepro_wkr { // THREAD.UNSAFE: caching for repeated calls
|
||||
}
|
||||
else {
|
||||
// Search backwards for leading whitespace
|
||||
int ws_bgn = i > 0 ? i - Php_str_.Strspn_bwd__space_or_tab(src, i, -1) : 0;
|
||||
int ws_bgn = i > 0 ? i - XophpString.strspn_bwd__space_or_tab(src, i, -1) : 0;
|
||||
|
||||
// Search forwards for trailing whitespace
|
||||
// $wsEnd will be the position of the last space (or the '>' if there's none)
|
||||
int ws_end = end_pos + 2 + Php_str_.Strspn_fwd__space_or_tab(src, end_pos + 3, -1, src_len);
|
||||
int ws_end = end_pos + 2 + XophpString.strspn_fwd__space_or_tab(src, end_pos + 3, -1, src_len);
|
||||
|
||||
// Keep looking forward as long as we're finding more
|
||||
// comments.
|
||||
@@ -302,7 +301,7 @@ public class Xomw_prepro_wkr { // THREAD.UNSAFE: caching for repeated calls
|
||||
if (cur_char_pos == Bry_find_.Not_found) {
|
||||
break;
|
||||
}
|
||||
cur_char_pos = cur_char_pos + 2 + Php_str_.Strspn_fwd__space_or_tab(src, cur_char_pos + 3, -1, src_len);
|
||||
cur_char_pos = cur_char_pos + 2 + XophpString.strspn_fwd__space_or_tab(src, cur_char_pos + 3, -1, src_len);
|
||||
comments_list.Add(new int[] {ws_end + 1, cur_char_pos});
|
||||
ws_end = cur_char_pos;
|
||||
}
|
||||
@@ -321,7 +320,7 @@ public class Xomw_prepro_wkr { // THREAD.UNSAFE: caching for repeated calls
|
||||
int ws_len = i - ws_bgn;
|
||||
int accum_len = accum.Len();
|
||||
if ( ws_len > 0
|
||||
&& Php_str_.Strspn_fwd__space_or_tab(accum.Bfr(), accum_len - ws_len, -1, accum_len) == ws_len) {
|
||||
&& XophpString.strspn_fwd__space_or_tab(accum.Bfr(), accum_len - ws_len, -1, accum_len) == ws_len) {
|
||||
accum.Del_by(ws_len);
|
||||
}
|
||||
|
||||
@@ -487,7 +486,7 @@ public class Xomw_prepro_wkr { // THREAD.UNSAFE: caching for repeated calls
|
||||
i++;
|
||||
}
|
||||
|
||||
int count = Php_str_.Strspn_fwd__byte(src, Byte_ascii.Eq, i, 6, src_len);
|
||||
int count = XophpString.strspn_fwd__byte(src, Byte_ascii.Eq, i, 6, src_len);
|
||||
if (count == 1 && find_equals) { // EX: "{{a|\n=b=\n"
|
||||
// DWIM: This looks kind of like a name/value separator.
|
||||
// Let's let the equals handler have it and break the
|
||||
@@ -516,7 +515,7 @@ public class Xomw_prepro_wkr { // THREAD.UNSAFE: caching for repeated calls
|
||||
// Search back through the input to see if it has a proper close.
|
||||
// Do this using the reversed String since the other solutions
|
||||
// (end anchor, etc.) are inefficient.
|
||||
int ws_len = Php_str_.Strspn_bwd__space_or_tab(src, src_len - i, -1);
|
||||
int ws_len = XophpString.strspn_bwd__space_or_tab(src, src_len - i, -1);
|
||||
int search_bgn = i - ws_len;
|
||||
|
||||
if (part.comment_end != -1 && search_bgn -1 == part.comment_end) {
|
||||
@@ -524,10 +523,10 @@ public class Xomw_prepro_wkr { // THREAD.UNSAFE: caching for repeated calls
|
||||
// Search for equals signs before the comment
|
||||
search_bgn = part.visual_end;
|
||||
search_bgn = Bry_find_.Find_bwd__while_space_or_tab(src, search_bgn, 0);
|
||||
search_bgn -= Php_str_.Strspn_bwd__space_or_tab(src, search_bgn, -1);
|
||||
search_bgn -= XophpString.strspn_bwd__space_or_tab(src, search_bgn, -1);
|
||||
}
|
||||
int count = piece.count;
|
||||
int eq_len = Php_str_.Strspn_bwd__byte(src, Byte_ascii.Eq, search_bgn, -1);
|
||||
int eq_len = XophpString.strspn_bwd__byte(src, Byte_ascii.Eq, search_bgn, -1);
|
||||
|
||||
byte[] element = Bry_.Empty;
|
||||
if (eq_len > 0) {
|
||||
@@ -580,7 +579,7 @@ public class Xomw_prepro_wkr { // THREAD.UNSAFE: caching for repeated calls
|
||||
}
|
||||
else if (found == Found__open) {
|
||||
// count opening brace characters
|
||||
int count = Php_str_.Strspn_fwd__byte(src, cur_char[0], i, -1, src_len); // NOTE: don't know how MediaWiki will handle "-{"
|
||||
int count = XophpString.strspn_fwd__byte(src, cur_char[0], i, -1, src_len); // NOTE: don't know how MediaWiki will handle "-{"
|
||||
|
||||
// we need to add to stack only if opening brace count is enough for one of the rules
|
||||
if (count >= rule.min) {
|
||||
@@ -605,7 +604,7 @@ public class Xomw_prepro_wkr { // THREAD.UNSAFE: caching for repeated calls
|
||||
Xomw_prepro_piece piece = stack.top;
|
||||
// lets check if there are enough characters for closing brace
|
||||
int max_count = piece.count;
|
||||
int count = Php_str_.Strspn_fwd__byte(src, cur_char[0], i, max_count, src_len);
|
||||
int count = XophpString.strspn_fwd__byte(src, cur_char[0], i, max_count, src_len);
|
||||
|
||||
// check for maximum matching characters (if there are 5 closing characters, we will probably need only 3 - depending on the rules)
|
||||
rule = Get_rule(piece.open);
|
||||
|
||||
@@ -14,7 +14,6 @@ GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.xowa.mediawiki.includes.parsers.quotes; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*; import gplx.xowa.mediawiki.includes.*; import gplx.xowa.mediawiki.includes.parsers.*;
|
||||
import gplx.xowa.mediawiki.includes.utls.*;
|
||||
import gplx.xowa.parsers.htmls.*;
|
||||
import gplx.core.primitives.*;
|
||||
public class Xomw_quote_wkr {// THREAD.UNSAFE: caching for repeated calls
|
||||
@@ -54,7 +53,7 @@ public class Xomw_quote_wkr {// THREAD.UNSAFE: caching for repeated calls
|
||||
return found ? tmp.To_bry_and_clear() : src;
|
||||
}
|
||||
private boolean Do_quotes(Bry_bfr bfr, boolean all_quotes_mode, byte[] src, int line_bgn, int line_end) {
|
||||
byte[][] arr = Php_preg_.Split(apos_pos_ary, src, line_bgn, line_end, Wtxt__apos, Bool_.Y); // PORTED.REGX: arr = preg_split("/(''+)/", text, -1, PREG_SPLIT_DELIM_CAPTURE);
|
||||
byte[][] arr = XophpPreg.split(apos_pos_ary, src, line_bgn, line_end, Wtxt__apos, Bool_.Y); // PORTED.REGX: arr = preg_split("/(''+)/", text, -1, PREG_SPLIT_DELIM_CAPTURE);
|
||||
if (arr == null) {
|
||||
if (all_quotes_mode) {
|
||||
bfr.Add_mid(src, line_bgn, line_end).Add_byte_nl();
|
||||
@@ -111,8 +110,8 @@ public class Xomw_quote_wkr {// THREAD.UNSAFE: caching for repeated calls
|
||||
for (int i = 1; i < arr_len; i += 2) {
|
||||
if (arr[i].length == 3) {
|
||||
byte[] prv = arr[i - 1];
|
||||
byte prv__last_char = Php_str_.Substr_byte(prv, -1);
|
||||
byte prv__last_minus_1_char = Php_str_.Substr_byte(prv, -2, 1);
|
||||
byte prv__last_char = XophpString.substr_byte(prv, -1);
|
||||
byte prv__last_minus_1_char = XophpString.substr_byte(prv, -2, 1);
|
||||
if (prv__last_char == Byte_ascii.Space) { // NOTE: prv ends in space; EX: "''prv '''"
|
||||
if (prv_ends_w_space == -1) {
|
||||
prv_ends_w_space = i;
|
||||
|
||||
@@ -14,7 +14,6 @@ GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.xowa.mediawiki.includes.parsers.tables; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*; import gplx.xowa.mediawiki.includes.*; import gplx.xowa.mediawiki.includes.parsers.*;
|
||||
import gplx.xowa.mediawiki.includes.utls.*;
|
||||
import gplx.xowa.parsers.htmls.*;
|
||||
import gplx.xowa.mediawiki.includes.libs.*; import gplx.xowa.parsers.uniqs.*;
|
||||
public class Xomw_table_wkr implements gplx.core.brys.Bry_split_wkr {// THREAD.UNSAFE: caching for repeated calls
|
||||
@@ -49,13 +48,13 @@ public class Xomw_table_wkr implements gplx.core.brys.Bry_split_wkr {// THREAD.U
|
||||
|
||||
// Closing open td, tr && table
|
||||
while (td_history.Len() > 0) {
|
||||
if (Php_ary_.Pop_bool_or_n(td_history)) {
|
||||
if (XophpArray.popBoolOrN(td_history)) {
|
||||
bfr.Add_str_a7("</td>\n");
|
||||
}
|
||||
if (Php_ary_.Pop_bool_or_n(tr_history)) {
|
||||
if (XophpArray.popBoolOrN(tr_history)) {
|
||||
bfr.Add_str_a7("</tr>\n");
|
||||
}
|
||||
if (!Php_ary_.Pop_bool_or_n(has_opened_tr)) {
|
||||
if (!XophpArray.popBoolOrN(has_opened_tr)) {
|
||||
bfr.Add_str_a7("<tr><td></td></tr>\n");
|
||||
}
|
||||
bfr.Add_str_a7("</table>\n");
|
||||
@@ -124,20 +123,20 @@ public class Xomw_table_wkr implements gplx.core.brys.Bry_split_wkr {// THREAD.U
|
||||
else if (Bry_.Eq(first_2, Wtxt__tb__end)) {
|
||||
// We are ending a table
|
||||
line = tmp.Add_str_a7("</table>").Add_mid(line, 2, line.length).To_bry_and_clear();
|
||||
byte[] last_tag = Php_ary_.Pop_bry_or_null(last_tag_history);
|
||||
byte[] last_tag = XophpArray.popBryOrNull(last_tag_history);
|
||||
|
||||
if (!Php_ary_.Pop_bool_or_n(has_opened_tr)) {
|
||||
if (!XophpArray.popBoolOrN(has_opened_tr)) {
|
||||
line = tmp.Add_str_a7("<tr><td></td></tr>").Add(line).To_bry_and_clear();
|
||||
}
|
||||
|
||||
if (Php_ary_.Pop_bool_or_n(tr_history)) {
|
||||
if (XophpArray.popBoolOrN(tr_history)) {
|
||||
line = tmp.Add_str_a7("</tr>").Add(line).To_bry_and_clear();
|
||||
}
|
||||
|
||||
if (Php_ary_.Pop_bool_or_n(td_history)) {
|
||||
if (XophpArray.popBoolOrN(td_history)) {
|
||||
line = tmp.Add_str_a7("</").Add(last_tag).Add_byte(Byte_ascii.Angle_end).Add(line).To_bry_and_clear();
|
||||
}
|
||||
Php_ary_.Pop_bry_or_null(tr_attributes);
|
||||
XophpArray.popBryOrNull(tr_attributes);
|
||||
// PORTED:$outLine = $line . str_repeat( '</dd></dl>', $indent_level );
|
||||
tmp.Add(line);
|
||||
for (int j = 0; j < indent_level; j++)
|
||||
@@ -153,19 +152,19 @@ public class Xomw_table_wkr implements gplx.core.brys.Bry_split_wkr {// THREAD.U
|
||||
sanitizer.fixTagAttributes(tmp, Name__tr, atrs);
|
||||
atrs = tmp.To_bry_and_clear();
|
||||
|
||||
Php_ary_.Pop_bry_or_null(tr_attributes);
|
||||
XophpArray.popBryOrNull(tr_attributes);
|
||||
tr_attributes.Add(atrs);
|
||||
|
||||
line = Bry_.Empty;
|
||||
byte[] last_tag = Php_ary_.Pop_bry_or_null(last_tag_history);
|
||||
Php_ary_.Pop_bool_or_n(has_opened_tr);
|
||||
byte[] last_tag = XophpArray.popBryOrNull(last_tag_history);
|
||||
XophpArray.popBoolOrN(has_opened_tr);
|
||||
has_opened_tr.Add(true);
|
||||
|
||||
if (Php_ary_.Pop_bool_or_n(tr_history)) {
|
||||
if (XophpArray.popBoolOrN(tr_history)) {
|
||||
line = Html__tr__end;
|
||||
}
|
||||
|
||||
if (Php_ary_.Pop_bool_or_n(td_history)) {
|
||||
if (XophpArray.popBoolOrN(td_history)) {
|
||||
line = tmp.Add_str_a7("</").Add(last_tag).Add_byte(Byte_ascii.Gt).Add(line).To_bry_and_clear();
|
||||
}
|
||||
|
||||
@@ -206,19 +205,19 @@ public class Xomw_table_wkr implements gplx.core.brys.Bry_split_wkr {// THREAD.U
|
||||
byte[] cell = cells[j];
|
||||
previous = Bry_.Empty;
|
||||
if (first_char != Byte_ascii.Plus) {
|
||||
byte[] tr_after = Php_ary_.Pop_bry_or_null(tr_attributes);
|
||||
if (!Php_ary_.Pop_bool_or_n(tr_history)) {
|
||||
byte[] tr_after = XophpArray.popBryOrNull(tr_attributes);
|
||||
if (!XophpArray.popBoolOrN(tr_history)) {
|
||||
previous = tmp.Add_str_a7("<tr").Add(tr_after).Add_str_a7(">\n").To_bry_and_clear();
|
||||
}
|
||||
tr_history.Add(true);
|
||||
tr_attributes.Add(Bry_.Empty);
|
||||
Php_ary_.Pop_bool_or_n(has_opened_tr);
|
||||
XophpArray.popBoolOrN(has_opened_tr);
|
||||
has_opened_tr.Add(true);
|
||||
}
|
||||
|
||||
byte[] last_tag = Php_ary_.Pop_bry_or_null(last_tag_history);
|
||||
byte[] last_tag = XophpArray.popBryOrNull(last_tag_history);
|
||||
|
||||
if (Php_ary_.Pop_bool_or_n(td_history)) {
|
||||
if (XophpArray.popBoolOrN(td_history)) {
|
||||
previous = tmp.Add_str_a7("</").Add(last_tag).Add_str_a7(">\n").Add(previous).To_bry_and_clear();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user