cuporter 0.3.3 → 0.3.4

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/Rakefile CHANGED
@@ -56,7 +56,7 @@ namespace :cuporter do
56
56
 
57
57
  spec = Gem::Specification.new do |s|
58
58
  s.name = 'cuporter'
59
- s.version = '0.3.3'
59
+ s.version = '0.3.4'
60
60
  s.rubyforge_project = s.name
61
61
 
62
62
  s.platform = Gem::Platform::RUBY
@@ -3,6 +3,16 @@ module StringExtensions
3
3
  def to_class_name
4
4
  gsub(/(^|_)([a-zA-Z])/) {$2.upcase}
5
5
  end
6
+
7
+ APOSTROPHE = "\047"
8
+ APOS_ENTITY = "'"
9
+ def escape_apostrophe
10
+ gsub(APOSTROPHE, APOS_ENTITY)
11
+ end
12
+
13
+ def unescape_apostrophe
14
+ gsub(APOS_ENTITY, APOSTROPHE)
15
+ end
6
16
  end
7
17
 
8
18
  class String
@@ -2,14 +2,14 @@
2
2
 
3
3
  module Cuporter
4
4
  class FeatureParser
5
- FEATURE_LINE = /^\s*(Feature:[^#]*)/
6
- TAG_LINE = /^\s*(@\w.+)/
7
- SCENARIO_LINE = /^\s*(Scenario:[^#]*)$/
8
- SCENARIO_OUTLINE_LINE = /^\s*(Scenario Outline:[^#]*)$/
9
- SCENARIO_SET_LINE = /^\s*(Scenarios:[^#]*)$/
10
- EXAMPLE_SET_LINE = /^\s*(Examples:[^#]*)$/
11
- EXAMPLE_LINE = /^\s*(\|.*\|)\s*$/
12
- PY_STRING_LINE = /^\s*"""\s*$/
5
+ FEATURE_LINE = /^\s*(Feature:[^#]*)/u
6
+ TAG_LINE = /^\s*(@\w.+)/u
7
+ SCENARIO_LINE = /^\s*(Scenario:[^#]*)$/u
8
+ SCENARIO_OUTLINE_LINE = /^\s*(Scenario Outline:[^#]*)$/u
9
+ SCENARIO_SET_LINE = /^\s*(Scenarios:[^#]*)$/u
10
+ EXAMPLE_SET_LINE = /^\s*(Examples:[^#]*)$/u
11
+ EXAMPLE_LINE = /^\s*(\|.*\|)\s*$/u
12
+ PY_STRING_LINE = /^\s*"""\s*$/u
13
13
 
14
14
  # adds a node to the doc for each cucumber '@' tag, populated with features and
15
15
  # scenarios
@@ -49,30 +49,30 @@ module Cuporter
49
49
  @open_comment_block = !@open_comment_block
50
50
  when TAG_LINE
51
51
  # may be more than one tag line
52
- @current_tags |= $1.strip.split(/\s+/)
52
+ @current_tags |= clean_cuke_line($1).split(/\s+/)
53
53
  when FEATURE_LINE
54
- @feature = new_feature_node($1.strip, file_relative_path)
54
+ @feature = new_feature_node(clean_cuke_line($1), file_relative_path)
55
55
  @current_tags = []
56
56
  when SCENARIO_LINE
57
57
  # How do we know when we have read all the lines from a "Scenario Outline:"?
58
58
  # One way is when we encounter a "Scenario:"
59
59
  close_scenario_outline
60
60
 
61
- handle_scenario_line($1.strip)
61
+ handle_scenario_line(clean_cuke_line($1))
62
62
  @current_tags = []
63
63
  when SCENARIO_OUTLINE_LINE
64
64
  # ... another is when we hit a subsequent "Scenario Outline:"
65
65
  close_scenario_outline
66
66
 
67
- @scenario_outline = new_scenario_outline_node($1.strip)
67
+ @scenario_outline = new_scenario_outline_node(clean_cuke_line($1))
68
68
  @current_tags = []
69
69
  when EXAMPLE_SET_LINE, SCENARIO_SET_LINE
70
70
  handle_example_set_line if @example_set
71
71
 
72
- @example_set = new_example_set_node($1.strip)
72
+ @example_set = new_example_set_node(clean_cuke_line($1))
73
73
  @current_tags = []
74
74
  when @example_set && EXAMPLE_LINE
75
- new_example_line($1.strip)
75
+ new_example_line(clean_cuke_line($1))
76
76
  end
77
77
  end
78
78
 
@@ -81,5 +81,8 @@ module Cuporter
81
81
  return @feature
82
82
  end
83
83
 
84
+ def clean_cuke_line(sub_expression)
85
+ sub_expression.strip.escape_apostrophe
86
+ end
84
87
  end
85
88
  end
@@ -35,7 +35,7 @@ module Cuporter
35
35
  end
36
36
 
37
37
  def cuke_name(value)
38
- "#{value},"
38
+ "#{value ? value.unescape_apostrophe : nil},"
39
39
  end
40
40
 
41
41
  def fs_name(value)
@@ -131,7 +131,8 @@ module Cuporter
131
131
  l
132
132
  end
133
133
  def cuke_name(value)
134
- value || ""
134
+ return "" unless value
135
+ value.unescape_apostrophe
135
136
  end
136
137
  def fs_name(value)
137
138
  return "" unless value
@@ -242,7 +242,7 @@
242
242
  <xsl:template match="@cuke_name">
243
243
  <xsl:element name="span">
244
244
  <xsl:attribute name="class">cuke_name</xsl:attribute>
245
- <xsl:value-of select="."/>
245
+ <xsl:value-of select="." disable-output-escaping="yes"/>
246
246
  </xsl:element>
247
247
  </xsl:template>
248
248
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cuporter
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 3
10
- version: 0.3.3
9
+ - 4
10
+ version: 0.3.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tim Camper