antelope 0.1.10 → 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/antelope/template/scanner.rb +10 -7
- data/lib/antelope/version.rb +1 -1
- data/spec/antelope/template_spec.rb +12 -2
- 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: e756559116af74788e49931a9ad0dd6c854e7b54
|
4
|
+
data.tar.gz: 8197695fe868552cea974c23745a1691429cc49b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96a4da9fa6114fc0eaf54da4cc8e8476c915ff309e5814b2d21dc6a5ef6b242ee44f5788cbc930030279e549c8b5796f7357cc08b99a569198da96cc79cabd58
|
7
|
+
data.tar.gz: 2f9cc8c84095e049b4dfbf26f5ed851bca8f835e4fe2b2b2e1d1c90473f37eae05d963d72280fadb7abc38c73992e4d5a58e4d42560d5358a6de9f4a3cc46ba5
|
@@ -48,7 +48,7 @@ module Antelope
|
|
48
48
|
|
49
49
|
def scan_until_tag
|
50
50
|
case
|
51
|
-
when value = @scanner.scan_until(/(\%|\{|\}
|
51
|
+
when value = @scanner.scan_until(/(\%|\{|\}|\\|\n)/)
|
52
52
|
@scanner.pos -= 1
|
53
53
|
tokens << [:text, value[0..-2]]
|
54
54
|
end
|
@@ -62,22 +62,25 @@ module Antelope
|
|
62
62
|
case
|
63
63
|
when @scanner.scan(/\\(\{\{|\}\}|\%)/)
|
64
64
|
tokens << [:text, @scanner[1]]
|
65
|
-
when @scanner.scan(
|
65
|
+
when @scanner.scan(/\n?\%\{/)
|
66
|
+
update_line
|
66
67
|
scan_tag_start(:output_tag, :_, /\}/)
|
67
|
-
when @scanner.scan(
|
68
|
+
when @scanner.scan(/\n?\%/)
|
69
|
+
update_line
|
68
70
|
tokens << [:tag, value]
|
69
|
-
when @scanner.scan(/\{\{=/)
|
71
|
+
when @scanner.scan(/\n?\{\{=/)
|
70
72
|
update_line
|
71
73
|
scan_tag_start(:output_tag)
|
72
|
-
when @scanner.scan(/\{\{!/)
|
74
|
+
when @scanner.scan(/\n?\{\{!/)
|
73
75
|
update_line
|
74
76
|
scan_tag_start(:comment_tag)
|
75
|
-
when @scanner.scan(/\{\{/)
|
77
|
+
when @scanner.scan(/\n?\{\{/)
|
78
|
+
update_line
|
76
79
|
scan_tag_start(:tag)
|
77
80
|
when @scanner.scan(/\}\}/)
|
78
81
|
@scanner.pos -= 2
|
79
82
|
error!
|
80
|
-
when @scanner.scan(/\{|\}
|
83
|
+
when @scanner.scan(/\{|\}|\%|\\|\n/)
|
81
84
|
tokens << [:text, @scanner[0]]
|
82
85
|
else
|
83
86
|
false
|
data/lib/antelope/version.rb
CHANGED
@@ -25,15 +25,25 @@ TEST
|
|
25
25
|
it "removes surrounding whitespace" do
|
26
26
|
expect(subject.parse).to eq <<-TEST
|
27
27
|
_out ||= ""
|
28
|
-
_out << "hello
|
28
|
+
_out << "hello"
|
29
29
|
_out << begin
|
30
30
|
something
|
31
31
|
end.to_s
|
32
|
-
_out << "\\nworld\\n
|
32
|
+
_out << "\\nworld\\n"
|
33
33
|
thing
|
34
34
|
_out << "\\na\\n\\n"
|
35
35
|
_out
|
36
36
|
TEST
|
37
37
|
end
|
38
|
+
|
39
|
+
it "runs in ruby" do
|
40
|
+
object = Object.new
|
41
|
+
result = nil
|
42
|
+
def object.something; "-" end
|
43
|
+
def object.thing; end
|
44
|
+
|
45
|
+
expect { result = object.instance_eval(subject.parse) }.to_not raise_error
|
46
|
+
expect(result).to eq "hello-\nworld\n\na\n\n"
|
47
|
+
end
|
38
48
|
end
|
39
49
|
end
|