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,49 @@
import { AuditoryDescription } from '../audio/auditory_description.js';
import * as XpathUtil from '../common/xpath_util.js';
import { Engine } from '../common/engine.js';
export function nodeCounter(nodes, context) {
const localLength = nodes.length;
let localCounter = 0;
let localContext = context;
if (!context) {
localContext = '';
}
return function () {
if (localCounter < localLength) {
localCounter += 1;
}
return localContext + ' ' + localCounter;
};
}
export function pauseSeparator(_nodes, context) {
const numeral = parseFloat(context);
const value = isNaN(numeral) ? context : numeral;
return function () {
return [
AuditoryDescription.create({
text: '',
personality: { pause: value }
})
];
};
}
export function contentIterator(nodes, context) {
let contentNodes;
if (nodes.length > 0) {
contentNodes = XpathUtil.evalXPath('../../content/*', nodes[0]);
}
else {
contentNodes = [];
}
return function () {
const content = contentNodes.shift();
const contextDescr = context
? [AuditoryDescription.create({ text: context }, { translate: true })]
: [];
if (!content) {
return contextDescr;
}
const descrs = Engine.evaluateNode(content);
return contextDescr.concat(descrs);
};
}