faml 0.6.1 → 0.6.2

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: c8c5abc0e50c774fb988c861370ccbe38c61bace
4
- data.tar.gz: d56eba69f346d05509da4cbdce6dccbd3d8f8666
3
+ metadata.gz: 70be9578e244e136f47caf610ffde1a3e7edf582
4
+ data.tar.gz: c3673597a734dcf1822656f55e4868396bf242c8
5
5
  SHA512:
6
- metadata.gz: 5b1d9821bddbb9c89a289a7190ca8af46921e88154c0a2baf6ecef7648d7720437f7a01c4f1166645400e3964843cb91195850bf8cf3132dfb27267cb5cb1f1b
7
- data.tar.gz: 9a01b8763adad686ff59845d00d31d3fe4cc926ce94f6a034673ecf3b4736a30760e102b26a3b1a61553a5dd6eb9fcde6f976761f5998f2385590871a5042dd3
6
+ metadata.gz: f370900646f37e6f58d4d2ef43ff98c1f72c6a74f10ea7e9733b506a85dca85e75a53b82267ec2dd5d151ea86b10c647e0de372b82e6e13b2841933ed5480df8
7
+ data.tar.gz: c268cc69b1de1723be7f79e8377026e34b712fbdecd4cea73f01f450bcad11cac600fee873f34db7394a168e9109e4f8882018f1ec7e3e52d55ed8643e23749f
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 0.6.2 (2015-11-22)
2
+ - Fix data-id and data-class attribute
3
+ - https://github.com/eagletmt/faml/pull/39
4
+ - It's regression in v0.6.1
5
+
1
6
  ## 0.6.1 (2015-11-21)
2
7
  - Fix handling duplicated old attributes and new attributes
3
8
  - https://github.com/eagletmt/faml/pull/37
@@ -83,7 +83,6 @@ normalize_data_i2(VALUE key, VALUE value, VALUE ptr)
83
83
  struct normalize_data_i2_arg *arg = (struct normalize_data_i2_arg *)ptr;
84
84
  VALUE k = rb_str_dup(arg->key);
85
85
 
86
- k = rb_str_dup(arg->key);
87
86
  rb_str_cat(k, "-", 1);
88
87
  rb_str_append(k, key);
89
88
  rb_hash_aset(arg->normalized, k, value);
data/faml.gemspec CHANGED
@@ -30,8 +30,8 @@ Gem::Specification.new do |spec|
30
30
  spec.add_development_dependency 'bundler'
31
31
  spec.add_development_dependency 'coffee-script'
32
32
  spec.add_development_dependency 'coveralls'
33
- spec.add_development_dependency 'haml' # for benchmark
34
- spec.add_development_dependency 'hamlit', '>= 0.6.0' # for benchmark
33
+ spec.add_development_dependency 'haml', '>= 4.1.0.beta.1' # for benchmark and compatibility check
34
+ spec.add_development_dependency 'hamlit', '>= 0.6.0' # for benchmark and compatibility check
35
35
  spec.add_development_dependency 'rake'
36
36
  spec.add_development_dependency 'rake-compiler'
37
37
  spec.add_development_dependency 'redcarpet'
@@ -1,7 +1,7 @@
1
1
  # Incompatibilities
2
2
  ## Versions
3
- - Haml 4.0.7
4
- - Faml 0.6.1
3
+ - Haml 4.1.0.beta.1
4
+ - Faml 0.6.2
5
5
  - Hamlit 1.7.2
6
6
 
7
7
  ## Table of contents
@@ -43,13 +43,13 @@
43
43
  %span{class: []}
44
44
  ```
45
45
 
46
- ## Faml, Haml
46
+ ## Faml
47
47
  ```html
48
48
  <span></span>
49
49
 
50
50
  ```
51
51
 
52
- ## Hamlit
52
+ ## Haml, Hamlit
53
53
  ```html
54
54
  <span class=''></span>
55
55
 
@@ -117,13 +117,13 @@
117
117
  %span{id: []}
118
118
  ```
119
119
 
120
- ## Faml, Haml
120
+ ## Faml
121
121
  ```html
122
122
  <span></span>
123
123
 
124
124
  ```
125
125
 
126
- ## Hamlit
126
+ ## Haml, Hamlit
127
127
  ```html
128
128
  <span id=''></span>
129
129
 
@@ -305,7 +305,7 @@
305
305
 
306
306
  ```
307
307
 
308
- # [./spec/render/attribute_spec.rb:142](../../../spec/render/attribute_spec.rb#L142)
308
+ # [./spec/render/attribute_spec.rb:149](../../../spec/render/attribute_spec.rb#L149)
309
309
  ## Input
310
310
  ```haml
311
311
  %span{foo: {bar: 1+2}} hello
