Almirah 0.2.2 → 0.2.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1924d26950a0c5c34f254da368edfa0c10a4a8aec9359bbb24239170fd6ded0b
4
- data.tar.gz: 225aec68760b4cb52c0ace5cd5dfe1cda664ab913859beef80f803c94ccfe9a0
3
+ metadata.gz: 34b91589658288fe6c451f14cbb14601ac2c4d083e28b4495aef3f1bb1edcd34
4
+ data.tar.gz: 3d834bb51eb285b7acac6b7c44090bab14c40d0d2e64b4743c5867b41375c0ef
5
5
  SHA512:
6
- metadata.gz: 805998bbe735fbec09972bd63c3d695a9df352436c75d02f3f32aa6bc971fef9d29b3cb6ef5fd9e5a4f58cde34b41d0ed4482fe8ee5ef575bf0f0651939f16d6
7
- data.tar.gz: cc96b734b74c78a7667e17fb12d2e4f4b72c393bcf5db1044a81963b2ca49d2cf87b4adf3b386dc66cd0bcdfc57ece1aebb7896a90b83443a9dbf0909f32cd7f
6
+ metadata.gz: 48e6c007534e2af97110faa435a2596fdd772c2a0acc8cc4980432cdc7c9d99b517f13a9460a05d8d5c0a7d3564ebd53249cffcb571f3087dd9cb3317c5c4093
7
+ data.tar.gz: 22ec1eaef53f7cf629ebd607fc321555f759c33b18510ec0787bdea61918636a985d84d7068ce02f6a81803a6dfe17fdd7250fc7ca8cd75a2fb1f4ed47a99981
@@ -11,9 +11,9 @@ class Blockquote < DocItem
11
11
  def to_html
12
12
  s = ''
13
13
  f_text = format_string(@text)
14
- if @@htmlTableRenderInProgress
14
+ if @@html_table_render_in_progress
15
15
  s += "</table>\n"
16
- @@htmlTableRenderInProgress = false
16
+ @@html_table_render_in_progress = false
17
17
  end
18
18
 
19
19
  s += "<div class=\"blockquote\"><p>#{f_text}</div>\n"
@@ -13,9 +13,9 @@ class CodeBlock < DocItem
13
13
  def to_html
14
14
  s = ''
15
15
 
16
- if @@htmlTableRenderInProgress
16
+ if @@html_table_render_in_progress
17
17
  s += "</table>\n"
18
- @@htmlTableRenderInProgress = false
18
+ @@html_table_render_in_progress = false
19
19
  end
20
20
  s += "<code>"
21
21
  @code_lines.each do |l|
@@ -19,14 +19,14 @@ class ControlledParagraph < Paragraph
19
19
 
20
20
  def to_html
21
21
  s = ''
22
- unless @@htmlTableRenderInProgress
22
+ unless @@html_table_render_in_progress
23
23
  s += "<table class=\"controlled\">\n"
24
- s += "\t<thead> <th>#</th> <th></th> <th>UL</th> <th>DL</th> <th>COV</th> </thead>\n"
25
- @@htmlTableRenderInProgress = true
24
+ s += "\t<thead> <th>#</th> <th></th> <th title=\"Up-links\">UL</th> <th title=\"Down-links\">DL</th> <th title=\"Test Coverage\">COV</th> </thead>\n"
25
+ @@html_table_render_in_progress = true
26
26
  end
27
27
  f_text = format_string(@text)
28
28
  s += "\t<tr>\n"
29
- s += "\t\t<td class=\"item_id\"> <a name=\"#{@id}\" id=\"#{@id}\" href=\"##{@id}\">#{@id}</a></td>\n"
29
+ s += "\t\t<td class=\"item_id\"> <a name=\"#{@id}\" id=\"#{@id}\" href=\"##{@id}\" title=\"Paragraph ID\">#{@id}</a></td>\n"
30
30
  s += "\t\t<td class=\"item_text\">#{f_text}</td>\n"
31
31
 
32
32
  if @up_link_ids
@@ -34,18 +34,18 @@ class ControlledParagraph < Paragraph
34
34
  if tmp = /^([a-zA-Z]+)[-]\d+/.match(@up_link_ids[0])
35
35
  up_link_doc_name = tmp[1].downcase
36
36
  end
37
- s += "\t\t<td class=\"item_id\"><a href=\"./../#{up_link_doc_name}/#{up_link_doc_name}.html##{@up_link_ids[0]}\" class=\"external\">#{@up_link_ids[0]}</a></td>\n"
37
+ s += "\t\t<td class=\"item_id\"><a href=\"./../#{up_link_doc_name}/#{up_link_doc_name}.html##{@up_link_ids[0]}\" class=\"external\" title=\"Linked to\">#{@up_link_ids[0]}</a></td>\n"
38
38
  else
39
39
  s += "\t\t<td class=\"item_id\">"
40
40
  s += "<div id=\"DL_#{@id}\" style=\"display: block;\">"
