TTS: add starting/resuming speaking from mark/range

Also:
- Fix `ssml:alphabet` attribute being ignored when set on root
- Convert `<br>` to `<break>`
This commit is contained in:
John Factotum
2023-09-28 02:02:56 +08:00
parent 403882e66d
commit fdec0b2037
2 changed files with 39 additions and 5 deletions
+5 -1
View File
@@ -64,6 +64,8 @@ export const toSSML = doc => {
el.setAttribute('name', node.dataset.name)
}
else if (ps.includes(nodeName)) el = ssml.createElementNS(NS.SSML, 'p')
else if (nodeName === 'br')
el = ssml.createElementNS(NS.SSML, 'break')
else if (nodeName === 'em' || nodeName === 'strong')
el = ssml.createElementNS(NS.SSML, 'emphasis')
@@ -93,5 +95,7 @@ export const toSSML = doc => {
}
return el
}
return convert(doc.body, ssml.documentElement)
convert(doc.body, ssml.documentElement,
doc.documentElement.getAttributeNS(NS.SSML, 'alphabet'))
return ssml
}