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
60
61
|
# File 'lib/eventdb/outline_reader.rb', line 24
def self.parse( txt )
outline=[]
txt = txt.gsub( /<!--
.+?
-->/xm, '' )
txt.each_line do |line|
line = line.strip
next if line.empty?
break if line == '__END__'
pp line
if HEADING_RE.match( line )
heading_marker = $1
heading_level = $1.length
heading = $2.strip
puts "heading #{heading_level} >#{heading}<"
outline << [:"h#{heading_level}", heading]
elsif LISTITEM_RE.match( line )
item = $1.strip
puts "list item >#{item}<"
outline << [:li, item]
else
outline << [:l, line]
end
end
outline
end
|