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,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.bldrs.wiki_cfgs; import gplx.*; import gplx.xowa.*; import gplx.xowa.bldrs.*;
|
||||
import gplx.core.log_msgs.*;
|
||||
import gplx.langs.phps.*; import gplx.xowa.langs.bldrs.*;
|
||||
class Xob_subpage_parser {
|
||||
public Xob_subpage_wiki[] Parse(byte[] src) {
|
||||
|
||||
@@ -20,7 +20,7 @@ public class Xoi_wiki_props_alias {
|
||||
public int Id() {return id;} private int id;
|
||||
public String Alias() {return alias;} private String alias;
|
||||
public Xoi_wiki_props_alias Init_by_ctor(int id, String alias) {this.id = id; this.alias = alias; return this;}
|
||||
public void Init_by_xml(gplx.xmls.XmlNde ns_nde) {
|
||||
public void Init_by_xml(gplx.langs.xmls.XmlNde ns_nde) {
|
||||
this.id = Int_.parse(ns_nde.Atrs().FetchValOr("id", "-1"));
|
||||
this.alias = String_.Replace(String_.Replace(ns_nde.Text_inner(), " ", "_"), "'", "''");
|
||||
}
|
||||
|
||||
@@ -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.bldrs.wiki_cfgs; import gplx.*; import gplx.xowa.*; import gplx.xowa.bldrs.*;
|
||||
import gplx.xmls.*; import gplx.ios.*;
|
||||
import gplx.langs.xmls.*; import gplx.core.ios.*;
|
||||
public class Xoi_wiki_props_api {
|
||||
private IoEngine_xrg_downloadFil download_args = IoEngine_xrg_downloadFil.new_("", Io_url_.Empty);
|
||||
public String Api_src(String wiki_domain) {
|
||||
@@ -26,15 +26,15 @@ public class Xoi_wiki_props_api {
|
||||
return download_args.Exec_as_bry(src);
|
||||
}
|
||||
public void Build_cfg(Bry_bfr bfr, Xoi_wiki_props_wiki wiki) {
|
||||
bfr.Add_str_a7("app.bldr.wiki_cfg_bldr.get('").Add(wiki.Wiki_domain()).Add_str("').new_cmd_('wiki.ns_mgr.aliases', 'ns_mgr.add_alias_bulk(\"\n");
|
||||
bfr.Add_str_a7("app.bldr.wiki_cfg_bldr.get('").Add(wiki.Wiki_domain()).Add_str_a7("').new_cmd_('wiki.ns_mgr.aliases', 'ns_mgr.add_alias_bulk(\"\n");
|
||||
int len = 0;
|
||||
len = wiki.Alias_ary().length;
|
||||
for (int i = 0; i < len; i++) {
|
||||
Xoi_wiki_props_alias alias = wiki.Alias_ary()[i];
|
||||
bfr.Add_int_variable(alias.Id()).Add_byte_pipe().Add_str(alias.Alias()).Add_byte_nl();
|
||||
bfr.Add_int_variable(alias.Id()).Add_byte_pipe().Add_str_u8(alias.Alias()).Add_byte_nl();
|
||||
}
|
||||
bfr.Add_str_a7("\");');\n");
|
||||
bfr.Add_str_a7("app.bldr.wiki_cfg_bldr.get('").Add(wiki.Wiki_domain()).Add_str("').new_cmd_('wiki.ns_mgr.subpages', \"");
|
||||
bfr.Add_str_a7("app.bldr.wiki_cfg_bldr.get('").Add(wiki.Wiki_domain()).Add_str_a7("').new_cmd_('wiki.ns_mgr.subpages', \"");
|
||||
len = wiki.Ns_ary().length;
|
||||
boolean first = true;
|
||||
for (int i = 0; i < len; i++) {
|
||||
@@ -45,7 +45,7 @@ public class Xoi_wiki_props_api {
|
||||
}
|
||||
else
|
||||
bfr.Add_byte_nl();
|
||||
bfr.Add_str_a7("ns_mgr.get_by_id_or_new(").Add_int_variable(ns.Id()).Add_str(").subpages_enabled_('y');");
|
||||
bfr.Add_str_a7("ns_mgr.get_by_id_or_new(").Add_int_variable(ns.Id()).Add_str_a7(").subpages_enabled_('y');");
|
||||
}
|
||||
}
|
||||
bfr.Add_str_a7("\");\n");
|
||||
|
||||
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.bldrs.wiki_cfgs; import gplx.*; import gplx.xowa.*; import gplx.xowa.bldrs.*;
|
||||
import org.junit.*; import gplx.core.strings.*;
|
||||
import gplx.xmls.*;
|
||||
import gplx.langs.xmls.*;
|
||||
import gplx.xowa.bldrs.cfgs.*;
|
||||
public class Xoi_wiki_props_api_tst {
|
||||
private Xoi_wiki_props_fxt fxt = new Xoi_wiki_props_fxt();
|
||||
@@ -47,7 +47,7 @@ public class Xoi_wiki_props_api_tst {
|
||||
// .Ns_ary_(fxt.ns_(0, false), fxt.ns_(1, true))
|
||||
// , "");
|
||||
// }
|
||||
// Tfds.Eq_str_lines(Query_ns(protocol, gplx.ios.IoEngine_.MemKey, wikis), String_.Concat_lines_nl
|
||||
// Tfds.Eq_str_lines(Query_ns(protocol, gplx.core.ios.IoEngine_.MemKey, wikis), String_.Concat_lines_nl
|
||||
// ( "app.bldr.wiki_cfg_bldr.get('en.wikipedia.org').new_cmd_('wiki.ns_mgr.aliases', 'ns_mgr.add_alias_bulk(\""
|
||||
// , "4|WP"
|
||||
// , "5|WT"
|
||||
@@ -82,7 +82,7 @@ class Xoi_wiki_props_fxt {
|
||||
bfr.Add_str_a7("aliases").Add_byte_nl();
|
||||
for (int i = 0; i < len; i++) {
|
||||
Xoi_wiki_props_alias alias = v.Alias_ary()[i];
|
||||
bfr.Add_int_variable(alias.Id()).Add_byte_pipe().Add_str(alias.Alias()).Add_byte_nl();
|
||||
bfr.Add_int_variable(alias.Id()).Add_byte_pipe().Add_str_u8(alias.Alias()).Add_byte_nl();
|
||||
}
|
||||
bfr.Add_str_a7("ns").Add_byte_nl();
|
||||
len = v.Ns_ary().length;
|
||||
|
||||
@@ -20,7 +20,7 @@ public class Xoi_wiki_props_ns {
|
||||
public int Id() {return id;} private int id;
|
||||
public boolean Subpages_enabled() {return subpages_enabled;} private boolean subpages_enabled;
|
||||
public Xoi_wiki_props_ns Init_by_ctor(int id, boolean subpages_enabled) {this.id = id; this.subpages_enabled = subpages_enabled; return this;}
|
||||
public void Init_by_xml(gplx.xmls.XmlNde ns_nde) {
|
||||
public void Init_by_xml(gplx.langs.xmls.XmlNde ns_nde) {
|
||||
this.id = Int_.parse(ns_nde.Atrs().FetchValOr("id", "-1"));
|
||||
this.subpages_enabled = ns_nde.Atrs().Fetch_or_null("subpages") != null;// per api, subpages="" means ns has subpages; no subpages attribute means no subpages
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user