diff --git a/cstyle/transformers/ul/main.go b/cstyle/transformers/ul/main.go
index 481d04e..6ad8ec3 100644
--- a/cstyle/transformers/ul/main.go
+++ b/cstyle/transformers/ul/main.go
@@ -23 +22,0 @@ func Init() cstyle.Transformer {
- element.QuickStyles(&dot)
@@ -31 +29,0 @@ func Init() cstyle.Transformer {
- element.QuickStyles(&content)
@@ -39,2 +37,2 @@ func Init() cstyle.Transformer {
- v.Children = append(v.Children, &dot)
- v.Children = append(v.Children, &content)
+ v.AppendChild(&dot)
+ v.AppendChild(&content)
package ul
import (
"grim/cstyle"
"grim/element"
)
func Init() cstyle.Transformer {
return cstyle.Transformer{
Selector: func(n *element.Node, c *cstyle.CSS) bool {
return n.TagName == "ul"
},
Handler: func(n *element.Node, c *cstyle.CSS) *element.Node {
// The reason tN (temporary Node) is used, is because we have to go through the n.Children and it makes it hard to insert/remove the old one
// its better to just replace it
// !ISSUE: make stylable
for i, v := range n.Children {
if v.TagName != "li" {
continue
}
dot := v.CreateElement("div")
element.QuickStyles(&dot)
dot.Style("background", "#000")
dot.Style("border-radius", "100px")
dot.Style("width", "5px")
dot.Style("height", "5px")
dot.Style("margin-right", "10px")
content := v.CreateElement("div")
element.QuickStyles(&content)
content.InnerText = v.InnerText
for k, v := range v.Styles() {
content.Style(k, v)
}
content.Style("display", "block")
v.Children = append(v.Children, &dot)
v.Children = append(v.Children, &content)
n.Children[i].Style("display", "flex")
n.Children[i].Style("align-items", "center")
n.Children[i] = v
}
return n
},
}
}