@@ -323,7 +323,7 @@
323
323
 
324
324
  ```
325
325
 
326
- # [./spec/render/attribute_spec.rb:165](../../../spec/render/attribute_spec.rb#L165)
326
+ # [./spec/render/attribute_spec.rb:172](../../../spec/render/attribute_spec.rb#L172)
327
327
  ## Input
328
328
  ```haml
329
329
  %span{data: {foo: 1, bar: 'baz', :hoge => :fuga, k1: { k2: 'v3' }}} hello
@@ -341,7 +341,7 @@
341
341
 
342
342
  ```
343
343
 
344
- # [./spec/render/attribute_spec.rb:173](../../../spec/render/attribute_spec.rb#L173)
344
+ # [./spec/render/attribute_spec.rb:180](../../../spec/render/attribute_spec.rb#L180)
345
345
  ## Input
346
346
  ```haml
347
347
  %span{data: {foo: 1, bar: 2+3}} hello
@@ -359,7 +359,7 @@
359
359
 
360
360
  ```
361
361
 
362
- # [./spec/render/attribute_spec.rb:177](../../../spec/render/attribute_spec.rb#L177)
362
+ # [./spec/render/attribute_spec.rb:184](../../../spec/render/attribute_spec.rb#L184)
363
363
  ## Input
364
364
  ```haml
365
365
  - data = { foo: 1, bar: 2 }
@@ -379,7 +379,7 @@
379
379
 
380
380
  ```
381
381
 
382
- # [./spec/render/attribute_spec.rb:195](../../../spec/render/attribute_spec.rb#L195)
382
+ # [./spec/render/attribute_spec.rb:202](../../../spec/render/attribute_spec.rb#L202)
383
383
  ## Input
384
384
  ```haml
