Sha256: c9b1bf2d0376cdb8db4c250ca2a0fba58366afb29663822cbf56388334325416

Contents?: true

Size: 860 Bytes

Versions: 1

Compression:

Stored size: 860 Bytes

Contents

# coding: utf-8

require 'mustache'

class BookRanking < Mustache

  # <<BookRanking>>
  # url: AmazonのURL
  # title: 書名
  # src: 書影ファイル名
  # desc: 説明

  @template = <<EOT
  <div class="imgLRBlock cf">
    <figure class="imgR">
      <a href="{{url}}" target="_blank"><img alt="{{title}}" src="{{cover}}" style="border:1px solid #808080; width:100px;" title="{{title}}" /></a></figure>
    <p markdown="1"> {{& description}}</p>
  </div>
EOT

  def description
    Mustache.new.render(desc, {book: "『[#{title}](#{url})』"})
  end

  def cover
    case File.dirname(src)
    when ".", "images"
      f = File.basename(l_src)
      "/static/images/article/■記事ID■/#{/^\d+_/ =~ f ? f : '■記事ID■_' + f}"
    when "common"
      "/static/images/article/common/#{File.basename(src)}"
    else
      src
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
zine_brewer-1.6.0 lib/zine_brewer/templates/bookranking.rb