Sha256: 9483d004fd9edefe4bf597cbabd9b12d2a94800f12372409a87f7f92902dd37a

Contents?: true

Size: 837 Bytes

Versions: 45

Compression:

Stored size: 837 Bytes

Contents

# -*- coding: utf-8 -*-
#
#--
# Copyright (C) 2009-2016 Thomas Leitner <t_leitner@gmx.at>
#
# This file is part of kramdown which is licensed under the MIT.
#++
#

require 'kramdown/parser'
require 'kramdown/converter'
require 'kramdown/utils'

module Kramdown

  module Converter

    # Converts a Kramdown::Document to a nested hash for further processing or debug output.
    class HashAST < Base

      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

    end

    HashAst = HashAST

  end
end

Version data entries

45 entries across 45 versions & 9 rubygems

Version Path
logstash-filter-cache-redis-0.3.1 vendor/bundle/jruby/1.9/gems/kramdown-1.14.0/lib/kramdown/converter/hash_ast.rb
logstash-filter-cache-redis-0.3.0 vendor/bundle/jruby/1.9/gems/kramdown-1.14.0/lib/kramdown/converter/hash_ast.rb
logstash-filter-cache-redis-0.2.0 vendor/bundle/jruby/1.9/gems/kramdown-1.14.0/lib/kramdown/converter/hash_ast.rb
logstash-filter-cache-redis-0.1.0 vendor/bundle/jruby/1.9/gems/kramdown-1.14.0/lib/kramdown/converter/hash_ast.rb
kramdown-1.14.0 lib/kramdown/converter/hash_ast.rb