2007-05-26 03:52:27 +02:00
|
|
|
module HTML5lib
|
2007-05-30 17:45:52 +02:00
|
|
|
module TreeBuilders
|
2007-05-26 03:52:27 +02:00
|
|
|
|
2007-06-05 23:34:49 +02:00
|
|
|
class << self
|
|
|
|
def [](name)
|
|
|
|
case name.to_s.downcase
|
2007-05-26 03:52:27 +02:00
|
|
|
when 'simpletree' then
|
2007-05-30 17:45:52 +02:00
|
|
|
require 'html5lib/treebuilders/simpletree'
|
|
|
|
SimpleTree::TreeBuilder
|
2007-05-26 03:52:27 +02:00
|
|
|
when 'rexml' then
|
2007-05-30 17:45:52 +02:00
|
|
|
require 'html5lib/treebuilders/rexml'
|
2007-06-05 23:34:49 +02:00
|
|
|
REXML::TreeBuilder
|
2007-05-26 03:52:27 +02:00
|
|
|
when 'hpricot' then
|
2007-05-30 17:45:52 +02:00
|
|
|
require 'html5lib/treebuilders/hpricot'
|
|
|
|
Hpricot::TreeBuilder
|
2007-05-26 03:52:27 +02:00
|
|
|
else
|
2007-05-30 17:45:52 +02:00
|
|
|
raise "Unknown TreeBuilder #{name}"
|
2007-06-05 23:34:49 +02:00
|
|
|
end
|
2007-05-30 17:45:52 +02:00
|
|
|
end
|
2007-05-26 03:52:27 +02:00
|
|
|
|
2007-06-05 23:34:49 +02:00
|
|
|
alias :getTreeBuilder :[]
|
|
|
|
end
|
2007-05-30 17:45:52 +02:00
|
|
|
end
|
2007-05-26 03:52:27 +02:00
|
|
|
end
|