haml_parser 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 57fa4126042491041d5f4331f41515d43c83a589
4
- data.tar.gz: 56cbec56b038d88ea9f624fb8f77e8d802adb0cc
3
+ metadata.gz: 9b06a7a145edcaee2bae05feafbd265c680a8e54
4
+ data.tar.gz: 70e85219456f494d6d3d0f8f337727ecbbede342
5
5
  SHA512:
6
- metadata.gz: a959f007b23c072abf2521e3ad6a7ea6684b5dec4cd975cea09030fa43dcbded2505827c2c82f9fbe808e3dea0ae1c6a8d03388c126fdaaaf9357e730a670112
7
- data.tar.gz: 72ec32afa7ee002abde26b19538ae2429d04afe55fe4d60b9bcf04155e8ff8486c545ad9d5a5375f657100d6597eb775f590d0baabe935dbb940abbe287a9e3e
6
+ metadata.gz: 88b446fd2edd5507ec973dd5926fc8b12b118c4e07f30bcb93a080d546905095ff87c08e683535d648b8801452d06188e1b9a41685911e356e2215a1545c206d
7
+ data.tar.gz: 65583c26a71fe5890e5f78dc9f885b17b9c5c169f8cb6ff95767971c50e82b7d3f8ae2f64f3a967b1612216db5590d7bdfe140fd5189d1fd22f52ae9b135d961
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.4.0 (2015-11-21)
2
+ - Old attributes and new attributes are no longer merged
3
+ - `Ast::Element#attributes` is left for compatibility
4
+
1
5
  # 0.3.0 (2015-11-16)
2
6
  - Add support for object reference syntax
3
7
  - Fix attribute parser for empty braces or parens
data/README.md CHANGED
@@ -42,17 +42,19 @@ Simple CLI interface is also available.
42
42
  tag_name="p",
43
43
  static_class="",
44
44
  static_id="",
45
- attributes="",
45
+ old_attributes=nil,
46
+ new_attributes=nil,
46
47
  oneline_child=
47
48
  #<struct HamlParser::Ast::Text
48
49
  text="hello world",
49
50
  escape_html=true,
50
- filename="in.haml",
51
+ filename="input.haml",
51
52
  lineno=1>,
52
53
  self_closing=false,
53
54
  nuke_inner_whitespace=false,
54
55
  nuke_outer_whitespace=false,
55
- filename="in.haml",
56
+ object_ref=nil,
57
+ filename="input.haml",
56
58
  lineno=1>]>
57
59
  ```
58
60
 
@@ -70,4 +72,3 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/eaglet
70
72
  ## License
71
73
 
72
74
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
73
-
@@ -34,7 +34,8 @@ module HamlParser
34
34
  :tag_name,
35
35
  :static_class,
36
36
  :static_id,
37
- :attributes,
37
+ :old_attributes,
38
+ :new_attributes,
38
39
  :oneline_child,
39
40
  :self_closing,
40
41
  :nuke_inner_whitespace,
@@ -49,7 +50,6 @@ module HamlParser
49
50
  super
50
51
  self.static_class ||= ''
51
52
  self.static_id ||= ''
52
- self.attributes ||= ''
53
53
  self.self_closing ||= false
54
54
  self.nuke_inner_whitespace ||= false
55
55
  self.nuke_outer_whitespace ||= false
@@ -61,6 +61,19 @@ module HamlParser
61
61
  oneline_child: oneline_child && oneline_child.to_h,
62
62
  )
63
63
  end
64
+
65
+ # XXX: For compatibility
66
+ def attributes
67
+ attrs = old_attributes || ''
68
+ if new_attributes
69
+ if attrs.empty?
70
+ attrs = new_attributes
71
+ else
72
+ attrs += ", #{new_attributes}"
73
+ end
74
+ end
75
+ attrs
76
+ end
64
77
  end
65
78
 
66
79
  Script = Struct.new(
@@ -26,7 +26,7 @@ module HamlParser
26
26
  element.static_class, element.static_id = parse_class_and_id(m[2])
27
27
  rest = m[3] || ''
28
28
 
29
- element.attributes, element.object_ref, rest = parse_attributes(rest)
29
+ element.old_attributes, element.new_attributes, element.object_ref, rest = parse_attributes(rest)
30
30
  element.nuke_inner_whitespace, element.nuke_outer_whitespace, rest = parse_nuke_whitespace(rest)
31
31
  element.self_closing, rest = parse_self_closing(rest)
32
32
  element.oneline_child = ScriptParser.new(@line_parser).parse(rest)
@@ -86,15 +86,7 @@ module HamlParser
86
86
  end
87
87
  end
88
88
 
89
- attributes = old_attributes || ''
90
- if new_attributes
91
- if attributes.empty?
92
- attributes = new_attributes
93
- else
94
- attributes << ', ' << new_attributes
95
- end
96
- end
97
- [attributes, object_ref, rest]
89
+ [old_attributes, new_attributes, object_ref, rest]
98
90
  end
99
91
 
100
92
  def parse_old_attributes(text)
@@ -1,3 +1,3 @@
1
1
  module HamlParser
2
- VERSION = '0.3.0'
2
+ VERSION = '0.4.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: haml_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kohei Suzuki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-11-16 00:00:00.000000000 Z
11
+ date: 2015-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: benchmark-ips
@@ -191,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
191
191
  version: '0'
192
192
  requirements: []
193
193
  rubyforge_project:
194
- rubygems_version: 2.4.5.1
194
+ rubygems_version: 2.5.0
195
195
  signing_key:
196
196
  specification_version: 4
197
197
  summary: Parser of Haml template language