@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.
@@ -3157,6 +3157,30 @@ function renderDivideOperatorLatex(side) {
3157
3157
  return side === "arabic" ? "\\backslash" : DIVIDE_OPERATOR_EN;
3158
3158
  }
3159
3159
 
3160
+ // src/editor/rawOperatorPresentation.ts
3161
+ var RTL_DIRECTIONAL_RAW_OPERATOR_SURFACE = {
3162
+ "<": ">",
3163
+ ">": "<"
3164
+ };
3165
+ function rawOperatorSurfaceExpr(expr, side) {
3166
+ if (isDivideOperatorExpr(expr)) {
3167
+ return divideOperatorSurfaceExpr(expr, side);
3168
+ }
3169
+ if (side === "arabic") {
3170
+ return RTL_DIRECTIONAL_RAW_OPERATOR_SURFACE[expr] ?? expr;
3171
+ }
3172
+ return expr;
3173
+ }
3174
+ function renderRawOperatorLatex(expr, side) {
3175
+ if (isDivideOperatorExpr(expr)) {
3176
+ return renderDivideOperatorLatex(side);
3177
+ }
3178
+ if (side === "arabic" && Object.prototype.hasOwnProperty.call(RTL_DIRECTIONAL_RAW_OPERATOR_SURFACE, expr)) {
3179
+ return `\\butexmirror{${expr}}`;
3180
+ }
3181
+ return expr;
3182
+ }
3183
+
3160
3184
  // src/editor/render.ts
3161
3185
  function selectedDigitForm(options) {
3162
3186
  return options?.digitForm ?? "western";
@@ -3316,8 +3340,8 @@ function renderNodeEnglish(node, options) {
3316
3340
  }
3317
3341
  return `${renderCharContent(node, options)}${latinScripts(node, options)}`;
3318
3342
  }
3319
- if (node.kind === "operator" && isDivideOperatorExpr(node.expr)) {
3320
- return `${renderDivideOperatorLatex("english")}${latinScripts(node, options)}`;
3343
+ if (node.kind === "operator") {
3344
+ return `${renderRawOperatorLatex(node.expr, "english")}${latinScripts(node, options)}`;
3321
3345
  }
3322
3346
  return `${formatDigits(node.expr, selectedDigitForm(options))}${latinScripts(node, options)}`;
3323
3347
  }
@@ -3377,8 +3401,8 @@ function renderNodeArabic(node, options) {
3377
3401
  }
3378
3402
  return arabicScripts(node, (node.characterFont ?? "default") === "default" ? `\\text{${escapeText(expr)}}` : content, options);
3379
3403
  }
3380
- if (node.kind === "operator" && isDivideOperatorExpr(node.expr)) {
3381
- return arabicScripts(node, renderDivideOperatorLatex("arabic"), options);
3404
+ if (node.kind === "operator") {
3405
+ return arabicScripts(node, renderRawOperatorLatex(node.expr, "arabic"), options);
3382
3406
  }
3383
3407
  return arabicScripts(node, formatDigits(node.expr, selectedDigitForm(options)), options);
3384
3408
  }
@@ -6072,7 +6096,7 @@ function buildBaseNodeBody(node, digitForm = "western", side = "english") {
6072
6096
  value.title = "\u0648\u062D\u062F\u0629 (unit)";
6073
6097
  }
6074
6098
  }
6075
- const surfaceExpr = node.kind === "operator" ? divideOperatorSurfaceExpr(node.expr, side) : node.expr;
6099
+ const surfaceExpr = node.kind === "operator" ? rawOperatorSurfaceExpr(node.expr, side) : node.expr;
6076
6100
  value.textContent = surfaceExpr === "" ? "\u25A1" : formatDigits(surfaceExpr, digitForm);
6077
6101
  return value;
6078
6102
  }