<commit_before>package changelog

import (
	"fmt"
	"time"

	"github.com/gorilla/feeds"
)

// ToFeed produces a github.com/gorilla/feeds.Feed that can be written to Atom or Rss
func ToFeed(link string, entries []Entry) (*feeds.Feed, error) {
	var newestEntryTime time.Time
	var oldestEntryTime time.Time

	for _, e := range entries {
		if e.Date.After(newestEntryTime) {
			newestEntryTime = e.Date
		}
		if e.Date.Before(oldestEntryTime) {
			oldestEntryTime = e.Date
		}
	}

	feed := &feeds.Feed{
		Title:       "",
		Link:        &feeds.Link{Href: link},
		Description: "generated by github.com/vbatts/sl-feeds",
		Created:     oldestEntryTime,
		Updated:     newestEntryTime,
	}
	feed.Items = make([]*feeds.Item, len(entries))
	for i, e := range entries {
		feed.Items[i] = &feeds.Item{
			Created:     e.Date,
			Link:        &feeds.Link{Href: fmt.Sprintf("%s/ChangeLog.txt#src=feeds&time=%d", link, e.Date.Unix())},
			Description: e.ToHTML(),
			Id:          fmt.Sprintf("%d", e.Date.Unix()),
		}

		updateWord := "updates"
		if len(e.Updates) == 1 {
			updateWord = "update"
		}<commit_msg>feed: Id needs to be an URL<commit_after>package changelog

import (
	"fmt"
	"time"

	"github.com/gorilla/feeds"
)

// ToFeed produces a github.com/gorilla/feeds.Feed that can be written to Atom or Rss
func ToFeed(link string, entries []Entry) (*feeds.Feed, error) {
	var newestEntryTime time.Time
	var oldestEntryTime time.Time

	for _, e := range entries {
		if e.Date.After(newestEntryTime) {
			newestEntryTime = e.Date
		}
		if e.Date.Before(oldestEntryTime) {
			oldestEntryTime = e.Date
		}
	}

	feed := &feeds.Feed{
		Title:       "",
		Link:        &feeds.Link{Href: link},
		Description: "generated by github.com/vbatts/sl-feeds",
		Created:     oldestEntryTime,
		Updated:     newestEntryTime,
	}
	feed.Items = make([]*feeds.Item, len(entries))
	for i, e := range entries {
		url := fmt.Sprintf("%s/ChangeLog.txt#src=feeds&time=%d", link, e.Date.Unix())
		feed.Items[i] = &feeds.Item{
			Created:     e.Date,
			Link:        &feeds.Link{Href: url},
			Description: e.ToHTML(),
			Id:          url,
		}

		updateWord := "updates"
		if len(e.Updates) == 1 {
			updateWord = "update"
		}
{'fraction_non_alphanumeric': 0.14872262773722628, 'fraction_numerical': 0.0009124087591240876, 'mean_word_length': 3.1692015209125475, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2925466', 'n_tokens_mistral': 887, 'n_tokens_neox': 820, 'n_words': 179}