Files
news.gitea.happylizard.me/bin/gems/kramdown-2.5.1/lib/kramdown/converter/hash_ast.rb
T
pizza2d1 4cee170d66
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 9s
Add bin and edit workflow
2026-09-16 13:11:16 -06:00

39 lines
864 B
Ruby

# -*- coding: utf-8; frozen_string_literal: true -*-
#
#--
# Copyright (C) 2009-2019 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