macros4cuke 0.1.06 → 0.1.07

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/HISTORY.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## [0.1.07]
2
+ ### Changes:
3
+ * Added new class TemplateEngine.
4
+
5
+
1
6
  ## [0.1.06]
2
7
 
3
8
  ### Documentation:
@@ -3,7 +3,7 @@
3
3
 
4
4
  module Macros4Cuke # Module used as a namespace
5
5
  # This constant keeps the current version of the gem.
6
- Version = '0.1.06'
6
+ Version = '0.1.07'
7
7
 
8
8
  Description = "Macros for Cucumber"
9
9
 
@@ -9,7 +9,6 @@ module Macros4Cuke # Module used as a namespace
9
9
  class TemplateEngine
10
10
 
11
11
  def self.parse(aTextLine)
12
- #return [] if aTextLine.empty?
13
12
  scanner = StringScanner.new(aTextLine)
14
13
  result = []
15
14
 
@@ -17,31 +16,22 @@ class TemplateEngine
17
16
  # Scan tag at current position...
18
17
  tag_literal = scanner.scan(/<(?:[^\\<>]|\\.)*>/)
19
18
  result << [:dynamic, tag_literal.gsub(/^<|>$/, '')] unless tag_literal.nil?
20
- # TODO: remove next line
21
- p tag_literal unless tag_literal.nil?
22
19
 
23
20
  # ... or scan plain text at current position
24
21
  text_literal = scanner.scan(/(?:[^\\<>]|\\.)+/)
25
22
  result << [:static, text_literal] unless text_literal.nil?
26
- # TODO: remove next line
27
- p text_literal unless text_literal.nil?
28
23
 
29
24
  if tag_literal.nil? && text_literal.nil?
30
25
  # Unsuccessful scanning: we have improperly balanced chevrons.
31
26
  # We will analyze the opening and closing chevrons...
32
- p aTextLine
33
- no_escaped = aTextLine.gsub(/\\<|\\>/, "--") # First: replace escaped chevron(s)
34
- p no_escaped
27
+ no_escaped = aTextLine.gsub(/\\[<>]/, "--") # First: replace escaped chevron(s)
35
28
  unbalance = 0 # = count of < - count of > (can only be 0 or -temporarily- 1)
36
29
 
37
30
  no_escaped.scan(/(.)/) do |match|
38
- p match
39
31
  case match[0]
40
32
  when '<'
41
- p "found <"
42
33
  unbalance += 1
43
34
  when '>'
44
- p 'found >'
45
35
  unbalance -= 1
46
36
  end
47
37
 
@@ -50,7 +40,7 @@ class TemplateEngine
50
40
  end
51
41
 
52
42
  raise StandardError, "Missing closing chevron '>'." if unbalance == 1
53
- raise StandardError, "Internal error[unbalance=#{unbalance}]. Cannot parse:\n'#{aTextLine}'"
43
+ raise StandardError, "Cannot parse:\n'#{aTextLine}'"
54
44
  end
55
45
  end
56
46
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: macros4cuke
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.06
4
+ version: 0.1.07
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: