hamlit 1.7.1 → 1.7.2

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: 50ca5880135de7cd06fcf6780fc4dbaffbf6ea43
4
- data.tar.gz: 804e0196607cf692780d87ed61f6895391584cc1
3
+ metadata.gz: 97c6e8e207573918bcdc35f2d9c5092221906577
4
+ data.tar.gz: 466188f7c1a06f359f33b85406263b8fc697b77b
5
5
  SHA512:
6
- metadata.gz: be851f631b5d947500998063fa534d791c551e0c4bf21a12ae844919ac0dc8124906d397a4f905d484c1149c305d18719e1c02fae88ed2633c277eda2d84bbef
7
- data.tar.gz: 722440d70b6da6048b9231f1094b6cdce48a7b7da00193b43ba125d4435a621df2b27344d54a97ac02b07bc28721215cf3332a14548a1b7c683e23f0f04e1db2
6
+ metadata.gz: 324a94fe243be2497ef6d0ab786386b6f281d2ab990396863e90cdad800f815578c2228bf6df3f2a85de7034e3621394456f6b20235701c70538e3f90ebc9c42
7
+ data.tar.gz: c69e5ed58abd2d603b54cd4915ffc90c00242f6fa9225b6db7be726c6f7aec01a2a2348c267dd2b1c3f3c0a2cc87700350286a4deebd237845ed56dea2e83170
@@ -1,3 +1,8 @@
1
+ ## v1.7.2
2
+
3
+ - Bugfix about parsing a content of tag
4
+ - This was introduced in v1.6.6.
5
+
1
6
  ## v1.7.1
2
7
 
3
8
  - Don't escape a block content of some helpers
@@ -23,7 +23,7 @@
23
23
  ```
24
24
 
25
25
 
26
- # [new\_attribute\_spec.rb:31](/spec/hamlit/engine/new_attribute_spec.rb#L31)
26
+ # [new\_attribute\_spec.rb:47](/spec/hamlit/engine/new_attribute_spec.rb#L47)
27
27
  ## Input
28
28
  ```haml
29
29
  %a(title="'")
@@ -50,7 +50,7 @@
50
50
  ```
51
51
 
52
52
 
53
- # [new\_attribute\_spec.rb:43](/spec/hamlit/engine/new_attribute_spec.rb#L43)
53
+ # [new\_attribute\_spec.rb:59](/spec/hamlit/engine/new_attribute_spec.rb#L59)
54
54
  ## Input
55
55
  ```haml
56
56
  - title = "'\""
@@ -26,7 +26,7 @@ Faml::Compiler::UnparsableRubyCode: Unparsable Ruby code is given to attributes:
26
26
  ```
27
27
 
28
28
 
29
- # [old\_attributes\_spec.rb:124](/spec/hamlit/engine/old_attributes_spec.rb#L124)
29
+ # [old\_attributes\_spec.rb:132](/spec/hamlit/engine/old_attributes_spec.rb#L132)
30
30
  ## Input
31
31
  ```haml
32
32
  .foo{ class: ['bar'] }
@@ -56,7 +56,7 @@ Faml::Compiler::UnparsableRubyCode: Unparsable Ruby code is given to attributes:
56
56
  ```
57
57
 
58
58
 
59
- # [old\_attributes\_spec.rb:203](/spec/hamlit/engine/old_attributes_spec.rb#L203)
59
+ # [old\_attributes\_spec.rb:211](/spec/hamlit/engine/old_attributes_spec.rb#L211)
60
60
  ## Input
61
61
  ```haml
62
62
  / wontfix: Non-boolean attributes are not escaped for optimization.
@@ -97,7 +97,7 @@ Faml::Compiler::UnparsableRubyCode: Unparsable Ruby code is given to attributes:
97
97
  ```
98
98
 
99
99
 
100
- # [old\_attributes\_spec.rb:228](/spec/hamlit/engine/old_attributes_spec.rb#L228)
100
+ # [old\_attributes\_spec.rb:236](/spec/hamlit/engine/old_attributes_spec.rb#L236)
101
101
  ## Input
102
102
  ```haml
103
103
  %a{title: "'"}
@@ -124,7 +124,7 @@ Faml::Compiler::UnparsableRubyCode: Unparsable Ruby code is given to attributes:
124
124
  ```
125
125
 
126
126
 
127
- # [old\_attributes\_spec.rb:240](/spec/hamlit/engine/old_attributes_spec.rb#L240)
127
+ # [old\_attributes\_spec.rb:248](/spec/hamlit/engine/old_attributes_spec.rb#L248)
128
128
  ## Input
129
129
  ```haml
