Permalink
Browse files

Merge pull request #97 from emmanuelbernard/atomizer-93-94-95

Atomizer improvements #93 #94 #95
  • Loading branch information...
2 parents 4eaefd5 + 4b5aabe commit be53f5786e1ce64b7821ac7d683aa2db473fa6f7 @tcurdt tcurdt committed Apr 14, 2012
Showing with 8 additions and 4 deletions.
  1. +4 −1 lib/awestruct/extensions/atomizer.rb
  2. +4 −3 lib/awestruct/extensions/template.atom.haml
@@ -6,6 +6,8 @@ def initialize(entries_name, output_path, opts={})
@entries_name = entries_name
@output_path = output_path
@num_entries = opts[:num_entries] || 50
+ @content_url = opts[:content_url]
+ @feed_title = opts[:feed_title]
end
def execute(site)
@@ -32,7 +34,8 @@ def execute(site)
page.date = page.timestamp unless page.timestamp.nil?
page.output_path = @output_path
page.entries = atom_pages
- page.title = site.title || site.base_url
+ page.title = @feed_title || site.title || site.base_url
+ page.content_url = @content_url || site.base_url
site.pages << page
end
@@ -3,7 +3,7 @@
!!! XML
%feed{ 'xml:lang'=>'en-US', :xmlns=>'http://www.w3.org/2005/Atom' }
- %id= "#{site.base_url}/"
+ %id= "#{page.content_url}/"
%title= escape_once( page.title )
- if ( defined?( site.author ) )
%author
@@ -16,12 +16,13 @@
- unless page.entries.empty?
%updated= page.entries.first.date.xmlschema
%link{:rel=>"self", :type=>"application/atom+xml", :href=>"#{site.base_url}#{page.url}" }
- %link{:rel=>"alternate", :type=>"text/html", :href=>"#{site.base_url}/" }
+ %link{:rel=>"alternate", :type=>"text/html", :href=>"#{page.content_url}/" }
- for entry in page.entries
%entry
%id #{site.base_url}#{entry.url}
%title= escape_once( entry.title )
%updated= entry.date.xmlschema
+ %published= entry.date.xmlschema
%link{:rel=>"alternate", :type=>"text/html", :href=>"#{site.base_url}#{entry.url}" }
- if ( defined?( entry.author ) )
%author
@@ -32,7 +33,7 @@
- else
%name= entry.author
%summary
- #{summarize( html_to_text( entry.content ), 100 )}...
+ #{summarize( html_to_text( entry.content ), 100 )}
%content{:type=>'html'}
= clean_html( html_escape( fully_qualify_urls( site.base_url, find_and_preserve( entry.content ) ) ) )

0 comments on commit be53f57

Please sign in to comment.