Skip to content

Commit 30b330d

Browse files
committed
Link to sigs from WG readmes
1 parent 98da7b8 commit 30b330d

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

generator/app.go

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,19 +163,29 @@ type Group struct {
163163
Name string
164164
MissionStatement FoldedString `yaml:"mission_statement,omitempty"`
165165
CharterLink string `yaml:"charter_link,omitempty"`
166-
StakeholderSIGs []string `yaml:"stakeholder_sigs,omitempty"`
166+
StakeholderSIGs []SIGName `yaml:"stakeholder_sigs,omitempty"`
167167
Label string
168168
Leadership LeadershipGroup `yaml:"leadership"`
169169
Meetings []Meeting
170170
Contact Contact
171171
Subprojects []Subproject `yaml:",omitempty"`
172172
}
173173

174+
type SIGName string
175+
176+
func (n SIGName) DirName() string {
177+
return DirName("sig", string(n))
178+
}
179+
174180
// DirName returns the directory that a group's documentation will be
175181
// generated into. It is composed of a prefix (sig for SIGs and wg for WGs),
176182
// and a formatted version of the group's name (in kebab case).
177183
func (g *Group) DirName(prefix string) string {
178-
return fmt.Sprintf("%s-%s", prefix, strings.ToLower(strings.Replace(g.Name, " ", "-", -1)))
184+
return DirName(prefix, g.Name)
185+
}
186+
187+
func DirName(prefix, name string) string {
188+
return fmt.Sprintf("%s-%s", prefix, strings.ToLower(strings.Replace(name, " ", "-", -1)))
179189
}
180190

181191
// LabelName returns the expected label for a given group
@@ -217,7 +227,9 @@ func (c *Context) Sort() {
217227
return groups[i].Dir < groups[j].Dir
218228
})
219229
for _, group := range groups {
220-
sort.Strings(group.StakeholderSIGs)
230+
sort.Slice(group.StakeholderSIGs, func(i, j int) bool {
231+
return group.StakeholderSIGs[i] < group.StakeholderSIGs[j]
232+
})
221233
for _, people := range [][]Person{
222234
group.Leadership.Chairs,
223235
group.Leadership.TechnicalLeads,
@@ -285,7 +297,7 @@ func (c *Context) Validate() []error {
285297
if len(group.StakeholderSIGs) != 0 {
286298
if prefix == "wg" {
287299
for _, name := range group.StakeholderSIGs {
288-
if index(c.Sigs, func(g Group) bool { return g.Name == name }) == -1 {
300+
if index(c.Sigs, func(g Group) bool { return g.Name == string(name) }) == -1 {
289301
errors = append(errors, fmt.Errorf("%s: invalid stakeholder sig name %s", group.Dir, name))
290302
}
291303
}

generator/wg_readme.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ The [charter]({{.CharterLink}}) defines the scope and governance of the {{.Name}
88
{{- if .StakeholderSIGs }}
99
## Stakeholder SIGs
1010
{{- range .StakeholderSIGs }}
11-
* SIG {{.}}
11+
* [SIG {{.}}](/{{.DirName}})
1212
{{- end }}
1313
{{ end }}
1414
{{ if .Meetings -}}

0 commit comments

Comments
 (0)