diff --git a/twitter/widget.go b/twitter/widget.go index d93f70d9..1da55322 100644 --- a/twitter/widget.go +++ b/twitter/widget.go @@ -2,6 +2,7 @@ package twitter import ( "fmt" + "html" "regexp" "github.com/dustin/go-humanize" @@ -66,9 +67,12 @@ func (widget *Widget) displayName(tweet Tweet) string { return tweet.User.ScreenName } -func (widget *Widget) highlightText(text string) string { +func (widget *Widget) formatText(text string) string { result := text + // Convert HTML entities + result = html.UnescapeString(result) + // RT indicator rtRegExp := regexp.MustCompile(`^RT`) result = rtRegExp.ReplaceAllString(result, "[olive]${0}[white::-]") @@ -89,7 +93,7 @@ func (widget *Widget) highlightText(text string) string { } func (widget *Widget) format(tweet Tweet) string { - body := widget.highlightText(tweet.Text) + body := widget.formatText(tweet.Text) name := widget.displayName(tweet) var attribution string