mirror of
https://github.com/ralsina/tartrazine.git
synced 2025-07-04 15:29:25 +00:00
Make formatter a bit more convenient
This commit is contained in:
@ -58,7 +58,8 @@ module Tartrazine
|
||||
"<span #{line_id} #{line_class} style=\"user-select: none;\">#{line_label} </span>"
|
||||
end
|
||||
|
||||
def format_text(text : String, lexer : Lexer, outp : IO) : Nil
|
||||
def format_text(text : String, lexer : Lexer, io : IO?) : String?
|
||||
outp = io.nil? ? String::Builder.new("") : io
|
||||
tokenizer = Tokenizer.new(lexer, text)
|
||||
i = 0
|
||||
if surrounding_pre?
|
||||
@ -75,6 +76,7 @@ module Tartrazine
|
||||
end
|
||||
end
|
||||
outp << "</code></pre>"
|
||||
return outp.to_s if io.nil?
|
||||
end
|
||||
|
||||
# ameba:disable Metrics/CyclomaticComplexity
|
||||
|
Reference in New Issue
Block a user