Skip to content

Commit 8310b60

Browse files
authored
Update Html.hs (#17)
1 parent 0895b49 commit 8310b60

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Miso/From/Html.hs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ instance Show HTMLAttr where
119119
, T.unpack v
120120
, "\" "
121121
]
122+
show (HTMLAttr x@(T.isPrefixOf "data-" -> True) Nothing) =
123+
case T.stripPrefix "data-" x of
124+
Just rest -> "data_ " <> "\"" <> T.unpack rest <> "\"" <> " \"\""
125+
Nothing -> T.unpack x
122126
show (HTMLAttr "checked" Nothing) =
123127
"checked_ True"
124128
show (HTMLAttr k Nothing) =

0 commit comments

Comments
 (0)