From 25414d8fea2e04272abdf73274bfbfba4a4c9350 Mon Sep 17 00:00:00 2001 From: Jonas Coch Date: Thu, 27 Jul 2017 09:30:01 +0200 Subject: [PATCH 1/2] Add failing test with additional columns in CSV --- tests/Tests/CSV/Import.elm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Tests/CSV/Import.elm b/tests/Tests/CSV/Import.elm index 00a5e9f..963bad6 100644 --- a/tests/Tests/CSV/Import.elm +++ b/tests/Tests/CSV/Import.elm @@ -42,9 +42,9 @@ inputCSV : String inputCSV = CSV.Template.headers ++ """ -"Translation.Test","myString","My comment","","Value" +"Translation.Test","myString","My comment","","Value","IGNORE" "Translation.Test","myFormat","","label","Prefix: {{label}}" -"Translation.Test","myFormatAtBeginning","","label","{{label}} suffix" +"Translation.Test","myFormatAtBeginning","","label","{{label}} suffix","IGNORE","IGNORE" "Translation.Test","myFormatQuoted","","label","Prefix '{{label}}' suffix" """ From 905aa64eb420b60e20327ab9e54bfdb497fad8c3 Mon Sep 17 00:00:00 2001 From: Jonas Coch Date: Thu, 27 Jul 2017 09:30:37 +0200 Subject: [PATCH 2/2] Support additional columns when reading lines --- src/CSV/Import.elm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CSV/Import.elm b/src/CSV/Import.elm index 47c1d3f..8248046 100644 --- a/src/CSV/Import.elm +++ b/src/CSV/Import.elm @@ -87,7 +87,7 @@ allModuleNames lines = moduleNameForLine : List String -> Maybe String moduleNameForLine columns = case columns of - [ modulename, _, _, _, _ ] -> + modulename :: _ :: _ :: _ :: _ :: xs -> Just modulename _ -> @@ -102,7 +102,7 @@ linesForModule moduleName lines = fromLine : List String -> Maybe Localized.Element fromLine columns = case columns of - [ modulename, key, comment, placeholders, value ] -> + modulename :: key :: comment :: placeholders :: value :: xs -> Just (code modulename key comment placeholders value) _ ->