public
Rubygem
Fork of jmhodges/rfeedparser
Description: rFeedParser is a translation of the Universal Feed Parser from Python into Ruby. It has nearly the exact same behavior.
Homepage: http://rfeedparser.rubyforge.org
Clone URL: git://github.com/technomancy/rfeedparser.git
fixed media title handling
technomancy (author)
Tue Jun 24 17:40:53 -0700 2008
commit  74e2ddced0a13fb179565751e2fbd9fd64025f12
tree    057bcfaed729e8372c0d2e4faaa2dc0731286205
parent  ed2330cacba5efea17f49e3e52c7057606ce5275
...
103
104
105
 
106
107
108
...
421
422
423
 
 
424
425
426
...
579
580
581
 
582
583
584
...
591
592
593
 
594
595
596
...
826
827
828
 
829
830
831
...
1053
1054
1055
1056
 
1057
1058
1059
1060
1061
 
1062
1063
1064
 
 
 
 
 
 
1065
1066
1067
...
1180
1181
1182
 
1183
1184
1185
...
103
104
105
106
107
108
109
...
422
423
424
425
426
427
428
429
...
582
583
584
585
586
587
588
...
595
596
597
598
599
600
601
...
831
832
833
834
835
836
837
...
1059
1060
1061
 
1062
1063
1064
1065
1066
1067
1068
1069
1070
 
1071
1072
1073
1074
1075
1076
1077
1078
1079
...
1192
1193
1194
1195
1196
1197
1198
0
@@ -103,6 +103,7 @@ module FeedParserMixin
0
     @langstack = []
0
     @baseuri = baseuri || ''
0
     @lang = baselang || nil
0
+ @has_title = false
0
     if baselang
0
       @feeddata['language'] = baselang.gsub('_','-')
0
     end
0
@@ -421,6 +422,8 @@ module FeedParserMixin
0
     # categories/tags/keywords/whatever are handled in _end_category
0
     return output if element == 'category'
0
 
0
+ return output if element == 'title' and @has_title
0
+
0
     # store output in appropriate place(s)
0
     if @inentry and not @insource
0
       if element == 'content'
0
@@ -579,6 +582,7 @@ module FeedParserMixin
0
 
0
   def _start_image(attrsD)
0
     @inimage = true
0
+ @has_title = false
0
     push('image', false)
0
     context = getContext()
0
     context['image'] ||= FeedParserDict.new
0
@@ -591,6 +595,7 @@ module FeedParserMixin
0
 
0
   def _start_textinput(attrsD)
0
     @intextinput = true
0
+ @has_title = false
0
     push('textinput', false)
0
     context = getContext()
0
     context['textinput'] ||= FeedParserDict.new
0
@@ -826,6 +831,7 @@ module FeedParserMixin
0
     @entries << FeedParserDict.new
0
     push('item', false)
0
     @inentry = true
0
+ @has_title = false
0
     @guidislink = false
0
     id = getAttribute(attrsD, 'rdf:about')
0
     if id and not id.empty?
0
@@ -1053,15 +1059,21 @@ module FeedParserMixin
0
 
0
   def _end_title
0
     value = popContent('title')
0
- context = getContext()
0
+ context = getContext
0
     if @intextinput
0
       context['textinput']['title'] = value
0
     elsif @inimage
0
       context['image']['title'] = value
0
     end
0
+ @has_title = true
0
   end
0
   alias :_end_dc_title :_end_title
0
- alias :_end_media_title :_end_title
0
+
0
+ def _end_media_title
0
+ orig_has_title = @has_title
0
+ _end_title
0
+ @has_title = orig_has_title
0
+ end
0
 
0
   def _start_description(attrsD)
0
     context = getContext()
0
@@ -1180,6 +1192,7 @@ module FeedParserMixin
0
 
0
   def _start_source(attrsD)
0
     @insource = true
0
+ @has_title = false
0
   end
0
 
0
   def _end_source

Comments

    No one has commented yet.