41
- s += "<a href=\"#\" onclick=\"downlink_OnClick(this.parentElement); return false;\" class=\"external\">#{@up_link_ids.length}</a>"
41
+ s += "<a href=\"#\" onclick=\"downlink_OnClick(this.parentElement); return false;\" class=\"external\" title=\"Number of up-links\">#{@up_link_ids.length}</a>"
42
42
  s += "</div>"
43
43
  s += "<div id=\"DLS_#{@id}\" style=\"display: none;\">"
44
44
  @up_link_ids.each do |lnk|
45
45
  if tmp = /^([a-zA-Z]+)[-]\d+/.match(lnk)
46
46
  up_link_doc_name = tmp[1].downcase
47
47
  end
48
- s += "\t\t\t<a href=\"./../#{up_link_doc_name}/#{up_link_doc_name}.html##{lnk}\" class=\"external\">#{lnk}</a>\n<br>"
48
+ s += "\t\t\t<a href=\"./../#{up_link_doc_name}/#{up_link_doc_name}.html##{lnk}\" class=\"external\" title=\"Linked to\">#{lnk}</a>\n<br>"
49
49
  end
50
50
  s += "</div>"
51
51
  s += "</td>\n"
@@ -59,15 +59,15 @@ class ControlledParagraph < Paragraph
59
59
  down_link_doc_name = tmp[1].downcase
60
60
  end
61
61
  if @down_links.length == 1
62
- s += "\t\t<td class=\"item_id\"><a href=\"./../#{down_link_doc_name}/#{down_link_doc_name}.html##{@down_links[0].id}\" class=\"external\">#{@down_links[0].id}</a></td>\n"
62
+ s += "\t\t<td class=\"item_id\"><a href=\"./../#{down_link_doc_name}/#{down_link_doc_name}.html##{@down_links[0].id}\" class=\"external\" title=\"Referenced in\">#{@down_links[0].id}</a></td>\n"
63
63
  else
64
64
  s += "\t\t<td class=\"item_id\">"
65
65
  s += "<div id=\"DL_#{@id}\" style=\"display: block;\">"
66
- s += "<a href=\"#\" onclick=\"downlink_OnClick(this.parentElement); return false;\" class=\"external\">#{@down_links.length}</a>"
66
+ s += "<a href=\"#\" onclick=\"downlink_OnClick(this.parentElement); return false;\" class=\"external\" title=\"Number of references\">#{@down_links.length}</a>"
67
67
  s += "</div>"
68
68
  s += "<div id=\"DLS_#{@id}\" style=\"display: none;\">"
69
69
  @down_links.each do |lnk|
70
- s += "\t\t\t<a href=\"./../#{lnk.parent_doc.id}/#{lnk.parent_doc.id}.html##{lnk.id}\" class=\"external\">#{lnk.id}</a>\n<br>"
70
+ s += "\t\t\t<a href=\"./../#{lnk.parent_doc.id}/#{lnk.parent_doc.id}.html##{lnk.id}\" class=\"external\" title=\"Referenced in\">#{lnk.id}</a>\n<br>"
71
71
  end
72
72
  s += "</div>"
73
73
  s += "</td>\n"
@@ -80,7 +80,7 @@ class ControlledParagraph < Paragraph
80
80
  if tmp = /^(.+)[.]\d+/.match(@coverage_links[0].id) # guessing that all the links refer to one document
81
81
  cov_link_doc_name = tmp[1].downcase
82
82
  end
83
- s += "\t\t<td class=\"item_id\"><a href=\"./../../tests/protocols/#{cov_link_doc_name}/#{cov_link_doc_name}.html\" class=\"external\">#{@coverage_links.length}</a></td>\n"
83
+ s += "\t\t<td class=\"item_id\"><a href=\"./../../tests/protocols/#{cov_link_doc_name}/#{cov_link_doc_name}.html\" class=\"external\" title=\"Number of verification steps\">#{@coverage_links.length}</a></td>\n"
84
84
  else
85
85
  s += "\t\t<td class=\"item_id\"></td>\n"
86
86
  end
@@ -87,10 +87,14 @@ class ControlledTable < DocItem
87
87
 
88
88
  attr_accessor :column_names
89
89
  attr_accessor :rows
90
+ attr_accessor :is_separator_detected
91
+
92
+ def initialize(doc, markdown_table)
93
+ @parent_doc = doc
94
+ @parent_heading = doc.headings[-1]
90
95
 
91
- def initialize(markdown_table, parent_doc)
92
- @parent_doc = parent_doc
93
96
  @column_names = markdown_table.column_names
97
+ @is_separator_detected = markdown_table.is_separator_detected
94
98
  # copy and re-format existing rows
95
99
  @rows = Array.new
96
100
 
@@ -151,9 +155,9 @@ class ControlledTable < DocItem
151
155
 
152
156
  def to_html
153
157
  s = ''
154
- if @@htmlTableRenderInProgress
158
+ if @@html_table_render_in_progress
155
159
  s += "</table>\n"
156
- @@htmlTableRenderInProgress = false
160
+ @@html_table_render_in_progress = false
157
161
  end
158
162
 
159
163
  s += "<table class=\"markdown_table\">\n"
@@ -7,9 +7,9 @@ class DocFooter < DocItem
7
7
 
