about summary refs log tree commit diff
path: root/app/lib
diff options
context:
space:
mode:
Diffstat (limited to 'app/lib')
-rw-r--r--app/lib/command_tag/commands/text_tools.rb13
1 files changed, 13 insertions, 0 deletions
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] = ["<pre><code>#{args.present? ? args.last : nil}</code></pre>"]
+    end
+  end
+end