mirror of
https://github.com/ralsina/tartrazine.git
synced 2025-07-02 04:47:07 -03:00
These are incompatible, tho. * Theme is now a property of the formatter instead of passing it arounf * get_style_defs is now style_defs
25 lines
608 B
Crystal
25 lines
608 B
Crystal
require "./actions"
|
|
require "./formatter"
|
|
require "./rules"
|
|
require "./styles"
|
|
require "./tartrazine"
|
|
require "colorize"
|
|
|
|
module Tartrazine
|
|
# This is the base class for all formatters.
|
|
abstract class Formatter
|
|
property name : String = ""
|
|
property theme : Theme = Tartrazine.theme("default-dark")
|
|
|
|
# Format the text using the given lexer.
|
|
def format(text : String, lexer : Lexer) : String
|
|
raise Exception.new("Not implemented")
|
|
end
|
|
|
|
# Return the styles, if the formatter supports it.
|
|
def style_defs : String
|
|
raise Exception.new("Not implemented")
|
|
end
|
|
end
|
|
end
|