diff --git a/main.go b/main.go index 12a4270..76e7695 100644 --- a/main.go +++ b/main.go @@ -55,6 +55,8 @@ func injectStories(table Table, path string, heisigIndex int) error { return err } + seenStories := make(map[string]bool) + for i, row := range table { for _, character := range characters { if character.Character != row[heisigIndex] { @@ -63,8 +65,13 @@ func injectStories(table Table, path string, heisigIndex int) error { var stories strings.Builder for _, story := range character.Stories { - content := strings.ReplaceAll(story.Content, "\n", " ") - stories.WriteString(wrapSpan(content, "rtk-story")) + storyNoBreaks := strings.ReplaceAll(story.Content, "\n", " ") + if seen, _ := seenStories[storyNoBreaks]; seen { + continue + } else { + stories.WriteString(wrapSpan(storyNoBreaks, "rtk-story")) + seenStories[storyNoBreaks] = true + } } row = append(row, stories.String())