1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00
This commit is contained in:
gnosygnu
2016-01-03 21:27:38 -05:00
parent 9509363f46
commit 096045614c
647 changed files with 11693 additions and 7648 deletions

View File

@@ -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.wikis; import gplx.*; import gplx.xowa.*;
public interface Xoa_wiki_mgr {
public interface Xoa_wiki_mgr extends GfoInvkAble {
boolean Has(byte[] key);
int Count();
Xow_wiki Get_at_i(int i);

View File

@@ -62,4 +62,6 @@ public class Xoa_ctg_mgr implements GfoInvkAble {
public static final byte Version_null = Byte_.Zero, Version_1 = 1, Version_2 = 2;
public static final byte Tid_null = Byte_.Max_value_127, Tid_subc = 0, Tid_file = 1, Tid_page = 2, Tid__max = 3;
public static final byte Hidden_n = Byte_.Zero, Hidden_y = (byte)1;
public static final String Html__cls__str = "CategoryTreeLabel CategoryTreeLabelNs14 CategoryTreeLabelCategory";
public static final byte[] Html__cls__bry = Bry_.new_a7(Html__cls__str);
}

View File

@@ -82,7 +82,7 @@ class Xoctg_fmtr_all {
, " <span class=\"CategoryTreeToggle\" style=\"display: none;\" data-ct-title=\"~{itm_data_title}\" title=\"~{itm_title}\" data-ct-state=\"collapsed\">"
, " </span> "
, " </span>"
, " <a href=\"~{itm_href}\" class=\"CategoryTreeLabel CategoryTreeLabelNs14 CategoryTreeLabelCategory\">~{itm_text}"
, " <a href=\"~{itm_href}\" class=\"" + Xoa_ctg_mgr.Html__cls__str + "\">~{itm_text}"
, " </a>"
, " <span title=\"~{itm_contains_title}\" dir=\"ltr\">~{itm_contains_text}"
, " </span>"

View File

@@ -19,12 +19,12 @@ package gplx.xowa.wikis.ctgs; import gplx.*; import gplx.xowa.*; import gplx.xow
import gplx.core.brys.fmtrs.*;
import gplx.xowa.htmls.core.htmls.*;
import gplx.xowa.langs.*; import gplx.xowa.langs.msgs.*;
class Xoctg_fmtr_grp extends gplx.core.brys.Bfr_arg_base {
class Xoctg_fmtr_grp implements gplx.core.brys.Bfr_arg {
public void Init_from_all(Xowe_wiki wiki, Xol_lang_itm lang, Xoh_wtr_ctx hctx, Xoctg_view_ctg ctg, Xoctg_fmtr_all mgr, Xoctg_view_grp itms_list) {
this.wiki = wiki; this.mgr = mgr; this.itms_fmtr = mgr.Fmtr_itm(); this.itms_list = itms_list; len = itms_list.Len();
itms_fmtr.Init_from_all(wiki, lang, hctx, ctg, mgr, itms_list, len);
} private Xowe_wiki wiki; Xoctg_fmtr_itm itms_fmtr; Xoctg_view_grp itms_list; int len; Xoctg_fmtr_all mgr;
@Override public void Bfr_arg__add(Bry_bfr bfr) {
public void Bfr_arg__add(Bry_bfr bfr) {
if (mgr.Grps_enabled()) {
if (len == 0) return;
int cur_idx = itms_list.Bgn(); int col_bgn = cur_idx;

View File

@@ -20,7 +20,7 @@ import gplx.core.brys.fmtrs.*;
import gplx.xowa.htmls.*; import gplx.xowa.htmls.hrefs.*; import gplx.xowa.htmls.core.wkrs.lnkis.htmls.*; import gplx.xowa.htmls.core.htmls.*;
import gplx.xowa.langs.*; import gplx.xowa.langs.msgs.*;
import gplx.xowa.users.history.*;
abstract class Xoctg_fmtr_itm_base extends gplx.core.brys.Bfr_arg_base implements Xoctg_fmtr_itm {
abstract class Xoctg_fmtr_itm_base implements gplx.core.brys.Bfr_arg, Xoctg_fmtr_itm {
private Xou_history_mgr history_mgr; private Xoh_wtr_ctx hctx;
protected Xowe_wiki wiki; Xol_lang_itm lang; Xoctg_view_ctg ctg; protected int len; protected Xoh_href_parser href_parser; protected Bry_fmtr html_itm, html_itm_missing; protected Xoctg_view_grp list; protected Xow_msg_mgr msg_mgr;
public void Init_from_all(Xowe_wiki wiki, Xol_lang_itm lang, Xoh_wtr_ctx hctx, Xoctg_view_ctg ctg, Xoctg_fmtr_all mgr, Xoctg_view_grp itms_list, int itms_list_len) {
@@ -39,7 +39,7 @@ abstract class Xoctg_fmtr_itm_base extends gplx.core.brys.Bfr_arg_base implement
} int col_idx;
public int Grp_end_idx() {return grp_end_idx;} private int grp_end_idx;
public boolean Grp_end_at_col() {return grp_end_at_col;} private boolean grp_end_at_col;
@Override public void Bfr_arg__add(Bry_bfr bfr) {
public void Bfr_arg__add(Bry_bfr bfr) {
for (int i = col_bgn; i < len; i++) {
if (i == col_end) {
grp_end_idx = i;
@@ -62,7 +62,7 @@ abstract class Xoctg_fmtr_itm_base extends gplx.core.brys.Bfr_arg_base implement
}
@gplx.Virtual public void Bld_html(Bry_bfr bfr, Xowe_wiki wiki, Xoh_wtr_ctx hctx, Xoctg_view_itm itm, Xoa_ttl ttl, byte[] ttl_page, Xoh_href_parser href_parser, Bry_fmtr html_itm) {
byte[] itm_href = wiki.App().Html__href_wtr().Build_to_bry(wiki, ttl);
byte[] itm_full_ttl = ttl.Full_txt();// NOTE: ttl.Full_txt() to get full ns; EX: Template:A instead of just "A"
byte[] itm_full_ttl = gplx.langs.htmls.Gfh_utl.Escape_html_as_bry(ttl.Full_txt());// NOTE: ttl.Full_txt() to get full ns; EX: Template:A instead of just "A"
byte[] itm_atr_cls = hctx.Mode_is_hdump() ? Bry_.Empty : Xoh_lnki_wtr.Lnki_cls_visited(history_mgr, wiki.Domain_bry(), ttl.Page_txt()); // NOTE: must be ttl.Page_txt() in order to match Xou_history_mgr.Add
Bry_fmtr fmtr = itm.Missing() ? html_itm_missing : html_itm;
fmtr.Bld_bfr_many(bfr, itm_href, itm_full_ttl, itm_full_ttl, itm.Page_id(), itm_atr_cls);
@@ -72,7 +72,7 @@ class Xoctg_fmtr_itm_page extends Xoctg_fmtr_itm_base {
public static final Xoctg_fmtr_itm_page Instance = new Xoctg_fmtr_itm_page(); Xoctg_fmtr_itm_page() {}
}
class Xoctg_fmtr_itm_file extends Xoctg_fmtr_itm_base {
// public override void Bfr_arg__add(Bry_bfr bfr) {
// public void Bfr_arg__add(Bry_bfr bfr) {
// html_itm = wiki.Html_mgr().Gallery_xtn_mgr().Html_gallery_itm_img();
// for (int i = list.Bgn(); i < len; i++) {
// Xoctg_view_itm itm = list.Itms()[i];

View File

@@ -36,166 +36,188 @@ public class Xoctg_html_mgr_tst {
fxt.Wiki().Appe().Usere().History_mgr().Add(url, ttl, page_bry);
fxt .Init_itm_page("A_1").Init_ctg_name_("Ctg_1").Init_ctg_pages_(0, 1)
.Test_html_all(Xoa_ctg_mgr.Tid_page, String_.Concat_lines_nl_skip_last
( ""
, "<div id=\"mw-pages\">"
, " <h2>Pages in category \"Ctg_1\"</h2>"
, " <p>The following page is in this category, out of 0 total.</p>"
, " <div lang=\"en\" dir=\"ltr\" class=\"mw-content-ltr\">"
, " <table style=\"width: 100%;\">"
, " <tr style=\"vertical-align: top;\">"
, " <td style=\"width: 33%;\">"
, " <h3>A</h3>"
, " <ul>"
, " <li><a href=\"/wiki/A_1\" class=\"xowa-visited\" title=\"A 1\">A 1</a></li>"
, " </ul>"
, " </td>"
, " </tr>"
, " </table>"
, " </div>"
, "</div>"
( ""
, "<div id=\"mw-pages\">"
, " <h2>Pages in category \"Ctg_1\"</h2>"
, " <p>The following page is in this category, out of 0 total.</p>"
, " <div lang=\"en\" dir=\"ltr\" class=\"mw-content-ltr\">"
, " <table style=\"width: 100%;\">"
, " <tr style=\"vertical-align: top;\">"
, " <td style=\"width: 33%;\">"
, " <h3>A</h3>"
, " <ul>"
, " <li><a href=\"/wiki/A_1\" class=\"xowa-visited\" title=\"A 1\">A 1</a></li>"
, " </ul>"
, " </td>"
, " </tr>"
, " </table>"
, " </div>"
, "</div>"
));
}
@Test public void Page_all() {
fxt .Init_itm_page("A1").Init_ctg_name_("Ctg_1").Init_ctg_pages_(0, 1)
.Test_html_all(Xoa_ctg_mgr.Tid_page, String_.Concat_lines_nl_skip_last
( ""
, "<div id=\"mw-pages\">"
, " <h2>Pages in category \"Ctg_1\"</h2>"
, " <p>The following page is in this category, out of 0 total.</p>"
, " <div lang=\"en\" dir=\"ltr\" class=\"mw-content-ltr\">"
, " <table style=\"width: 100%;\">"
, " <tr style=\"vertical-align: top;\">"
, " <td style=\"width: 33%;\">"
, " <h3>A</h3>"
, " <ul>"
, " <li><a href=\"/wiki/A1\" title=\"A1\">A1</a></li>"
, " </ul>"
, " </td>"
, " </tr>"
, " </table>"
, " </div>"
, "</div>"
( ""
, "<div id=\"mw-pages\">"
, " <h2>Pages in category \"Ctg_1\"</h2>"
, " <p>The following page is in this category, out of 0 total.</p>"
, " <div lang=\"en\" dir=\"ltr\" class=\"mw-content-ltr\">"
, " <table style=\"width: 100%;\">"
, " <tr style=\"vertical-align: top;\">"
, " <td style=\"width: 33%;\">"
, " <h3>A</h3>"
, " <ul>"
, " <li><a href=\"/wiki/A1\" title=\"A1\">A1</a></li>"
, " </ul>"
, " </td>"
, " </tr>"
, " </table>"
, " </div>"
, "</div>"
));
}
@Test public void File_all() {
fxt .Init_itm_file("File:A1.png").Init_ctg_name_("Ctg_1").Init_ctg_files_(0, 1)
.Test_html_all(Xoa_ctg_mgr.Tid_file, String_.Concat_lines_nl_skip_last
( ""
, "<div id=\"mw-category-media\">"
, " <h2>Media in category \"Ctg_1\"</h2>"
, " <p>The following file is in this category, out of 0 total.</p>"
, " <div lang=\"en\" dir=\"ltr\" class=\"mw-content-ltr\">"
, " <table style=\"width: 100%;\">"
, " <tr style=\"vertical-align: top;\">"
, " <td style=\"width: 33%;\">"
, " <h3>A</h3>"
, " <ul>"
, " <li><a href=\"/wiki/File:A1.png\" title=\"File:A1.png\">File:A1.png</a></li>"
, " </ul>"
, " </td>"
, " </tr>"
, " </table>"
, " </div>"
, "</div>"
( ""
, "<div id=\"mw-category-media\">"
, " <h2>Media in category \"Ctg_1\"</h2>"
, " <p>The following file is in this category, out of 0 total.</p>"
, " <div lang=\"en\" dir=\"ltr\" class=\"mw-content-ltr\">"
, " <table style=\"width: 100%;\">"
, " <tr style=\"vertical-align: top;\">"
, " <td style=\"width: 33%;\">"
, " <h3>A</h3>"
, " <ul>"
, " <li><a href=\"/wiki/File:A1.png\" title=\"File:A1.png\">File:A1.png</a></li>"
, " </ul>"
, " </td>"
, " </tr>"
, " </table>"
, " </div>"
, "</div>"
));
// , " <ul id=\"xowa_gallery_ul_0\" class=\"gallery\">"
// , " <li class=\"gallerybox\" style=\"width:155px;\">"
// , " <div style=\"width:155px;\">"
// , " <div class=\"thumb\" style=\"width:155px;\">"
// , " <div id=\"xowa_gallery_div3_-1\" style=\"margin:15px auto;\">"
// , " <a href=\"/wiki/File:A1.png\" class=\"image\">"
// , " <img id=\"xowa_file_img_-1\" alt=\"A1.png\" src=\"\" width=\"-1\" height=\"-1\" />"
// , " </a>"
// , " </div>"
// , " </div>"
// , " <div class=\"gallerytext\">A1.png"
// , " </div>"
// , " </div>"
// , " </li>"
// , ""
// , " </ul>"
// , " <ul id=\"xowa_gallery_ul_0\" class=\"gallery\">"
// , " <li class=\"gallerybox\" style=\"width:155px;\">"
// , " <div style=\"width:155px;\">"
// , " <div class=\"thumb\" style=\"width:155px;\">"
// , " <div id=\"xowa_gallery_div3_-1\" style=\"margin:15px auto;\">"
// , " <a href=\"/wiki/File:A1.png\" class=\"image\">"
// , " <img id=\"xoimg_-1\" alt=\"A1.png\" src=\"\" width=\"-1\" height=\"-1\" />"
// , " </a>"
// , " </div>"
// , " </div>"
// , " <div class=\"gallerytext\">A1.png"
// , " </div>"
// , " </div>"
// , " </li>"
// , ""
// , " </ul>"
}
@Test public void Subc_all() {
fxt .Init_itm_ctg("Category:Subc_1").Init_ctg_name_("Ctg_1").Init_ctg_files_(0, 1)
.Test_html_all(Xoa_ctg_mgr.Tid_subc, String_.Concat_lines_nl_skip_last
( ""
, "<div id=\"mw-subcategories\">"
, " <h2>Subcategories</h2>"
, " <p>This category has the following subcategory, out of 0 total.</p>"
, " <div lang=\"en\" dir=\"ltr\" class=\"mw-content-ltr\">"
, " <table style=\"width: 100%;\">"
, " <tr style=\"vertical-align: top;\">"
, " <td style=\"width: 33%;\">"
, " <h3>S</h3>"
, " <ul>"
, " <li>"
, " <div class=\"CategoryTreeSection\">"
, " <div class=\"CategoryTreeItem\">"
, " <span class=\"CategoryTreeBullet\">"
, " <span class=\"CategoryTreeToggle\" style=\"display: none;\" data-ct-title=\"Subc_1\" title=\"Subc 1\" data-ct-state=\"collapsed\">"
, " </span> "
, " </span>"
, " <a href=\"/wiki/Category:Subc_1\" class=\"CategoryTreeLabel CategoryTreeLabelNs14 CategoryTreeLabelCategory\">Subc 1"
, " </a>"
, " <span title=\"contains 0 subcategories, 0 pages, and 0 files\" dir=\"ltr\">"
, " </span>"
, " </div>"
, " <div class=\"CategoryTreeChildren\" style=\"display:none\"></div>"
, " </div>"
, " </li>"
, " </ul>"
, " </td>"
, " </tr>"
, " </table>"
, " </div>"
, "</div>"
( ""
, "<div id=\"mw-subcategories\">"
, " <h2>Subcategories</h2>"
, " <p>This category has the following subcategory, out of 0 total.</p>"
, " <div lang=\"en\" dir=\"ltr\" class=\"mw-content-ltr\">"
, " <table style=\"width: 100%;\">"
, " <tr style=\"vertical-align: top;\">"
, " <td style=\"width: 33%;\">"
, " <h3>S</h3>"
, " <ul>"
, " <li>"
, " <div class=\"CategoryTreeSection\">"
, " <div class=\"CategoryTreeItem\">"
, " <span class=\"CategoryTreeBullet\">"
, " <span class=\"CategoryTreeToggle\" style=\"display: none;\" data-ct-title=\"Subc_1\" title=\"Subc 1\" data-ct-state=\"collapsed\">"
, " </span> "
, " </span>"
, " <a href=\"/wiki/Category:Subc_1\" class=\"CategoryTreeLabel CategoryTreeLabelNs14 CategoryTreeLabelCategory\">Subc 1"
, " </a>"
, " <span title=\"contains 0 subcategories, 0 pages, and 0 files\" dir=\"ltr\">"
, " </span>"
, " </div>"
, " <div class=\"CategoryTreeChildren\" style=\"display:none\"></div>"
, " </div>"
, " </li>"
, " </ul>"
, " </td>"
, " </tr>"
, " </table>"
, " </div>"
, "</div>"
));
}
@Test public void Page_all_cols() {
fxt .Init_itm_page("A1", "A2", "A3", "B1", "C1").Init_ctg_name_("Ctg_1").Init_ctg_pages_(0, 5)
.Test_html_all(Xoa_ctg_mgr.Tid_page, String_.Concat_lines_nl_skip_last
( ""
, "<div id=\"mw-pages\">"
, " <h2>Pages in category \"Ctg_1\"</h2>"
, " <p>The following 5 pages are in this category, out of 0 total.</p>"
, " <div lang=\"en\" dir=\"ltr\" class=\"mw-content-ltr\">"
, " <table style=\"width: 100%;\">"
, " <tr style=\"vertical-align: top;\">"
, " <td style=\"width: 33%;\">"
, " <h3>A</h3>"
, " <ul>"
, " <li><a href=\"/wiki/A1\" title=\"A1\">A1</a></li>"
, " <li><a href=\"/wiki/A2\" title=\"A2\">A2</a></li>"
, " </ul>"
, " </td>"
, " <td style=\"width: 33%;\">"
, " <h3>A cont.</h3>"
, " <ul>"
, " <li><a href=\"/wiki/A3\" title=\"A3\">A3</a></li>"
, " </ul>"
, " <h3>B</h3>"
, " <ul>"
, " <li><a href=\"/wiki/B1\" title=\"B1\">B1</a></li>"
, " </ul>"
, " </td>"
, " <td style=\"width: 33%;\">"
, " <h3>C</h3>"
, " <ul>"
, " <li><a href=\"/wiki/C1\" title=\"C1\">C1</a></li>"
, " </ul>"
, " </td>"
, " </tr>"
, " </table>"
, " </div>"
, "</div>"
( ""
, "<div id=\"mw-pages\">"
, " <h2>Pages in category \"Ctg_1\"</h2>"
, " <p>The following 5 pages are in this category, out of 0 total.</p>"
, " <div lang=\"en\" dir=\"ltr\" class=\"mw-content-ltr\">"
, " <table style=\"width: 100%;\">"
, " <tr style=\"vertical-align: top;\">"
, " <td style=\"width: 33%;\">"
, " <h3>A</h3>"
, " <ul>"
, " <li><a href=\"/wiki/A1\" title=\"A1\">A1</a></li>"
, " <li><a href=\"/wiki/A2\" title=\"A2\">A2</a></li>"
, " </ul>"
, " </td>"
, " <td style=\"width: 33%;\">"
, " <h3>A cont.</h3>"
, " <ul>"
, " <li><a href=\"/wiki/A3\" title=\"A3\">A3</a></li>"
, " </ul>"
, " <h3>B</h3>"
, " <ul>"
, " <li><a href=\"/wiki/B1\" title=\"B1\">B1</a></li>"
, " </ul>"
, " </td>"
, " <td style=\"width: 33%;\">"
, " <h3>C</h3>"
, " <ul>"
, " <li><a href=\"/wiki/C1\" title=\"C1\">C1</a></li>"
, " </ul>"
, " </td>"
, " </tr>"
, " </table>"
, " </div>"
, "</div>"
));
}
@Test public void Title__escape_quotes() {// PURPOSE: quotes in title should be escaped; DATE:2015-12-28
fxt .Init_itm_page("A\"1").Init_ctg_name_("Ctg_1").Init_ctg_pages_(0, 1)
.Test_html_all(Xoa_ctg_mgr.Tid_page, String_.Concat_lines_nl_skip_last
( ""
, "<div id=\"mw-pages\">"
, " <h2>Pages in category \"Ctg_1\"</h2>"
, " <p>The following page is in this category, out of 0 total.</p>"
, " <div lang=\"en\" dir=\"ltr\" class=\"mw-content-ltr\">"
, " <table style=\"width: 100%;\">"
, " <tr style=\"vertical-align: top;\">"
, " <td style=\"width: 33%;\">"
, " <h3>A</h3>"
, " <ul>"
, " <li><a href=\"/wiki/A%221\" title=\"A&quot;1\">A&quot;1</a></li>"
, " </ul>"
, " </td>"
, " </tr>"
, " </table>"
, " </div>"
, "</div>"
));
}
@Test public void Bld_rslts_lnk() {
fxt.Init_itm_page("A1").Init_ctg_name_("Ctg_1").Init_ctg_pages_(1, 1)
.Test_bld_rslts_lnk(Bool_.Y, "Category:Ctg_1", String_.Concat_lines_nl
( ""
, " (<a href=\"/wiki/Category:Ctg_1?pageuntil=A1#mw-pages\" class=\"xowa_nav\" title=\"Category:Ctg_1\">previous 0</a>)"
, " (<a href=\"/wiki/Category:Ctg_1?pagefrom=A1#mw-pages\" class=\"xowa_nav\" title=\"Category:Ctg_1\">next 0</a>)"
( ""
, " (<a href=\"/wiki/Category:Ctg_1?pageuntil=A1#mw-pages\" class=\"xowa_nav\" title=\"Category:Ctg_1\">previous 0</a>)"
, " (<a href=\"/wiki/Category:Ctg_1?pagefrom=A1#mw-pages\" class=\"xowa_nav\" title=\"Category:Ctg_1\">next 0</a>)"
));
}
@Test public void Calc_col_max() {

View File

@@ -57,7 +57,7 @@ public class Xoctg_idx_mgr implements GfoInvkAble {
while (true) {
rv = (Xoctg_idx_itm)itms.Get_at(pos);
comp_cur = Bry_.Compare(find, rv.Sortkey());
// Tfds.Write(dif, pos, comp_cur, comp_prv, String_.new_a7(find), String_.new_a7(rv.Sortkey()));
// Tfds.Dbg(dif, pos, comp_cur, comp_prv, String_.new_a7(find), String_.new_a7(rv.Sortkey()));
if (comp_cur == CompareAble_.Same) break; // exact match; stop
dif /= 2;
if (dif == 0) dif = 1; // make sure dif is at least 1
@@ -99,7 +99,7 @@ public class Xoctg_idx_mgr implements GfoInvkAble {
pos_cur = dir_fwd ? itm_bgn : itm_bgn - 1; // -1 to position at pipe (note that -1 in FindBwd will position before)
tmp_prv_itm.Copy(tmp_cur_itm);
}
// Tfds.Write(arg_is_from, dir_fwd, String_.new_u8(find), String_.new_u8(tmp_cur_itm.Sortkey()), String_.new_u8(tmp_prv_itm.Sortkey()));
// Tfds.Dbg(arg_is_from, dir_fwd, String_.new_u8(find), String_.new_u8(tmp_cur_itm.Sortkey()), String_.new_u8(tmp_prv_itm.Sortkey()));
if (comp_cur == CompareAble_.Same) return tmp_cur_itm;
return (arg_is_from && dir_fwd) || (!arg_is_from && !dir_fwd) ? tmp_cur_itm : tmp_prv_itm; // see note above
} private Xoctg_idx_itm tmp_cur_itm = new Xoctg_idx_itm(), tmp_prv_itm = new Xoctg_idx_itm(); Gfo_fld_rdr fld_rdr = Gfo_fld_rdr.xowa_();

View File

@@ -19,7 +19,7 @@ package gplx.xowa.wikis.ctgs; import gplx.*; import gplx.xowa.*; import gplx.xow
import gplx.core.brys.fmtrs.*;
import gplx.xowa.htmls.core.htmls.*;
import gplx.xowa.langs.*; import gplx.xowa.langs.msgs.*;
public class Xoctg_pagelist_grp extends gplx.core.brys.Bfr_arg_base {
public class Xoctg_pagelist_grp implements gplx.core.brys.Bfr_arg {
public void Init_app(Xoae_app app, boolean type_is_normal, Bry_fmtr fmtr_grp, Bry_fmtr fmtr_itm) {
this.type_is_normal = type_is_normal;
this.fmtr_grp = fmtr_grp;
@@ -33,7 +33,7 @@ public class Xoctg_pagelist_grp extends gplx.core.brys.Bfr_arg_base {
} private byte[] lbl_ctg_help, lbl_ctg_text, lbl_hidden; private static final byte[] Key_pagecategorieslink = Bry_.new_a7("pagecategorieslink");
public boolean Type_is_normal() {return type_is_normal;} private boolean type_is_normal;
public Xoctg_pagelist_itms Itms() {return itms;} private Xoctg_pagelist_itms itms = new Xoctg_pagelist_itms();
@Override public void Bfr_arg__add(Bry_bfr bfr) {
public void Bfr_arg__add(Bry_bfr bfr) {
if (type_is_normal)
fmtr_grp.Bld_bfr_many(bfr, lbl_ctg_help, lbl_ctg_text, itms);
else

View File

@@ -20,7 +20,7 @@ import gplx.core.brys.fmtrs.*;
import gplx.xowa.htmls.*; import gplx.xowa.htmls.hrefs.*; import gplx.xowa.htmls.core.htmls.*; import gplx.xowa.htmls.core.wkrs.lnkis.htmls.*; import gplx.xowa.wikis.data.tbls.*;
import gplx.xowa.wikis.nss.*;
import gplx.xowa.users.history.*;
public class Xoctg_pagelist_itms extends gplx.core.brys.Bfr_arg_base {
public class Xoctg_pagelist_itms implements gplx.core.brys.Bfr_arg {
private Xoh_href_wtr href_wtr; private Xou_history_mgr history_mgr; private Bry_fmtr fmtr_itm;
public void Init_app(Xoae_app app, Bry_fmtr fmtr_itm) {
this.href_wtr = app.Html__href_wtr();
@@ -30,7 +30,7 @@ public class Xoctg_pagelist_itms extends gplx.core.brys.Bfr_arg_base {
public void Init_wiki(Xowe_wiki wiki, Xoh_wtr_ctx hctx) {this.wiki = wiki; this.hctx = hctx;} private Xowe_wiki wiki; private Xoh_wtr_ctx hctx;
public void Itms_clear() {itms.Clear();} private List_adp itms = List_adp_.new_();
public void Itms_add(Xowd_page_itm page) {itms.Add(page);}
@Override public void Bfr_arg__add(Bry_bfr bfr) {
public void Bfr_arg__add(Bry_bfr bfr) {
int len = itms.Count();
for (int i = 0; i < len; i++) {
Xowd_page_itm page = (Xowd_page_itm)itms.Get_at(i);

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.xowa.wikis.ctgs; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*;
import gplx.core.brys.fmtrs.*;
import gplx.xowa.htmls.core.htmls.*;
public class Xoctg_pagelist_mgr extends gplx.core.brys.Bfr_arg_base {
public class Xoctg_pagelist_mgr implements gplx.core.brys.Bfr_arg {
public Xoctg_pagelist_mgr Init_by_app(Xoae_app app, Xoctg_pagelist_wtr hidden_wtr) {
this.fmtr_all = hidden_wtr.Fmtr_all();
grp_normal.Init_app(app, Bool_.Y, hidden_wtr.Fmtr_grp_normal(), hidden_wtr.Fmtr_itm());
@@ -31,7 +31,7 @@ public class Xoctg_pagelist_mgr extends gplx.core.brys.Bfr_arg_base {
}
public Xoctg_pagelist_grp Grp_normal() {return grp_normal;} private Xoctg_pagelist_grp grp_normal = new Xoctg_pagelist_grp();
public Xoctg_pagelist_grp Grp_hidden() {return grp_hidden;} private Xoctg_pagelist_grp grp_hidden = new Xoctg_pagelist_grp();
@Override public void Bfr_arg__add(Bry_bfr bfr) {
public void Bfr_arg__add(Bry_bfr bfr) {
fmtr_all.Bld_bfr_many(bfr, grp_normal, grp_hidden);
}
}

View File

@@ -82,6 +82,6 @@ class Xoctg_pagelist_mgr_fxt {
Xowd_page_itm[] page_ary = (Xowd_page_itm[])init_ctgs.To_ary_and_clear(Xowd_page_itm.class);
hidden_wtr.Print_hidden(bfr, fxt.Wiki(), page_ary, gplx.xowa.htmls.core.htmls.Xoh_wtr_ctx.Basic);
Tfds.Eq_str_lines(expd, bfr.To_str_and_clear());
// Tfds.Write(bfr.To_bry_and_clear());
// Tfds.Dbg(bfr.To_bry_and_clear());
}
}

View File

@@ -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.wikis.pages.skins; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*; import gplx.xowa.wikis.pages.*;
public class Xopg_xtn_skin_fmtr_arg extends gplx.core.brys.Bfr_arg_base {
public class Xopg_xtn_skin_fmtr_arg implements gplx.core.brys.Bfr_arg {
private Xoae_page page; private byte xtn_skin_tid;
public Xopg_xtn_skin_fmtr_arg(Xoae_page page, byte xtn_skin_tid) {
this.page = page; this.xtn_skin_tid = xtn_skin_tid;
}
@Override public void Bfr_arg__add(Bry_bfr bfr) {
public void Bfr_arg__add(Bry_bfr bfr) {
Xopg_xtn_skin_mgr mgr = page.Html_data().Xtn_skin_mgr();
int len = mgr.Count();
for (int i = 0; i < len; ++i) {

View File

@@ -108,6 +108,6 @@ class Xob_reg_wtr {
}
public void Flush(Io_url url) {
Io_mgr.Instance.SaveFilBfr(url, bfr);
// Tfds.Write(url.Raw() + "\n" + Io_mgr.Instance.LoadFilStr(url));
// Tfds.Dbg(url.Raw() + "\n" + Io_mgr.Instance.LoadFilStr(url));
}
}

View File

@@ -226,7 +226,7 @@ class Xob_xdat_file_ {
else if (comp == CompareAble_.Same) {xdat_itm.Found_exact_y_(); return itm_idx;}
else if (comp < CompareAble_.Same) {hi = itm_idx; delta = -1;}
int itm_dif = hi - lo;
// if (itm_end - 1 > fld_bgn) Tfds.Write(comp, itm_dif, String_.new_u8(src, fld_bgn, itm_end - 1));
// if (itm_end - 1 > fld_bgn) Tfds.Dbg(comp, itm_dif, String_.new_u8(src, fld_bgn, itm_end - 1));
switch (itm_dif) {
case 0: return exact ? String_.Find_none : hi; // NOTE: can be 0 when src.length == 1 || 2; also, sometimes 0 in some situations
case -1:

View File

@@ -16,22 +16,20 @@ 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.wikis.ttls; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*;
import org.junit.*;
import org.junit.*; import gplx.xowa.wikis.nss.*;
public class Xow_ttl__anchor_tst {
@Before public void init() {fxt.Reset();} private Xow_ttl_fxt fxt = new Xow_ttl_fxt();
@Test public void Anch_y() {fxt.Init_ttl("a#b") .Expd_full_txt("A").Expd_page_txt("A").Expd_anch_txt("b").Test();}
@Test public void Anch_only() {fxt.Init_ttl("#a") .Expd_full_txt("").Expd_page_txt("").Expd_anch_txt("a").Test();}
@Test public void Anchor_fails() { // PURPOSE: :#batch:Main Page causes ttl to fail b/c # is treated as anchor; DATE:2013-01-02
@Test public void Page__main() {fxt.Init_ttl("a#b") .Expd_full_txt("A").Expd_page_txt("A").Expd_anch_txt("b").Test();}
@Test public void Page__ns() {fxt.Init_ttl("Help:A#B") .Expd_full_txt("Help:A").Expd_ns_id(Xow_ns_.Tid__help).Expd_page_txt("A").Expd_anch_txt("B").Test();}
@Test public void Pageless__main() {fxt.Init_ttl("#a") .Expd_full_txt("").Expd_page_txt("").Expd_anch_txt("a").Test();}
@Test public void Xwiki() { // PURPOSE: :#batch:Main Page causes ttl to fail b/c # is treated as anchor; DATE:2013-01-02
fxt.Wiki().Xwiki_mgr().Add_by_atrs(Bry_.new_a7("#batch"), Bry_.new_a7("none"));
fxt.Init_ttl(":#batch:Main Page").Expd_full_txt("Main Page").Test();
}
@Test public void Anchor_angles() {// PURPOSE: angles in anchor should be encoded; DATE: 2013-01-23
@Test public void Anch_has_angles() {// PURPOSE: angles in anchor should be encoded; DATE: 2013-01-23
fxt.Init_ttl("A#b<c>d").Expd_full_txt("A").Expd_anch_txt("b.3Cc.3Ed").Test();
}
@Test public void Anchor_arg_in_non_main_ns() {
fxt.Init_ttl("Help:A#B").Expd_full_txt("Help:A").Expd_anch_txt("B").Test();
}
@Test public void Anchor_and_slash() { // PURPOSE: slash in anchor was being treated as a subpage; DATE:2014-01-14
@Test public void Anch_has_slash() { // PURPOSE: slash in anchor was being treated as a subpage; DATE:2014-01-14
fxt.Init_ttl("A#b/c").Expd_full_txt("A").Expd_anch_txt("b/c").Expd_leaf_txt("A").Test(); // NOTE: Leaf_txt should be Page_txt; used to fail
}
@Test public void Decode_ncr() { // PURPOSE: convert &#x23; to #; PAGE:en.s:The_English_Constitution_(1894) DATE:2014-09-07
@@ -39,4 +37,7 @@ public class Xow_ttl__anchor_tst {
fxt.Init_ttl("A&#35;b").Expd_full_txt("A").Expd_page_txt("A").Expd_anch_txt("b").Test();
fxt.Init_ttl("A&#36;b").Expd_full_txt("A$b").Expd_page_txt("A$b").Expd_anch_txt("").Test();
}
@Test public void Multiple() {// PURPOSE: handle multiple anchors; en.w:Grand_Central_Terminal; DATE:2015-12-31
fxt.Init_ttl("A#b#c").Expd_page_txt("A").Expd_anch_txt("b#c").Test();
}
}

View File

@@ -21,13 +21,13 @@ import gplx.xowa.langs.cases.*;
public class Xow_ttl__i18n_tst {
@Before public void init() {fxt.Reset();} private Xow_ttl_fxt fxt = new Xow_ttl_fxt();
@Test public void Bidi() { // PURPOSE: handle bidirectional characters; DATE:2015-07-28; DATE:2015-08-24
fxt.Init_ttl("A" + String_.new_u8(Bry_.new_ints(0xE2, 0x80, 0x8E)) + "B").Expd_page_txt("AB").Test();
fxt.Init_ttl("A" + String_.new_u8(Bry_.new_ints(0xE2, 0x80, 0x8F)) + "B").Expd_page_txt("AB").Test();
fxt.Init_ttl("A" + String_.new_u8(Bry_.new_ints(0xE2, 0x80, 0xAA)) + "B").Expd_page_txt("AB").Test();
fxt.Init_ttl("A" + String_.new_u8(Bry_.new_ints(0xE2, 0x80, 0xAB)) + "B").Expd_page_txt("AB").Test();
fxt.Init_ttl("A" + String_.new_u8(Bry_.new_ints(0xE2, 0x80, 0xAC)) + "B").Expd_page_txt("AB").Test();
fxt.Init_ttl("A" + String_.new_u8(Bry_.new_ints(0xE2, 0x80, 0xAD)) + "B").Expd_page_txt("AB").Test();
fxt.Init_ttl("A" + String_.new_u8(Bry_.new_ints(0xE2, 0x80, 0xAE)) + "B").Expd_page_txt("AB").Test();
fxt.Init_ttl("A" + String_.new_u8(Bry_.New_by_ints(0xE2, 0x80, 0x8E)) + "B").Expd_page_txt("AB").Test();
fxt.Init_ttl("A" + String_.new_u8(Bry_.New_by_ints(0xE2, 0x80, 0x8F)) + "B").Expd_page_txt("AB").Test();
fxt.Init_ttl("A" + String_.new_u8(Bry_.New_by_ints(0xE2, 0x80, 0xAA)) + "B").Expd_page_txt("AB").Test();
fxt.Init_ttl("A" + String_.new_u8(Bry_.New_by_ints(0xE2, 0x80, 0xAB)) + "B").Expd_page_txt("AB").Test();
fxt.Init_ttl("A" + String_.new_u8(Bry_.New_by_ints(0xE2, 0x80, 0xAC)) + "B").Expd_page_txt("AB").Test();
fxt.Init_ttl("A" + String_.new_u8(Bry_.New_by_ints(0xE2, 0x80, 0xAD)) + "B").Expd_page_txt("AB").Test();
fxt.Init_ttl("A" + String_.new_u8(Bry_.New_by_ints(0xE2, 0x80, 0xAE)) + "B").Expd_page_txt("AB").Test();
}
@Test public void Multi_byte_char2() { // PURPOSE: multi-byte HTML entity causes array out of index error; EX: w:List_of_Unicode_characters; DATE:2013-12-25
fxt.Init_ttl("&#x2c65;").Expd_full_txt("").Test();

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.xowa.wikis.ttls; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*;
import gplx.core.log_msgs.*;
class Xow_ttl_fxt {
private Xop_fxt fxt = new Xop_fxt();
private final Xop_fxt fxt = new Xop_fxt();
public Xow_ttl_fxt Init_ttl(String raw) {test_raw = raw; return this;} private String test_raw = "";
public Xow_ttl_fxt Expd_ns_id(int v) {expd_ns_id = v; return this;} private int expd_ns_id = Int_.Min_value;
public Xow_ttl_fxt Expd_page_txt(String v) {expd_page_txt = v; return this;} private String expd_page_txt;

View File

@@ -17,12 +17,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.wikis.xwikis.sitelinks.htmls; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*; import gplx.xowa.wikis.xwikis.*; import gplx.xowa.wikis.xwikis.sitelinks.*;
import gplx.core.brys.fmtrs.*;
class Xoa_sitelink_grp_wtr extends gplx.core.brys.Bfr_arg_base {
class Xoa_sitelink_grp_wtr implements gplx.core.brys.Bfr_arg {
private final Xoa_sitelink_itm_wtr itm_wtr = new Xoa_sitelink_itm_wtr();
private Xoa_sitelink_grp_mgr mgr;
public void Init_by_app(Xoa_app app) {itm_wtr.Init_by_app(app);}
public Xoa_sitelink_grp_wtr Fmt__init(Xoa_sitelink_grp_mgr mgr) {this.mgr = mgr; return this;}
@Override public void Bfr_arg__add(Bry_bfr bfr) {
public void Bfr_arg__add(Bry_bfr bfr) {
int len = mgr.Len();
for (int i = 0; i < len; ++i) {
Xoa_sitelink_grp grp = mgr.Get_at(i);

View File

@@ -19,12 +19,12 @@ package gplx.xowa.wikis.xwikis.sitelinks.htmls; import gplx.*; import gplx.xowa.
import gplx.core.brys.fmtrs.*;
import gplx.xowa.htmls.hrefs.*;
import gplx.xowa.wikis.domains.*;
class Xoa_sitelink_itm_wtr extends gplx.core.brys.Bfr_arg_base {
class Xoa_sitelink_itm_wtr implements gplx.core.brys.Bfr_arg {
private final Bry_bfr tmp_bfr = Bry_bfr.new_(255);
private Xoa_app app; private Xoa_sitelink_grp grp;
public void Init_by_app(Xoa_app app) {this.app = app;}
public Xoa_sitelink_itm_wtr Fmt__init(Xoa_sitelink_grp grp) {this.grp = grp; return this;}
@Override public void Bfr_arg__add(Bry_bfr bfr) {
public void Bfr_arg__add(Bry_bfr bfr) {
int len = grp.Len();
boolean tr_opened = false; int td_idx = 0;
for (int i = 0; i < len; ++i) {