Implement table styles
All checks were successful
CI Pipeline / build (pull_request) Successful in 14s

This commit is contained in:
2025-12-03 12:14:31 +01:00
parent 67a60c8c6e
commit 9a70d91fd5
12 changed files with 555 additions and 13 deletions

View File

@@ -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