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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 589dbe0a0efbde62a5437b07ade45e68dc624d13
4
- data.tar.gz: 2b3e774c00a75aa76bb37288621c5d6e094dc9ea
3
+ metadata.gz: e756559116af74788e49931a9ad0dd6c854e7b54
4
+ data.tar.gz: 8197695fe868552cea974c23745a1691429cc49b
5
5
  SHA512:
6
- metadata.gz: e0ab4508a37e1d0d32ec8a3c715d8ba3117e8a94b3aa370e16ec8a22d2183c86f4ad2c290d89c18736e3f10d120412922e0eb0466aec79c36dabcaf2aac354c3
7
- data.tar.gz: 95c5614a000b96260bc277cc8cfff24505fb8d5ae6d7780ededb1178f92c3bce97525961004ee63f54ea319901add91f6a63abf68a0fd9c559680aedd014de56
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
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Antelope
4
4
  # The current running version of antelope.
5
- VERSION = "0.1.10".freeze
5
+ VERSION = "0.1.11".freeze
6
6
  end
@@ -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\\n"
28
+ _out << "hello"
29
29
  _out << begin
30
30
  something
31
31
  end.to_s
32
- _out << "\\nworld\\n\\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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: antelope
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Rodi