class Kramdown::Converter::HashAst
Converts a Kramdown::Document
to a nested hash for further processing or debug output.
Public Instance Methods
convert(el)
click to toggle source
# File lib/kramdown/converter/hash_ast.rb, line 20 def convert(el) hash = {type: el.type} hash[:attr] = el.attr unless el.attr.empty? hash[:value] = el.value unless el.value.nil? hash[:options] = el.options unless el.options.empty? unless el.children.empty? hash[:children] = [] el.children.each {|child| hash[:children] << convert(child) } end hash end