Almirah 0.2.5 → 0.2.6

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.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/bin/almirah +4 -4
  3. data/lib/almirah/doc_fabric.rb +65 -65
  4. data/lib/almirah/doc_items/blockquote.rb +21 -21
  5. data/lib/almirah/doc_items/code_block.rb +26 -26
  6. data/lib/almirah/doc_items/controlled_paragraph.rb +112 -112
  7. data/lib/almirah/doc_items/controlled_table.rb +224 -224
  8. data/lib/almirah/doc_items/controlled_table_row.rb +22 -22
  9. data/lib/almirah/doc_items/doc_footer.rb +16 -16
  10. data/lib/almirah/doc_items/doc_item.rb +22 -22
  11. data/lib/almirah/doc_items/frontmatter.rb +9 -9
  12. data/lib/almirah/doc_items/heading.rb +93 -93
  13. data/lib/almirah/doc_items/image.rb +27 -27
  14. data/lib/almirah/doc_items/markdown_list.rb +156 -156
  15. data/lib/almirah/doc_items/markdown_table.rb +61 -61
  16. data/lib/almirah/doc_items/paragraph.rb +25 -25
  17. data/lib/almirah/doc_items/text_line.rb +296 -296
  18. data/lib/almirah/doc_items/todo_block.rb +21 -21
  19. data/lib/almirah/doc_parser.rb +378 -378
  20. data/lib/almirah/doc_types/base_document.rb +64 -64
  21. data/lib/almirah/doc_types/coverage.rb +95 -80
  22. data/lib/almirah/doc_types/index.rb +173 -173
  23. data/lib/almirah/doc_types/persistent_document.rb +17 -17
  24. data/lib/almirah/doc_types/protocol.rb +24 -24
  25. data/lib/almirah/doc_types/specification.rb +67 -67
  26. data/lib/almirah/doc_types/traceability.rb +142 -142
  27. data/lib/almirah/dom/doc_section.rb +25 -25
  28. data/lib/almirah/dom/document.rb +78 -78
  29. data/lib/almirah/navigation_pane.rb +16 -16
  30. data/lib/almirah/project.rb +287 -287
  31. data/lib/almirah/project_configuration.rb +41 -41
  32. data/lib/almirah/project_template.rb +298 -298
  33. data/lib/almirah/project_utility.rb +52 -0
  34. data/lib/almirah/search/specifications_db.rb +79 -79
  35. data/lib/almirah/templates/css/main.css +300 -300
  36. data/lib/almirah/templates/css/search.css +40 -40
  37. data/lib/almirah/templates/page.html +42 -42
  38. data/lib/almirah/templates/scripts/main.js +111 -111
  39. data/lib/almirah/templates/scripts/orama_search.js +138 -138
  40. data/lib/almirah.rb +93 -58
  41. metadata +4 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 71154c27766a7774835e0c6b51d555c859cadb28297f4f66c40e8687dcf53692
4
- data.tar.gz: 6ec9713d086508afe732073729a8e97e3ac5bb985e43a111f29608d6de87948c
3
+ metadata.gz: 163089850b213b2d22e6f4eacb5497d86afa143ecd5f2c02f1b9f2985e8b22cf
4
+ data.tar.gz: b6c93f44780216b6d8f898c7f037efe22ebdcf92978d68ab907fc6794e6bdac1
5
5
  SHA512:
6
- metadata.gz: b56be1e40f2ebdafffe0bdac306f98f015e7221f98ee87305cf3e574b19824ef44513f11c8a1912414673b4d7fe582797f9d58dcf49654e701f76bfb0e221dd7
7
- data.tar.gz: 6a389036b0e41048be97450e7148853adfa192eebf14725cb912c8baebb159f4d0940481e668a5292ad26607ade67742b4edbde7be36dab769b1df6db17fc92a
6
+ metadata.gz: dfb26159036daa64ab4107352aab6f1e4ae0f92945050945d46a4742d59eddc223a23e6108189595120ec63e44ad85e07a198222574f238391ac091c903965a3
7
+ data.tar.gz: fe7a12729f62b9b5faee456c2d6ce9fe31d1730da4e9cd0c1057ad4420043eb8628f79b67b4bc38f57aafc49b890f9ec7627814c4fae44cb0d7486b5c5821b05
data/bin/almirah CHANGED
@@ -1,5 +1,5 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "almirah"
4
-
1
+ #!/usr/bin/env ruby
2
+
3
+ require "almirah"
4
+
5
5
  CLI.start(ARGV)
