diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | gen.go | 81 | ||||
-rw-r--r-- | go.mod | 5 | ||||
-rw-r--r-- | go.sum | 8 | ||||
-rw-r--r-- | plan.html.tmpl | 76 | ||||
-rw-r--r-- | plan.yml | 48 |
6 files changed, 198 insertions, 21 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2c656a5 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/plan.html @@ -0,0 +1,81 @@ +package main + +import ( + "bytes" + _ "embed" + "fmt" + "os" + "sigs.k8s.io/yaml" + "strings" + + "github.com/yuin/goldmark" + "html/template" +) + +type Plan struct { + Tags map[string]TagInfo `json:"tags"` + Contributions []Contribution `json:"contributions"` +} + +type TagInfo struct { + PrettyName string `json:"prettyName"` + Desc string `json:"desc"` +} + +type Contribution struct { + URLs []string `json:"urls"` + Tags []string `json:"tags"` + SponsoredBy string `json:"sponsored-by"` + Desc string `json:"desc"` +} + +func ReadPlan(filename string) (Plan, error) { + bs, err := os.ReadFile(filename) + if err != nil { + return Plan{}, err + } + var ret Plan + if err := yaml.UnmarshalStrict(bs, &ret); err != nil { + return Plan{}, err + } + return ret, nil +} + +func MarkdownToHTML(md string) (template.HTML, error) { + var html strings.Builder + if err := goldmark.Convert([]byte(md), &html); err != nil { + return template.HTML(""), err + } + return template.HTML(html.String()), nil +} + +func main() { + if err := mainWithError(); err != nil { + fmt.Fprintf(os.Stderr, "%s: error: %v\n", os.Args[0], err) + os.Exit(1) + } +} + +//go:embed plan.html.tmpl +var embedPlanHTMLTmpl string + +var tmpl = template.Must(template.New("plan.html"). + Funcs(template.FuncMap{ + "md2html": MarkdownToHTML, + }). + Parse(embedPlanHTMLTmpl)) + +func mainWithError() error { + plan, err := ReadPlan("plan.yml") + if err != nil { + return err + } + var out bytes.Buffer + if err := tmpl.Execute(&out, plan); err != nil { + return err + } + if err := os.WriteFile("plan.html", out.Bytes(), 0666); err != nil { + return err + } + return nil +} @@ -1,3 +1,8 @@ module git.lukeshu.com/imworkingon go 1.22.2 + +require ( + github.com/yuin/goldmark v1.7.1 + sigs.k8s.io/yaml v1.4.0 +) @@ -0,0 +1,8 @@ +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/yuin/goldmark v1.7.1 h1:3bajkSilaCbjdKVsKdZjZCLBNPL9pYzrCakKaf4U49U= +github.com/yuin/goldmark v1.7.1/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= +sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= diff --git a/plan.html.tmpl b/plan.html.tmpl new file mode 100644 index 0000000..d1d1696 --- /dev/null +++ b/plan.html.tmpl @@ -0,0 +1,76 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <title>Luke is working on</title> + <style> + body { + width: 98%; + max-width: 1024px; + margin-left: auto; + margin-right: auto; + + font-family: sans-serif; + } + kbd, code, samp, tt, pre { + background: #DDDDFF; + } + kbd, code, samp, tt, { + white-space: pre-wrap; + } + h1, h2, h3, h4, h5, h6 { + font-family: sans-serif; + } + h1 { + text-align: center; + background-color: #DDDDFF; + } + a { + text-decoration: none; + } + a:hover, a:focus { + text-decoration: underline; + } + article { + border: solid 1px #333333; + border-radius: 1em; + padding: 0.5em 2em; + margin: 0.5em; + } + article.tag > h2 { + margin: 0; + margin-left: -1em; + } + </style> + </head> + <body> + <section id="tags"> + <h1>Luke is working on...</h1> + <p>... improving the GNU/Linux ecosystem.</p> + {{- range $tagName, $tagInfo := .Tags }} + <article class="tag" id="tag-{{ $tagName }}"> + <h2><a href="#tag-{{ $tagName }}">#{{ $tagName }}</a> : {{ $tagInfo.PrettyName }}</h2> + <div clasg="tag-desc">{{ $tagInfo.Desc | md2html }}</div> + </article> + {{- end }} + </section> + <section id="contribs"> + <h1>... by contributing...</h1> + {{- range $contrib := .Contributions }} + <article class="contrib"> + <div class="contrib-urls"> + {{- range $url := $contrib.URLs }} + <a href="{{ $url }}"><tt>{{ $url }}</tt></a><br /> + {{- end }} + </div> + <div class="contrib-tags"> + {{- range $tag := $contrib.Tags }} + <a href="#tag-{{ $tag }}">#{{ $tag }}</a> {{/* */}} + {{- end }} + </div> + <div class="contrib-desc">{{ $contrib.Desc | md2html }}</div> + </article> + {{- end }} + </section> + </body> +</html> @@ -1,25 +1,31 @@ tags: - docs: | - I'm working to improve documentation for GNU/Linux, but more than - that I'm working to improve the forms of documentation that more - skilled technical writers might be afraid or incapable of working - on: `--help` text, generated documentation, and auditing - documentation against the source code to make sure that it is - accurate and complete. - GI: | - "GObject Introspection" (which is a terrible name for what it is, - btw) is a cross-(language-runtime) object system. GObject was an - object system for C that game out of GTK+, and then GObject - Introspection was created as a way to specify the ABI for working - with an object, so that GObjects could be used from other - languages. I think that GObject Introspection is a really cool - technology that can be the basis of reducing friction between - languages, but it needs better/more-ubiquitous tooling. - ARM: | - Not that folks can't use GNU/Linux on ARM (obviously, the - Raspberry Pi has been a huge success), but there's still a lot - more friction to using GNU/Linux on ARM compared to x86. I'm - working on that. + docs: + prettyName: Documentation + desc: | + I'm working to improve documentation for GNU/Linux, but more + than that I'm working to improve the forms of documentation that + more skilled technical writers might be afraid or incapable of + working on: `--help` text, generated documentation, and auditing + documentation against the source code to make sure that it is + accurate and complete. + ARM: + prettyName: ARM support + desc: | + Not that folks can't use GNU/Linux on ARM (obviously, the + Raspberry Pi has been a huge success), but there's still a lot + more friction to using GNU/Linux on ARM compared to x86. I'm + working on that. + GI: + prettyName: GObject Introspection + desc: | + GObject Introspection (which is a terrible name for what it is, + btw) is a cross-(language-runtime) object system. GObject was + an object system for C that game out of GTK+, and then GObject + Introspection was created as a way to specify the ABI for + working with an object, so that GObjects could be used from + other languages. I think that GObject Introspection is a really + cool technology that can be the basis of reducing friction + between languages, but it needs better/more-ubiquitous tooling. contributions: - urls: [https://github.com/flori/json/pull/567] |