Sha256: da1de9bf2bba078f5cbfd2ccc4c4093d6092de34753deff60981f3a09812a0c4

Contents?: true

Size: 450 Bytes

Versions: 3

Compression:

Stored size: 450 Bytes

Contents

class ComfyPress::Tag::Snippet
  include ComfyPress::Tag
  
  def self.regex_tag_signature(identifier = nil)
    identifier ||= /[\w\-]+/
    /\{\{\s*cms:snippet:(#{identifier})\s*\}\}/
  end
  
  # Find or initialize Cms::Snippet object
  def snippet
    page.site.snippets.detect{|s| s.identifier == self.identifier.to_s} ||
      page.site.snippets.build(:identifier => self.identifier.to_s)
  end
  
  def content
    snippet.content
  end
  
end

Version data entries

3 entries across 2 versions & 1 rubygems

Version Path
comfypress-0.1.4 db/lib/comfypress/tags/snippet.rb
comfypress-0.1.4 lib/comfypress/tags/snippet.rb
comfypress-0.1.3 lib/comfypress/tags/snippet.rb