Module: JekyllFilterTemplate
- Included in:
- JekyllPluginTemplate
- Defined in:
- lib/jekyll_filter_template.rb
Overview
Template for Jekyll filters.
Class Attribute Summary collapse
-
.logger ⇒ Object
Returns the value of attribute logger.
Instance Method Summary collapse
-
#my_filter_template(input_string) ⇒ String
This Jekyll filter returns the URL to search Google for the contents of the input string.
Class Attribute Details
.logger ⇒ Object
Returns the value of attribute logger.
7 8 9 |
# File 'lib/jekyll_filter_template.rb', line 7 def logger @logger end |
Instance Method Details
#my_filter_template(input_string) ⇒ String
This Jekyll filter returns the URL to search Google for the contents of the input string.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/jekyll_filter_template.rb', line 16 def my_filter_template(input_string) # @context[Liquid::Context] is available here to look up variables defined in front matter, templates, page, etc. JekyllFilterTemplate.logger.debug do 'Defined filters are: ' + self.class # rubocop:disable Style/StringConcatenation .class_variable_get('@@global_strainer') .filter_methods.instance_variable_get('@hash') .map { |k, _v| k } .sort end input_string.strip! JekyllFilterTemplate.logger.debug "input_string=#{input_string}" if input_string.empty? '' else "<a href='https://www.google.com/search?q=#{input_string}' target='_blank' rel='nofollow'>#{input_string}</a>" end end |