mirror of
https://codeberg.org/librarian/feeds
synced 2024-12-06 19:16:24 +01:00
use Content by default in atom instead of Summary (via Description), change content to a struct and set Type to html
This commit is contained in:
@@ -18,8 +18,15 @@ type AtomPerson struct {
|
||||
}
|
||||
|
||||
type AtomSummary struct {
|
||||
Content string `xml:",chardata"`
|
||||
Type string `xml:"type,attr"`
|
||||
XMLName xml.Name `xml:"summary"`
|
||||
Content string `xml:",chardata"`
|
||||
Type string `xml:"type,attr"`
|
||||
}
|
||||
|
||||
type AtomContent struct {
|
||||
XMLName xml.Name `xml:"content"`
|
||||
Content string `xml:",chardata"`
|
||||
Type string `xml:"type,attr"`
|
||||
}
|
||||
|
||||
type AtomAuthor struct {
|
||||
@@ -38,10 +45,10 @@ type AtomEntry struct {
|
||||
Updated string `xml:"updated"` // required
|
||||
Id string `xml:"id"` // required
|
||||
Category string `xml:"category,omitempty"`
|
||||
Content string `xml:"content,omitempty"`
|
||||
Rights string `xml:"rights,omitempty"`
|
||||
Source string `xml:"source,omitempty"`
|
||||
Published string `xml:"published,omitempty"`
|
||||
Content *AtomContent
|
||||
Rights string `xml:"rights,omitempty"`
|
||||
Source string `xml:"source,omitempty"`
|
||||
Published string `xml:"published,omitempty"`
|
||||
Contributor *AtomContributor
|
||||
Link *AtomLink // required if no child 'content' elements
|
||||
Summary *AtomSummary // required if content has src or content is base64
|
||||
@@ -78,7 +85,7 @@ type Atom struct {
|
||||
func newAtomEntry(i *Item) *AtomEntry {
|
||||
id := i.Id
|
||||
// assume the description is html
|
||||
s := &AtomSummary{i.Description, "html"}
|
||||
c := &AtomContent{Content: i.Description, Type: "html"}
|
||||
|
||||
if len(id) == 0 {
|
||||
// if there's no id set, try to create one, either from data or just a uuid
|
||||
@@ -101,7 +108,7 @@ func newAtomEntry(i *Item) *AtomEntry {
|
||||
x := &AtomEntry{
|
||||
Title: i.Title,
|
||||
Link: &AtomLink{Href: i.Link.Href, Rel: i.Link.Rel},
|
||||
Summary: s,
|
||||
Content: c,
|
||||
Id: id,
|
||||
Updated: anyTimeFormat(time.RFC3339, i.Updated, i.Created),
|
||||
}
|
||||
|
||||
+3
-3
@@ -21,8 +21,8 @@ var atomOutput = `<?xml version="1.0" encoding="UTF-8"?>
|
||||
<title>Limiting Concurrency in Go</title>
|
||||
<updated>2013-01-16T21:52:35-05:00</updated>
|
||||
<id>tag:jmoiron.net,2013-01-16:/blog/limiting-concurrency-in-go/</id>
|
||||
<content type="html">A discussion on controlled parallelism in golang</content>
|
||||
<link href="http://jmoiron.net/blog/limiting-concurrency-in-go/"></link>
|
||||
<Summary type="html">A discussion on controlled parallelism in golang</Summary>
|
||||
<author>
|
||||
<name>Jason Moiron</name>
|
||||
<email>jmoiron@jmoiron.net</email>
|
||||
@@ -32,15 +32,15 @@ var atomOutput = `<?xml version="1.0" encoding="UTF-8"?>
|
||||
<title>Logic-less Template Redux</title>
|
||||
<updated>2013-01-16T21:52:35-05:00</updated>
|
||||
<id>tag:jmoiron.net,2013-01-16:/blog/logicless-template-redux/</id>
|
||||
<content type="html">More thoughts on logicless templates</content>
|
||||
<link href="http://jmoiron.net/blog/logicless-template-redux/"></link>
|
||||
<Summary type="html">More thoughts on logicless templates</Summary>
|
||||
</entry>
|
||||
<entry>
|
||||
<title>Idiomatic Code Reuse in Go</title>
|
||||
<updated>2013-01-16T21:52:35-05:00</updated>
|
||||
<id>tag:jmoiron.net,2013-01-16:/blog/idiomatic-code-reuse-in-go/</id>
|
||||
<content type="html">How to use interfaces <em>effectively</em></content>
|
||||
<link href="http://jmoiron.net/blog/idiomatic-code-reuse-in-go/"></link>
|
||||
<Summary type="html">How to use interfaces <em>effectively</em></Summary>
|
||||
</entry>
|
||||
</feed>`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user