Improve explain output

This commit is contained in:
Vitalii Elenhaupt 2019-01-13 22:14:25 +02:00
parent 3c5e3cdef4
commit f294bb6a68
No known key found for this signature in database
GPG key ID: 7558EF3A4056C706

View file

@ -5,7 +5,8 @@ module Ameba::Formatter
# a specific location.
class ExplainFormatter
LINE_BREAK = "\n"
PREFIX = "| ".colorize(:yellow)
HEADING = "## "
PREFIX = " "
include Util
@ -64,8 +65,8 @@ module Ameba::Formatter
end
private def output_title(title)
output << PREFIX << title.colorize(:yellow) << LINE_BREAK
output << PREFIX << LINE_BREAK
output << HEADING.colorize(:yellow) << title.colorize(:yellow) << LINE_BREAK
output << LINE_BREAK
end
private def output_paragraph(paragraph : String)
@ -74,9 +75,9 @@ module Ameba::Formatter
private def output_paragraph(paragraph : Array(String))
paragraph.each do |line|
output << PREFIX << PREFIX << line << LINE_BREAK
output << PREFIX << line << LINE_BREAK
end
output << PREFIX << LINE_BREAK
output << LINE_BREAK
end
end
end