Almirah 0.2.4 → 0.2.5
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.
- checksums.yaml +4 -4
- data/lib/almirah/doc_items/doc_item.rb +16 -14
- data/lib/almirah/doc_items/frontmatter.rb +9 -0
- data/lib/almirah/doc_items/markdown_list.rb +1 -3
- data/lib/almirah/doc_items/markdown_table.rb +1 -3
- data/lib/almirah/doc_items/paragraph.rb +18 -20
- data/lib/almirah/doc_parser.rb +71 -23
- data/lib/almirah/doc_types/base_document.rb +56 -62
- data/lib/almirah/doc_types/coverage.rb +65 -66
- data/lib/almirah/doc_types/index.rb +167 -163
- data/lib/almirah/doc_types/persistent_document.rb +14 -17
- data/lib/almirah/dom/document.rb +6 -0
- data/lib/almirah/project.rb +1 -20
- data/lib/almirah/project_template.rb +298 -0
- data/lib/almirah/search/specifications_db.rb +66 -70
- data/lib/almirah.rb +32 -23
- metadata +27 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71154c27766a7774835e0c6b51d555c859cadb28297f4f66c40e8687dcf53692
|
4
|
+
data.tar.gz: 6ec9713d086508afe732073729a8e97e3ac5bb985e43a111f29608d6de87948c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b56be1e40f2ebdafffe0bdac306f98f015e7221f98ee87305cf3e574b19824ef44513f11c8a1912414673b4d7fe582797f9d58dcf49654e701f76bfb0e221dd7
|
7
|
+
data.tar.gz: 6a389036b0e41048be97450e7148853adfa192eebf14725cb912c8baebb159f4d0940481e668a5292ad26607ade67742b4edbde7be36dab769b1df6db17fc92a
|
@@ -1,20 +1,22 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
attr_accessor :parent_doc
|
5
|
-
attr_accessor :parent_heading
|
6
|
-
|
7
|
-
@parent_doc = nil
|
8
|
-
@parent_heading = nil
|
9
|
-
|
10
|
-
@@html_table_render_in_progress = false
|
11
|
-
|
12
|
-
def get_url
|
13
|
-
''
|
14
|
-
end
|
15
|
-
end
|
3
|
+
require_relative 'text_line'
|
16
4
|
|
5
|
+
class DocItem < TextLine # rubocop:disable Style/Documentation
|
6
|
+
attr_accessor :parent_doc, :parent_heading
|
17
7
|
|
8
|
+
@parent_doc = nil
|
9
|
+
@parent_heading = nil
|
18
10
|
|
11
|
+
@@html_table_render_in_progress = false # rubocop:disable Style/ClassVars
|
19
12
|
|
13
|
+
def initialize(doc)
|
14
|
+
super()
|
15
|
+
@parent_doc = doc
|
16
|
+
@parent_heading = doc.headings[-1]
|
17
|
+
end
|
20
18
|
|
19
|
+
def get_url
|
20
|
+
''
|
21
|
+
end
|
22
|
+
end
|
@@ -6,9 +6,7 @@ class MarkdownTable < DocItem
|
|
6
6
|
attr_accessor :column_names, :rows, :heading_row, :is_separator_detected
|
7
7
|
|
8
8
|
def initialize(doc, heading_row)
|
9
|
-
super()
|
10
|
-
@parent_doc = doc
|
11
|
-
@parent_heading = doc.headings[-1]
|
9
|
+
super(doc)
|
12
10
|
@heading_row = heading_row
|
13
11
|
|
14
12
|
res = /^[|](.*[|])/.match(heading_row)
|
@@ -1,27 +1,25 @@
|
|
1
|
-
require_relative
|
1
|
+
require_relative 'doc_item'
|
2
2
|
|
3
3
|
class Paragraph < DocItem
|
4
|
+
attr_accessor :text
|
4
5
|
|
5
|
-
|
6
|
+
def initialize(doc, text)
|
7
|
+
super(doc)
|
8
|
+
@text = text.strip
|
9
|
+
end
|
6
10
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
@text = text.strip
|
11
|
-
end
|
11
|
+
def getTextWithoutSpaces
|
12
|
+
@text.split.join('-').downcase
|
13
|
+
end
|
12
14
|
|
13
|
-
|
14
|
-
|
15
|
+
def to_html
|
16
|
+
s = ''
|
17
|
+
if @@html_table_render_in_progress
|
18
|
+
s += '</table>'
|
19
|
+
@@html_table_render_in_progress = false
|
15
20
|
end
|
16
21
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
@@html_table_render_in_progress = false
|
22
|
-
end
|
23
|
-
|
24
|
-
s += "<p>" + format_string(@text)
|
25
|
-
return s
|
26
|
-
end
|
27
|
-
end
|
22
|
+
s += "<p>#{format_string(@text)}"
|
23
|
+
s
|
24
|
+
end
|
25
|
+
end
|
data/lib/almirah/doc_parser.rb
CHANGED
@@ -11,15 +11,53 @@ require_relative 'doc_items/controlled_table'
|
|
11
11
|
require_relative 'doc_items/image'
|
12
12
|
require_relative 'doc_items/markdown_list'
|
13
13
|
require_relative 'doc_items/doc_footer'
|
14
|
+
require_relative 'doc_items/frontmatter'
|
15
|
+
|
16
|
+
class DocParser # rubocop:disable Metrics/ClassLength,Style/Documentation
|
17
|
+
def self.try_to_extract_frontmatter(doc, text_lines) # rubocop:disable Metrics/MethodLength
|
18
|
+
lines_to_remove = 0
|
19
|
+
frontmatter_lines = ''
|
20
|
+
if /^(-{3,})/.match(text_lines[0])
|
21
|
+
frontmatter_started = false
|
22
|
+
text_lines.each do |s|
|
23
|
+
lines_to_remove += 1
|
24
|
+
if /^(-{3,})/.match(s)
|
25
|
+
if frontmatter_started
|
26
|
+
doc.frontmatter = Frontmatter.new(frontmatter_lines)
|
27
|
+
frontmatter_started = false
|
28
|
+
break
|
29
|
+
else
|
30
|
+
frontmatter_started = true
|
31
|
+
end
|
32
|
+
elsif frontmatter_started
|
33
|
+
frontmatter_lines += s
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
text_lines.shift(lines_to_remove)
|
38
|
+
text_lines
|
39
|
+
end
|
14
40
|
|
15
|
-
class DocParser
|
16
41
|
def self.parse(doc, text_lines)
|
17
42
|
temp_md_table = nil
|
18
43
|
temp_md_list = nil
|
19
44
|
temp_code_block = nil
|
20
45
|
# restart section numbering for each new document
|
21
46
|
Heading.reset_global_section_number
|
22
|
-
|
47
|
+
# try to get frontmatter first
|
48
|
+
text_lines = try_to_extract_frontmatter(doc, text_lines)
|
49
|
+
# There is no document without heading
|
50
|
+
title = "#{doc.id}.md"
|
51
|
+
item = Heading.new(doc, title, 0)
|
52
|
+
doc.items.append(item)
|
53
|
+
doc.headings.append(item)
|
54
|
+
doc.title = title
|
55
|
+
# replace dummy title with extracted from frontmatter
|
56
|
+
if doc.frontmatter && (doc.frontmatter.parameters.key? 'title')
|
57
|
+
doc.title = doc.frontmatter.parameters['title']
|
58
|
+
doc.headings[0].text = doc.frontmatter.parameters['title']
|
59
|
+
end
|
60
|
+
# main loop
|
23
61
|
text_lines.each do |s|
|
24
62
|
if s.lstrip != ''
|
25
63
|
if res = /^(\#{1,})\s(.*)/.match(s) # Heading
|
@@ -33,10 +71,6 @@ class DocParser
|
|
33
71
|
level = res[1].length
|
34
72
|
value = res[2]
|
35
73
|
|
36
|
-
if level == 1 && doc.title == ''
|
37
|
-
doc.title = value
|
38
|
-
end
|
39
|
-
|
40
74
|
item = Heading.new(doc, value, level)
|
41
75
|
doc.items.append(item)
|
42
76
|
doc.headings.append(item)
|
@@ -45,13 +79,9 @@ class DocParser
|
|
45
79
|
|
46
80
|
title = res[1]
|
47
81
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
item = Heading.new(doc, title, 0)
|
53
|
-
doc.items.append(item)
|
54
|
-
doc.headings.append(item)
|
82
|
+
# Rewrite
|
83
|
+
doc.title = title
|
84
|
+
doc.headings[0].text = title
|
55
85
|
|
56
86
|
elsif res = /^\[(\S*)\]\s+(.*)/.match(s) # Controlled Paragraph
|
57
87
|
|
@@ -72,12 +102,10 @@ class DocParser
|
|
72
102
|
if tmp.length > 0
|
73
103
|
up_links = []
|
74
104
|
tmp.each do |ul|
|
75
|
-
lnk = ul[0]
|
105
|
+
lnk = ul[0]
|
76
106
|
# do not add links for the self document
|
77
107
|
doc_id = /([a-zA-Z]+)-\d+/.match(lnk) # SRS
|
78
|
-
if
|
79
|
-
up_links << lnk.upcase
|
80
|
-
end
|
108
|
+
up_links << lnk.upcase if doc_id and (doc_id[1].downcase != doc.id.downcase)
|
81
109
|
# try to find the real end of text
|
82
110
|
pos = text.index(lnk)
|
83
111
|
first_pos = pos if pos < first_pos
|
@@ -95,7 +123,7 @@ class DocParser
|
|
95
123
|
item = ControlledParagraph.new(doc, text, id)
|
96
124
|
|
97
125
|
if up_links
|
98
|
-
up_links.uniq! #remove duplicates
|
126
|
+
up_links.uniq! # remove duplicates
|
99
127
|
doc.items_with_uplinks_number += 1 # for statistics
|
100
128
|
up_links.each do |ul|
|
101
129
|
next unless tmp = />\[(\S*)\]$/.match(ul) # >[SRS-001]
|
@@ -146,7 +174,16 @@ class DocParser
|
|
146
174
|
|
147
175
|
doc.items.append(item)
|
148
176
|
|
149
|
-
elsif res = /^(\*\s+)(.*)/.match(s)
|
177
|
+
elsif res = /^(\*\s+)(.*)/.match(s) # check if unordered list start
|
178
|
+
|
179
|
+
if doc.title == ''
|
180
|
+
# dummy section if root is not a Document Title (level 0)
|
181
|
+
title = "#{doc.id}.md"
|
182
|
+
item = Heading.new(doc, title, 0)
|
183
|
+
doc.items.append(item)
|
184
|
+
doc.headings.append(item)
|
185
|
+
doc.title = title
|
186
|
+
end
|
150
187
|
|
151
188
|
temp_md_table = process_temp_table(doc, temp_md_table)
|
152
189
|
|
@@ -160,7 +197,7 @@ class DocParser
|
|
160
197
|
temp_md_list = item
|
161
198
|
end
|
162
199
|
|
163
|
-
elsif res = /^\d[.]\s(.*)/.match(s)
|
200
|
+
elsif res = /^\d[.]\s(.*)/.match(s) # check if ordered list start
|
164
201
|
|
165
202
|
temp_md_table = process_temp_table(doc, temp_md_table)
|
166
203
|
|
@@ -176,6 +213,15 @@ class DocParser
|
|
176
213
|
|
177
214
|
elsif s[0] == '|' # check if table
|
178
215
|
|
216
|
+
if doc.title == ''
|
217
|
+
# dummy section if root is not a Document Title (level 0)
|
218
|
+
title = "#{doc.id}.md"
|
219
|
+
item = Heading.new(doc, title, 0)
|
220
|
+
doc.items.append(item)
|
221
|
+
doc.headings.append(item)
|
222
|
+
doc.title = title
|
223
|
+
end
|
224
|
+
|
179
225
|
if temp_md_list
|
180
226
|
doc.items.append temp_md_list
|
181
227
|
temp_md_list = nil
|
@@ -184,8 +230,8 @@ class DocParser
|
|
184
230
|
if res = /^[|](-{3,})[|]/.match(s) # check if it is a separator first
|
185
231
|
|
186
232
|
if temp_md_table
|
187
|
-
|
188
|
-
|
233
|
+
# separator is found after heading
|
234
|
+
temp_md_table.is_separator_detected = true
|
189
235
|
else
|
190
236
|
# separator out of table scope consider it just as a regular paragraph
|
191
237
|
item = Paragraph.new(doc, s)
|
@@ -257,6 +303,7 @@ class DocParser
|
|
257
303
|
# start code block
|
258
304
|
temp_code_block = CodeBlock.new(suggested_format)
|
259
305
|
temp_code_block.parent_doc = doc
|
306
|
+
temp_code_block.parent_heading = doc.headings[-1]
|
260
307
|
end
|
261
308
|
|
262
309
|
elsif res = /^TODO:(.*)/.match(s) # check if TODO block
|
@@ -276,6 +323,7 @@ class DocParser
|
|
276
323
|
doc.todo_blocks.append(item)
|
277
324
|
|
278
325
|
else # Reqular Paragraph
|
326
|
+
|
279
327
|
temp_md_table = process_temp_table(doc, temp_md_table)
|
280
328
|
if temp_md_list
|
281
329
|
if MarkdownList.unordered_list_item?(s) || MarkdownList.ordered_list_item?(s)
|
@@ -314,7 +362,7 @@ class DocParser
|
|
314
362
|
doc.items.append(item)
|
315
363
|
end
|
316
364
|
|
317
|
-
def self.process_temp_table(doc, temp_md_table)
|
365
|
+
def self.process_temp_table(doc, temp_md_table)
|
318
366
|
if temp_md_table
|
319
367
|
if temp_md_table.is_separator_detected
|
320
368
|
doc.items.append temp_md_table
|
@@ -1,70 +1,64 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
|
2
|
-
class BaseDocument
|
3
|
+
class BaseDocument # rubocop:disable Style/Documentation
|
4
|
+
attr_accessor :title, :id, :dom, :headings
|
3
5
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
6
|
+
def initialize
|
7
|
+
@items = []
|
8
|
+
@headings = []
|
9
|
+
@title = ''
|
10
|
+
@id = ''
|
11
|
+
@dom = nil
|
12
|
+
end
|
8
13
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
@title = ""
|
13
|
-
@id = ""
|
14
|
-
@dom = nil
|
15
|
-
end
|
16
|
-
|
17
|
-
def save_html_to_file html_rows, nav_pane, output_file_path
|
18
|
-
|
19
|
-
gem_root = File.expand_path './../../..', File.dirname(__FILE__)
|
20
|
-
template_file = gem_root + "/lib/almirah/templates/page.html"
|
14
|
+
def save_html_to_file(html_rows, nav_pane, output_file_path) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
|
15
|
+
gem_root = File.expand_path './../../..', File.dirname(__FILE__)
|
16
|
+
template_file = "#{gem_root}/lib/almirah/templates/page.html"
|
21
17
|
|
22
|
-
|
23
|
-
|
24
|
-
|
18
|
+
file = File.open(template_file)
|
19
|
+
file_data = file.readlines
|
20
|
+
file.close
|
25
21
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
22
|
+
output_file_path += if @id == 'index'
|
23
|
+
"#{@id}.html"
|
24
|
+
else
|
25
|
+
"#{@id}/#{@id}.html"
|
26
|
+
end
|
27
|
+
file = File.open(output_file_path, 'w')
|
28
|
+
file_data.each do |s| # rubocop:disable Metrics/BlockLength
|
29
|
+
if s.include?('{{CONTENT}}')
|
30
|
+
html_rows.each do |r|
|
31
|
+
file.puts r
|
30
32
|
end
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
file.puts '<link rel="stylesheet" href="../../css/main.css">'
|
54
|
-
file.puts '<script src="../../scripts/main.js"></script>'
|
55
|
-
elsif self.instance_of? Coverage
|
56
|
-
file.puts '<link rel="stylesheet" href="../../css/main.css">'
|
57
|
-
file.puts '<script src="../../scripts/main.js"></script>'
|
58
|
-
elsif self.instance_of? Protocol
|
59
|
-
file.puts '<link rel="stylesheet" href="../../../css/main.css">'
|
60
|
-
file.puts '<script src="../../../scripts/main.js"></script>'
|
61
|
-
end
|
62
|
-
elsif s.include?('{{GEM_VERSION}}')
|
63
|
-
file.puts "(" + Gem.loaded_specs['Almirah'].version.version + ")"
|
64
|
-
else
|
65
|
-
file.puts s
|
66
|
-
end
|
33
|
+
elsif s.include?('{{NAV_PANE}}')
|
34
|
+
file.puts nav_pane.to_html if nav_pane
|
35
|
+
elsif s.include?('{{DOCUMENT_TITLE}}')
|
36
|
+
file.puts s.gsub! '{{DOCUMENT_TITLE}}', @title
|
37
|
+
elsif s.include?('{{STYLES_AND_SCRIPTS}}')
|
38
|
+
if @id == 'index'
|
39
|
+
file.puts '<script type="module" src="./scripts/orama_search.js"></script>'
|
40
|
+
file.puts '<link rel="stylesheet" href="./css/search.css">'
|
41
|
+
file.puts '<link rel="stylesheet" href="./css/main.css">'
|
42
|
+
file.puts '<script src="./scripts/main.js"></script>'
|
43
|
+
elsif instance_of? Specification
|
44
|
+
file.puts '<link rel="stylesheet" href="../../css/main.css">'
|
45
|
+
file.puts '<script src="../../scripts/main.js"></script>'
|
46
|
+
elsif instance_of? Traceability
|
47
|
+
file.puts '<link rel="stylesheet" href="../../css/main.css">'
|
48
|
+
file.puts '<script src="../../scripts/main.js"></script>'
|
49
|
+
elsif instance_of? Coverage
|
50
|
+
file.puts '<link rel="stylesheet" href="../../css/main.css">'
|
51
|
+
file.puts '<script src="../../scripts/main.js"></script>'
|
52
|
+
elsif instance_of? Protocol
|
53
|
+
file.puts '<link rel="stylesheet" href="../../../css/main.css">'
|
54
|
+
file.puts '<script src="../../../scripts/main.js"></script>'
|
67
55
|
end
|
68
|
-
|
56
|
+
elsif s.include?('{{GEM_VERSION}}')
|
57
|
+
file.puts "(#{Gem.loaded_specs['Almirah'].version.version})"
|
58
|
+
else
|
59
|
+
file.puts s
|
60
|
+
end
|
69
61
|
end
|
70
|
-
|
62
|
+
file.close
|
63
|
+
end
|
64
|
+
end
|
@@ -1,81 +1,80 @@
|
|
1
|
-
require_relative
|
1
|
+
require_relative 'base_document'
|
2
2
|
|
3
3
|
class Coverage < BaseDocument
|
4
|
+
attr_accessor :top_doc, :bottom_doc, :covered_items, :passed_steps_number, :failed_steps_number
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
|
6
|
+
def initialize(top_doc)
|
7
|
+
super()
|
8
|
+
@top_doc = top_doc
|
9
|
+
@bottom_doc = nil
|
8
10
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
11
|
+
@id = top_doc.id + '-' + 'tests'
|
12
|
+
@title = 'Coverage Matrix: ' + @id
|
13
|
+
@covered_items = {}
|
14
|
+
@passed_steps_number = 0
|
15
|
+
@failed_steps_number = 0
|
16
|
+
end
|
13
17
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
end
|
18
|
-
|
19
|
-
def to_console
|
20
|
-
puts "\e[35m" + "Traceability: " + @id + "\e[0m"
|
21
|
-
end
|
18
|
+
def to_console
|
19
|
+
puts "\e[35m" + 'Traceability: ' + @id + "\e[0m"
|
20
|
+
end
|
22
21
|
|
23
|
-
|
22
|
+
def to_html(nav_pane, output_file_path)
|
23
|
+
html_rows = []
|
24
24
|
|
25
|
-
|
25
|
+
html_rows.append('')
|
26
|
+
s = "<h1>#{@title}</h1>\n"
|
27
|
+
s += "<table class=\"controlled\">\n"
|
28
|
+
s += "\t<thead> <th>#</th> <th style='font-weight: bold;'>#{@top_doc.title}</th> <th>#</th> <th style='font-weight: bold;'>Test CaseId.StepId</th> </thead>\n"
|
29
|
+
html_rows.append s
|
26
30
|
|
27
|
-
|
28
|
-
s = "<h1>#{@title}</h1>\n"
|
29
|
-
s += "<table class=\"controlled\">\n"
|
30
|
-
s += "\t<thead> <th>#</th> <th style='font-weight: bold;'>#{@top_doc.title}</th> <th>#</th> <th style='font-weight: bold;'>Test CaseId.StepId</th> </thead>\n"
|
31
|
-
html_rows.append s
|
31
|
+
sorted_items = @top_doc.controlled_items.sort_by { |w| w.id }
|
32
32
|
|
33
|
-
|
33
|
+
sorted_items.each do |top_item|
|
34
|
+
row = render_table_row top_item
|
35
|
+
html_rows.append row
|
36
|
+
end
|
37
|
+
html_rows.append "</table>\n"
|
34
38
|
|
35
|
-
|
36
|
-
|
37
|
-
html_rows.append row
|
38
|
-
end
|
39
|
-
html_rows.append "</table>\n"
|
39
|
+
save_html_to_file(html_rows, nav_pane, output_file_path)
|
40
|
+
end
|
40
41
|
|
41
|
-
|
42
|
-
|
43
|
-
|
42
|
+
def render_table_row(top_item)
|
43
|
+
s = ''
|
44
|
+
if top_item.coverage_links
|
45
|
+
id_color = if top_item.coverage_links.length > 1
|
46
|
+
'' # "style='background-color: #fff8c5;'" # disabled for now
|
47
|
+
else
|
48
|
+
''
|
49
|
+
end
|
50
|
+
top_item.coverage_links.each do |bottom_item|
|
51
|
+
s += "\t<tr>\n"
|
52
|
+
s += "\t\t<td class=\"item_id\" #{id_color}><a href=\"./../#{top_item.parent_doc.id}/#{top_item.parent_doc.id}.html##{top_item.id}\" class=\"external\">#{top_item.id}</a></td>\n"
|
53
|
+
s += "\t\t<td class=\"item_text\" style='width: 42%;'>#{top_item.text}</td>\n"
|
44
54
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
s += "\t<tr>\n"
|
55
|
-
s += "\t\t<td class=\"item_id\" #{id_color}><a href=\"./../#{top_item.parent_doc.id}/#{top_item.parent_doc.id}.html##{top_item.id}\" class=\"external\">#{top_item.id}</a></td>\n"
|
56
|
-
s += "\t\t<td class=\"item_text\" style='width: 42%;'>#{top_item.text}</td>\n"
|
57
|
-
|
58
|
-
if bottom_item.columns[-2].text.downcase == "pass"
|
59
|
-
test_step_color = "style='background-color: #cfc;'"
|
60
|
-
elsif bottom_item.columns[-2].text.downcase == "fail"
|
61
|
-
test_step_color = "style='background-color: #fcc;'"
|
62
|
-
else
|
63
|
-
test_step_color = ""
|
64
|
-
end
|
55
|
+
test_step_color = if bottom_item.columns[-2].text.downcase == 'pass'
|
56
|
+
@passed_steps_number += 1
|
57
|
+
"style='background-color: #cfc;'"
|
58
|
+
elsif bottom_item.columns[-2].text.downcase == 'fail'
|
59
|
+
@failed_steps_number += 1
|
60
|
+
"style='background-color: #fcc;'"
|
61
|
+
else
|
62
|
+
''
|
63
|
+
end
|
65
64
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
end
|
79
|
-
return s
|
65
|
+
s += "\t\t<td class=\"item_id\" #{test_step_color}><a href=\"./../../tests/protocols/#{bottom_item.parent_doc.id}/#{bottom_item.parent_doc.id}.html##{bottom_item.id}\" class=\"external\">#{bottom_item.id}</a></td>\n"
|
66
|
+
s += "\t\t<td class=\"item_text\" style='width: 42%;'>#{bottom_item.columns[1].text}</td>\n"
|
67
|
+
s += "\t</tr>\n"
|
68
|
+
@covered_items[top_item.id.to_s.downcase] = top_item
|
69
|
+
end
|
70
|
+
else
|
71
|
+
s += "\t<tr>\n"
|
72
|
+
s += "\t\t<td class=\"item_id\"><a href=\"./../#{top_item.parent_doc.id}/#{top_item.parent_doc.id}.html##{top_item.id}\" class=\"external\">#{top_item.id}</a></td>\n"
|
73
|
+
s += "\t\t<td class=\"item_text\" style='width: 42%;'>#{top_item.text}</td>\n"
|
74
|
+
s += "\t\t<td class=\"item_id\"></td>\n"
|
75
|
+
s += "\t\t<td class=\"item_text\" style='width: 42%;'></td>\n"
|
76
|
+
s += "\t</tr>\n"
|
80
77
|
end
|
78
|
+
s
|
79
|
+
end
|
81
80
|
end
|