Class: JekyllIncludePlugin::IncludeFileTag
- Inherits:
-
Liquid::Tag
- Object
- Liquid::Tag
- JekyllIncludePlugin::IncludeFileTag
- Defined in:
- lib/jekyll_include_plugin/jekyll_include_plugin.rb
Instance Method Summary collapse
-
#initialize(tag_name, raw_markup, tokens) ⇒ IncludeFileTag
constructor
A new instance of IncludeFileTag.
- #render(context) ⇒ Object
Methods included from TextUtils
#blank_line?, #pick_snippet, #remove_all_snippets, #remove_excessive_indentation, #remove_excessive_newlines, #render_comments, #wrap_in_codeblock
Methods included from Utils
Constructor Details
#initialize(tag_name, raw_markup, tokens) ⇒ IncludeFileTag
Returns a new instance of IncludeFileTag.
10 11 12 13 14 |
# File 'lib/jekyll_include_plugin/jekyll_include_plugin.rb', line 10 def initialize(tag_name, raw_markup, tokens) super @raw_markup = raw_markup @params = {} end |
Instance Method Details
#render(context) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/jekyll_include_plugin/jekyll_include_plugin.rb', line 16 def render(context) parse_params(context) file_contents = get_raw_file_contents(context) if @params["snippet"] file_contents = pick_snippet(file_contents, @params["snippet"]) else file_contents = remove_all_snippets(file_contents) end file_contents = remove_excessive_newlines(file_contents) file_contents = remove_excessive_indentation(file_contents) file_contents = render_comments(file_contents, context.registers[:page]["lang"]) file_contents = wrap_in_codeblock(file_contents, @params["syntax"]) if @params["syntax"] return file_contents end |