summaryrefslogtreecommitdiffstats
path: root/parser
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2018-12-23 21:08:12 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2018-12-23 21:09:09 +0100
commitce06bdb16a64dd39a8ebbb2e5a53b33520b00bb1 (patch)
tree6dac463a32206d7f13f812d384d48334cf936f70 /parser
parent2efc1a64c391420b1007f6e94b6ff616fb136635 (diff)
Rename CSV option from comma to delimiter
See #5555
Diffstat (limited to 'parser')
-rw-r--r--parser/metadecoders/decoder.go8
-rw-r--r--parser/metadecoders/format.go2
2 files changed, 5 insertions, 5 deletions
diff --git a/parser/metadecoders/decoder.go b/parser/metadecoders/decoder.go
index 0ca8575fe..2f3c27d45 100644
--- a/parser/metadecoders/decoder.go
+++ b/parser/metadecoders/decoder.go
@@ -31,8 +31,8 @@ import (
// Decoder provides some configuration options for the decoders.
type Decoder struct {
- // Comma is the field delimiter used in the CSV decoder. It defaults to ','.
- Comma rune
+ // Delimiter is the field delimiter used in the CSV decoder. It defaults to ','.
+ Delimiter rune
// Comment, if not 0, is the comment character ued in the CSV decoder. Lines beginning with the
// Comment character without preceding whitespace are ignored.
@@ -41,7 +41,7 @@ type Decoder struct {
// Default is a Decoder in its default configuration.
var Default = Decoder{
- Comma: ',',
+ Delimiter: ',',
}
// UnmarshalToMap will unmarshall data in format f into a new map. This is
@@ -156,7 +156,7 @@ func (d Decoder) unmarshal(data []byte, f Format, v interface{}) error {
func (d Decoder) unmarshalCSV(data []byte, v interface{}) error {
r := csv.NewReader(bytes.NewReader(data))
- r.Comma = d.Comma
+ r.Comma = d.Delimiter
r.Comment = d.Comment
records, err := r.ReadAll()
diff --git a/parser/metadecoders/format.go b/parser/metadecoders/format.go
index 719fbf100..4f81528c3 100644
--- a/parser/metadecoders/format.go
+++ b/parser/metadecoders/format.go
@@ -92,7 +92,7 @@ func FormatFromFrontMatterType(typ pageparser.ItemType) Format {
// in the given string.
// It return an empty string if no format could be detected.
func (d Decoder) FormatFromContentString(data string) Format {
- csvIdx := strings.IndexRune(data, d.Comma)
+ csvIdx := strings.IndexRune(data, d.Delimiter)
jsonIdx := strings.Index(data, "{")
yamlIdx := strings.Index(data, ":")
tomlIdx := strings.Index(data, "=")