dwml-ts 0.5.0 → 0.5.1
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.cjs +13 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +13 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2102,7 +2102,9 @@ const DIRECT_TAGS = new Set([
|
|
|
2102
2102
|
'num',
|
|
2103
2103
|
'den',
|
|
2104
2104
|
'deg',
|
|
2105
|
-
'e'
|
|
2105
|
+
'e',
|
|
2106
|
+
'oMath',
|
|
2107
|
+
'oMathPara'
|
|
2106
2108
|
]);
|
|
2107
2109
|
class Converter {
|
|
2108
2110
|
convert(node) {
|
|
@@ -2426,7 +2428,17 @@ class Converter {
|
|
|
2426
2428
|
}
|
|
2427
2429
|
const SUB_TEMPLATE = '_{{{0}}}';
|
|
2428
2430
|
const SUP_TEMPLATE = '^{{{0}}}';
|
|
2431
|
+
function findLocal(node, name, acc = []) {
|
|
2432
|
+
if (localName(node.tagName) === name) acc.push(node);
|
|
2433
|
+
for (const child of node.children)if ('string' != typeof child) findLocal(child, name, acc);
|
|
2434
|
+
return acc;
|
|
2435
|
+
}
|
|
2429
2436
|
function ommlNodeToLatex(node, options = {}) {
|
|
2437
|
+
const name = localName(node.tagName);
|
|
2438
|
+
if ('oMathPara' === name || 'm' === name) {
|
|
2439
|
+
const found = findLocal(node, 'oMath');
|
|
2440
|
+
if (found.length) return found.map((omath)=>new Converter(options).convert(omath)).join('').trim();
|
|
2441
|
+
}
|
|
2430
2442
|
return new Converter(options).convert(node);
|
|
2431
2443
|
}
|
|
2432
2444
|
function findAll(nodes, name, acc = []) {
|