Skip to content

Commit 53d3582

Browse files
Fix row numbering
Co-authored-by: Lunny Xiao <[email protected]>
1 parent e130b93 commit 53d3582

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

modules/markup/csv/csv.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ func (r Renderer) Render(ctx *markup.RenderContext, input io.Reader, output io.W
9797
return err
9898
}
9999

100-
row := 1
100+
row := 0
101101
for {
102102
fields, err := rd.Read()
103103
if err == io.EOF || (row >= maxRows && maxRows != 0) {

modules/markup/csv/csv_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ import (
1616
func TestRenderCSV(t *testing.T) {
1717
var render Renderer
1818
kases := map[string]string{
19-
"a": "<table class=\"data-table\"><tr><th class=\"line-num\">1</th><th>a</th></tr></table>",
20-
"1,2": "<table class=\"data-table\"><tr><th class=\"line-num\">1</th><th>1</th><th>2</th></tr></table>",
21-
"1;2\n3;4": "<table class=\"data-table\"><tr><th class=\"line-num\">1</th><th>1</th><th>2</th></tr><tr><td class=\"line-num\">2</td><td>3</td><td>4</td></tr></table>",
22-
"<br/>": "<table class=\"data-table\"><tr><th class=\"line-num\">1</th><th>&lt;br/&gt;</th></tr></table>",
19+
"a": "<table class=\"data-table\"><tr><th class=\"line-num\">0</th><th>a</th></tr></table>",
20+
"1,2": "<table class=\"data-table\"><tr><th class=\"line-num\">0</th><th>1</th><th>2</th></tr></table>",
21+
"1;2\n3;4": "<table class=\"data-table\"><tr><th class=\"line-num\">0</th><th>1</th><th>2</th></tr><tr><td class=\"line-num\">2</td><td>3</td><td>4</td></tr></table>",
22+
"<br/>": "<table class=\"data-table\"><tr><th class=\"line-num\">0</th><th>&lt;br/&gt;</th></tr></table>",
2323
}
2424

2525
for k, v := range kases {

0 commit comments

Comments
 (0)