From ebc991b3059cfdac23e085c8333ae23d3f01a9de Mon Sep 17 00:00:00 2001 From: Fire Demon Date: Sun, 26 Jul 2020 03:24:51 -0500 Subject: [Command Tags] Add TextTools module --- app/lib/command_tag/commands/text_tools.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 app/lib/command_tag/commands/text_tools.rb (limited to 'app/lib') diff --git a/app/lib/command_tag/commands/text_tools.rb b/app/lib/command_tag/commands/text_tools.rb new file mode 100644 index 000000000..acb0a5985 --- /dev/null +++ b/app/lib/command_tag/commands/text_tools.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module CommandTag::Commands::TextTools + def handle_code_at_start(args) + name = args.count > 1 ? args[0] : 'code' + + if @status.content_type == 'text/plain' + @vars[name] = ["----------\n#{args.present? ? args.last : nil}\n----------"] + else + @vars[name] = ["
#{args.present? ? args.last : nil}
"] + end + end +end -- cgit