mirror of
https://github.com/kiwix/kiwix-js-pwa.git
synced 2025-09-10 04:40:27 -04:00
Works around mwoffliner issue with hatnote
See https://github.com/openzim/mwoffliner/issues/182 Former-commit-id: fd9167f2ed1de2f427f0fb02057dea9b3514241f [formerly adba26f8d5cb0f14b2b9213282a5fb4dea6fda58] Former-commit-id: 22bba4f753a98bb2b68a4531b7e2e2e0c006d441
This commit is contained in:
parent
e1c68a6fcb
commit
61d76711a2
@ -1584,7 +1584,7 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'q', 'module'
|
|||||||
|
|
||||||
//Some documents (e.g. Ray Charles Index) can't be scrolled to the very end, as some content remains benath the footer
|
//Some documents (e.g. Ray Charles Index) can't be scrolled to the very end, as some content remains benath the footer
|
||||||
//so add some whitespace at the end of the document
|
//so add some whitespace at the end of the document
|
||||||
htmlArticle = htmlArticle.replace(/(dditional terms may apply for the media files[^<]+<\/div>\s*)/i, "$1\r\n<p> </p><p> </p><p> </p><p> </p>\r\n");
|
htmlArticle = htmlArticle.replace(/(dditional terms may apply for the media files[^<]+<\/div>\s*)/i, "$1\r\n<p> </p><p> </p><p> </p><p> </p><p> </p>\r\n");
|
||||||
|
|
||||||
//@TODO - remove this when issue fixed: VERY DIRTY PATCH FOR HTML IN PAGE TITLES on Wikivoyage
|
//@TODO - remove this when issue fixed: VERY DIRTY PATCH FOR HTML IN PAGE TITLES on Wikivoyage
|
||||||
htmlArticle = htmlArticle.replace(/<a href[^"]+"\/wiki\/([^"]+)[^<]+>([^<]+)<\/a>/ig, "<a href=\"$1.html\">$2</a>");
|
htmlArticle = htmlArticle.replace(/<a href[^"]+"\/wiki\/([^"]+)[^<]+>([^<]+)<\/a>/ig, "<a href=\"$1.html\">$2</a>");
|
||||||
@ -1602,6 +1602,13 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'q', 'module'
|
|||||||
htmlArticle = htmlArticle.replace(/<h1\b[^>]+>[^/]*?User:Popo[^<]+<\/h1>\s*/i, "");
|
htmlArticle = htmlArticle.replace(/<h1\b[^>]+>[^/]*?User:Popo[^<]+<\/h1>\s*/i, "");
|
||||||
htmlArticle = htmlArticle.replace(/<span\b[^>]+>[^/]*?User:Popo[^<]+<\/span>\s*/i, "");
|
htmlArticle = htmlArticle.replace(/<span\b[^>]+>[^/]*?User:Popo[^<]+<\/span>\s*/i, "");
|
||||||
|
|
||||||
|
//Put misplaced hatnote header back in its correct position @TODO remove this when fixed in mw-offliner
|
||||||
|
var hatnote = htmlArticle.match(/<div\s+[^>]+\bhatnote\b[^>]+>Not to be confused with[\s\S]+?<\/div>\s*/i);
|
||||||
|
if (hatnote && hatnote.length) {
|
||||||
|
htmlArticle = htmlArticle.replace(hatnote, "");
|
||||||
|
htmlArticle = htmlArticle.replace(/(<\/h1>\s*)/i, "$1" + hatnote);
|
||||||
|
}
|
||||||
|
|
||||||
//TESTING - find out whether document contains MathSVGs
|
//TESTING - find out whether document contains MathSVGs
|
||||||
//var containsMathSVG = /\.svg\s*['"][^>]+mwe-math-fallback-image|mwe-math-fallback-image[^>]+\.svg\s*['"]/i.test(htmlArticle);
|
//var containsMathSVG = /\.svg\s*['"][^>]+mwe-math-fallback-image|mwe-math-fallback-image[^>]+\.svg\s*['"]/i.test(htmlArticle);
|
||||||
//Version below will match any type of fallback image so long as there is an alt string
|
//Version below will match any type of fallback image so long as there is an alt string
|
||||||
|
Loading…
x
Reference in New Issue
Block a user