]> Git — Sourcephile - tmp/julm/literate-invoice.git/blob - src/Literate/Document/Table.hs
WIP
[tmp/julm/literate-invoice.git] / src / Literate / Document / Table.hs
1 {-# LANGUAGE OverloadedLists #-}
2 {-# OPTIONS_GHC -Wno-orphans #-}
3
4 module Literate.Document.Table where
5
6 import Data.List qualified as List
7 import Literate.Document.Type
8 import Literate.Prelude
9
10 table =
11 Table
12 { tableHeads = Nothing
13 , tableTemplate = []
14 , tableRowsEvenOdd = False
15 , tableRows = []
16 }
17 tableTemplateFinal :: Table -> TableTemplate
18 tableTemplateFinal tbl
19 | tbl & tableTemplate & null = 1 & fr & LengthRelative & List.replicate columns
20 | otherwise = tbl & tableTemplate
21 where
22 columns :: Int
23 columns =
24 maximum
25 [ row & tableRowColumns & List.length
26 | row <- tbl & tableRows
27 ]
28 tableRow =
29 TableRow
30 { tableRowColumns = []
31 }
32 tableCell =
33 TableCell
34 { tableCellContent = ""
35 , tableCellJustify = JustificationCenter
36 }
37
38 dict =
39 Dict
40 { dictEntries = []
41 }