Skip to content

Commit

Permalink
Merge pull request #97 from emmanuelbernard/atomizer-93-94-95
Browse files Browse the repository at this point in the history
Atomizer improvements #93 #94 #95
  • Loading branch information
tcurdt committed Apr 14, 2012
2 parents 4eaefd5 + 4b5aabe commit be53f57
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 4 additions & 1 deletion lib/awestruct/extensions/atomizer.rb
Expand Up @@ -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)
Expand All @@ -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

Expand Down
7 changes: 4 additions & 3 deletions lib/awestruct/extensions/template.atom.haml
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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.