hamlit 0.1.3 → 0.2.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: 5197e691717bb214cdad95076a339e333b5dd792
4
- data.tar.gz: 9c7c54d9caa52e82fc0b530a2e56a4ced80279f8
3
+ metadata.gz: a0955744ac46327a3e2115805e0a9dd6e8ea25b9
4
+ data.tar.gz: 076201b48858283fc206d95e6b9f2e379a97cb42
5
5
  SHA512:
6
- metadata.gz: da4d38596e82c4810fbdf9d89c5e4ea1e41f296b14bc515eba50e1ae23f3393ea9621750c89cad01a5b0e98afe26797b3aba14a1ea5136a1e34f79312a8e34b2
7
- data.tar.gz: 32c52ed264090db9a982b64f552e691c75fb74d28a7d4e542c98348e04fd639c86014aad59c8d70a9a98f0621abb94ecd4503b31a3524cf14cc59a89f4c5642e
6
+ metadata.gz: 08fadc2c1c196c6925dfde247ecb22ead01257ca71f2d68a20e15509d2fb8ecc9087c08b9291dafd6bee28c1a43a3caf75d20af023b2b3c455ede4d3016e6308
7
+ data.tar.gz: 467bdeb99dc78710fce307dff15f85425b31a3fa41fc938065be7a75777213b4dbbaac02de178f81583c5b98de4e4cfa38e1ba49a65dbc1b6803d0df8807ae70
@@ -70,7 +70,16 @@ module Hamlit
70
70
  scanner = StringScanner.new(current_line)
71
71
  code += ' '
72
72
  end
73
- code
73
+ remove_comment(code)
74
+ end
75
+
76
+ def remove_comment(code)
77
+ result = ''
78
+ Ripper.lex(code).each do |(row, col), type, str|
79
+ next if type == :on_comment
80
+ result += str
81
+ end
82
+ result
74
83
  end
75
84
 
76
85
  def has_block?
@@ -1,3 +1,3 @@
1
1
  module Hamlit
2
- VERSION = "0.1.3"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -10,6 +10,17 @@ describe Hamlit::Engine do
10
10
  HTML
11
11
  end
12
12
 
13
+ it 'renders one-line script with comment' do
14
+ assert_render(<<-HAML, <<-HTML)
15
+ = '#' + "#" # = 3 #
16
+ = ['#',
17
+ "#"] # comment
18
+ HAML
19
+ ##
20
+ ["#", "#"]
21
+ HTML
22
+ end
23
+
13
24
  it 'renders multi-lines script' do
14
25
  assert_render(<<-HAML, <<-HTML)
15
26
  %span
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.1.3
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takashi Kokubun