@drghaliasri/butex 7.3.2 → 7.3.3

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.
@@ -3194,6 +3194,30 @@ function renderDivideOperatorLatex(side) {
3194
3194
  return side === "arabic" ? "\\backslash" : DIVIDE_OPERATOR_EN;
3195
3195
  }
3196
3196
 
3197
+ // src/editor/rawOperatorPresentation.ts
3198
+ var RTL_DIRECTIONAL_RAW_OPERATOR_SURFACE = {
3199
+ "<": ">",
3200
+ ">": "<"
3201
+ };
3202
+ function rawOperatorSurfaceExpr(expr, side) {
3203
+ if (isDivideOperatorExpr(expr)) {
3204
+ return divideOperatorSurfaceExpr(expr, side);
3205
+ }
3206
+ if (side === "arabic") {
3207
+ return RTL_DIRECTIONAL_RAW_OPERATOR_SURFACE[expr] ?? expr;
3208
+ }
3209
+ return expr;
3210
+ }
3211
+ function renderRawOperatorLatex(expr, side) {
3212
+ if (isDivideOperatorExpr(expr)) {
3213
+ return renderDivideOperatorLatex(side);
3214
+ }
3215
+ if (side === "arabic" && Object.prototype.hasOwnProperty.call(RTL_DIRECTIONAL_RAW_OPERATOR_SURFACE, expr)) {
3216
+ return `\\butexmirror{${expr}}`;
3217
+ }
3218
+ return expr;
3219
+ }
3220
+
3197
3221
  // src/editor/render.ts
3198
3222
  function selectedDigitForm(options) {
3199
3223
  return options?.digitForm ?? "western";
@@ -3353,8 +3377,8 @@ function renderNodeEnglish(node, options) {
3353
3377
  }
3354
3378
  return `${renderCharContent(node, options)}${latinScripts(node, options)}`;
3355
3379
  }
3356
- if (node.kind === "operator" && isDivideOperatorExpr(node.expr)) {
3357
- return `${renderDivideOperatorLatex("english")}${latinScripts(node, options)}`;
3380
+ if (node.kind === "operator") {
3381
+ return `${renderRawOperatorLatex(node.expr, "english")}${latinScripts(node, options)}`;
3358
3382
  }
3359
3383
  return `${formatDigits(node.expr, selectedDigitForm(options))}${latinScripts(node, options)}`;
3360
3384
  }
@@ -3414,8 +3438,8 @@ function renderNodeArabic(node, options) {
3414
3438
  }
3415
3439
  return arabicScripts(node, (node.characterFont ?? "default") === "default" ? `\\text{${escapeText(expr)}}` : content, options);
3416
3440
  }
3417
- if (node.kind === "operator" && isDivideOperatorExpr(node.expr)) {
3418
- return arabicScripts(node, renderDivideOperatorLatex("arabic"), options);
3441
+ if (node.kind === "operator") {
3442
+ return arabicScripts(node, renderRawOperatorLatex(node.expr, "arabic"), options);
3419
3443
  }
3420
3444
  return arabicScripts(node, formatDigits(node.expr, selectedDigitForm(options)), options);
3421
3445
  }
@@ -6109,7 +6133,7 @@ function buildBaseNodeBody(node, digitForm = "western", side = "english") {
6109
6133
  value.title = "\u0648\u062D\u062F\u0629 (unit)";
6110
6134
  }
6111
6135
  }
6112
- const surfaceExpr = node.kind === "operator" ? divideOperatorSurfaceExpr(node.expr, side) : node.expr;
6136
+ const surfaceExpr = node.kind === "operator" ? rawOperatorSurfaceExpr(node.expr, side) : node.expr;
6113
6137
  value.textContent = surfaceExpr === "" ? "\u25A1" : formatDigits(surfaceExpr, digitForm);
6114
6138
  return value;
6115
6139
  }