Sha256: ff9e9b403b274899299823daa30c4511c181f621899227276251889dced69e7f

Contents?: true

Size: 579 Bytes

Versions: 10

Compression:

Stored size: 579 Bytes

Contents

class Lalala::Markdown::Handlers::Asset < 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] || "original"

    # build url
    url = "//" + File.join(
      "c." + Haraway.configuration.endpoint,
      id,
      version.to_s)

    # build img element
    helpers.image_tag(
      url,
      alt: alt,
      title: title
    )
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
lalala-4.1.0.dev.358 lib/lalala/markdown/handlers/asset.rb
lalala-4.1.0.dev.356 lib/lalala/markdown/handlers/asset.rb
lalala-4.1.0.dev.355 lib/lalala/markdown/handlers/asset.rb
lalala-4.1.0.dev.342 lib/lalala/markdown/handlers/asset.rb
lalala-4.1.0.dev.341 lib/lalala/markdown/handlers/asset.rb
lalala-4.1.0.dev.340 lib/lalala/markdown/handlers/asset.rb
lalala-4.1.0.dev.334 lib/lalala/markdown/handlers/asset.rb
lalala-4.1.0.dev.332 lib/lalala/markdown/handlers/asset.rb
lalala-4.1.0.dev.324 lib/lalala/markdown/handlers/asset.rb
lalala-4.1.0.dev.322 lib/lalala/markdown/handlers/asset.rb