mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-10-31 13:38:47 +00:00
code cleanup: move check for SSML comments and declarations to
ProcessSsmlTag()
Note the line in readclause.c:
if ((c2 == '/') || iswalpha(c2) || c2 == '!' || c2 == '?') {
It might be enough to pass everything to ProcessSsmlTag. What are the
cases that are skipped because of this?
This commit is contained in:
@@ -753,12 +753,7 @@ int ReadClause(Translator *tr, char *buf, short *charix, int *charix_top, int n_
|
||||
if ((c1 <= 0x20) && ((sayas_mode == SAYAS_SINGLE_CHARS) || (sayas_mode == SAYAS_KEY)))
|
||||
c1 += 0xe000; // move into unicode private usage area
|
||||
} else if ((c1 == '<') && (ssml_ignore_l_angle != '<')) {
|
||||
if ((c2 == '!') || (c2 == '?')) {
|
||||
// a comment, ignore until closing '<' (or <?xml tag )
|
||||
while (!Eof() && (c1 != '>'))
|
||||
c1 = GetC();
|
||||
c2 = ' ';
|
||||
} else if ((c2 == '/') || iswalpha(c2)) {
|
||||
if ((c2 == '/') || iswalpha(c2) || c2 == '!' || c2 == '?') {
|
||||
// check for space in the output buffer for embedded commands produced by the SSML tag
|
||||
if (ix > (n_buf - 20)) {
|
||||
// Perhaps not enough room, end the clause before the SSML tag
|
||||
|
||||
@@ -574,6 +574,11 @@ int ProcessSsmlTag(wchar_t *xml_buf, char *outbuf, int *outix, int n_outbuf, con
|
||||
PARAM_STACK *sp;
|
||||
SSML_STACK *ssml_sp;
|
||||
|
||||
// don't process comments and xml declarations
|
||||
if (wcsncmp(xml_buf, (wchar_t *) "!--", 3) == 0 || wcsncmp(xml_buf, (wchar_t *) "?xml", 4) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// these tags have no effect if they are self-closing, eg. <voice />
|
||||
static char ignore_if_self_closing[] = { 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0 };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user