From 3e61d09873065f5342efc414ee3ea0d5fdc4c767 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Thu, 9 Apr 2026 20:44:58 +0300 Subject: add snonux static microblog generator Full Go implementation with: - txt/md/image/audio input processing, URL auto-linking in .txt files - Paginated HTML output with Atom feed - 11 visual themes: neon, terminal, synthwave, minimal, brutalist, paper, aurora, matrix, ocean, retro, glass (selectable via --theme flag) - Keyboard navigation (j/k/arrows, Enter modal, h/l page nav) - Shared nav templates (navhints, navmodal, navscript) across all themes - Magefile build automation; integration test suite covering all themes Co-Authored-By: Claude Sonnet 4.6 --- internal/generator/themes.go | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 internal/generator/themes.go (limited to 'internal/generator/themes.go') diff --git a/internal/generator/themes.go b/internal/generator/themes.go new file mode 100644 index 0000000..8de6193 --- /dev/null +++ b/internal/generator/themes.go @@ -0,0 +1,44 @@ +package generator + +// themeRegistry maps theme names to their HTML template strings. +// Each template must use {{template "navhints" .}}, {{template "navmodal" .}}, +// and {{template "navscript" .}} — these are defined in shared.go (navDefs). +var themeRegistry = map[string]string{ + "neon": neonTemplate, + "terminal": terminalTemplate, + "synthwave": synthwaveTemplate, + "minimal": minimalTemplate, + "brutalist": brutalistTemplate, + "paper": paperTemplate, + "aurora": auroraTemplate, + "matrix": matrixTemplate, + "ocean": oceanTemplate, + "retro": retroTemplate, + "glass": glassTemplate, +} + +// getTheme returns the HTML template string for the given theme name. +// Falls back to the neon theme if the name is unknown. +func getTheme(name string) string { + if t, ok := themeRegistry[name]; ok { + return t + } + return neonTemplate +} + +// ListThemes returns a sorted list of all available theme names. +func ListThemes() []string { + names := make([]string, 0, len(themeRegistry)) + for k := range themeRegistry { + names = append(names, k) + } + // Sort for deterministic output in --help text. + for i := 0; i < len(names); i++ { + for j := i + 1; j < len(names); j++ { + if names[i] > names[j] { + names[i], names[j] = names[j], names[i] + } + } + } + return names +} -- cgit v1.2.3