Almirah 0.2.1 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- 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 +11 -11
- data/lib/almirah/doc_items/controlled_table.rb +8 -4
- 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 +5 -3
- 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 +50 -54
- data/lib/almirah/doc_types/index.rb +17 -17
- data/lib/almirah/doc_types/specification.rb +56 -93
- data/lib/almirah/dom/doc_section.rb +1 -1
- data/lib/almirah/search/specifications_db.rb +18 -1
- data/lib/almirah/templates/css/main.css +5 -2
- data/lib/almirah/templates/page.html +3 -1
- data/lib/almirah/templates/scripts/main.js +20 -3
- data/lib/almirah/templates/scripts/orama_search.js +3 -1
- metadata +2 -2
data/lib/almirah/doc_parser.rb
CHANGED
@@ -24,10 +24,7 @@ class DocParser
|
|
24
24
|
if s.lstrip != ''
|
25
25
|
if res = /^(\#{1,})\s(.*)/.match(s) # Heading
|
26
26
|
|
27
|
-
|
28
|
-
doc.items.append temp_md_table
|
29
|
-
temp_md_table = nil
|
30
|
-
end
|
27
|
+
temp_md_table = process_temp_table(doc, temp_md_table)
|
31
28
|
if temp_md_list
|
32
29
|
doc.items.append temp_md_list
|
33
30
|
temp_md_list = nil
|
@@ -58,10 +55,7 @@ class DocParser
|
|
58
55
|
|
59
56
|
elsif res = /^\[(\S*)\]\s+(.*)/.match(s) # Controlled Paragraph
|
60
57
|
|
61
|
-
|
62
|
-
doc.items.append temp_md_table
|
63
|
-
temp_md_table = nil
|
64
|
-
end
|
58
|
+
temp_md_table = process_temp_table(doc, temp_md_table)
|
65
59
|
if temp_md_list
|
66
60
|
doc.items.append temp_md_list
|
67
61
|
temp_md_list = nil
|
@@ -137,10 +131,7 @@ class DocParser
|
|
137
131
|
|
138
132
|
elsif res = /^!\[(.*)\]\((.*)\)/.match(s) # Image
|
139
133
|
|
140
|
-
|
141
|
-
doc.items.append temp_md_table
|
142
|
-
temp_md_table = nil
|
143
|
-
end
|
134
|
+
temp_md_table = process_temp_table(doc, temp_md_table)
|
144
135
|
if temp_md_list
|
145
136
|
doc.items.append temp_md_list
|
146
137
|
temp_md_list = nil
|
@@ -157,10 +148,7 @@ class DocParser
|
|
157
148
|
|
158
149
|
elsif res = /^(\*\s+)(.*)/.match(s) # check if unordered list start
|
159
150
|
|
160
|
-
|
161
|
-
doc.items.append temp_md_table
|
162
|
-
temp_md_table = nil
|
163
|
-
end
|
151
|
+
temp_md_table = process_temp_table(doc, temp_md_table)
|
164
152
|
|
165
153
|
row = res[2]
|
166
154
|
|
@@ -174,10 +162,7 @@ class DocParser
|
|
174
162
|
|
175
163
|
elsif res = /^\d[.]\s(.*)/.match(s) # check if ordered list start
|
176
164
|
|
177
|
-
|
178
|
-
doc.items.append temp_md_table
|
179
|
-
temp_md_table = nil
|
180
|
-
end
|
165
|
+
temp_md_table = process_temp_table(doc, temp_md_table)
|
181
166
|
|
182
167
|
row = res[1]
|
183
168
|
|
@@ -199,39 +184,50 @@ class DocParser
|
|
199
184
|
if res = /^[|](-{3,})[|]/.match(s) # check if it is a separator first
|
200
185
|
|
201
186
|
if temp_md_table
|
202
|
-
# separator is found after heading
|
187
|
+
# separator is found after heading
|
188
|
+
temp_md_table.is_separator_detected = true
|
203
189
|
else
|
204
190
|
# separator out of table scope consider it just as a regular paragraph
|
205
|
-
item = Paragraph.new(s)
|
206
|
-
item.parent_doc = doc
|
207
|
-
item.parent_heading = doc.headings[-1]
|
191
|
+
item = Paragraph.new(doc, s)
|
208
192
|
doc.items.append(item)
|
209
193
|
end
|
210
194
|
|
211
|
-
elsif res = /^[|](.*[|])/.match(s) # check if it looks as a table
|
195
|
+
elsif res = /^[|](.*[|])/.match(s) # check if it looks as a table row
|
212
196
|
|
213
197
|
row = res[1]
|
214
198
|
|
215
199
|
if temp_md_table
|
216
|
-
#
|
217
|
-
|
218
|
-
|
219
|
-
|
200
|
+
if temp_md_table.is_separator_detected # if there is a separator
|
201
|
+
# check if parent doc is a Protocol
|
202
|
+
if doc.instance_of? Protocol
|
203
|
+
# check if it is a controlled table
|
204
|
+
tmp = /(.*)\s+>\[(\S*)\]/.match(row)
|
205
|
+
if tmp && (temp_md_table.instance_of? MarkdownTable)
|
206
|
+
# this is not a regular Markdown table
|
207
|
+
# so the table type shall be changed and this row shall be passed one more time
|
208
|
+
temp_md_table = ControlledTable.new(doc, temp_md_table)
|
209
|
+
end
|
210
|
+
end
|
220
211
|
temp_md_table.addRow(row)
|
212
|
+
else
|
213
|
+
# replece table heading with regular paragraph
|
214
|
+
item = Paragraph.new(doc, temp_md_table.heading_row)
|
215
|
+
doc.items.append(item)
|
216
|
+
# and current row
|
217
|
+
item = Paragraph.new(doc, s)
|
218
|
+
doc.items.append(item)
|
219
|
+
temp_md_table = nil
|
221
220
|
end
|
222
221
|
else
|
223
222
|
# start table from heading
|
224
|
-
temp_md_table = MarkdownTable.new(
|
225
|
-
temp_md_table.parent_doc = doc
|
223
|
+
temp_md_table = MarkdownTable.new(doc, s)
|
226
224
|
end
|
227
225
|
end
|
228
226
|
|
229
227
|
elsif res = /^>(.*)/.match(s) # check if blockquote
|
230
228
|
|
231
|
-
|
232
|
-
|
233
|
-
temp_md_table = nil
|
234
|
-
end
|
229
|
+
temp_md_table = process_temp_table(doc, temp_md_table)
|
230
|
+
|
235
231
|
if temp_md_list
|
236
232
|
doc.items.append temp_md_list
|
237
233
|
temp_md_list = nil
|
@@ -244,10 +240,7 @@ class DocParser
|
|
244
240
|
|
245
241
|
elsif res = /^```(\w*)/.match(s) # check if code block
|
246
242
|
|
247
|
-
|
248
|
-
doc.items.append temp_md_table
|
249
|
-
temp_md_table = nil
|
250
|
-
end
|
243
|
+
temp_md_table = process_temp_table(doc, temp_md_table)
|
251
244
|
if temp_md_list
|
252
245
|
doc.items.append temp_md_list
|
253
246
|
temp_md_list = nil
|
@@ -268,10 +261,7 @@ class DocParser
|
|
268
261
|
|
269
262
|
elsif res = /^TODO:(.*)/.match(s) # check if TODO block
|
270
263
|
|
271
|
-
|
272
|
-
doc.items.append temp_md_table
|
273
|
-
temp_md_table = nil
|
274
|
-
end
|
264
|
+
temp_md_table = process_temp_table(doc, temp_md_table)
|
275
265
|
if temp_md_list
|
276
266
|
doc.items.append temp_md_list
|
277
267
|
temp_md_list = nil
|
@@ -286,10 +276,7 @@ class DocParser
|
|
286
276
|
doc.todo_blocks.append(item)
|
287
277
|
|
288
278
|
else # Reqular Paragraph
|
289
|
-
|
290
|
-
doc.items.append temp_md_table
|
291
|
-
temp_md_table = nil
|
292
|
-
end
|
279
|
+
temp_md_table = process_temp_table(doc, temp_md_table)
|
293
280
|
if temp_md_list
|
294
281
|
if MarkdownList.unordered_list_item?(s) || MarkdownList.ordered_list_item?(s)
|
295
282
|
temp_md_list.addRow(s)
|
@@ -302,9 +289,7 @@ class DocParser
|
|
302
289
|
if temp_code_block
|
303
290
|
temp_code_block.code_lines.append(s)
|
304
291
|
else
|
305
|
-
item = Paragraph.new(s)
|
306
|
-
item.parent_doc = doc
|
307
|
-
item.parent_heading = doc.headings[-1]
|
292
|
+
item = Paragraph.new(doc, s)
|
308
293
|
doc.items.append(item)
|
309
294
|
end
|
310
295
|
end
|
@@ -314,10 +299,7 @@ class DocParser
|
|
314
299
|
end
|
315
300
|
end
|
316
301
|
# Finalize non-closed elements
|
317
|
-
|
318
|
-
doc.items.append temp_md_table
|
319
|
-
temp_md_table = nil
|
320
|
-
end
|
302
|
+
temp_md_table = process_temp_table(doc, temp_md_table)
|
321
303
|
if temp_md_list
|
322
304
|
doc.items.append temp_md_list
|
323
305
|
temp_md_list = nil
|
@@ -331,4 +313,18 @@ class DocParser
|
|
331
313
|
item.parent_doc = doc
|
332
314
|
doc.items.append(item)
|
333
315
|
end
|
316
|
+
|
317
|
+
def self.process_temp_table(doc, temp_md_table) # rubocop:disable Metrics/MethodLength
|
318
|
+
if temp_md_table
|
319
|
+
if temp_md_table.is_separator_detected
|
320
|
+
doc.items.append temp_md_table
|
321
|
+
else # no separator
|
322
|
+
# replece table heading with regular paragraph
|
323
|
+
item = Paragraph.new(doc, temp_md_table.heading_row)
|
324
|
+
doc.items.append(item)
|
325
|
+
end
|
326
|
+
temp_md_table = nil
|
327
|
+
end
|
328
|
+
temp_md_table
|
329
|
+
end
|
334
330
|
end
|
@@ -26,15 +26,15 @@ class Index < BaseDocument
|
|
26
26
|
s = "<h2>Specifications</h2>\n"
|
27
27
|
s += "<table class=\"controlled\">\n"
|
28
28
|
s += "\t<thead>\n"
|
29
|
-
s += "\t\t<th>Title</th>\n"
|
30
|
-
s += "\t\t<th>Items</th>\n"
|
31
|
-
s += "\t\t<th>Items<br>w/
|
32
|
-
s += "\t\t<th>Items<br>w/
|
33
|
-
s += "\t\t<th>Covered<br>by Tests</th>\n"
|
34
|
-
s += "\t\t<th>Duplicated<br>
|
35
|
-
s += "\t\t<th>Wrong<br>links</th>\n"
|
36
|
-
s += "\t\t<th>TODOs</th>\n"
|
37
|
-
s += "\t\t<th>Last Used<br>
|
29
|
+
s += "\t\t<th title=\"Document title\">Title</th>\n"
|
30
|
+
s += "\t\t<th title=\"Number of Controlled Paragraphs\">Items</th>\n"
|
31
|
+
s += "\t\t<th title=\"Number of Controlled Paragraphs with up-links\">Items<br>w/ Up-links</th>\n"
|
32
|
+
s += "\t\t<th title=\"Number of references from other documents\">Items<br>w/ Down-links</th>\n"
|
33
|
+
s += "\t\t<th title=\"Number of Controlled Paragraphs mentioned in Test Cases\">Covered <br>by Tests</th>\n"
|
34
|
+
s += "\t\t<th title=\"Number of Controlled Paragraphs that have the same ID\">Duplicated<br>IDs</th>\n"
|
35
|
+
s += "\t\t<th title=\"Number of Controlled Paragraphs that link to non-existing items\">Wrong<br>links</th>\n"
|
36
|
+
s += "\t\t<th title=\"Number of 'TODO:' blocks in document\">TODOs</th>\n"
|
37
|
+
s += "\t\t<th title=\"The last Controlled Paragraph sequence number (ID) used in the document\">Last Used<br>ID</th>\n"
|
38
38
|
s += "</thead>\n"
|
39
39
|
html_rows.append s
|
40
40
|
|
@@ -51,11 +51,11 @@ class Index < BaseDocument
|
|
51
51
|
if doc.duplicated_ids_number >0
|
52
52
|
s += "\t\t<td class=\"item_id\" style='width: 7%; background-color: #fcc;'>"
|
53
53
|
s += "<div id=\"DL_#{doc.id}\" style=\"display: block;\">"
|
54
|
-
s += "<a href=\"#\" onclick=\"downlink_OnClick(this.parentElement); return false;\" class=\"external\">#{doc.duplicated_ids_number.to_s}</a>"
|
54
|
+
s += "<a href=\"#\" onclick=\"downlink_OnClick(this.parentElement); return false;\" class=\"external\" title=\"Number of Controlled Paragraphs that have the same ID\">#{doc.duplicated_ids_number.to_s}</a>"
|
55
55
|
s += "</div>"
|
56
56
|
s += "<div id=\"DLS_#{doc.id}\" style=\"display: none;\">"
|
57
57
|
doc.duplicates_list.each do |lnk|
|
58
|
-
s += "\t\t\t<a href=\"./specifications/#{doc.id}/#{doc.id}.html##{lnk.id}\" class=\"external\">#{lnk.id}</a>\n<br>"
|
58
|
+
s += "\t\t\t<a href=\"./specifications/#{doc.id}/#{doc.id}.html##{lnk.id}\" class=\"external\" title=\"Controlled Paragraph with duplicated ID\">#{lnk.id}</a>\n<br>"
|
59
59
|
end
|
60
60
|
s += "</div>"
|
61
61
|
s += "</td>\n"
|
@@ -66,11 +66,11 @@ class Index < BaseDocument
|
|
66
66
|
if doc.wrong_links_hash.length >0
|
67
67
|
s += "\t\t<td class=\"item_id\" style='width: 7%; background-color: #fcc;'>"
|
68
68
|
s += "<div id=\"DL_#{doc.id}wl\" style=\"display: block;\">"
|
69
|
-
s += "<a href=\"#\" onclick=\"downlink_OnClick(this.parentElement); return false;\" class=\"external\">#{doc.wrong_links_hash.length.to_s}</a>"
|
69
|
+
s += "<a href=\"#\" onclick=\"downlink_OnClick(this.parentElement); return false;\" class=\"external\" title=\"Number of Controlled Paragraphs that link to non-existing items\">#{doc.wrong_links_hash.length.to_s}</a>"
|
70
70
|
s += "</div>"
|
71
71
|
s += "<div id=\"DLS_#{doc.id}wl\" style=\"display: none;\">"
|
72
72
|
doc.wrong_links_hash.each do |wrong_lnk, item|
|
73
|
-
s += "\t\t\t<a href=\"./specifications/#{doc.id}/#{doc.id}.html##{item.id}\" class=\"external\">#{wrong_lnk}</a>\n<br>"
|
73
|
+
s += "\t\t\t<a href=\"./specifications/#{doc.id}/#{doc.id}.html##{item.id}\" class=\"external\" title=\"Controlled Paragraphs that link to non-existing items\">#{wrong_lnk}</a>\n<br>"
|
74
74
|
end
|
75
75
|
s += "</div>"
|
76
76
|
s += "</td>\n"
|
@@ -94,10 +94,10 @@ class Index < BaseDocument
|
|
94
94
|
s = "<h2>Traceability Matrices</h2>\n"
|
95
95
|
s += "<table class=\"controlled\">\n"
|
96
96
|
s += "\t<thead>\n"
|
97
|
-
s += "\t\t<th>Title</th>\n"
|
98
|
-
s += "\t\t<th>Coverage</th>\n"
|
99
|
-
s += "\t\t<th>Top Document</th>\n"
|
100
|
-
s += "\t\t<th>Bottom Document</th>\n"
|
97
|
+
s += "\t\t<th title=\"Traceability Matrix Title\">Title</th>\n"
|
98
|
+
s += "\t\t<th title=\"The ratio of Controlled Paragraphs mentioned in other documents and not-mentioned ones\">Coverage</th>\n"
|
99
|
+
s += "\t\t<th title=\"Document, that contains Cotroled Paragraphs to be referenced in Bottom document(s)\">Top Document</th>\n"
|
100
|
+
s += "\t\t<th title=\"Document(s), that contains references to Controlled Paragraphs from the Top Document\">Bottom Document</th>\n"
|
101
101
|
s += "</thead>\n"
|
102
102
|
html_rows.append s
|
103
103
|
|
@@ -1,104 +1,67 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
attr_accessor :dictionary
|
6
|
-
attr_accessor :todo_blocks
|
7
|
-
attr_accessor :wrong_links_hash
|
8
|
-
|
9
|
-
attr_accessor :items_with_uplinks_number
|
10
|
-
attr_accessor :items_with_downlinks_number
|
11
|
-
attr_accessor :items_with_coverage_number
|
12
|
-
attr_accessor :duplicated_ids_number
|
13
|
-
attr_accessor :duplicates_list
|
14
|
-
attr_accessor :last_used_id
|
15
|
-
attr_accessor :last_used_id_number
|
16
|
-
attr_accessor :color
|
17
|
-
|
18
|
-
def initialize(fele_path)
|
19
|
-
super
|
20
|
-
@dictionary = Hash.new
|
21
|
-
@duplicates_list = Array.new
|
22
|
-
@todo_blocks = Array.new
|
23
|
-
@wrong_links_hash = Hash.new
|
24
|
-
|
25
|
-
@items_with_uplinks_number = 0
|
26
|
-
@items_with_downlinks_number = 0
|
27
|
-
@items_with_coverage_number = 0
|
28
|
-
@duplicated_ids_number = 0
|
29
|
-
@last_used_id = ""
|
30
|
-
@last_used_id_number = 0
|
31
|
-
|
32
|
-
@color = 'bbb'
|
3
|
+
require_relative 'persistent_document'
|
33
4
|
|
34
|
-
|
5
|
+
class Specification < PersistentDocument
|
6
|
+
attr_accessor :dictionary, :todo_blocks, :wrong_links_hash, :items_with_uplinks_number, :items_with_downlinks_number,
|
7
|
+
:items_with_coverage_number, :duplicated_ids_number, :duplicates_list, :last_used_id,
|
8
|
+
:last_used_id_number, :color
|
9
|
+
|
10
|
+
def initialize(fele_path)
|
11
|
+
super
|
12
|
+
@dictionary = {}
|
13
|
+
@duplicates_list = []
|
14
|
+
@todo_blocks = []
|
15
|
+
@wrong_links_hash = {}
|
16
|
+
|
17
|
+
@items_with_uplinks_number = 0
|
18
|
+
@items_with_downlinks_number = 0
|
19
|
+
@items_with_coverage_number = 0
|
20
|
+
@duplicated_ids_number = 0
|
21
|
+
@last_used_id = ''
|
22
|
+
@last_used_id_number = 0
|
23
|
+
|
24
|
+
@color = 'bbb'
|
25
|
+
|
26
|
+
@id = File.basename(fele_path, File.extname(fele_path)).downcase
|
27
|
+
end
|
28
|
+
|
29
|
+
def to_console
|
30
|
+
puts ''
|
31
|
+
puts "\e[33mSpecification: #{@title}\e[0m"
|
32
|
+
puts '-' * 53
|
33
|
+
puts '| Number of Controlled Items | %10d |' % @controlled_items.length
|
34
|
+
puts format('| Number of Items w/ Up-links | %10d |', @items_with_uplinks_number)
|
35
|
+
puts format('| Number of Items w/ Down-links | %10d |', @items_with_downlinks_number)
|
36
|
+
|
37
|
+
# coverage
|
38
|
+
if @controlled_items.length.positive? && (@controlled_items.length == @items_with_coverage_number)
|
39
|
+
puts format("| Number of Items w/ Test Coverage |\e[1m\e[32m %10d \e[0m|", @items_with_coverage_number)
|
40
|
+
else
|
41
|
+
puts format('| Number of Items w/ Test Coverage | %10d |', @items_with_coverage_number)
|
35
42
|
end
|
36
43
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
puts "| Number of Items w/ Up-links | %10d |" % @items_with_uplinks_number
|
43
|
-
puts "| Number of Items w/ Down-links | %10d |" % @items_with_downlinks_number
|
44
|
-
|
45
|
-
# coverage
|
46
|
-
if (@controlled_items.length > 0) && (@controlled_items.length == @items_with_coverage_number)
|
47
|
-
puts "| Number of Items w/ Test Coverage |\e[1m\e[32m %10d \e[0m|" % @items_with_coverage_number
|
48
|
-
else
|
49
|
-
puts "| Number of Items w/ Test Coverage | %10d |" % @items_with_coverage_number
|
50
|
-
end
|
51
|
-
|
52
|
-
# duplicates
|
53
|
-
if @duplicated_ids_number >0
|
54
|
-
puts "| Duplicated Item Ids found |\e[1m\e[31m %10d \e[0m|" % @duplicated_ids_number
|
55
|
-
else
|
56
|
-
puts "| Duplicated Item Ids found | %10d |" % @duplicated_ids_number
|
57
|
-
end
|
58
|
-
|
59
|
-
puts "| Last used Item Id |\e[1m\e[37m %10s \e[0m|" % @last_used_id
|
60
|
-
puts "-" * 53
|
44
|
+
# duplicates
|
45
|
+
if @duplicated_ids_number.positive?
|
46
|
+
puts format("| Duplicated Item Ids found |\e[1m\e[31m %10d \e[0m|", @duplicated_ids_number)
|
47
|
+
else
|
48
|
+
puts format('| Duplicated Item Ids found | %10d |', @duplicated_ids_number)
|
61
49
|
end
|
62
50
|
|
63
|
-
|
51
|
+
puts format("| Last used Item Id |\e[1m\e[37m %10s \e[0m|", @last_used_id)
|
52
|
+
puts '-' * 53
|
53
|
+
end
|
64
54
|
|
65
|
-
|
55
|
+
def to_html(nav_pane, output_file_path)
|
56
|
+
html_rows = []
|
66
57
|
|
67
|
-
|
68
|
-
|
69
|
-
@items.each do |item|
|
70
|
-
a = item.to_html
|
71
|
-
#a = adjust_internal_links(a, nav_pane.specifications)
|
72
|
-
html_rows.append a
|
73
|
-
end
|
74
|
-
|
75
|
-
self.save_html_to_file(html_rows, nav_pane, output_file_path)
|
76
|
-
|
77
|
-
end
|
58
|
+
html_rows.append('')
|
78
59
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
if res = /(\w*)[.]md/.match(tmp[1])
|
83
|
-
id = res[1].downcase
|
84
|
-
res = /(\w*)[.]md(#.*)/.match(tmp[1])
|
85
|
-
|
86
|
-
specifications.each do |spec|
|
87
|
-
if spec.id.downcase == id
|
88
|
-
if res && res.length > 2
|
89
|
-
anchor = res[2]
|
90
|
-
line.sub!(/<a\shref="(.*)"\sclass="external">/,
|
91
|
-
"<a href=\".\\..\\#{id}\\#{id}.html#{anchor}\" class=\"external\">")
|
92
|
-
else
|
93
|
-
line.sub!(/<a\shref="(.*)"\sclass="external">/,
|
94
|
-
"<a href=\".\\..\\#{id}\\#{id}.html\" class=\"external\">")
|
95
|
-
end
|
96
|
-
break
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
100
|
-
end
|
101
|
-
return line
|
60
|
+
@items.each do |item|
|
61
|
+
a = item.to_html
|
62
|
+
html_rows.append a
|
102
63
|
end
|
103
64
|
|
104
|
-
|
65
|
+
save_html_to_file(html_rows, nav_pane, output_file_path)
|
66
|
+
end
|
67
|
+
end
|
@@ -12,7 +12,7 @@ class DocSection
|
|
12
12
|
|
13
13
|
def to_html
|
14
14
|
s = ''
|
15
|
-
s += "\t<li><span class=\"fa-li\"><i class=\"fa fa-
|
15
|
+
s += "\t<li><span class=\"fa-li\"><i class=\"fa fa-square-o\"> </i></span>"
|
16
16
|
s += "<a href=\"\#" + @heading.anchor_id.to_s + "\">" + @heading.get_section_info + "</a>\n"
|
17
17
|
if @sections.length >0
|
18
18
|
s += "\t\t<ul class=\"fa-ul\">\n"
|
@@ -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-chevron-left" aria-hidden="true"></i></span> Index</a>
|
14
|
+
<a id="document_tree_menu_item" href="javascript:void(0)" onclick="openNav()" style="display: none;"><span><i class="fa fa-bars" aria-hidden="true"></i></span> Document Tree</a>
|
13
15
|
<input type="text" id="searchInput" placeholder="Search.." style="display: none;">
|
14
16
|
<a class="split">{{DOCUMENT_TITLE}}</a>
|
15
17
|
</div>
|
@@ -1,5 +1,9 @@
|
|
1
1
|
function openNav() {
|
2
|
-
document.getElementById("nav_pane").style.visibility
|
2
|
+
if (document.getElementById("nav_pane").style.visibility == "visible"){
|
3
|
+
document.getElementById("nav_pane").style.visibility = "hidden";
|
4
|
+
}else{
|
5
|
+
document.getElementById("nav_pane").style.visibility = "visible";
|
6
|
+
}
|
3
7
|
}
|
4
8
|
|
5
9
|
function closeNav() {
|
@@ -15,8 +19,21 @@ function openNav() {
|
|
15
19
|
elem.style.width = "640px";
|
16
20
|
}
|
17
21
|
}
|
18
|
-
if (
|
19
|
-
document.getElementById(
|
22
|
+
if (document.title == "Document Index"){
|
23
|
+
document.getElementById('document_tree_menu_item').style.display = "none";
|
24
|
+
document.getElementById('home_menu_item').style.display = "block";
|
25
|
+
document.getElementById('index_menu_item').style.display = "none";
|
26
|
+
if (document.URL.includes('http')){
|
27
|
+
document.getElementById("searchInput").style.display = "block";
|
28
|
+
}
|
29
|
+
}else{
|
30
|
+
document.getElementById('home_menu_item').style.display = "none";
|
31
|
+
document.getElementById('index_menu_item').style.display = "block";
|
32
|
+
if (document.title.includes("Traceability Matrix:")){
|
33
|
+
document.getElementById('document_tree_menu_item').style.display = "none";
|
34
|
+
} else {
|
35
|
+
document.getElementById('document_tree_menu_item').style.display = "block";
|
36
|
+
}
|
20
37
|
}
|
21
38
|
// Scroll a bit to make navigated anchor visible
|
22
39
|
//setTimeout(function() {
|
@@ -12,7 +12,9 @@ const db = await create({
|
|
12
12
|
}
|
13
13
|
})
|
14
14
|
// Load JSON DB
|
15
|
-
const
|
15
|
+
const rel_location = window.location.href.split('/').slice(0,-1).join('/');
|
16
|
+
const json_location = rel_location + "/data/specifications_db.json";
|
17
|
+
const response = await fetch(json_location);
|
16
18
|
const data_rows = await response.json();
|
17
19
|
let i = 0;
|
18
20
|
while (i < data_rows.length) {
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: Almirah
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oleksandr Ivanov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-06-
|
11
|
+
date: 2024-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: The software part of the Almirah framework
|
14
14
|
email: oleksandr.ivanov.development@gmail.com
|