ed-mathml2tex 0.1.5 → 0.1.6

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.
@@ -936,6 +936,14 @@ function getRender(node) {
936
936
  return getRender_joinSeparator("@content")(node, childrenArray);
937
937
  }
938
938
 
939
+ if (firstOp === '[' && lastOp === ']') {
940
+ const innerContent = childrenArray
941
+ .slice(1, -1)
942
+ .map(child => parse(child))
943
+ .join('');
944
+ return `[${innerContent}]`;
945
+ }
946
+
939
947
  // Xử lý đặc biệt cho dấu ngoặc vuông chứa mtable
940
948
  if (firstOp === '[') {
941
949
  const innerContent = childrenArray
@@ -1087,6 +1095,12 @@ function getRender(node) {
1087
1095
  const over = parse(childrenArray[2]);
1088
1096
  const baseText = NodeTool.getNodeText(childrenArray[0]).trim();
1089
1097
 
1098
+ // Special handling for chemical reaction arrow
1099
+ if (baseText === '→' &&
1100
+ NodeTool.getNodeName(childrenArray[1]) === 'msup') {
1101
+ return `\\xrightarrow[${under}]{${over}}`;
1102
+ }
1103
+
1090
1104
  if (baseText === '∫') return `\\int_{${under}}^{${over}}`;
1091
1105
  if (baseText === '∑') return `\\sum_{${under}}^{${over}}`;
1092
1106
  if (baseText === '∏') return `\\prod_{${under}}^{${over}}`;
@@ -934,6 +934,14 @@ function getRender(node) {
934
934
  return getRender_joinSeparator("@content")(node, childrenArray);
935
935
  }
936
936
 
937
+ if (firstOp === '[' && lastOp === ']') {
938
+ const innerContent = childrenArray
939
+ .slice(1, -1)
940
+ .map(child => parse(child))
941
+ .join('');
942
+ return `[${innerContent}]`;
943
+ }
944
+
937
945
  // Xử lý đặc biệt cho dấu ngoặc vuông chứa mtable
938
946
  if (firstOp === '[') {
939
947
  const innerContent = childrenArray
@@ -1085,6 +1093,12 @@ function getRender(node) {
1085
1093
  const over = parse(childrenArray[2]);
1086
1094
  const baseText = NodeTool.getNodeText(childrenArray[0]).trim();
1087
1095
 
1096
+ // Special handling for chemical reaction arrow
1097
+ if (baseText === '→' &&
1098
+ NodeTool.getNodeName(childrenArray[1]) === 'msup') {
1099
+ return `\\xrightarrow[${under}]{${over}}`;
1100
+ }
1101
+
1088
1102
  if (baseText === '∫') return `\\int_{${under}}^{${over}}`;
1089
1103
  if (baseText === '∑') return `\\sum_{${under}}^{${over}}`;
1090
1104
  if (baseText === '∏') return `\\prod_{${under}}^{${over}}`;
@@ -940,6 +940,14 @@
940
940
  return getRender_joinSeparator("@content")(node, childrenArray);
941
941
  }
942
942
 
943
+ if (firstOp === '[' && lastOp === ']') {
944
+ const innerContent = childrenArray
945
+ .slice(1, -1)
946
+ .map(child => parse(child))
947
+ .join('');
948
+ return `[${innerContent}]`;
949
+ }
950
+
943
951
  // Xử lý đặc biệt cho dấu ngoặc vuông chứa mtable
944
952
  if (firstOp === '[') {
945
953
  const innerContent = childrenArray
@@ -1091,6 +1099,12 @@
1091
1099
  const over = parse(childrenArray[2]);
1092
1100
  const baseText = NodeTool.getNodeText(childrenArray[0]).trim();
1093
1101
 
1102
+ // Special handling for chemical reaction arrow
1103
+ if (baseText === '→' &&
1104
+ NodeTool.getNodeName(childrenArray[1]) === 'msup') {
1105
+ return `\\xrightarrow[${under}]{${over}}`;
1106
+ }
1107
+
1094
1108
  if (baseText === '∫') return `\\int_{${under}}^{${over}}`;
1095
1109
  if (baseText === '∑') return `\\sum_{${under}}^{${over}}`;
1096
1110
  if (baseText === '∏') return `\\prod_{${under}}^{${over}}`;
@@ -936,6 +936,14 @@ function getRender(node) {
936
936
  return getRender_joinSeparator("@content")(node, childrenArray);
937
937
  }
938
938
 
939
+ if (firstOp === '[' && lastOp === ']') {
940
+ const innerContent = childrenArray
941
+ .slice(1, -1)
942
+ .map(child => parse(child))
943
+ .join('');
944
+ return `[${innerContent}]`;
945
+ }
946
+
939
947
  // Xử lý đặc biệt cho dấu ngoặc vuông chứa mtable
940
948
  if (firstOp === '[') {
941
949
  const innerContent = childrenArray
@@ -1087,6 +1095,12 @@ function getRender(node) {
1087
1095
  const over = parse(childrenArray[2]);
1088
1096
  const baseText = NodeTool.getNodeText(childrenArray[0]).trim();
1089
1097
 
1098
+ // Special handling for chemical reaction arrow
1099
+ if (baseText === '→' &&
1100
+ NodeTool.getNodeName(childrenArray[1]) === 'msup') {
1101
+ return `\\xrightarrow[${under}]{${over}}`;
1102
+ }
1103
+
1090
1104
  if (baseText === '∫') return `\\int_{${under}}^{${over}}`;
1091
1105
  if (baseText === '∑') return `\\sum_{${under}}^{${over}}`;
1092
1106
  if (baseText === '∏') return `\\prod_{${under}}^{${over}}`;
@@ -934,6 +934,14 @@ function getRender(node) {
934
934
  return getRender_joinSeparator("@content")(node, childrenArray);
935
935
  }
936
936
 
937
+ if (firstOp === '[' && lastOp === ']') {
938
+ const innerContent = childrenArray
939
+ .slice(1, -1)
940
+ .map(child => parse(child))
941
+ .join('');
942
+ return `[${innerContent}]`;
943
+ }
944
+
937
945
  // Xử lý đặc biệt cho dấu ngoặc vuông chứa mtable
938
946
  if (firstOp === '[') {
939
947
  const innerContent = childrenArray
@@ -1085,6 +1093,12 @@ function getRender(node) {
1085
1093
  const over = parse(childrenArray[2]);
1086
1094
  const baseText = NodeTool.getNodeText(childrenArray[0]).trim();
1087
1095
 
1096
+ // Special handling for chemical reaction arrow
1097
+ if (baseText === '→' &&
1098
+ NodeTool.getNodeName(childrenArray[1]) === 'msup') {
1099
+ return `\\xrightarrow[${under}]{${over}}`;
1100
+ }
1101
+
1088
1102
  if (baseText === '∫') return `\\int_{${under}}^{${over}}`;
1089
1103
  if (baseText === '∑') return `\\sum_{${under}}^{${over}}`;
1090
1104
  if (baseText === '∏') return `\\prod_{${under}}^{${over}}`;
@@ -940,6 +940,14 @@
940
940
  return getRender_joinSeparator("@content")(node, childrenArray);
941
941
  }
942
942
 
943
+ if (firstOp === '[' && lastOp === ']') {
944
+ const innerContent = childrenArray
945
+ .slice(1, -1)
946
+ .map(child => parse(child))
947
+ .join('');
948
+ return `[${innerContent}]`;
949
+ }
950
+
943
951
  // Xử lý đặc biệt cho dấu ngoặc vuông chứa mtable
944
952
  if (firstOp === '[') {
945
953
  const innerContent = childrenArray
@@ -1091,6 +1099,12 @@
1091
1099
  const over = parse(childrenArray[2]);
1092
1100
  const baseText = NodeTool.getNodeText(childrenArray[0]).trim();
1093
1101
 
1102
+ // Special handling for chemical reaction arrow
1103
+ if (baseText === '→' &&
1104
+ NodeTool.getNodeName(childrenArray[1]) === 'msup') {
1105
+ return `\\xrightarrow[${under}]{${over}}`;
1106
+ }
1107
+
1094
1108
  if (baseText === '∫') return `\\int_{${under}}^{${over}}`;
1095
1109
  if (baseText === '∑') return `\\sum_{${under}}^{${over}}`;
1096
1110
  if (baseText === '∏') return `\\prod_{${under}}^{${over}}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ed-mathml2tex",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "Convert mathml to latex.",
5
5
  "author": "Mika",
6
6
  "license": "MIT",