lib/jekyll_quote.rb in jekyll_quote-0.3.0 vs lib/jekyll_quote.rb in jekyll_quote-0.3.1

- old
+ new

@@ -1,16 +1,14 @@ -# frozen_string_literal: true - require 'jekyll_plugin_support' require 'jekyll_plugin_support_helper' require_relative 'jekyll_quote/version' # @author Copyright 2022 Michael Slinn # @license SPDX-License-Identifier: Apache-2.0 module QuoteModule - PLUGIN_NAME = 'quote' + PLUGIN_NAME = 'quote'.freeze end module Jekyll # Usage: {% quote [break] [by] [cite='Joe Blow'] [noprep] [url='https://blabla.com'] %}Bla bla.{% endquote %} # Output looks like: @@ -19,10 +17,12 @@ # <br><br> <span style='font-style:normal;'>&nbsp;&ndash; From Source cite.</span> # </div> class Quote < JekyllSupport::JekyllBlock attr_accessor :cite, :url + include JekyllQuoteVersion + def render_impl(text) @break = @helper.parameter_specified? 'break' # enforced by CSS if a list ends the body @by = @helper.parameter_specified? 'by' @cite = @helper.parameter_specified? 'cite' @noprep = @helper.parameter_specified? 'noprep' @@ -37,18 +37,17 @@ else "#{@cite}\n" end tag = @break ? 'div' : 'span' attribution = "<#{tag} class='quoteAttribution'> &nbsp;&ndash; #{preposition} #{attribution}</#{tag}>\n" - text = "<div class='quoteText'>#{text}</div>" if @break + text = "<div class='quoteText clearfix'>#{text}</div>" if @break end <<~END_HERE <div class='quote'> #{text}#{attribution} </div> END_HERE end + + JekyllPluginHelper.register(self, QuoteModule::PLUGIN_NAME) end end - -PluginMetaLogger.instance.info { "Loaded #{QuoteModule::PLUGIN_NAME} v0.1.0 plugin." } -Liquid::Template.register_tag(QuoteModule::PLUGIN_NAME, Jekyll::Quote)