func encodeString(name, quote string) []byte { return append(html.Must((&html.Label{ For: name, Label: path.Base(name), }).MarshalText()), html.Must((&html.Input{ Type: html.Input_TEXT, Name: name, Value: quote, }).MarshalText())...) }
func encodeBool(name string, quote bool) []byte { return append(html.Must((&html.Label{ For: name, Label: path.Base(name), }).MarshalText()), html.Must((&html.Input{ Name: name, Type: html.Input_CHECKBOX, Checked: quote, }).MarshalText())...) }
func encodeFloat(name string, quote float64) []byte { return append(html.Must((&html.Label{ For: name, Label: path.Base(name), }).MarshalText()), html.Must((&html.Input{ Type: html.Input_NUMBER, Name: name, Value: fmt.Sprintf("%f", quote), }).MarshalText())...) }
func encodeTime(name string, quote time.Time) []byte { return append(html.Must((&html.Label{ For: name, Label: path.Base(name), }).MarshalText()), html.Must((&html.Input{ Name: name, Type: html.Input_DATETIME_LOCAL, Value: quote.Format(time.RFC3339), }).MarshalText())...) }
func marshalComposite(name string, v reflect.Value) ([]byte, error) { bytes, err := json.MarshalIndent(v.Interface(), "", " ") if err != nil { return nil, err } return append(html.Must((&html.Label{ For: name, Label: path.Base(name), }).MarshalText()), html.Must((&html.TextArea{ Name: name, Content: string(bytes), }).MarshalText())...), nil }