Almirah 0.2.4 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/almirah +4 -4
- data/lib/almirah/doc_fabric.rb +65 -65
- data/lib/almirah/doc_items/blockquote.rb +21 -21
- data/lib/almirah/doc_items/code_block.rb +26 -26
- data/lib/almirah/doc_items/controlled_paragraph.rb +112 -112
- data/lib/almirah/doc_items/controlled_table.rb +224 -224
- data/lib/almirah/doc_items/controlled_table_row.rb +22 -22
- data/lib/almirah/doc_items/doc_footer.rb +16 -16
- data/lib/almirah/doc_items/doc_item.rb +22 -20
- data/lib/almirah/doc_items/frontmatter.rb +9 -0
- data/lib/almirah/doc_items/heading.rb +93 -93
- data/lib/almirah/doc_items/image.rb +27 -27
- data/lib/almirah/doc_items/markdown_list.rb +156 -158
- data/lib/almirah/doc_items/markdown_table.rb +61 -63
- data/lib/almirah/doc_items/paragraph.rb +25 -27
- data/lib/almirah/doc_items/text_line.rb +296 -296
- data/lib/almirah/doc_items/todo_block.rb +21 -21
- data/lib/almirah/doc_parser.rb +378 -330
- data/lib/almirah/doc_types/base_document.rb +64 -70
- data/lib/almirah/doc_types/coverage.rb +95 -81
- data/lib/almirah/doc_types/index.rb +173 -169
- data/lib/almirah/doc_types/persistent_document.rb +17 -20
- data/lib/almirah/doc_types/protocol.rb +24 -24
- data/lib/almirah/doc_types/specification.rb +67 -67
- data/lib/almirah/doc_types/traceability.rb +142 -142
- data/lib/almirah/dom/doc_section.rb +25 -25
- data/lib/almirah/dom/document.rb +78 -72
- data/lib/almirah/navigation_pane.rb +16 -16
- data/lib/almirah/project.rb +287 -306
- data/lib/almirah/project_configuration.rb +41 -41
- data/lib/almirah/project_template.rb +298 -0
- data/lib/almirah/project_utility.rb +52 -0
- data/lib/almirah/search/specifications_db.rb +79 -83
- data/lib/almirah/templates/css/main.css +300 -300
- data/lib/almirah/templates/css/search.css +40 -40
- data/lib/almirah/templates/page.html +42 -42
- data/lib/almirah/templates/scripts/main.js +111 -111
- data/lib/almirah/templates/scripts/orama_search.js +138 -138
- data/lib/almirah.rb +93 -49
- 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
|
-
@
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
s
|
60
|
-
|
61
|
-
|
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
|
2
|
-
|
3
|
-
class Paragraph < DocItem
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
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
|