@drghaliasri/butex 7.3.2 → 7.3.4

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.mjs CHANGED
@@ -3534,6 +3534,30 @@ function renderDivideOperatorLatex(side) {
3534
3534
  return side === "arabic" ? "\\backslash" : DIVIDE_OPERATOR_EN;
3535
3535
  }
3536
3536
 
3537
+ // src/editor/rawOperatorPresentation.ts
3538
+ var RTL_DIRECTIONAL_RAW_OPERATOR_SURFACE = {
3539
+ "<": ">",
3540
+ ">": "<"
3541
+ };
3542
+ function rawOperatorSurfaceExpr(expr, side) {
3543
+ if (isDivideOperatorExpr(expr)) {
3544
+ return divideOperatorSurfaceExpr(expr, side);
3545
+ }
3546
+ if (side === "arabic") {
3547
+ return RTL_DIRECTIONAL_RAW_OPERATOR_SURFACE[expr] ?? expr;
3548
+ }
3549
+ return expr;
3550
+ }
3551
+ function renderRawOperatorLatex(expr, side) {
3552
+ if (isDivideOperatorExpr(expr)) {
3553
+ return renderDivideOperatorLatex(side);
3554
+ }
3555
+ if (side === "arabic" && Object.prototype.hasOwnProperty.call(RTL_DIRECTIONAL_RAW_OPERATOR_SURFACE, expr)) {
3556
+ return `\\butexmirror{${expr}}`;
3557
+ }
3558
+ return expr;
3559
+ }
3560
+
3537
3561
  // src/editor/digits.ts
3538
3562
  var WESTERN = "0123456789";
3539
3563
  var ARABIC_INDIC = "\u0660\u0661\u0662\u0663\u0664\u0665\u0666\u0667\u0668\u0669";
@@ -3669,7 +3693,7 @@ function renderCharContent(node, options) {
3669
3693
  }
3670
3694
  function renderNodeEnglish(node, options) {
3671
3695
  if (node.kind === "delimiter" && node.innerExpr) {
3672
- return `${node.leftDelimExpr}${renderChainEnglish(node.innerExpr, options)}${node.rightDelimExpr}${latinScripts(node, options)}`;
3696
+ return `${node.leftDelimExpr} ${renderChainEnglish(node.innerExpr, options)}${node.rightDelimExpr}${latinScripts(node, options)}`;
3673
3697
  }
3674
3698
  if (node.kind === "boxed" && node.innerExpr) {
3675
3699
  const body = `\\boxed{${renderChainEnglish(node.innerExpr, options)}}`;
@@ -3721,8 +3745,8 @@ function renderNodeEnglish(node, options) {
3721
3745
  }
3722
3746
  return `${renderCharContent(node, options)}${latinScripts(node, options)}`;
3723
3747
  }
3724
- if (node.kind === "operator" && isDivideOperatorExpr(node.expr)) {
3725
- return `${renderDivideOperatorLatex("english")}${latinScripts(node, options)}`;
3748
+ if (node.kind === "operator") {
3749
+ return `${renderRawOperatorLatex(node.expr, "english")}${latinScripts(node, options)}`;
3726
3750
  }
3727
3751
  return `${formatDigits(node.expr, selectedDigitForm(options))}${latinScripts(node, options)}`;
3728
3752
  }
@@ -3782,8 +3806,8 @@ function renderNodeArabic(node, options) {
3782
3806
  }
3783
3807
  return arabicScripts(node, (node.characterFont ?? "default") === "default" ? `\\text{${escapeText(expr)}}` : content, options);
3784
3808
  }
3785
- if (node.kind === "operator" && isDivideOperatorExpr(node.expr)) {
3786
- return arabicScripts(node, renderDivideOperatorLatex("arabic"), options);
3809
+ if (node.kind === "operator") {
3810
+ return arabicScripts(node, renderRawOperatorLatex(node.expr, "arabic"), options);
3787
3811
  }
3788
3812
  return arabicScripts(node, formatDigits(node.expr, selectedDigitForm(options)), options);
3789
3813
  }
@@ -6122,7 +6146,7 @@ function buildBaseNodeBody(node, digitForm = "western", side = "english") {
6122
6146
  value.title = "\u0648\u062D\u062F\u0629 (unit)";
6123
6147
  }
6124
6148
  }
6125
- const surfaceExpr = node.kind === "operator" ? divideOperatorSurfaceExpr(node.expr, side) : node.expr;
6149
+ const surfaceExpr = node.kind === "operator" ? rawOperatorSurfaceExpr(node.expr, side) : node.expr;
6126
6150
  value.textContent = surfaceExpr === "" ? "\u25A1" : formatDigits(surfaceExpr, digitForm);
6127
6151
  return value;
6128
6152
  }