Sha256: d4ab84e1a2687f7864e3cce99d904bc000732593178dc6567925d97c0ea526c2

Contents?: true

Size: 1.62 KB

Versions: 8

Compression:

Stored size: 1.62 KB

Contents

# -*- encoding : utf-8 -*-
class Card; module Set; class All
# Set: All cards (HtmlShow)
#
module HtmlShow;
extend Card::Set
def self.source_location; "/Users/ethan/dev/decko/gem/card-mod-format/set/all/html_show.rb"; end
module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
  def show view, args
    capture_the_freak do
      content = send show_method, view, args
      show_full_page? ? wrap_with_html_page(content) : content
    end
  end

  def show_method
    "show_#{show_layout? ? :with : :without}_page_layout"
  end

  def show_without_page_layout view, args
    @main = true if params[:is_main] || args[:main]
    args.delete(:layout)
    view ||= args[:home_view] || :open # default_nest_view
    render! view, args
  end

  def show_full_page?
    !Env.ajax?
  end

  wrapper :html_page do
    <<-HTML.strip_heredoc
      <!DOCTYPE HTML>
      <html class="h-100">
        <head>
          #{head_content}
        </head>
        #{interior}
      </html>
    HTML
  end

  def head_content
    nest card.rule_card(:head), view: :head_content
  end

  private

  # this is a temporary fix to try to debug a recurring encoding-related error
  # TODO: remove the following after tracking down wikirate encoding bug
  def capture_the_freak
    yield
  rescue Card::Error::ServerError => e
    if e.message.match?(/invalid byte sequence/)
      Card::Lexicon.cache.reset
      Rails.logger.info "reset name cache to prevent encoding freakiness"
    end
    raise e
  end
end
end;end;end;end;
# ~~ generated from /Users/ethan/dev/decko/gem/card-mod-format/set/all/html_show.rb ~~

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
card-1.101.7 tmpsets/set/mod007-card-mod-format/all/html_show.rb
card-1.101.6 tmpsets/set/mod007-card-mod-format/all/html_show.rb
card-1.101.5 tmpsets/set/mod008-card-mod-format/all/html_show.rb
card-1.101.4 tmpsets/set/mod008-card-mod-format/all/html_show.rb
card-1.101.3 tmpsets/set/mod008-card-mod-format/all/html_show.rb
card-1.101.2 tmpsets/set/mod008-card-mod-format/all/html_show.rb
card-1.101.1 tmpsets/set/mod008-card-mod-format/all/html_show.rb
card-1.101.0 tmpsets/set/mod008-card-mod-format/all/html_show.rb