Very dirty patch for HTML showing in Wikivoyage headings on some pages

See https://github.com/openzim/mwoffliner/issues/178


Former-commit-id: daeadbb483b6b3322a0ea2f83ad6f0dfcbf17a20 [formerly ca6ae28c6f4dbc2f24cc29da3913d9b153f36c92]
Former-commit-id: 3f9cb5eba145576be9c923cba2becc556e5f5e30
This commit is contained in:
Jaifroid 2017-12-16 16:44:05 +00:00
parent 5958c118e2
commit 1eb9da18fb

View File

@ -1553,7 +1553,10 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'abstractFile
//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
htmlArticle = htmlArticle.replace(/(<\/body>)/i, "<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>\r\n$1");
htmlArticle = htmlArticle.replace(/(dditional terms may apply for the media files[^<]+<\/div>\s*)/i, "$1\r\n<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>\r\n");
//@TODO - remove this when issue fixed: VERY DIRTY PATCH FOR HTML IN PAGE TITLES on Wikivoyage
htmlArticle = htmlArticle.replace(/&lt;a href[^"]+"\/wiki\/([^"]+)[^<]+&gt;([^<]+)&lt;\/a&gt;/ig, "<a href=\"$1.html\">$2</a>");
//Fast-replace img src with data-kiwixsrc and hide image [kiwix-js #272]
htmlArticle = htmlArticle.replace(/(<img\s+[^>]*\b)src(\s*=)/ig, "$1data-kiwixsrc$2");