Class: Jekyll::RawInclude
- Inherits:
-
Liquid::Block
- Object
- Liquid::Block
- Jekyll::RawInclude
- Includes:
- LiquidFilters
- Defined in:
- rawinclude.rb
Constant Summary collapse
- FullTokenPossiblyInvalid =
/\A(.*)#{Liquid::TagStart}\s*(\w+)\s*(.*)?#{Liquid::TagEnd}\z/om
Instance Method Summary collapse
- #blank? ⇒ Boolean
-
#initialize(tag_name, params, tokens) ⇒ RawInclude
constructor
A new instance of RawInclude.
- #nodelist ⇒ Object
- #parse(tokens) ⇒ Object
- #render(context) ⇒ Object
Methods included from LiquidFilters
Constructor Details
#initialize(tag_name, params, tokens) ⇒ RawInclude
Returns a new instance of RawInclude.
18 19 20 21 |
# File 'rawinclude.rb', line 18 def initialize(tag_name, params, tokens) super @params = params end |
Instance Method Details
#blank? ⇒ Boolean
48 49 50 |
# File 'rawinclude.rb', line 48 def blank? @body.empty? end |
#nodelist ⇒ Object
44 45 46 |
# File 'rawinclude.rb', line 44 def nodelist [@body] end |
#parse(tokens) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'rawinclude.rb', line 23 def parse(tokens) @body = '' while token = tokens.shift if token =~ FullTokenPossiblyInvalid @body << Regexp.last_match(1) if Regexp.last_match(1) != ''.freeze return if block_delimiter == Regexp.last_match(2) end @body << token unless token.empty? end raise Liquid::SyntaxError, parse_context.locale.t('errors.syntax.tag_never_closed'.freeze, block_name: block_name) end |
#render(context) ⇒ Object
37 38 39 40 41 42 |
# File 'rawinclude.rb', line 37 def render(context) uri_data = escape_quotes(URI.escape(@body.slice(1, @body.length))) Liquid::Template.parse("{% include #{@params} block='#{escape_quotes(unliquidify(@body))}' uri_data='#{uri_data}' %}").render(context) end |