Almirah 0.2.4 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
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 -20
  11. data/lib/almirah/doc_items/frontmatter.rb +9 -0
  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 -158
  15. data/lib/almirah/doc_items/markdown_table.rb +61 -63
  16. data/lib/almirah/doc_items/paragraph.rb +25 -27
  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 -330
  20. data/lib/almirah/doc_types/base_document.rb +64 -70
  21. data/lib/almirah/doc_types/coverage.rb +95 -81
  22. data/lib/almirah/doc_types/index.rb +173 -169
  23. data/lib/almirah/doc_types/persistent_document.rb +17 -20
  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 -72
  29. data/lib/almirah/navigation_pane.rb +16 -16
  30. data/lib/almirah/project.rb +287 -306
  31. data/lib/almirah/project_configuration.rb +41 -41
  32. data/lib/almirah/project_template.rb +298 -0
  33. data/lib/almirah/project_utility.rb +52 -0
  34. data/lib/almirah/search/specifications_db.rb +79 -83
  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 -49
  41. metadata +28 -5
@@ -1,63 +1,61 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'doc_item'
4
-
5
- class MarkdownTable < DocItem
6
- attr_accessor :column_names, :rows, :heading_row, :is_separator_detected
7
-
8
- def initialize(doc, heading_row)
9
- super()
10
- @parent_doc = doc
11
- @parent_heading = doc.headings[-1]
12
- @heading_row = heading_row
13
-
14
- res = /^[|](.*[|])/.match(heading_row)
15
- @column_names = if res
16
- res[1].split('|')
17
- else
18
- ['# ERROR# ']
19
- end
20
- @rows = []
21
- @is_separator_detected = false
22
- end
23
-
24
- def add_row(row)
25
- columns = row.split('|')
26
- @rows.append(columns.map!(&:strip))
27
- true
28
- end
29
-
30
- def to_html
31
- s = ''
32
- if @@html_table_render_in_progress
33
- s += "</table>\n"
34
- @@html_table_render_in_progress = false
35
- end
36
-
37
- s += "<table class=\"markdown_table\">\n"
38
- s += "\t<thead>"
39
-
40
- @column_names.each do |h|
41
- s += " <th>#{h}</th>"
42
- end
43
-
44
- s += " </thead>\n"
45
-
46
- @rows.each do |row|
47
- s += "\t<tr>\n"
48
- row.each do |col|
49
- if col.to_i.positive? && col.to_i.to_s == col # autoalign cells with numbers
50
- s += "\t\t<td style=\"text-align: center;\">#{col}</td>\n"
51
- else
52
- f_text = format_string(col)
53
- s += "\t\t<td>#{f_text}</td>\n"
54
- end
55
- end
56
- s += "\t</tr>\n"
57
- end
58
-
59
- s += "</table>\n"
60
-
61
- s
62
- end
63
- end
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'doc_item'
4
+
5
+ class MarkdownTable < DocItem
6
+ attr_accessor :column_names, :rows, :heading_row, :is_separator_detected
7
+
8
+ def initialize(doc, heading_row)
9
+ super(doc)
10
+ @heading_row = heading_row
11
+
12
+ res = /^[|](.*[|])/.match(heading_row)
13
+ @column_names = if res
14
+ res[1].split('|')
15
+ else
16
+ ['# ERROR# ']
17
+ end
18
+ @rows = []
19
+ @is_separator_detected = false
20
+ end
21
+
22
+ def add_row(row)
23
+ columns = row.split('|')
24
+ @rows.append(columns.map!(&:strip))
25
+ true
26
+ end
27
+
28
+ def to_html
29
+ s = ''
30
+ if @@html_table_render_in_progress
31
+ s += "</table>\n"
32
+ @@html_table_render_in_progress = false
33
+ end
34
+
35
+ s += "<table class=\"markdown_table\">\n"
36
+ s += "\t<thead>"
37
+
38
+ @column_names.each do |h|
39
+ s += " <th>#{h}</th>"
40
+ end
41
+
42
+ s += " </thead>\n"
43
+
44
+ @rows.each do |row|
45
+ s += "\t<tr>\n"
46
+ row.each do |col|
47
+ if col.to_i.positive? && col.to_i.to_s == col # autoalign cells with numbers
48
+ s += "\t\t<td style=\"text-align: center;\">#{col}</td>\n"
49
+ else
50
+ f_text = format_string(col)
51
+ s += "\t\t<td>#{f_text}</td>\n"
52
+ end
53
+ end
54
+ s += "\t</tr>\n"
55
+ end
56
+
57
+ s += "</table>\n"
58
+
59
+ s
60
+ end
61
+ end
@@ -1,27 +1,25 @@
1
- require_relative "doc_item"
2
-
3
- class Paragraph < DocItem
4
-
5
- attr_accessor :text
6
-
7
- def initialize(doc, text)
8
- @parent_doc = doc
9
- @parent_heading = doc.headings[-1]
10
- @text = text.strip
11
- end
12
-
13
- def getTextWithoutSpaces
14
- return @text.split.join('-').downcase
15
- end
16
-
17
- def to_html
18
- s = ''
19
- if @@html_table_render_in_progress
20
- s += "</table>"
21
- @@html_table_render_in_progress = false
22
- end
23
-
24
- s += "<p>" + format_string(@text)
25
- return s
26
- end
27
- end
1
+ require_relative 'doc_item'
2
+
3
+ class Paragraph < DocItem
4
+ attr_accessor :text
5
+
6
+ def initialize(doc, text)
7
+ super(doc)
8
+ @text = text.strip
9
+ end
10
+
11
+ def getTextWithoutSpaces
12
+ @text.split.join('-').downcase
13
+ end
14
+
15
+ def to_html
16
+ s = ''
17
+ if @@html_table_render_in_progress
18
+ s += '</table>'
19
+ @@html_table_render_in_progress = false
20
+ end
21
+
22
+ s += "<p>#{format_string(@text)}"
23
+ s
24
+ end
25
+ end