1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00

v2.11.3.1

This commit is contained in:
gnosygnu
2015-11-15 21:08:17 -05:00
parent d9f45cec19
commit 8a5d58a973
418 changed files with 2694 additions and 1621 deletions

View File

@@ -35,10 +35,11 @@ public class Xoh_href_parser {
switch (((Byte_obj_val)seg_obj).Val()) {
case Seg_xcmd_tid: // convert "/xcmd/a" to "xowa-cmd:a"
raw = Bry_.Add(Gfo_protocol_itm.Bry_xcmd, Bry_.Mid(raw, btrie.Match_pos()));
bgn = 0;
break;
case Seg_wiki_tid: // skip "/wiki/" or "/site/"
case Seg_site_tid:
case Seg_wiki_tid: // add domain_bry; NOTE: needed for url-like pages; EX:"/wiki/http://A"; PAGE:esolangs.org/wiki/Language_list; DATE:2015-11-14
raw = Bry_.Add(wiki.Domain_bry(), raw);
break;
case Seg_site_tid: // skip "/site"
bgn = btrie.Match_pos();
break;
default:

View File

@@ -35,12 +35,18 @@ public class Xoh_href_parser_tst {
fxt.Run_parse_by_href("/wiki/A#b").Chk_to_str("en.wikipedia.org/wiki/A#b").Chk_anch("b");
}
@Test public void Wiki__xwiki__only() {
fxt.Prep_add_xwiki_to_wiki("wikt", "en.wiktionary.org");
fxt.Run_parse_by_href("/wiki/wikt:").Chk_page_is_main_y().Chk_page("Main_Page").Chk_to_str("en.wiktionary.org/wiki/Main_Page");
fxt.Prep_add_xwiki_to_wiki("c", "commons.wikimedia.org");
fxt.Run_parse_by_href("/wiki/c:").Chk_page_is_main_y().Chk_page("Main_Page").Chk_to_str("commons.wikimedia.org/wiki/Main_Page");
}
@Test public void Wiki__encoded() {
fxt.Run_parse_by_href("/wiki/A%22b%22c").Chk_page("A\"b\"c");
}
@Test public void Wiki__triple_slash() { // PURPOSE: handle triple slashes; PAGE:esolangs.org/wiki/Language_list; DATE:2015-11-14
fxt.Run_parse_by_href("/wiki////").Chk_to_str("en.wikipedia.org/wiki////").Chk_wiki("en.wikipedia.org").Chk_page("///");
}
@Test public void Wiki__http() { // PURPOSE: variant of triple slashes; DATE:2015-11-14
fxt.Run_parse_by_href("/wiki/http://a").Chk_to_str("en.wikipedia.org/wiki/Http://a").Chk_wiki("en.wikipedia.org").Chk_page("Http://a");
}
@Test public void Site__basic() {
fxt.Run_parse_by_href("/site/en.wikipedia.org/wiki/A").Chk_tid(Xoa_url_.Tid_page).Chk_to_str("en.wikipedia.org/wiki/A").Chk_page("A");
}

View File

@@ -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.htmls.hrefs; import gplx.*; import gplx.xowa.*; import gplx.xowa.htmls.*;
import gplx.core.brys.fmtrs.*;
import gplx.langs.htmls.encoders.*;
import gplx.xowa.wikis.xwikis.*;
public class Xoh_href_wtr {