From 73445885d54edffcc9ae74525887b529a3f96165 Mon Sep 17 00:00:00 2001 From: Justin Gassner Date: Sat, 23 Mar 2024 18:08:44 +0100 Subject: Update --- _plugins/enunciation.rb | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to '_plugins/enunciation.rb') diff --git a/_plugins/enunciation.rb b/_plugins/enunciation.rb index b141ae9..17bfd1c 100644 --- a/_plugins/enunciation.rb +++ b/_plugins/enunciation.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Jekyll class EnunciationTagBlock < Liquid::Block def initialize(tag_name, arg, parse_context) @@ -11,19 +13,19 @@ module Jekyll # If the enunciation ends with a KaTeX displayed equation, # then we remove the bottom margin. if text[-5, 5] == " $$\n" - text += ' {: .katex-display .mb-0 }' + text << ' {: .katex-display .mb-0 }' elsif text[-3, 3] == "$$\n" - text += '{: .katex-display .mb-0 }' + text << '{: .katex-display .mb-0 }' end # Check if a description was given. if @arg.empty? "{: .#{block_name} }\n #{text.gsub!(/^/, '> ')}" else - if @arg[0] == '*' - title = @arg.delete_prefix('* ') - else - title = "#{block_name.capitalize} (#{@arg})" - end + title = if @arg[0] == '*' + @arg.delete_prefix('* ') + else + "#{block_name.capitalize} (#{@arg})" + end slug = @slugtemplate.render('string' => title) "{: .#{block_name}-title }\n> #{title}\n> {: \##{slug} }\n>\n#{text.gsub!(/^/, '> ')}" end -- cgit v1.2.3-54-g00ecf