Class: Jekyll::AssetTag
- Inherits:
-
Liquid::Tag
- Object
- Liquid::Tag
- Jekyll::AssetTag
- Includes:
- AssetPages::Jekyll::LiquidHelper
- Defined in:
- lib/asset_pages/jekyll/plugins/asset_tag.rb
Direct Known Subclasses
ImageTag, JavaScriptIncludeTag, RequireJsIncludeTag, StylesheetLinkTag
Constant Summary collapse
- SourcePattern =
Regexp.new("#{Liquid::QuotedFragment}+")
Constants included from AssetPages::Jekyll::LiquidHelper
AssetPages::Jekyll::LiquidHelper::Root
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#sources ⇒ Object
readonly
Returns the value of attribute sources.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name, markup, tokens) ⇒ AssetTag
constructor
A new instance of AssetTag.
- #render(context) ⇒ Object
Methods included from AssetPages::Jekyll::LiquidHelper
Constructor Details
#initialize(name, markup, tokens) ⇒ AssetTag
Returns a new instance of AssetTag.
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/asset_pages/jekyll/plugins/asset_tag.rb', line 30 def initialize(name, markup, tokens) super @sources = [] @options, markup = AssetTag.(markup) markup.scan(SourcePattern) do |path| sources.push(path) end end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
28 29 30 |
# File 'lib/asset_pages/jekyll/plugins/asset_tag.rb', line 28 def @options end |
#sources ⇒ Object (readonly)
Returns the value of attribute sources.
27 28 29 |
# File 'lib/asset_pages/jekyll/plugins/asset_tag.rb', line 27 def sources @sources end |
Class Method Details
.parse_options(markup) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/asset_pages/jekyll/plugins/asset_tag.rb', line 45 def self.(markup) = {} markup = markup.gsub(Liquid::TagAttributes) do |matched| attr_name = $1 attr_value = $2 raise ArgumentError, "Please qualify the attribute value #{attr_value.dump} with quotes" \ if !(attr_value.size >= 2 && attr_value[0] == "\"" && attr_value[-1] == "\"") [attr_name] = attr_value[1...-1] "" end [, markup] end |
Instance Method Details
#render(context) ⇒ Object
41 42 43 |
# File 'lib/asset_pages/jekyll/plugins/asset_tag.rb', line 41 def render(context) @context = context end |