Class: Smithy::Liquid::Tags::Html::Base
- Inherits:
-
Liquid::Tag
- Object
- Liquid::Tag
- Smithy::Liquid::Tags::Html::Base
show all
- Defined in:
- lib/smithy/liquid/tags/html.rb
Constant Summary
collapse
- Syntax =
/(#{::Liquid::Expression}+)?/
Instance Method Summary
collapse
Constructor Details
#initialize(tag_name, markup, tokens) ⇒ Base
Returns a new instance of Base.
8
9
10
11
12
13
14
15
|
# File 'lib/smithy/liquid/tags/html.rb', line 8
def initialize(tag_name, markup, tokens)
if markup =~ Syntax
@tag = $1.gsub('\'', '')
else
raise ::Liquid::SyntaxError.new("Syntax Error in '#{tag_name}' - Valid syntax: #{tag_name} <path_to/your_file>")
end
super
end
|
Instance Method Details
#render(context) ⇒ Object
29
30
31
|
# File 'lib/smithy/liquid/tags/html.rb', line 29
def render(context)
raise Error.new("please override Smithy::Liquid::Tag::Html::Base#render")
end
|
#tag ⇒ Object
17
18
19
|
# File 'lib/smithy/liquid/tags/html.rb', line 17
def tag
@tag
end
|
#tag_with_ext(ext) ⇒ Object
21
22
23
|
# File 'lib/smithy/liquid/tags/html.rb', line 21
def tag_with_ext(ext)
tag.match(/\.#{ext}$/) ? tag : "#{tag}.#{ext}"
end
|
#tag_without_ext(ext) ⇒ Object
25
26
27
|
# File 'lib/smithy/liquid/tags/html.rb', line 25
def tag_without_ext(ext)
tag.sub(/\.#{ext}$/, '')
end
|