Types
ColumnAlign = enum Left, Center, Right
- Source Edit
HwylTableError = object of CatchableError
- Source Edit
HwylTableSeps = object
- Source Edit
HwylTableSepType = enum None, Ascii, Box, BoxRounded
- Source Edit
HwylTableStyle = object headerStyle* = "bold" rowStyles*: seq[string] = [] headerAlign*: seq[ColumnAlign] = [] colAlign*: seq[ColumnAlign] = [] header* = true border* = true headerSep* = true rowSep* = false colSep* = true sepStyle* = "" seps* = (topLeft: "╭", topRight: "╮", topMiddle: "┬", bottomLeft: "╰", bottomRight: "╯", bottomMiddle: "┴", centerLeft: "├", centerRight: "┤", centerMiddle: "┼", vertical: "│", horizontal: "─")
- Source Edit
Consts
HwylTableSepsByType = [(topLeft: " ", topRight: " ", topMiddle: " ", bottomLeft: " ", bottomRight: " ", bottomMiddle: " ", centerLeft: " ", centerRight: " ", centerMiddle: " ", vertical: " ", horizontal: " "), (topLeft: "+", topRight: "+", topMiddle: "+", bottomLeft: "+", bottomRight: "+", bottomMiddle: "+", centerLeft: "+", centerRight: "+", centerMiddle: "+", vertical: "|", horizontal: "-"), (topLeft: "┌", topRight: "┐", topMiddle: "┬", bottomLeft: "└", bottomRight: "┘", bottomMiddle: "┴", centerLeft: "├", centerRight: "┤", centerMiddle: "┼", vertical: "│", horizontal: "─"), (topLeft: "╭", topRight: "╮", topMiddle: "┬", bottomLeft: "╰", bottomRight: "╯", bottomMiddle: "┴", centerLeft: "├", centerRight: "┤", centerMiddle: "┼", vertical: "│", horizontal: "─")]
- Source Edit
Procs
func borderMiddle(colWidths: seq[int]; style: HwylTableStyle; top = false): string {. ...raises: [], tags: [], forbids: [].}
- Source Edit
func borderMiddleSep(style: HwylTableStyle; top = false): string {....raises: [], tags: [], forbids: [].}
- Source Edit
func bottomBorder(colWidths: seq[int]; style: HwylTableStyle): BbString {. ...raises: [], tags: [], forbids: [].}
- Source Edit
func getColWidths(t: HwylTable): seq[int] {....raises: [], tags: [], forbids: [].}
- Source Edit
func getRowLengths(t: HwylTable): seq[seq[int]] {....raises: [], tags: [], forbids: [].}
- Source Edit
func newHwylTableStyle(sepType: HwylTableSepType): HwylTableStyle {....raises: [], tags: [], forbids: [].}
- Source Edit
func renderHeader(t: HwylTable; style: HwylTableStyle; colWidths: seq[int]): BbString {. ...raises: [], tags: [], forbids: [].}
- Source Edit
func renderRows(t: HwylTable; style: HwylTableStyle; colWidths: seq[int]): BbString {. ...raises: [], tags: [], forbids: [].}
- Source Edit
proc toHwylTable[A, B](pairs: openArray[(A, B)]): HwylTable
- Source Edit
proc toHwylTable[A, B](t: OrderedTable[A, B]): HwylTable
- Source Edit
proc toHwylTable[A, B](t: Table[A, B]): HwylTable
- Source Edit
proc topBorder(colWidths: seq[int]; style: HwylTableStyle): BbString {. ...raises: [], tags: [], forbids: [].}
- Source Edit
Macros
macro hwylTableBlock(body: untyped): untyped
-
create a table from a list of tuples
let blockTable = hwylTableBlock: ["ID", "Name" , "Department" ] ("1" ,bb"[bold]Alice Johnson", "Engineering" ) ("2" , "Bob Smith" ,bb"[blue]Marketing" ) ("3" ,bb"[bold]Carol White" , "Sales" ) ("4" , "David Brown" ,bb"[green]Engineering")
Source Edit
Exports
-
BbString, bbEscape, toAnsiCode, bbMarkup, bbfmt, BbMode, join, $, alignLeft, wrapWordsBbMarkup, hecho, echo, toAnsiCode, repeat, bb, bb, hconcat, &, setHwylConsole, bb, toAnsiCode, align, wrapWords, bb, hconcat, &, len, truncate, add, bbEscape, &, add, BbSpan, toString, stripAnsi, setHwylConsoleFile, join, newConsole, bb, hwylConsole, splitLines, []