speechmarkdown / speechmarkdown-js

Speech Markdown grammar, parser, and formatters for use with JavaScript.
MIT License
76 stars 16 forks source link

Support both double and single quotes #48

Closed rmtuckerphx closed 1 year ago

rmtuckerphx commented 4 years ago

The audio tag supports both double and single quotes:

!['https://www.speechmarkdown.org/test.mp3']  // YES
!["https://www.speechmarkdown.org/test.mp3"]  // YES

But other tags such as emphasis, only support double quotes:

(text)[emphasis:"strong"]  // YES
(text)[emphasis:'strong']  // NO
johniwasz commented 4 years ago

I submitted a pull request that addresses this issue.

Including the single quote character in the ipa character set caused issues with parsing single-quoted strings. Removing the single quote character from single-quoted strings addresses the issue.

See update to SpeechMarkdownGrammar.ts

Also updated numerous voice, rate, and pitch tests to validate single quotes.

There is still an issue with using single quote characters in single-quoted IPA strings. For example:

I say, <phoneme alphabet="ipa" ph="'pi.kæn">pecan</phoneme>.   WORKS
I say, <phoneme alphabet='ipa' ph='\'pi.kæn'>pecan</phoneme>. DOES NOT WORK

However, the above sample didn't work previously.