130
130
  - title = "'\""
@@ -150,7 +150,7 @@ Faml::Compiler::UnparsableRubyCode: Unparsable Ruby code is given to attributes:
150
150
  ```
151
151
 
152
152
 
153
- # [old\_attributes\_spec.rb:252](/spec/hamlit/engine/old_attributes_spec.rb#L252)
153
+ # [old\_attributes\_spec.rb:260](/spec/hamlit/engine/old_attributes_spec.rb#L260)
154
154
  ## Input
155
155
  ```haml
156
156
  - title = { title: "'\"" }
@@ -176,7 +176,7 @@ Faml::Compiler::UnparsableRubyCode: Unparsable Ruby code is given to attributes:
176
176
  ```
177
177
 
178
178
 
179
- # [old\_attributes\_spec.rb:275](/spec/hamlit/engine/old_attributes_spec.rb#L275)
179
+ # [old\_attributes\_spec.rb:283](/spec/hamlit/engine/old_attributes_spec.rb#L283)
180
180
  ## Input
181
181
  ```haml
182
182
  %span{ data: { disable: true } } bar
@@ -18,7 +18,7 @@ Faml::Compiler::UnparsableRubyCode: Unparsable Ruby code is given to attributes:
18
18
  ```
19
19
 
20
20
 
21
- # [old\_attributes\_spec.rb:124](/spec/hamlit/engine/old_attributes_spec.rb#L124)
21
+ # [old\_attributes\_spec.rb:132](/spec/hamlit/engine/old_attributes_spec.rb#L132)
22
22
  ## Input
23
23
  ```haml
24
24
  .foo{ class: ['bar'] }
@@ -48,7 +48,7 @@ Faml::Compiler::UnparsableRubyCode: Unparsable Ruby code is given to attributes:
48
48
  ```
49
49
 
50
50
 
51
- # [old\_attributes\_spec.rb:203](/spec/hamlit/engine/old_attributes_spec.rb#L203)
51
+ # [old\_attributes\_spec.rb:211](/spec/hamlit/engine/old_attributes_spec.rb#L211)
52
52
  ## Input
53
53
  ```haml
54
54
  / wontfix: Non-boolean attributes are not escaped for optimization.
@@ -89,7 +89,7 @@ Faml::Compiler::UnparsableRubyCode: Unparsable Ruby code is given to attributes:
89
89
  ```
90
90
 
91
91
 
92
- # [old\_attributes\_spec.rb:275](/spec/hamlit/engine/old_attributes_spec.rb#L275)
92
+ # [old\_attributes\_spec.rb:283](/spec/hamlit/engine/old_attributes_spec.rb#L283)
93
93
  ## Input
94
94
  ```haml
95
95
  %span{ data: { disable: true } } bar
@@ -23,7 +23,7 @@
23
23
  ```
24
24
 
25
25
 
26
- # [new\_attribute\_spec.rb:31](/spec/hamlit/engine/new_attribute_spec.rb#L31)
26
+ # [new\_attribute\_spec.rb:47](/spec/hamlit/engine/new_attribute_spec.rb#L47)
27
27
  ## Input
28
28
  ```haml
29
29
  %a(title="'")
@@ -50,7 +50,7 @@
50
50
  ```
51
51
 
52
52
 
53
- # [new\_attribute\_spec.rb:43](/spec/hamlit/engine/new_attribute_spec.rb#L43)
53
+ # [new\_attribute\_spec.rb:59](/spec/hamlit/engine/new_attribute_spec.rb#L59)
54
54
  ## Input
55
55
  ```haml
56
56
  - title = "'\""
@@ -21,7 +21,7 @@ Haml::SyntaxError: (haml):1: syntax error, unexpected tSTRING_DEND, expecting ')
21
21
  ```
22
22
 
23
23
 
24
- # [old\_attributes\_spec.rb:203](/spec/hamlit/engine/old_attributes_spec.rb#L203)
24
+ # [old\_attributes\_spec.rb:211](/spec/hamlit/engine/old_attributes_spec.rb#L211)
25
25
  ## Input
26
26
  ```haml
27
27
  / wontfix: Non-boolean attributes are not escaped for optimization.
