mirror of
https://github.com/kiwix/kiwix-js-pwa.git
synced 2025-09-08 19:57:46 -04:00
Fix runaway regular expression when parsing MathML
This commit is contained in:
parent
cf0dfc73f2
commit
aeadc403c2
@ -6443,8 +6443,8 @@ function displayArticleContentInContainer (dirEntry, htmlArticle) {
|
|||||||
|
|
||||||
// Replace all TeX SVGs with MathJax scripts
|
// Replace all TeX SVGs with MathJax scripts
|
||||||
if (params.useMathJax) {
|
if (params.useMathJax) {
|
||||||
// Deal with any newer MathML blocks
|
// Deal with any newer MathML blocksº
|
||||||
htmlArticle = htmlArticle.replace(/(<math\b[^>]+alttext=(["']))((?:[^"']|[\s\S](?!\2))+?)(\2(?:[^<]|<(?!\/math))+(?:[^<]|<(?!img))+)<img\b[^>]+?class=["'][^"']*?mwe-math-fallback-image[^>]+>/ig,
|
htmlArticle = htmlArticle.replace(/(<math\b[^>]+alttext=(["']))((?:[^\s\S](?!\2))+)(\2(?:[^<]|<(?!\/math))+(?:[^<]|<(?!img))+)<img\b[^>]+?class=["'][^"']*?mwe-math-fallback-image[^>]+>/ig,
|
||||||
function (_p0, p1, _p2, math, p4) {
|
function (_p0, p1, _p2, math, p4) {
|
||||||
// Remove any rogue ampersands in MathJax due to double escaping (by Wikipedia)
|
// Remove any rogue ampersands in MathJax due to double escaping (by Wikipedia)
|
||||||
math = math.replace(/&/g, '&');
|
math = math.replace(/&/g, '&');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user