]*>(?:(?=([^<]+))\3|<(?!p\b[^>]*>))*?<\/p>(?:)?)/i, "$2\r\n$1") : html;
//Set infobox styling hard-coded in Wikipedia mobile
- html = html.replace(/(table\s+(?=[^>]*class\s*=\s*["'][^"']*(?:infobox|vertical-navbox|qbRight|wikitable))[^>]*style\s*=\s*["'][^"']+[^;'"]);?\s*["']/ig, '$1; position: relative; border: 1px solid #eaecf0; text-align: left; background-color: #f8f9fa;"');
+ html = html.replace(/(table\s+(?=[^>]*class\s*=\s*["'][^"']*(?:infobox|vertical-navbox|qbRight|wv-quickbar|wikitable))[^>]*style\s*=\s*["'][^"']+[^;'"]);?\s*["']/ig, '$1; position: relative; border: 1px solid #eaecf0; text-align: left; background-color: #f8f9fa;"');
//Wrap
tags in
to control bottom border width if there's an infobox
- html = html.match(/table\s+(?=[^>]*class\s*=\s*["'][^"']*(?:infobox|vertical-navbox|qbRight|wikitable))/i) ? html.replace(/(
)/ig, '
$1
') : html;
+ html = html.match(/table\s+(?=[^>]*class\s*=\s*["'][^"']*(?:infobox|vertical-navbox|qbRight|wv-quickbar|wikitable))/i) ? html.replace(/(
)/ig, '
$1
') : html;
}
//Add dark theme if requested
css += (params.cssTheme == "dark") ? '\r\n' : (params.cssTheme == "invert") ? '\r\n' :"";
@@ -158,17 +158,15 @@ define(['util', 'uiUtil'], function (util, uiUtil) {
console.log(zim == "mobile" ? "Transforming display style to desktop..." : "Optimizing cached styles for desktop display...");
uiUtil.poll("mobile" ? "Transforming display style to desktop..." : "Optimizing cached styles for desktop display...");
//If it's in mobile position, move info-box above lead paragraph like on Wikipedia desktop
- //html = html.replace(/((?:\s*)?
', 'i') : tableBox;
if (tableBox && tableBox.length) {
html = html.replace(tableBox, "@@@KiwixSep@@@");
- html = html.replace(/((?:\s*)?
...
followed by Kiwix separator or
...
followed by small skpped
containing no more than 40 characters (this happens in Wikivoyage English)
+ html = html.replace(/(<(?:(span\b)[^>]*>\s*<)?p\b[^>]*>(?:(?=([^<]+))\3|<(?!p\b))*?<\/p>\s*(?:<\/)?\2(?:>\s*)?(?:
\s*)?)@@@KiwixSep@@@/i, tableBox + "\r\n$1");
//Do the replacement below just in case above regex failed
html = html.replace(/@@@KiwixSep@@@/, tableBox);
}