def load(data,p={})
depth = 1
count = 0
root = [self.sections]
data.each_line do |line|
if line =~ /^([=]{1,6})\s*(.*?)\s*(\1)/
root << root.last[-1].children if $1.length > depth
root.pop if $1.length < depth
depth = $1.length
root.last << Section.new(line, get_id_for($2.gsub(/\s+/,'_')))
count += 1
else
root.last[-1] << line
end
end
self.sections.first.template = true if data =~ /\{\{\{\s*([A-Za-z0-9]+)\s*\}\}\}/
self.sections.first.auto_toc = true unless count < 4 || data =~ /__(NO|)TOC__/
self.params = p
end