Class: Archangel::Liquid::Tags::ApplicationTag

Inherits:
Liquid::Tag
  • Object
show all
Includes:
ActionView::Helpers::TagHelper
Defined in:
lib/archangel/liquid/tags/application_tag.rb

Overview

Base helper class for Liquid

Constant Summary collapse

ASSET_SYNTAX =

Regex for asset name

/
  #{::Liquid::QuotedString}
  |
  (
    [\w-]+\.[\w]+
    |
    #{::Liquid::QuotedString}
  )
/ox.freeze
ASSET_ATTRIBUTES_SYNTAX =

Regex for tag syntax

/
  (?<asset>#{ASSET_SYNTAX})
  \s*
  (?<attributes>.*)
  \s*
/omx.freeze
KEY_VALUE_ATTRIBUTES_SYNTAX =

Regex for “key: value” attributes

Example

{% tag_name "[slug]" [foo: bar, bat: "baz"] %}
/
  (?<key>\w+)
  \s*
  \:
  \s*
  (?<value>#{::Liquid::QuotedFragment})
/ox.freeze
SLUG_ATTRIBUTES_SYNTAX =

Slug and attributes syntax

Example

{% tag_name "[slug]" [attributes] %}
/
  (?<slug>#{::Liquid::QuotedFragment}+)
  \s*
  (?<attributes>.*)
  \s*
/omx.freeze
SLUG_SYNTAX =

Slug syntax

Example

{% tag_name "[slug]" %}
/(?<slug>#{::Liquid::QuotedFragment}+)\s*/o.freeze
URL_ATTRIBUTES_SYNTAX =

URL and attributes syntax

Example

{% tag_name "[url]" [attributes] %}
/
  (?<url>#{::Liquid::QuotedFragment}+)
  \s*
  (?<attributes>.*)
  \s*
/omx.freeze