8
8
  def to_html
9
9
  s = ''
10
- if @@htmlTableRenderInProgress
10
+ if @@html_table_render_in_progress
11
11
  s += "</table>\n"
12
- @@htmlTableRenderInProgress = false
12
+ @@html_table_render_in_progress = false
13
13
  end
14
14
  return s
15
15
  end
@@ -7,7 +7,7 @@ class DocItem < TextLine
7
7
  @parent_doc = nil
8
8
  @parent_heading = nil
9
9
 
10
- @@htmlTableRenderInProgress = false
10
+ @@html_table_render_in_progress = false
11
11
 
12
12
  def get_url
13
13
  ''
@@ -1,98 +1,93 @@
1
- require_relative "paragraph"
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
- attr_accessor :level
6
- attr_accessor :anchor_id
7
- attr_accessor :section_number
8
-
9
- @@global_section_number = ""
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
- def get_section_info
55
- if level == 0 # Doc Title
56
- s = @text
57
- else
58
- s = @section_number + " " + @text
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
- end
20
+ else
21
+ previous_level = @@global_section_number.split('.').length
61
22
 
62
- def get_anchor_text()
63
- s = @section_number + "-" + getTextWithoutSpaces()
64
- end
23
+ if previous_level == level
65
24
 
66
- def to_html
67
- s = ''
68
- if @@htmlTableRenderInProgress
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 += "&para;</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
- def get_html_link
85
- if (@parent_doc.instance_of? Specification)
86
- heading_text = get_section_info()
87
- s = "<a href= class=\"external\">#{heading_text}</a>"
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
- def get_url
92
- "./specifications/#{parent_doc.id}/#{parent_doc.id}.html\##{@anchor_id}"
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
- def self.reset_global_section_number
96
- @@global_section_number = ""
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
- end
80
+ s += "<a name=\"#{@anchor_id}\"></a>\n"
81
+ s += "<h#{heading_level}> #{heading_text} <a href=\"\##{@anchor_id}\" class=\"heading_anchor\">"
82
+ s += "&para;</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 @@htmlTableRenderInProgress
19
+ if @@html_table_render_in_progress
20
20
  s += "</table>\n"
21
- @@htmlTableRenderInProgress = false
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
- require_relative "doc_item"
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
- attr_accessor :rows
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
- @@lists_stack = Array.new
10
+ def initialize(doc, is_ordered)
11
+ super()
12
+ @parent_doc = doc
13
+ @parent_heading = doc.headings[-1]
12
14
 
13
- def initialize(doc, is_ordered)
14
- @parent_doc = doc
15
- @parent_heading = doc.headings[-1]
15
+ @rows = []
16
+ @is_ordered = is_ordered
17
+ @current_nesting_level = 0
18
+ @indent_position = 0
19
+ @text = ''
16
20
 
17
- @rows = Array.new
18
- @is_ordered = is_ordered
19
- @current_nesting_level = 0
20
- @indent_position = 0
21
- @text = ''
21
+ @@lists_stack.push(self)
22
+ end
22
23
 
23
- @@lists_stack.push(self)
24
- end
24
+ def addRow(raw_text)
25
+ pos = calculate_text_position(raw_text)
26
+ row = raw_text[pos..-1]
25
27
 
26
- def addRow(raw_text)
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
- end
62
- end
30
+ if pos > @@lists_stack[-1].indent_position
63
31
 
64
- def calculate_indent_position(s)
65
- s.downcase
66
- pos = 0
67
- s.each_char do |c|
68
- if c != ' ' && c != '\t'
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
- def letter?(c)
106
- c.match?(/[[:alpha:]]/)
107
- end
108
-
109
- def numeric?(c)
110
- c.match?(/[[:digit:]]/)
111
- end
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
- def non_blank?(c)
114
- c.match?(/[[:graph:]]/)
115
- end
47
+ nested_list.addRow(raw_text)
116
48
 
117
- def self.unordered_list_item?(raw_text)
49
+ elsif pos < @@lists_stack[-1].indent_position
118
50
 
119
- if res = /(\*\s?)(.*)/.match(raw_text)
120
- return true
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
- def self.ordered_list_item?(raw_text)
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
- def to_html
134
- s = ''
135
- if @@htmlTableRenderInProgress
136
- s += "</table>\n"
137
- @@htmlTableRenderInProgress = false
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
- if @is_ordered
141
- s += "<ol>\n"
142
- else
143
- s += "<ul>\n"
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
- @rows.each do |r|
147
- if r.is_a?(MarkdownList)
148
- f_text = format_string(r.text)
149
- s += "\t<li>#{f_text}\n"
150
- s += r.to_html()
151
- s += "</li>\n"
152
- else
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
- if @is_ordered
160
- s += "</ol>\n"
161
- else
162
- s += "</ul>\n"
163
- end
114
+ false
115
+ end
164
116
 
165
- return s
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
- end
149
+
150
+ s += if @is_ordered
151
+ "</ol>\n"
152
+ else
153
+ "</ul>\n"
154
+ end
155
+
156
+ s
157
+ end
158
+ end