@drghaliasri/butex 4.1.0 → 4.3.0

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/document.mjs CHANGED
@@ -957,6 +957,16 @@ var ATOMIC_COMMANDS = {
957
957
  arabicLabel: "\u0645\u062D\u062F\u062F",
958
958
  title: "\u0645\u062D\u062F\u062F"
959
959
  },
960
+ ////////////////////// Derivatives ////////////////////////////////
961
+ ad: {
962
+ id: "ad",
963
+ category: "derivative",
964
+ englishTex: "\\mathrm{d}",
965
+ englishLabel: "d",
966
+ arabicTex: "\\ad",
967
+ arabicLabel: "\u0621",
968
+ title: "\u0639\u0644\u0627\u0645\u0629 \u0627\u0644\u0627\u0634\u062A\u0642\u0627\u0642"
969
+ },
960
970
  ////////////////////// Groups /////////////////////////////////
961
971
  N: {
962
972
  id: "N",
@@ -1548,6 +1558,16 @@ function atomicOperatorCommandSpec(id) {
1548
1558
  return Object.prototype.hasOwnProperty.call(ATOMIC_OPERATOR_COMMANDS, id) ? ATOMIC_OPERATOR_COMMANDS[id] : null;
1549
1559
  }
1550
1560
 
1561
+ // src/editor/divideOperator.ts
1562
+ var DIVIDE_OPERATOR_EN = "/";
1563
+ var DIVIDE_OPERATOR_AR = "\\";
1564
+ function isDivideOperatorExpr(expr) {
1565
+ return expr === DIVIDE_OPERATOR_EN || expr === DIVIDE_OPERATOR_AR;
1566
+ }
1567
+ function renderDivideOperatorLatex(side) {
1568
+ return side === "arabic" ? "\\backslash" : DIVIDE_OPERATOR_EN;
1569
+ }
1570
+
1551
1571
  // src/editor/digits.ts
1552
1572
  var WESTERN = "0123456789";
1553
1573
  var ARABIC_INDIC = "\u0660\u0661\u0662\u0663\u0664\u0665\u0666\u0667\u0668\u0669";
@@ -1670,6 +1690,9 @@ function renderNodeArabic(node, options) {
1670
1690
  const content = renderCharContent(node, options);
1671
1691
  return arabicScripts(node, (node.characterFont ?? "default") === "default" ? `\\text{${escapeText(expr)}}` : content, options);
1672
1692
  }
1693
+ if (node.kind === "operator" && isDivideOperatorExpr(node.expr)) {
1694
+ return arabicScripts(node, renderDivideOperatorLatex("arabic"), options);
1695
+ }
1673
1696
  return arabicScripts(node, formatDigits(node.expr, selectedDigitForm(options)), options);
1674
1697
  }
1675
1698
  function renderChainArabic(chain, options) {
@@ -2241,6 +2264,19 @@ ${ATOMIC_OPERATOR_COMMAND_CSS}
2241
2264
  `.trim();
2242
2265
 
2243
2266
  // src/document/mathEditorAdapter.ts
2267
+ var CHAR_FONT_EXPORT_TEX = {
2268
+ takween: "\\butextakween",
2269
+ diwani: "\\butexdiwani",
2270
+ diwaniOutline: "\\butexdiwanioutline"
2271
+ };
2272
+ function charEditorNodeToAstNode(node) {
2273
+ const font = node.characterFont ?? "default";
2274
+ const charNode = new CharNode(node.expr);
2275
+ if (font === "default") {
2276
+ return charNode;
2277
+ }
2278
+ return new CommandNode(CHAR_FONT_EXPORT_TEX[font], [], [new ChainNode([charNode])]);
2279
+ }
2244
2280
  function attachAstScripts(editorNode, astNode) {
2245
2281
  if (editorNode.superscript) {
2246
2282
  const sup = editorChainToAstChain(editorNode.superscript);
@@ -2296,7 +2332,7 @@ function editorEnvToAstNode(node) {
2296
2332
  function editorNodeToAstNode(node) {
2297
2333
  let astNode;
2298
2334
  if (node.kind === "char") {
2299
- astNode = new CharNode(node.expr);
2335
+ astNode = charEditorNodeToAstNode(node);
2300
2336
  } else if (node.kind === "number") {
2301
2337
  astNode = new NumberNode(node.expr);
2302
2338
  } else if (node.kind === "operator") {