mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
v2.3.2.1
This commit is contained in:
@@ -114,6 +114,7 @@ public class Xoa_css_img_downloader {
|
||||
if (css_url_len > 1 && css_url[1] != Byte_ascii.Slash) // skip if css_url starts with "//"; EX: "//site/page"
|
||||
css_url = Bry_.Add(rel_url_prefix, css_url); // "/w/a.css" -> "//en.wikipedia.org/w/a.css"
|
||||
}
|
||||
css_url = Bry_.Replace(css_url, Byte_ascii.Space, Byte_ascii.Underline); // NOTE: must replace spaces with underlines else download will fail; EX:https://it.wikivoyage.org/w/index.php?title=MediaWiki:Container e Infobox.css&action=raw&ctype=text/css; DATE:2015-03-08
|
||||
byte[] css_src_bry = Import_url_build(stylesheet_prefix, rel_url_prefix, css_url);
|
||||
String css_src_str = String_.new_utf8_(css_src_bry);
|
||||
download_wkr.Download_xrg().Prog_fmt_hdr_(usr_dlg.Log_many(GRP_KEY, "logo.download", "downloading import for '~{0}'", css_src_str));
|
||||
|
||||
@@ -129,6 +129,20 @@ public class Xoa_css_img_downloader_tst {
|
||||
)
|
||||
);
|
||||
}
|
||||
@Test public void Import_url_space() { // PURPOSE: some css has spaces; replace with underlines else fails when downloaded; EX: https://it.wikivoyage.org/w/index.php?title=MediaWiki:Container e Infobox.css&action=raw&ctype=text/css; DATE:2015-03-08
|
||||
Io_mgr._.InitEngine_mem();
|
||||
Io_mgr._.SaveFilStr("mem/www/b_c.css", "imported_css");
|
||||
fxt.Test_css_convert
|
||||
( "x @import url(\"mem/www/b c.css\") screen; z"
|
||||
, String_.Concat_lines_nl
|
||||
( "x "
|
||||
, "/*XOWA:mem/www/b_c.css*/"
|
||||
, "imported_css"
|
||||
, ""
|
||||
, " z"
|
||||
)
|
||||
);
|
||||
}
|
||||
@Test public void Wikisource_freedimg() { // PURPOSE: check that "wikimedia" is replaced for FreedImg hack; PAGE:en.s:Page:Notes_on_Osteology_of_Baptanodon._With_a_Description_of_a_New_Species.pdf/3 DATE:2014-09-06
|
||||
fxt.Downloader().Stylesheet_prefix_(Bry_.new_utf8_("mem")); // stylesheet prefix prefix defaults to ""; set to "mem", else test will try to retrieve "//url" which will fail
|
||||
Io_mgr._.InitEngine_mem();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -32,12 +32,12 @@ class Xow_page_fetcher_mok implements Xow_page_fetcher {
|
||||
public Xow_page_fetcher Wiki_(Xowe_wiki v) {return this;}
|
||||
public void Clear() {pages.Clear();} private HashAdp pages = HashAdp_.new_();
|
||||
public void Add(int ns_id, byte[] ttl, byte[] text) {
|
||||
Xodb_page page = new Xodb_page().Ns_id_(ns_id).Ttl_wo_ns_(ttl).Text_(text);
|
||||
Xodb_page page = new Xodb_page().Ns_id_(ns_id).Ttl_page_db_(ttl).Wtxt_(text);
|
||||
pages.Add(Make_key(ns_id, ttl), page);
|
||||
}
|
||||
public byte[] Fetch(int ns_id, byte[] ttl) {
|
||||
Xodb_page rv = (Xodb_page)pages.Fetch(Make_key(ns_id, ttl));
|
||||
return rv == null ? null : rv.Text();
|
||||
return rv == null ? null : rv.Wtxt();
|
||||
}
|
||||
String Make_key(int ns_id, byte[] ttl) {return Int_.Xto_str(ns_id) + "|" + String_.new_utf8_(ttl);}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user