385
385
  %span{b: __LINE__,
@@ -399,7 +399,7 @@
399
399
 
400
400
  ```
401
401
 
402
- # [./spec/render/attribute_spec.rb:202](../../../spec/render/attribute_spec.rb#L202)
402
+ # [./spec/render/attribute_spec.rb:209](../../../spec/render/attribute_spec.rb#L209)
403
403
  ## Input
404
404
  ```haml
405
405
  %span{"foo\0bar" => "hello"}
@@ -417,7 +417,7 @@
417
417
 
418
418
  ```
419
419
 
420
- # [./spec/render/attribute_spec.rb:202](../../../spec/render/attribute_spec.rb#L202)
420
+ # [./spec/render/attribute_spec.rb:209](../../../spec/render/attribute_spec.rb#L209)
421
421
  ## Input
422
422
  ```haml
423
423
  - val = "hello"
@@ -437,7 +437,7 @@
437
437
 
438
438
  ```
439
439
 
440
- # [./spec/render/attribute_spec.rb:202](../../../spec/render/attribute_spec.rb#L202)
440
+ # [./spec/render/attribute_spec.rb:209](../../../spec/render/attribute_spec.rb#L209)
441
441
  ## Input
442
442
  ```haml
443
443
  - key = "foo\0bar"
@@ -459,7 +459,7 @@
459
459
  ... ^
460
460
  ```
461
461
 
462
- # [./spec/render/attribute_spec.rb:216](../../../spec/render/attribute_spec.rb#L216)
462
+ # [./spec/render/attribute_spec.rb:223](../../../spec/render/attribute_spec.rb#L223)
463
463
  ## Input
464
464
  ```haml
465
465
  %span[Faml::TestStruct.new(123)] hello
@@ -477,7 +477,7 @@
477
477
 
478
478
  ```
479
479
 
480
- # [./spec/render/attribute_spec.rb:220](../../../spec/render/attribute_spec.rb#L220)
480
+ # [./spec/render/attribute_spec.rb:227](../../../spec/render/attribute_spec.rb#L227)
481
481
  ## Input
482
482
  ```haml
483
483
  %span[Faml::TestStruct.new(123), :hello] hello
@@ -495,7 +495,7 @@
495
495
 
496
496
  ```
497
497
 
498
- # [./spec/render/attribute_spec.rb:224](../../../spec/render/attribute_spec.rb#L224)
498
+ # [./spec/render/attribute_spec.rb:231](../../../spec/render/attribute_spec.rb#L231)
499
499
  ## Input
500
500
  ```haml
501
501
  %span[Faml::TestRefStruct.new(123)] hello
@@ -513,7 +513,7 @@
513
513
 
514
514
  ```
515
515
 
516
- # [./spec/render/attribute_spec.rb:228](../../../spec/render/attribute_spec.rb#L228)
516
+ # [./spec/render/attribute_spec.rb:235](../../../spec/render/attribute_spec.rb#L235)
517
517
  ## Input
518
518
  ```haml
519
519
  %span#baz[Faml::TestStruct.new(123)]{id: "foo"} hello
@@ -531,7 +531,7 @@
531
531
 
532
532
  ```
533
533
 
534
- # [./spec/render/attribute_spec.rb:234](../../../spec/render/attribute_spec.rb#L234)
534
+ # [./spec/render/attribute_spec.rb:241](../../../spec/render/attribute_spec.rb#L241)
535
535
  ## Input
536
536
  ```haml
537
537
  %span{foo: 1}(foo=2)
@@ -549,7 +549,7 @@
549
549
 
550
550
  ```
551
551
 
552
- # [./spec/render/attribute_spec.rb:234](../../../spec/render/attribute_spec.rb#L234)
552
+ # [./spec/render/attribute_spec.rb:241](../../../spec/render/attribute_spec.rb#L241)
553
553
  ## Input
554
554
  ```haml
555
555
  %span(foo=2){foo: 1}
@@ -567,7 +567,7 @@
567
567
 
568
568
  ```
569
569
 
570
- # [./spec/render/attribute_spec.rb:234](../../../spec/render/attribute_spec.rb#L234)
570
+ # [./spec/render/attribute_spec.rb:241](../../../spec/render/attribute_spec.rb#L241)
571
571
  ## Input
572
572
  ```haml
573
573
  - v = 2
@@ -586,7 +586,7 @@
586
586
 
587
587
  ```
588
588
 
589
- # [./spec/render/attribute_spec.rb:234](../../../spec/render/attribute_spec.rb#L234)
589
+ # [./spec/render/attribute_spec.rb:241](../../../spec/render/attribute_spec.rb#L241)
590
590
  ## Input
591
591
  ```haml
592
592
  - v = 2
@@ -605,7 +605,7 @@
605
605
 
606
606
  ```
607
607
 
608
- # [./spec/render/attribute_spec.rb:234](../../../spec/render/attribute_spec.rb#L234)
608
+ # [./spec/render/attribute_spec.rb:241](../../../spec/render/attribute_spec.rb#L241)
609
609
  ## Input
610
610
  ```haml
611
611
  - h = {foo: 1}
@@ -624,7 +624,7 @@
624
624
 
625
625
  ```
626
626
 
627
- # [./spec/render/attribute_spec.rb:234](../../../spec/render/attribute_spec.rb#L234)
627
+ # [./spec/render/attribute_spec.rb:241](../../../spec/render/attribute_spec.rb#L241)
628
628
  ## Input
629
629
  ```haml
630
630
  - h = {foo: 1}
@@ -643,177 +643,21 @@
643
643
 
644
644
  ```
645
645
 
646
- # [./spec/render/attribute_spec.rb:245](../../../spec/render/attribute_spec.rb#L245)
647
- ## Input
648
- ```haml
649
- %span{class: 1}(class=2)
650
- ```
651
-
652
- ## Faml, Hamlit
653
- ```html
654
- <span class='1 2'></span>
655
-
656
- ```
657
-
658
- ## Haml
659
- ```html
660
- <span class='1'></span>
661
-
662
- ```
663
-
664
- # [./spec/render/attribute_spec.rb:245](../../../spec/render/attribute_spec.rb#L245)
665
- ## Input
666
- ```haml
667
- - v = 2
668
- %span{class: v-1}(class=v)
669
- ```
670
-
671
- ## Faml, Hamlit
672
- ```html
673
- <span class='1 2'></span>
674
-
675
- ```
676
-
677
- ## Haml
678
- ```html
679
- <span class='1'></span>
680
-
681
- ```
682
-
683
- # [./spec/render/attribute_spec.rb:245](../../../spec/render/attribute_spec.rb#L245)
684
- ## Input
685
- ```haml
686
- - h = {class: 1}
687
- %span{h}(class=2)
688
- ```
689
-
690
- ## Faml, Hamlit
691
- ```html
692
- <span class='1 2'></span>
693
-
694
- ```
695
-
696
- ## Haml
697
- ```html
698
- <span class='1'></span>
699
-
700
- ```
701
-
702
- # [./spec/render/attribute_spec.rb:253](../../../spec/render/attribute_spec.rb#L253)
646
+ # [./spec/render/attribute_spec.rb:260](../../../spec/render/attribute_spec.rb#L260)
703
647
  ## Input
704
648
  ```haml
705
649
  %span{id: 1}(id=2)
706
650
  ```
707
651
 
708
- ## Faml
652
+ ## Faml, Haml
709
653
  ```html
710
654
  <span id='2_1'></span>
711
655
 
712
656
  ```
713
657
 
714
- ## Haml
715
- ```html
716
- <span id='1'></span>
717
-
718
- ```
719
-
720
658
  ## Hamlit
721
659
  ```html
722
660
  <span id='1_2'></span>
723
661
 
724
662
  ```
725
663
 
726
- # [./spec/render/attribute_spec.rb:253](../../../spec/render/attribute_spec.rb#L253)
727
- ## Input
728
- ```haml
729
- %span(id=2){id: 1}
730
- ```
731
-
732
- ## Faml, Hamlit
733
- ```html
734
- <span id='2_1'></span>
735
-
736
- ```
737
-
738
- ## Haml
739
- ```html
740
- <span id='1'></span>
741
-
742
- ```
743
-
744
- # [./spec/render/attribute_spec.rb:253](../../../spec/render/attribute_spec.rb#L253)
745
- ## Input
746
- ```haml
747
- - v = 2
748
- %span{id: v-1}(id=v)
749
- ```
750
-
751
- ## Faml, Hamlit
752
- ```html
753
- <span id='2_1'></span>
754
-
755
- ```
756
-
757
- ## Haml
758
- ```html
759
- <span id='1'></span>
760
-
761
- ```
762
-
763
- # [./spec/render/attribute_spec.rb:253](../../../spec/render/attribute_spec.rb#L253)
764
- ## Input
765
- ```haml
766
- - v = 2
767
- %span(id=v){id: v-1}
768
- ```
769
-
770
- ## Faml, Hamlit
771
- ```html
772
- <span id='2_1'></span>
773
-
774
- ```
775
-
776
- ## Haml
777
- ```html
778
- <span id='1'></span>
779
-
780
- ```
781
-
782
- # [./spec/render/attribute_spec.rb:253](../../../spec/render/attribute_spec.rb#L253)
783
- ## Input
784
- ```haml
785
- - h = {id: 1}
786
- %span{h}(id=2)
787
- ```
788
-
789
- ## Faml, Hamlit
790
- ```html
791
- <span id='2_1'></span>
792
-
793
- ```
794
-
795
- ## Haml
796
- ```html
797
- <span id='1'></span>
798
-
799
- ```
800
-
801
- # [./spec/render/attribute_spec.rb:253](../../../spec/render/attribute_spec.rb#L253)
802
- ## Input
803
- ```haml
804
- - h = {id: 1}
805
- %span(id=2){h}
806
- ```
807
-
808
- ## Faml, Hamlit
809
- ```html
810
- <span id='2_1'></span>
811
-
812
- ```
813
-
814
- ## Haml
815
- ```html
816
- <span id='1'></span>
817
-
818
- ```
819
-
@@ -11,6 +11,10 @@ module Faml
11
11
  assert_valid_ruby_code!(old_attributes)
12
12
  return [nil, nil]
13
13
  end
14
+ if old_attributes && new_attributes
15
+ # TODO: Quit optimization. Merge id and class correctly.
16
+ return [nil, nil]
17
+ end
14
18
 
15
19
  static_attributes, dynamic_attributes = build_optimized_attributes(parser, static_id, static_class)
16
20
  if optimizable?(old_attributes, new_attributes, static_attributes, dynamic_attributes)
@@ -129,14 +129,7 @@ module Faml
129
129
  end
130
130
 
131
131
  def set_static_attribute(key, val)
132
- case key.to_s
133
- when 'id', 'class'
134
- @static_attributes[key] ||= []
135
- @static_attributes[key].concat(Array(val))
136
- else
137
- @static_attributes[key] = val
138
- end
139
- val
132
+ @static_attributes[key] = val
140
133
  end
141
134
 
142
135
  def set_dynamic_attributes(key, val)
data/lib/faml/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # frozen-string-literal: true
2
2
  module Faml
3
- VERSION = '0.6.1'
3
+ VERSION = '0.6.2'
4
4
  end
@@ -139,6 +139,13 @@ HAML
139
139
  HAML
140
140
  end
141
141
 
142
+ it 'renders data-id and data-class (#38)' do
143
+ aggregate_failures do
144
+ expect(render_string('%span{data: {id: 1}}')).to eq("<span data-id='1'></span>\n")
145
+ expect(render_string('%span{data: {class: 1}}')).to eq("<span data-class='1'></span>\n")
146
+ end
147
+ end
148
+
142
149
  it 'optimize send case' do
143
150
  expect(render_string('%span{foo: {bar: 1+2}} hello')).to eq("<span foo='{:bar=&gt;3}'>hello</span>\n")
144
151
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kohei Suzuki
@@ -156,14 +156,14 @@ dependencies:
156
156
  requirements:
157
157
  - - ">="
158
158
  - !ruby/object:Gem::Version
159
- version: '0'
159
+ version: 4.1.0.beta.1
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - ">="
165
165
  - !ruby/object:Gem::Version
166
- version: '0'
166
+ version: 4.1.0.beta.1
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: hamlit
169
169
  requirement: !ruby/object:Gem::Requirement