1
0
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:
gnosygnu
2015-11-01 20:50:05 -05:00
parent 4f43f51b18
commit b990ec409f
858 changed files with 6758 additions and 4187 deletions

View File

@@ -21,7 +21,7 @@ public class Xoh_href_gui_utl {
public static String Html_extract_text(String site, String page, String text_str) {
byte[] text_bry = Bry_.new_u8(text_str);
int text_len = text_bry.length;
int text_tid = Byte_ascii.Xto_digit(text_bry[0]);
int text_tid = Byte_ascii.To_a7_int(text_bry[0]);
switch (text_tid) {
case Text_tid_none: return ""; // "0"
case Text_tid_text: return String_.new_u8(text_bry, 2, text_len); // 2 to skip "1|"

View File

@@ -61,7 +61,7 @@ public class Xoh_href_parser_tst {
}
@Test public void Site__xwiki_cases_correctly() { // PURPOSE: xwiki links should use case_match of xwiki (en.wiktionary.org) not cur_wiki (en.wikipedia.org); EX:w:Alphabet
Xowe_wiki en_wiktionary_org = fxt.Prep_create_wiki("en.wiktionary.org");
en_wiktionary_org.Ns_mgr().Ns_main().Case_match_(Xow_ns_case_.Id_all);
en_wiktionary_org.Ns_mgr().Ns_main().Case_match_(Xow_ns_case_.Tid__all);
fxt.Prep_add_xwiki_to_user("en.wiktionary.org", "en.wiktionary.org");
fxt.Run_parse_by_href("/site/en.wiktionary.org/wiki/alphabet");
fxt.Chk_to_str("en.wiktionary.org/wiki/alphabet").Chk_page("alphabet");

View File

@@ -72,11 +72,11 @@ public class Xoh_href_wtr {
}
private void Build_to_bfr_page(Xoa_ttl ttl, byte[] ttl_full, int page_bgn) {
int anch_bgn = Bry_find_.Find_fwd(ttl_full, Byte_ascii.Hash); // NOTE: cannot use Anch_bgn b/c Anch_bgn has bug with whitespace
if (anch_bgn == Bry_.NotFound) // no anchor; just add page
if (anch_bgn == Bry_find_.Not_found) // no anchor; just add page
encoder.Encode(encoder_bfr, ttl_full, page_bgn, ttl_full.length);
else { // anchor exists; check if anchor is preceded by ws; EX: [[A #b]] -> "/wiki/A#b"
int page_end = Bry_find_.Find_bwd_last_ws(ttl_full, anch_bgn); // first 1st ws before #; handles multiple ws
page_end = page_end == Bry_.NotFound ? anch_bgn : page_end; // if ws not found, use # pos; else use 1st ws pos
page_end = page_end == Bry_find_.Not_found ? anch_bgn : page_end; // if ws not found, use # pos; else use 1st ws pos
encoder.Encode(encoder_bfr, ttl_full, page_bgn, page_end); // add page
encoder.Encode(encoder_bfr, ttl_full, anch_bgn, ttl_full.length); // add anchor
}

View File

@@ -47,7 +47,7 @@ class Xoh_href_wtr_fxt {
public Xoae_app App() {return app;} private final Xoae_app app;
public Xoh_href_wtr_fxt Prep_wiki_cs(String domain) {
Xow_wiki wiki = app.Wiki_mgr().Get_by_key_or_make_init_n(Bry_.new_u8(domain));
wiki.Ns_mgr().Ns_main().Case_match_(Xow_ns_case_.Id_all);
wiki.Ns_mgr().Ns_main().Case_match_(Xow_ns_case_.Tid__all);
return this;
}
public Xoh_href_wtr_fxt Prep_xwiki_by_many(String raw) {wiki.Xwiki_mgr().Add_by_csv(Bry_.new_u8(raw)); return this;} // need to add to wiki's xwiki_mgr for ttl_parse