Decode style JSON into a typed struct

This commit is contained in:
Christian Muehlhaeuser
2019-12-13 03:04:48 +01:00
parent 219f21c4e7
commit 35342a2061
17 changed files with 184 additions and 249 deletions
+4 -2
View File
@@ -77,6 +77,8 @@ func (s BlockStack) Current() BlockElement {
return s[len(s)-1]
}
func (s BlockStack) With(child ElementStyle) ElementStyle {
return cascadeStyle(s.Current().Style, child, true)
func (s BlockStack) With(child StylePrimitive) StylePrimitive {
sb := StyleBlock{}
sb.StylePrimitive = child
return cascadeStyle(s.Current().Style, sb, true).StylePrimitive
}