Sha256: 0b353e6ad0b4d54a3b70874a9c73bb651239e3724eaec431c24f6b0b07cf8b04

Contents?: true

Size: 848 Bytes

Versions: 3

Compression:

Stored size: 848 Bytes

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

3 entries across 3 versions & 1 rubygems

Version Path
card-mod-format-0.14.2 lib/card/format/html_format.rb
card-mod-format-0.14.1 lib/card/format/html_format.rb
card-mod-format-0.14.0 lib/card/format/html_format.rb