@xiee/utils
Advanced tools
Comparing version 1.3.12 to 1.3.13
@@ -1,20 +0,13 @@ | ||
(function() { | ||
var i, text, code, codes = document.getElementsByTagName('code'); | ||
for (i = 0; i < codes.length;) { | ||
code = codes[i]; | ||
if (code.parentNode.tagName !== 'PRE' && code.childElementCount === 0) { | ||
text = code.textContent; | ||
if (/^\$[^$]/.test(text) && /[^$]\$$/.test(text)) { | ||
text = text.replace(/^\$/, '\\(').replace(/\$$/, '\\)'); | ||
code.textContent = text; | ||
} | ||
if (/^\\\((.|\s)+\\\)$/.test(text) || /^\\\[(.|\s)+\\\]$/.test(text) || | ||
/^\$(.|\s)+\$$/.test(text) || | ||
/^\\begin\{([^}]+)\}(.|\s)+\\end\{[^}]+\}$/.test(text)) { | ||
code.outerHTML = code.innerHTML; // remove <code></code> | ||
continue; | ||
} | ||
} | ||
i++; | ||
[...document.getElementsByTagName('code')].forEach(code => { | ||
if (code.parentNode.tagName === 'PRE' || code.childElementCount > 0) return; | ||
const text = code.textContent; | ||
if (/^\$[^$]/.test(text) && /[^$]\$$/.test(text)) { | ||
text = text.replace(/^\$/, '\\(').replace(/\$$/, '\\)'); | ||
code.textContent = text; | ||
} | ||
})(); | ||
if (/^\\\((.|\s)+\\\)$/.test(text) || /^\\\[(.|\s)+\\\]$/.test(text) || | ||
/^\$(.|\s)+\$$/.test(text) || | ||
/^\\begin\{([^}]+)\}(.|\s)+\\end\{[^}]+\}$/.test(text)) { | ||
code.outerHTML = code.innerHTML; // remove <code></code> | ||
} | ||
}); |
@@ -1,1 +0,1 @@ | ||
!function(){var e,t,n,$=document.getElementsByTagName("code");for(e=0;e<$.length;)"PRE"!==(n=$[e]).parentNode.tagName&&0===n.childElementCount&&(t=n.textContent,/^\$[^$]/.test(t)&&/[^$]\$$/.test(t)&&(t=t.replace(/^\$/,"\\(").replace(/\$$/,"\\)"),n.textContent=t),/^\\\((.|\s)+\\\)$/.test(t)||/^\\\[(.|\s)+\\\]$/.test(t)||/^\$(.|\s)+\$$/.test(t)||/^\\begin\{([^}]+)\}(.|\s)+\\end\{[^}]+\}$/.test(t))?n.outerHTML=n.innerHTML:e++}(); | ||
[...document.getElementsByTagName("code")].forEach((e=>{if("PRE"===e.parentNode.tagName||e.childElementCount>0)return;const t=e.textContent;/^\$[^$]/.test(t)&&/[^$]\$$/.test(t)&&(t=t.replace(/^\$/,"\\(").replace(/\$$/,"\\)"),e.textContent=t),(/^\\\((.|\s)+\\\)$/.test(t)||/^\\\[(.|\s)+\\\]$/.test(t)||/^\$(.|\s)+\$$/.test(t)||/^\\begin\{([^}]+)\}(.|\s)+\\end\{[^}]+\}$/.test(t))&&(e.outerHTML=e.innerHTML)})); |
{ | ||
"name": "@xiee/utils", | ||
"version": "1.3.12", | ||
"version": "1.3.13", | ||
"description": "Miscellaneous tools and utilities to manipulate HTML pages", | ||
@@ -5,0 +5,0 @@ "scripts": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
52456
813