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 +4 -4
- data/lib/hamlit/parsers/script.rb +10 -1
- data/lib/hamlit/version.rb +1 -1
- data/spec/hamlit/engine/script_spec.rb +11 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0955744ac46327a3e2115805e0a9dd6e8ea25b9
|
4
|
+
data.tar.gz: 076201b48858283fc206d95e6b9f2e379a97cb42
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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?
|
data/lib/hamlit/version.rb
CHANGED
@@ -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
|