Browse Source

Convert newlines to <br> in whatsapp->matrix formatted messages

Tulir Asokan 6 năm trước cách đây
mục cha
commit
7f0a0df7de
1 tập tin đã thay đổi với 1 bổ sung0 xóa
  1. 1 0
      formatting.go

+ 1 - 0
formatting.go

@@ -126,6 +126,7 @@ func (formatter *Formatter) ParseWhatsApp(content *mautrix.Content) {
 		output = regex.ReplaceAllStringFunc(output, replacer)
 		output = regex.ReplaceAllStringFunc(output, replacer)
 	}
 	}
 	if output != content.Body {
 	if output != content.Body {
+		output = strings.Replace(output, "\n", "<br/>", -1)
 		content.FormattedBody = output
 		content.FormattedBody = output
 		content.Format = mautrix.FormatHTML
 		content.Format = mautrix.FormatHTML
 		for regex, replacer := range formatter.waReplFuncText {
 		for regex, replacer := range formatter.waReplFuncText {