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
+10 -1
View File
@@ -153,7 +153,10 @@ func (s *Suite) Conventions() []*doc.Document {
}
// Layers lists the layers of a topic — the documents that declared that name in
// their front matter.
// their front matter — in the order a copy carries them: base, then language,
// then stack. Documents are loaded in the order of their prefixes, which says
// nothing about layers, and a listing that opens with a language layer reads as
// if the base one were missing.
func (s *Suite) Layers(topic string) []*doc.Document {
var out []*doc.Document
for _, d := range s.Docs {
@@ -161,6 +164,12 @@ func (s *Suite) Layers(topic string) []*doc.Document {
out = append(out, d)
}
}
sort.Slice(out, func(i, j int) bool {
if rank(out[i]) != rank(out[j]) {
return rank(out[i]) < rank(out[j])
}
return out[i].Path < out[j].Path
})
return out
}