mirror of
https://git.phreedom.club/localhost_frssoft/bloat.git
synced 2024-11-22 12:01:27 +00:00
Highlight quotes
This commit is contained in:
parent
fcb88c8a85
commit
b8bab6fcf3
|
@ -3,6 +3,7 @@ package renderer
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"regexp"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"text/template"
|
"text/template"
|
||||||
|
@ -49,6 +50,8 @@ func emojiFilter(content string, emojis []mastodon.Emoji) string {
|
||||||
return strings.NewReplacer(replacements...).Replace(content)
|
return strings.NewReplacer(replacements...).Replace(content)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var quoteRE = regexp.MustCompile("(?mU)(^|> *|\n)(>.*)(<br|$)")
|
||||||
|
|
||||||
func statusContentFilter(spoiler string, content string,
|
func statusContentFilter(spoiler string, content string,
|
||||||
emojis []mastodon.Emoji, mentions []mastodon.Mention) string {
|
emojis []mastodon.Emoji, mentions []mastodon.Mention) string {
|
||||||
|
|
||||||
|
@ -57,6 +60,7 @@ func statusContentFilter(spoiler string, content string,
|
||||||
if len(spoiler) > 0 {
|
if len(spoiler) > 0 {
|
||||||
content = spoiler + "<br />" + content
|
content = spoiler + "<br />" + content
|
||||||
}
|
}
|
||||||
|
content = quoteRE.ReplaceAllString(content, "$1<span class=\"quote\">$2</span>$3")
|
||||||
for _, e := range emojis {
|
for _, e := range emojis {
|
||||||
r = fmt.Sprintf("<img class=\"emoji\" src=\"%s\" alt=\":%s:\" title=\":%s:\" height=\"32\" />",
|
r = fmt.Sprintf("<img class=\"emoji\" src=\"%s\" alt=\":%s:\" title=\":%s:\" height=\"32\" />",
|
||||||
e.URL, e.ShortCode, e.ShortCode)
|
e.URL, e.ShortCode, e.ShortCode)
|
||||||
|
|
|
@ -575,6 +575,10 @@ kbd {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.quote {
|
||||||
|
color: #789922;
|
||||||
|
}
|
||||||
|
|
||||||
.dark {
|
.dark {
|
||||||
background-color: #222222;
|
background-color: #222222;
|
||||||
background-image: none;
|
background-image: none;
|
||||||
|
|
Loading…
Reference in a new issue