Skip to content

Commit

Permalink
Prepare for pages-order: option
Browse files Browse the repository at this point in the history
  • Loading branch information
glejeune committed Apr 26, 2010
1 parent dfafd67 commit 4c9fb9e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.rdoc
Expand Up @@ -39,7 +39,7 @@ Here is the list of options :
* <tt>source:</tt> <tt>String</tt> : Information about the source of the book.
* <tt>coverage:</tt> <tt>String</tt> : Provides information on the spatial and/or time relevance of the book.
* <tt>cover-image:</tt> <tt>String</tt> : The image to use for the cover of the book (i use a 540 × 648 pixels image)
* <tt>pages:</tt> <tt>[page | post]</tt> : A list of pages and/or posts you want to order at the begenning of the book.
* <tt>pages-order:</tt> <tt>[page | post]</tt> : A list of pages and/or posts you want to order at the begenning of the book. If you don't specify any order, Jekyll-epub will generate the book with the posts first (from the older to the newer), then the pages.

=== Layout

Expand Down
15 changes: 14 additions & 1 deletion lib/jekyll/epub.rb
Expand Up @@ -15,6 +15,17 @@ def url #:nodoc:
end

class Site #:nodoc:

attr_accessor :all

def get_all_pages_order
if self.config["epub"]["pages-order"]
pages + posts
else
posts + pages
end
end

# This is a Jekyll[http://jekyllrb.com] extension
#
# Same as Site::process but generate the epub.
Expand Down Expand Up @@ -48,6 +59,8 @@ def epub #:nodoc:
# Generate the specifics epub files : content.opf, toc.ncx, mimetype,
# page-template.xpgt and META-INF/container.xml
def package_epub #:nodoc:
@all = get_all_pages_order

files = []
order = 0

Expand All @@ -59,7 +72,7 @@ def package_epub #:nodoc:
}
end

(posts + pages + static_files).each do |p|
(all + static_files).each do |p|
url = p.url.gsub( /^\//, "" )
next if url == self.config["epub"]["cover-image"]
mime = MIME::Types.type_for( url ).to_s
Expand Down

0 comments on commit 4c9fb9e

Please sign in to comment.