Workaround for misplaced homonymie hatnotes in French Wikipedia

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


Former-commit-id: 127a9972d35309f6fc9e4758fca23c138a328242 [formerly cdb085d280f76c37b7fbceb092d9f158a884170c]
Former-commit-id: 1aadf0b1ad19958dfbd87bc356e8aedaaa46090e
This commit is contained in:
Jaifroid 2018-02-28 08:10:53 +00:00
parent ba9aead18c
commit 6b09a663b3

View File

@ -1677,7 +1677,7 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'q', 'module'
htmlArticle = htmlArticle.replace(/<span\b[^>]+>[^/]*?User:Popo[^<]+<\/span>\s*/i, "");
//Put misplaced hatnote headers inside <h1> block back in correct position @TODO remove this when fixed in mw-offliner
var hatnote = htmlArticle.match(/<h1\b(?:[^<]|<(?!h2))+?((?:<div\s+[^>]+\bhatnote\b[\s\S]+?<\/div>\s*)+)/i);
var hatnote = htmlArticle.match(/<h1\b(?:[^<]|<(?!h2))+?((?:<div\s+[^>]+\b(?:hatnote|homonymie)\b[\s\S]+?<\/div>\s*)+)/i);
if (hatnote && hatnote.length > 1) {
htmlArticle = htmlArticle.replace(hatnote[1], "");
htmlArticle = htmlArticle.replace(/(<\/h1>\s*)/i, "$1" + hatnote[1].replace(/(<div\s+)/i,'$1style="padding-top:10px;" '));