11"" "
2- jekyll-multisite Sumit Khanna - http://penguindreams.org
2+ jekyll-multisite Sumit Khanna - http://penguindreams.org
33
44 ---
55
@@ -29,7 +29,7 @@ module Jekyll
2929
3030 class << self
3131 def sanitized_path ( base_directory , questionable_path )
32-
32+
3333 if base_directory . eql? ( questionable_path )
3434 base_directory
3535 elsif questionable_path . start_with? ( base_directory )
@@ -41,7 +41,7 @@ def sanitized_path(base_directory, questionable_path)
4141 else
4242 File . join ( base_directory , questionable_path )
4343 end
44-
44+
4545 end
4646 end
4747
@@ -57,47 +57,47 @@ def parent_dirs(file)
5757 end
5858 end
5959 end
60-
60+
6161 # Shared source reader
6262
6363 class Reader
6464
6565 def read
6666 @site . layouts = LayoutReader . new ( site ) . read
6767 read_directories
68-
68+
6969 if @site . config [ 'shared_dir' ]
7070 read_directories File . join ( '..' , @site . config [ 'shared_dir' ] )
7171 end
72-
72+
7373 sort_files!
7474 @site . data = DataReader . new ( site ) . read ( site . config [ 'data_dir' ] )
7575 CollectionReader . new ( site ) . read
7676 end
77-
77+
7878 end
7979
8080
8181 # Move the _shared directories to the correct location
82- # (very hacky - we move all the files to the correct
82+ # (very hacky - we move all the files to the correct
8383 # location with a hook after the site is written/rendered)
8484
8585 def self . sync_dir ( cur , base , dest )
8686 Dir . glob ( File . join ( cur , '*' ) , File ::FNM_DOTMATCH ) . each do |f |
87-
87+
8888 rel = Pathname . new ( f ) . relative_path_from ( base )
8989 dest_dir = File . join ( dest , rel )
90-
90+
9191 if File . basename ( f ) == '.' or File . basename ( f ) == '..'
92- next
92+ next
9393 elsif File . directory? ( f )
94- if not File . exists? ( dest_dir )
95- Dir . mkdir ( dest_dir )
96- end
94+ if not File . exists? ( dest_dir )
95+ Dir . mkdir ( dest_dir )
96+ end
9797 sync_dir ( f , base , dest )
98- Dir . rmdir ( f )
98+ Dir . rmdir ( f )
9999 else
100- FileUtils . mv ( f , dest_dir )
100+ FileUtils . mv ( f , dest_dir )
101101 end
102102 end
103103 end
@@ -110,10 +110,10 @@ def self.sync_dir(cur, base, dest)
110110 base_shared = File . basename ( site . config [ 'shared_dir' ] )
111111 shared_dir = File . join ( site . dest , base_shared )
112112 static_shared_dir = File . join ( Configuration ::DEFAULTS [ 'destination' ] , base_shared )
113-
113+
114114 sync_dir ( shared_dir , Pathname . new ( shared_dir ) , site . dest )
115115 sync_dir ( static_shared_dir , Pathname . new ( static_shared_dir ) , site . dest )
116-
116+
117117 Dir . rmdir ( shared_dir )
118118 Dir . rmdir ( static_shared_dir )
119119 end
@@ -140,15 +140,15 @@ def relative_to_source(entry)
140140
141141 begin
142142 require "jekyll-paginate"
143-
143+
144144 module Paginate
145145
146146 class Pager
147147 def self . pagination_candidate? ( config , page )
148148 page . name == 'index.html'
149149 end
150150 end
151-
151+
152152 class Pagination < Generator
153153 def paginate ( site , page )
154154 all_posts = site . site_payload [ 'site' ] [ 'posts' ]
@@ -159,14 +159,14 @@ def paginate(site, page)
159159 if num_page > 1
160160
161161 # Here is our monkey patch
162- if File . basename ( page . dir ) == site . config [ 'shared_dir' ]
163- base = File . expand_path ( File . join ( site . source , '..' ) )
162+ if File . basename ( page . dir ) == site . config [ 'shared_dir' ]
163+ base = File . expand_path ( File . join ( site . source , '..' ) )
164164 newpage = Page . new ( site , base , page . dir , page . name )
165165 else
166- newpage = Page . new ( site , site . source , page . dir , page . name )
167- end
166+ newpage = Page . new ( site , site . source , page . dir , page . name )
167+ end
168168
169- newpage . pager = pager
169+ newpage . pager = pager
170170 newpage . dir = Pager . paginate_path ( site , num_page )
171171 site . pages << newpage
172172 else
0 commit comments