Sha256: 2cef06330761aee7ededbd0412b352b95907e7410ab25eaa547fb76fbe9ee9e9
Contents?: true
Size: 1.1 KB
Versions: 2
Compression:
Stored size: 1.1 KB
Contents
module Flannel class BaseBlock attr_reader :type, :id, :text, :parent_id, :attributes def initialize block form = block[0] if form == :block create_from_list block[1] else @text = block[1] @type = :paragraph end strip_text end def create_from_list list header = list.shift @type = header.shift[1] @id = header.shift[1] @attributes = {} next_item = header.shift while next_item case next_item[0] when :parent_id then @parent_id = next_item[1] when :attribute_list then next_item.shift next_item.each do |attribute| @attributes[attribute[0]] = attribute[1] end end next_item = header.shift end @text = list.shift end def to_h html_formatter = Flannel::HtmlFormatter.new html_formatter.do(@text, @type, @id) end def strip_text return if @type == :preformatted return unless @text @text = @text.strip end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
flannel-0.2.13 | lib/flannel/base_block.rb |
flannel-0.2.12 | lib/flannel/base_block.rb |