Module: Wrongdoc::NewsAtom
Instance Method Summary collapse
-
#news_atom ⇒ Object
generates an Atom feed based on git tags in the document directory.
Methods included from Readme
#readme_description, #readme_metadata
Methods included from History
#initialize_history, #old_summaries, #tag_uri, #tags
Instance Method Details
#news_atom ⇒ Object
generates an Atom feed based on git tags in the document directory
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/wrongdoc/news_atom.rb', line 6 def news_atom project_name, short_desc, _ = = [0,10] atom_uri = @rdoc_uri.dup atom_uri.path += "NEWS.atom.xml" news_uri = @rdoc_uri.dup news_uri.path += "NEWS.html" doc = Nokogiri::XML::Builder.new { feed :xmlns => "http://www.w3.org/2005/Atom" do id! atom_uri.to_s title "#{project_name} news" subtitle short_desc link! :rel => 'alternate', :type => 'text/html', :href => news_uri.to_s updated .empty? ? '1970-01-01:00:00:00Z' : [0][:time] .each do |tag| entry { title tag[:subject] updated tag[:time] published tag[:time] { name tag[:tagger_name] email tag[:tagger_email] } uri = tag_uri(tag[:tag]).to_s link! :rel => "alternate", :type => "text/html", :href => uri id! uri = tag[:body].split(/\n.+\(\d+\):\n {6}/s)[0].strip content({:type =>:text}, ) content(:type =>:xhtml) { pre tag[:body] } } end end } fpath = "doc/NEWS.atom.xml" File.open(fpath, "w") { |fp| fp.write doc.to_xml(:indent => 0) } unless .empty? time = [0][:ruby_time] File.utime(time, time, fpath) end end |