Class: GreenPepper::WikiTableParser

Inherits:
Object
  • Object
show all
Defined in:
lib/greenpepper/parser/wikiparser.rb

Instance Method Summary collapse

Instance Method Details

#parse(wiki_table_string) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/greenpepper/parser/wikiparser.rb', line 15

def parse(wiki_table_string)
  s = wiki_table_string.split("\n")
  s = s.collect{|x| x.strip}
  s = s.join("\n")
  html = RedCloth.new(s).to_html
  doc = (LibXML::XML::HTMLParser.string html).parse.root
  html_parser = HtmlTableParser.new
  html_parser.parse doc 
end