Almirah 0.2.2 → 0.2.4
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_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
@@ -1,98 +1,93 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'paragraph'
|
2
4
|
|
3
5
|
class Heading < Paragraph
|
6
|
+
attr_accessor :level, :anchor_id, :section_number
|
4
7
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
def initialize(doc, text, level)
|
12
|
-
@parent_doc = doc
|
13
|
-
@text = text
|
14
|
-
@level = level
|
15
|
-
|
16
|
-
if level != 0 # skip Doc Title
|
17
|
-
if @@global_section_number == ""
|
18
|
-
@@global_section_number = "1"
|
19
|
-
for n in 1..(level-1) do
|
20
|
-
@@global_section_number += ".1"
|
21
|
-
end
|
22
|
-
else
|
23
|
-
previous_level = @@global_section_number.split(".").length
|
24
|
-
|
25
|
-
if previous_level == level
|
26
|
-
|
27
|
-
a = @@global_section_number.split(".")
|
28
|
-
a[-1] = (a[-1].to_i() +1).to_s
|
29
|
-
@@global_section_number = a.join(".")
|
30
|
-
|
31
|
-
elsif level > previous_level
|
32
|
-
|
33
|
-
a = @@global_section_number.split(".")
|
34
|
-
a.push("1")
|
35
|
-
@@global_section_number = a.join(".")
|
36
|
-
|
37
|
-
else # level < previous_level
|
38
|
-
|
39
|
-
a = @@global_section_number.split(".")
|
40
|
-
delta = previous_level - level
|
41
|
-
a.pop(delta)
|
42
|
-
@@global_section_number = a.join(".")
|
43
|
-
# increment
|
44
|
-
a = @@global_section_number.split(".")
|
45
|
-
a[-1] = (a[-1].to_i() +1).to_s
|
46
|
-
@@global_section_number = a.join(".")
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
@section_number = @@global_section_number
|
51
|
-
@anchor_id = get_anchor_text()
|
52
|
-
end
|
8
|
+
@@global_section_number = ''
|
9
|
+
|
10
|
+
def initialize(doc, text, level)
|
11
|
+
super(doc, text)
|
12
|
+
@level = level
|
53
13
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
14
|
+
if level != 0 # skip Doc Title
|
15
|
+
if @@global_section_number == ''
|
16
|
+
@@global_section_number = '1'
|
17
|
+
(1..(level - 1)).each do |_n|
|
18
|
+
@@global_section_number += '.1'
|
59
19
|
end
|
60
|
-
|
20
|
+
else
|
21
|
+
previous_level = @@global_section_number.split('.').length
|
61
22
|
|
62
|
-
|
63
|
-
s = @section_number + "-" + getTextWithoutSpaces()
|
64
|
-
end
|
23
|
+
if previous_level == level
|
65
24
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
s += "</table>\n"
|
70
|
-
@@htmlTableRenderInProgress = false
|
71
|
-
end
|
72
|
-
heading_level = level.to_s
|
73
|
-
heading_text = get_section_info()
|
74
|
-
if level == 0
|
75
|
-
heading_level = 1.to_s # Render Doc Title as a regular h1
|
76
|
-
heading_text = @text # Doc Title does not have a section number
|
77
|
-
end
|
78
|
-
s += "<a name=\"#{@anchor_id}\"></a>\n"
|
79
|
-
s += "<h#{heading_level}> #{heading_text} <a href=\"\##{@anchor_id}\" class=\"heading_anchor\">"
|
80
|
-
s += "¶</a></h#{heading_level}>"
|
81
|
-
return s
|
82
|
-
end
|
25
|
+
a = @@global_section_number.split('.')
|
26
|
+
a[-1] = (a[-1].to_i + 1).to_s
|
27
|
+
@@global_section_number = a.join('.')
|
83
28
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
29
|
+
elsif level > previous_level
|
30
|
+
|
31
|
+
a = @@global_section_number.split('.')
|
32
|
+
a.push('1')
|
33
|
+
@@global_section_number = a.join('.')
|
34
|
+
|
35
|
+
else # level < previous_level
|
36
|
+
|
37
|
+
a = @@global_section_number.split('.')
|
38
|
+
delta = previous_level - level
|
39
|
+
a.pop(delta)
|
40
|
+
@@global_section_number = a.join('.')
|
41
|
+
# increment
|
42
|
+
a = @@global_section_number.split('.')
|
43
|
+
a[-1] = (a[-1].to_i + 1).to_s
|
44
|
+
@@global_section_number = a.join('.')
|
88
45
|
end
|
46
|
+
end
|
89
47
|
end
|
90
|
-
|
91
|
-
|
92
|
-
|
48
|
+
@section_number = @@global_section_number
|
49
|
+
@anchor_id = get_anchor_text
|
50
|
+
end
|
51
|
+
|
52
|
+
def get_section_info
|
53
|
+
if level.zero? # Doc Title
|
54
|
+
@text
|
55
|
+
else
|
56
|
+
"#{@section_number} #{@text}"
|
93
57
|
end
|
58
|
+
end
|
94
59
|
|
95
|
-
|
96
|
-
|
60
|
+
def get_anchor_text
|
61
|
+
"#{@section_number}-#{getTextWithoutSpaces}"
|
62
|
+
end
|
63
|
+
|
64
|
+
def get_markdown_anchor_text
|
65
|
+
getTextWithoutSpaces
|
66
|
+
end
|
67
|
+
|
68
|
+
def to_html
|
69
|
+
s = ''
|
70
|
+
if @@html_table_render_in_progress
|
71
|
+
s += "</table>\n"
|
72
|
+
@@html_table_render_in_progress = false
|
73
|
+
end
|
74
|
+
heading_level = level.to_s
|
75
|
+
heading_text = get_section_info
|
76
|
+
if level.zero?
|
77
|
+
heading_level = 1.to_s # Render Doc Title as a regular h1
|
78
|
+
heading_text = @text # Doc Title does not have a section number
|
97
79
|
end
|
98
|
-
|
80
|
+
s += "<a name=\"#{@anchor_id}\"></a>\n"
|
81
|
+
s += "<h#{heading_level}> #{heading_text} <a href=\"\##{@anchor_id}\" class=\"heading_anchor\">"
|
82
|
+
s += "¶</a></h#{heading_level}>"
|
83
|
+
s
|
84
|
+
end
|
85
|
+
|
86
|
+
def get_url
|
87
|
+
"./specifications/#{parent_doc.id}/#{parent_doc.id}.html\##{@anchor_id}"
|
88
|
+
end
|
89
|
+
|
90
|
+
def self.reset_global_section_number
|
91
|
+
@@global_section_number = ''
|
92
|
+
end
|
93
|
+
end
|
@@ -16,9 +16,9 @@ class Image < DocItem
|
|
16
16
|
|
17
17
|
def to_html
|
18
18
|
s = ''
|
19
|
-
if @@
|
19
|
+
if @@html_table_render_in_progress
|
20
20
|
s += "</table>\n"
|
21
|
-
@@
|
21
|
+
@@html_table_render_in_progress = false
|
22
22
|
end
|
23
23
|
|
24
24
|
s += "<p style=\"margin-top: 15px;\"><img src=\"#{@path}\" alt=\"#{@text}\" "
|
@@ -1,167 +1,158 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'doc_item'
|
2
4
|
|
3
5
|
class MarkdownList < DocItem
|
6
|
+
attr_accessor :rows, :text, :is_ordered, :indent_position, :current_nesting_level
|
4
7
|
|
5
|
-
|
6
|
-
attr_accessor :text
|
7
|
-
attr_accessor :is_ordered
|
8
|
-
attr_accessor :indent_position
|
9
|
-
attr_accessor :current_nesting_level
|
8
|
+
@@lists_stack = []
|
10
9
|
|
11
|
-
|
10
|
+
def initialize(doc, is_ordered)
|
11
|
+
super()
|
12
|
+
@parent_doc = doc
|
13
|
+
@parent_heading = doc.headings[-1]
|
12
14
|
|
13
|
-
|
14
|
-
|
15
|
-
|
15
|
+
@rows = []
|
16
|
+
@is_ordered = is_ordered
|
17
|
+
@current_nesting_level = 0
|
18
|
+
@indent_position = 0
|
19
|
+
@text = ''
|
16
20
|
|
17
|
-
|
18
|
-
|
19
|
-
@current_nesting_level = 0
|
20
|
-
@indent_position = 0
|
21
|
-
@text = ''
|
21
|
+
@@lists_stack.push(self)
|
22
|
+
end
|
22
23
|
|
23
|
-
|
24
|
-
|
24
|
+
def add_row(raw_text)
|
25
|
+
pos = calculate_text_position(raw_text)
|
26
|
+
row = raw_text[pos..-1]
|
25
27
|
|
26
|
-
|
27
|
-
pos = calculate_text_position(raw_text)
|
28
|
-
row = raw_text[pos..-1]
|
29
|
-
|
30
|
-
pos = calculate_indent_position(raw_text)
|
31
|
-
|
32
|
-
if pos > @@lists_stack[-1].indent_position
|
33
|
-
|
34
|
-
prev_lists_stack_item = @@lists_stack[-1]
|
35
|
-
# the following line pushes new list to the lists_stack in the constructor!
|
36
|
-
nested_list = MarkdownList.new( @parent_doc, MarkdownList.ordered_list_item?(raw_text) )
|
37
|
-
nested_list.current_nesting_level = @current_nesting_level + 1
|
38
|
-
nested_list.indent_position = pos
|
39
|
-
|
40
|
-
prev_row = prev_lists_stack_item.rows[-1]
|
41
|
-
if prev_row.is_a?(MarkdownList)
|
42
|
-
#cannot be there
|
43
|
-
else
|
44
|
-
nested_list.text = prev_row
|
45
|
-
#puts "Length: " + prev_lists_stack_item.rows.length.to_s
|
46
|
-
prev_lists_stack_item.rows[-1] = nested_list
|
47
|
-
end
|
48
|
-
|
49
|
-
nested_list.addRow(raw_text)
|
50
|
-
|
51
|
-
elsif pos < @@lists_stack[-1].indent_position
|
52
|
-
|
53
|
-
while pos < @@lists_stack[-1].indent_position
|
54
|
-
@@lists_stack.pop
|
55
|
-
end
|
56
|
-
@@lists_stack[-1].rows.append(row)
|
57
|
-
|
58
|
-
else
|
59
|
-
@@lists_stack[-1].rows.append(row)
|
28
|
+
pos = calculate_indent_position(raw_text)
|
60
29
|
|
61
|
-
|
62
|
-
end
|
30
|
+
if pos > @@lists_stack[-1].indent_position
|
63
31
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
break
|
70
|
-
end
|
71
|
-
pos += 1
|
72
|
-
end
|
73
|
-
return pos
|
74
|
-
end
|
75
|
-
def calculate_text_position(s)
|
76
|
-
s.downcase
|
77
|
-
pos = 0
|
78
|
-
state = 'looking_for_list_item_marker'
|
79
|
-
s.each_char do |c|
|
80
|
-
if state == 'looking_for_list_item_marker'
|
81
|
-
if c == '*'
|
82
|
-
state = 'looking_for_space'
|
83
|
-
elsif numeric?(c)
|
84
|
-
state = 'looking_for_dot'
|
85
|
-
end
|
86
|
-
elsif state == 'looking_for_dot'
|
87
|
-
if c == '.'
|
88
|
-
state = 'looking_for_space'
|
89
|
-
end
|
90
|
-
elsif state == 'looking_for_space'
|
91
|
-
if c == ' ' || c == '\t'
|
92
|
-
state = 'looking_for_non_space'
|
93
|
-
end
|
94
|
-
elsif state == 'looking_for_non_space'
|
95
|
-
if c != ' ' || c != '\t'
|
96
|
-
state = 'list_item_text_pos_found'
|
97
|
-
break
|
98
|
-
end
|
99
|
-
end
|
100
|
-
pos += 1
|
101
|
-
end
|
102
|
-
return pos
|
103
|
-
end
|
32
|
+
prev_lists_stack_item = @@lists_stack[-1]
|
33
|
+
# the following line pushes new list to the lists_stack in the constructor!
|
34
|
+
nested_list = MarkdownList.new(@parent_doc, MarkdownList.ordered_list_item?(raw_text))
|
35
|
+
nested_list.current_nesting_level = @current_nesting_level + 1
|
36
|
+
nested_list.indent_position = pos
|
104
37
|
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
38
|
+
prev_row = prev_lists_stack_item.rows[-1]
|
39
|
+
if prev_row.is_a?(MarkdownList)
|
40
|
+
# cannot be there
|
41
|
+
else
|
42
|
+
nested_list.text = prev_row
|
43
|
+
# puts "Length: " + prev_lists_stack_item.rows.length.to_s
|
44
|
+
prev_lists_stack_item.rows[-1] = nested_list
|
45
|
+
end
|
112
46
|
|
113
|
-
|
114
|
-
c.match?(/[[:graph:]]/)
|
115
|
-
end
|
47
|
+
nested_list.add_row(raw_text)
|
116
48
|
|
117
|
-
|
49
|
+
elsif pos < @@lists_stack[-1].indent_position
|
118
50
|
|
119
|
-
|
120
|
-
|
121
|
-
end
|
122
|
-
return false
|
123
|
-
end
|
51
|
+
@@lists_stack.pop while pos < @@lists_stack[-1].indent_position
|
52
|
+
@@lists_stack[-1].rows.append(row)
|
124
53
|
|
125
|
-
|
54
|
+
else
|
55
|
+
@@lists_stack[-1].rows.append(row)
|
126
56
|
|
127
|
-
if res = /\d[.]\s(.*)/.match(raw_text)
|
128
|
-
return true
|
129
|
-
end
|
130
|
-
return false
|
131
57
|
end
|
58
|
+
end
|
132
59
|
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
end
|
60
|
+
def calculate_indent_position(s)
|
61
|
+
s.downcase
|
62
|
+
pos = 0
|
63
|
+
s.each_char do |c|
|
64
|
+
break if c != ' ' && c != '\t'
|
139
65
|
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
66
|
+
pos += 1
|
67
|
+
end
|
68
|
+
pos
|
69
|
+
end
|
70
|
+
|
71
|
+
def calculate_text_position(s)
|
72
|
+
s.downcase
|
73
|
+
pos = 0
|
74
|
+
state = 'looking_for_list_item_marker'
|
75
|
+
s.each_char do |c|
|
76
|
+
case state
|
77
|
+
when 'looking_for_list_item_marker'
|
78
|
+
if c == '*'
|
79
|
+
state = 'looking_for_space'
|
80
|
+
elsif numeric?(c)
|
81
|
+
state = 'looking_for_dot'
|
144
82
|
end
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
f_text = format_string(r)
|
154
|
-
#puts f_text
|
155
|
-
s += "\t<li>#{f_text}</li>\n"
|
156
|
-
end
|
83
|
+
when 'looking_for_dot'
|
84
|
+
state = 'looking_for_space' if c == '.'
|
85
|
+
when 'looking_for_space'
|
86
|
+
state = 'looking_for_non_space' if [' ', '\t'].include?(c)
|
87
|
+
when 'looking_for_non_space'
|
88
|
+
if c != ' ' || c != '\t'
|
89
|
+
state = 'list_item_text_pos_found'
|
90
|
+
break
|
157
91
|
end
|
92
|
+
end
|
93
|
+
pos += 1
|
94
|
+
end
|
95
|
+
pos
|
96
|
+
end
|
97
|
+
|
98
|
+
def letter?(c)
|
99
|
+
c.match?(/[[:alpha:]]/)
|
100
|
+
end
|
101
|
+
|
102
|
+
def numeric?(c)
|
103
|
+
c.match?(/[[:digit:]]/)
|
104
|
+
end
|
105
|
+
|
106
|
+
def non_blank?(c)
|
107
|
+
c.match?(/[[:graph:]]/)
|
108
|
+
end
|
109
|
+
|
110
|
+
def self.unordered_list_item?(raw_text)
|
111
|
+
res = /(\*\s?)(.*)/.match(raw_text)
|
112
|
+
return true if res
|
158
113
|
|
159
|
-
|
160
|
-
|
161
|
-
else
|
162
|
-
s += "</ul>\n"
|
163
|
-
end
|
114
|
+
false
|
115
|
+
end
|
164
116
|
|
165
|
-
|
117
|
+
def self.ordered_list_item?(raw_text)
|
118
|
+
res = /\d[.]\s(.*)/.match(raw_text)
|
119
|
+
return true if res
|
120
|
+
|
121
|
+
false
|
122
|
+
end
|
123
|
+
|
124
|
+
def to_html
|
125
|
+
s = ''
|
126
|
+
if @@html_table_render_in_progress
|
127
|
+
s += "</table>\n"
|
128
|
+
@@html_table_render_in_progress = false
|
129
|
+
end
|
130
|
+
|
131
|
+
s += if @is_ordered
|
132
|
+
"<ol>\n"
|
133
|
+
else
|
134
|
+
"<ul>\n"
|
135
|
+
end
|
136
|
+
|
137
|
+
@rows.each do |r|
|
138
|
+
if r.is_a?(MarkdownList)
|
139
|
+
f_text = format_string(r.text)
|
140
|
+
s += "\t<li>#{f_text}\n"
|
141
|
+
s += r.to_html
|
142
|
+
s += "</li>\n"
|
143
|
+
else
|
144
|
+
f_text = format_string(r)
|
145
|
+
# puts f_text
|
146
|
+
s += "\t<li>#{f_text}</li>\n"
|
147
|
+
end
|
166
148
|
end
|
167
|
-
|
149
|
+
|
150
|
+
s += if @is_ordered
|
151
|
+
"</ol>\n"
|
152
|
+
else
|
153
|
+
"</ul>\n"
|
154
|
+
end
|
155
|
+
|
156
|
+
s
|
157
|
+
end
|
158
|
+
end
|
@@ -1,59 +1,63 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
attr_accessor :column_names
|
6
|
-
attr_accessor :rows
|
3
|
+
require_relative 'doc_item'
|
7
4
|
|
8
|
-
|
9
|
-
|
10
|
-
|
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
|
11
35
|
end
|
12
36
|
|
13
|
-
|
14
|
-
|
15
|
-
if tmp = /(.*)\s+>\[(\S*)\]/.match(row)
|
16
|
-
return false # this is not a regular Markdown table.
|
17
|
-
# so the table type shall be changed and this row shall be passed one more time
|
18
|
-
end
|
37
|
+
s += "<table class=\"markdown_table\">\n"
|
38
|
+
s += "\t<thead>"
|
19
39
|
|
20
|
-
|
21
|
-
|
22
|
-
return true
|
40
|
+
@column_names.each do |h|
|
41
|
+
s += " <th>#{h}</th>"
|
23
42
|
end
|
24
43
|
|
25
|
-
|
26
|
-
s = ''
|
27
|
-
if @@htmlTableRenderInProgress
|
28
|
-
s += "</table>\n"
|
29
|
-
@@htmlTableRenderInProgress = false
|
30
|
-
end
|
31
|
-
|
32
|
-
s += "<table class=\"markdown_table\">\n"
|
33
|
-
s += "\t<thead>"
|
34
|
-
|
35
|
-
@column_names.each do |h|
|
36
|
-
s += " <th>#{h}</th>"
|
37
|
-
end
|
44
|
+
s += " </thead>\n"
|
38
45
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
f_text = format_string(col)
|
48
|
-
s += "\t\t<td>#{f_text}</td>\n"
|
49
|
-
end
|
50
|
-
end
|
51
|
-
s += "\t</tr>\n"
|
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"
|
52
54
|
end
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
return s
|
55
|
+
end
|
56
|
+
s += "\t</tr>\n"
|
57
57
|
end
|
58
58
|
|
59
|
-
|
59
|
+
s += "</table>\n"
|
60
|
+
|
61
|
+
s
|
62
|
+
end
|
63
|
+
end
|
@@ -4,8 +4,10 @@ class Paragraph < DocItem
|
|
4
4
|
|
5
5
|
attr_accessor :text
|
6
6
|
|
7
|
-
def initialize(text)
|
8
|
-
@
|
7
|
+
def initialize(doc, text)
|
8
|
+
@parent_doc = doc
|
9
|
+
@parent_heading = doc.headings[-1]
|
10
|
+
@text = text.strip
|
9
11
|
end
|
10
12
|
|
11
13
|
def getTextWithoutSpaces
|
@@ -14,9 +16,9 @@ class Paragraph < DocItem
|
|
14
16
|
|
15
17
|
def to_html
|
16
18
|
s = ''
|
17
|
-
if @@
|
19
|
+
if @@html_table_render_in_progress
|
18
20
|
s += "</table>"
|
19
|
-
@@
|
21
|
+
@@html_table_render_in_progress = false
|
20
22
|
end
|
21
23
|
|
22
24
|
s += "<p>" + format_string(@text)
|