Class: Jekyll::Tabler::FilledTag
- Inherits:
-
Liquid::Tag
- Object
- Liquid::Tag
- Jekyll::Tabler::FilledTag
- Defined in:
- lib/jekyll-tabler.rb
Overview
Handles ‘tabler_filled … %` tags.
The control flow mirrors ‘OutlineTag`; the only behavior difference is the final SVG wrapper that uses filled icon data.
Instance Method Summary collapse
-
#initialize(tag_name, markup, tokens) ⇒ FilledTag
constructor
rubocop:disable Metrics/AbcSize.
-
#render(context) ⇒ Object
Converts stored arguments into final values for the current page and delegates SVG generation to the shared helper.
Constructor Details
#initialize(tag_name, markup, tokens) ⇒ FilledTag
rubocop:disable Metrics/AbcSize
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
# File 'lib/jekyll-tabler.rb', line 166 def initialize(tag_name, markup, tokens) # rubocop:disable Metrics/AbcSize super args = Shellwords.shellsplit(markup.to_s) raise Liquid::SyntaxError, Jekyll::Tabler. if args.empty? @icon_name = args[0] , positional_args = Jekyll::Tabler.parse_optional_args(args.drop(1)) raise Liquid::SyntaxError, Jekyll::Tabler. if positional_args.length > 2 @size = .fetch("size", positional_args[0] || 24) @color = .fetch("color", positional_args[1] || "currentColor") rescue ArgumentError => e raise Liquid::SyntaxError, e. end |
Instance Method Details
#render(context) ⇒ Object
Converts stored arguments into final values for the current page and delegates SVG generation to the shared helper.
185 186 187 188 189 190 191 |
# File 'lib/jekyll-tabler.rb', line 185 def render(context) icon_name = Jekyll::Tabler.resolve_argument(@icon_name, context) size = Jekyll::Tabler.resolve_argument(@size, context) color = Jekyll::Tabler.resolve_argument(@color, context) Jekyll::Tabler.filled_wrapper(icon_name, size, color) end |