diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2016-03-23 14:51:16 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2016-03-23 14:51:16 +0100 |
commit | 1cb7ed6ac7fd808b7755a47ffc4878506a42d13c (patch) | |
tree | 42e3e2e242acc256e8875375c926ee6ee2d2c805 /commands | |
parent | 937592cb85f6b4bf4603230050ac0afdcc93058b (diff) |
parser: Spring code cleaning
Diffstat (limited to 'commands')
-rw-r--r-- | commands/convert.go | 6 | ||||
-rw-r--r-- | commands/undraft.go | 8 |
2 files changed, 7 insertions, 7 deletions
diff --git a/commands/convert.go b/commands/convert.go index ca87e6fe0..fc15b847c 100644 --- a/commands/convert.go +++ b/commands/convert.go @@ -45,7 +45,7 @@ var toJSONCmd = &cobra.Command{ Long: `toJSON converts all front matter in the content directory to use JSON for the front matter.`, RunE: func(cmd *cobra.Command, args []string) error { - return convertContents(rune([]byte(parser.JSON_LEAD)[0])) + return convertContents(rune([]byte(parser.JSONLead)[0])) }, } @@ -55,7 +55,7 @@ var toTOMLCmd = &cobra.Command{ Long: `toTOML converts all front matter in the content directory to use TOML for the front matter.`, RunE: func(cmd *cobra.Command, args []string) error { - return convertContents(rune([]byte(parser.TOML_LEAD)[0])) + return convertContents(rune([]byte(parser.TOMLLead)[0])) }, } @@ -65,7 +65,7 @@ var toYAMLCmd = &cobra.Command{ Long: `toYAML converts all front matter in the content directory to use YAML for the front matter.`, RunE: func(cmd *cobra.Command, args []string) error { - return convertContents(rune([]byte(parser.YAML_LEAD)[0])) + return convertContents(rune([]byte(parser.YAMLLead)[0])) }, } diff --git a/commands/undraft.go b/commands/undraft.go index 26ebdb2c1..c4bc2ffb0 100644 --- a/commands/undraft.go +++ b/commands/undraft.go @@ -121,15 +121,15 @@ L: // get the front matter as bytes and split it into lines var lineEnding []byte - fmLines := bytes.Split(fm, parser.UnixEnding) + fmLines := bytes.Split(fm, []byte("\n")) if len(fmLines) == 1 { // if the result is only 1 element, try to split on dos line endings - fmLines = bytes.Split(fm, parser.DosEnding) + fmLines = bytes.Split(fm, []byte("\r\n")) if len(fmLines) == 1 { return buff, fmt.Errorf("unable to split FrontMatter into lines") } - lineEnding = append(lineEnding, parser.DosEnding...) + lineEnding = append(lineEnding, []byte("\r\n")...) } else { - lineEnding = append(lineEnding, parser.UnixEnding...) + lineEnding = append(lineEnding, []byte("\n")...) } // Write the front matter lines to the buffer, replacing as necessary |