Sha256: 1bb78a35907d1210813ab46f8b2c69799ea1590464299974d14b80d66e7f0b01

Contents?: true

Size: 972 Bytes

Versions: 9

Compression:

Stored size: 972 Bytes

Contents

# frozen_string_literal: true

module Vedeu

  module Renderers

    # Renders a {Vedeu::Buffers::Terminal} as a HTML snippet; a table
    # by default.
    #
    # @api private
    #
    class HTML < Vedeu::Renderers::File

      include Vedeu::Renderers::Options

      # @return [String]
      def html_body
        if valid?
          output.inject([]) do |acc, line|
            acc << "#{start_row_tag}\n"
            line.each do |char|
              acc << char.to_html(options)
            end
            acc << "#{end_row_tag}\n"
          end.join

        else
          ''

        end
      end

      private

      # @return [String]
      def content
        if valid?
          Vedeu::Templating::Template.parse(self, template)

        else
          ''

        end
      end

      # @return [Boolean]
      def valid?
        return false if string?(output) || escape?(output)

        true
      end

    end # HTML

  end # Renderers

end # Vedeu

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
vedeu-0.8.32 lib/vedeu/renderers/html.rb
vedeu-0.8.31 lib/vedeu/renderers/html.rb
vedeu-0.8.30 lib/vedeu/renderers/html.rb
vedeu-0.8.29 lib/vedeu/renderers/html.rb
vedeu-0.8.28 lib/vedeu/renderers/html.rb
vedeu-0.8.27 lib/vedeu/renderers/html.rb
vedeu-0.8.26 lib/vedeu/renderers/html.rb
vedeu-0.8.25 lib/vedeu/renderers/html.rb
vedeu-0.8.24 lib/vedeu/renderers/html.rb