mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-11-27 14:16:39 +00:00
bffc67d764
Bumps [github.com/gorilla/feeds](https://github.com/gorilla/feeds) from 1.1.1 to 1.1.2. - [Release notes](https://github.com/gorilla/feeds/releases) - [Commits](https://github.com/gorilla/feeds/compare/v1.1.1...v1.1.2) --- updated-dependencies: - dependency-name: github.com/gorilla/feeds dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
199 lines
6.6 KiB
Markdown
199 lines
6.6 KiB
Markdown
## gorilla/feeds
|
|
![testing](https://github.com/gorilla/feeds/actions/workflows/test.yml/badge.svg)
|
|
[![codecov](https://codecov.io/github/gorilla/feeds/branch/main/graph/badge.svg)](https://codecov.io/github/gorilla/feeds)
|
|
[![godoc](https://godoc.org/github.com/gorilla/feeds?status.svg)](https://godoc.org/github.com/gorilla/feeds)
|
|
[![sourcegraph](https://sourcegraph.com/github.com/gorilla/feeds/-/badge.svg)](https://sourcegraph.com/github.com/gorilla/feeds?badge)
|
|
|
|
![Gorilla Logo](https://github.com/gorilla/.github/assets/53367916/d92caabf-98e0-473e-bfbf-ab554ba435e5)
|
|
|
|
feeds is a web feed generator library for generating RSS, Atom and JSON feeds from Go
|
|
applications.
|
|
|
|
### Goals
|
|
|
|
* Provide a simple interface to create both Atom & RSS 2.0 feeds
|
|
* Full support for [Atom][atom], [RSS 2.0][rss], and [JSON Feed Version 1][jsonfeed] spec elements
|
|
* Ability to modify particulars for each spec
|
|
|
|
[atom]: https://tools.ietf.org/html/rfc4287
|
|
[rss]: http://www.rssboard.org/rss-specification
|
|
[jsonfeed]: https://jsonfeed.org/version/1.1
|
|
|
|
### Usage
|
|
|
|
```go
|
|
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
"time"
|
|
"github.com/gorilla/feeds"
|
|
)
|
|
|
|
func main() {
|
|
now := time.Now()
|
|
feed := &feeds.Feed{
|
|
Title: "jmoiron.net blog",
|
|
Link: &feeds.Link{Href: "http://jmoiron.net/blog"},
|
|
Description: "discussion about tech, footie, photos",
|
|
Author: &feeds.Author{Name: "Jason Moiron", Email: "jmoiron@jmoiron.net"},
|
|
Created: now,
|
|
}
|
|
|
|
feed.Items = []*feeds.Item{
|
|
&feeds.Item{
|
|
Title: "Limiting Concurrency in Go",
|
|
Link: &feeds.Link{Href: "http://jmoiron.net/blog/limiting-concurrency-in-go/"},
|
|
Description: "A discussion on controlled parallelism in golang",
|
|
Author: &feeds.Author{Name: "Jason Moiron", Email: "jmoiron@jmoiron.net"},
|
|
Created: now,
|
|
},
|
|
&feeds.Item{
|
|
Title: "Logic-less Template Redux",
|
|
Link: &feeds.Link{Href: "http://jmoiron.net/blog/logicless-template-redux/"},
|
|
Description: "More thoughts on logicless templates",
|
|
Created: now,
|
|
},
|
|
&feeds.Item{
|
|
Title: "Idiomatic Code Reuse in Go",
|
|
Link: &feeds.Link{Href: "http://jmoiron.net/blog/idiomatic-code-reuse-in-go/"},
|
|
Description: "How to use interfaces <em>effectively</em>",
|
|
Created: now,
|
|
},
|
|
}
|
|
|
|
atom, err := feed.ToAtom()
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
rss, err := feed.ToRss()
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
json, err := feed.ToJSON()
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
fmt.Println(atom, "\n", rss, "\n", json)
|
|
}
|
|
```
|
|
|
|
Outputs:
|
|
|
|
```xml
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
<feed xmlns="http://www.w3.org/2005/Atom">
|
|
<title>jmoiron.net blog</title>
|
|
<link href="http://jmoiron.net/blog"></link>
|
|
<id>http://jmoiron.net/blog</id>
|
|
<updated>2013-01-16T03:26:01-05:00</updated>
|
|
<summary>discussion about tech, footie, photos</summary>
|
|
<entry>
|
|
<title>Limiting Concurrency in Go</title>
|
|
<link href="http://jmoiron.net/blog/limiting-concurrency-in-go/"></link>
|
|
<updated>2013-01-16T03:26:01-05:00</updated>
|
|
<id>tag:jmoiron.net,2013-01-16:/blog/limiting-concurrency-in-go/</id>
|
|
<summary type="html">A discussion on controlled parallelism in golang</summary>
|
|
<author>
|
|
<name>Jason Moiron</name>
|
|
<email>jmoiron@jmoiron.net</email>
|
|
</author>
|
|
</entry>
|
|
<entry>
|
|
<title>Logic-less Template Redux</title>
|
|
<link href="http://jmoiron.net/blog/logicless-template-redux/"></link>
|
|
<updated>2013-01-16T03:26:01-05:00</updated>
|
|
<id>tag:jmoiron.net,2013-01-16:/blog/logicless-template-redux/</id>
|
|
<summary type="html">More thoughts on logicless templates</summary>
|
|
<author></author>
|
|
</entry>
|
|
<entry>
|
|
<title>Idiomatic Code Reuse in Go</title>
|
|
<link href="http://jmoiron.net/blog/idiomatic-code-reuse-in-go/"></link>
|
|
<updated>2013-01-16T03:26:01-05:00</updated>
|
|
<id>tag:jmoiron.net,2013-01-16:/blog/idiomatic-code-reuse-in-go/</id>
|
|
<summary type="html">How to use interfaces <em>effectively</em></summary>
|
|
<author></author>
|
|
</entry>
|
|
</feed>
|
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
<rss version="2.0">
|
|
<channel>
|
|
<title>jmoiron.net blog</title>
|
|
<link>http://jmoiron.net/blog</link>
|
|
<description>discussion about tech, footie, photos</description>
|
|
<managingEditor>jmoiron@jmoiron.net (Jason Moiron)</managingEditor>
|
|
<pubDate>2013-01-16T03:22:24-05:00</pubDate>
|
|
<item>
|
|
<title>Limiting Concurrency in Go</title>
|
|
<link>http://jmoiron.net/blog/limiting-concurrency-in-go/</link>
|
|
<description>A discussion on controlled parallelism in golang</description>
|
|
<pubDate>2013-01-16T03:22:24-05:00</pubDate>
|
|
</item>
|
|
<item>
|
|
<title>Logic-less Template Redux</title>
|
|
<link>http://jmoiron.net/blog/logicless-template-redux/</link>
|
|
<description>More thoughts on logicless templates</description>
|
|
<pubDate>2013-01-16T03:22:24-05:00</pubDate>
|
|
</item>
|
|
<item>
|
|
<title>Idiomatic Code Reuse in Go</title>
|
|
<link>http://jmoiron.net/blog/idiomatic-code-reuse-in-go/</link>
|
|
<description>How to use interfaces <em>effectively</em></description>
|
|
<pubDate>2013-01-16T03:22:24-05:00</pubDate>
|
|
</item>
|
|
</channel>
|
|
</rss>
|
|
|
|
{
|
|
"version": "https://jsonfeed.org/version/1.1",
|
|
"title": "jmoiron.net blog",
|
|
"home_page_url": "http://jmoiron.net/blog",
|
|
"description": "discussion about tech, footie, photos",
|
|
"author": {
|
|
"name": "Jason Moiron"
|
|
},
|
|
"authors": [
|
|
{
|
|
"name": "Jason Moiron"
|
|
}
|
|
],
|
|
"items": [
|
|
{
|
|
"id": "",
|
|
"url": "http://jmoiron.net/blog/limiting-concurrency-in-go/",
|
|
"title": "Limiting Concurrency in Go",
|
|
"summary": "A discussion on controlled parallelism in golang",
|
|
"date_published": "2013-01-16T03:22:24.530817846-05:00",
|
|
"author": {
|
|
"name": "Jason Moiron"
|
|
},
|
|
"authors": [
|
|
{
|
|
"name": "Jason Moiron"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "",
|
|
"url": "http://jmoiron.net/blog/logicless-template-redux/",
|
|
"title": "Logic-less Template Redux",
|
|
"summary": "More thoughts on logicless templates",
|
|
"date_published": "2013-01-16T03:22:24.530817846-05:00"
|
|
},
|
|
{
|
|
"id": "",
|
|
"url": "http://jmoiron.net/blog/idiomatic-code-reuse-in-go/",
|
|
"title": "Idiomatic Code Reuse in Go",
|
|
"summary": "How to use interfaces \u003cem\u003eeffectively\u003c/em\u003e",
|
|
"date_published": "2013-01-16T03:22:24.530817846-05:00"
|
|
}
|
|
]
|
|
}
|
|
```
|