mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
Parser.Lnke: Handle xwiki links to history pages
This commit is contained in:
@@ -176,12 +176,17 @@ public class Xop_lnke_wkr implements Xop_ctx_wkr {
|
||||
|
||||
byte[] xwiki_wiki = xo_url_parser_url.Wiki_bry();
|
||||
byte[] xwiki_page = xo_url_parser_url.Page_bry();
|
||||
Xoa_ttl ttl = Xoa_ttl.Parse(wiki, xwiki_page);
|
||||
if (ttl != null && ttl.Wik_itm() != null) {
|
||||
xwiki_wiki = ttl.Wik_itm().Domain_bry();
|
||||
xwiki_page = ttl.Page_url();
|
||||
if (xwiki_page == null) { // handle xwiki lnke's to history page else null ref; EX:[http://ru.wikipedia.org/w/index.php?title&diff=19103464&oldid=18910980 извещен]; PAGE:ru.w:Project:Заявки_на_снятие_флагов/Архив/Патрулирующие/2009 DATE:2016-11-24
|
||||
xwiki_page = decoded_src;
|
||||
}
|
||||
else {
|
||||
Xoa_ttl ttl = Xoa_ttl.Parse(wiki, xwiki_page);
|
||||
if (ttl != null && ttl.Wik_itm() != null) {
|
||||
xwiki_wiki = ttl.Wik_itm().Domain_bry();
|
||||
xwiki_page = ttl.Page_url();
|
||||
}
|
||||
tkn.Lnke_xwiki_(xwiki_wiki, xwiki_page, xo_url_parser_url.Qargs_ary());
|
||||
}
|
||||
tkn.Lnke_xwiki_(xwiki_wiki, xwiki_page, xo_url_parser_url.Qargs_ary());
|
||||
}
|
||||
ctx.Subs_add(root, tkn);
|
||||
if (lnke_type == Xop_lnke_tkn.Lnke_typ_brack) {
|
||||
|
||||
@@ -40,6 +40,10 @@ public class Xop_lnke_wkr_xwiki_tst {
|
||||
fxt.App().Usere().Wiki().Xwiki_mgr().Add_by_atrs(Bry_.new_a7("en.wikipedia.org"), Bry_.new_a7("en.wikipedia.org"));
|
||||
fxt.Test__parse__wtxt_to_html("[http://en.wikipedia.org/wiki/A?action=edit a]", "<a href='/site/en.wikipedia.org/wiki/A?action=edit'>a</a>");
|
||||
}
|
||||
@Test public void Xwiki__history() { // PURPOSE: handle xwiki lnke's to history page else null ref; EX:[http://ru.wikipedia.org/w/index.php?title&diff=19103464&oldid=18910980 извещен]; PAGE:ru.w:Project:Заявки_на_снятие_флагов/Архив/Патрулирующие/2009 DATE:2016-11-24
|
||||
fxt.App().Usere().Wiki().Xwiki_mgr().Add_by_atrs(Bry_.new_a7("en.wikipedia.org"), Bry_.new_a7("en.wikipedia.org"));
|
||||
fxt.Test__parse__wtxt_to_html("[http://en.wikipedia.org/w/index.php?title&diff=1&oldid=2 abc]", "<a href='http://en.wikipedia.org/w/index.php?title&diff=1&oldid=2' rel='nofollow' class='external text'>abc</a>");
|
||||
}
|
||||
@Test public void Ignore_proto() { // PURPOSE: handle other protocols; PAGE:uk.w:Маскалі; DATE:2015-07-28
|
||||
fxt.Test__parse__wtxt_to_html("[mailto:a b]", "<a href='mailto:a' rel='nofollow' class='external text'>b</a>");// should be /w/, not /en.wikipedia.org
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user