update README and hardcode poll options to 20

This commit is contained in:
localhost_frssoft 2023-11-10 18:00:13 +03:00
parent 8dcd6cfdd7
commit 4c0c1c40a8
7 changed files with 76 additions and 2 deletions

View file

@ -7,6 +7,7 @@ import (
"strconv"
"strings"
"time"
"fmt"
"bloat/mastodon"
)
@ -67,6 +68,14 @@ func emojiFilter(content string, emojis []mastodon.Emoji) string {
return strings.NewReplacer(replacements...).Replace(content)
}
func generatePollOptions() string {
var pollbuilder string
for i := 0; i < 20; i++ {
pollbuilder = pollbuilder + `<div><input id="` + fmt.Sprintf("poll-option-%d", i) + `" name="` + fmt.Sprintf("poll-option-%d", i) + `"></div>`
}
return pollbuilder
}
var quoteRE = regexp.MustCompile("(?mU)(^|> *|\n)(&gt;.*)(<br|$)")
func statusContentFilter(content string, emojis []mastodon.Emoji, mentions []mastodon.Mention) string {
@ -158,6 +167,7 @@ func NewRenderer(templateGlobPattern string) (r *renderer, err error) {
t, err = t.Funcs(template.FuncMap{
"EmojiFilter": emojiFilter,
"Allowed_emoji_page": allowed_emoji_page,
"GeneratePollOptions": generatePollOptions,
"StatusContentFilter": statusContentFilter,
"DisplayInteractionCount": displayInteractionCount,
"TimeSince": timeSince,