mirror of
https://github.com/ralsina/tartrazine.git
synced 2025-08-05 07:45:33 +00:00
Use IO for output
This commit is contained in:
@@ -4,8 +4,9 @@ module Tartrazine
|
||||
class Json < Formatter
|
||||
property name = "json"
|
||||
|
||||
def format(text : String, lexer : Lexer, _theme : Theme) : String
|
||||
lexer.tokenize(text).to_json
|
||||
def format(text : String, lexer : Lexer, outp : IO) : Nil
|
||||
tokenizer = Tokenizer.new(lexer, text)
|
||||
outp << Tartrazine::Lexer.collapse_tokens(tokenizer.to_a).to_json
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user