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,38 @@
import { SREError } from '../common/engine.js';
import * as AudioUtil from './audio_util.js';
import { MarkupRenderer } from './markup_renderer.js';
export class XmlRenderer extends MarkupRenderer {
markup(descrs) {
this.setScaleFunction(-2, 2, -100, 100, 2);
const markup = AudioUtil.personalityMarkup(descrs);
const result = [];
const currentOpen = [];
for (let i = 0, descr; (descr = markup[i]); i++) {
if (descr.span) {
result.push(this.merge(descr.span));
continue;
}
if (AudioUtil.isPauseElement(descr)) {
result.push(this.pause(descr));
continue;
}
if (descr.close.length) {
for (let j = 0; j < descr.close.length; j++) {
const last = currentOpen.pop();
if (descr.close.indexOf(last) === -1) {
throw new SREError('Unknown closing markup element: ' + last);
}
result.push(this.closeTag(last));
}
}
if (descr.open.length) {
const open = AudioUtil.sortClose(descr.open.slice(), markup.slice(i + 1));
open.forEach((o) => {
result.push(this.prosodyElement(o, descr[o]));
currentOpen.push(o);
});
}
}
return result.join(' ');
}
}