Samples: screens, menus and strings in color with tags

logon, welcome and goodbye .asc (shown to plain terminals, Commodores,
and 3270s without a .3270) in color like bulletins.asc; goodbye.3270
with a second color; bbs.conf.sample's menus with tagged titles and
labels and its [strings] with tagged prompts.  A test reads the samples
and fails on a tag that is not one, so a typo shows in the tests rather
than as braces on a caller's screen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
This commit is contained in:
Claude committed 2026-10-13 22:08:30 +00:00
1 parent e9a600bab1
commit 4c787da415
7 files changed
+75 -23

No files matched your search

+14 -13
View File
@@ -495,34 +495,35 @@ address = 127.0.0.1:2513
; and tags ({yellow}, {bright}, {reset} ...: docs/wiki/Customization.md).
; screen = NAME shows that display file instead of the list of items
;[menu main]
;title = @BBS@
;title = {cyan}{bright}@BBS@{reset}
;screen = mainmenu
;m = areas Message areas
;e = mail E-mail (@NEWMAIL@ new)
;e = mail E-mail ({yellow}@NEWMAIL@{default} new)
;f = files File areas
;d = doors Doors
;c = chat Chat
;s = page Page the sysop
;w = who Who's online
;b = screen:bulletins Bulletins
;b = screen:bulletins {green}Bulletins{reset}
;x = menu:extras Extras
;g = logoff Goodbye
;g = logoff {red}Goodbye{reset}
;
;[menu extras]
;title = Extras
;prompt = "Extras> "
;title = {cyan}Extras{reset}
;prompt = "{cyan}Extras{default}> "
;u = users User list
;p = profile Your profile
;i = info System info
;t = terminal Your terminal (3270)
;q = back Back
; The prompts and messages, with @-codes:
; The prompts and messages, with @-codes and tags (on 3270s, and in the
; welcome, tags are dropped):
;[strings]
;name_prompt = "Name: "
;new_name_prompt = "Name (or NEW): "
;password_prompt = "Password: "
;command_prompt = "Command: "
;pause = "[Press a key]"
;logoff_confirm = "Log off?"
;name_prompt = "{cyan}Name:{default} "
;new_name_prompt = "{cyan}Name{default} (or NEW): "
;password_prompt = "{cyan}Password:{default} "
;command_prompt = "{yellow}@USER@{default} @ {cyan}@BBS@{default} > "
;pause = "{blue}[Press a key]{reset}"
;logoff_confirm = "{red}Log off?{reset}"
;welcome = "Welcome, @USER@."
+50
View File
@@ -0,0 +1,50 @@
package screens
import (
"os"
"path/filepath"
"regexp"
"strings"
"testing"
)
// TestSamples: every tag in the sample screens and in bbs.conf.sample's
// menus and strings is one (a typo would show its braces).
func TestSamples(t *testing.T) {
var texts []string
for _, pat := range []string{"*.asc", "*.3270"} {
files, _ := filepath.Glob(filepath.Join("..", "..", "screens.sample", pat))
for _, f := range files {
b, err := os.ReadFile(f)
if err != nil {
t.Fatal(err)
}
texts = append(texts, string(b))
}
}
conf, err := os.ReadFile(filepath.Join("..", "..", "bbs.conf.sample"))
if err != nil {
t.Fatal(err)
}
// the menus' and the strings' lines (other settings have {placeholders})
c := string(conf)
from, to := strings.Index(c, ";[menu main]"), strings.Index(c, ";welcome = ")
if from < 0 || to < from {
t.Fatal("no sample menus and strings in bbs.conf.sample")
}
setting := regexp.MustCompile(`^;[a-z_]+ = `)
for _, l := range strings.Split(c[from:to], "\n") {
if setting.MatchString(l) && strings.Contains(l, "{") {
texts = append(texts, l)
}
}
if len(texts) < 10 {
t.Fatalf("only %d texts found", len(texts))
}
any := func(string) (string, bool) { return "x", true }
for _, s := range texts {
if left := String(s, any); strings.ContainsAny(left, "{}") {
t.Errorf("an unknown tag in %q: %q", s, left)
}
}
}
+2 -1
View File
@@ -8,7 +8,8 @@ bbs.conf.sample uses mainmenu and bulletins.
Tags in a .asc ({clear}, {pause}, {red}, {on blue}, {bright}, {reset}...)
are ANSI on an ANSI terminal, colors on a Commodore and a 3270, and
nothing on a plain terminal: bulletins.asc has a few.
nothing on a plain terminal: every .asc here has some, as do the sample
menus and strings in bbs.conf.sample.
logon, newuser, welcome and goodbye are shown by themselves; others by
the menus that name them. See the wiki's Customization page.
+1 -1
View File
@@ -1 +1 @@
{turquoise}{bright}Thanks for calling @BBS@, @USER@. Come back soon!
{turquoise}{bright}Thanks for calling @BBS@, @USER@. {yellow}Come back soon!
+1 -1
View File
@@ -1,2 +1,2 @@
Thanks for calling @BBS@, @USER@. Come back soon!
{cyan}Thanks for calling {bright}@BBS@{normal}, @USER@.{default} {yellow}Come back soon!{reset}
+3 -3
View File
@@ -1,5 +1,5 @@
@BBS@
----------------------------------------
Node @NODE@, @VIA@. @ONLINE@ on now.
{cyan}{bright}@BBS@{reset}
{blue}----------------------------------------{reset}
Node {yellow}@NODE@{default}, @VIA@. {green}@ONLINE@{default} on now.
+4 -4
View File
@@ -1,4 +1,4 @@
Welcome back, @USER@.
Last call: @LASTON@ Calls: @CALLS@ Posts: @POSTS@
New mail: @NEWMAIL@
{clear}
{white}{bright}Welcome back, @USER@.{reset}
{cyan}Last call:{default} @LASTON@ {cyan}Calls:{default} @CALLS@ {cyan}Posts:{default} @POSTS@
{cyan}New mail:{default} {yellow}{bright}@NEWMAIL@{reset}