about summary refs log tree commit diff
path: root/app/lib/command_tag/commands/text_tools.rb
blob: acb0a59850ffe1d27bb2d27d42b1074d368d876a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
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] = ["<pre><code>#{args.present? ? args.last : nil}</code></pre>"]
    end
  end
end