Sha256: 3e3512283fbbbb3c413648fb5508b88f2d9150235a15a83f05f7d8ee78867a6e

Contents?: true

Size: 1.02 KB

Versions: 5

Compression:

Stored size: 1.02 KB

Contents

# -*- encoding : utf-8 -*-

# # require "card/content/diff"

class Card
  class Format
    # Main Format class for formatting card views in HTML
    class HtmlFormat < Format
      register :html

      attr_accessor :options_need_save, :start_time, :skip_autosave

      def main?
        !@main.nil?
      end

      # is the current card the requested card?
      def focal?
        @focal ||= show_layout? ? main? : depth.zero?
      end

      def default_nest_view
        # FIXME: not sure this makes sense as a rule...
        card.rule(:default_html_view) || :titled
      end

      def default_item_view
        :bar
      end

      def escape_literal literal
        "<span>#{literal}</span>"
      end

      def mime_type
        "text/html"
      end

      def final_render_call method
        rendered = super
        rendered.is_a?(Array) ? output(rendered) : rendered
      end

      def stylesheet_link_tag path
        tag "link", href: path, media: "all", rel: "stylesheet", type: "text/css"
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
card-mod-format-0.13.4 lib/card/format/html_format.rb
card-mod-format-0.13.3 lib/card/format/html_format.rb
card-mod-format-0.13.2 lib/card/format/html_format.rb
card-mod-format-0.13.1 lib/card/format/html_format.rb
card-mod-format-0.13.0 lib/card/format/html_format.rb