Skip to content

Commit 0cddcf9

Browse files
committed
auto translate underscores to dashes for attributes
1 parent af9bd12 commit 0cddcf9

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "Cobweb"
22
uuid = "ec354790-cf28-43e8-bb59-b484409b7bad"
33
authors = ["joshday <[email protected]> and contributors"]
4-
version = "0.7.1"
4+
version = "0.7.2"
55

66
[deps]
77
DefaultApplication = "3f0dd361-4fe0-5fc6-8523-80b14ec94d85"

src/Cobweb.jl

+2-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ tag(o::Node) = getfield(o, :tag)
5050
attrs(o::Node) = getfield(o, :attrs)
5151
children(o::Node) = getfield(o, :children)
5252

53-
attrs(kw::AbstractDict) = OrderedDict(Symbol(k) => string(v) for (k,v) in pairs(kw))
53+
attr_symbol(x) = Symbol(replace(string(x), '_' => '-'))
54+
attrs(kw::AbstractDict) = OrderedDict(attr_symbol(k) => string(v) for (k,v) in pairs(kw))
5455

5556
(o::Node)(x...; kw...) = Node(tag(o), merge(attrs(o), attrs(kw)), vcat(children(o), x...))
5657

0 commit comments

Comments
 (0)