Class: DmCore::LiquidBlock

Inherits:
Liquid::Block
  • Object
show all
Includes:
LiquidExtensions::Helpers
Defined in:
lib/dm_core/liquid_extensions.rb

Constant Summary collapse

SimpleSyntax =
/#{Liquid::QuotedFragment}/
NamedSyntax =
/(#{Liquid::QuotedFragment})\s*\:\s*(#{Liquid::QuotedFragment})/

Class Method Summary collapse

Instance Method Summary collapse

Methods included from LiquidExtensions::Helpers

#context_account_site_assets, #render_erb

Constructor Details

#initialize(tag_name, markup, tokens) ⇒ LiquidBlock




100
101
102
103
104
105
106
# File 'lib/dm_core/liquid_extensions.rb', line 100

def initialize(tag_name, markup, tokens)      
  @attributes    = {}
  markup.scan(Liquid::TagAttributes) do |key, value|
    @attributes[key] = ((value.delete "\"").delete "\'")
  end
  super    
end

Class Method Details

.detailsObject



120
121
122
# File 'lib/dm_core/liquid_extensions.rb', line 120

def details
  { name: self.tag_name, summary: '', description: '', example: '', category: '' }
end

.tag_nameObject




117
118
119
# File 'lib/dm_core/liquid_extensions.rb', line 117

def tag_name
  self.name.split('::').last.underscore
end

Instance Method Details

#allow_empty_blockObject

Liquid will automatically throw away a block with empty/blank content. Call this in the tag’s render method to allow the tag to be rendered anyway




111
112
113
# File 'lib/dm_core/liquid_extensions.rb', line 111

def allow_empty_block
  @blank = false
end