From b14d92205c58e653d236c3b1031320aab8cf4280 Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Mon, 9 Dec 2024 11:58:23 -0500 Subject: [PATCH] Rename a bunch of internal things from frontmatter to meta --- meta.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/meta.go b/meta.go index 8a1dfa3..47934af 100644 --- a/meta.go +++ b/meta.go @@ -2,7 +2,7 @@ package step import "strings" -const frontMatterRule = "---" +const metaRule = "---" // Meta represents optional metadata that can occur at the very start of // a document. @@ -18,25 +18,25 @@ func SplitMeta (input string) (Meta, string, error) { // by line instead of operating directly on the string. have that call // yet another function which will solve #11 - // stop if there is no front matter - if !strings.HasPrefix(input, frontMatterRule + "\n") { + // stop if there is no metadata + if !strings.HasPrefix(input, metaRule + "\n") { return Meta { }, input, nil } - // get the start and the end of the front matter - input = strings.TrimPrefix(input, frontMatterRule) - index := strings.Index(input, "\n" + frontMatterRule + "\n") + // get the start and the end of the metadata + input = strings.TrimPrefix(input, metaRule) + index := strings.Index(input, "\n" + metaRule + "\n") if index < 0 { return nil, "", ErrMetaNeverClosed } - frontMatterRaw := input[:index] - body := input[index + len(frontMatterRule) + 2:] + metaStr := input[:index] + bodyStr := input[index + len(metaRule) + 2:] - // parse meta - meta, err := ParseMeta(frontMatterRaw) + // parse metadata + meta, err := ParseMeta(metaStr) if err != nil { return Meta { }, "", err } - return meta, body, nil + return meta, bodyStr, nil } // ParseMeta parses isolated metadata (without the horizontal starting and