Class: Jekyll::Octicons
- Inherits:
-
Liquid::Tag
- Object
- Liquid::Tag
- Jekyll::Octicons
- Includes:
- LiquidExtensions
- Defined in:
- lib/jekyll-octicons.rb,
lib/jekyll-octicons/version.rb
Constant Summary collapse
- Syntax =
Syntax for the octicon symbol
/\A(#{Liquid::VariableSignature}+)/- Variable =
For interpoaltion, look for liquid variables
/\{\{\s*([\w]+\.?[\w]*)\s*\}\}/i- TagAttributes =
Copied from Liquid::TagAttributes to allow dashes in tag names:
{% octicon alert area-label:"Hello World!" %} /([\w-]+)\s*\:\s*(#{Liquid::QuotedFragment})/o- VERSION =
'1.1.0'.freeze
Instance Method Summary collapse
-
#initialize(tag_name, markup, options) ⇒ Octicons
constructor
A new instance of Octicons.
- #render(context) ⇒ Object
Constructor Details
#initialize(tag_name, markup, options) ⇒ Octicons
Returns a new instance of Octicons.
22 23 24 25 26 |
# File 'lib/jekyll-octicons.rb', line 22 def initialize(tag_name, markup, ) super @markup = markup = string_to_hash(markup) end |
Instance Method Details
#render(context) ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/jekyll-octicons.rb', line 28 def render(context) @markup.scan Variable do |variable| = string_to_hash(@markup.gsub(Variable, lookup_variable(context, variable.first))) end return nil if [:symbol].nil? ::Octicons::Octicon.new().to_svg end |