Almirah 0.2.2 → 0.2.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.
- checksums.yaml +4 -4
- data/lib/almirah/doc_fabric.rb +21 -2
- data/lib/almirah/doc_items/blockquote.rb +2 -2
- data/lib/almirah/doc_items/code_block.rb +2 -2
- data/lib/almirah/doc_items/controlled_paragraph.rb +100 -79
- data/lib/almirah/doc_items/controlled_table.rb +181 -134
- data/lib/almirah/doc_items/controlled_table_row.rb +3 -3
- data/lib/almirah/doc_items/doc_footer.rb +2 -2
- data/lib/almirah/doc_items/doc_item.rb +1 -1
- data/lib/almirah/doc_items/heading.rb +80 -85
- data/lib/almirah/doc_items/image.rb +2 -2
- data/lib/almirah/doc_items/markdown_list.rb +134 -143
- data/lib/almirah/doc_items/markdown_table.rb +52 -48
- data/lib/almirah/doc_items/paragraph.rb +6 -4
- data/lib/almirah/doc_items/text_line.rb +247 -264
- data/lib/almirah/doc_items/todo_block.rb +2 -2
- data/lib/almirah/doc_parser.rb +56 -60
- data/lib/almirah/doc_types/base_document.rb +1 -0
- data/lib/almirah/doc_types/coverage.rb +4 -1
- data/lib/almirah/doc_types/index.rb +26 -18
- data/lib/almirah/doc_types/specification.rb +56 -93
- data/lib/almirah/doc_types/traceability.rb +6 -2
- data/lib/almirah/dom/doc_section.rb +21 -24
- data/lib/almirah/dom/document.rb +66 -57
- data/lib/almirah/project.rb +257 -275
- data/lib/almirah/search/specifications_db.rb +18 -1
- data/lib/almirah/templates/css/main.css +5 -2
- data/lib/almirah/templates/page.html +4 -2
- data/lib/almirah/templates/scripts/main.js +54 -3
- metadata +2 -2
data/lib/almirah/project.rb
CHANGED
@@ -1,324 +1,306 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'fileutils'
|
2
|
-
require_relative
|
3
|
-
require_relative
|
4
|
-
require_relative
|
5
|
-
require_relative
|
6
|
-
require_relative
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
4
|
+
require_relative 'doc_fabric'
|
5
|
+
require_relative 'navigation_pane'
|
6
|
+
require_relative 'doc_types/traceability'
|
7
|
+
require_relative 'doc_types/index'
|
8
|
+
require_relative 'search/specifications_db'
|
9
|
+
|
10
|
+
class Project # rubocop:disable Metrics/ClassLength,Style/Documentation
|
11
|
+
attr_accessor :specifications, :protocols, :traceability_matrices, :coverage_matrices, :specifications_dictionary,
|
12
|
+
:index, :project, :configuration
|
13
|
+
|
14
|
+
def initialize(configuration)
|
15
|
+
@configuration = configuration
|
16
|
+
@specifications = []
|
17
|
+
@protocols = []
|
18
|
+
@traceability_matrices = []
|
19
|
+
@coverage_matrices = []
|
20
|
+
@specifications_dictionary = {}
|
21
|
+
@covered_specifications_dictionary = {}
|
22
|
+
@index = nil
|
23
|
+
@project = self
|
24
|
+
FileUtils.remove_dir("#{@configuration.project_root_directory}/build", true)
|
25
|
+
copy_resources
|
26
|
+
end
|
27
|
+
|
28
|
+
def copy_resources
|
29
|
+
# scripts
|
30
|
+
gem_root = File.expand_path './../..', File.dirname(__FILE__)
|
31
|
+
src_folder = "#{gem_root}/lib/almirah/templates/scripts"
|
32
|
+
dst_folder = "#{@configuration.project_root_directory}/build/scripts"
|
33
|
+
FileUtils.mkdir_p(dst_folder)
|
34
|
+
FileUtils.copy_entry(src_folder, dst_folder)
|
35
|
+
# css
|
36
|
+
src_folder = "#{gem_root}/lib/almirah/templates/css"
|
37
|
+
dst_folder = "#{@configuration.project_root_directory}/build/css"
|
38
|
+
FileUtils.mkdir_p(dst_folder)
|
39
|
+
FileUtils.copy_entry(src_folder, dst_folder)
|
40
|
+
end
|
41
|
+
|
42
|
+
def specifications_and_protocols # rubocop:disable Metrics/MethodLength
|
43
|
+
parse_all_specifications
|
44
|
+
parse_all_protocols
|
45
|
+
link_all_specifications
|
46
|
+
link_all_protocols
|
47
|
+
check_wrong_specification_referenced
|
48
|
+
create_index
|
49
|
+
render_all_specifications(@specifications)
|
50
|
+
render_all_specifications(@traceability_matrices)
|
51
|
+
render_all_specifications(@coverage_matrices)
|
52
|
+
render_all_protocols
|
53
|
+
render_index
|
54
|
+
create_search_data
|
55
|
+
end
|
56
|
+
|
57
|
+
def specifications_and_results(test_run) # rubocop:disable Metrics/MethodLength
|
58
|
+
parse_all_specifications
|
59
|
+
parse_test_run test_run
|
60
|
+
link_all_specifications
|
61
|
+
link_all_protocols
|
62
|
+
check_wrong_specification_referenced
|
63
|
+
create_index
|
64
|
+
render_all_specifications(@specifications)
|
65
|
+
render_all_specifications(@traceability_matrices)
|
66
|
+
render_all_specifications(@coverage_matrices)
|
67
|
+
render_all_protocols
|
68
|
+
render_index
|
69
|
+
create_search_data
|
70
|
+
end
|
71
|
+
|
72
|
+
def transform(file_extension)
|
73
|
+
transform_all_specifications file_extension
|
74
|
+
end
|
75
|
+
|
76
|
+
def transform_all_specifications(_file_extension)
|
77
|
+
path = @configuration.project_root_directory
|
78
|
+
|
79
|
+
# find all specifications
|
80
|
+
Dir.glob("#{path}/specifications/**/*.md").each do |f|
|
81
|
+
puts f
|
82
|
+
# make a copy with another extention to preserve the content
|
83
|
+
f_directory = File.dirname(f)
|
84
|
+
f_name = File.basename(f, File.extname(f)).downcase + '._md'
|
85
|
+
FileUtils.copy_file(f, "#{f_directory}/#{f_name}")
|
86
|
+
# transform the original one
|
87
|
+
# but do nothing for now - TODO
|
31
88
|
end
|
89
|
+
end
|
32
90
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
FileUtils.mkdir_p(dst_folder)
|
39
|
-
FileUtils.copy_entry( src_folder, dst_folder )
|
40
|
-
# css
|
41
|
-
src_folder = gem_root + "/lib/almirah/templates/css"
|
42
|
-
dst_folder = @configuration.project_root_directory + "/build/css"
|
43
|
-
FileUtils.mkdir_p(dst_folder)
|
44
|
-
FileUtils.copy_entry( src_folder, dst_folder )
|
91
|
+
def parse_all_specifications
|
92
|
+
path = @configuration.project_root_directory
|
93
|
+
# do a lasy pass first to get the list of documents id
|
94
|
+
Dir.glob("#{path}/specifications/**/*.md").each do |f|
|
95
|
+
DocFabric.add_lazy_doc_id(f)
|
45
96
|
end
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
link_all_specifications
|
52
|
-
link_all_protocols
|
53
|
-
check_wrong_specification_referenced
|
54
|
-
create_index
|
55
|
-
render_all_specifications(@specifications)
|
56
|
-
render_all_specifications(@traceability_matrices)
|
57
|
-
render_all_specifications(@coverage_matrices)
|
58
|
-
render_all_protocols
|
59
|
-
render_index
|
60
|
-
create_search_data
|
97
|
+
# parse documents in the second pass
|
98
|
+
Dir.glob("#{path}/specifications/**/*.md").each do |f| # rubocop:disable Style/CombinableLoops
|
99
|
+
doc = DocFabric.create_specification(f)
|
100
|
+
@specifications.append(doc)
|
101
|
+
@specifications_dictionary[doc.id.to_s.downcase] = doc
|
61
102
|
end
|
103
|
+
end
|
62
104
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
link_all_protocols
|
69
|
-
check_wrong_specification_referenced
|
70
|
-
create_index
|
71
|
-
render_all_specifications(@specifications)
|
72
|
-
render_all_specifications(@traceability_matrices)
|
73
|
-
render_all_specifications(@coverage_matrices)
|
74
|
-
render_all_protocols
|
75
|
-
render_index
|
76
|
-
create_search_data
|
105
|
+
def parse_all_protocols
|
106
|
+
path = @configuration.project_root_directory
|
107
|
+
Dir.glob("#{path}/tests/protocols/**/*.md").each do |f|
|
108
|
+
doc = DocFabric.create_protocol(f)
|
109
|
+
@protocols.append(doc)
|
77
110
|
end
|
111
|
+
end
|
78
112
|
|
79
|
-
|
80
|
-
|
113
|
+
def parse_test_run(test_run)
|
114
|
+
path = @configuration.project_root_directory
|
115
|
+
Dir.glob("#{path}/tests/runs/#{test_run}/**/*.md").each do |f|
|
116
|
+
doc = DocFabric.create_protocol(f)
|
117
|
+
@protocols.append(doc)
|
81
118
|
end
|
119
|
+
end
|
82
120
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
Dir.glob( "#{path}/specifications/**/*.md" ).each do |f|
|
89
|
-
puts f
|
90
|
-
# make a copy with another extention to preserve the content
|
91
|
-
f_directory = File.dirname(f)
|
92
|
-
f_name = File.basename(f, File.extname(f)).downcase + "._md"
|
93
|
-
FileUtils.copy_file( f, "#{f_directory}/#{f_name}")
|
94
|
-
# transform the original one
|
95
|
-
# but do nothing for now - TODO
|
96
|
-
end
|
121
|
+
def link_all_specifications # rubocop:disable Metrics/MethodLength
|
122
|
+
comb_list = @specifications.combination(2)
|
123
|
+
comb_list.each do |c|
|
124
|
+
link_two_specifications(c[0], c[1])
|
125
|
+
# puts "Link: #{c[0].id} - #{c[1].id}"
|
97
126
|
end
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
doc = DocFabric.create_specification(f)
|
108
|
-
@specifications.append(doc)
|
109
|
-
@specifications_dictionary[doc.id.to_s.downcase] = doc
|
110
|
-
end
|
127
|
+
# separatelly create design inputs treceability
|
128
|
+
@configuration.get_design_inputs.each do |i|
|
129
|
+
next unless @specifications_dictionary.key? i.to_s.downcase
|
130
|
+
|
131
|
+
document = @specifications_dictionary[i.to_s.downcase]
|
132
|
+
if document
|
133
|
+
doc = DocFabric.create_traceability_document(document, nil)
|
134
|
+
@traceability_matrices.append doc
|
135
|
+
end
|
111
136
|
end
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
137
|
+
end
|
138
|
+
|
139
|
+
def link_all_protocols # rubocop:disable Metrics/MethodLength
|
140
|
+
@protocols.each do |p|
|
141
|
+
@specifications.each do |s|
|
142
|
+
if p.up_link_docs.key?(s.id.to_s)
|
143
|
+
link_protocol_to_spec(p, s)
|
144
|
+
@covered_specifications_dictionary[s.id.to_s] = s
|
119
145
|
end
|
146
|
+
end
|
120
147
|
end
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
puts "Run: " + f
|
126
|
-
doc = DocFabric.create_protocol(f)
|
127
|
-
@protocols.append(doc)
|
128
|
-
end
|
148
|
+
# create coverage documents
|
149
|
+
@covered_specifications_dictionary.each do |_key, value|
|
150
|
+
doc = DocFabric.create_coverage_matrix(value)
|
151
|
+
@coverage_matrices.append doc
|
129
152
|
end
|
153
|
+
end
|
130
154
|
|
131
|
-
|
132
|
-
|
133
|
-
combList.each do |c|
|
134
|
-
link_two_specifications(c[0], c[1])
|
135
|
-
# puts "Link: #{c[0].id} - #{c[1].id}"
|
136
|
-
end
|
137
|
-
# separatelly create design inputs treceability
|
138
|
-
@configuration.get_design_inputs.each do |i|
|
139
|
-
if @specifications_dictionary.has_key? i.to_s.downcase
|
140
|
-
document = @specifications_dictionary[i.to_s.downcase]
|
141
|
-
if document
|
142
|
-
trx = Traceability.new document, nil, true
|
143
|
-
@traceability_matrices.append trx
|
144
|
-
end
|
145
|
-
end
|
146
|
-
end
|
147
|
-
end
|
155
|
+
def check_wrong_specification_referenced # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
|
156
|
+
available_specification_ids = {}
|
148
157
|
|
149
|
-
|
150
|
-
|
151
|
-
@specifications.each do |s|
|
152
|
-
if p.up_link_docs.has_key?(s.id.to_s)
|
153
|
-
link_protocol_to_spec(p,s)
|
154
|
-
end
|
155
|
-
end
|
156
|
-
end
|
158
|
+
@specifications.each do |s|
|
159
|
+
available_specification_ids[s.id.to_s.downcase] = s
|
157
160
|
end
|
158
161
|
|
159
|
-
|
162
|
+
@specifications.each do |s| # rubocop:disable Style/CombinableLoops
|
163
|
+
s.up_link_docs.each do |key, _value|
|
164
|
+
next if available_specification_ids.key?(key)
|
160
165
|
|
161
|
-
|
166
|
+
# now key points to the doc_id that does not exist
|
167
|
+
wrong_doc_id = key
|
168
|
+
# find the item that reference to it
|
169
|
+
s.controlled_items.each do |item|
|
170
|
+
next if item.up_link_ids.nil?
|
162
171
|
|
163
|
-
|
164
|
-
|
165
|
-
end
|
172
|
+
item.up_link_ids.each do |up_link_id|
|
173
|
+
next unless tmp = /^([a-zA-Z]+)-\d+/.match(up_link_id) # SRS
|
166
174
|
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
# now key points to the doc_id that does not exist
|
171
|
-
wrong_doc_id = key
|
172
|
-
# find the item that reference to it
|
173
|
-
s.controlled_items.each do |item|
|
174
|
-
unless item.up_link_ids.nil?
|
175
|
-
item.up_link_ids.each do |up_link_id|
|
176
|
-
if tmp = /^([a-zA-Z]+)[-]\d+/.match(up_link_id) # SRS
|
177
|
-
if tmp[1].downcase == wrong_doc_id
|
178
|
-
# we got it finally!
|
179
|
-
s.wrong_links_hash[ up_link_id.to_s ] = item
|
180
|
-
end
|
181
|
-
end
|
182
|
-
end
|
183
|
-
end
|
184
|
-
end
|
185
|
-
end
|
175
|
+
if tmp[1].downcase == wrong_doc_id
|
176
|
+
# we got it finally!
|
177
|
+
s.wrong_links_hash[up_link_id.to_s] = item
|
186
178
|
end
|
179
|
+
end
|
187
180
|
end
|
181
|
+
end
|
188
182
|
end
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
bottom_document.wrong_links_hash[ up_lnk ] = item
|
221
|
-
end
|
222
|
-
end
|
223
|
-
end
|
224
|
-
end
|
225
|
-
end
|
183
|
+
end
|
184
|
+
|
185
|
+
def link_two_specifications(doc_a, doc_b) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
|
186
|
+
if doc_b.up_link_docs.key?(doc_a.id.to_s)
|
187
|
+
top_document = doc_a
|
188
|
+
bottom_document = doc_b
|
189
|
+
elsif doc_a.up_link_docs.key?(doc_b.id.to_s)
|
190
|
+
top_document = doc_b
|
191
|
+
bottom_document = doc_a
|
192
|
+
else
|
193
|
+
return # no links
|
194
|
+
end
|
195
|
+
# puts "Link: #{doc_a.id} - #{doc_b.id}"
|
196
|
+
bottom_document.controlled_items.each do |item|
|
197
|
+
next unless item.up_link_ids
|
198
|
+
|
199
|
+
item.up_link_ids.each do |up_lnk|
|
200
|
+
if top_document.dictionary.key?(up_lnk.to_s)
|
201
|
+
|
202
|
+
top_item = top_document.dictionary[up_lnk.to_s]
|
203
|
+
|
204
|
+
unless top_item.down_links
|
205
|
+
top_item.down_links = []
|
206
|
+
top_document.items_with_downlinks_number += 1 # for statistics
|
207
|
+
end
|
208
|
+
top_item.down_links.append(item)
|
209
|
+
elsif tmp = /^([a-zA-Z]+)-\d+/.match(up_lnk)
|
210
|
+
# check if there is a non existing link with the right doc_id
|
211
|
+
if tmp[1].downcase == top_document.id.downcase
|
212
|
+
bottom_document.wrong_links_hash[up_lnk] = item
|
213
|
+
end # SRS
|
226
214
|
end
|
227
|
-
|
228
|
-
trx = Traceability.new top_document, bottom_document, false
|
229
|
-
@traceability_matrices.append trx
|
215
|
+
end
|
230
216
|
end
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
217
|
+
# create treceability document
|
218
|
+
doc = DocFabric.create_traceability_document(top_document, bottom_document)
|
219
|
+
@traceability_matrices.append doc
|
220
|
+
end
|
221
|
+
|
222
|
+
def link_protocol_to_spec(protocol, specification) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
|
223
|
+
top_document = specification
|
224
|
+
bottom_document = protocol
|
225
|
+
|
226
|
+
bottom_document.controlled_items.each do |item|
|
227
|
+
next unless item.up_link_ids
|
228
|
+
|
229
|
+
item.up_link_ids.each do |up_lnk|
|
230
|
+
if top_document.dictionary.key?(up_lnk.to_s)
|
231
|
+
|
232
|
+
top_item = top_document.dictionary[up_lnk.to_s]
|
233
|
+
|
234
|
+
unless top_item.coverage_links
|
235
|
+
top_item.coverage_links = []
|
236
|
+
top_document.items_with_coverage_number += 1 # for statistics
|
237
|
+
end
|
238
|
+
top_item.coverage_links.append(item)
|
239
|
+
elsif tmp = /^([a-zA-Z]+)-\d+/.match(up_lnk)
|
240
|
+
# check if there is a non existing link with the right doc_id
|
241
|
+
if tmp[1].downcase == top_document.id.downcase
|
242
|
+
bottom_document.wrong_links_hash[up_lnk] = item
|
243
|
+
end # SRS
|
249
244
|
end
|
250
|
-
|
251
|
-
trx = Coverage.new top_document
|
252
|
-
@coverage_matrices.append trx
|
245
|
+
end
|
253
246
|
end
|
247
|
+
end
|
254
248
|
|
255
|
-
|
256
|
-
|
257
|
-
|
249
|
+
def create_index
|
250
|
+
@index = Index.new(@project)
|
251
|
+
end
|
258
252
|
|
259
|
-
|
253
|
+
def render_all_specifications(spec_list) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
254
|
+
path = @configuration.project_root_directory
|
260
255
|
|
261
|
-
|
256
|
+
FileUtils.mkdir_p("#{path}/build/specifications")
|
262
257
|
|
263
|
-
|
264
|
-
|
265
|
-
spec_list.each do |doc|
|
258
|
+
spec_list.each do |doc|
|
259
|
+
doc.to_console
|
266
260
|
|
267
|
-
|
261
|
+
img_src_dir = "#{path}/specifications/#{doc.id}/img"
|
262
|
+
img_dst_dir = "#{path}/build/specifications/#{doc.id}/img"
|
268
263
|
|
269
|
-
|
270
|
-
img_dst_dir = path + "/build/specifications/" + doc.id + "/img"
|
271
|
-
|
272
|
-
FileUtils.mkdir_p(img_dst_dir)
|
264
|
+
FileUtils.mkdir_p(img_dst_dir)
|
273
265
|
|
274
|
-
|
275
|
-
FileUtils.copy_entry( img_src_dir, img_dst_dir )
|
276
|
-
end
|
266
|
+
FileUtils.copy_entry(img_src_dir, img_dst_dir) if File.directory?(img_src_dir)
|
277
267
|
|
278
|
-
|
279
|
-
|
280
|
-
doc.to_html( nav_pane, "#{path}/build/specifications/" )
|
281
|
-
end
|
268
|
+
nav_pane = NavigationPane.new(doc)
|
269
|
+
doc.to_html(nav_pane, "#{path}/build/specifications/")
|
282
270
|
end
|
271
|
+
end
|
283
272
|
|
284
|
-
|
285
|
-
|
286
|
-
# create a sidebar first
|
287
|
-
# nav_pane = NavigationPane.new(@specifications)
|
273
|
+
def render_all_protocols
|
274
|
+
path = @configuration.project_root_directory
|
288
275
|
|
289
|
-
|
276
|
+
FileUtils.mkdir_p("#{path}/build/tests/protocols")
|
290
277
|
|
291
|
-
|
292
|
-
|
293
|
-
|
278
|
+
@protocols.each do |doc|
|
279
|
+
img_src_dir = "#{path}/tests/protocols/#{doc.id}/img"
|
280
|
+
img_dst_dir = "#{path}/build/tests/protocols/#{doc.id}/img"
|
294
281
|
|
295
|
-
|
296
|
-
img_dst_dir = path + "/build/tests/protocols/" + doc.id + "/img"
|
297
|
-
|
298
|
-
FileUtils.mkdir_p(img_dst_dir)
|
282
|
+
FileUtils.mkdir_p(img_dst_dir)
|
299
283
|
|
300
|
-
|
301
|
-
FileUtils.copy_entry( img_src_dir, img_dst_dir )
|
302
|
-
end
|
284
|
+
FileUtils.copy_entry(img_src_dir, img_dst_dir) if File.directory?(img_src_dir)
|
303
285
|
|
304
|
-
|
305
|
-
|
286
|
+
nav_pane = NavigationPane.new(doc)
|
287
|
+
doc.to_html(nav_pane, "#{path}/build/tests/protocols/")
|
306
288
|
end
|
289
|
+
end
|
307
290
|
|
308
|
-
|
309
|
-
|
310
|
-
path = @configuration.project_root_directory
|
291
|
+
def render_index
|
292
|
+
path = @configuration.project_root_directory
|
311
293
|
|
312
|
-
|
313
|
-
|
294
|
+
doc = @index
|
295
|
+
doc.to_console
|
314
296
|
|
315
|
-
|
316
|
-
|
297
|
+
doc.to_html("#{path}/build/")
|
298
|
+
end
|
317
299
|
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
end
|
300
|
+
def create_search_data
|
301
|
+
db = SpecificationsDb.new @specifications
|
302
|
+
data_path = "#{@configuration.project_root_directory}/build/data"
|
303
|
+
FileUtils.mkdir_p(data_path)
|
304
|
+
db.save(data_path)
|
305
|
+
end
|
306
|
+
end
|
@@ -23,7 +23,9 @@ class SpecificationsDb
|
|
23
23
|
}
|
24
24
|
@data.append e
|
25
25
|
elsif i.instance_of? MarkdownList
|
26
|
-
e = add_markdown_list_item_to_db( @data, i, i)
|
26
|
+
e = add_markdown_list_item_to_db( @data, i, i)
|
27
|
+
elsif i.instance_of? MarkdownTable
|
28
|
+
add_markdown_table_item_to_db( @data, i, i)
|
27
29
|
end
|
28
30
|
end
|
29
31
|
end
|
@@ -56,6 +58,21 @@ class SpecificationsDb
|
|
56
58
|
return e
|
57
59
|
end
|
58
60
|
|
61
|
+
def add_markdown_table_item_to_db(data, item_for_reference, item_to_process)
|
62
|
+
e = nil
|
63
|
+
table_text = ""
|
64
|
+
item_to_process.rows.each do |row|
|
65
|
+
table_text += "| " + row.join(" | ") + " |"
|
66
|
+
end
|
67
|
+
e = { "document" => item_for_reference.parent_doc.title, \
|
68
|
+
"doc_color" => item_for_reference.parent_doc.color, \
|
69
|
+
"text" => table_text, \
|
70
|
+
"heading_url" => item_for_reference.parent_heading.get_url(), \
|
71
|
+
"heading_text" => item_for_reference.parent_heading.get_section_info()
|
72
|
+
}
|
73
|
+
data << e
|
74
|
+
end
|
75
|
+
|
59
76
|
def save(path)
|
60
77
|
json = JSON.generate(@data)
|
61
78
|
|
@@ -223,13 +223,16 @@ img{
|
|
223
223
|
font-family: "Trebuchet MS", Verdana, sans-serif;
|
224
224
|
}
|
225
225
|
#top_nav a:hover {
|
226
|
-
background-color:
|
227
|
-
color:
|
226
|
+
background-color: #169;
|
227
|
+
color: #eee;
|
228
228
|
}
|
229
229
|
#top_nav a.active {
|
230
230
|
background-color: #169;
|
231
231
|
color: white;
|
232
232
|
}
|
233
|
+
#top_nav a:focus {
|
234
|
+
text-decoration: underline;
|
235
|
+
}
|
233
236
|
#searchInput{
|
234
237
|
float: left;
|
235
238
|
margin: 4px 6px;
|
@@ -9,7 +9,9 @@
|
|
9
9
|
</head>
|
10
10
|
<body>
|
11
11
|
<div id="top_nav">
|
12
|
-
<a href="javascript:void(0)" onclick="navigate_to_home()"><span><i class="fa fa-home" aria-hidden="true"></i></span> Home</a>
|
12
|
+
<a id="home_menu_item" href="javascript:void(0)" onclick="navigate_to_home()"><span><i class="fa fa-home" aria-hidden="true"></i></span> Home</a>
|
13
|
+
<a id="index_menu_item" href="javascript:void(0)" onclick="navigate_to_home()" style="display: none;"><span><i class="fa fa-info" aria-hidden="true"></i></span> Index</a>
|
14
|
+
<a id="document_tree_menu_item" href="javascript:void(0)" onclick="openNav()" style="display: none;" title="Navigation Pane"><span><i class="fa fa-folder-open-o" aria-hidden="true"></i></span></a>
|
13
15
|
<input type="text" id="searchInput" placeholder="Search.." style="display: none;">
|
14
16
|
<a class="split">{{DOCUMENT_TITLE}}</a>
|
15
17
|
</div>
|
@@ -17,7 +19,7 @@
|
|
17
19
|
<div id="main">
|
18
20
|
<div id="closed_nav_pane" href="javascript:void(0)" onclick="openNav()">
|
19
21
|
</div>
|
20
|
-
<div id="nav_pane"
|
22
|
+
<div id="nav_pane">
|
21
23
|
{{NAV_PANE}}
|
22
24
|
</div>
|
23
25
|
<div id="content" href="javascript:void(0)" onclick="closeNav()">
|