@@ -1,65 +1,65 @@
1
- require_relative 'doc_types/base_document'
2
- require_relative 'doc_types/specification'
3
- require_relative 'doc_types/protocol'
4
- require_relative 'doc_types/coverage'
5
- require_relative 'doc_parser'
6
- require_relative 'dom/document'
7
- require_relative 'doc_items/heading'
8
-
9
- class DocFabric
10
- @@color_index = 0
11
- @@spec_colors = %w[cff4d2 fbeee6 ffcad4 bce6ff e4dfd9 f9e07f cbe54e d3e7ee eab595 86e3c3
12
- ffdca2 ffffff ffdd94 d0e6a5 ffb284 f3dbcf c9bbc8 c6c09c]
13
-
14
- def self.add_lazy_doc_id(path)
15
- if res = /(\w+)[.]md$/.match(path)
16
- TextLine.add_lazy_doc_id(res[1])
17
- end
18
- end
19
-
20
- def self.create_specification(path)
21
- color = @@spec_colors[@@color_index]
22
- @@color_index += 1
23
- @@color_index = 0 if @@color_index >= @@spec_colors.length
24
- doc = Specification.new path
25
- DocFabric.parse_document doc
26
- doc.color = color
27
- doc
28
- end
29
-
30
- def self.create_protocol(path)
31
- doc = Protocol.new path
32
- DocFabric.parse_document doc
33
- doc
34
- end
35
-
36
- def self.create_coverage_matrix(specification)
37
- doc = Coverage.new specification
38
- Heading.reset_global_section_number
39
- doc.headings << Heading.new(doc, doc.title, 0)
40
- # Build dom
41
- doc.dom = Document.new(doc.headings)
42
- doc
43
- end
44
-
45
- def self.create_traceability_document(top_document, bottom_document)
46
- doc = Traceability.new top_document, bottom_document
47
- Heading.reset_global_section_number
48
- doc.headings << Heading.new(doc, doc.title, 0)
49
- # Build dom
50
- doc.dom = Document.new(doc.headings)
51
- doc
52
- end
53
-
54
- def self.parse_document(doc)
55
-
56
- file = File.open(doc.path)
57
- file_lines = file.readlines
58
- file.close
59
-
60
- DocParser.parse(doc, file_lines)
61
-
62
- # Build dom
63
- doc.dom = Document.new(doc.headings) if doc.is_a?(Specification) || doc.is_a?(Protocol)
64
- end
65
- end
1
+ require_relative 'doc_types/base_document'
2
+ require_relative 'doc_types/specification'
3
+ require_relative 'doc_types/protocol'
4
+ require_relative 'doc_types/coverage'
5
+ require_relative 'doc_parser'
6
+ require_relative 'dom/document'
7
+ require_relative 'doc_items/heading'
8
+
9
+ class DocFabric
10
+ @@color_index = 0
11
+ @@spec_colors = %w[cff4d2 fbeee6 ffcad4 bce6ff e4dfd9 f9e07f cbe54e d3e7ee eab595 86e3c3
12
+ ffdca2 ffffff ffdd94 d0e6a5 ffb284 f3dbcf c9bbc8 c6c09c]
13
+
14
+ def self.add_lazy_doc_id(path)
15
+ if res = /(\w+)[.]md$/.match(path)
16
+ TextLine.add_lazy_doc_id(res[1])
17
+ end
18
+ end
19
+
20
+ def self.create_specification(path)
21
+ color = @@spec_colors[@@color_index]
22
+ @@color_index += 1
23
+ @@color_index = 0 if @@color_index >= @@spec_colors.length
24
+ doc = Specification.new path
25
+ DocFabric.parse_document doc
26
+ doc.color = color
27
+ doc
28
+ end
29
+
30
+ def self.create_protocol(path)
31
+ doc = Protocol.new path
32
+ DocFabric.parse_document doc
33
+ doc
34
+ end
35
+
36
+ def self.create_coverage_matrix(specification)
37
+ doc = Coverage.new specification
38
+ Heading.reset_global_section_number
39
+ doc.headings << Heading.new(doc, doc.title, 0)
40
+ # Build dom
41
+ doc.dom = Document.new(doc.headings)
42
+ doc
43
+ end
44
+
45
+ def self.create_traceability_document(top_document, bottom_document)
46
+ doc = Traceability.new top_document, bottom_document
47
+ Heading.reset_global_section_number
48
+ doc.headings << Heading.new(doc, doc.title, 0)
49
+ # Build dom
50
+ doc.dom = Document.new(doc.headings)
51
+ doc
52
+ end
53
+
54
+ def self.parse_document(doc)
55
+
56
+ file = File.open(doc.path)
57
+ file_lines = file.readlines
58
+ file.close
59
+
60
+ DocParser.parse(doc, file_lines)
61
+
62
+ # Build dom
63
+ doc.dom = Document.new(doc.headings) if doc.is_a?(Specification) || doc.is_a?(Protocol)
64
+ end
65
+ end
@@ -1,22 +1,22 @@
1
- require_relative "doc_item"
2
-
3
- class Blockquote < DocItem
4
-
5
- attr_accessor :text
6
-
7
- def initialize(text)
8
- @text = text
9
- end
10
-
11
- def to_html
12
- s = ''
13
- f_text = format_string(@text)
14
- if @@html_table_render_in_progress
15
- s += "</table>\n"
16
- @@html_table_render_in_progress = false
17
- end
18
-
19
- s += "<div class=\"blockquote\"><p>#{f_text}</div>\n"
20
- return s
21
- end
1
+ require_relative "doc_item"
2
+
3
+ class Blockquote < DocItem
4
+
5
+ attr_accessor :text
6
+
7
+ def initialize(text)
8
+ @text = text
9
+ end
10
+
11
+ def to_html
12
+ s = ''
13
+ f_text = format_string(@text)
14
+ if @@html_table_render_in_progress
15
+ s += "</table>\n"
16
+ @@html_table_render_in_progress = false
17
+ end
18
+
19
+ s += "<div class=\"blockquote\"><p>#{f_text}</div>\n"
20
+ return s
21
+ end
22
22
  end
