File tree Expand file tree Collapse file tree 7 files changed +52
-2
lines changed
Expand file tree Collapse file tree 7 files changed +52
-2
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ type Item struct {
5959 DublinCoreExt * ext.DublinCoreExtension `json:"dcExt,omitempty"`
6060 ITunesExt * ext.ITunesItemExtension `json:"itunesExt,omitempty"`
6161 Extensions ext.Extensions `json:"extensions,omitempty"`
62+ Custom map [string ]string `json:"custom,omitempty"`
6263}
6364
6465// 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) {
415415 }
416416 categories = append (categories , result )
417417 } 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
420426 }
421427 }
422428 }
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)
7878 item .DublinCoreExt = rssItem .DublinCoreExt
7979 item .ITunesExt = rssItem .ITunesExt
8080 item .Extensions = rssItem .Extensions
81+ item .Custom = rssItem .Custom
8182 return
8283}
8384
You can’t perform that action at this time.
0 commit comments