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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5175b4fea185d08238f003ae8669fe7747418b7e
4
- data.tar.gz: 304e17d39d4cc0a6f7c04f0688f882d8375e5969
3
+ metadata.gz: f26748711e6ecbb403d8f33ca532985d71e47985
4
+ data.tar.gz: cd5ba0bd80afab05b357a2cfe3cfba9720f3da17
5
5
  SHA512:
6
- metadata.gz: a45f5ebd7c99d9cd79b9651e409390cfac808b3c6cd87de51150dc86a613bf274be9183ba8328f4f8fc1af983337663641b0d784db7339074a692aecacf298fe
7
- data.tar.gz: 064d03cfc93d24e066b6efadc24a73e422deb1a845542fb5dfe7890c1df362bcb1cbd522560258d1c86e78c185adb64e62be27df0bf4ca3fa2b7c220c400f303
6
+ metadata.gz: 5c6363a1a3a810c5aec5d715c31d30e22c04ff6cea3aea763522ea3c06f3e6ede4ea3807101cd631b8c390d753b69c04439377f116d3661db04cb336c2b22fd9
7
+ data.tar.gz: 81d9ac0d9e57f7c693bcf90f757cd0bc8a54a91a5a608375130704b3cc627a53fe085cf72d9f732342b50b201463e52ade08aee0a8f520ff98b2174977d6464a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## v0.5.3
2
+
3
+ - Bugfix for syntax error in data attribute hash
4
+ - https://github.com/k0kubun/hamlit/issues/17
5
+ - Thanks to @eagletmt
6
+
1
7
  ## v0.5.2
2
8
 
3
9
  - Bugfix for silent script without block
@@ -10,16 +10,16 @@ module Hamlit
10
10
  class Attribute
11
11
  include Concerns::AttributeBuilder
12
12
 
13
- def self.build(quote, attributes, base = {})
13
+ def self.build(quote, base, attributes = {})
14
14
  builder = self.new(quote)
15
- builder.build(attributes, base)
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(attributes, base)
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, str, base].compact.join(', ')})"
33
+ code = "::Hamlit::Attribute.build(#{[quote, base, str].compact.join(', ')})"
34
34
  [:dynamic, code]
35
35
  end
36
36
 
@@ -1,3 +1,3 @@
1
1
  module Hamlit
2
- VERSION = "0.5.2"
2
+ VERSION = "0.5.3"
3
3
  end
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hamlit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takashi Kokubun