// mautrix-telegram - A Matrix-Telegram puppeting bridge.
// Copyright (C) 2024 Sumner Evans
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see %s", message)
case StyleCode:
if strings.ContainsRune(message, '\n') {
// This is somewhat incorrect, as it won't allow inline text before/after a multiline monospace-formatted string.
return fmt.Sprintf("
%s", message)
}
return fmt.Sprintf("%s", message)
case StyleUnderline:
return fmt.Sprintf("%s", message)
case StyleBlockquote:
return fmt.Sprintf("%s", message) case StylePre: if s.Language != "" { return fmt.Sprintf("
%s", s.Language, message)
} else {
return fmt.Sprintf("%s", message)
}
case StyleEmail:
return fmt.Sprintf(`%s`, message, message)
case StyleTextURL:
if strings.HasPrefix(s.URL, "https://matrix.to/#") {
return s.URL
}
return fmt.Sprintf(`%s`, s.URL, message)
case StyleURL:
if strings.HasPrefix(s.URL, "https://matrix.to/#") {
return s.URL
}
return fmt.Sprintf(`%s`, s.URL, message)
case StyleCustomEmoji:
if s.EmojiInfo.Emoji != "" {
return s.EmojiInfo.Emoji
} else if s.EmojiInfo.EmojiURI != "" {
return fmt.Sprintf(
`