File tree 7 files changed +52
-2
lines changed
7 files changed +52
-2
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ type Item struct {
59
59
DublinCoreExt * ext.DublinCoreExtension `json:"dcExt,omitempty"`
60
60
ITunesExt * ext.ITunesItemExtension `json:"itunesExt,omitempty"`
61
61
Extensions ext.Extensions `json:"extensions,omitempty"`
62
+ Custom map [string ]string `json:"custom,omitempty"`
62
63
}
63
64
64
65
// Image is an image that represents the feed
Original file line number Diff line number Diff line change @@ -415,8 +415,14 @@ func (rp *Parser) parseItem(p *xpp.XMLPullParser) (item *Item, err error) {
415
415
}
416
416
categories = append (categories , result )
417
417
} else {
418
- // Skip any elements not part of the item spec
419
- p .Skip ()
418
+ result , err := shared .ParseText (p )
419
+ if err != nil {
420
+ continue
421
+ }
422
+ if item .Custom == nil {
423
+ item .Custom = make (map [string ]string , 0 )
424
+ }
425
+ item .Custom [name ] = result
420
426
}
421
427
}
422
428
}
Original file line number Diff line number Diff line change
1
+ {
2
+ "items" : [
3
+ {
4
+ "custom" : {
5
+ "apcategory" : " s" ,
6
+ "test" : " test"
7
+ }
8
+ }
9
+ ],
10
+ "version" : " 2.0"
11
+ }
Original file line number Diff line number Diff line change
1
+ <!--
2
+ Description: rss item categories
3
+ -->
4
+ <rss version =" 2.0" >
5
+ <channel >
6
+ <item >
7
+ <apcategory >s</apcategory >
8
+ <test >test</test >
9
+ </item >
10
+ </channel >
11
+ </rss >
Original file line number Diff line number Diff line change
1
+ {
2
+ "items" : [
3
+ {
4
+ "custom" : {
5
+ "apcategory" : " s" ,
6
+ "test" : " test"
7
+ }
8
+ }
9
+ ],
10
+ "feedType" : " rss" ,
11
+ "feedVersion" : " 2.0"
12
+ }
Original file line number Diff line number Diff line change
1
+ <rss version =" 2.0" >
2
+ <channel >
3
+ <item >
4
+ <test >test</test >
5
+ <apcategory >s</apcategory >
6
+ </item >
7
+ </channel >
8
+ </rss >
Original file line number Diff line number Diff line change @@ -78,6 +78,7 @@ func (t *DefaultRSSTranslator) translateFeedItem(rssItem *rss.Item) (item *Item)
78
78
item .DublinCoreExt = rssItem .DublinCoreExt
79
79
item .ITunesExt = rssItem .ITunesExt
80
80
item .Extensions = rssItem .Extensions
81
+ item .Custom = rssItem .Custom
81
82
return
82
83
}
83
84
You can’t perform that action at this time.
0 commit comments