Category: Replace spaces with underscores in category name [#557]

pull/620/head
gnosygnu 5 years ago
parent a7029f8cf1
commit 42842f0bcc

@ -51,10 +51,16 @@ public class Scrib_lib_site implements Scrib_lib {
return ns_obj == null ? rslt.Init_ary_empty() : rslt.Init_obj(((Xow_ns)ns_obj).Id());
}
public boolean PagesInCategory(Scrib_proc_args args, Scrib_proc_rslt rslt) {
// args
byte[] ctg_name = args.Pull_bry(0);
String ctg_type = args.Cast_str_or(1, "all");
// get ttl
Xoa_ttl ctg_ttl = core.Wiki().Ttl_parse(Xow_ns_.Tid__category, ctg_name);
if (ctg_ttl == null) return rslt.Init_obj(0);
// replace space with underlines (and possibly other normalizations) else TOC will not show; PAGE:en.wiktionary.org/wiki/Category:English_conjunctions; ISSUE#:557; DATE:2019-08-22
ctg_name = ctg_ttl.Page_db();
Xoax_ctg_addon ctg_mgr = Xoax_ctg_addon.Get(core.Wiki());
Xoctg_ctg_itm ctg_itm = ctg_mgr.Itms__get_or_null(ctg_name);
if (ctg_itm == null) {

@ -47,6 +47,10 @@ public class Scrib_lib_site_tst {
, " files=1"
));
}
@Test public void PagesInCategory__spaces() { // replace space with underlines (and possibly other normalizations) else TOC will not show; PAGE:en.wiktionary.org/wiki/Category:English_conjunctions; ISSUE#:557; DATE:2019-08-22
gplx.xowa.addons.wikis.ctgs.Xoax_ctg_addon.Get(fxt.Core().Wiki()).Itms__add(Bry_.new_a7("A_b"), 3, 2, 1);
fxt.Test__proc__ints(lib, Scrib_lib_site.Invk_pagesInCategory, Object_.Ary("A b", "pages") , 3);
}
@Test public void PagesInNs() {
fxt.Test__proc__ints(lib, Scrib_lib_site.Invk_pagesInNs, Object_.Ary("12"), 0);
}

Loading…
Cancel
Save