mirror of
https://github.com/ralsina/tartrazine.git
synced 2025-07-04 15:29:25 +00:00
API changes to make it nicer
These are incompatible, tho. * Theme is now a property of the formatter instead of passing it arounf * get_style_defs is now style_defs
This commit is contained in:
@ -9,12 +9,15 @@ module Tartrazine
|
||||
# This is the base class for all formatters.
|
||||
abstract class Formatter
|
||||
property name : String = ""
|
||||
property theme : Theme = Tartrazine.theme("default-dark")
|
||||
|
||||
def format(text : String, lexer : Lexer, theme : Theme) : String
|
||||
# Format the text using the given lexer.
|
||||
def format(text : String, lexer : Lexer) : String
|
||||
raise Exception.new("Not implemented")
|
||||
end
|
||||
|
||||
def get_style_defs(theme : Theme) : String
|
||||
# Return the styles, if the formatter supports it.
|
||||
def style_defs : String
|
||||
raise Exception.new("Not implemented")
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user