@@ -1,27 +1,27 @@
1
- require_relative "doc_item"
2
-
3
- class CodeBlock < DocItem
4
-
5
- attr_accessor :suggested_format
6
- attr_accessor :code_lines
7
-
8
- def initialize(suggested_format)
9
- @suggested_format = suggested_format
10
- @code_lines = Array.new
11
- end
12
-
13
- def to_html
14
- s = ''
15
-
16
- if @@html_table_render_in_progress
17
- s += "</table>\n"
18
- @@html_table_render_in_progress = false
19
- end
20
- s += "<code>"
21
- @code_lines.each do |l|
22
- s += l + " </br>"
23
- end
24
- s += "</code>\n"
25
- return s
26
- end
1
+ require_relative "doc_item"
2
+
3
+ class CodeBlock < DocItem
4
+
5
+ attr_accessor :suggested_format
6
+ attr_accessor :code_lines
7
+
8
+ def initialize(suggested_format)
9
+ @suggested_format = suggested_format
10
+ @code_lines = Array.new
11
+ end
12
+
13
+ def to_html
14
+ s = ''
15
+
16
+ if @@html_table_render_in_progress
17
+ s += "</table>\n"
18
+ @@html_table_render_in_progress = false
19
+ end
20
+ s += "<code>"
21
+ @code_lines.each do |l|
22
+ s += l + " </br>"
23
+ end
24
+ s += "</code>\n"
25
+ return s
26
+ end
27
27
  end
