chore: file header and change local text

This commit is contained in:
tiglog 2023-08-21 17:42:50 +08:00
parent 0cc0b5f310
commit d74d4a5348
21 changed files with 206 additions and 56 deletions

View File

@ -1,3 +1,10 @@
//
// config.go
// Copyright (C) 2023 tiglog <me@tiglog.com>
//
// Distributed under terms of the MIT license.
//
package table package table
import "git.hexq.cn/tiglog/golib/helper/text" import "git.hexq.cn/tiglog/golib/helper/text"

View File

@ -1,3 +1,10 @@
//
// render.go
// Copyright (C) 2023 tiglog <me@tiglog.com>
//
// Distributed under terms of the MIT license.
//
package table package table
import ( import (

View File

@ -1,9 +1,16 @@
//
// render_bidi_test.go
// Copyright (C) 2023 tiglog <me@tiglog.com>
//
// Distributed under terms of the MIT license.
//
package table package table
import ( import (
"testing" "testing"
"github.com/jedib0t/go-pretty/v6/text" "git.hexq.cn/tiglog/golib/helper/text"
) )
func TestTable_Render_BiDiText(t *testing.T) { func TestTable_Render_BiDiText(t *testing.T) {

View File

@ -1,3 +1,10 @@
//
// render_csv.go
// Copyright (C) 2023 tiglog <me@tiglog.com>
//
// Distributed under terms of the MIT license.
//
package table package table
import ( import (
@ -7,11 +14,12 @@ import (
) )
// RenderCSV renders the Table in CSV format. Example: // RenderCSV renders the Table in CSV format. Example:
// #,First Name,Last Name,Salary, //
// 1,Arya,Stark,3000, // #,First Name,Last Name,Salary,
// 20,Jon,Snow,2000,"You know nothing\, Jon Snow!" // 1,Arya,Stark,3000,
// 300,Tyrion,Lannister,5000, // 20,Jon,Snow,2000,"You know nothing\, Jon Snow!"
// ,,Total,10000, // 300,Tyrion,Lannister,5000,
// ,,Total,10000,
func (t *Table) RenderCSV() string { func (t *Table) RenderCSV() string {
t.initForRender() t.initForRender()

View File

@ -1,3 +1,10 @@
//
// render_csv_test.go
// Copyright (C) 2023 tiglog <me@tiglog.com>
//
// Distributed under terms of the MIT license.
//
package table package table
import ( import (

View File

@ -1,3 +1,10 @@
//
// render_hint.go
// Copyright (C) 2023 tiglog <me@tiglog.com>
//
// Distributed under terms of the MIT license.
//
package table package table
// renderHint has hints for the Render*() logic // renderHint has hints for the Render*() logic

View File

@ -1,3 +1,10 @@
//
// render_html.go
// Copyright (C) 2023 tiglog <me@tiglog.com>
//
// Distributed under terms of the MIT license.
//
package table package table
import ( import (
@ -13,49 +20,50 @@ const (
) )
// RenderHTML renders the Table in HTML format. Example: // RenderHTML renders the Table in HTML format. Example:
// <table class="go-pretty-table"> //
// <thead> // <table class="go-pretty-table">
// <tr> // <thead>
// <th align="right">#</th> // <tr>
// <th>First Name</th> // <th align="right">#</th>
// <th>Last Name</th> // <th>First Name</th>
// <th align="right">Salary</th> // <th>Last Name</th>
// <th>&nbsp;</th> // <th align="right">Salary</th>
// </tr> // <th>&nbsp;</th>
// </thead> // </tr>
// <tbody> // </thead>
// <tr> // <tbody>
// <td align="right">1</td> // <tr>
// <td>Arya</td> // <td align="right">1</td>
// <td>Stark</td> // <td>Arya</td>
// <td align="right">3000</td> // <td>Stark</td>
// <td>&nbsp;</td> // <td align="right">3000</td>
// </tr> // <td>&nbsp;</td>
// <tr> // </tr>
// <td align="right">20</td> // <tr>
// <td>Jon</td> // <td align="right">20</td>
// <td>Snow</td> // <td>Jon</td>
// <td align="right">2000</td> // <td>Snow</td>
// <td>You know nothing, Jon Snow!</td> // <td align="right">2000</td>
// </tr> // <td>You know nothing, Jon Snow!</td>
// <tr> // </tr>
// <td align="right">300</td> // <tr>
// <td>Tyrion</td> // <td align="right">300</td>
// <td>Lannister</td> // <td>Tyrion</td>
// <td align="right">5000</td> // <td>Lannister</td>
// <td>&nbsp;</td> // <td align="right">5000</td>
// </tr> // <td>&nbsp;</td>
// </tbody> // </tr>
// <tfoot> // </tbody>
// <tr> // <tfoot>
// <td align="right">&nbsp;</td> // <tr>
// <td>&nbsp;</td> // <td align="right">&nbsp;</td>
// <td>Total</td> // <td>&nbsp;</td>
// <td align="right">10000</td> // <td>Total</td>
// <td>&nbsp;</td> // <td align="right">10000</td>
// </tr> // <td>&nbsp;</td>
// </tfoot> // </tr>
// </table> // </tfoot>
// </table>
func (t *Table) RenderHTML() string { func (t *Table) RenderHTML() string {
t.initForRender() t.initForRender()

View File

@ -1,10 +1,17 @@
//
// render_html_test.go
// Copyright (C) 2023 tiglog <me@tiglog.com>
//
// Distributed under terms of the MIT license.
//
package table package table
import ( import (
"fmt" "fmt"
"testing" "testing"
"github.com/jedib0t/go-pretty/v6/text" "git.hexq.cn/tiglog/golib/helper/text"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
) )

View File

@ -1,3 +1,10 @@
//
// render_init.go
// Copyright (C) 2023 tiglog <me@tiglog.com>
//
// Distributed under terms of the MIT license.
//
package table package table
import ( import (

View File

@ -1,3 +1,10 @@
//
// render_markdown.go
// Copyright (C) 2023 tiglog <me@tiglog.com>
//
// Distributed under terms of the MIT license.
//
package table package table
import ( import (
@ -6,12 +13,13 @@ import (
) )
// RenderMarkdown renders the Table in Markdown format. Example: // RenderMarkdown renders the Table in Markdown format. Example:
// | # | First Name | Last Name | Salary | | //
// | ---:| --- | --- | ---:| --- | // | # | First Name | Last Name | Salary | |
// | 1 | Arya | Stark | 3000 | | // | ---:| --- | --- | ---:| --- |
// | 20 | Jon | Snow | 2000 | You know nothing, Jon Snow! | // | 1 | Arya | Stark | 3000 | |
// | 300 | Tyrion | Lannister | 5000 | | // | 20 | Jon | Snow | 2000 | You know nothing, Jon Snow! |
// | | | Total | 10000 | | // | 300 | Tyrion | Lannister | 5000 | |
// | | | Total | 10000 | |
func (t *Table) RenderMarkdown() string { func (t *Table) RenderMarkdown() string {
t.initForRender() t.initForRender()

View File

@ -1,3 +1,10 @@
//
// render_markdown_test.go
// Copyright (C) 2023 tiglog <me@tiglog.com>
//
// Distributed under terms of the MIT license.
//
package table package table
import ( import (

View File

@ -1,3 +1,10 @@
//
// render_test.go
// Copyright (C) 2023 tiglog <me@tiglog.com>
//
// Distributed under terms of the MIT license.
//
package table package table
import ( import (

View File

@ -1,3 +1,10 @@
//
// sort.go
// Copyright (C) 2023 tiglog <me@tiglog.com>
//
// Distributed under terms of the MIT license.
//
package table package table
import ( import (

View File

@ -1,3 +1,10 @@
//
// sort_test.go
// Copyright (C) 2023 tiglog <me@tiglog.com>
//
// Distributed under terms of the MIT license.
//
package table package table
import ( import (

View File

@ -1,3 +1,10 @@
//
// style.go
// Copyright (C) 2023 tiglog <me@tiglog.com>
//
// Distributed under terms of the MIT license.
//
package table package table
import "git.hexq.cn/tiglog/golib/helper/text" import "git.hexq.cn/tiglog/golib/helper/text"

View File

@ -1,3 +1,10 @@
//
// table.go
// Copyright (C) 2023 tiglog <me@tiglog.com>
//
// Distributed under terms of the MIT license.
//
package table package table
import ( import (

View File

@ -1,3 +1,10 @@
//
// table_test.go
// Copyright (C) 2023 tiglog <me@tiglog.com>
//
// Distributed under terms of the MIT license.
//
package table package table
import ( import (

View File

@ -1,3 +1,10 @@
//
// util.go
// Copyright (C) 2023 tiglog <me@tiglog.com>
//
// Distributed under terms of the MIT license.
//
package table package table
import ( import (

View File

@ -1,3 +1,10 @@
//
// util_test.go
// Copyright (C) 2023 tiglog <me@tiglog.com>
//
// Distributed under terms of the MIT license.
//
package table package table
import ( import (

View File

@ -1,3 +1,10 @@
//
// writer.go
// Copyright (C) 2023 tiglog <me@tiglog.com>
//
// Distributed under terms of the MIT license.
//
package table package table
import ( import (

View File

@ -1,3 +1,10 @@
//
// writer_test.go
// Copyright (C) 2023 tiglog <me@tiglog.com>
//
// Distributed under terms of the MIT license.
//
package table package table
import ( import (