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,7 +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.xtns; import gplx.*; import gplx.xowa.*;
|
||||
import gplx.xowa.langs.bldrs.*; import gplx.xowa.htmls.*;
|
||||
import gplx.xowa.langs.bldrs.*; import gplx.xowa.htmls.core.htmls.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.xndes.*;
|
||||
public abstract class Xox_mgr_base implements Xox_mgr {
|
||||
public Xox_mgr_base() {
|
||||
|
||||
@@ -16,7 +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.xtns; import gplx.*; import gplx.xowa.*;
|
||||
import gplx.xowa.htmls.*;
|
||||
import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.htmls.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.xndes.*;
|
||||
public interface Xox_xnde {
|
||||
void Xtn_parse(Xowe_wiki wiki, Xop_ctx ctx, Xop_root_tkn root, byte[] src, Xop_xnde_tkn xnde);
|
||||
|
||||
@@ -16,7 +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.xtns.categoryList; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.xowa.htmls.*;
|
||||
import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.htmls.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.xndes.*; import gplx.xowa.parsers.htmls.*;
|
||||
public class Xtn_categorylist_nde implements Xox_xnde {
|
||||
public void Xtn_parse(Xowe_wiki wiki, Xop_ctx ctx, Xop_root_tkn root, byte[] src, Xop_xnde_tkn xnde) {}
|
||||
|
||||
@@ -16,7 +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.xtns.cite; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.xowa.htmls.*;
|
||||
import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.htmls.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.xndes.*;
|
||||
public class Ref_html_wtr {
|
||||
public Ref_html_wtr(Xowe_wiki wiki) {
|
||||
|
||||
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.xtns.cite; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.core.primitives.*;
|
||||
import gplx.xowa.htmls.*;
|
||||
import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.htmls.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.xndes.*; import gplx.xowa.parsers.htmls.*;
|
||||
public class Ref_nde implements Xox_xnde, Mwh_atr_itm_owner {
|
||||
public byte[] Name() {return name;} public Ref_nde Name_(byte[] v) {name = v; return this;} private byte[] name = Bry_.Empty;
|
||||
|
||||
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.xtns.cite; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.core.primitives.*;
|
||||
import gplx.xowa.htmls.*;
|
||||
import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.htmls.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.xndes.*; import gplx.xowa.parsers.htmls.*;
|
||||
public class References_nde implements Xox_xnde, Mwh_atr_itm_owner {
|
||||
public byte[] Group() {return group;} public References_nde Group_(byte[] v) {group = v; return this;} private byte[] group = Bry_.Empty;
|
||||
|
||||
@@ -67,7 +67,7 @@ class Dpl_itm {
|
||||
if (key_id == Dpl_itm_keys.Key_null) { // unknown key; warn and set pos to end of line; EX: "unknown=";
|
||||
Parse_missing_key(usr_dlg, page_ttl, src, fld_bgn, fld_end);
|
||||
fld_bgn = Bry_find_.Find_fwd(src, Byte_ascii.Nl, pos);
|
||||
if (fld_bgn == Bry_.NotFound) loop = false;
|
||||
if (fld_bgn == Bry_find_.Not_found) loop = false;
|
||||
}
|
||||
else { // known key; set pos to val_bgn
|
||||
fld_bgn = pos + Int_.Const_dlm_len;
|
||||
|
||||
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.xtns.dynamicPageList; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.core.primitives.*;
|
||||
import gplx.xowa.htmls.*;
|
||||
import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.htmls.*;
|
||||
import gplx.xowa.wikis.dbs.*; import gplx.xowa.wikis.ctgs.*; import gplx.xowa.wikis.data.tbls.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.xndes.*; import gplx.xowa.parsers.htmls.*;
|
||||
public class Dpl_xnde implements Xox_xnde {
|
||||
|
||||
@@ -16,7 +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.xtns.gallery; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.langs.htmls.*; import gplx.xowa.htmls.hdumps.abrvs.*;
|
||||
import gplx.langs.htmls.*; import gplx.xowa.htmls.core.makes.*;
|
||||
public interface Gallery_box_w_fmtr_arg extends Bry_fmtr_arg {
|
||||
Gallery_box_w_fmtr_arg Init(int uid, int width);
|
||||
}
|
||||
@@ -34,7 +34,7 @@ class Gallery_box_w_fmtr_arg__hdump implements Gallery_box_w_fmtr_arg {
|
||||
private int uid;
|
||||
public Gallery_box_w_fmtr_arg Init(int uid, int width) {this.uid = uid; return this;}
|
||||
public void Fmt__do(Bry_bfr bfr) {
|
||||
bfr.Add(Xohd_abrv_.Key_gallery_box_w);
|
||||
bfr.Add(Xoh_make_trie_.Bry__gallery_box_w);
|
||||
bfr.Add_int_variable(uid);
|
||||
bfr.Add_byte_apos();
|
||||
}
|
||||
@@ -56,7 +56,7 @@ class Gallery_img_pad_fmtr_arg__hdump implements Gallery_img_pad_fmtr_arg {
|
||||
private int uid;
|
||||
public Gallery_img_pad_fmtr_arg Init(int uid, int width) {this.uid = uid; return this;}
|
||||
public void Fmt__do(Bry_bfr bfr) {
|
||||
bfr.Add(Xohd_abrv_.Key_gallery_img_pad);
|
||||
bfr.Add(Xoh_make_trie_.Bry__gallery_img_pad);
|
||||
bfr.Add_int_variable(uid);
|
||||
bfr.Add_byte_apos();
|
||||
}
|
||||
|
||||
@@ -16,7 +16,8 @@ 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.xtns.gallery; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.xowa.files.*; import gplx.xowa.htmls.*; import gplx.xowa.htmls.lnkis.*; import gplx.xowa.htmls.hdumps.core.*; import gplx.xowa.htmls.hdumps.pages.*; import gplx.xowa.parsers.lnkis.*;
|
||||
import gplx.xowa.files.*; import gplx.xowa.htmls.core.wkrs.lnkis.htmls.*; import gplx.xowa.htmls.core.makes.imgs.*; import gplx.xowa.wikis.pages.*; import gplx.xowa.parsers.lnkis.*;
|
||||
import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.htmls.*;
|
||||
import gplx.xowa.parsers.*;
|
||||
public class Gallery_html_wtr {
|
||||
private final Xoh_arg_img_core img_core_fmtr_basic = new Xoh_arg_img_core__basic(), img_core_fmtr_hdump = new Xoh_arg_img_core__hdump();
|
||||
@@ -87,12 +88,12 @@ public class Gallery_html_wtr {
|
||||
}
|
||||
byte[] lnki_ttl = lnki.Ttl().Page_txt();
|
||||
Xoa_ttl lnki_link_ttl = itm_ttl; // default href to ttl
|
||||
if ( itm.Link_bgn() != Bry_.NotFound // link is not -1; EX: "A.png" has no link specified
|
||||
if ( itm.Link_bgn() != Bry_find_.Not_found // link is not -1; EX: "A.png" has no link specified
|
||||
&& (itm.Link_end() - itm.Link_bgn()) > 0 // and link_end - link_bgn > 0; EX: "A.png|link="; DATE:2014-06-15
|
||||
)
|
||||
lnki_link_ttl = Xoa_ttl.parse(wiki, Bry_.Mid(src, itm.Link_bgn(), itm.Link_end()));
|
||||
byte[] lnki_href = app.Html__href_wtr().Build_to_bry(wiki, lnki_link_ttl);
|
||||
byte[] lnki_alt = itm.Alt_bgn() == Bry_.NotFound ? lnki_ttl : Xoh_html_wtr_escaper.Escape(app.Parser_amp_mgr(), tmp_bfr, Bry_.Mid(src, itm.Alt_bgn(), itm.Alt_end()));
|
||||
byte[] lnki_alt = itm.Alt_bgn() == Bry_find_.Not_found ? lnki_ttl : Xoh_html_wtr_escaper.Escape(app.Parser_amp_mgr(), tmp_bfr, Bry_.Mid(src, itm.Alt_bgn(), itm.Alt_end()));
|
||||
img_core_fmtr.Init(itm_elem_id, html_src, html_w, html_h);
|
||||
int itm_margin = Gallery_html_wtr_utl.Calc_vpad(mgr.Itm_h(), html_h);
|
||||
Gallery_html_wtr_.Itm_img_fmtr.Bld_bfr_many(itm_bfr
|
||||
@@ -105,7 +106,7 @@ public class Gallery_html_wtr {
|
||||
, lnki_alt
|
||||
);
|
||||
if (hctx_is_hdump)
|
||||
hdump_imgs.Imgs_add_img(new Xohd_data_itm__gallery_itm().Data_init_gallery(itm_div_w, itm_box_w, itm_margin), xfer_itm, Xohd_data_itm__gallery_itm.Tid_gallery);
|
||||
hdump_imgs.Imgs_add_img(new Xohd_img_itm__gallery_itm().Data_init_gallery(itm_div_w, itm_box_w, itm_margin), xfer_itm, Xohd_img_itm__gallery_itm.Tid_gallery);
|
||||
}
|
||||
else {
|
||||
Gallery_html_wtr_.Itm_txt_fmtr.Bld_bfr_many(itm_bfr
|
||||
|
||||
@@ -16,7 +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.xtns.gallery; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.xowa.files.*; import gplx.xowa.files.gui.*; import gplx.xowa.guis.views.*; import gplx.xowa.htmls.*;
|
||||
import gplx.xowa.files.*; import gplx.xowa.files.gui.*; import gplx.xowa.guis.views.*; import gplx.xowa.htmls.core.htmls.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.lnkis.*;
|
||||
public class Gallery_itm implements Js_img_wkr {
|
||||
private Gallery_xnde xnde; private Xof_file_itm xfer_itm; private Xowe_wiki wiki; private Xop_ctx ctx; private byte[] src; private byte[] gallery_li_id_bry; private int gallery_itm_idx;
|
||||
@@ -35,7 +35,7 @@ public class Gallery_itm implements Js_img_wkr {
|
||||
public Xop_lnki_tkn Lnki_tkn() {return lnki_tkn;} public Gallery_itm Lnki_tkn_(Xop_lnki_tkn v) {lnki_tkn = v; return this;} private Xop_lnki_tkn lnki_tkn;
|
||||
public Gallery_itm Reset() {
|
||||
ttl = null;
|
||||
ttl_bgn = ttl_end = alt_bgn = alt_end = link_bgn = link_end = page_bgn = page_end = Bry_.NotFound;
|
||||
ttl_bgn = ttl_end = alt_bgn = alt_end = link_bgn = link_end = page_bgn = page_end = Bry_find_.Not_found;
|
||||
caption_bry = null; // NOTE: use null instead of ""; more legible tests
|
||||
caption_tkn = null;
|
||||
ext = null;
|
||||
|
||||
@@ -165,7 +165,7 @@ public class Gallery_itm_parser {
|
||||
int fld_end = cur_pos;
|
||||
if (cur_fld != Fld_caption) {
|
||||
int non_ws_pos = Bry_find_.Find_bwd_non_ws_or_not_found(src, cur_pos - 1, itm_bgn) + 1; // SEE:non_ws_pos
|
||||
if (non_ws_pos != Bry_.NotFound + 1)
|
||||
if (non_ws_pos != Bry_find_.Not_found + 1)
|
||||
fld_end = non_ws_pos;
|
||||
}
|
||||
switch (cur_fld) {
|
||||
|
||||
@@ -107,6 +107,6 @@ class Gallery_itm_parser_fxt {
|
||||
return rv;
|
||||
}
|
||||
private String Xto_str_ary_itm(byte[] src, int bgn, int end) {
|
||||
return bgn == Bry_.NotFound && end == Bry_.NotFound ? null : String_.new_u8(src, bgn, end);
|
||||
return bgn == Bry_find_.Not_found && end == Bry_find_.Not_found ? null : String_.new_u8(src, bgn, end);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +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.xtns.gallery; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.langs.htmls.*; import gplx.xowa.htmls.*; import gplx.xowa.htmls.modules.*; import gplx.xowa.files.*; import gplx.xowa.htmls.hdumps.abrvs.*; import gplx.xowa.htmls.hdumps.core.*;
|
||||
import gplx.langs.htmls.*; import gplx.xowa.htmls.core.htmls.*; import gplx.xowa.htmls.modules.*; import gplx.xowa.files.*; import gplx.xowa.htmls.core.makes.*; import gplx.xowa.htmls.core.makes.imgs.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.xndes.*; import gplx.xowa.parsers.htmls.*; import gplx.xowa.parsers.lnkis.*;
|
||||
public abstract class Gallery_mgr_base {
|
||||
private Gallery_box_w_fmtr_arg__basic box_w_fmtr__basic = new Gallery_box_w_fmtr_arg__basic(); private Gallery_box_w_fmtr_arg__hdump box_w_fmtr__hdump = new Gallery_box_w_fmtr_arg__hdump();
|
||||
@@ -60,7 +60,7 @@ public abstract class Gallery_mgr_base {
|
||||
if (itms_per_row > 0) {
|
||||
int max_width = itms_per_row * (itm_default_w + this.Get_all_padding());
|
||||
box_style = Fmt_and_add(tmp_bfr, box_style_max_width_fmtr, box_style, max_width);
|
||||
page.Hdump_data().Imgs_add(new Xohd_data_itm__gallery_mgr(gallery_uid, max_width));
|
||||
page.Hdump_data().Imgs_add(new Xohd_img_itm__gallery_mgr(gallery_uid, max_width));
|
||||
}
|
||||
byte[] box_cls = Fmt_and_add(tmp_bfr, box_cls_fmtr, xnde.Atr_cls(), this.Tid_bry());
|
||||
byte[] gallery_ul_id = tmp_bfr.Add(box_id_prefix_bry).Add_int_variable(gallery_uid).To_bry_and_clear();
|
||||
@@ -111,11 +111,11 @@ public abstract class Gallery_mgr_base {
|
||||
html_w_expand = lnki_w_orig; html_h_expand = lnki_h_orig; // reset lnki_w_orig / lnki_h_orig else large captions
|
||||
}
|
||||
else {
|
||||
byte[] alt = itm.Alt_bgn() == Bry_.NotFound && Bry_.Len_eq_0(itm_caption) // if ( $alt == '' && $text == '' ) $imageParameters['alt'] = $nt->getText();
|
||||
byte[] alt = itm.Alt_bgn() == Bry_find_.Not_found && Bry_.Len_eq_0(itm_caption) // if ( $alt == '' && $text == '' ) $imageParameters['alt'] = $nt->getText();
|
||||
? itm.Ttl().Page_txt()
|
||||
: Xoh_html_wtr_escaper.Escape(app.Parser_amp_mgr(), tmp_bfr, Bry_.Mid(src, itm.Alt_bgn(), itm.Alt_end()))
|
||||
;
|
||||
Xoa_ttl href_ttl = itm.Link_bgn() == Bry_.NotFound
|
||||
Xoa_ttl href_ttl = itm.Link_bgn() == Bry_find_.Not_found
|
||||
? ttl
|
||||
: Xoa_ttl.parse(wiki, Bry_.Mid(src, itm.Link_bgn(), itm.Link_end()))
|
||||
;
|
||||
@@ -151,7 +151,7 @@ public abstract class Gallery_mgr_base {
|
||||
Wrap_gallery_text(bfr, itm_caption, html_w_expand, html_h_expand);
|
||||
bfr.Add(itm_li_end_bry);
|
||||
if (hctx_is_hdump)
|
||||
page.Hdump_data().Imgs_add_img(new Xohd_data_itm__gallery_itm().Data_init_gallery(itm_div_width, img_div_w, vpad), xfer_itm, Xohd_data_itm__gallery_itm.Tid_gallery);
|
||||
page.Hdump_data().Imgs_add_img(new Xohd_img_itm__gallery_itm().Data_init_gallery(itm_div_width, img_div_w, vpad), xfer_itm, Xohd_img_itm__gallery_itm.Tid_gallery);
|
||||
}
|
||||
private static final byte[]
|
||||
Wrap_gallery_text_bgn = Bry_.new_a7("\n <div class=\"gallerytext\">") // NOTE: The newline after <div class="gallerytext"> is needed to accommodate htmltidy
|
||||
@@ -191,16 +191,16 @@ public abstract class Gallery_mgr_base {
|
||||
}
|
||||
private static void Box_hdr_write(Bry_bfr bfr, Xop_xatr_whitelist_mgr whitelist_mgr, byte[] src, byte[] gallery_ul_uid, byte[] cls, byte[] style, List_adp xatr_list, boolean hctx_is_hdump, int uid) {
|
||||
bfr.Add_byte(Byte_ascii.Lt).Add(Html_tag_.Ul_name_bry);
|
||||
Html_wtr.Write_atr_bry(bfr, Html_atr_.Id_bry, gallery_ul_uid);
|
||||
Html_wtr.Write_atr_bry(bfr, Html_atr_.Cls_bry, cls);
|
||||
Html_wtr.Write_atr_bry(bfr, Html_atr_.Bry__id, gallery_ul_uid);
|
||||
Html_wtr.Write_atr_bry(bfr, Html_atr_.Bry__class, cls);
|
||||
if (hctx_is_hdump) {
|
||||
bfr.Add_byte_space();
|
||||
bfr.Add(Xohd_abrv_.Key_gallery_box_max);
|
||||
bfr.Add(Xoh_make_trie_.Bry__gallery_box_max);
|
||||
bfr.Add_int_variable(uid);
|
||||
bfr.Add_byte_apos();
|
||||
}
|
||||
else
|
||||
Html_wtr.Write_atr_bry(bfr, Html_atr_.Style_bry, style);
|
||||
Html_wtr.Write_atr_bry(bfr, Html_atr_.Bry__style, style);
|
||||
if (xatr_list != null) {
|
||||
int len = xatr_list.Count();
|
||||
for (int i = 0; i < len; i++) {
|
||||
|
||||
@@ -19,7 +19,7 @@ package gplx.xowa.xtns.gallery; import gplx.*; import gplx.xowa.*; import gplx.x
|
||||
import gplx.core.primitives.*; import gplx.dbs.cfgs.*;
|
||||
import gplx.fsdb.meta.*;
|
||||
import gplx.xowa.parsers.logs.*;
|
||||
import gplx.xowa.htmls.*; import gplx.xowa.files.*; import gplx.xowa.files.fsdb.*;
|
||||
import gplx.xowa.htmls.core.htmls.*; import gplx.xowa.files.*; import gplx.xowa.files.fsdb.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.xndes.*; import gplx.xowa.parsers.htmls.*;
|
||||
public class Gallery_xnde implements Xox_xnde, Mwh_atr_itm_owner {
|
||||
private Gallery_xtn_mgr xtn_mgr;
|
||||
|
||||
@@ -16,7 +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.xtns.graphs; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.xowa.htmls.*;
|
||||
import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.htmls.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.logs.*; import gplx.xowa.parsers.xndes.*; import gplx.xowa.parsers.htmls.*;
|
||||
public class Graph_xnde implements Xox_xnde {
|
||||
private Graph_xtn xtn;
|
||||
|
||||
@@ -16,7 +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.xtns.hieros; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.langs.htmls.*; import gplx.xowa.htmls.*;
|
||||
import gplx.langs.htmls.*; import gplx.xowa.htmls.core.htmls.*;
|
||||
class Hiero_html_mgr {
|
||||
private Bry_bfr html_bfr = Bry_bfr.reset_(Io_mgr.Len_kb), content_bfr = Bry_bfr.reset_(255), tbl_content_bfr = Bry_bfr.reset_(Io_mgr.Len_kb), temp_bfr = Bry_bfr.reset_(255);
|
||||
private Xoh_wtr_ctx hctx;
|
||||
|
||||
@@ -16,12 +16,12 @@ 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.xtns.hieros; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.langs.htmls.*; import gplx.xowa.htmls.*;
|
||||
import gplx.langs.htmls.*; import gplx.xowa.htmls.core.htmls.*;
|
||||
class Hiero_html_wtr {
|
||||
private Hiero_phoneme_mgr phoneme_mgr;
|
||||
private Bry_bfr temp_bfr = Bry_bfr.reset_(255);
|
||||
public Hiero_html_wtr(Hiero_html_mgr mgr, Hiero_phoneme_mgr phoneme_mgr) {this.phoneme_mgr = phoneme_mgr;}
|
||||
public void Init_for_write(Xoh_wtr_ctx hctx) {this.hiero_img_dir = hctx.Mode_is_hdump() ? gplx.xowa.htmls.hdumps.abrvs.Xohd_abrv_.Key_hiero_dir : Hiero_xtn_mgr.Img_src_dir;} private byte[] hiero_img_dir = null;
|
||||
public void Init_for_write(Xoh_wtr_ctx hctx) {this.hiero_img_dir = hctx.Mode_is_hdump() ? gplx.xowa.htmls.core.makes.Xoh_make_trie_.Bry__hiero_dir : Hiero_xtn_mgr.Img_src_dir;} private byte[] hiero_img_dir = null;
|
||||
public void Hr(Bry_bfr bfr) {bfr.Add(Html_tag_.Hr_inl).Add_byte_nl();}
|
||||
public void Tbl_eol(Bry_bfr bfr) {bfr.Add(Tbl_eol_bry);}
|
||||
public byte[] Td_height(int height) {
|
||||
|
||||
@@ -16,7 +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.xtns.hieros; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.core.primitives.*;
|
||||
import gplx.core.primitives.*; import gplx.core.log_msgs.*;
|
||||
import gplx.langs.phps.*; import gplx.langs.dsvs.*;
|
||||
import gplx.xowa.apps.gfs.*;
|
||||
public class Hiero_mw_tables_parser {
|
||||
|
||||
@@ -16,7 +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.xtns.hieros; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.xowa.htmls.*;
|
||||
import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.htmls.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.logs.*; import gplx.xowa.parsers.xndes.*; import gplx.xowa.parsers.htmls.*;
|
||||
public class Hiero_xnde implements Xox_xnde {
|
||||
private Hiero_xtn_mgr xtn_mgr;
|
||||
|
||||
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.xtns.imaps; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.core.primitives.*;
|
||||
import gplx.xowa.htmls.*; import gplx.xowa.htmls.lnkis.*;
|
||||
import gplx.xowa.htmls.core.htmls.*; import gplx.xowa.htmls.core.wkrs.lnkis.htmls.*;
|
||||
import gplx.xowa.parsers.*;
|
||||
class Imap_img_fmtr_arg implements Bry_fmtr_arg {
|
||||
private Xoh_wtr_ctx hctx; private Imap_map map; private Imap_xtn_mgr xtn_mgr;
|
||||
|
||||
@@ -17,7 +17,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.xtns.imaps; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.core.primitives.*; import gplx.core.net.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.lnkis.*; import gplx.xowa.parsers.lnkes.*; import gplx.xowa.htmls.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.lnkis.*; import gplx.xowa.parsers.lnkes.*; import gplx.xowa.htmls.core.htmls.*;
|
||||
import gplx.xowa.htmls.core.wkrs.lnkes.*;
|
||||
interface Imap_link_owner {
|
||||
void Link_tid_(int v);
|
||||
void Link_href_(byte[] v);
|
||||
@@ -40,8 +41,8 @@ class Imap_link_owner_ {
|
||||
case Xop_tkn_itm_.Tid_lnke: {
|
||||
Xop_lnke_tkn lnke = (Xop_lnke_tkn)tkn;
|
||||
Xop_ctx ctx = wiki.Parser_mgr().Ctx();
|
||||
int lnke_bgn = lnke.Lnke_bgn(), lnke_end = lnke.Lnke_end(); boolean proto_is_xowa = lnke.Proto_tid() == Gfo_protocol_itm.Tid_xowa;
|
||||
Xoh_lnke_wtr lnke_wtr = wiki.Html_mgr().Html_wtr().Lnke_wtr();
|
||||
int lnke_bgn = lnke.Lnke_href_bgn(), lnke_end = lnke.Lnke_href_end(); boolean proto_is_xowa = lnke.Proto_tid() == Gfo_protocol_itm.Tid_xowa;
|
||||
Xoh_lnke_html lnke_wtr = wiki.Html_mgr().Html_wtr().Wkr__lnke();
|
||||
lnke_wtr.Write_href(bfr, ctx, src, lnke, lnke_bgn, lnke_end, proto_is_xowa);
|
||||
link_owner.Link_href_(bfr.To_bry_and_clear());
|
||||
lnke_wtr.Write_caption(bfr, wiki.Html_mgr().Html_wtr(), Xoh_wtr_ctx.Basic, ctx, src, lnke, lnke_bgn, lnke_end, proto_is_xowa);
|
||||
|
||||
@@ -16,8 +16,8 @@ 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.xtns.imaps; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.xowa.files.*; import gplx.xowa.htmls.*; import gplx.xowa.files.gui.*; import gplx.xowa.guis.views.*; import gplx.xowa.htmls.lnkis.*;
|
||||
import gplx.xowa.htmls.hdumps.core.*;
|
||||
import gplx.xowa.files.*; import gplx.xowa.htmls.core.htmls.*; import gplx.xowa.files.gui.*; import gplx.xowa.guis.views.*; import gplx.xowa.htmls.core.wkrs.lnkis.htmls.*;
|
||||
import gplx.xowa.htmls.core.makes.imgs.*;
|
||||
public class Imap_map implements Xoh_file_img_wkr, Js_img_wkr {
|
||||
private static final Imap_map_fmtr map_fmtr_arg = new Imap_map_fmtr();
|
||||
public Imap_map(int id) {this.id = id;}
|
||||
@@ -44,7 +44,7 @@ public class Imap_map implements Xoh_file_img_wkr, Js_img_wkr {
|
||||
this.a_href = a_href; this.img_alt = img_alt; this.img_cls_tid = img_cls; this.img_cls_other = img_cls_other;
|
||||
Write_imap_div(tmp_bfr, hctx, uid, img_w, img_h, img_src, xfer_itm.Orig_w(), xfer_itm.Orig_h());
|
||||
if (hctx.Mode_is_hdump())
|
||||
page.Hdump_data().Imgs_add_img(new Xohd_data_itm__img(), xfer_itm, Xohd_data_itm__gallery_itm.Tid_basic);
|
||||
page.Hdump_data().Imgs_add_img(new Xohd_img_itm__img(), xfer_itm, Xohd_img_itm__gallery_itm.Tid_basic);
|
||||
}
|
||||
public void Html_update(Xoa_page page, Xog_js_wkr js_wkr, int html_uid, int html_w, int html_h, Io_url html_view_url, int orig_w, int orig_h, Io_url html_orig_url, byte[] lnki_ttl) {
|
||||
Xowe_wiki wiki = xtn_mgr.Wiki();
|
||||
|
||||
@@ -16,7 +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.xtns.imaps; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.xowa.htmls.*;
|
||||
import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.htmls.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.logs.*; import gplx.xowa.parsers.xndes.*;
|
||||
public class Imap_xnde implements Xox_xnde {
|
||||
private Imap_xtn_mgr xtn_mgr;
|
||||
|
||||
@@ -16,7 +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.xtns.imaps; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.core.btries.*; import gplx.xowa.wikis.*; import gplx.xowa.htmls.*; import gplx.xowa.htmls.lnkis.*;
|
||||
import gplx.core.btries.*; import gplx.xowa.wikis.*; import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.wkrs.lnkis.htmls.*;
|
||||
public class Imap_xtn_mgr extends Xox_mgr_base implements GfoInvkAble {
|
||||
private boolean init;
|
||||
@Override public boolean Enabled_default() {return true;}
|
||||
|
||||
@@ -16,7 +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.xtns.indicators; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.core.primitives.*; import gplx.xowa.htmls.*; import gplx.xowa.wikis.pages.skins.*;
|
||||
import gplx.core.primitives.*; import gplx.xowa.htmls.core.htmls.*; import gplx.xowa.wikis.pages.skins.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.xndes.*; import gplx.xowa.parsers.htmls.*;
|
||||
public class Indicator_xnde implements Xox_xnde, Mwh_atr_itm_owner {
|
||||
public String Name() {return name;} private String name;
|
||||
|
||||
@@ -16,7 +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.xtns.inputBox; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.xowa.htmls.*;
|
||||
import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.htmls.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.xndes.*;
|
||||
public class Xtn_inputbox_nde implements Xox_xnde {
|
||||
public void Xtn_parse(Xowe_wiki wiki, Xop_ctx ctx, Xop_root_tkn root, byte[] src, Xop_xnde_tkn xnde) {} // FUTURE: noop for now so it doesn't show (since it's useless)
|
||||
|
||||
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.xtns.listings; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.core.primitives.*;
|
||||
import gplx.langs.htmls.*; import gplx.xowa.htmls.*;
|
||||
import gplx.langs.htmls.*; import gplx.xowa.htmls.core.htmls.*;
|
||||
import gplx.xowa.langs.*; import gplx.xowa.langs.msgs.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.xndes.*; import gplx.xowa.parsers.htmls.*;
|
||||
public class Listing_xnde implements Xox_xnde, Mwh_atr_itm_owner {
|
||||
@@ -111,8 +111,8 @@ public class Listing_xnde implements Xox_xnde, Mwh_atr_itm_owner {
|
||||
if (xatr_url != null)
|
||||
wtr.Nde_full_atrs(Tag_a, wtr.To_bry_and_clear(), false
|
||||
, Atr_a_href , xatr_url
|
||||
, Atr_a_class , Atr_a_class_external_text
|
||||
, Atr_a_rel , Atr_a_rel_nofollow
|
||||
, Atr_a_class , Atr_a_class_external_text
|
||||
, Atr_a_title , xatr_name
|
||||
);
|
||||
if (xatr_alt != null) {
|
||||
|
||||
@@ -30,7 +30,7 @@ public class Listing_xnde_basic_tst {
|
||||
@Test public void Url() {
|
||||
fxt.Test_parse_page_all_str
|
||||
( "<sleep name='name_0' url='http://site.org'/>"
|
||||
, "<a href=\"http://site.org\" class=\"external text\" rel=\"nofollow\" title=\"name_0\"><strong>name_0</strong></a>. "
|
||||
, "<a href=\"http://site.org\" rel=\"nofollow\" class=\"external text\" title=\"name_0\"><strong>name_0</strong></a>. "
|
||||
);
|
||||
}
|
||||
@Test public void Alt() {
|
||||
|
||||
@@ -50,7 +50,7 @@ public class Lst_pfunc_wkr {
|
||||
if (!page.Tmpl_stack_add(src_ttl.Full_db())) return; // put template back on stack;
|
||||
Xop_root_tkn root = wiki.Parser_mgr().Main().Parse_text_to_wdom(sub_ctx, src, true); // NOTE: pass sub_ctx as old_ctx b/c entire document will be parsed, and references outside the section should be ignored;
|
||||
src = root.Data_mid(); // NOTE: must set src to root.Data_mid() which is result of parse; else <nowiki> will break text; DATE:2013-07-11
|
||||
wiki.Cache_mgr().Lst_cache().Add(defn_tmpl, Xow_ns_case_.Id_all);
|
||||
wiki.Cache_mgr().Lst_cache().Add(defn_tmpl, Xow_ns_case_.Tid__all);
|
||||
page.Tmpl_stack_del();
|
||||
defn_tmpl.Data_mid_(src);
|
||||
defn_tmpl.Ctx_(sub_ctx);
|
||||
|
||||
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.xtns.lst; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.core.primitives.*;
|
||||
import gplx.xowa.langs.*; import gplx.xowa.htmls.*;
|
||||
import gplx.xowa.langs.*; import gplx.xowa.htmls.core.htmls.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.xndes.*; import gplx.xowa.parsers.htmls.*;
|
||||
public class Lst_section_nde implements Xox_xnde, Mwh_atr_itm_owner {
|
||||
public byte[] Section_name() {return section_name;} private byte[] section_name;
|
||||
|
||||
@@ -181,7 +181,7 @@ class Map_math {// REF.MW:MapSources_math.php
|
||||
if (word_idx >= Input_units_len) return;
|
||||
byte unit_dlm = Input_units[word_idx];
|
||||
int pos = Bry_find_.Find_fwd(input, unit_dlm, word_bgn, word_end);
|
||||
if (pos != Bry_.NotFound) // remove dlms from end of bry; EX: "123'" -> "123"
|
||||
if (pos != Bry_find_.Not_found) // remove dlms from end of bry; EX: "123'" -> "123"
|
||||
word_end = pos;
|
||||
if (!Parse_input_word_is_compass(input[word_bgn])) { // if ( is_numeric( $v ) ) {
|
||||
double word_val = Bry_.To_double_or(input, word_bgn, word_end, Double_.NaN);
|
||||
|
||||
@@ -16,7 +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.xtns.math; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.xowa.htmls.*;
|
||||
import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.htmls.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.logs.*; import gplx.xowa.parsers.xndes.*; import gplx.xowa.parsers.htmls.*;
|
||||
public class Math_nde implements Xox_xnde {
|
||||
public Xop_xnde_tkn Xnde() {throw Err_.new_unimplemented();}
|
||||
|
||||
@@ -16,7 +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.xtns.math; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.xowa.htmls.*;
|
||||
import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.htmls.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.xndes.*; import gplx.xowa.parsers.vnts.*;
|
||||
public class Xof_math_html_wtr {
|
||||
private Xof_math_itm tmp_math_itm = new Xof_math_itm();
|
||||
@@ -33,7 +33,7 @@ public class Xof_math_html_wtr {
|
||||
boolean enabled = app.File_mgr().Math_mgr().Enabled();
|
||||
if (renderer_is_latex && app.File_mgr().Math_mgr().Find_itm(tmp_math_itm, page.Wiki().Domain_str(), math_bry)) {
|
||||
bfr.Add(Xoh_consts.Img_bgn);
|
||||
bfr.Add_str(tmp_math_itm.Png_url().To_http_file_str());
|
||||
bfr.Add_str_u8(tmp_math_itm.Png_url().To_http_file_str());
|
||||
bfr.Add(Xoh_consts.__inline_quote);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -32,7 +32,7 @@ public class Xof_math_mgr implements GfoInvkAble {
|
||||
public void Make_itm(Xof_math_itm rv, String wiki_key, byte[] math_bry) {
|
||||
Io_url math_dir = Make_math_dir(wiki_key);
|
||||
math_bry = app.Math_subst_regy().Subst(math_bry);
|
||||
String md5 = gplx.security.HashAlgo_.Md5.CalcHash(Console_adp_.Noop, gplx.ios.IoStream_.ary_(math_bry));
|
||||
String md5 = gplx.core.security.HashAlgo_.Md5.CalcHash(Console_adp_.Noop, gplx.core.ios.IoStream_.ary_(math_bry));
|
||||
Io_url png_fil = Make_png_fil(math_dir, md5);
|
||||
rv.Ctor(math_bry, md5, png_fil);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public abstract class Pf_func_base implements Pf_func {
|
||||
if (subs_len == 0) { // no subs; either {{#func}} or {{#func:}}
|
||||
int src_bgn = name_tkn.Src_bgn();
|
||||
int colon_pos = Bry_find_.Find_bwd(src, Byte_ascii.Colon, self.Src_end(), src_bgn); // look for ":"; NOTE: used to be src_bgn - 1, but this would always search one character too many; DATE:2014-02-11
|
||||
if (colon_pos == Bry_.NotFound) // no colon; EX: {{#func}}
|
||||
if (colon_pos == Bry_find_.Not_found) // no colon; EX: {{#func}}
|
||||
return Eval_arg_or_null_is_null;
|
||||
else { // colon found; EX: {{#func:}}
|
||||
if (Bry_.Match_bwd_any(src, colon_pos - 1, src_bgn - 1, func_name)) // #func == func_name; EX: {{NAMESPACE:}}
|
||||
|
||||
@@ -16,7 +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.xtns.pfuncs.exprs; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.xowa.langs.*; import gplx.xowa.langs.kwds.*;
|
||||
import gplx.xowa.langs.*; import gplx.xowa.langs.kwds.*; import gplx.core.log_msgs.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
|
||||
public class Pfunc_expr extends Pf_func_base {
|
||||
@Override public boolean Func_require_colon_arg() {return true;}
|
||||
@@ -32,7 +32,7 @@ public class Pfunc_expr extends Pf_func_base {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
bfr.Add_str(rslt.To_str());
|
||||
bfr.Add_str_u8(rslt.To_str());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,40 +18,48 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.xtns.pfuncs.langs; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import org.junit.*; import gplx.xowa.langs.*;
|
||||
public class Pfunc_grammar_tst {
|
||||
private Xop_fxt fxt = new Xop_fxt();
|
||||
private final Xop_fxt fxt = new Xop_fxt();
|
||||
@Before public void init() {fxt.Reset();}
|
||||
@Test public void English() {// for now, mark unimplemented langs by returning not_found; [[Template:grammar]]; wait for users to report
|
||||
fxt.Test_parse_tmpl_str_test("{{grammar:a|b}}" , "{{test}}" , "[[:Template:grammar]]");
|
||||
fxt .Test_parse_tmpl_str_test ("{{grammar:a|b}}" , "{{test}}", "[[:Template:grammar]]");
|
||||
}
|
||||
@Test public void Finnish() {
|
||||
fxt.Lang_by_id_(Xol_lang_stub_.Id_fi);
|
||||
fxt.Reset().Test_parse_tmpl_str_test("{{grammar:elative|Wikiuutiset}}" , "{{test}}" , "Wikiuutisista");
|
||||
fxt.Reset().Test_parse_tmpl_str_test("{{grammar:talo}}" , "{{test}}" , "");
|
||||
fxt.Reset().Test_parse_tmpl_str_test("{{grammar:genitive|talo}}" , "{{test}}" , "talon");
|
||||
fxt.Reset().Test_parse_tmpl_str_test("{{grammar:elative|talo}}" , "{{test}}" , "talosta");
|
||||
fxt.Reset().Test_parse_tmpl_str_test("{{grammar:inessive|talo}}" , "{{test}}" , "talossa");
|
||||
fxt.Reset().Test_parse_tmpl_str_test("{{grammar:partitive|talo}}" , "{{test}}" , "taloa");
|
||||
fxt.Reset().Test_parse_tmpl_str_test("{{grammar:illative|talo}}" , "{{test}}" , "taloon");
|
||||
fxt.Reset().Test_parse_tmpl_str_test("{{grammar:genitive|sängy}}" , "{{test}}" , "sängyn");
|
||||
fxt.Reset().Test_parse_tmpl_str_test("{{grammar:elative|sängy}}" , "{{test}}" , "sängystä");
|
||||
fxt.Reset().Test_parse_tmpl_str_test("{{grammar:inessive|sängy}}" , "{{test}}" , "sängyssä");
|
||||
fxt.Reset().Test_parse_tmpl_str_test("{{grammar:partitive|sängy}}" , "{{test}}" , "sängyä");
|
||||
fxt.Reset().Test_parse_tmpl_str_test("{{grammar:illative|sängy}}" , "{{test}}" , "sängyyn");
|
||||
fxt.Reset().Test_html_full_str("{{grammar:elative|Wikiuutiset}}" , "Wikiuutisista");
|
||||
fxt.Reset().Test_html_full_str("{{grammar:talo}}" , "");
|
||||
fxt.Reset().Test_html_full_str("{{grammar:genitive|talo}}" , "talon");
|
||||
fxt.Reset().Test_html_full_str("{{grammar:elative|talo}}" , "talosta");
|
||||
fxt.Reset().Test_html_full_str("{{grammar:inessive|talo}}" , "talossa");
|
||||
fxt.Reset().Test_html_full_str("{{grammar:partitive|talo}}" , "taloa");
|
||||
fxt.Reset().Test_html_full_str("{{grammar:illative|talo}}" , "taloon");
|
||||
fxt.Reset().Test_html_full_str("{{grammar:genitive|sängy}}" , "sängyn");
|
||||
fxt.Reset().Test_html_full_str("{{grammar:elative|sängy}}" , "sängystä");
|
||||
fxt.Reset().Test_html_full_str("{{grammar:inessive|sängy}}" , "sängyssä");
|
||||
fxt.Reset().Test_html_full_str("{{grammar:partitive|sängy}}" , "sängyä");
|
||||
fxt.Reset().Test_html_full_str("{{grammar:illative|sängy}}" , "sängyyn");
|
||||
}
|
||||
@Test public void Russian() {
|
||||
fxt.Lang_by_id_(Xol_lang_stub_.Id_ru);
|
||||
fxt.Reset().Test_parse_tmpl_str_test("{{grammar:unknown}}" , "{{test}}" , "");
|
||||
fxt.Reset().Test_parse_tmpl_str_test("{{grammar:genitive|aвики}}" , "{{test}}" , "aвики");
|
||||
fxt.Reset().Test_parse_tmpl_str_test("{{grammar:genitive|aВики}}" , "{{test}}" , "aВики");
|
||||
fxt.Reset().Test_parse_tmpl_str_test("{{grammar:genitive|aь}}" , "{{test}}" , "aя");
|
||||
fxt.Reset().Test_parse_tmpl_str_test("{{grammar:genitive|aия}}" , "{{test}}" , "aии");
|
||||
fxt.Reset().Test_parse_tmpl_str_test("{{grammar:genitive|aка}}" , "{{test}}" , "aки");
|
||||
fxt.Reset().Test_parse_tmpl_str_test("{{grammar:genitive|aти}}" , "{{test}}" , "aтей");
|
||||
fxt.Reset().Test_parse_tmpl_str_test("{{grammar:genitive|aды}}" , "{{test}}" , "aдов");
|
||||
fxt.Reset().Test_parse_tmpl_str_test("{{grammar:genitive|aник}}" , "{{test}}" , "aника");
|
||||
fxt.Reset().Test_parse_tmpl_str_test("{{grammar:dative|a}}" , "{{test}}" , "a");
|
||||
fxt.Reset().Test_parse_tmpl_str_test("{{grammar:accusative|a}}" , "{{test}}" , "a");
|
||||
fxt.Reset().Test_parse_tmpl_str_test("{{grammar:instrumental|a}}" , "{{test}}" , "a");
|
||||
fxt.Reset().Test_parse_tmpl_str_test("{{grammar:prepositional|a}}" , "{{test}}" , "a");
|
||||
fxt.Reset().Test_html_full_str("{{grammar:unknown}}" , "");
|
||||
fxt.Reset().Test_html_full_str("{{grammar:genitive|aвики}}" , "aвики");
|
||||
fxt.Reset().Test_html_full_str("{{grammar:genitive|aВики}}" , "aВики");
|
||||
fxt.Reset().Test_html_full_str("{{grammar:genitive|aь}}" , "aя");
|
||||
fxt.Reset().Test_html_full_str("{{grammar:genitive|aия}}" , "aии");
|
||||
fxt.Reset().Test_html_full_str("{{grammar:genitive|aка}}" , "aки");
|
||||
fxt.Reset().Test_html_full_str("{{grammar:genitive|aти}}" , "aтей");
|
||||
fxt.Reset().Test_html_full_str("{{grammar:genitive|aды}}" , "aдов");
|
||||
fxt.Reset().Test_html_full_str("{{grammar:genitive|aник}}" , "aника");
|
||||
fxt.Reset().Test_html_full_str("{{grammar:dative|a}}" , "a");
|
||||
fxt.Reset().Test_html_full_str("{{grammar:accusative|a}}" , "a");
|
||||
fxt.Reset().Test_html_full_str("{{grammar:instrumental|a}}" , "a");
|
||||
fxt.Reset().Test_html_full_str("{{grammar:prepositional|a}}" , "a");
|
||||
}
|
||||
@Test public void Hebrew() {
|
||||
fxt.Lang_by_id_(Xol_lang_stub_.Id_he);
|
||||
fxt.Reset().Test_html_full_str("{{grammar:unknown|abc}}" , "abc");
|
||||
fxt.Reset().Test_html_full_str("{{grammar:prefixed|וabc}}" , "ווabc"); // waw: add ו
|
||||
fxt.Reset().Test_html_full_str("{{grammar:prefixed|ווabc}}" , "ווabc"); // waw: do not add ו if וו
|
||||
fxt.Reset().Test_html_full_str("{{grammar:prefixed|הabc}}" , "abc"); // he: remove ה
|
||||
fxt.Reset().Test_html_full_str("{{grammar:prefixed|אabc}}" , "־אabc"); // maqaf: add ־
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +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.xtns.pfuncs.pages; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.xowa.htmls.*;
|
||||
import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.htmls.*;
|
||||
import gplx.xowa.langs.kwds.*; import gplx.xowa.langs.cases.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
|
||||
public class Pfunc_displaytitle extends Pf_func_base {
|
||||
|
||||
@@ -90,7 +90,9 @@ class Pft_fmt_itm_hebrew_month_name_gen implements Pft_fmt_itm {
|
||||
class Pft_fmt_itm_hebrew_numeral implements Pft_fmt_itm {
|
||||
public int TypeId() {return Pft_fmt_itm_.Tid_hebrew_numeral;}
|
||||
public void Fmt(Bry_bfr bfr, Xowe_wiki wiki, Xol_lang_itm lang, DateAdp date, Pft_func_formatdate_bldr bldr) {
|
||||
bfr.Add_str(Pft_fmt_itm_hebrew_.Calc_hebrew_numeral(date.Year()));
|
||||
int num_int = bfr.To_int_and_clear(-1);
|
||||
byte[] num_bry = Pft_fmt_itm_hebrew_.Calc_hebrew_numeral(num_int);
|
||||
bfr.Add(num_bry);
|
||||
}
|
||||
}
|
||||
class Pft_fmt_itm_iranian_year_idx implements Pft_fmt_itm {
|
||||
|
||||
@@ -206,53 +206,53 @@ class Pft_fmt_itm_hebrew_ {
|
||||
, Rslt_month_days_count = 3
|
||||
;
|
||||
|
||||
private static final String[][] Numeral_tbls = new String[][]
|
||||
{ new String[] {"", "א", "ב", "ג", "ד", "ה", "ו", "ז", "ח", "ט", "י"}
|
||||
, new String[] {"", "י", "כ", "ל", "מ", "נ", "ס", "ע", "פ", "צ", "ק"}
|
||||
, new String[] {"", "ק", "ר", "ש", "ת", "תק", "תר", "תש", "תת", "תתק", "תתר"}
|
||||
, new String[] {"", "א", "ב", "ג", "ד", "ה", "ו", "ז", "ח", "ט", "י"}
|
||||
private static final byte[][][] Numeral_tbls = new byte[][][]
|
||||
{ new byte[][] {Bry_.Empty, Bry_.new_u8("א"), Bry_.new_u8("ב"), Bry_.new_u8("ג"), Bry_.new_u8("ד"), Bry_.new_u8("ה") , Bry_.new_u8("ו") , Bry_.new_u8("ז") , Bry_.new_u8("ח") , Bry_.new_u8("ט") , Bry_.new_u8("י")}
|
||||
, new byte[][] {Bry_.Empty, Bry_.new_u8("י"), Bry_.new_u8("כ"), Bry_.new_u8("ל"), Bry_.new_u8("מ"), Bry_.new_u8("נ") , Bry_.new_u8("ס") , Bry_.new_u8("ע") , Bry_.new_u8("פ") , Bry_.new_u8("צ") , Bry_.new_u8("ק")}
|
||||
, new byte[][] {Bry_.Empty, Bry_.new_u8("ק"), Bry_.new_u8("ר"), Bry_.new_u8("ש"), Bry_.new_u8("ת"), Bry_.new_u8("תק") , Bry_.new_u8("תר") , Bry_.new_u8("תש") , Bry_.new_u8("תת") , Bry_.new_u8("תתק"), Bry_.new_u8("תתר")}
|
||||
, new byte[][] {Bry_.Empty, Bry_.new_u8("א"), Bry_.new_u8("ב"), Bry_.new_u8("ג"), Bry_.new_u8("ד"), Bry_.new_u8("ה") , Bry_.new_u8("ו") , Bry_.new_u8("ז") , Bry_.new_u8("ח") , Bry_.new_u8("ט") , Bry_.new_u8("י")}
|
||||
};
|
||||
public static String Calc_hebrew_numeral(int num) {
|
||||
if (num > 9999 || num <= 0)
|
||||
return Int_.To_str(num);
|
||||
public static byte[] Calc_hebrew_numeral(int num) {
|
||||
if (num > 9999 || num <= 0) return Int_.To_bry(num);
|
||||
|
||||
String tmp = "";
|
||||
byte[] tmp = Bry_.Empty;
|
||||
int pow10 = 1000;
|
||||
for (int i = 3; i >= 0; pow10 /= 10, i--) {
|
||||
if (num >= pow10) {
|
||||
if (num == 15 || num == 16) {
|
||||
tmp += Numeral_tbls[0][9] + Numeral_tbls[0][num - 9];
|
||||
tmp = Bry_.Add(tmp, Numeral_tbls[0][9], Numeral_tbls[0][num - 9]);
|
||||
num = 0;
|
||||
} else {
|
||||
tmp += Numeral_tbls[i][(int)(num / pow10)];
|
||||
tmp = Bry_.Add(tmp, Numeral_tbls[i][(int)(num / pow10)]);
|
||||
if (pow10 == 1000)
|
||||
tmp += "'";
|
||||
tmp = Bry_.Add(tmp, Byte_ascii.Apos_bry);
|
||||
}
|
||||
}
|
||||
num = num % pow10;
|
||||
}
|
||||
String rv = "";
|
||||
int tmp_len = String_.Len(tmp);
|
||||
byte[] rv = Bry_.Empty;
|
||||
int tmp_len = tmp.length;
|
||||
if (tmp_len == 2) {
|
||||
rv = tmp + "'";
|
||||
rv = Bry_.Add(tmp, Byte_ascii.Apos_bry);
|
||||
}
|
||||
else {
|
||||
rv = String_.Mid(tmp, 0, tmp_len - 1) + "\"";
|
||||
rv += String_.Mid(tmp, tmp_len - 1);
|
||||
rv = Bry_.Add(Bry_.Mid(tmp, 0, tmp_len - 2), Byte_ascii.Quote_bry);
|
||||
rv = Bry_.Add(rv, Bry_.Mid(tmp, tmp_len - 2, tmp_len));
|
||||
}
|
||||
int rv_len = rv.length;
|
||||
Object end_obj = end_trie.Match_bgn(rv, rv_len - 2, rv_len);
|
||||
if (end_obj != null) {
|
||||
byte[] end = (byte[])end_obj;
|
||||
byte[] start = Bry_.Mid(rv, 0, rv_len - 2);
|
||||
rv = Bry_.Add(start, end);
|
||||
}
|
||||
int rv_len = String_.Len(rv);
|
||||
String start = String_.Mid(rv, 0, rv_len - 1);
|
||||
String end = String_.Mid(rv, rv_len - 1);
|
||||
if (String_.Eq(end, "כ"))
|
||||
rv = start + "ך";
|
||||
else if (String_.Eq(end, "מ"))
|
||||
rv = start + "ם";
|
||||
else if (String_.Eq(end, "נ"))
|
||||
rv = start + "ן";
|
||||
else if (String_.Eq(end, "פ"))
|
||||
rv = start + "ף";
|
||||
else if (String_.Eq(end, "צ"))
|
||||
rv = start + "ץ";
|
||||
return rv;
|
||||
}
|
||||
private static final gplx.core.btries.Btrie_slim_mgr end_trie = gplx.core.btries.Btrie_slim_mgr.cs()
|
||||
.Add_str_str("כ", "ך")
|
||||
.Add_str_str("מ", "ם")
|
||||
.Add_str_str("נ", "ן")
|
||||
.Add_str_str("פ", "ף")
|
||||
.Add_str_str("צ", "ץ")
|
||||
;
|
||||
}
|
||||
|
||||
@@ -105,10 +105,10 @@ class Pft_fmt_itm_iso_fmt implements Pft_fmt_itm {
|
||||
public Pft_fmt_itm_iso_fmt() {}
|
||||
public int TypeId() {return Pft_fmt_itm_.Tid_iso_fmt;}
|
||||
public void Fmt(Bry_bfr bfr, Xowe_wiki wiki, Xol_lang_itm lang, DateAdp date, Pft_func_formatdate_bldr bldr) {
|
||||
bfr.Add_str(date.XtoStr_fmt("yyyy-MM-dd"));
|
||||
bfr.Add_str_a7(date.XtoStr_fmt("yyyy-MM-dd"));
|
||||
bfr.Add_byte(Byte_ascii.Ltr_T);
|
||||
bfr.Add_str(date.XtoStr_fmt("HH:mm:ss"));
|
||||
bfr.Add_str(date.XtoStr_tz());
|
||||
bfr.Add_str_a7(date.XtoStr_fmt("HH:mm:ss"));
|
||||
bfr.Add_str_a7(date.XtoStr_tz());
|
||||
}
|
||||
}
|
||||
class Pft_fmt_itm_rfc_5322 implements Pft_fmt_itm {
|
||||
@@ -118,8 +118,8 @@ class Pft_fmt_itm_rfc_5322 implements Pft_fmt_itm {
|
||||
int dow = date.DayOfWeek();
|
||||
DateAdpTranslator_xapp.Translate(wiki, lang, DateAdp_.SegIdx_dayOfWeek, dow, bfr);
|
||||
bfr.Add_byte(Byte_ascii.Comma).Add_byte(Byte_ascii.Space);
|
||||
bfr.Add_str(date.XtoStr_fmt("dd MMM yyyy HH:mm:ss")); // NOTE: always UTC time
|
||||
bfr.Add(CONST_timezone); // NOTE: always UTC time zone
|
||||
bfr.Add_str_a7(date.XtoStr_fmt("dd MMM yyyy HH:mm:ss")); // NOTE: always UTC time
|
||||
bfr.Add(CONST_timezone); // NOTE: always UTC time zone
|
||||
} static final byte[] CONST_timezone = Bry_.new_a7(" +0000");
|
||||
}
|
||||
class Pft_fmt_itm_timezone_offset implements Pft_fmt_itm {
|
||||
|
||||
@@ -28,13 +28,23 @@ public class Pft_func_formatdate_bldr {
|
||||
this.fmt_itms = fmt_itms;
|
||||
int len = fmt_itms.length;
|
||||
idx_cur = 0; idx_nxt = -1;
|
||||
Pft_fmt_itm last = null;
|
||||
Pft_fmt_itm chained_fmt = null;
|
||||
while (idx_cur < len) {
|
||||
Pft_fmt_itm fmt_itm = fmt_itms[idx_cur];
|
||||
if (fmt_itm.TypeId() == Pft_fmt_itm_.Tid_hebrew_numeral)
|
||||
last = fmt_itm;
|
||||
chained_fmt = fmt_itm;
|
||||
else {
|
||||
fmt_itm.Fmt(bfr, wiki, lang, date, this);
|
||||
if (chained_fmt != null) {
|
||||
Bry_bfr tmp_bfr = Xoa_app_.Utl__bfr_mkr().Get_b128();
|
||||
synchronized (tmp_bfr) {
|
||||
fmt_itm.Fmt(tmp_bfr, wiki, lang, date, this);
|
||||
chained_fmt.Fmt(tmp_bfr, wiki, lang, date, this);
|
||||
bfr.Add(tmp_bfr.To_bry_and_rls());
|
||||
chained_fmt = null;
|
||||
}
|
||||
}
|
||||
else
|
||||
fmt_itm.Fmt(bfr, wiki, lang, date, this);
|
||||
}
|
||||
if (idx_nxt == -1)
|
||||
++idx_cur;
|
||||
@@ -43,11 +53,11 @@ public class Pft_func_formatdate_bldr {
|
||||
idx_nxt = -1;
|
||||
}
|
||||
}
|
||||
if (last != null) {
|
||||
if (chained_fmt != null) {
|
||||
int year_int = bfr.To_int_and_clear(-1);
|
||||
if (year_int != -1) { // handle no format; EX:{{#time:xh}} DATE:2014-07-20
|
||||
date = DateAdp_.seg_(new int[] {year_int, date.Month(), date.Day(), date.Hour(), date.Minute(), date.Second(), date.Frac()});
|
||||
last.Fmt(bfr, wiki, lang, date, this);
|
||||
chained_fmt.Fmt(bfr, wiki, lang, date, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ public class Pft_func_time extends Pf_func_base {
|
||||
Bry_bfr error_bfr = Bry_bfr.new_();
|
||||
DateAdp date = ParseDate(arg_date, utc, error_bfr);
|
||||
if (date == null || error_bfr.Len() > 0)
|
||||
bfr.Add_str_a7("<strong class=\"error\">").Add_bfr_and_clear(error_bfr).Add_str("</strong>");
|
||||
bfr.Add_str_a7("<strong class=\"error\">").Add_bfr_and_clear(error_bfr).Add_str_a7("</strong>");
|
||||
else {
|
||||
Xol_lang_itm lang = ctx.Lang();
|
||||
if (Bry_.Len_gt_0(arg_lang)) {
|
||||
|
||||
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.xtns.pfuncs.times; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import org.junit.*; import gplx.xowa.langs.*; import gplx.xowa.langs.msgs.*;
|
||||
public class Pft_func_time_basic_tst {
|
||||
public class Pft_func_time__basic__tst {
|
||||
@Before public void init() {fxt.Reset(); Tfds.Now_set(DateAdp_.new_(2012, 1, 2, 3, 4, 5, 6));} private Xop_fxt fxt = new Xop_fxt();
|
||||
@After public void term() {Tfds.Now_enabled_n_();}
|
||||
@Test public void Utc_date() {fxt.Test_parse_tmpl_str("{{#time:Y-m-d|2012-01-02 03:04:05}}" , "2012-01-02");}
|
||||
@@ -34,7 +34,7 @@ public class Pft_func_time_basic_tst {
|
||||
@Test public void Lcl_date() {fxt.Test_parse_tmpl_str("{{#timel:Y-m-d|2012-01-02 03:04:05}}" , "2012-01-02");}
|
||||
@Test public void Utc_dow_abrv() {fxt.Test_parse_tmpl_str("{{#time:D|20120301}}" , "Thu");}
|
||||
@Test public void Utc_ymd() {fxt.Test_parse_tmpl_str("{{#time:Y-m-d|20120102}}" , "2012-01-02");}
|
||||
@Test public void Utc_ym() {fxt.Test_parse_tmpl_str("{{#time:Y-m-d|201201}}" , "2012-01-01");}
|
||||
@Test public void Utc_ym() {fxt.Test_parse_tmpl_str("{{#time:Y-m-d|201201}}" , "2012-01-02");} // PURPOSE: default to today's date
|
||||
@Test public void Utc_md() {fxt.Test_parse_tmpl_str("{{#time:Y-m-d|2-13}}" , "2012-02-13");} // PURPOSE.fix: m-d failed
|
||||
@Test public void Slashes() {fxt.Test_parse_tmpl_str("{{#time:Y-m-d|2/13/12}}" , "2012-02-13");} // PURPOSE: assert slashes work
|
||||
@Test public void Utc_day() {fxt.Test_parse_tmpl_str("{{#time:Y-m-d|March 27}}" , "2012-03-27");}
|
||||
@@ -95,7 +95,7 @@ public class Pft_func_time_basic_tst {
|
||||
@Test public void Multiple_dates_lt_12() {fxt.Test_parse_tmpl_str("{{#time:c|January 2, 2001-06-11}}" , "2001-01-02T06:00:00-05:00");} // PURPOSE.fix: w:Vim_(text_editor)
|
||||
@Test public void Raw_H() {fxt.Test_parse_tmpl_str("{{#time:xnH}}" , "08");} // PURPOSE: ignore "xn" for now; chk 0-padded number is generated; DATE:2013-12-31
|
||||
@Test public void Raw_h() {fxt.Test_parse_tmpl_str("{{#time:xnh}}" , "08");} // PURPOSE: ignore "xn" for now; chk 0-padded number is generated; DATE:2013-12-31
|
||||
@Test public void Iso8601_T() {fxt.Test_parse_tmpl_str("{{#time:Y-m-d h:i:s A|T1:23}}" , "2012-01-01 01:23:00 AM");} // handle "T" flag; PAGE:pl.w:StarCraft_II:_Wings_of_Liberty
|
||||
@Test public void Iso8601_T_ws() {fxt.Test_parse_tmpl_str("{{#time:Y-m-d h:i:s A|T 1:23}}" , "2012-01-01 01:23:00 AM");} // handle "T" flag and ws
|
||||
@Test public void Iso8601_T() {fxt.Test_parse_tmpl_str("{{#time:Y-m-d h:i:s A|T1:23}}" , "2012-01-02 01:23:00 AM");} // handle "T" flag; PAGE:pl.w:StarCraft_II:_Wings_of_Liberty
|
||||
@Test public void Iso8601_T_ws() {fxt.Test_parse_tmpl_str("{{#time:Y-m-d h:i:s A|T 1:23}}" , "2012-01-02 01:23:00 AM");} // handle "T" flag and ws
|
||||
@Test public void Iso8601_T_fail() {fxt.Test_parse_tmpl_str("{{#time:Y-m-d h:i:s A|T2012-01-02}}" , "<strong class=\"error\">Invalid hour: T</strong>");} // handle "T" flag and ws
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
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.xtns.pfuncs.times; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import org.junit.*;
|
||||
public class Pft_func_time__hebrew__tst {
|
||||
@Before public void init() {fxt.Clear();} private Pft_func_time_foreign_fxt fxt = new Pft_func_time_foreign_fxt();
|
||||
@After public void term() {fxt.Term();}
|
||||
@Test public void Year_num() {fxt.Test_parse("{{#time:xjY|2012-01-02}}" , "5772");}
|
||||
@Test public void Month_num() {fxt.Test_parse("{{#time:xjn|2012-01-02}}" , "4");}
|
||||
@Test public void Day_num() {fxt.Test_parse("{{#time:xjj|2012-01-02}}" , "7");}
|
||||
@Test public void Month_days_count() {fxt.Test_parse("{{#time:xjt|2012-01-02}}" , "29");}
|
||||
@Test public void Month_name_full() {fxt.Init_msg("hebrew-calendar-m4" , "Tevet").Test_parse("{{#time:xjF|2012-01-02}}" , "Tevet");}
|
||||
@Test public void Month_name_gen() {fxt.Init_msg("hebrew-calendar-m4-gen" , "Tevet").Test_parse("{{#time:xjx|2012-01-02}}" , "Tevet");}
|
||||
@Test public void Numeral__empty() {fxt.Test_parse("{{#time:xh}}" , "");}
|
||||
@Test public void Numeral_many() {fxt.Test_parse("{{#time:xhxjj xjx xhxjY|28-08-1608 + 341 days}}" , "ד' ה'שס\"ט");}
|
||||
@Test public void Numeral__year() {
|
||||
String s = String_.new_u8(Bry_.new_ints(215, 148, 39, 215, 170, 215, 169, 215, 153, 34, 215, 152)); // ה'תש"ך
|
||||
fxt.Test_parse("{{#time:xhxjY|1959}}", s); // NOTE: 1959 chosen b/c it will choose the first char from the end_trie; .Add_str_str("כ", "ך")
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.xtns.pfuncs.times; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import org.junit.*;
|
||||
public class Pft_func_time_int_tst {
|
||||
public class Pft_func_time__int__tst {
|
||||
@Before public void init() {fxt.Reset(); Tfds.Now_set(DateAdp_.new_(2012, 1, 2, 3, 4, 5, 6));} private Xop_fxt fxt = new Xop_fxt();
|
||||
@Test public void Time_before_date__dmy() {fxt.Test_parse_tmpl_str("{{#time:Y-m-d H:i|01:02 3.4.2005}}" , "2005-04-03 01:02");} // PAGE:sk.w:Dr._House; DATE:2014-09-23
|
||||
@Test public void Time_before_date__mdy() {fxt.Test_parse_tmpl_str("{{#time:Y-m-d H:i|01:02 3.14.2005}}" , "<strong class=\"error\">Invalid month: 14</strong>");} // mdy is invalid; DATE:2014-09-23
|
||||
@@ -16,20 +16,12 @@ 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.xtns.pfuncs.times; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import org.junit.*; import gplx.xowa.langs.*; import gplx.xowa.langs.msgs.*;
|
||||
public class Pft_func_time_foreign_tst {
|
||||
import org.junit.*;
|
||||
public class Pft_func_time__other__tst {
|
||||
@Before public void init() {fxt.Clear();} private Pft_func_time_foreign_fxt fxt = new Pft_func_time_foreign_fxt();
|
||||
@After public void term() {fxt.Term();}
|
||||
@Test public void Thai() {fxt.Test_parse("{{#time:xkY|2012}}" , "2555");}
|
||||
@Test public void Minguo() {fxt.Test_parse("{{#time:xoY|2012}}" , "101");}
|
||||
@Test public void Hebrew__year_num() {fxt.Test_parse("{{#time:xjY|2012-01-02}}" , "5772");}
|
||||
@Test public void Hebrew__month_num() {fxt.Test_parse("{{#time:xjn|2012-01-02}}" , "4");}
|
||||
@Test public void Hebrew__day_num() {fxt.Test_parse("{{#time:xjj|2012-01-02}}" , "7");}
|
||||
@Test public void Hebrew__month_days_count() {fxt.Test_parse("{{#time:xjt|2012-01-02}}" , "29");}
|
||||
@Test public void Hebrew__month_name_full() {fxt.Init_msg("hebrew-calendar-m4" , "Tevet").Test_parse("{{#time:xjF|2012-01-02}}" , "Tevet");}
|
||||
@Test public void Hebrew__month_name_gen() {fxt.Init_msg("hebrew-calendar-m4-gen" , "Tevet").Test_parse("{{#time:xjx|2012-01-02}}" , "Tevet");}
|
||||
@Test public void Hebrew__numeral() {fxt.Test_parse("{{#time:xh}}" , "");}
|
||||
@Test public void Hebrew__numeral_2() {fxt.Test_parse("{{#time:xhxjY|2014}}" , "ה'תשע\"ד");}
|
||||
@Test public void Iranian__year_idx() {fxt.Test_parse("{{#time:xiY|2012-01-02}}" , "1390");}
|
||||
@Test public void Iranian__month_idx() {fxt.Test_parse("{{#time:xin|2012-01-02}}" , "10");}
|
||||
@Test public void Iranian__day_idx() {fxt.Test_parse("{{#time:xij|2012-01-02}}" , "12");}
|
||||
@@ -59,27 +51,3 @@ public class Pft_func_time_foreign_tst {
|
||||
fxt.Test_Roman(4000, "4000");
|
||||
}
|
||||
}
|
||||
class Pft_func_time_foreign_fxt {
|
||||
private Xop_fxt fxt = new Xop_fxt();
|
||||
public void Clear() {
|
||||
fxt.Reset();
|
||||
Tfds.Now_set(DateAdp_.new_(2012, 1, 2, 3, 4, 5, 6));
|
||||
}
|
||||
public void Term() {
|
||||
Tfds.Now_enabled_n_();
|
||||
}
|
||||
public Pft_func_time_foreign_fxt Init_msg(String key, String val) {
|
||||
Xol_msg_itm msg = fxt.Wiki().Msg_mgr().Get_or_make(Bry_.new_u8(key));
|
||||
msg.Atrs_set(Bry_.new_u8(val), false, false);
|
||||
return this;
|
||||
}
|
||||
public void Test_parse(String raw, String expd) {
|
||||
fxt.Test_parse_tmpl_str_test(raw, "{{test}}", expd);
|
||||
}
|
||||
public void Test_Roman(int v, String expd) {
|
||||
Bry_bfr bfr = Bry_bfr.new_(16);
|
||||
Pfxtp_roman.ToRoman(v, bfr);
|
||||
String actl = bfr.To_str_and_clear();
|
||||
Tfds.Eq(expd, actl);
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.xtns.pfuncs.times; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import org.junit.*;
|
||||
public class Pft_func_time_uncommon_tst {
|
||||
public class Pft_func_time__uncommon__tst {
|
||||
private Xop_fxt fxt = new Xop_fxt();
|
||||
@Before public void init() {fxt.Reset(); Tfds.Now_set(DateAdp_.new_(2012, 1, 2, 3, 4, 5, 6));}
|
||||
@After public void term() {Tfds.Now_enabled_n_();}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
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.xtns.pfuncs.times; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.xowa.langs.*; import gplx.xowa.langs.msgs.*;
|
||||
class Pft_func_time_foreign_fxt {
|
||||
private Xop_fxt fxt = new Xop_fxt();
|
||||
public void Clear() {
|
||||
fxt.Reset();
|
||||
Tfds.Now_set(DateAdp_.new_(2012, 1, 2, 3, 4, 5, 6));
|
||||
}
|
||||
public void Term() {
|
||||
Tfds.Now_enabled_n_();
|
||||
}
|
||||
public Pft_func_time_foreign_fxt Init_msg(String key, String val) {
|
||||
Xol_msg_itm msg = fxt.Wiki().Msg_mgr().Get_or_make(Bry_.new_u8(key));
|
||||
msg.Atrs_set(Bry_.new_u8(val), false, false);
|
||||
return this;
|
||||
}
|
||||
public void Test_parse(String raw, String expd) {
|
||||
fxt.Test_parse_tmpl_str_test(raw, "{{test}}", expd);
|
||||
}
|
||||
public void Test_Roman(int v, String expd) {
|
||||
Bry_bfr bfr = Bry_bfr.new_(16);
|
||||
Pfxtp_roman.ToRoman(v, bfr);
|
||||
String actl = bfr.To_str_and_clear();
|
||||
Tfds.Eq(expd, actl);
|
||||
}
|
||||
}
|
||||
@@ -88,14 +88,10 @@ class Pxd_eval_seg {
|
||||
switch (itm.Digits()) {
|
||||
case 1:
|
||||
case 2:
|
||||
if (val > 0 && val < 13) {
|
||||
if (val > -1 && val < 13) {
|
||||
tctx.Seg_idxs_(itm, DateAdp_.SegIdx_month);
|
||||
return true;
|
||||
}
|
||||
else if (val == 0) {// 0 day means subtract 1; EX:w:Mariyinsky_Palace; DATE:2014-03-25
|
||||
Pxd_itm_int_.Convert_to_rel(tctx, itm, Pxd_parser_.Unit_name_month, DateAdp_.SegIdx_month, -1);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
tctx.Err_set(Pft_func_time_log.Invalid_month, Bry_fmtr_arg_.int_(val));
|
||||
@@ -106,14 +102,10 @@ class Pxd_eval_seg {
|
||||
switch (itm.Digits()) {
|
||||
case 1:
|
||||
case 2:
|
||||
if (val > 0 && val < 32) {
|
||||
if (val > -1 && val < 32) {
|
||||
tctx.Seg_idxs_(itm, DateAdp_.SegIdx_day);
|
||||
return true;
|
||||
}
|
||||
else if (val == 0) { // 0 day means subtract 1; EX:w:Mariyinsky_Palace; DATE:2014-03-25
|
||||
Pxd_itm_int_.Convert_to_rel(tctx, itm, Pxd_parser_.Unit_name_day, DateAdp_.SegIdx_day, -1);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
tctx.Err_set(Pft_func_time_log.Invalid_day, Bry_fmtr_arg_.int_(val));
|
||||
|
||||
@@ -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.xtns.pfuncs.times; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.core.log_msgs.*;
|
||||
interface Pxd_itm {
|
||||
byte Tkn_tid();
|
||||
int Ary_idx();
|
||||
|
||||
@@ -55,8 +55,18 @@ class Pxd_itm_int extends Pxd_itm_base implements Pxd_itm_int_interface {
|
||||
}
|
||||
bldr.Date_(date);
|
||||
}
|
||||
else
|
||||
bldr.Seg_set(seg_idx, val);
|
||||
else {
|
||||
if (val == 0) { // 0 means subtract 1; EX:w:Mariyinsky_Palace; DATE:2014-03-25
|
||||
DateAdp date = bldr.Date();
|
||||
switch (seg_idx) {
|
||||
case DateAdp_.SegIdx_month: date = DateAdp_.seg_(new int[] {date.Year(), 1, date.Day(), date.Hour(), date.Minute(), date.Second(), date.Frac()}).Add_month(-1); bldr.Date_(date); break;
|
||||
case DateAdp_.SegIdx_day: date = DateAdp_.seg_(new int[] {date.Year(), date.Month(), 1, date.Hour(), date.Minute(), date.Second(), date.Frac()}).Add_day(-1); bldr.Date_(date); break;
|
||||
default: return;
|
||||
}
|
||||
}
|
||||
else
|
||||
bldr.Seg_set(seg_idx, val);
|
||||
}
|
||||
}
|
||||
@Override public void Eval(Pxd_parser tctx) {
|
||||
int data_idx = this.Data_idx();
|
||||
|
||||
@@ -16,7 +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.xtns.pfuncs.times; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.core.btries.*;
|
||||
import gplx.core.btries.*; import gplx.core.log_msgs.*;
|
||||
class Pxd_parser {
|
||||
byte[] src; int cur_pos, tkn_bgn_pos, src_len, tkn_type;
|
||||
public Pxd_itm[] Tkns() {return tkns;} Pxd_itm[] tkns;
|
||||
@@ -140,7 +140,8 @@ class Pxd_parser {
|
||||
return DateAdp_.MinValue;
|
||||
}
|
||||
}
|
||||
DateAdpBldr bldr = new DateAdpBldr(DateAdp_.Now().Year(), 1, 1, 0, 0, 0, 0);
|
||||
DateAdp now = DateAdp_.Now();
|
||||
DateAdpBldr bldr = new DateAdpBldr(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0);
|
||||
for (int i = 0; i < tkns_len; i++) {
|
||||
Pxd_itm itm = (Pxd_itm)tkns[i];
|
||||
itm.Time_ini(bldr);
|
||||
|
||||
@@ -25,20 +25,20 @@ public class Pxd_parser_tst {
|
||||
@Test public void Month_name_0__day__year__bad_day() {tst_date_("Mar 32 2001" , "Invalid day: 32");}
|
||||
@Test public void Month_name_0__day__year__bad_year() {tst_date_("Mar 3 999" , "0999-03-03");}
|
||||
@Test public void Month_name_0__day__year__bad_day_year() {tst_date_("Mar 32 999" , "Invalid day: 32");}
|
||||
@Test public void Month_name_0__year() {tst_date_("Mar 2001" , "2001-03-01");}
|
||||
@Test public void Month_name_0__year() {tst_date_("Mar 2001" , "2001-03-27");}
|
||||
@Test public void Month_name_0__day() {tst_date_("Mar 02" , "2012-03-02");}
|
||||
@Test public void Month_name_0__day_fail() {tst_date_("Mar 32" , "Invalid day: 32");}
|
||||
@Test public void Month_name_0() {tst_date_("Mar" , "2012-03-01");} // y: ,.,.. Feb; n: / Feb, - Feb
|
||||
@Test public void Month_name_0() {tst_date_("Mar" , "2012-03-27");} // y: ,.,.. Feb; n: / Feb, - Feb
|
||||
@Test public void Month_name_1__day__year() {tst_date_("2 Mar 2001" , "2001-03-02");} // y: 3-Feb-2012; 3 Feb 2012;
|
||||
@Test public void Month_name_1__year__day() {tst_date_("2001 Mar 02" , "2001-03-02");} // y: 2012-Feb-3 n:2012.Feb.3;2012 Feb 3; 2012,Feb,3;2012/Feb/3
|
||||
@Test public void Month_name_1__day__year__guess() {tst_date_("02 Mar 01" , "2001-03-02");}
|
||||
@Test public void Month_name_1__day() {tst_date_("02 Mar" , "2012-03-02");}
|
||||
@Test public void Month_name_1__year() {tst_date_("2003 Mar" , "2003-03-01");}
|
||||
@Test public void Month_name_1__year() {tst_date_("2003 Mar" , "2003-03-27");}
|
||||
@Test public void Month_name_2__day__year() {tst_date_("2001.02.Mar" , "2001-03-02");} // y: 2012.5.Feb; 2012 5 Feb n: 2012-5-Feb; 2012/5/Feb
|
||||
@Test public void Year_0__month__day() {tst_date_("2001-03-31" , "2001-03-31");}
|
||||
@Test public void Year_0__day__month__fail() {tst_date_("2001-31-03" , "Invalid month: 31");} // n:2012.31.03; 2012/31/03
|
||||
@Test public void Year_0__month() {tst_date_("2001-03" , "2001-03-01");}
|
||||
@Test public void Year_0() {tst_date_("2001" , "2001-01-01");}
|
||||
@Test public void Year_0__month() {tst_date_("2001-03" , "2001-03-27");}
|
||||
@Test public void Year_0() {tst_date_("2001" , "2001-02-27");}
|
||||
@Test public void Year_1() {tst_date_("31-2001" , "Invalid date: 4 digit year must be either yyyy-##-## or ##-##-yyyy");} // n:31-2012; 31.2012; 31/2012; 03-2012; 03.2012; 03/2012
|
||||
@Test public void Year_2__month__day() {tst_date_("03/31/2001" , "2001-03-31");} // n: 03.31.2012;03-31-2012
|
||||
@Test public void Year_2__day__month() {tst_date_("31-03-2001" , "2001-03-31");} // y: 31.03.2012; n:31/03/2012
|
||||
@@ -58,7 +58,7 @@ public class Pxd_parser_tst {
|
||||
@Test public void Time_len_6() {tst_time_("041526" , "04:15:26.000");}
|
||||
@Test public void Time_len_12() {tst_both_("201601020304" , "2016-01-02 03:04:00.000");} // PURPOSE: handle 12 digit datetime; PAGE:en.w:Boron; DATE:2015-07-29
|
||||
@Test public void Err_one_num() {tst_time_("2" , "Invalid year: 2");} // occurs on some templates; PAGE:en.w:Voyager 1 and {{date}}
|
||||
@Test public void Dmy_at_y_dot() {tst_date_("1.2.70" , "1970-02-01");} // PURPOSE: dmy when delimiter is dot
|
||||
@Test public void Dmy_at_y_dot() {tst_date_("1.2.70" , "1970-02-27");} // PURPOSE: dmy when delimiter is dot
|
||||
@Test public void Mdy_at_y_slash() {tst_date_("1/2/70" , "1970-01-02");} // PURPOSE: mdy when delimiter is slash
|
||||
@Test public void Ago() {tst_date_("1 month ago" , "2012-01-27");}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ public class Pfunc_filepath_tst {
|
||||
}
|
||||
@Test public void Wiki_is_commons() {
|
||||
fxt.Init_page_create(commons_wiki, "File:A.png", "");
|
||||
commons_wiki.Tdb_fsys_mgr().Tdb_dir_regy()[Xotdb_dir_info_.Tid_page].Ext_tid_(gplx.ios.Io_stream_.Tid_raw);
|
||||
commons_wiki.Tdb_fsys_mgr().Tdb_dir_regy()[Xotdb_dir_info_.Tid_page].Ext_tid_(gplx.core.ios.Io_stream_.Tid_raw);
|
||||
mock_wkr.Redirect_("A.png", "A.png").Repo_idx_(1);
|
||||
fxt.Test_parse_tmpl_str_test("{{filepath:A.png}}", "{{test}}", "file:///mem/xowa/file/commons/trg/orig/7/0/1/c/A.png");
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public class Pfunc_ns extends Pf_func_base { // EX: {{ns:6}} -> File
|
||||
canonical_add(ns.Id(), ns.Name_bry());
|
||||
}
|
||||
private static void canonical_add(int ns_id, byte[] ns_name) {
|
||||
Xow_ns ns = new Xow_ns(ns_id, Xow_ns_case_.Id_all, ns_name, false);
|
||||
Xow_ns ns = new Xow_ns(ns_id, Xow_ns_case_.Tid__all, ns_name, false);
|
||||
canonical.Add(ns_name, ns);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.xtns.pfuncs.ttls; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.core.log_msgs.*;
|
||||
public class Pfunc_titleparts_log {
|
||||
private static final Gfo_msg_grp owner = Gfo_msg_grp_.new_(Xoa_app_.Nde, "tmpl_func_titleparts");
|
||||
public static final Gfo_msg_itm
|
||||
|
||||
@@ -16,7 +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.xtns.poems; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.langs.htmls.*; import gplx.xowa.htmls.*;
|
||||
import gplx.langs.htmls.*; import gplx.xowa.htmls.core.htmls.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.xndes.*;
|
||||
public class Poem_nde implements Xox_xnde {
|
||||
private Xop_root_tkn xtn_root;
|
||||
|
||||
@@ -16,7 +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.xtns.proofreadPage; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.xowa.htmls.*;
|
||||
import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.htmls.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.logs.*; import gplx.xowa.parsers.xndes.*; import gplx.xowa.parsers.htmls.*;
|
||||
public class Pp_pagelist_nde implements Xox_xnde { // TODO:
|
||||
public void Xatr__set(Xowe_wiki wiki, byte[] src, Mwh_atr_itm xatr, Object xatr_id_obj) {}
|
||||
|
||||
@@ -16,7 +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.xtns.proofreadPage; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.xowa.htmls.*;
|
||||
import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.htmls.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.xndes.*;
|
||||
public class Pp_pagequality_nde implements Xox_xnde {
|
||||
public void Xtn_parse(Xowe_wiki wiki, Xop_ctx ctx, Xop_root_tkn root, byte[] src, Xop_xnde_tkn xnde) {} // FUTURE: noop for now so it doesn't show (since it's useless)
|
||||
|
||||
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.xtns.proofreadPage; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.core.primitives.*;
|
||||
import gplx.xowa.apps.cfgs.*;
|
||||
import gplx.xowa.htmls.*;
|
||||
import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.htmls.*;
|
||||
import gplx.xowa.wikis.nss.*;
|
||||
import gplx.xowa.xtns.lst.*; import gplx.xowa.wikis.pages.*; import gplx.xowa.wikis.data.tbls.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.amps.*; import gplx.xowa.parsers.xndes.*; import gplx.xowa.parsers.htmls.*; import gplx.xowa.parsers.lnkis.*; import gplx.xowa.parsers.tmpls.*;
|
||||
|
||||
@@ -16,7 +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.xtns.quiz; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.xowa.htmls.*;
|
||||
import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.htmls.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.logs.*; import gplx.xowa.parsers.lnkis.*; import gplx.xowa.parsers.xndes.*;
|
||||
public class Quiz_xnde implements Xox_xnde {
|
||||
public void Xtn_parse(Xowe_wiki wiki, Xop_ctx ctx, Xop_root_tkn root, byte[] src, Xop_xnde_tkn xnde) {}
|
||||
|
||||
@@ -16,7 +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.xtns.rss; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.xowa.htmls.*;
|
||||
import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.htmls.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.logs.*; import gplx.xowa.parsers.lnkis.*; import gplx.xowa.parsers.xndes.*;
|
||||
public class Rss_xnde implements Xox_xnde {
|
||||
public void Xtn_parse(Xowe_wiki wiki, Xop_ctx ctx, Xop_root_tkn root, byte[] src, Xop_xnde_tkn xnde) {}
|
||||
|
||||
@@ -21,7 +21,7 @@ public class Rss_xnde_tst {
|
||||
private Xop_fxt fxt = new Xop_fxt();
|
||||
@Before public void init() {fxt.Reset();}
|
||||
@Test public void Basic() {
|
||||
fxt.Test_parse_page_all_str("<rss max='6'>http://blog.wikimedia.org/feed/</rss>", "XOWA does not support this extension: <rss max='6'><a href=\"http://blog.wikimedia.org/feed/\" class=\"external text\" rel=\"nofollow\">http://blog.wikimedia.org/feed/</a></rss>");
|
||||
fxt.Test_parse_page_all_str("<rss max='6'>http://blog.wikimedia.org/feed/</rss>", "XOWA does not support this extension: <rss max='6'><a href=\"http://blog.wikimedia.org/feed/\" rel=\"nofollow\" class=\"external free\">http://blog.wikimedia.org/feed/</a></rss>");
|
||||
fxt.Test_parse_page_all_str("<rss />", "XOWA does not support this extension: <rss />");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.xtns.scores; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.core.primitives.*;
|
||||
import gplx.xowa.htmls.*; import gplx.xowa.files.*;
|
||||
import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.htmls.*; import gplx.xowa.files.*;
|
||||
import gplx.xowa.guis.views.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.logs.*; import gplx.xowa.parsers.xndes.*; import gplx.xowa.parsers.htmls.*; import gplx.xowa.parsers.lnkis.*;
|
||||
public class Score_xnde implements Xox_xnde, Mwh_atr_itm_owner, Xoh_cmd_itm {
|
||||
@@ -68,7 +68,7 @@ public class Score_xnde implements Xox_xnde, Mwh_atr_itm_owner, Xoh_cmd_itm {
|
||||
if (ly_process.Exe_exists() == Bool_.N_byte) {Html_write_code_as_pre(bfr, app); return;}
|
||||
Bry_bfr tmp_bfr = wiki.Utl__bfr_mkr().Get_b128();
|
||||
tmp_bfr.Add(code).Add_byte_pipe().Add_int_bool(lang_is_abc).Add_byte_pipe().Add_int_bool(code_is_raw);
|
||||
sha1 = gplx.security.HashAlgo_.Sha1.Calc_hash_bry(tmp_bfr.To_bry_and_rls()); // NOTE: MW transforms to base32; for now, keep sha1 as raw
|
||||
sha1 = gplx.core.security.HashAlgo_.Sha1.Calc_hash_bry(tmp_bfr.To_bry_and_rls()); // NOTE: MW transforms to base32; for now, keep sha1 as raw
|
||||
sha1_prefix = String_.new_a7(sha1, 0, 8);
|
||||
output_dir = app.Fsys_mgr().File_dir().GenSubDir_nest(wiki.Domain_str(), "lilypond", Char_.To_str(sha1[0]), Char_.To_str(sha1[1]), String_.new_a7(sha1)); // NOTE: MW also adds an extra level for 8-len; EX: /.../sha1_32_len/sha1_8_len/
|
||||
png_file = output_dir.GenSubFil(sha1_prefix + ".png");
|
||||
@@ -180,9 +180,9 @@ public class Score_xnde implements Xox_xnde, Mwh_atr_itm_owner, Xoh_cmd_itm {
|
||||
}
|
||||
public static byte[] Get_lilypond_version(String rslt_str) {
|
||||
byte[] rslt = Bry_.new_u8(rslt_str); // expect 1st line to be of form "GNU LilyPond 2.16.2"
|
||||
int bgn_pos = Bry_find_.Find_fwd(rslt, Version_find_bgn); if (bgn_pos == Bry_.NotFound) return Version_unknown;
|
||||
int bgn_pos = Bry_find_.Find_fwd(rslt, Version_find_bgn); if (bgn_pos == Bry_find_.Not_found) return Version_unknown;
|
||||
bgn_pos += Version_find_bgn.length + 1; // +1 for trailing space
|
||||
int end_pos = Bry_find_.Find_fwd(rslt, Byte_ascii.Nl, bgn_pos); if (bgn_pos == Bry_.NotFound) return Version_unknown;
|
||||
int end_pos = Bry_find_.Find_fwd(rslt, Byte_ascii.Nl, bgn_pos); if (bgn_pos == Bry_find_.Not_found) return Version_unknown;
|
||||
if (rslt[end_pos - 1] == Byte_ascii.Cr) end_pos = end_pos - 1;
|
||||
return Bry_.Mid(rslt, bgn_pos, end_pos);
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ public class Scrib_core {
|
||||
func_args = Scrib_kv_utl_.base1_many_(proc);
|
||||
func_rslt = engine.CallFunction(lib_mw.Mod().Fncs_get_id("executeFunction"), func_args); // call function now
|
||||
String rslt = Scrib_kv_utl_.Val_to_str(func_rslt, 0); // rslt expects an array with 1 scalar value
|
||||
bfr.Add_str(rslt);
|
||||
bfr.Add_str_u8(rslt);
|
||||
// byte[] rslt_bry = Bry_.new_u8(rslt); // CHART
|
||||
// gplx.xowa.parsers.xndes.Xop_xnde_tkn.Hack_ctx = ctx;
|
||||
// bfr.Add(rslt_bry);
|
||||
|
||||
@@ -31,7 +31,7 @@ public class Scrib_fsys_mgr {
|
||||
public String Get_or_null(String name) {
|
||||
if (libs == null) libs = libs_init(script_dir);
|
||||
Object lib_fil_obj = libs.Get_by(name); if (lib_fil_obj == null) return null;
|
||||
gplx.ios.Io_fil lib_fil = (gplx.ios.Io_fil)lib_fil_obj;
|
||||
gplx.core.ios.Io_fil lib_fil = (gplx.core.ios.Io_fil)lib_fil_obj;
|
||||
String lib_data = lib_fil.Data();
|
||||
if (lib_data == null) {
|
||||
lib_data = Io_mgr.Instance.LoadFilStr(lib_fil.Url());
|
||||
@@ -46,7 +46,7 @@ public class Scrib_fsys_mgr {
|
||||
for (int i = 0; i < fils_len; i++) {
|
||||
Io_url fil = fils[i];
|
||||
if (!String_.Eq(fil.Ext(), ".lua")) continue; // ignore readme.txt, readme
|
||||
gplx.ios.Io_fil fil_itm = new gplx.ios.Io_fil(fil, null);
|
||||
gplx.core.ios.Io_fil fil_itm = new gplx.core.ios.Io_fil(fil, null);
|
||||
rv.Add_if_dupe_use_1st(fil.NameOnly(), fil_itm);
|
||||
rv.Add_if_dupe_use_1st(String_.Replace(String_.DelEndIf(fil.GenRelUrl_orEmpty(script_dir), ".lua"), "\\", "/"), fil_itm);
|
||||
}
|
||||
@@ -55,7 +55,7 @@ public class Scrib_fsys_mgr {
|
||||
public void Shrink() {
|
||||
int len = libs.Count();
|
||||
for (int i = 0; i < len; i++) {
|
||||
gplx.ios.Io_fil fil = (gplx.ios.Io_fil)libs.Get_at(i);
|
||||
gplx.core.ios.Io_fil fil = (gplx.core.ios.Io_fil)libs.Get_at(i);
|
||||
fil.Url_(null).Data_(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,10 +58,10 @@ public class Scrib_invoke_func extends Pf_func_base {
|
||||
if (invoke_wkr != null)
|
||||
invoke_wkr.Eval_end(ctx.Cur_page(), mod_name, fnc_name, log_time_bgn);
|
||||
}
|
||||
catch (Exception e) {
|
||||
Error(bfr, wiki.Msg_mgr(), e);
|
||||
catch (Throwable e) {
|
||||
Err err = Err_.cast_or_make(e);
|
||||
bfr.Add(Html_tag_.Comm_bgn).Add_str(err.To_str__full()).Add(Html_tag_.Comm_end);
|
||||
Error(bfr, wiki.Msg_mgr(), err);
|
||||
bfr.Add(Html_tag_.Comm_bgn).Add_str_u8(err.To_str__full()).Add(Html_tag_.Comm_end);
|
||||
Scrib_err_filter_mgr err_filter_mgr = invoke_wkr == null ? null : invoke_wkr.Err_filter_mgr();
|
||||
if ( err_filter_mgr == null // no err_filter_mgr defined;
|
||||
|| err_filter_mgr.Count_eq_0( ) // err_filter_mgr exists, but no definitions
|
||||
@@ -70,7 +70,7 @@ public class Scrib_invoke_func extends Pf_func_base {
|
||||
Scrib_core.Core_invalidate_when_page_changes(); // NOTE: invalidate core when page changes, not for rest of page, else page with many errors will be very slow due to multiple invalidations; PAGE:th.d:all; DATE:2014-10-03
|
||||
}
|
||||
}
|
||||
public static void Error(Bry_bfr bfr, Xow_msg_mgr msg_mgr, Exception e) {Error(bfr, msg_mgr, Err_.cast_or_make(e).To_str__top_wo_args());}// NOTE: must use "short" error message to show in wikitext; DATE:2015-07-27
|
||||
public static void Error(Bry_bfr bfr, Xow_msg_mgr msg_mgr, Err err) {Error(bfr, msg_mgr, Err_.cast_or_make(err).To_str__top_wo_args());}// NOTE: must use "short" error message to show in wikitext; DATE:2015-07-27
|
||||
public static void Error(Bry_bfr bfr, Xow_msg_mgr msg_mgr, String error) {
|
||||
byte[] script_error_msg = msg_mgr.Val_by_id(Xol_msg_itm_.Id_scribunto_parser_error);
|
||||
error_fmtr.Bld_bfr_many(bfr, script_error_msg, error);
|
||||
|
||||
@@ -88,7 +88,7 @@ public class Scrib_invoke_func_fxt {
|
||||
fxt.Test_parse_page_tmpl_str(raw, tmp_bfr.To_str_and_clear());
|
||||
}
|
||||
public void Test_error(Exception e, String expd) {
|
||||
Scrib_invoke_func.Error(tmp_bfr, fxt.Wiki().Msg_mgr(), e);
|
||||
Scrib_invoke_func.Error(tmp_bfr, fxt.Wiki().Msg_mgr(), Err_.cast_or_make(e));
|
||||
Tfds.Eq_str(expd, tmp_bfr.To_str_and_clear(), "error");
|
||||
}
|
||||
public void Test_lib_proc(Scrib_lib lib, String func_name, Object[] args, String expd) {Test_lib_proc_kv(lib, func_name, Scrib_kv_utl_.base1_many_(args), expd);}
|
||||
@@ -138,7 +138,7 @@ public class Scrib_invoke_func_fxt {
|
||||
for (int i = 0; i < len; ++i) {
|
||||
if (i != 0) bfr.Add_byte(Byte_ascii.Semic);
|
||||
KeyVal kv = ary[i];
|
||||
bfr.Add_str(Object_.Xto_str_strict_or_null_mark(kv.Val()));
|
||||
bfr.Add_str_u8(Object_.Xto_str_strict_or_null_mark(kv.Val()));
|
||||
}
|
||||
return bfr.To_str_and_clear();
|
||||
}
|
||||
@@ -201,11 +201,11 @@ class Scrib_lua_rsp_bldr {
|
||||
private void Bld_bool(Bry_bfr bfr, boolean v) {bfr.Add_str_a7("b:").Add_int_fixed(v ? 1 : 0, 1).Add_byte(Byte_ascii.Semic);}
|
||||
private void Bld_int(Bry_bfr bfr, int v) {bfr.Add_str_a7("i:").Add_int_variable(v).Add_byte(Byte_ascii.Semic);}
|
||||
private void Bld_double(Bry_bfr bfr, double v) {bfr.Add_str_a7("d:").Add_double(v).Add_byte(Byte_ascii.Semic);}
|
||||
private void Bld_str(Bry_bfr bfr, String v) {bfr.Add_str_a7("s:").Add_int_variable(Bry_.new_u8(v).length).Add_str(":\"").Add_str(v).Add_str("\";");} // NOTE: must use Bry_.new_u8(v).length to calculate full bry len
|
||||
private void Bld_str(Bry_bfr bfr, String v) {bfr.Add_str_a7("s:").Add_int_variable(Bry_.new_u8(v).length).Add_str_a7(":\"").Add_str_a7(v).Add_str_a7("\";");} // NOTE: must use Bry_.new_u8(v).length to calculate full bry len
|
||||
private void Bld_fnc(Bry_bfr bfr, Scrib_lua_proc v) {bfr.Add_str_a7("O:42:\"Scribunto_LuaStandaloneInterpreterFunction\":1:{s:2:\"id\";i:").Add_int_variable(v.Id()).Add_byte(Byte_ascii.Semic).Add_byte(Byte_ascii.Curly_end);}
|
||||
private void Bld_kv_ary(Bry_bfr bfr, KeyVal[] ary) {
|
||||
int len = ary.length;
|
||||
bfr.Add_str_a7("a:").Add_int_variable(len).Add_str(":{");
|
||||
bfr.Add_str_a7("a:").Add_int_variable(len).Add_str_a7(":{");
|
||||
for (int i = 0; i < len; i++) {
|
||||
KeyVal kv = ary[i];
|
||||
Bld_obj(bfr, kv.Key_as_obj());
|
||||
|
||||
@@ -92,9 +92,9 @@ public class Scrib_proc_args {
|
||||
for (int i = 0; i < len; i++) {
|
||||
KeyVal kv = kvs[i];
|
||||
if (i != 0) bfr.Add_byte(Byte_ascii.Amp);
|
||||
bfr.Add_str(kv.Key());
|
||||
bfr.Add_str_u8(kv.Key());
|
||||
bfr.Add_byte(Byte_ascii.Eq);
|
||||
bfr.Add_str(kv.Val_to_str_or_empty());
|
||||
bfr.Add_str_u8(kv.Val_to_str_or_empty());
|
||||
}
|
||||
return bfr.To_bry_and_rls();
|
||||
}
|
||||
|
||||
@@ -27,12 +27,12 @@ public class Luaj_server_func_dbg extends VarArgFunction {
|
||||
public Varargs invoke(Varargs args) {
|
||||
int len = args.narg();
|
||||
Bry_bfr bfr = Bry_bfr.new_();
|
||||
bfr.Add_str("<span class='xowa_dbg' style='color:red'>");
|
||||
bfr.Add_str_a7("<span class='xowa_dbg' style='color:red'>");
|
||||
for (int i = 1; i <= len; ++i) {
|
||||
String s = args.arg(i).toString();
|
||||
bfr.Add_str(gplx.langs.htmls.Html_utl.Escape_html_as_str(s) + " ");
|
||||
bfr.Add_str_u8(gplx.langs.htmls.Html_utl.Escape_html_as_str(s) + " ");
|
||||
}
|
||||
bfr.Add_str("</span><br/>");
|
||||
bfr.Add_str_a7("</span><br/>");
|
||||
core.Page().Html_data().Xtn_scribunto_dbg_(bfr.To_bry_and_clear());
|
||||
return NONE;
|
||||
}
|
||||
|
||||
@@ -16,7 +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.xtns.scribunto.engines.process; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.scribunto.*; import gplx.xowa.xtns.scribunto.engines.*;
|
||||
import gplx.texts.*;
|
||||
import gplx.core.texts.*;
|
||||
import gplx.xowa.xtns.scribunto.libs.*;
|
||||
public class Process_engine implements Scrib_engine {
|
||||
private Scrib_core core; private Xoae_app app; private Scrib_xtn_mgr scrib_opts;
|
||||
|
||||
@@ -17,10 +17,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.xtns.scribunto.engines.process; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.scribunto.*; import gplx.xowa.xtns.scribunto.engines.*;
|
||||
import gplx.core.threads.*;
|
||||
import gplx.texts.HexDecUtl;
|
||||
import gplx.core.texts.HexDecUtl;
|
||||
import gplx.xowa.xtns.scribunto.*;
|
||||
import gplx.core.threads.Thread_adp_;
|
||||
import gplx.ios.*;
|
||||
import java.io.*;
|
||||
public class Process_server implements Scrib_server {
|
||||
private Process process;
|
||||
|
||||
@@ -73,7 +73,7 @@ class Process_server_mock_rcvd_val implements Process_server_mock_rcvd {
|
||||
Class<?> kv_val_type = kv_val.getClass();
|
||||
boolean kv_val_is_array = Type_adp_.Eq(kv_val_type, KeyVal[].class);
|
||||
if (print_key && !kv_val_is_array)
|
||||
bfr.Add_str(kv.Key()).Add_byte(Byte_ascii.Colon);
|
||||
bfr.Add_str_u8(kv.Key()).Add_byte(Byte_ascii.Colon);
|
||||
if (Type_adp_.Eq(kv_val_type, Bool_.Cls_ref_type))
|
||||
bfr.Add(Bool_.cast(kv_val) ? gplx.langs.jsons.Json_itm_.Bry__true : gplx.langs.jsons.Json_itm_.Bry__false);
|
||||
else if (kv_val_is_array) {
|
||||
@@ -86,7 +86,7 @@ class Process_server_mock_rcvd_val implements Process_server_mock_rcvd {
|
||||
}
|
||||
}
|
||||
else
|
||||
bfr.Add_str(kv.Val_to_str_or_empty());
|
||||
bfr.Add_str_u8(kv.Val_to_str_or_empty());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +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.xtns.scribunto.engines.process; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.scribunto.*; import gplx.xowa.xtns.scribunto.engines.*;
|
||||
import gplx.ios.*; import gplx.texts.*;
|
||||
import gplx.core.ios.*; import gplx.core.texts.*;
|
||||
public class Process_stream_rdr {
|
||||
public Process_stream_rdr(byte[] bry_header, byte[] bry_body) {this.bry_header = bry_header; this.bry_body = bry_body;} private byte[] bry_header, bry_body;
|
||||
public IoStream_stream_rdr Rdr() {return rdr;} IoStream_stream_rdr rdr = new IoStream_stream_rdr();
|
||||
|
||||
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.xtns.scribunto.engines.process; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.scribunto.*; import gplx.xowa.xtns.scribunto.engines.*;
|
||||
import org.junit.*;
|
||||
import gplx.ios.*;
|
||||
import gplx.core.ios.*;
|
||||
public class Process_stream_rdr_tst {
|
||||
@Before public void init() {fxt.Clear();} Scrib_lua_srl_fxt fxt = new Scrib_lua_srl_fxt();
|
||||
@Test public void Body_basic() {
|
||||
|
||||
@@ -142,17 +142,17 @@ public class Scrib_lib_mw implements Scrib_lib {
|
||||
return invk.Args_get_by_key(src, Bry_.To_a7_bry(idx + 1, 1));
|
||||
}
|
||||
private static boolean Verify_arg_key(byte[] src, int idx, Arg_nde_tkn nde) {
|
||||
int key_int = Bry_.NotFound;
|
||||
int key_int = Bry_find_.Not_found;
|
||||
byte[] key_dat_ary = nde.Key_tkn().Dat_ary();
|
||||
if (Env_.Mode_testing() && src == null) // some tests will always pass a null src;
|
||||
key_int = Bry_.To_int_or(key_dat_ary, 0, key_dat_ary.length, Bry_.NotFound);
|
||||
key_int = Bry_.To_int_or(key_dat_ary, 0, key_dat_ary.length, Bry_find_.Not_found);
|
||||
else {
|
||||
if (Bry_.Len_eq_0(key_dat_ary)) // should be called by current context;
|
||||
key_int = Bry_.To_int_or(src, nde.Key_tkn().Src_bgn(), nde.Key_tkn().Src_end(), Bry_.NotFound);
|
||||
key_int = Bry_.To_int_or(src, nde.Key_tkn().Src_bgn(), nde.Key_tkn().Src_end(), Bry_find_.Not_found);
|
||||
else // will be called by parent context; note that this calls Xot_defn_tmpl_.Make_itm which sets a key_dat_ary; DATE:2013-09-23
|
||||
key_int = Bry_.To_int_or(key_dat_ary, 0, key_dat_ary.length, Bry_.NotFound);
|
||||
key_int = Bry_.To_int_or(key_dat_ary, 0, key_dat_ary.length, Bry_find_.Not_found);
|
||||
}
|
||||
if (key_int == Bry_.NotFound) // key is not-numeric
|
||||
if (key_int == Bry_find_.Not_found) // key is not-numeric
|
||||
return false;
|
||||
else // key is numeric
|
||||
return idx == key_int;
|
||||
@@ -286,7 +286,7 @@ public class Scrib_lib_mw implements Scrib_lib {
|
||||
byte[] fnc_name = fnc_name_ref.Val();
|
||||
int fnc_name_len = fnc_name.length;
|
||||
int fnc_name_colon_pos = Bry_find_.Find_fwd(fnc_name, Byte_ascii.Colon, 0, fnc_name_len);
|
||||
if (fnc_name_colon_pos == Bry_.NotFound) {
|
||||
if (fnc_name_colon_pos == Bry_find_.Not_found) {
|
||||
KeyVal arg_argx = (KeyVal)rv.Get_at(0);
|
||||
argx_ref.Val_(arg_argx.Val_to_bry());
|
||||
rv.Del_at(0);
|
||||
|
||||
@@ -119,11 +119,11 @@ public class Scrib_lib_title implements Scrib_lib {
|
||||
String anchor_str = args.Cast_str_or_null(2);
|
||||
String xwiki_str = args.Cast_str_or_null(3);
|
||||
Bry_bfr tmp_bfr = wiki.Utl__bfr_mkr().Get_k004();
|
||||
if (xwiki_str != null) tmp_bfr.Add_str(xwiki_str).Add_byte(Byte_ascii.Colon);
|
||||
if (xwiki_str != null) tmp_bfr.Add_str_u8(xwiki_str).Add_byte(Byte_ascii.Colon);
|
||||
if (Bry_.Len_gt_0(ns_bry)) // only prefix ns if available; EX:"Template:Title"; else will get ":Title"; DATE:2014-10-30
|
||||
tmp_bfr.Add(ns_bry).Add_byte(Byte_ascii.Colon);
|
||||
tmp_bfr.Add_str(ttl_str);
|
||||
if (anchor_str != null) tmp_bfr.Add_byte(Byte_ascii.Hash).Add_str(anchor_str);
|
||||
tmp_bfr.Add_str_u8(ttl_str);
|
||||
if (anchor_str != null) tmp_bfr.Add_byte(Byte_ascii.Hash).Add_str_u8(anchor_str);
|
||||
Xoa_ttl ttl = Xoa_ttl.parse(wiki, tmp_bfr.To_bry_and_rls());
|
||||
if (ttl == null) return rslt.Init_obj(null); // invalid title; exit;
|
||||
return rslt.Init_obj(GetInexpensiveTitleData(ttl));
|
||||
|
||||
@@ -63,7 +63,7 @@ public class Scrib_lib_ustring implements Scrib_lib {
|
||||
return rslt.Init_many_objs(bgn_codepoint_idx + Scrib_lib_ustring.Base1, bgn_codepoint_idx + Scrib_lib_ustring.Base1 - 1);
|
||||
if (plain) {
|
||||
int pos = String_.FindFwd(text_str, regx, bgn_codepoint_idx);
|
||||
boolean found = pos != Bry_.NotFound;
|
||||
boolean found = pos != Bry_find_.Not_found;
|
||||
return found
|
||||
? rslt.Init_many_objs(pos + Scrib_lib_ustring.Base1, pos + Scrib_lib_ustring.Base1 + String_.Len(regx) - Scrib_lib_ustring.End_adj)
|
||||
: rslt.Init_ary_empty()
|
||||
@@ -224,14 +224,14 @@ class Scrib_lib_ustring_gsub_mgr {
|
||||
for (int i = 0; i < len; i++) {
|
||||
if (limit > -1 && repl_count == limit) break;
|
||||
Regx_match rslt = rslts[i];
|
||||
tmp_bfr.Add_str(String_.Mid(text, pos, rslt.Find_bgn())); // NOTE: regx returns char pos (not bry); must add as String, not bry; DATE:2013-07-17
|
||||
tmp_bfr.Add_str_u8(String_.Mid(text, pos, rslt.Find_bgn())); // NOTE: regx returns char pos (not bry); must add as String, not bry; DATE:2013-07-17
|
||||
Exec_repl_itm(tmp_bfr, repl_tid, repl_bry, text, rslt);
|
||||
pos = rslt.Find_end();
|
||||
++repl_count;
|
||||
}
|
||||
int text_len = String_.Len(text);
|
||||
if (pos < text_len)
|
||||
tmp_bfr.Add_str(String_.Mid(text, pos, text_len)); // NOTE: regx returns char pos (not bry); must add as String, not bry; DATE:2013-07-17
|
||||
tmp_bfr.Add_str_u8(String_.Mid(text, pos, text_len)); // NOTE: regx returns char pos (not bry); must add as String, not bry; DATE:2013-07-17
|
||||
return tmp_bfr.To_str_and_clear();
|
||||
}
|
||||
private void Exec_repl_itm(Bry_bfr tmp_bfr, byte repl_tid, byte[] repl_bry, String text, Regx_match match) {
|
||||
@@ -257,7 +257,7 @@ class Scrib_lib_ustring_gsub_mgr {
|
||||
idx -= List_adp_.Base1;
|
||||
if (idx < match.Groups().length) { // retrieve numbered capture; TODO: support more than 9 captures
|
||||
Regx_group grp = match.Groups()[idx];
|
||||
tmp_bfr.Add_str(String_.Mid(text, grp.Bgn(), grp.End())); // NOTE: grp.Bgn() / .End() is for String pos (bry pos will fail for utf8 strings)
|
||||
tmp_bfr.Add_str_u8(String_.Mid(text, grp.Bgn(), grp.End())); // NOTE: grp.Bgn() / .End() is for String pos (bry pos will fail for utf8 strings)
|
||||
}
|
||||
else {
|
||||
tmp_bfr.Add_byte(Byte_ascii.Percent);
|
||||
@@ -297,7 +297,7 @@ class Scrib_lib_ustring_gsub_mgr {
|
||||
String find_str = String_.Mid(text, match_bgn, match_end); // NOTE: rslt.Bgn() / .End() is for String pos (bry pos will fail for utf8 strings)
|
||||
Object actl_repl_obj = repl_hash.Get_by(find_str);
|
||||
if (actl_repl_obj == null) // match found, but no replacement specified; EX:"abc", "[ab]", "a:A"; "b" in regex but not in tbl; EX:d:DVD; DATE:2014-03-31
|
||||
tmp_bfr.Add_str(find_str);
|
||||
tmp_bfr.Add_str_u8(find_str);
|
||||
else
|
||||
tmp_bfr.Add((byte[])actl_repl_obj);
|
||||
break;
|
||||
@@ -319,7 +319,7 @@ class Scrib_lib_ustring_gsub_mgr {
|
||||
}
|
||||
}
|
||||
KeyVal[] rslts = core.Interpreter().CallFunction(repl_func.Id(), luacbk_args);
|
||||
tmp_bfr.Add_str(Scrib_kv_utl_.Val_to_str(rslts, 0));
|
||||
tmp_bfr.Add_str_u8(Scrib_kv_utl_.Val_to_str(rslts, 0));
|
||||
break;
|
||||
}
|
||||
default: throw Err_.new_unhandled(repl_tid);
|
||||
|
||||
@@ -79,7 +79,7 @@ public class Scrib_lib_wikibase implements Scrib_lib {
|
||||
}
|
||||
public boolean ResolvePropertyId(Scrib_proc_args args, Scrib_proc_rslt rslt) {
|
||||
byte[] prop = args.Pull_bry(0); if (Bry_.Len_eq_0(prop)) return rslt.Init_ary_empty();
|
||||
Wdata_doc wdoc = Get_wdoc(Bry_.Add(Byte_ascii.Ltr_p, prop)); if (wdoc == null) return rslt.Init_ary_empty();
|
||||
Wdata_doc wdoc = Get_wdoc(prop); if (wdoc == null) return rslt.Init_ary_empty(); // prop should be of form "P123"; do not add "P"; PAGE:no.w:Anne_Enger; DATE:2015-10-27
|
||||
return rslt.Init_obj(wdoc.Label_list__get_or_fallback(core.Lang()));
|
||||
}
|
||||
public boolean GetSiteLinkPageName(Scrib_proc_args args, Scrib_proc_rslt rslt) {
|
||||
|
||||
@@ -406,12 +406,12 @@ class Scrib_lib_wikibase_srl_fxt {
|
||||
}
|
||||
private void Xto_str(Bry_bfr bfr, KeyVal kv, int depth) {
|
||||
bfr.Add_byte_repeat(Byte_ascii.Space, depth * 2);
|
||||
bfr.Add_str(kv.Key()).Add_byte(Byte_ascii.Colon);
|
||||
bfr.Add_str_u8(kv.Key()).Add_byte(Byte_ascii.Colon);
|
||||
Object kv_val = kv.Val();
|
||||
if (kv_val == null) {bfr.Add_str_a7("null").Add_byte_nl(); return;}
|
||||
Class<?> kv_val_cls = kv_val.getClass();
|
||||
if (Type_adp_.Eq(kv_val_cls, KeyVal[].class)) {bfr.Add_byte_nl(); Xto_str(bfr, (KeyVal[])kv_val, depth + 1);}
|
||||
else if (Type_adp_.Eq(kv_val_cls, KeyVal[].class)) {bfr.Add_byte_nl(); Xto_str(bfr, (KeyVal)kv_val, depth + 1);}
|
||||
else bfr.Add_byte(Byte_ascii.Apos).Add_str(Object_.Xto_str_strict_or_empty(kv_val)).Add_byte(Byte_ascii.Apos).Add_byte_nl();
|
||||
else bfr.Add_byte(Byte_ascii.Apos).Add_str_u8(Object_.Xto_str_strict_or_empty(kv_val)).Add_byte(Byte_ascii.Apos).Add_byte_nl();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,6 +87,6 @@ public class Scrib_lib_wikibase_tst {
|
||||
}
|
||||
@Test public void ResolvePropertyId() {
|
||||
wdata_fxt.Init_pages_add(wdata_fxt.Wdoc_bldr("Property:p2").Add_label("zh-hans", "prop_a").Xto_wdoc());
|
||||
fxt.Test_scrib_proc_str(lib, Scrib_lib_wikibase.Invk_resolvePropertyId, Object_.Ary("2"), "prop_a");
|
||||
fxt.Test_scrib_proc_str(lib, Scrib_lib_wikibase.Invk_resolvePropertyId, Object_.Ary("p2"), "prop_a");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.xtns.syntax_highlights; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.core.primitives.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.xndes.*; import gplx.xowa.parsers.htmls.*;
|
||||
import gplx.xowa.htmls.*;
|
||||
import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.htmls.*;
|
||||
public class Synh_xtn_nde implements Xox_xnde, Mwh_atr_itm_owner {
|
||||
private byte[] lang = Bry_.Empty; private byte[] style = null; private byte[] enclose = Bry_.Empty;
|
||||
private boolean line_enabled = false; private int start = 1; private Int_rng_mgr highlight_idxs = Int_rng_mgr_null.Instance;
|
||||
|
||||
@@ -16,7 +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.xtns.templateData; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.xowa.htmls.*;
|
||||
import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.htmls.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.xndes.*; import gplx.xowa.parsers.htmls.*;
|
||||
public class Xtn_templateData_nde implements Xox_xnde {
|
||||
public Xop_xnde_tkn Xnde() {return xnde;} private Xop_xnde_tkn xnde;
|
||||
|
||||
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.xtns.translates; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.core.primitives.*;
|
||||
import gplx.xowa.wikis.nss.*;
|
||||
import gplx.xowa.htmls.*; import gplx.xowa.htmls.hrefs.*; import gplx.xowa.langs.*; import gplx.xowa.wikis.data.tbls.*;
|
||||
import gplx.xowa.htmls.core.htmls.*; import gplx.xowa.htmls.hrefs.*; import gplx.xowa.langs.*; import gplx.xowa.wikis.data.tbls.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.xndes.*;
|
||||
public class Xop_languages_xnde implements Xox_xnde {
|
||||
public Xop_xnde_tkn Xnde() {return xnde;} private Xop_xnde_tkn xnde;
|
||||
@@ -31,7 +31,7 @@ public class Xop_languages_xnde implements Xox_xnde {
|
||||
private Xoa_ttl Root_ttl_of(Xowe_wiki wiki, Xoa_ttl ttl) {
|
||||
byte[] page_bry = ttl.Page_db();
|
||||
int slash_pos = Bry_find_.Find_bwd(page_bry, Xoa_ttl.Subpage_spr);
|
||||
if (slash_pos == Bry_.NotFound) return ttl;
|
||||
if (slash_pos == Bry_find_.Not_found) return ttl;
|
||||
byte[] root_bry = Bry_.Mid(page_bry, 0, slash_pos);
|
||||
return Xoa_ttl.parse(wiki, ttl.Ns().Id(), root_bry);
|
||||
}
|
||||
|
||||
@@ -16,7 +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.xtns.translates; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.xowa.htmls.*;
|
||||
import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.htmls.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.xndes.*; import gplx.xowa.parsers.htmls.*;
|
||||
public class Xop_translate_xnde implements Xox_xnde {
|
||||
public Xop_root_tkn Xtn_root() {return xtn_root;} private Xop_root_tkn xtn_root;
|
||||
|
||||
@@ -25,8 +25,8 @@ public class Xop_tvar_lxr implements Xop_lxr {
|
||||
public void Term(Btrie_fast_mgr core_trie) {}
|
||||
private static final byte[] Hook_bgn = Bry_.new_a7("<tvar|"), Close_nde = Bry_.new_a7("</>");
|
||||
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 rhs_end = Bry_find_.Find_fwd(src, Byte_ascii.Gt, cur_pos); if (rhs_end == Bry_.NotFound) return ctx.Lxr_make_txt_(cur_pos);
|
||||
int lhs_bgn = Bry_find_.Find_fwd(src, Close_nde , rhs_end); if (lhs_bgn == Bry_.NotFound) return ctx.Lxr_make_txt_(cur_pos);
|
||||
int rhs_end = Bry_find_.Find_fwd(src, Byte_ascii.Gt, cur_pos); if (rhs_end == Bry_find_.Not_found) return ctx.Lxr_make_txt_(cur_pos);
|
||||
int lhs_bgn = Bry_find_.Find_fwd(src, Close_nde , rhs_end); if (lhs_bgn == Bry_find_.Not_found) return ctx.Lxr_make_txt_(cur_pos);
|
||||
byte[] body = Bry_.Mid(src, rhs_end + Int_.Const_position_after_char, lhs_bgn);
|
||||
Xop_ctx sub_ctx = Xop_ctx.new_sub_(ctx.Wiki());
|
||||
Xop_root_tkn sub_root = tkn_mkr.Root(body);
|
||||
|
||||
@@ -116,7 +116,7 @@ public class Wdata_wiki_mgr implements GfoEvObj, GfoInvkAble {
|
||||
public static byte[] Get_low_qid(byte[] bry) { // HACK: wdata currently does not differentiate between "Vandalism" and "Wikipedia:Vandalism", combining both into "Vandalism:q4664011|q6160"; get lowest qid
|
||||
int bry_len = bry.length;
|
||||
int pipe_pos = Bry_find_.Find_fwd(bry, Byte_ascii.Pipe, 0, bry_len);
|
||||
if (pipe_pos == Bry_.NotFound) return bry;
|
||||
if (pipe_pos == Bry_find_.Not_found) return bry;
|
||||
byte[][] qids = Bry_split_.Split(bry, Byte_ascii.Pipe);
|
||||
int qids_len = qids.length;
|
||||
int qid_min = Int_.Max_value;
|
||||
|
||||
@@ -52,14 +52,14 @@ class Wdata_visitor__html_wtr implements Wdata_claim_visitor {
|
||||
tmp_bfr.Add(itm.Amount()).Add_byte_space();
|
||||
if (hi_diff.Eq(lo_diff)) { // delta is same in both directions; EX: val=50 hi=60 lo=40 -> hi_diff == lo_diff == 10
|
||||
if (hi_diff_val != 0) // skip if 0
|
||||
tmp_bfr.Add(msgs.Sym_plusminus()).Add_str(hi_diff.To_str());
|
||||
tmp_bfr.Add(msgs.Sym_plusminus()).Add_str_a7(hi_diff.To_str());
|
||||
}
|
||||
else { // delta is diff in both directions; EX: val=50 hi=60 lo=30 -> hi_diff == 10, lo_diff == 20
|
||||
if (hi_diff_val != 0) // skip if 0
|
||||
tmp_bfr.Add(msgs.Sym_plus()).Add_str(hi_diff.To_str());
|
||||
tmp_bfr.Add(msgs.Sym_plus()).Add_str_a7(hi_diff.To_str());
|
||||
if (lo_diff_val != 0) { // skip if 0
|
||||
if (hi_diff_val != 0) tmp_bfr.Add(Time_plus_minus_spr);
|
||||
tmp_bfr.Add(msgs.Sym_minus()).Add_str(lo_diff.To_str());
|
||||
tmp_bfr.Add(msgs.Sym_minus()).Add_str_a7(lo_diff.To_str());
|
||||
}
|
||||
}
|
||||
byte[] unit = itm.Unit();
|
||||
|
||||
@@ -16,7 +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.xtns.wdatas.imports; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.wdatas.*;
|
||||
import gplx.ios.*;
|
||||
import gplx.core.ios.*;
|
||||
import gplx.core.criterias.*;
|
||||
class Io_stream_rdr_mgr {
|
||||
public static Io_stream_rdr Get_rdr_or_null(Io_url src_fil, Io_url src_dir, Io_stream_unzip_mgr unzip_mgr, String... filter_ary) {
|
||||
|
||||
@@ -16,7 +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.xtns.wdatas.imports; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.wdatas.*;
|
||||
import gplx.langs.jsons.*; import gplx.ios.*;
|
||||
import gplx.langs.jsons.*; import gplx.core.ios.*;
|
||||
import gplx.xowa.bldrs.*; import gplx.xowa.bldrs.wkrs.*;
|
||||
import gplx.xowa.langs.*; import gplx.xowa.langs.parsers.*;
|
||||
import gplx.xowa.xtns.wdatas.imports.*;
|
||||
|
||||
@@ -16,7 +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.xtns.wdatas.imports; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.wdatas.*;
|
||||
import gplx.ios.*;
|
||||
import gplx.core.ios.*;
|
||||
import gplx.xowa.bldrs.*; import gplx.xowa.bldrs.cmds.texts.tdbs.*;
|
||||
class Wdata_idx_wtr {
|
||||
public Wdata_idx_wtr(Io_url dump_dir, int dump_fil_max, Io_url make_dir) {
|
||||
|
||||
@@ -16,7 +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.xtns.wdatas.imports; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.wdatas.*;
|
||||
import gplx.ios.*;
|
||||
import gplx.core.ios.*;
|
||||
import gplx.langs.jsons.*;
|
||||
import gplx.xowa.bldrs.*; import gplx.xowa.bldrs.cmds.*; import gplx.xowa.bldrs.cmds.texts.sqls.*;
|
||||
import gplx.xowa.wikis.nss.*;
|
||||
|
||||
@@ -16,7 +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.xtns.wdatas.imports; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.wdatas.*;
|
||||
import gplx.ios.*;
|
||||
import gplx.core.ios.*;
|
||||
import gplx.xowa.bldrs.*;
|
||||
import gplx.xowa.wikis.data.tbls.*;
|
||||
class Xob_wbase_json_dump_parser {
|
||||
|
||||
@@ -58,14 +58,14 @@ public class Xob_wdata_pid_base_tst {
|
||||
}
|
||||
public static String json_(String entity_id, String grp_key, String[] grp_vals) {
|
||||
Bry_bfr bfr = Bry_bfr.new_();
|
||||
bfr.Add_str_a7("{ 'entity':'").Add_str(entity_id).Add_byte(Byte_ascii.Apos).Add_byte_nl();
|
||||
bfr.Add_str_a7(", '").Add_str(grp_key).Add_str("':").Add_byte_nl();
|
||||
bfr.Add_str_a7("{ 'entity':'").Add_str_u8(entity_id).Add_byte(Byte_ascii.Apos).Add_byte_nl();
|
||||
bfr.Add_str_a7(", '").Add_str_u8(grp_key).Add_str_a7("':").Add_byte_nl();
|
||||
int len = grp_vals.length;
|
||||
for (int i = 0; i < len; i += 2) {
|
||||
bfr.Add_byte_repeat(Byte_ascii.Space, 2);
|
||||
bfr.Add_byte(i == 0 ? Byte_ascii.Curly_bgn : Byte_ascii.Comma).Add_byte(Byte_ascii.Space);
|
||||
bfr.Add_byte(Byte_ascii.Apos).Add_str(grp_vals[i ]).Add_byte(Byte_ascii.Apos).Add_byte(Byte_ascii.Colon);
|
||||
bfr.Add_byte(Byte_ascii.Apos).Add_str(grp_vals[i + 1]).Add_byte(Byte_ascii.Apos).Add_byte_nl();
|
||||
bfr.Add_byte(Byte_ascii.Apos).Add_str_u8(grp_vals[i ]).Add_byte(Byte_ascii.Apos).Add_byte(Byte_ascii.Colon);
|
||||
bfr.Add_byte(Byte_ascii.Apos).Add_str_u8(grp_vals[i + 1]).Add_byte(Byte_ascii.Apos).Add_byte_nl();
|
||||
}
|
||||
bfr.Add_str_a7(" }").Add_byte_nl();
|
||||
bfr.Add_str_a7("}").Add_byte_nl();
|
||||
|
||||
@@ -16,7 +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.xtns.wdatas.imports; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.wdatas.*;
|
||||
import gplx.langs.jsons.*; import gplx.ios.*; import gplx.xowa.xtns.wdatas.core.*; import gplx.xowa.xtns.wdatas.parsers.*; import gplx.xowa.wikis.data.tbls.*;
|
||||
import gplx.langs.jsons.*; import gplx.core.ios.*; import gplx.xowa.xtns.wdatas.core.*; import gplx.xowa.xtns.wdatas.parsers.*; import gplx.xowa.wikis.data.tbls.*;
|
||||
import gplx.xowa.wikis.nss.*;
|
||||
import gplx.xowa.bldrs.*; import gplx.xowa.bldrs.wkrs.*;
|
||||
import gplx.xowa.bldrs.wms.sites.*;
|
||||
|
||||
@@ -39,10 +39,10 @@ public class Wdata_itemByTitle_page implements Xows_page {
|
||||
page_bry = arg_hash.Get_val_bry_or(Arg_page, Bry_.Empty);
|
||||
}
|
||||
int site_bgn = Bry_find_.Find_fwd(raw_bry, Xoa_ttl.Subpage_spr);
|
||||
if (site_bgn != Bry_.NotFound) { // leaf arg is available
|
||||
if (site_bgn != Bry_find_.Not_found) { // leaf arg is available
|
||||
int page_bgn = Bry_find_.Find_fwd(raw_bry, Xoa_ttl.Subpage_spr, site_bgn + 1);
|
||||
int raw_bry_len = raw_bry.length;
|
||||
if (page_bgn != Bry_.NotFound && page_bgn < raw_bry_len) { // pipe is found and not last char (EX: "enwiki/" is invalid
|
||||
if (page_bgn != Bry_find_.Not_found && page_bgn < raw_bry_len) { // pipe is found and not last char (EX: "enwiki/" is invalid
|
||||
site_bry = Bry_.Mid(raw_bry, site_bgn + 1, page_bgn);
|
||||
page_bry = Bry_.Mid(raw_bry, page_bgn + 1, raw_bry_len);
|
||||
}
|
||||
|
||||
@@ -16,7 +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.xtns.xowa_cmds; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.xowa.htmls.*;
|
||||
import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.htmls.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.xndes.*;
|
||||
public class Xop_xowa_cmd implements Xox_xnde {
|
||||
public Xop_root_tkn Xtn_root() {throw Err_.new_unimplemented_w_msg("xowa_cmd.xtn_root should not be called");}
|
||||
|
||||
@@ -16,7 +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.xtns.xowa_cmds; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.core.primitives.*; import gplx.xowa.htmls.*;
|
||||
import gplx.core.primitives.*; import gplx.xowa.htmls.core.htmls.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.xndes.*; import gplx.xowa.parsers.htmls.*;
|
||||
public class Xox_xowa_html_cmd implements Xox_xnde, Mwh_atr_itm_owner {
|
||||
private byte pos_val = Pos_head_end;
|
||||
|
||||
Reference in New Issue
Block a user