jekyll-epub 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
data/jekyll-epub.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{jekyll-epub}
8
- s.version = "0.0.1"
8
+ s.version = "0.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Gregoire Lejeune"]
12
- s.date = %q{2010-04-27}
12
+ s.date = %q{2010-05-02}
13
13
  s.default_executable = %q{jekyll_epub}
14
14
  s.description = %q{Create an eBook (epub) of your Jekyll blog}
15
15
  s.email = %q{gregoire.lejeune@free.fr}
data/lib/jekyll/epub.rb CHANGED
@@ -17,12 +17,48 @@ module Jekyll
17
17
  class Site #:nodoc:
18
18
  def all
19
19
  if self.config["epub"]["pages-order"]
20
- pages + posts
20
+ self.create_order( pages.clone, posts.clone, self.config["epub"]["pages-order"], :url )
21
21
  else
22
22
  posts + pages
23
23
  end
24
24
  end
25
25
 
26
+ def get_item( item, method, posts, pages ) #:nodoc:
27
+ _out = []
28
+
29
+ posts.each do |p|
30
+ if p.send(method).gsub( /^\//, "" ) == item
31
+ _out << posts.delete(p)
32
+ end
33
+ end
34
+
35
+ pages.each do |p|
36
+ if p.send(method).gsub( /^\//, "" ) == item
37
+ _out << pages.delete(p)
38
+ end
39
+ end
40
+
41
+ return _out, posts, pages
42
+ end
43
+
44
+ def create_order( pages, posts, order, method ) #:nodoc:
45
+ _result = []
46
+ _order = {}
47
+ order.each do |item|
48
+ if item.class == Symbol
49
+ _order[item] = eval(item.to_s)
50
+ else
51
+ _order[item], posts, pages = get_item( item, method, posts, pages )
52
+ end
53
+ end
54
+
55
+ order.each do |item|
56
+ _result = _result + _order[item]
57
+ end
58
+
59
+ return _result
60
+ end
61
+
26
62
  # This is a Jekyll[http://jekyllrb.com] extension
27
63
  #
28
64
  # Same as Site::process but generate the epub.
@@ -18,7 +18,7 @@ module Jekyll
18
18
  end
19
19
 
20
20
  def epub( key, value )
21
- @_epub["epub"][key.to_s] = value
21
+ @_epub[key.to_s] = value
22
22
  end
23
23
 
24
24
  def web( key, value )
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 1
9
- version: 0.0.1
8
+ - 2
9
+ version: 0.0.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Gregoire Lejeune
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-27 00:00:00 +02:00
17
+ date: 2010-05-02 00:00:00 +02:00
18
18
  default_executable: jekyll_epub
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency