suite rule и suite list

- suite rule дописывает правило: номер берётся следующим за наибольшим, блоки
  раскладываются в порядке норма, ПОЧЕМУ, ПРИМЕРЫ, --after ставит правило рядом
  с тем, которое оно уточняет
- ступень называется категорией (requirement, prohibition, ...), а не словом
  языка, поэтому вызывающему не нужно знать, на каком языке записан набор
- suite list показывает темы со слоями, а с осью — что возьмёт компонент; отбор
  слоёв вынесен в suite.Assemble, откуда его возьмут проектные команды
- слои темы теперь всегда возвращаются базовым вперёд
This commit is contained in:
av
2026-07-27 11:36:19 +03:00
parent 5321fba89d
commit 8331aa1ca5
8 changed files with 706 additions and 6 deletions
+34
View File
@@ -50,6 +50,40 @@ func (l Level) String() string {
return "unknown level"
}
// levelNames are the language-neutral handles of the steps: the categories of
// the standard rather than the words of any one natural language. A caller
// naming a step says "requirement" and gets ДОЛЖЕН or MUST depending on the
// suite — which is what keeps an agent out of the business of knowing Russian.
var levelNames = []struct {
name string
level Level
}{
{"requirement", Requirement},
{"prohibition", Prohibition},
{"recommendation", Recommendation},
{"not-recommended", RecommendationAgainst},
{"permission", Permission},
}
// LevelByName resolves the handle of a step.
func LevelByName(name string) (Level, bool) {
for _, n := range levelNames {
if n.name == name {
return n.level, true
}
}
return 0, false
}
// LevelNames lists the handles in the order of the scale.
func LevelNames() []string {
out := make([]string, len(levelNames))
for i, n := range levelNames {
out[i] = n.name
}
return out
}
// Mark labels a block of a rule. Marks set no obligation, they only say what
// this is: a rationale, an illustration, a note about mechanization, a stub in
// place of a retired rule.