Skip to content

Commit

Permalink
Fix row numbering
Browse files Browse the repository at this point in the history
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
  • Loading branch information
HenriquerPimentel and lunny committed Apr 10, 2024
1 parent e130b93 commit 53d3582
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion modules/markup/csv/csv.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func (r Renderer) Render(ctx *markup.RenderContext, input io.Reader, output io.W
return err
}

row := 1
row := 0
for {
fields, err := rd.Read()
if err == io.EOF || (row >= maxRows && maxRows != 0) {
Expand Down
8 changes: 4 additions & 4 deletions modules/markup/csv/csv_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ import (
func TestRenderCSV(t *testing.T) {
var render Renderer
kases := map[string]string{
"a": "<table class=\"data-table\"><tr><th class=\"line-num\">1</th><th>a</th></tr></table>",
"1,2": "<table class=\"data-table\"><tr><th class=\"line-num\">1</th><th>1</th><th>2</th></tr></table>",
"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>",
"<br/>": "<table class=\"data-table\"><tr><th class=\"line-num\">1</th><th>&lt;br/&gt;</th></tr></table>",
"a": "<table class=\"data-table\"><tr><th class=\"line-num\">0</th><th>a</th></tr></table>",
"1,2": "<table class=\"data-table\"><tr><th class=\"line-num\">0</th><th>1</th><th>2</th></tr></table>",
"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>",
"<br/>": "<table class=\"data-table\"><tr><th class=\"line-num\">0</th><th>&lt;br/&gt;</th></tr></table>",
}

for k, v := range kases {
Expand Down

0 comments on commit 53d3582

Please sign in to comment.