optimize ascii tables, use custom style instead of tab inserters (#53)

* optimize ascii tables, use custom style instead of tab inserters
This commit is contained in:
T.v.Dein
2025-06-10 16:12:03 +02:00
committed by GitHub
parent 787178b17e
commit 5168b04339
3 changed files with 7 additions and 41 deletions

View File

@@ -34,39 +34,3 @@ func (data *Tabdata) CloneEmpty() Tabdata {
return newdata
}
// add a TAB (\t) in front of every cell, but not the first
func (data *Tabdata) TabEntries() [][]string {
newentries := make([][]string, len(data.entries))
for rowidx, row := range data.entries {
newentries[rowidx] = make([]string, len(row))
for colidx, cell := range row {
switch colidx {
case 0:
newentries[rowidx][colidx] = cell
default:
newentries[rowidx][colidx] = "\t" + cell
}
}
}
return newentries
}
// add a TAB (\t) in front of every header, but not the first
func (data *Tabdata) TabHeaders() []string {
newheaders := make([]string, len(data.headers))
for colidx, cell := range data.headers {
switch colidx {
case 0:
newheaders[colidx] = cell
default:
newheaders[colidx] = "\t" + cell
}
}
return newheaders
}