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/bangtags.rb5
-rw-r--r--app/lib/formatter.rb7
2 files changed, 11 insertions, 1 deletions
diff --git a/app/lib/bangtags.rb b/app/lib/bangtags.rb
index 290d2b294..acb83221e 100644
--- a/app/lib/bangtags.rb
+++ b/app/lib/bangtags.rb
@@ -504,6 +504,11 @@ class Bangtags
             'plain'       => 'text/plain',
             'plaintext'   => 'text/plain',
 
+            'c'           => 'text/console',
+            'console'     => 'text/console',
+            'terminal'    => 'text/console',
+            'monospace'   => 'text/console',
+
             'm'           => 'text/markdown',
             'md'          => 'text/markdown',
             'markdown'    => 'text/markdown',
diff --git a/app/lib/formatter.rb b/app/lib/formatter.rb
index 524e09247..bbe123b54 100644
--- a/app/lib/formatter.rb
+++ b/app/lib/formatter.rb
@@ -229,6 +229,7 @@ class Formatter
     else
       html = simple_format(html, {}, sanitize: false)
       html = html.delete("\n")
+      html = format_console(html) if status.content_type == 'text/console'
     end
 
     unless status.footer.blank?
@@ -247,13 +248,17 @@ class Formatter
     html.html_safe # rubocop:disable Rails/OutputSafety
   end
 
+  def format_console(html)
+    "<pre><code>#{html}</code></pre>"
+  end
+
   def format_markdown(html)
     html = markdown_formatter.render(html)
   end
 
   def format_bbcode(html)
     html = bbcode_formatter(html)
-    html = html.gsub(/<hr>.*<\/hr>/im, '<hr />')
+    html.gsub(/<hr>.*<\/hr>/im, '<hr />')
   end
 
   def format_bbdown(html)