diff options
| author | Paul Buetow <paul@buetow.org> | 2024-12-11 22:56:42 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2024-12-11 22:56:42 +0200 |
| commit | 0f5ecb2715876d05bed8e54d7bd30754e57bcdc4 (patch) | |
| tree | f37eda9bfb4cff298a0446e06948d26952735542 /internal | |
| parent | 1dca76e728a70b70ee8001c87407acf962e731cd (diff) | |
fix flaky test
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/tags/inline.go | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/internal/tags/inline.go b/internal/tags/inline.go index ee07f70..96b9684 100644 --- a/internal/tags/inline.go +++ b/internal/tags/inline.go @@ -59,23 +59,26 @@ func inlineExtractTagsFromContent(content string) ([]string, string, error) { } parts := strings.Split(content, " ") // First word must contain certain symbols to clarify as (inline) tags. - if inlineTagRE.MatchString(parts[0]) { - var tags []string - // String separator either a dot or a comma. Each element will be a tag. - for _, elem := range strings.Split(parts[0], ".") { - tags = append(tags, strings.Split(elem, ",")...) - } - if len(tags) > 0 { - for i := range len(tags) { - if isShare(tags[i]) { - var err error - if tags[i], err = platforms.ExpandAliases(tags[i]); err != nil { - return []string{}, content, err - } + if !inlineTagRE.MatchString(parts[0]) { + return []string{}, content, nil + } + + var tags []string + // String separator either a dot or a comma. Each element will be a tag. + for _, elem := range strings.Split(parts[0], ".") { + tags = append(tags, strings.Split(elem, ",")...) + } + if len(tags) > 0 { + for i := range len(tags) { + if isShare(tags[i]) { + var err error + if tags[i], err = platforms.ExpandAliases(tags[i]); err != nil { + return []string{}, content, err } } - return tags, strings.Join(parts[1:], " "), nil } + return tags, strings.Join(parts[1:], " "), nil } + return []string{}, content, nil } |
