Class: JekyllToDo::ToDo
- Inherits:
-
JekyllSupport::JekyllBlock
- Object
- JekyllSupport::JekyllBlock
- JekyllToDo::ToDo
- Extended by:
- JekyllToDoModule
- Defined in:
- lib/todo.rb
Overview
This class implements the Jekyll functionality
Constant Summary collapse
- PLUGIN_NAME =
'todo'.freeze
- VERSION =
JekyllToDo::VERSION
Instance Method Summary collapse
Methods included from JekyllToDoModule
Instance Method Details
#render_impl(content) ⇒ string
See github.com/mslinn/jekyll_plugin_support#argument-parsing
The following variables are predefined:
@argument_string, @config, @envs, @helper, @layout, @logger, @mode, @page, @paginator, @site and @theme
@tag_name [String] is the name of the tag, which we already know.
@argument_string [String] the arguments from the web page.
@tokens [Liquid::ParseContext] tokenized command line
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/todo.rb', line 61 def render_impl(content) @alert = @helper.parameter_specified? 'alert' @alert_option = ' alert' if @alert @block = @helper.parameter_specified? 'block' @block_option = ' display: block;' if @block @class = @helper.parameter_specified? 'class' @class_option = " #{@class}" @id = @helper.parameter_specified? 'id' @id_option = " id='@id'" if @id @mode_specified = @helper.parameter_specified? 'mode' @span = @helper.parameter_specified? 'span' unless @block @style = @helper.parameter_specified? 'style' @style_option = " style='#{@style}#{@block_option}'" if @style || @block_option @mode_specified = 'development' if @mode_specified&.start_with? 'develop' @mode_specified = 'production' if @mode_specified&.start_with? 'prod' return if @mode_specified && @mode_specified != @mode if @span " <span class=\"todo\#{@alert_option}\#{@class_option}\"\#{@id_option}\#{@style_option}>\#{content}</span>\n END_MSG\n else\n <<~END_MSG\n <fieldset class=\"todo\#{@alert_option}\#{@class_option} rounded shadow\"\#{@id_option}\#{@style_option}>\n <legend>TODO</legend>\n \#{content}\n </fieldset>\n END_MSG\n end\nrescue StandardError => e\n @logger.error { \"\#{self.class} died with a \#{e.full_message}\" }\n exit 3\nend\n" |