6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/fabulator/template/parser.rb', line 6
def parse(context, text)
if !@context
@context = Context.new(self)
end
if !@parser
@parser = Radius::Parser.new(@context, :tag_prefix => 'r')
end
@context.globals.context = context
text.gsub!(/&/, '&')
text.gsub!(/<\//, '</')
text.gsub!(/<\/r:/, '</r:')
r = @parser.parse(text)
r.gsub!(/<\//, '</')
r.gsub!(/&/, '&')
begin
Fabulator::Template::ParseResult.new(r)
rescue => e
"<!-- unable to parse XML: #{e} -->" + r
end
end
|