From 5f22f89ffdb4566a119c76c0ecee6dd24bce4981 Mon Sep 17 00:00:00 2001 From: Jaifroid Date: Sat, 13 Jan 2018 18:14:57 +0000 Subject: [PATCH] Works around misplacement of noexcerpt disambiguation note See https://github.com/openzim/mwoffliner/issues/182 Former-commit-id: 99389e97f3cfd4062aef2d4b67c2ca6966f6fdff [formerly 3864eb7b4b5fc139c0ea2f0e92588db211790eb3] Former-commit-id: 6f581cc64cd03944da04817a6f118ac1b55a9c33 --- www/js/app.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/www/js/app.js b/www/js/app.js index 9e866033..5606c404 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -1608,6 +1608,12 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'q', 'module' htmlArticle = htmlArticle.replace(hatnote, ""); htmlArticle = htmlArticle.replace(/(<\/h1>\s*)/i, "$1" + hatnote); } + //Put misplaced disambiguation header back in its correct position @TODO remove this when fixed in mw-offliner + var noexcerpt = htmlArticle.match(/
(?:[^<]|<(?!\/dl>))+?excerpt(?:[^<]|<(?!\/dl>))+?For other places with the same name(?:[^<]|<(?!\/dl>))+?<\/dl>\s*/i); + if (noexcerpt && noexcerpt.length) { + htmlArticle = htmlArticle.replace(noexcerpt, ""); + htmlArticle = htmlArticle.replace(/(<\/h1>\s*)/i, "$1" + noexcerpt); + } //TESTING - find out whether document contains MathSVGs //var containsMathSVG = /\.svg\s*['"][^>]+mwe-math-fallback-image|mwe-math-fallback-image[^>]+\.svg\s*['"]/i.test(htmlArticle);