Skip to content

Commit 230ff2b

Browse files
fix: Cleanup codegen and formatting. (#835)
This change fixes issues with code generation and go code formatting.
1 parent 52a7f61 commit 230ff2b

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

docs/widgets.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,8 @@ render.Column(
160160

161161

162162
## Image
163-
Image renders the image data passed via `src`. `src` accepts a string and supports file URLs, SVG as a string, as well as image binary data. Supported binary data formats include PNG, JPEG and GIF.
163+
Image renders the binary image data passed via `src`. Supported
164+
formats include PNG, JPEG, GIF, and SVG.
164165

165166
If `width` or `height` are set, the image will be scaled
166167
accordingly, with nearest neighbor interpolation. Otherwise the
@@ -173,7 +174,7 @@ the `delay` attribute.
173174
#### Attributes
174175
| Name | Type | Description | Required |
175176
| --- | --- | --- | --- |
176-
| `src` | `str` | Binary image data or svg text | **Y** |
177+
| `src` | `str` | Binary image data or SVG text | **Y** |
177178
| `width` | `int` | Scale image to this width | N |
178179
| `height` | `int` | Scale image to this height | N |
179180
| `delay` | `int` | (Read-only) Frame delay in ms, for animated GIFs | N |

render/image.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
)
2222

2323
// Image renders the binary image data passed via `src`. Supported
24-
// formats include PNG, JPEG and GIF.
24+
// formats include PNG, JPEG, GIF, and SVG.
2525
//
2626
// If `width` or `height` are set, the image will be scaled
2727
// accordingly, with nearest neighbor interpolation. Otherwise the
@@ -31,7 +31,7 @@ import (
3131
// also be animated. Frame delay (in milliseconds) can be read from
3232
// the `delay` attribute.
3333
//
34-
// DOC(Src): Binary image data
34+
// DOC(Src): Binary image data or SVG text
3535
// DOC(Width): Scale image to this width
3636
// DOC(Height): Scale image to this height
3737
// DOC(Delay): (Read-only) Frame delay in ms, for animated GIFs

runtime/gen/header/render.tmpl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ var renderModule = RenderModule{}
2323

2424
func LoadRenderModule() (starlark.StringDict, error) {
2525
renderModule.once.Do(func() {
26-
fnt := starlark.NewDict(len(render.Font))
27-
for k, _ := range render.Font {
28-
fnt.SetKey(starlark.String(k), starlark.String(k))
26+
fontList := render.GetFontList()
27+
fnt := starlark.NewDict(len(fontList))
28+
for _, name := range fontList {
29+
fnt.SetKey(starlark.String(name), starlark.String(name))
2930
}
3031
fnt.Freeze()
3132

runtime/modules/hmac/hmac.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ func LoadModule() (starlark.StringDict, error) {
4747
func fnHmac(hashFunc func() hash.Hash) func(*starlark.Thread, *starlark.Builtin, starlark.Tuple, []starlark.Tuple) (starlark.Value, error) {
4848
return func(t *starlark.Thread, fn *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
4949
var (
50-
key starlark.Value
51-
s starlark.String
50+
key starlark.Value
51+
s starlark.String
5252
binary bool = false
5353
)
5454
if err := starlark.UnpackArgs(fn.Name(), args, kwargs, "key", &key, "s", &s, "binary?", &binary); err != nil {
@@ -77,4 +77,4 @@ func fnHmac(hashFunc func() hash.Hash) func(*starlark.Thread, *starlark.Builtin,
7777
}
7878
return starlark.String(fmt.Sprintf("%x", digest)), nil
7979
}
80-
}
80+
}

0 commit comments

Comments
 (0)