Sha256: c68020953064066b087437d3a7848c22946894b6aeaa74230dc03026af19025d

Contents?: true

Size: 1.2 KB

Versions: 16

Compression:

Stored size: 1.2 KB

Contents

module Liquid
  class Quote < DmCore::LiquidBlock

    #------------------------------------------------------------------------------
    def render(context)
      @attributes.reverse_merge!  'class' => '', 'id' => '', 'style' => '', 'author' => ''

      output  = super
      style   = "style='#{@attributes["style"]}'" unless @attributes['style'].blank?
      dclass  = "class='#{@attributes["class"]}'" unless @attributes['class'].blank?
      id      = "id='#{@attributes["id"]}'" unless @attributes['id'].blank?
      
      out  = "<blockquote #{[id, dclass, style].join(' ')}>"
      out += output
      out += "\r\n<footer markdown='0'><cite>#{@attributes['author']}</cite></footer>" unless @attributes['author'].blank?
      out += "</blockquote>"
    end

    def self.details
      { name: self.tag_name,
        summary: 'HTML blockquote',
        category: 'structure',
        description: <<-END_OF_DESCRIPTION
Outpus an HTML 'blockquote' with optional author.  You can specify id, class, and style.

~~~
{% quote author: 'Favorite Person', id: some_id, class: some_class, style: some_style %}
  ...content
{% endquote %}
~~~
END_OF_DESCRIPTION
      }
    end
  end

  Template.register_tag('quote', Quote)
  
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
dm_cms-4.2.3.10 lib/dm_cms/liquid/tags/quote.rb
dm_cms-4.2.3.9 lib/dm_cms/liquid/tags/quote.rb
dm_cms-4.2.3.8 lib/dm_cms/liquid/tags/quote.rb
dm_cms-4.2.3.7 lib/dm_cms/liquid/tags/quote.rb
dm_cms-4.2.3.6 lib/dm_cms/liquid/tags/quote.rb
dm_cms-4.2.3.5 lib/dm_cms/liquid/tags/quote.rb
dm_cms-4.2.3.4 lib/dm_cms/liquid/tags/quote.rb
dm_cms-4.2.3.3 lib/dm_cms/liquid/tags/quote.rb
dm_cms-4.2.3.2 lib/dm_cms/liquid/tags/quote.rb
dm_cms-4.2.3.1 lib/dm_cms/liquid/tags/quote.rb
dm_cms-4.2.3 lib/dm_cms/liquid/tags/quote.rb
dm_cms-4.2.2.3 lib/dm_cms/liquid/tags/quote.rb
dm_cms-4.2.2.2 lib/dm_cms/liquid/tags/quote.rb
dm_cms-4.2.2.1 lib/dm_cms/liquid/tags/quote.rb
dm_cms-4.2.2 lib/dm_cms/liquid/tags/quote.rb
dm_cms-4.2.1.5 lib/dm_cms/liquid/tags/quote.rb