Sha256: 46a47f743c7a433a287a38c43ae7c996ce8bcc1fe779e675c3e38417f63d995d

Contents?: true

Size: 600 Bytes

Versions: 29

Compression:

Stored size: 600 Bytes

Contents

class Lalala::Markdown::Handlers::LazyAsset < Lalala::Markdown::Handlers::Base

  def initialize(options={})
    @options = options
  end

  def image(url, alt=nil, title=nil)
    unless %r|^asset[:]//(.+)$| === url
      return ""
    end

    id_with_version = $1.split("/")
    id = id_with_version[0]
    version = id_with_version[1]

    # build url
    url = "//" + [
      "c." + Haraway.configuration.endpoint,
      id,
      version
    ].compact.join("/")

    # build img element
    <<-EOS
      <img class="js-lazy" data-src="#{url}" alt="#{alt}" title="#{title}" />
    EOS
  end

end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
lalala-4.1.0.dev.425 lib/lalala/markdown/handlers/lazy_asset.rb
lalala-4.1.0.dev.420 lib/lalala/markdown/handlers/lazy_asset.rb
lalala-4.1.0.dev.419 lib/lalala/markdown/handlers/lazy_asset.rb
lalala-4.1.0.dev.418 lib/lalala/markdown/handlers/lazy_asset.rb
lalala-4.1.0.dev.417 lib/lalala/markdown/handlers/lazy_asset.rb
lalala-4.1.0.dev.415 lib/lalala/markdown/handlers/lazy_asset.rb
lalala-4.1.0.dev.414 lib/lalala/markdown/handlers/lazy_asset.rb
lalala-4.1.0.dev.413 lib/lalala/markdown/handlers/lazy_asset.rb
lalala-4.1.0.dev.412 lib/lalala/markdown/handlers/lazy_asset.rb
lalala-4.1.0.dev.411 lib/lalala/markdown/handlers/lazy_asset.rb
lalala-4.1.0.dev.410 lib/lalala/markdown/handlers/lazy_asset.rb
lalala-4.1.0.dev.409 lib/lalala/markdown/handlers/lazy_asset.rb
lalala-4.1.0.dev.408 lib/lalala/markdown/handlers/lazy_asset.rb
lalala-4.1.0.dev.398 lib/lalala/markdown/handlers/lazy_asset.rb
lalala-4.1.0.dev.397 lib/lalala/markdown/handlers/lazy_asset.rb
lalala-4.1.0.dev.394 lib/lalala/markdown/handlers/lazy_asset.rb
lalala-4.1.0.dev.392 lib/lalala/markdown/handlers/lazy_asset.rb
lalala-4.1.0.dev.391 lib/lalala/markdown/handlers/lazy_asset.rb
lalala-4.1.0.dev.390 lib/lalala/markdown/handlers/lazy_asset.rb
lalala-4.1.0.dev.389 lib/lalala/markdown/handlers/lazy_asset.rb