@@ -62,7 +62,7 @@ Haml::SyntaxError: (haml):1: syntax error, unexpected tSTRING_DEND, expecting ')
62
62
  ```
63
63
 
64
64
 
65
- # [old\_attributes\_spec.rb:228](/spec/hamlit/engine/old_attributes_spec.rb#L228)
65
+ # [old\_attributes\_spec.rb:236](/spec/hamlit/engine/old_attributes_spec.rb#L236)
66
66
  ## Input
67
67
  ```haml
68
68
  %a{title: "'"}
@@ -89,7 +89,7 @@ Haml::SyntaxError: (haml):1: syntax error, unexpected tSTRING_DEND, expecting ')
89
89
  ```
90
90
 
91
91
 
92
- # [old\_attributes\_spec.rb:240](/spec/hamlit/engine/old_attributes_spec.rb#L240)
92
+ # [old\_attributes\_spec.rb:248](/spec/hamlit/engine/old_attributes_spec.rb#L248)
93
93
  ## Input
94
94
  ```haml
95
95
  - title = "'\""
@@ -115,7 +115,7 @@ Haml::SyntaxError: (haml):1: syntax error, unexpected tSTRING_DEND, expecting ')
115
115
  ```
116
116
 
117
117
 
118
- # [old\_attributes\_spec.rb:252](/spec/hamlit/engine/old_attributes_spec.rb#L252)
118
+ # [old\_attributes\_spec.rb:260](/spec/hamlit/engine/old_attributes_spec.rb#L260)
119
119
  ## Input
120
120
  ```haml
121
121
  - title = { title: "'\"" }
@@ -29,12 +29,12 @@ module Hamlit
29
29
  def parse_old_attributes(scanner)
30
30
  return [] unless scanner.match?(/{/)
31
31
 
32
- tokens = Ripper.lex(scanner.rest.sub(ATTRIBUTE_BEGIN, METHOD_CALL_PREFIX))
32
+ tokens = try_lex(scanner.rest.sub(ATTRIBUTE_BEGIN, METHOD_CALL_PREFIX))
33
33
  until balanced_embexprs_exist?(tokens, start_count: BALANCE_START_COUNT)
34
34
  @current_lineno += 1
35
35
  break unless @lines[@current_lineno]
36
36
  scanner.concat(current_line)
37
- tokens = Ripper.lex(scanner.rest.sub(ATTRIBUTE_BEGIN, METHOD_CALL_PREFIX))
37
+ tokens = try_lex(scanner.rest.sub(ATTRIBUTE_BEGIN, METHOD_CALL_PREFIX))
38
38
  end
39
39
 
40
40
  tokens = fetch_balanced_embexprs(tokens, start_count: BALANCE_START_COUNT)
@@ -58,6 +58,14 @@ module Hamlit
58
58
  scanner.pos += convert_position(text, *tokens.last.first) + 1
59
59
  [text]
60
60
  end
61
+
62
+ # Ripper.lex pulls invalid tokens first.
63
+ # This method rejects these invalid tokens.
64
+ def try_lex(str)
65
+ Ripper.lex(str).reject do |(row, col), type, str|
66
+ row == 0
67
+ end
68
+ end
61
69
  end
62
70
  end
63
71
  end
@@ -1,3 +1,3 @@
1
1
  module Hamlit
2
- VERSION = "1.7.1"
2
+ VERSION = "1.7.2"
3
3
  end
@@ -56,6 +56,14 @@ describe Hamlit::Engine do
56
56
  HTML
57
57
  end
58
58
 
59
+ it 'accepts tag content' do
60
+ assert_render(<<-'HAML', <<-HTML)
61
+ %span{ class: 'foo' } <b>bar</b>
62
+ HAML
63
+ <span class='foo'><b>bar</b></span>
64
+ HTML
65
+ end
66
+
59
67
  it 'renders multi-byte chars as static attribute value' do
60
68
  assert_render(<<-'HAML', <<-HTML)
61
69
  %img{ alt: 'こんにちは' }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hamlit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.1
4
+ version: 1.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takashi Kokubun
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-21 00:00:00.000000000 Z
11
+ date: 2015-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: escape_utils
@@ -626,4 +626,3 @@ test_files:
626
626
  - spec/spec_helper/document_generator.rb
627
627
  - spec/spec_helper/render_helper.rb
628
628
  - spec/spec_helper/test_case.rb
629
- has_rdoc: