Sha256: 03dcd044bf2359ea716ea65833d877e1bae8db97db8b0a13291eae0d1a10441c

Contents?: true

Size: 815 Bytes

Versions: 12

Compression:

Stored size: 815 Bytes

Contents

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

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 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

12 entries across 12 versions & 1 rubygems

Version Path
card-mod-format-0.18.1 lib/card/format/html_format.rb
card-mod-format-0.18.0 lib/card/format/html_format.rb
card-mod-format-0.17.0 lib/card/format/html_format.rb
card-mod-format-0.16.0 lib/card/format/html_format.rb
card-mod-format-0.15.6 lib/card/format/html_format.rb
card-mod-format-0.15.5 lib/card/format/html_format.rb
card-mod-format-0.15.4 lib/card/format/html_format.rb
card-mod-format-0.15.3 lib/card/format/html_format.rb
card-mod-format-0.15.2.pre1 lib/card/format/html_format.rb
card-mod-format-0.15.1.1 lib/card/format/html_format.rb
card-mod-format-0.15.1 lib/card/format/html_format.rb
card-mod-format-0.15.0 lib/card/format/html_format.rb