Moved the changes to hackFix().

Changes seemed to better fit in the hackFix function than where I originally put them.  Also improved the comments I added to the code.
pull/5359/head
mblemberg 2019-07-31 00:52:32 -05:00 committed by GitHub
parent 908a9efc7b
commit 5a1a32d0ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -12,8 +12,7 @@ function renderSan(san: San) {
if (c == '@') return 'at';
const code = c.charCodeAt(0);
if (code > 48 && code < 58) return c; // 1-8
if (code == 99 || code == 102) return c; //uppercase C and F get pronounced as degrees Fahrenheit/Celsius
else if (code > 96 && code < 105) return c.toUpperCase();
if (code > 96 && code < 105) return c.toUpperCase();
return roles[c] || c;
}).join(' ');
if (san.includes('+')) move += ' check';
@ -26,6 +25,8 @@ function hackFix(msg: string): string {
return msg
.replace(/^A /, "A, ") // "A takes" & "A 3" are mispronounced
.replace(/(\d) E (\d)/, "$1,E $2"); // Strings such as 1E5 are treated as scientific notation
.replace(/^C /, "c ") // "uppercase C is pronounced as "degrees celsius" when it comes after a number (e.g. R8c3)
.replace(/^F /, "f ") // "uppercase C is pronounced as "degrees fahrenheit" when it comes after a number (e.g. R8f3)
}
export function say(text: string, cut: boolean) {