Skip to content

Commit 7de6454

Browse files
committed
add tts parenthesis filter
1 parent b88e811 commit 7de6454

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

doc/description.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ English, Russian, Japanese, Chinese and so on
2121
# Change Log
2222
- 0.1.205
2323
- Add right mouse hold in pdf viewer now act as handtool (contributed by Witnull)
24+
- filter parenthesis text from tts (requested by Gobidobi)
2425
- 0.1.204
2526
- fix setting export
2627
- 0.1.203

src/util/text_util.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ export default class TextUtil {
6060
text=this.filterEmoji(text)
6161
text=this.filterHtmlTag(text)
6262
text=this.filterNonSoundText(text)
63+
text=this.filterParenthesis(text)
6364
return text
6465
}
6566
static filterNonSoundText(text){
@@ -77,7 +78,9 @@ export default class TextUtil {
7778
return word.replace(/([<>])/g, "");
7879
}
7980

80-
81+
static filterParenthesis(text){
82+
return text.replace(/\([^\)]*\)/g, "");
83+
}
8184

8285
static truncate(str, n) {
8386
return str.length > n ? str.slice(0, n - 1) + "..." : str;

0 commit comments

Comments
 (0)