mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-10-31 05:35:35 +00:00
Support unqouted attributes in SSML parser
This commit is contained in:
@@ -135,10 +135,15 @@ static int attrcopy_utf8(char *buf, const wchar_t *pw, int len)
|
||||
int ix = 0;
|
||||
|
||||
if (pw != NULL) {
|
||||
wchar_t quote = pw[-1];
|
||||
if ((quote != '"') && (quote != '\'')) quote = 0;
|
||||
|
||||
unsigned int c;
|
||||
int prev_c = 0;
|
||||
while ((ix < (len-4)) && ((c = *pw++) != 0)) {
|
||||
if ((c == '"') && (prev_c != '\\'))
|
||||
if ((quote == 0) && (isspace(c) || (c == '/')))
|
||||
break;
|
||||
if ((quote != 0) && (c == quote) && (prev_c != '\\'))
|
||||
break; // " indicates end of attribute, unless preceded by backstroke
|
||||
|
||||
int n = utf8_out(c, &buf[ix]);
|
||||
@@ -299,8 +304,10 @@ static const wchar_t *GetSsmlAttribute(wchar_t *pw, const char *name)
|
||||
while (iswspace(*pw)) pw++;
|
||||
if ((*pw == '"') || (*pw == '\'')) // allow single-quotes ?
|
||||
return pw+1;
|
||||
else
|
||||
else if (iswspace(*pw) || (*pw == '/')) // end of attribute
|
||||
return empty;
|
||||
else
|
||||
return pw;
|
||||
}
|
||||
}
|
||||
pw++;
|
||||
|
||||
Reference in New Issue
Block a user