summaryrefslogtreecommitdiffstats
path: root/_plugins/enunciation.rb
diff options
context:
space:
mode:
authorJustin Gassner <justin.gassner@mailbox.org>2024-03-23 18:08:44 +0100
committerJustin Gassner <justin.gassner@mailbox.org>2024-03-23 18:08:44 +0100
commit73445885d54edffcc9ae74525887b529a3f96165 (patch)
tree525c54151d604a4cf2f69601fc88f45e8673adc2 /_plugins/enunciation.rb
parenta1b5de688d879069b5e1192057d71572c7bc5368 (diff)
downloadsite-master.tar.zst
Diffstat (limited to '_plugins/enunciation.rb')
-rw-r--r--_plugins/enunciation.rb16
1 files changed, 9 insertions, 7 deletions
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