From a887bb657eee2fbf7c59ceaefd451604d960bb1f Mon Sep 17 00:00:00 2001 From: knoxfighter Date: Mon, 15 Jun 2020 00:02:20 +0200 Subject: [PATCH] fixed crash when dashed syllable contains space --- word.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/word.go b/word.go index a6d114e..75e35a9 100644 --- a/word.go +++ b/word.go @@ -281,7 +281,9 @@ func (w *Word) doUnderline(markdown bool) (string, error) { shUnderlineA := "\033[4m" shUnderlineB := "\033[0m" dashed := w.Syllables - dSlice := strings.Split(dashed, "-") + dSlice := strings.FieldsFunc(dashed, func(r rune) bool { + return r == '-' || r == ' ' + }) stressedIndex, err := strconv.Atoi(w.Stressed) if err != nil {