acsi-core 0.9.4 → 0.9.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1681,24 +1681,25 @@ var LatexExtractor = /*#__PURE__*/function () {
1681
1681
  var latexPart = content.slice(firstPosition).trim();
1682
1682
  return textPart + (" $$" + latexPart + "$$");
1683
1683
  }
1684
+ return content.replace(foundLatexStr, "$$" + foundLatexStr + "$$");
1684
1685
  }
1685
- return content.replace(foundLatexStr, "$$" + foundLatexStr + "$$");
1686
+ return content;
1686
1687
  };
1687
1688
  return LatexExtractor;
1688
1689
  }();
1689
1690
  LatexExtractor.extractAllLatexUltimate = function (content) {
1690
1691
  var latexRegex = /(\\[a-zA-Z]+\s*\{[^}]*\}(?:\s*\{[^}]*\})*|\\[a-zA-Z]+|\\[a-zA-Z]+\s*[^\\\s\{]+|[a-zA-Z]+\^{[^}]*}|[a-zA-Z]+\_{[^}]*}|\$[^$]+\$|\\\([^)]+\\\)|\\\[[^\]]+\\\]|\\[a-zA-Z]+\d*|(?:\\[a-zA-Z]+\s*)+[^\\]*(?=\\\\|\.|$))/g;
1691
1692
  var matches = content.match(latexRegex) || [];
1692
- return matches.map(function (match) {
1693
- return match.trim();
1694
- }).filter(function (match) {
1693
+ return matches.filter(function (match) {
1695
1694
  return match.length > 1 && !match.match(/^[,\s\.]*$/) && (match.includes("\\") || match.includes("^{") || match.includes("_{") || match.includes("$") || !!match.match(/[a-zA-Z]\s*[=+\-*/]\s*[a-zA-Z0-9]/));
1696
1695
  });
1697
1696
  };
1698
1697
  LatexExtractor.extractMultiLineFormulas = function (content) {
1699
1698
  var formulas = content.split(/\\\\/);
1700
1699
  return formulas.map(function (formula) {
1701
- return formula.trim().replace(/\.$/, "");
1700
+ var cleaned = formula.trim();
1701
+ cleaned = cleaned.replace(/\.$/, "");
1702
+ return cleaned;
1702
1703
  }).filter(function (formula) {
1703
1704
  return formula.length > 0 && LatexExtractor.isMathFormula(formula);
1704
1705
  });