mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
v2.7.3.1
This commit is contained in:
@@ -60,7 +60,7 @@ public class Xoa_css_extractor {
|
||||
wiki.Html__css_installing_(false);
|
||||
}
|
||||
catch (Exception e) { // if error, failover; paranoia catch for outliers like bad network connectivity fail, or MediaWiki: message not existing; DATE:2013-11-21
|
||||
wiki.App().Usr_dlg().Warn_many("", "", "failed to get css; failing over; wiki='~{0}' err=~{1}", wiki.Domain_str(), Err_.Message_gplx(e));
|
||||
wiki.App().Usr_dlg().Warn_many("", "", "failed to get css; failing over; wiki='~{0}' err=~{1}", wiki.Domain_str(), Err_.Message_gplx_full(e));
|
||||
Css_common_failover(); // only failover xowa_common.css; xowa_wiki.css comes from MediaWiki:Common.css / Vector.css
|
||||
wiki.Html__css_installing_(false);
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class Xoa_css_img_downloader {
|
||||
if (url_pos == Bry_.NotFound) {bfr.Add_mid(src, prv_pos, src_len); break;} // no more "url("; exit;
|
||||
int bgn_pos = url_pos + Bry_url_len; // set bgn_pos after "url("
|
||||
byte bgn_byte = src[bgn_pos];
|
||||
byte end_byte = Byte_ascii.Nil;
|
||||
byte end_byte = Byte_ascii.Null;
|
||||
boolean quoted = true;
|
||||
switch (bgn_byte) { // find end_byte
|
||||
case Byte_ascii.Quote: case Byte_ascii.Apos: // quoted; end_byte is ' or "
|
||||
@@ -99,7 +99,7 @@ public class Xoa_css_img_downloader {
|
||||
return bfr.Xto_bry_and_clear();
|
||||
}
|
||||
catch (Exception e) {
|
||||
usr_dlg.Warn_many("", "", "failed to convert local_urls: ~{0} ~{1}", String_.new_u8(rel_url_prefix), Err_.Message_gplx(e));
|
||||
usr_dlg.Warn_many("", "", "failed to convert local_urls: ~{0} ~{1}", String_.new_u8(rel_url_prefix), Err_.Message_gplx_full(e));
|
||||
return src;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ public class Xoa_css_img_downloader_tst {
|
||||
);
|
||||
}
|
||||
@Test public void Import_url_relative_skip() { // PURPOSE: if rel path, skip; "//site/a/b.css"; DATE:2014-02-03
|
||||
fxt.Downloader().Stylesheet_prefix_(Bry_.new_u8("mem")); // stylesheet prefix prefix defaults to ""; set to "mem", else test will try to retrieve "//url" which will fail
|
||||
fxt.Downloader().Stylesheet_prefix_(Bry_.new_a7("mem")); // stylesheet prefix prefix defaults to ""; set to "mem", else test will try to retrieve "//url" which will fail
|
||||
Io_mgr.I.InitEngine_mem();
|
||||
Io_mgr.I.SaveFilStr("mem//en.wikipedia.org/a/b.css", "imported_css");
|
||||
fxt.Test_css_convert
|
||||
@@ -144,7 +144,7 @@ public class Xoa_css_img_downloader_tst {
|
||||
);
|
||||
}
|
||||
@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_u8("mem")); // stylesheet prefix prefix defaults to ""; set to "mem", else test will try to retrieve "//url" which will fail
|
||||
fxt.Downloader().Stylesheet_prefix_(Bry_.new_a7("mem")); // stylesheet prefix prefix defaults to ""; set to "mem", else test will try to retrieve "//url" which will fail
|
||||
Io_mgr.I.InitEngine_mem();
|
||||
Io_mgr.I.SaveFilStr("mem//en.wikisource.org/w/index.php?title=MediaWiki:Dynimg.css", ".freedImg img[src*=\"wikipedia\"], .freedImg img[src*=\"wikisource\"], .freedImg img[src*=\"score\"], .freedImg img[src*=\"math\"] {");
|
||||
fxt.Test_css_convert
|
||||
|
||||
@@ -30,7 +30,7 @@ class Xob_css_parser__url {
|
||||
break;
|
||||
default: // not quoted; end byte is ")"; EX: ' url(a.png)'
|
||||
end_byte = Byte_ascii.Paren_end;
|
||||
quote_byte = Byte_ascii.Nil;
|
||||
quote_byte = Byte_ascii.Null;
|
||||
break;
|
||||
}
|
||||
int end_pos = Bry_finder.Find_fwd(src, end_byte, bgn_pos, src_len);
|
||||
|
||||
@@ -62,7 +62,7 @@ class Xob_css_tkn__url extends Xob_css_tkn__base {
|
||||
mgr.File_hash().Add_if_dupe_use_1st(src_url, new Xobc_download_itm(Xobc_download_itm.Tid_file, String_.new_u8(src_url), trg_url));
|
||||
}
|
||||
@Override public int Write(Bry_bfr bfr, byte[] src) {
|
||||
byte quote = quote_byte; if (quote == Byte_ascii.Nil) quote = Byte_ascii.Apos;
|
||||
byte quote = quote_byte; if (quote == Byte_ascii.Null) quote = Byte_ascii.Apos;
|
||||
bfr.Add_str_a7(" url("); // EX: ' url('
|
||||
bfr.Add_byte(quote).Add(trg_url).Add_byte(quote); // EX: '"a.png"'
|
||||
bfr.Add_byte(Byte_ascii.Paren_end); // EX: ')'
|
||||
@@ -102,7 +102,7 @@ class Xob_css_tkn__import extends Xob_css_tkn__base {
|
||||
mgr.Code_add(src_url);
|
||||
}
|
||||
@Override public int Write(Bry_bfr bfr, byte[] src) {
|
||||
byte quote = quote_byte; if (quote == Byte_ascii.Nil) quote = Byte_ascii.Apos;
|
||||
byte quote = quote_byte; if (quote == Byte_ascii.Null) quote = Byte_ascii.Apos;
|
||||
bfr.Add_str_a7(" @import url("); // EX: ' @import url('
|
||||
bfr.Add_byte(quote).Add(trg_url).Add_byte(quote); // EX: '"a.png"'
|
||||
bfr.Add_byte(Byte_ascii.Paren_end); // EX: ')'
|
||||
|
||||
Reference in New Issue
Block a user