@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.js CHANGED
@@ -3576,6 +3576,30 @@ function renderDivideOperatorLatex(side) {
3576
3576
  return side === "arabic" ? "\\backslash" : DIVIDE_OPERATOR_EN;
3577
3577
  }
3578
3578
 
3579
+ // src/editor/rawOperatorPresentation.ts
3580
+ var RTL_DIRECTIONAL_RAW_OPERATOR_SURFACE = {
3581
+ "<": ">",
3582
+ ">": "<"
3583
+ };
3584
+ function rawOperatorSurfaceExpr(expr, side) {
3585
+ if (isDivideOperatorExpr(expr)) {
3586
+ return divideOperatorSurfaceExpr(expr, side);
3587
+ }
3588
+ if (side === "arabic") {
3589
+ return RTL_DIRECTIONAL_RAW_OPERATOR_SURFACE[expr] ?? expr;
3590
+ }
3591
+ return expr;
3592
+ }
3593
+ function renderRawOperatorLatex(expr, side) {
3594
+ if (isDivideOperatorExpr(expr)) {
3595
+ return renderDivideOperatorLatex(side);
3596
+ }
3597
+ if (side === "arabic" && Object.prototype.hasOwnProperty.call(RTL_DIRECTIONAL_RAW_OPERATOR_SURFACE, expr)) {
3598
+ return `\\butexmirror{${expr}}`;
3599
+ }
3600
+ return expr;
3601
+ }
3602
+
3579
3603
  // src/editor/digits.ts
3580
3604
  var WESTERN = "0123456789";
3581
3605
  var ARABIC_INDIC = "\u0660\u0661\u0662\u0663\u0664\u0665\u0666\u0667\u0668\u0669";
@@ -3711,7 +3735,7 @@ function renderCharContent(node, options) {
3711
3735
  }
3712
3736
  function renderNodeEnglish(node, options) {
3713
3737
  if (node.kind === "delimiter" && node.innerExpr) {
3714
- return `${node.leftDelimExpr}${renderChainEnglish(node.innerExpr, options)}${node.rightDelimExpr}${latinScripts(node, options)}`;
3738
+ return `${node.leftDelimExpr} ${renderChainEnglish(node.innerExpr, options)}${node.rightDelimExpr}${latinScripts(node, options)}`;
3715
3739
  }
3716
3740
  if (node.kind === "boxed" && node.innerExpr) {
3717
3741
  const body = `\\boxed{${renderChainEnglish(node.innerExpr, options)}}`;
@@ -3763,8 +3787,8 @@ function renderNodeEnglish(node, options) {
3763
3787
  }
3764
3788
  return `${renderCharContent(node, options)}${latinScripts(node, options)}`;
3765
3789
  }
3766
- if (node.kind === "operator" && isDivideOperatorExpr(node.expr)) {
3767
- return `${renderDivideOperatorLatex("english")}${latinScripts(node, options)}`;
3790
+ if (node.kind === "operator") {
3791
+ return `${renderRawOperatorLatex(node.expr, "english")}${latinScripts(node, options)}`;
3768
3792
  }
3769
3793
  return `${formatDigits(node.expr, selectedDigitForm(options))}${latinScripts(node, options)}`;
3770
3794
  }
@@ -3824,8 +3848,8 @@ function renderNodeArabic(node, options) {
3824
3848
  }
3825
3849
  return arabicScripts(node, (node.characterFont ?? "default") === "default" ? `\\text{${escapeText(expr)}}` : content, options);
3826
3850
  }
3827
- if (node.kind === "operator" && isDivideOperatorExpr(node.expr)) {
3828
- return arabicScripts(node, renderDivideOperatorLatex("arabic"), options);
3851
+ if (node.kind === "operator") {
3852
+ return arabicScripts(node, renderRawOperatorLatex(node.expr, "arabic"), options);
3829
3853
  }
3830
3854
  return arabicScripts(node, formatDigits(node.expr, selectedDigitForm(options)), options);
3831
3855
  }
@@ -6164,7 +6188,7 @@ function buildBaseNodeBody(node, digitForm = "western", side = "english") {
6164
6188
  value.title = "\u0648\u062D\u062F\u0629 (unit)";
6165
6189
  }
6166
6190
  }
6167
- const surfaceExpr = node.kind === "operator" ? divideOperatorSurfaceExpr(node.expr, side) : node.expr;
6191
+ const surfaceExpr = node.kind === "operator" ? rawOperatorSurfaceExpr(node.expr, side) : node.expr;
6168
6192
  value.textContent = surfaceExpr === "" ? "\u25A1" : formatDigits(surfaceExpr, digitForm);
6169
6193
  return value;
6170
6194
  }