1
0

add initial marp implementation with sample content and build configuration

This commit is contained in:
2025-09-13 18:13:22 +02:00
parent dcacc9b409
commit e5f219507f
10319 changed files with 1402023 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
import * as DomUtil from '../common/dom_util.js';
import { SemanticRole, SemanticType } from '../semantic_tree/semantic_meaning.js';
import { AbstractEnrichCase } from './abstract_enrich_case.js';
import { walkTree } from './enrich_mathml.js';
import { addMrow, setAttributes, Attribute } from './enrich_attr.js';
export class CaseBinomial extends AbstractEnrichCase {
static test(semantic) {
return (!semantic.mathmlTree &&
semantic.type === SemanticType.LINE &&
semantic.role === SemanticRole.BINOMIAL);
}
constructor(semantic) {
super(semantic);
this.mml = semantic.mathmlTree;
}
getMathml() {
if (!this.semantic.childNodes.length) {
return this.mml;
}
const child = this.semantic.childNodes[0];
this.mml = walkTree(child);
if (this.mml.hasAttribute(Attribute.TYPE)) {
const mrow = addMrow();
DomUtil.replaceNode(this.mml, mrow);
mrow.appendChild(this.mml);
this.mml = mrow;
}
setAttributes(this.mml, this.semantic);
return this.mml;
}
}