D1 Part 3 leftovers: remove 8 residual emoji + Python emoji gate
- The D0 grep gate false-negatived multibyte emoji on Windows (its zero was wrong). scripts/emoji_gate.py scans by Unicode codepoint; it found 8 survivors: backups.html (📁→file-text icon, 🔄 restore-info text), debug.html (🔄→'fut', 🔒→'titkosított'), deploy.html (📦→upload icon, ★ default-marker → '(alapértelmezett)'), storage.html (📦→upload icon, 📦 in the migrate-target option → plain text). All → sprite icons or plain words. - Gates: scripts/emoji_gate.py = 0; new Go TestNoEmojiInTemplates codepoint scan keeps it enforced (allowlist: ✓✗✔✘•●○■▶ monochrome text marks). go build/vet/test ./... green (18 pkgs).
This commit is contained in:
@@ -252,3 +252,41 @@ func TestStorageAgentDownNote(t *testing.T) {
|
||||
t.Error("enrichment JS lacks the warn-note error path")
|
||||
}
|
||||
}
|
||||
|
||||
// TestNoEmojiInTemplates (D1 §10, Group G): no emoji/pictographs in web templates. Go-side
|
||||
// codepoint scan (the D0 grep-based gate false-negatived multibyte emoji on Windows).
|
||||
func TestNoEmojiInTemplates(t *testing.T) {
|
||||
allow := map[rune]bool{}
|
||||
for _, r := range "✓✗✔✘•●○■▶" {
|
||||
allow[r] = true
|
||||
}
|
||||
isEmoji := func(r rune) bool {
|
||||
if allow[r] {
|
||||
return false
|
||||
}
|
||||
switch {
|
||||
case r >= 0x1F300 && r <= 0x1FAFF,
|
||||
r >= 0x2600 && r <= 0x26FF,
|
||||
r >= 0x2700 && r <= 0x27BF,
|
||||
r >= 0xFE00 && r <= 0xFE0F,
|
||||
r >= 0x1F1E6 && r <= 0x1F1FF:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
entries, _ := templateFS.ReadDir("templates")
|
||||
for _, e := range entries {
|
||||
if !strings.HasSuffix(e.Name(), ".html") {
|
||||
continue
|
||||
}
|
||||
b, err := templateFS.ReadFile("templates/" + e.Name())
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, r := range string(b) {
|
||||
if isEmoji(r) {
|
||||
t.Errorf("%s contains emoji %q (U+%04X)", e.Name(), r, r)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user