hamlit 0.5.2 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/hamlit/attribute.rb +3 -3
- data/lib/hamlit/compilers/runtime_attribute.rb +1 -1
- data/lib/hamlit/version.rb +1 -1
- data/spec/hamlit/engine/old_attributes_spec.rb +9 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f26748711e6ecbb403d8f33ca532985d71e47985
|
4
|
+
data.tar.gz: cd5ba0bd80afab05b357a2cfe3cfba9720f3da17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c6363a1a3a810c5aec5d715c31d30e22c04ff6cea3aea763522ea3c06f3e6ede4ea3807101cd631b8c390d753b69c04439377f116d3661db04cb336c2b22fd9
|
7
|
+
data.tar.gz: 81d9ac0d9e57f7c693bcf90f757cd0bc8a54a91a5a608375130704b3cc627a53fe085cf72d9f732342b50b201463e52ade08aee0a8f520ff98b2174977d6464a
|
data/CHANGELOG.md
CHANGED
data/lib/hamlit/attribute.rb
CHANGED
@@ -10,16 +10,16 @@ module Hamlit
|
|
10
10
|
class Attribute
|
11
11
|
include Concerns::AttributeBuilder
|
12
12
|
|
13
|
-
def self.build(quote,
|
13
|
+
def self.build(quote, base, attributes = {})
|
14
14
|
builder = self.new(quote)
|
15
|
-
builder.build(
|
15
|
+
builder.build(base, attributes)
|
16
16
|
end
|
17
17
|
|
18
18
|
def initialize(quote)
|
19
19
|
@quote = quote
|
20
20
|
end
|
21
21
|
|
22
|
-
def build(
|
22
|
+
def build(base, attributes)
|
23
23
|
result = ''
|
24
24
|
merge_attributes(base, attributes).each do |key, value|
|
25
25
|
if value == true
|
@@ -30,7 +30,7 @@ module Hamlit
|
|
30
30
|
def compile_runtime_attribute(str, base = nil)
|
31
31
|
str = str.gsub(/(\A\{|\}\Z)/, '')
|
32
32
|
quote = options[:attr_quote].inspect
|
33
|
-
code = "::Hamlit::Attribute.build(#{[quote,
|
33
|
+
code = "::Hamlit::Attribute.build(#{[quote, base, str].compact.join(', ')})"
|
34
34
|
[:dynamic, code]
|
35
35
|
end
|
36
36
|
|
data/lib/hamlit/version.rb
CHANGED
@@ -125,6 +125,15 @@ describe Hamlit::Engine do
|
|
125
125
|
end
|
126
126
|
|
127
127
|
describe 'nested attributes' do
|
128
|
+
it 'renders data attribute by hash' do
|
129
|
+
assert_render(<<-'HAML', <<-HTML)
|
130
|
+
- hash = { bar: 'baz' }
|
131
|
+
%span.foo{ data: hash }
|
132
|
+
HAML
|
133
|
+
<span class='foo' data-bar='baz'></span>
|
134
|
+
HTML
|
135
|
+
end
|
136
|
+
|
128
137
|
it 'renders true attributes' do
|
129
138
|
assert_render(<<-'HAML', <<-HTML)
|
130
139
|
%span{ data: { disable: true } } bar
|