render.gno
0.65 Kb · 26 lines
1package gnotif
2
3import (
4 "strings"
5
6 "gno.land/p/nt/markdown/sanitize/v0"
7)
8
9// Render lists the triggers in declaration order.
10func Render(path string) string {
11 var b strings.Builder
12 b.WriteString("# gnotif triggers\n\n")
13 triggers.Iterate("", "", func(_ string, v any) bool {
14 tr := v.(*Trigger)
15 b.WriteString("- **" + tr.ID + "** " + sanitize.InlineText(tr.Target) + " · " + sanitize.InlineText(tr.Event))
16 if tr.Param != "" {
17 b.WriteString(" · param " + sanitize.InlineText(tr.Param))
18 }
19 if tr.Verified {
20 b.WriteString(" · ✓ verified")
21 }
22 b.WriteString(" · by " + tr.Declarer.String() + "\n")
23 return false
24 })
25 return b.String()
26}