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

@@ -4,7 +4,7 @@ module Notare
class Document
include Builder
attr_reader :nodes, :styles, :hyperlinks
attr_reader :nodes, :styles, :table_styles, :hyperlinks
def self.create(path, &block)
doc = new
@@ -25,7 +25,9 @@ module Notare
@images = {}
@hyperlinks = []
@styles = {}
@table_styles = {}
register_built_in_styles
register_built_in_table_styles
end
def define_style(name, **properties)
@@ -36,6 +38,14 @@ module Notare
@styles[name]
end
def define_table_style(name, **properties)
@table_styles[name] = TableStyle.new(name, **properties)
end
def table_style(name)
@table_styles[name]
end
def save(path)
Package.new(self).save(path)
end
@@ -104,5 +114,13 @@ module Notare
define_style :quote, italic: true, color: "666666", indent: 720
define_style :code, font: "Courier New", size: 10
end
def register_built_in_table_styles
define_table_style :grid,
borders: { style: "single", color: "000000", size: 4 }
define_table_style :borderless,
borders: :none
end
end
end