def export
result = "\n=== Extractor tree ===\n\nexport() is not working at the moment, due to the removal or ParseTree, ruby2ruby and RubyInline.\nFor now, in case you are using examples, you can replace them by hand based on the output below.\nSo if your pattern in the learning extractor looks like\n\nbook \"Ruby Cookbook\"\n\nand you see the following below:\n\n[book] /table[1]/tr/td[2]\n\nthen replace \"Ruby Cookbook\" with \"/table[1]/tr/td[2]\" (and all the other XPaths) and you are ready!\n\n"
tree_builder = lambda do |node, level|
result += current_level = (" " * (level == 0 ? 0 : level-1) +
"|\n" * (level == 0 ? 0 : 1) +
" " * (level == 0 ? 0 : level-1) +
"+-- " * (level == 0 ? 0 : 1) +
"[#{node.name}]")
result += " #{node.filters[0].xpath}" if node.type == :tree
result += "\n"
node.children.each {|c| tree_builder[c, level+1]}
end
tree_builder[root_patterns[0],0]
result += "\n"
end