Sha256: 22ae8428fe48116a748e46cc14c97c7d1f123db2567a7971a1bbc64d12a67ff7

Contents?: true

Size: 873 Bytes

Versions: 10

Compression:

Stored size: 873 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}}" loading="lazy" 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(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

10 entries across 10 versions & 1 rubygems

Version Path
zine_brewer-1.13.1 lib/zine_brewer/templates/bookranking.rb
zine_brewer-1.13.0 lib/zine_brewer/templates/bookranking.rb
zine_brewer-1.12.2 lib/zine_brewer/templates/bookranking.rb
zine_brewer-1.12.1 lib/zine_brewer/templates/bookranking.rb
zine_brewer-1.12.0 lib/zine_brewer/templates/bookranking.rb
zine_brewer-1.11.3 lib/zine_brewer/templates/bookranking.rb
zine_brewer-1.11.2 lib/zine_brewer/templates/bookranking.rb
zine_brewer-1.11.1 lib/zine_brewer/templates/bookranking.rb
zine_brewer-1.11.0 lib/zine_brewer/templates/bookranking.rb
zine_brewer-1.10.0 lib/zine_brewer/templates/bookranking.rb