@@ -1,112 +1,112 @@
1
- require_relative 'paragraph'
2
-
3
- class ControlledParagraph < Paragraph
4
- attr_accessor :id, :up_link_ids, :down_links, :coverage_links
5
-
6
- def initialize(doc, text, id)
7
- super(doc, text)
8
- @parent_heading = doc.headings[-1]
9
- @id = id
10
- @up_link_ids = nil
11
- @down_links = nil
12
- @coverage_links = nil
13
- end
14
-
15
- def to_html
16
- s = ''
17
- unless @@html_table_render_in_progress
18
- s += "<table class=\"controlled\">\n"
19
- s += "\t<thead> <th>#</th> <th></th> <th title=\"Up-links\">UL</th> <th title=\"Down-links\">DL</th> \
20
- <th title=\"Test Coverage\">COV</th> </thead>\n"
21
- @@html_table_render_in_progress = true # rubocop:disable Style/ClassVars
22
- end
23
- f_text = format_string(@text)
24
- s += "\t<tr>\n"
25
- s += "\t\t<td class=\"item_id\"> \
26
- <a name=\"#{@id}\" id=\"#{@id}\" href=\"##{@id}\" title=\"Paragraph ID\">#{@id}</a></td>\n"
27
- s += "\t\t<td class=\"item_text\">#{f_text}</td>\n"
28
-
29
- if @up_link_ids
30
- if @up_link_ids.length == 1
31
- if tmp = /^([a-zA-Z]+)-\d+/.match(@up_link_ids[0])
32
- up_link_doc_name = tmp[1].downcase
33
- end
34
- s += "\t\t<td class=\"item_id\">\
35
- <a href=\"./../#{up_link_doc_name}/#{up_link_doc_name}.html##{@up_link_ids[0]}\" \
36
- class=\"external\" title=\"Linked to\">#{@up_link_ids[0]}</a></td>\n"
37
- else
38
- s += "\t\t<td class=\"item_id\">"
39
- s += "<div id=\"UL_#{@id}\" style=\"display: block;\">"
40
- s += "<a href=\"#\" onclick=\"upLink_OnClick(this.parentElement); return false;\" \
41
- class=\"external\" title=\"Number of up-links\">#{@up_link_ids.length}</a>"
42
- s += '</div>'
43
- s += "<div id=\"ULS_#{@id}\" style=\"display: none;\">"
44
- @up_link_ids.each do |lnk|
45
- if tmp = /^([a-zA-Z]+)-\d+/.match(lnk)
46
- up_link_doc_name = tmp[1].downcase
47
- end
48
- s += "\t\t\t<a href=\"./../#{up_link_doc_name}/#{up_link_doc_name}.html##{lnk}\" \
49
- class=\"external\" title=\"Linked to\">#{lnk}</a>\n<br>"
50
- end
51
- s += '</div>'
52
- s += "</td>\n"
53
- end
54
- else
55
- s += "\t\t<td class=\"item_id\"></td>\n"
56
- end
57
-
58
- if @down_links
59
- if tmp = /^([a-zA-Z]+)-\d+/.match(@down_links[0].id) # guessing that all the links refer to one document
60
- down_link_doc_name = tmp[1].downcase
61
- end
62
- if @down_links.length == 1
63
- s += "\t\t<td class=\"item_id\">\
64
- <a href=\"./../#{down_link_doc_name}/#{down_link_doc_name}.html##{@down_links[0].id}\" \
65
- class=\"external\" title=\"Referenced in\">#{@down_links[0].id}</a></td>\n"
66
- else
67
- s += "\t\t<td class=\"item_id\">"
68
- s += "<div id=\"DL_#{@id}\" style=\"display: block;\">"
69
- s += "<a href=\"#\" onclick=\"downlink_OnClick(this.parentElement); return false;\" \
70
- class=\"external\" title=\"Number of references\">#{@down_links.length}</a>"
71
- s += '</div>'
72
- s += "<div id=\"DLS_#{@id}\" style=\"display: none;\">"
73
- @down_links.each do |lnk|
74
- s += "\t\t\t<a href=\"./../#{lnk.parent_doc.id}/#{lnk.parent_doc.id}.html##{lnk.id}\" \
75
- class=\"external\" title=\"Referenced in\">#{lnk.id}</a>\n<br>"
76
- end
77
- s += '</div>'
78
- s += "</td>\n"
79
- end
80
- else
81
- s += "\t\t<td class=\"item_id\"></td>\n"
82
- end
83
-
84
- if @coverage_links
85
- if tmp = /^(.+)[.]\d+/.match(@coverage_links[0].id) # guessing that all the links refer to one document
86
- cov_link_doc_name = tmp[1].downcase
87
- end
88
- if @coverage_links.length == 1
89
- s += "\t\t<td class=\"item_id\">\
90
- <a href=\"./../../tests/protocols/#{cov_link_doc_name}/#{cov_link_doc_name}.html\" \
91
- class=\"external\" title=\"Number of verification steps\">#{@coverage_links[0].id}</a></td>\n"
92
- else
93
- s += "\t\t<td class=\"item_id\">"
94
- s += "<div id=\"COV_#{@id}\" style=\"display: block;\">"
95
- s += "<a href=\"#\" onclick=\"coverageLink_OnClick(this.parentElement); return false;\" \
96
- class=\"external\" title=\"Number of verification steps\">#{@coverage_links.length}</a>"
97
- s += '</div>'
98
- s += "<div id=\"COVS_#{@id}\" style=\"display: none;\">"
99
- @coverage_links.each do |lnk|
100
- s += "\t\t\t<a href=\"./../../tests/protocols/#{lnk.parent_doc.id}/#{lnk.parent_doc.id}.html##{lnk.id}\" \
101
- class=\"external\" title=\"Covered in\">#{lnk.id}</a>\n<br>"
102
- end
103
- s += '</div>'
104
- s += "</td>\n"
105
- end
106
- else
107
- s += "\t\t<td class=\"item_id\"></td>\n"
108
- end
109
- s += "\t</tr>\n"
110
- s
111
- end
112
- end
1
+ require_relative 'paragraph'
2
+
3
+ class ControlledParagraph < Paragraph
4
+ attr_accessor :id, :up_link_ids, :down_links, :coverage_links
5
+
6
+ def initialize(doc, text, id)
7
+ super(doc, text)
8
+ @parent_heading = doc.headings[-1]
9
+ @id = id
10
+ @up_link_ids = nil
11
+ @down_links = nil
12
+ @coverage_links = nil
13
+ end
14
+
15
+ def to_html
16
+ s = ''
17
+ unless @@html_table_render_in_progress
18
+ s += "<table class=\"controlled\">\n"
19
+ s += "\t<thead> <th>#</th> <th></th> <th title=\"Up-links\">UL</th> <th title=\"Down-links\">DL</th> \
20
+ <th title=\"Test Coverage\">COV</th> </thead>\n"
21
+ @@html_table_render_in_progress = true # rubocop:disable Style/ClassVars
22
+ end
23
+ f_text = format_string(@text)
24
+ s += "\t<tr>\n"
25
+ s += "\t\t<td class=\"item_id\"> \
26
+ <a name=\"#{@id}\" id=\"#{@id}\" href=\"##{@id}\" title=\"Paragraph ID\">#{@id}</a></td>\n"
27
+ s += "\t\t<td class=\"item_text\">#{f_text}</td>\n"
28
+
29
+ if @up_link_ids
30
+ if @up_link_ids.length == 1
31
+ if tmp = /^([a-zA-Z]+)-\d+/.match(@up_link_ids[0])
32
+ up_link_doc_name = tmp[1].downcase
33
+ end
34
+ s += "\t\t<td class=\"item_id\">\
35
+ <a href=\"./../#{up_link_doc_name}/#{up_link_doc_name}.html##{@up_link_ids[0]}\" \
36
+ class=\"external\" title=\"Linked to\">#{@up_link_ids[0]}</a></td>\n"
37
+ else
38
+ s += "\t\t<td class=\"item_id\">"
39
+ s += "<div id=\"UL_#{@id}\" style=\"display: block;\">"
40
+ s += "<a href=\"#\" onclick=\"upLink_OnClick(this.parentElement); return false;\" \
41
+ class=\"external\" title=\"Number of up-links\">#{@up_link_ids.length}</a>"
42
+ s += '</div>'
43
+ s += "<div id=\"ULS_#{@id}\" style=\"display: none;\">"
44
+ @up_link_ids.each do |lnk|
45
+ if tmp = /^([a-zA-Z]+)-\d+/.match(lnk)
46
+ up_link_doc_name = tmp[1].downcase
47
+ end
48
+ s += "\t\t\t<a href=\"./../#{up_link_doc_name}/#{up_link_doc_name}.html##{lnk}\" \
49
+ class=\"external\" title=\"Linked to\">#{lnk}</a>\n<br>"
50
+ end
51
+ s += '</div>'
52
+ s += "</td>\n"
53
+ end
54
+ else
55
+ s += "\t\t<td class=\"item_id\"></td>\n"
56
+ end
57
+
58
+ if @down_links
59
+ if tmp = /^([a-zA-Z]+)-\d+/.match(@down_links[0].id) # guessing that all the links refer to one document
60
+ down_link_doc_name = tmp[1].downcase
61
+ end
62
+ if @down_links.length == 1
63
+ s += "\t\t<td class=\"item_id\">\
64
+ <a href=\"./../#{down_link_doc_name}/#{down_link_doc_name}.html##{@down_links[0].id}\" \
65
+ class=\"external\" title=\"Referenced in\">#{@down_links[0].id}</a></td>\n"
66
+ else
67
+ s += "\t\t<td class=\"item_id\">"
68
+ s += "<div id=\"DL_#{@id}\" style=\"display: block;\">"
69
+ s += "<a href=\"#\" onclick=\"downlink_OnClick(this.parentElement); return false;\" \
70
+ class=\"external\" title=\"Number of references\">#{@down_links.length}</a>"
71
+ s += '</div>'
72
+ s += "<div id=\"DLS_#{@id}\" style=\"display: none;\">"
73
+ @down_links.each do |lnk|
74
+ s += "\t\t\t<a href=\"./../#{lnk.parent_doc.id}/#{lnk.parent_doc.id}.html##{lnk.id}\" \
75
+ class=\"external\" title=\"Referenced in\">#{lnk.id}</a>\n<br>"
76
+ end
77
+ s += '</div>'
78
+ s += "</td>\n"
79
+ end
80
+ else
81
+ s += "\t\t<td class=\"item_id\"></td>\n"
82
+ end
83
+
84
+ if @coverage_links
85
+ if tmp = /^(.+)[.]\d+/.match(@coverage_links[0].id) # guessing that all the links refer to one document
86
+ cov_link_doc_name = tmp[1].downcase
87
+ end
88
+ if @coverage_links.length == 1
89
+ s += "\t\t<td class=\"item_id\">\
90
+ <a href=\"./../../tests/protocols/#{cov_link_doc_name}/#{cov_link_doc_name}.html\" \
91
+ class=\"external\" title=\"Number of verification steps\">#{@coverage_links[0].id}</a></td>\n"
92
+ else
93
+ s += "\t\t<td class=\"item_id\">"
94
+ s += "<div id=\"COV_#{@id}\" style=\"display: block;\">"
95
+ s += "<a href=\"#\" onclick=\"coverageLink_OnClick(this.parentElement); return false;\" \
96
+ class=\"external\" title=\"Number of verification steps\">#{@coverage_links.length}</a>"
97
+ s += '</div>'
98
+ s += "<div id=\"COVS_#{@id}\" style=\"display: none;\">"
99
+ @coverage_links.each do |lnk|
100
+ s += "\t\t\t<a href=\"./../../tests/protocols/#{lnk.parent_doc.id}/#{lnk.parent_doc.id}.html##{lnk.id}\" \
101
+ class=\"external\" title=\"Covered in\">#{lnk.id}</a>\n<br>"
102
+ end
103
+ s += '</div>'
104
+ s += "</td>\n"
105
+ end
106
+ else
107
+ s += "\t\t<td class=\"item_id\"></td>\n"
108
+ end
109
+ s += "\t</tr>\n"
110
+ s
111
+ end
112
+ end