Skip to content

Commit

Permalink
Work around missing titles in all recent Wikimedia scrapes
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaifroid committed Aug 25, 2023
1 parent 882818b commit 26b96dd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions www/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -4941,8 +4941,8 @@ function displayArticleContentInContainer (dirEntry, htmlArticle) {
// Put site.js in the correct position
htmlArticle = htmlArticle.replace(/(<script\b[^>]+\/site\.js["']><\/script>\s*)((?:[^<]|<(?!\/body))+)/, '$2$1');
// @TODO Remove when fixed in https://github.com/openzim/mwoffliner/issues/1872
// Add missing title to Wikivoyage articles for post June 2023 scrapes
htmlArticle = /wikivoyage_en/.test(appstate.selectedArchive._file.name) && !/<h1\b[^>]+section-heading/i.test(htmlArticle) ? htmlArticle.replace(/(<section\sdata-mw-section-id="0"[^>]+>\s*)/i, '$1<h1 style="margin:10px 0">' + dirEntry.getTitleOrUrl() + '</h1>') : htmlArticle;
// Add missing title to WikiMedia articles for post June 2023 scrapes
htmlArticle = !params.isLandingPage && !/<h1\b[^>]+section-heading/i.test(htmlArticle) ? htmlArticle.replace(/(<section\sdata-mw-section-id="0"[^>]+>\s*)/i, '$1<h1 style="margin:10px 0">' + dirEntry.getTitleOrUrl() + '</h1>') : htmlArticle;
}

// Gutenberg ZIMs try to initialize before all assets are fully loaded. Affect UWP app.
Expand Down

0 comments on commit 26b96dd

Please sign in to comment.