rss: eliminate content
Jes Olson j3s@c3f.net
Thu, 22 Jun 2023 21:31:41 -0500
7 files changed,
0 insertions(+),
67 deletions(-)
M
rss/atom.go
→
rss/atom.go
@@ -44,7 +44,6 @@
next := new(Item) next.Title = item.Title next.Summary = item.Summary - next.Content = item.Content.RAWContent if item.Date != "" { next.Date, err = parseTime(item.Date) if err == nil {@@ -95,10 +94,6 @@
return out, nil } -type RAWContent struct { - RAWContent string `xml:",innerxml"` -} - type atomFeed struct { XMLName xml.Name `xml:"feed"` Title string `xml:"title"`@@ -113,7 +108,6 @@ type atomItem struct {
XMLName xml.Name `xml:"entry"` Title string `xml:"title"` Summary string `xml:"summary"` - Content RAWContent `xml:"content"` Links []atomLink `xml:"link"` Date string `xml:"updated"` DateValid bool
M
rss/atom_test.go
→
rss/atom_test.go
@@ -30,33 +30,3 @@ t.Errorf("%s: got %q, want %q", name, feed.Title, want)
} } } - -func TestParseAtomContent(t *testing.T) { - tests := map[string]string{ - "atom_1.0": "Volltext des Weblog-Eintrags", - "atom_1.0_enclosure": "Volltext des Weblog-Eintrags", - "atom_1.0-1": "", - "atom_1.0_html": "<body>html</body>", - } - - for test, want := range tests { - name := filepath.Join("testdata", test) - data, err := ioutil.ReadFile(name) - if err != nil { - t.Fatalf("Reading %s: %v", name, err) - } - - feed, err := Parse(data) - if err != nil { - t.Fatalf("Parsing %s: %v", name, err) - } - - if feed.Items[0].Content != want { - t.Errorf("%s: got %q, want %q", name, feed.Items[0].Content, want) - } - - if !feed.Items[0].DateValid { - t.Errorf("%s: Invalid date: %q", name, feed.Items[0].Date) - } - } -}
M
rss/doc.go
→
rss/doc.go
@@ -46,7 +46,6 @@
type Item struct { Title string Summary string - Content string Link string Date time.Time DateValid bool
M
rss/rss.go
→
rss/rss.go
@@ -225,7 +225,6 @@ // Item represents a single story.
type Item struct { Title string `json:"title"` Summary string `json:"summary"` - Content string `json:"content"` Categories []string `json:"category"` Link string `json:"link"` Date time.Time `json:"date"`@@ -255,7 +254,6 @@ fmt.Fprintf(w, "\xff%s\xffLink:\t%s\n", double, i.Link)
fmt.Fprintf(w, "\xff%s\xffDate:\t%s\n", double, i.Date.Format(DATE)) fmt.Fprintf(w, "\xff%s\xffID:\t%s\n", double, i.ID) fmt.Fprintf(w, "\xff%s\xffRead:\t%v\n", double, i.Read) - fmt.Fprintf(w, "\xff%s\xffContent:\t%q\n", double, i.Content) fmt.Fprintf(w, "\xff%s\xff}\n", single) w.Flush() } else {@@ -265,7 +263,6 @@ fmt.Fprintf(w, "%s%q\n", double, i.Link)
fmt.Fprintf(w, "%s%s\n", double, i.Date.Format(DATE)) fmt.Fprintf(w, "%s%q\n", double, i.ID) fmt.Fprintf(w, "%sRead: %v\n", double, i.Read) - fmt.Fprintf(w, "%s%q\n", double, i.Content) } return buf.String() }
M
rss/rss_1.0.go
→
rss/rss_1.0.go
@@ -83,7 +83,6 @@
next := new(Item) next.Title = item.Title next.Summary = item.Description - next.Content = item.Content next.Link = item.Link if item.Date != "" { next.Date, err = parseTime(item.Date)@@ -138,7 +137,6 @@ type rss1_0Item struct {
XMLName xml.Name `xml:"item"` Title string `xml:"title"` Description string `xml:"description"` - Content string `xml:"encoded"` Link string `xml:"link"` PubDate string `xml:"pubDate"` Date string `xml:"date"`
M
rss/rss_2.0.go
→
rss/rss_2.0.go
@@ -91,7 +91,6 @@
next := new(Item) next.Title = item.Title next.Summary = item.Description - next.Content = item.Content next.Categories = item.Categories next.Link = item.Link next.Image = item.Image.Image()@@ -179,7 +178,6 @@ type rss2_0Item struct {
XMLName xml.Name `xml:"item"` Title string `xml:"title"` Description string `xml:"description"` - Content string `xml:"encoded"` Categories rss2_0Categories `xml:"category"` Link string `xml:"link"` PubDate string `xml:"pubDate"`
M
rss/rss_2.0_test.go
→
rss/rss_2.0_test.go
@@ -34,29 +34,6 @@ }
} } -func TestParseContent(t *testing.T) { - tests := map[string]string{ - "rss_2.0_content_encoded": "<p><a href=\"https://example.com/\">Example.com</a> is an example site.</p>", - } - - for test, want := range tests { - name := filepath.Join("testdata", test) - data, err := ioutil.ReadFile(name) - if err != nil { - t.Fatalf("Reading %s: %v", name, err) - } - - feed, err := Parse(data) - if err != nil { - t.Fatalf("Parsing %s: %v", name, err) - } - - if feed.Items[0].Content != want { - t.Errorf("%s: got %s, want %s", name, feed.Items[0].Content, want) - } - } -} - func TestParseItemDateOK(t *testing.T) { tests := map[string]string{ "rss_2.0": "2009-09-06 16:45:00 +0000 UTC",