diff --git a/CHANGELOG.md b/CHANGELOG.md index 65f5b6a..425a93f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## Unreleased +## v2.0.2 - 25 October 2024 +- Patch to fix bug with handling closing quotes before a newline. + ## v2.0.1 - 26 September 2024 - Patch to consider all headers in from_dicts. diff --git a/gleam.toml b/gleam.toml index 7f3d010..7e921a0 100644 --- a/gleam.toml +++ b/gleam.toml @@ -1,5 +1,5 @@ name = "gsv" -version = "2.0.1" +version = "2.0.2" gleam = ">= 0.32.0" description = "A simple csv parser and generator written in gleam " diff --git a/src/gsv/internal/ast.gleam b/src/gsv/internal/ast.gleam index fe1c66f..56f667f 100644 --- a/src/gsv/internal/ast.gleam +++ b/src/gsv/internal/ast.gleam @@ -154,7 +154,8 @@ fn parse_p( [curr_line, ..previously_parsed_lines] -> parse_p(remaining_tokens, InsideEscapedString, [ - ["", ..curr_line], + [""], + curr_line, ..previously_parsed_lines ]) diff --git a/test/gsv_test.gleam b/test/gsv_test.gleam index 3529a88..fdb681f 100644 --- a/test/gsv_test.gleam +++ b/test/gsv_test.gleam @@ -1,5 +1,6 @@ import gleam/dict import gleam/int +import gleam/io import gleam/list import gleam/result import gleam/string @@ -234,3 +235,15 @@ pub fn dicts_with_missing_values_test() { "colour,name,score,youtube\nPink,Lucy,100,\n,Isaac,99,@IsaacHarrisHolt", ) } + +pub fn quotes_test() { + let stringy = + "\"Date\",\"Type\",\"Price\",\"Ammount\"\n\"11/11/2024\",\"Apples\",\"7\",\"5\"" + + gsv.to_lists(stringy) + |> should.be_ok + |> should.equal([ + ["Date", "Type", "Price", "Ammount"], + ["11/11/2024", "Apples", "7", "5"], + ]) +}