mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
'v3.7.2.1'
This commit is contained in:
@@ -33,7 +33,7 @@ public class Xop_languages_xnde implements Xox_xnde {
|
||||
int slash_pos = Bry_find_.Find_bwd(page_bry, Xoa_ttl.Subpage_spr);
|
||||
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);
|
||||
return Xoa_ttl.Parse(wiki, ttl.Ns().Id(), root_bry);
|
||||
}
|
||||
private List_adp Find_lang_pages(Xop_ctx ctx, Xowe_wiki wiki) {
|
||||
this.root_ttl = Root_ttl_of(wiki, ctx.Page().Ttl());
|
||||
@@ -112,13 +112,13 @@ class Xop_languages_fmtr implements gplx.core.brys.Bfr_arg {
|
||||
int len = langs.Count();
|
||||
Xoh_href_wtr href_wtr = wiki.Appe().Html__href_wtr();
|
||||
int ns_id = root_ttl.Ns().Id();
|
||||
byte[] root_ttl_bry = root_ttl.Page_db(); // NOTE: do not use .Full(); ns will be added in Xoa_ttl.parse below
|
||||
byte[] root_ttl_bry = root_ttl.Page_db(); // NOTE: do not use .Full(); ns will be added in Xoa_ttl.Parse below
|
||||
for (int i = 0; i < len; i++) {
|
||||
Xol_lang_stub lang = (Xol_lang_stub)langs.Get_at(i);
|
||||
byte[] lang_key = lang.Key();
|
||||
boolean lang_is_en = Bry_.Eq(lang_key, Xol_lang_itm_.Key_en);
|
||||
byte[] lang_ttl_bry = lang_is_en ? root_ttl_bry : Bry_.Add_w_dlm(Xoa_ttl.Subpage_spr, root_ttl_bry, lang_key);
|
||||
Xoa_ttl lang_ttl = Xoa_ttl.parse(wiki, ns_id, lang_ttl_bry);
|
||||
Xoa_ttl lang_ttl = Xoa_ttl.Parse(wiki, ns_id, lang_ttl_bry);
|
||||
byte[] lang_href = href_wtr.Build_to_bry(wiki, lang_ttl);
|
||||
byte[] lang_title = Xoh_html_wtr.Ttl_to_title(lang_ttl.Full_txt_w_ttl_case());
|
||||
Bry_fmtr fmtr = null;
|
||||
|
||||
@@ -30,7 +30,7 @@ public class Xop_mylanguage_page implements Xow_special_page {
|
||||
if (!lang_is_english)
|
||||
trg_bry = Bry_.Add_w_dlm(Xoa_ttl.Subpage_spr, page_bry, lang_key);
|
||||
wiki.Data_mgr().Redirect(page, trg_bry);
|
||||
if (page.Missing() && !lang_is_english) // foreign lang does not exist; default to english
|
||||
if (page.Db().Page().Exists_n() && !lang_is_english) // foreign lang does not exist; default to english
|
||||
wiki.Data_mgr().Redirect(page, page_bry);
|
||||
}
|
||||
|
||||
|
||||
@@ -49,10 +49,10 @@ class Xop_mylanguage_page_fxt {
|
||||
Xoae_page page = parser_fxt.Ctx().Page();
|
||||
Xoa_url url = app.User().Wikii().Utl__url_parser().Parse(Bry_.new_u8(link));
|
||||
page.Url_(url);
|
||||
Xoa_ttl ttl = Xoa_ttl.parse(wiki, Bry_.new_a7(link));
|
||||
Xoa_ttl ttl = Xoa_ttl.Parse(wiki, Bry_.new_a7(link));
|
||||
page.Ttl_(ttl);
|
||||
special_page.Special__gen(wiki, page, url, ttl);
|
||||
Tfds.Eq(expd, String_.new_a7(page.Url().Page_bry()));
|
||||
Tfds.Eq(expd, String_.new_a7(page.Data_raw()));
|
||||
Tfds.Eq(expd, String_.new_a7(page.Db().Text().Text_bry()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ public class Xop_translate_xnde implements Xox_xnde {
|
||||
public void Xtn_parse(Xowe_wiki wiki, Xop_ctx ctx, Xop_root_tkn root, byte[] src, Xop_xnde_tkn xnde) {
|
||||
byte[] translate_src = Bry_.Mid(src, xnde.Tag_open_end(), xnde.Tag_close_bgn());
|
||||
translate_src = Bry_.Trim(translate_src, 0, translate_src.length);
|
||||
Xop_ctx sub_ctx = Xop_ctx.new_sub_(wiki);
|
||||
Xop_ctx sub_ctx = Xop_ctx.new_sub_(ctx);
|
||||
xtn_root = wiki.Parser_mgr().Main().Parse_text_to_wdom_old_ctx(sub_ctx, translate_src, true);
|
||||
}
|
||||
public void Xtn_write(Bry_bfr bfr, Xoae_app app, Xop_ctx ctx, Xoh_html_wtr html_wtr, Xoh_wtr_ctx hctx, Xop_xnde_tkn xnde, byte[] src) {
|
||||
|
||||
@@ -23,17 +23,17 @@ public class Xop_tvar_lxr implements Xop_lxr {
|
||||
public void Init_by_wiki(Xowe_wiki wiki, Btrie_fast_mgr core_trie) {core_trie.Add(Hook_bgn, this);}
|
||||
public void Init_by_lang(Xol_lang_itm lang, Btrie_fast_mgr core_trie) {}
|
||||
public void Term(Btrie_fast_mgr core_trie) {}
|
||||
private static final byte[] Hook_bgn = Bry_.new_a7("<tvar|"), Close_nde = Bry_.new_a7("</>");
|
||||
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_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_ctx sub_ctx = Xop_ctx.new_sub_(ctx);
|
||||
Xop_root_tkn sub_root = tkn_mkr.Root(body);
|
||||
body = ctx.Wiki().Parser_mgr().Main().Parse_text_to_wtxt(sub_root, sub_ctx, tkn_mkr, body); // NOTE: must parse inner text for templates; EX:<tvar|a>{{B}}</>; PAGE:mw:Download; DATE:2014-04-27
|
||||
int end_pos = lhs_bgn + Close_nde.length;
|
||||
ctx.Subs_add(root, tkn_mkr.Tvar(bgn_pos, end_pos, cur_pos, rhs_end, rhs_end + Int_.Const_position_after_char, lhs_bgn, body));
|
||||
return end_pos;
|
||||
}
|
||||
public static final Xop_tvar_lxr Instance = new Xop_tvar_lxr(); Xop_tvar_lxr() {}
|
||||
public static final Xop_tvar_lxr Instance = new Xop_tvar_lxr(); Xop_tvar_lxr() {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user