diff options
| author | Joe Beda <joe.github@bedafamily.com> | 2017-11-06 11:57:04 -0800 |
|---|---|---|
| committer | Joe Beda <joe.github@bedafamily.com> | 2017-11-06 13:35:52 -0800 |
| commit | 1cc0e9748240fc2659ad2d80c610f54880121e16 (patch) | |
| tree | 284def1109488b147dbbc6e27c5f6ea191176f20 /generator | |
| parent | 56ddf9c24ae7e308e3cbd4cb9c3638d758c53709 (diff) | |
Make time zone explicit
Diffstat (limited to 'generator')
| -rw-r--r-- | generator/README.md | 10 | ||||
| -rw-r--r-- | generator/app.go | 20 | ||||
| -rw-r--r-- | generator/list.tmpl | 4 | ||||
| -rw-r--r-- | generator/sig_readme.tmpl | 2 | ||||
| -rw-r--r-- | generator/wg_readme.tmpl | 2 |
5 files changed, 31 insertions, 7 deletions
diff --git a/generator/README.md b/generator/README.md index 175d7c8f..0f09eb0f 100644 --- a/generator/README.md +++ b/generator/README.md @@ -5,6 +5,16 @@ different Special Interest Groups (SIGs) of Kubernetes. The authoritative source for SIG information is the `sigs.yaml` file in the project root. All updates must be done there. +The schema for this file should be self explanatory. However, if you need to see all the options check out the generator code in `app.go`. + +**Time Zone gotcha**: +Time zones make everything complicated. +And Daylight Savings time makes it even more complicated. +Meetings are specified with a time zone and we generate a link to http://www.thetimezoneconverter.com/ so that people can easily convert it to their local time zone. +To make this work you need to specify the time zone in a way that that web site recognizes. +Practically, that means US pacific time must be `PT (Pacific Time)`. +`PT` isn't good enough, unfortunately. + When an update happens to the this file, the next step is generate the accompanying documentation. This takes the format of two types of doc file: diff --git a/generator/app.go b/generator/app.go index 2aaced3f..3c6c144d 100644 --- a/generator/app.go +++ b/generator/app.go @@ -20,6 +20,7 @@ import ( "fmt" "io/ioutil" "log" + "net/url" "os" "path/filepath" "sort" @@ -60,8 +61,8 @@ type Lead struct { // Meeting represents a regular meeting for a group. type Meeting struct { Day string - UTC string - PST string + Time string + TZ string `yaml:"tz"` Frequency string } @@ -153,9 +154,22 @@ func getExistingContent(path string) (string, error) { return strings.Join(captured, "\n"), nil } +var funcMap template.FuncMap = template.FuncMap{ + "tzUrlEncode": tzUrlEncode, +} + +// tzUrlEncode returns an url encoded string without the + shortcut. This is +// required as the timezone conversion site we are using doesn't recognize + as +// a valid url escape character. +func tzUrlEncode(tz string) string { + return strings.Replace(url.QueryEscape(tz), "+", "%20", -1) +} + func writeTemplate(templatePath, outputPath string, data interface{}) error { // set up template - t, err := template.ParseFiles(templatePath, filepath.Join(baseGeneratorDir, templateDir, headerTemplate)) + t, err := template.New(filepath.Base(templatePath)). + Funcs(funcMap). + ParseFiles(templatePath, filepath.Join(baseGeneratorDir, templateDir, headerTemplate)) if err != nil { return err } diff --git a/generator/list.tmpl b/generator/list.tmpl index 9a5ee729..38ddc0e1 100644 --- a/generator/list.tmpl +++ b/generator/list.tmpl @@ -16,7 +16,7 @@ When the need arises, a [new SIG can be created](sig-creation-procedure.md) | Name | Label | Leads | Contact | Meetings | |------|--------|-------|---------|----------| {{- range .Sigs}} -|[{{.Name}}]({{.Dir}}/README.md)|{{.Label}}|{{range .Leads}}* [{{.Name}}](https://github.com/{{.GitHub}}){{if .Company}}, {{.Company}}{{end}}<br>{{end}}|* [Slack](https://kubernetes.slack.com/messages/{{.Contact.Slack}})<br>* [Mailing List]({{.Contact.MailingList}})|{{ $save := . }}{{range .Meetings}}* [{{.Day}}s at {{.UTC}} UTC ({{.Frequency}})]({{$save.MeetingURL}})<br>{{end}} +|[{{.Name}}]({{.Dir}}/README.md)|{{.Label}}|{{range .Leads}}* [{{.Name}}](https://github.com/{{.GitHub}}){{if .Company}}, {{.Company}}{{end}}<br>{{end}}|* [Slack](https://kubernetes.slack.com/messages/{{.Contact.Slack}})<br>* [Mailing List]({{.Contact.MailingList}})|{{ $save := . }}{{range .Meetings}}* [{{.Day}}s at {{.Time}} {{.TZ}} ({{.Frequency}})]({{$save.MeetingURL}})<br>{{end}} {{- end }} ### Master Working Group List @@ -24,5 +24,5 @@ When the need arises, a [new SIG can be created](sig-creation-procedure.md) | Name | Organizers | Contact | Meetings | |------|------------|---------|----------| {{- range .WorkingGroups}} -|[{{.Name}}]({{.Dir}}/README.md)|{{range .Leads}}* [{{.Name}}](https://github.com/{{.GitHub}}){{if .Company}}, {{.Company}}{{end}}<br>{{end}}|* [Slack](https://kubernetes.slack.com/messages/{{.Contact.Slack}})<br>* [Mailing List]({{.Contact.MailingList}})|{{ $save := . }}{{range .Meetings}}* [{{.Day}}s at {{.UTC}} UTC ({{.Frequency}})]({{$save.MeetingURL}})<br>{{end}} +|[{{.Name}}]({{.Dir}}/README.md)|{{range .Leads}}* [{{.Name}}](https://github.com/{{.GitHub}}){{if .Company}}, {{.Company}}{{end}}<br>{{end}}|* [Slack](https://kubernetes.slack.com/messages/{{.Contact.Slack}})<br>* [Mailing List]({{.Contact.MailingList}})|{{ $save := . }}{{range .Meetings}}* [{{.Day}}s at {{.Time}} {{.TZ}} ({{.Frequency}})]({{$save.MeetingURL}})<br>{{end}} {{- end }} diff --git a/generator/sig_readme.tmpl b/generator/sig_readme.tmpl index 81284162..755b6938 100644 --- a/generator/sig_readme.tmpl +++ b/generator/sig_readme.tmpl @@ -4,7 +4,7 @@ {{ .MissionStatement }} ## Meetings {{- range .Meetings }} -* [{{.Day}}s at {{.UTC}} UTC]({{$.MeetingURL}}) ({{.Frequency}}). [Convert to your timezone](http://www.thetimezoneconverter.com/?t={{.UTC}}&tz=UTC). +* [{{.Day}}s at {{.Time}} {{.TZ}}]({{$.MeetingURL}}) ({{.Frequency}}). [Convert to your timezone](http://www.thetimezoneconverter.com/?t={{.Time}}&tz={{.TZ | tzUrlEncode}}). {{- end }} {{ if .MeetingArchiveURL -}} diff --git a/generator/wg_readme.tmpl b/generator/wg_readme.tmpl index 8b990848..40ec00a1 100644 --- a/generator/wg_readme.tmpl +++ b/generator/wg_readme.tmpl @@ -4,7 +4,7 @@ {{ .MissionStatement }} ## Meetings {{- range .Meetings }} -* [{{.Day}}s at {{.UTC}} UTC]({{$.MeetingURL}}) ({{.Frequency}}). [Convert to your timezone](http://www.thetimezoneconverter.com/?t={{.UTC}}&tz=UTC). +* [{{.Day}}s at {{.Time}} {{.TZ}}]({{$.MeetingURL}}) ({{.Frequency}}). [Convert to your timezone](http://www.thetimezoneconverter.com/?t={{.Time}}&tz={{.TZ | tzUrlEncode}}). {{- end }} {{ if .MeetingArchiveURL -}} |
