]+?width=)[^>]+?height=['"][^'"]+?['"]/ig, '$1max-width: 321px$2"320px"');
if (!params.isLandingPage) {
// Convert section tags to details tags (we have to loop because regex only matches innermost ...)
for (i = 5; i--;) {
htmlArticle = htmlArticle.replace(/]*data-mw-section-id=["'][1-9][^>]*)>((?:(?=([^<]+))\3|<(?!section\b[^>]*>))*?)<\/section>/ig, function (m0, m1, m2) {
- var summary = m2.replace(/(<(h[2-9])\b[^>]*>(?:[^<]|<(?!\2))+?<\/\2>)/i, '$1');
+ var summary = m2.replace(/(?:
]+>)?(<(h[2-9])\b[^>]*>(?:[^<]|<(?!\2))+?<\/\2>)(?:<\/div>)?/i, '$1');
return '' + summary + '';
});
- // We can stop iterating if all sections are consume
+ // We can stop iterating if all sections are consumed
if (!/]*data-mw-section-id=["'][1-9]/i.test(htmlArticle)) break;
}
}
@@ -6316,13 +6321,15 @@ function displayArticleContentInContainer (dirEntry, htmlArticle) {
zimType = /gutenberg\.css/i.test(testCSS) ? 'desktop-gtb' : zimType; // Support Gutenberg
zimType = /minerva|mobile/i.test(testCSS) ? 'mobile' : zimType;
cssSource = cssSource == 'auto' ? zimType : cssSource; // Default to in-built zimType if user has selected automatic detection of styles
- if (/minerva|inserted.style/i.test(testCSS) && (cssCache || zimType != cssSource)) {
+ if (/minerva|inserted.style|pcs\.css/i.test(testCSS) && (cssCache || zimType != cssSource)) {
// Substitute ridiculously long style name TODO: move this code to transformStyles
for (var i = arr.length; i--;) { // TODO: move to transfromStyles
arr[i] = /minerva/i.test(arr[i]) ? '' : arr[i];
// Delete stylesheet if will be inserted via minerva anyway (avoid linking it twice)
- if (/inserted.style/i.test(arr[i]) && /minerva/i.test(testCSS)) {
+ if (/inserted.style/i.test(arr[i]) && /minerva/i.test(testCSS) ||
+ // We also remove the new pcs.css style as it is causing issues
+ /pcs\.css/i.test(arr[i])) {
arr.splice(i, 1);
}
}
@@ -7178,8 +7185,12 @@ function openAllSections (override, node) {
function processSection (open, node) {
if (/DETAILS|SECTION/.test(node.tagName)) {
- if (open) node.setAttribute('open', '');
- else node.removeAttribute('open');
+ if (open) {
+ node.setAttribute('open', '');
+ node.style.display = '';
+ } else {
+ node.removeAttribute('open');
+ }
if (typeof HTMLDetailsElement === 'undefined' || node.tagName === 'SECTION') {
var children = node.children;
for (var y = children.length; y--;) {
diff --git a/www/js/lib/transformStyles.js b/www/js/lib/transformStyles.js
index f7f62e4c..a5f35b70 100644
--- a/www/js/lib/transformStyles.js
+++ b/www/js/lib/transformStyles.js
@@ -96,6 +96,7 @@ function filterCSS (zl, zim, cc, cs, i) {
/\/content.parsoid.css/i.test(zl) ||
/\/inserted_style_mobile.css/i.test(zl) ||
/\/inserted_style.css/i.test(zl) ||
+ /\/meta.wikimedia.org\/api\/rest_v1\/data\/css\/mobile\/base.css/i.test(zl) ||
/-\/static\/bootstrap\/css\/bootstrap.min.css/i.test(zl) ||
/-\/static\/bootstrap\/css\/bootstrap-theme.min.css/i.test(zl) ||
/-\/static\/main.css/i.test(zl) ||
@@ -105,7 +106,7 @@ function filterCSS (zl, zim, cc, cs, i) {
/\/skins.minerva.base.reset\|skins.minerva.content.styles\|ext.cite.style\|mediawiki.page.gallery.styles\|mobile.app.pagestyles.android\|mediawiki.skinning.content.parsoid.css/i.test(zl)
)) {
zl = zl.replace(/\|/ig, '_'); // Replace "|" with "_" (legacy for some stylesheets with pipes in filename - but next line renders this redundant in current implementation)
- if (/(-\/(?:s\/css_modules\/|mw\/)?style\.css)|minerva|inserted_style_mobile/i.test(zl)) { // If it matches one of the required styles...
+ if (/(-\/(?:s\/css_modules\/|mw\/)?style\.css)|minerva|inserted_style_mobile|base\.css/i.test(zl)) { // If it matches one of the required styles...
zl = cs === 'mobile' ? '-/s/style-mobile.css' : '-/s/style.css';
}
// Rename this required mobile style so that we don't trigger reading ZIM as mobile in print intercept