beebo
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

rss: eliminate content

j3s.sh 83621650 7d29f474

verified
-67
-6
rss/atom.go
··· 44 44 next := new(Item) 45 45 next.Title = item.Title 46 46 next.Summary = item.Summary 47 - next.Content = item.Content.RAWContent 48 47 if item.Date != "" { 49 48 next.Date, err = parseTime(item.Date) 50 49 if err == nil { ··· 95 94 return out, nil 96 95 } 97 96 98 - type RAWContent struct { 99 - RAWContent string `xml:",innerxml"` 100 - } 101 - 102 97 type atomFeed struct { 103 98 XMLName xml.Name `xml:"feed"` 104 99 Title string `xml:"title"` ··· 113 108 XMLName xml.Name `xml:"entry"` 114 109 Title string `xml:"title"` 115 110 Summary string `xml:"summary"` 116 - Content RAWContent `xml:"content"` 117 111 Links []atomLink `xml:"link"` 118 112 Date string `xml:"updated"` 119 113 DateValid bool
-30
rss/atom_test.go
··· 30 30 } 31 31 } 32 32 } 33 - 34 - func TestParseAtomContent(t *testing.T) { 35 - tests := map[string]string{ 36 - "atom_1.0": "Volltext des Weblog-Eintrags", 37 - "atom_1.0_enclosure": "Volltext des Weblog-Eintrags", 38 - "atom_1.0-1": "", 39 - "atom_1.0_html": "<body>html</body>", 40 - } 41 - 42 - for test, want := range tests { 43 - name := filepath.Join("testdata", test) 44 - data, err := ioutil.ReadFile(name) 45 - if err != nil { 46 - t.Fatalf("Reading %s: %v", name, err) 47 - } 48 - 49 - feed, err := Parse(data) 50 - if err != nil { 51 - t.Fatalf("Parsing %s: %v", name, err) 52 - } 53 - 54 - if feed.Items[0].Content != want { 55 - t.Errorf("%s: got %q, want %q", name, feed.Items[0].Content, want) 56 - } 57 - 58 - if !feed.Items[0].DateValid { 59 - t.Errorf("%s: Invalid date: %q", name, feed.Items[0].Date) 60 - } 61 - } 62 - }
-1
rss/doc.go
··· 46 46 type Item struct { 47 47 Title string 48 48 Summary string 49 - Content string 50 49 Link string 51 50 Date time.Time 52 51 DateValid bool
-3
rss/rss.go
··· 225 225 type Item struct { 226 226 Title string `json:"title"` 227 227 Summary string `json:"summary"` 228 - Content string `json:"content"` 229 228 Categories []string `json:"category"` 230 229 Link string `json:"link"` 231 230 Date time.Time `json:"date"` ··· 255 254 fmt.Fprintf(w, "\xff%s\xffDate:\t%s\n", double, i.Date.Format(DATE)) 256 255 fmt.Fprintf(w, "\xff%s\xffID:\t%s\n", double, i.ID) 257 256 fmt.Fprintf(w, "\xff%s\xffRead:\t%v\n", double, i.Read) 258 - fmt.Fprintf(w, "\xff%s\xffContent:\t%q\n", double, i.Content) 259 257 fmt.Fprintf(w, "\xff%s\xff}\n", single) 260 258 w.Flush() 261 259 } else { ··· 265 263 fmt.Fprintf(w, "%s%s\n", double, i.Date.Format(DATE)) 266 264 fmt.Fprintf(w, "%s%q\n", double, i.ID) 267 265 fmt.Fprintf(w, "%sRead: %v\n", double, i.Read) 268 - fmt.Fprintf(w, "%s%q\n", double, i.Content) 269 266 } 270 267 return buf.String() 271 268 }
-2
rss/rss_1.0.go
··· 83 83 next := new(Item) 84 84 next.Title = item.Title 85 85 next.Summary = item.Description 86 - next.Content = item.Content 87 86 next.Link = item.Link 88 87 if item.Date != "" { 89 88 next.Date, err = parseTime(item.Date) ··· 138 137 XMLName xml.Name `xml:"item"` 139 138 Title string `xml:"title"` 140 139 Description string `xml:"description"` 141 - Content string `xml:"encoded"` 142 140 Link string `xml:"link"` 143 141 PubDate string `xml:"pubDate"` 144 142 Date string `xml:"date"`
-2
rss/rss_2.0.go
··· 91 91 next := new(Item) 92 92 next.Title = item.Title 93 93 next.Summary = item.Description 94 - next.Content = item.Content 95 94 next.Categories = item.Categories 96 95 next.Link = item.Link 97 96 next.Image = item.Image.Image() ··· 179 178 XMLName xml.Name `xml:"item"` 180 179 Title string `xml:"title"` 181 180 Description string `xml:"description"` 182 - Content string `xml:"encoded"` 183 181 Categories rss2_0Categories `xml:"category"` 184 182 Link string `xml:"link"` 185 183 PubDate string `xml:"pubDate"`
-23
rss/rss_2.0_test.go
··· 34 34 } 35 35 } 36 36 37 - func TestParseContent(t *testing.T) { 38 - tests := map[string]string{ 39 - "rss_2.0_content_encoded": "<p><a href=\"https://example.com/\">Example.com</a> is an example site.</p>", 40 - } 41 - 42 - for test, want := range tests { 43 - name := filepath.Join("testdata", test) 44 - data, err := ioutil.ReadFile(name) 45 - if err != nil { 46 - t.Fatalf("Reading %s: %v", name, err) 47 - } 48 - 49 - feed, err := Parse(data) 50 - if err != nil { 51 - t.Fatalf("Parsing %s: %v", name, err) 52 - } 53 - 54 - if feed.Items[0].Content != want { 55 - t.Errorf("%s: got %s, want %s", name, feed.Items[0].Content, want) 56 - } 57 - } 58 - } 59 - 60 37 func TestParseItemDateOK(t *testing.T) { 61 38 tests := map[string]string{ 62 39 "rss_2.0": "2009-09-06 16:45:00 +0000 UTC",