about summary refs log tree commit diff
path: root/app/lib/formatter.rb
diff options
context:
space:
mode:
authormultiple creatures <dev@multiple-creature.party>2019-07-29 23:09:51 -0500
committermultiple creatures <dev@multiple-creature.party>2019-07-29 23:09:51 -0500
commit90130014dd27a909fda8a63d3ce520d4d31fd68c (patch)
tree567a2ce75e2102e810a98ece02ca83257e460911 /app/lib/formatter.rb
parent0fb1e7888e8f2f83c8f1d6b19a44b6c079251a2e (diff)
add plain-text console formatting option
Diffstat (limited to 'app/lib/formatter.rb')
-rw-r--r--app/lib/formatter.rb7
1 files changed, 6 insertions, 1 deletions
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)