Implement table styles
All checks were successful
CI Pipeline / build (pull_request) Successful in 14s
All checks were successful
CI Pipeline / build (pull_request) Successful in 14s
This commit is contained in:
@@ -100,8 +100,8 @@ module Notare
|
||||
@current_list.add_item(item)
|
||||
end
|
||||
|
||||
def table(&block)
|
||||
tbl = Nodes::Table.new
|
||||
def table(style: nil, &block)
|
||||
tbl = Nodes::Table.new(style: resolve_table_style(style))
|
||||
previous_table = @current_table
|
||||
@current_table = tbl
|
||||
block.call
|
||||
@@ -198,5 +198,12 @@ module Notare
|
||||
|
||||
style(style_or_name) || raise(ArgumentError, "Unknown style: #{style_or_name}")
|
||||
end
|
||||
|
||||
def resolve_table_style(style_or_name)
|
||||
return nil if style_or_name.nil?
|
||||
return style_or_name if style_or_name.is_a?(TableStyle)
|
||||
|
||||
table_style(style_or_name) || raise(ArgumentError, "Unknown table style: #{style_or_name}")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user