mirror of
https://github.com/kremalicious/blog.git
synced 2024-06-30 21:52:05 +02:00
downgrade jekyll for now to solve build error with category pagination
This commit is contained in:
parent
fbf8603d79
commit
945b1640c2
2
Gemfile
2
Gemfile
|
@ -2,6 +2,6 @@
|
||||||
source "https://rubygems.org"
|
source "https://rubygems.org"
|
||||||
|
|
||||||
# gem "rails"
|
# gem "rails"
|
||||||
gem 'jekyll', '>=2.0.0'
|
gem 'jekyll', '1.5.1'
|
||||||
gem 'mini_magick', '>=3.6.0'
|
gem 'mini_magick', '>=3.6.0'
|
||||||
gem 'fileutils', '>=0.7'
|
gem 'fileutils', '>=0.7'
|
55
Gemfile.lock
55
Gemfile.lock
|
@ -2,67 +2,50 @@ GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
blankslate (2.1.2.4)
|
blankslate (2.1.2.4)
|
||||||
celluloid (0.15.2)
|
|
||||||
timers (~> 1.1.0)
|
|
||||||
classifier (1.3.4)
|
classifier (1.3.4)
|
||||||
fast-stemmer (>= 1.0.0)
|
fast-stemmer (>= 1.0.0)
|
||||||
coffee-script (2.2.0)
|
|
||||||
coffee-script-source
|
|
||||||
execjs
|
|
||||||
coffee-script-source (1.7.0)
|
|
||||||
colorator (0.1)
|
colorator (0.1)
|
||||||
execjs (2.2.1)
|
commander (4.1.6)
|
||||||
|
highline (~> 1.6.11)
|
||||||
fast-stemmer (1.0.2)
|
fast-stemmer (1.0.2)
|
||||||
ffi (1.9.3)
|
ffi (1.9.3)
|
||||||
fileutils (0.7)
|
fileutils (0.7)
|
||||||
rmagick (>= 2.13.1)
|
rmagick (>= 2.13.1)
|
||||||
jekyll (2.1.0)
|
highline (1.6.21)
|
||||||
|
jekyll (1.5.1)
|
||||||
classifier (~> 1.3)
|
classifier (~> 1.3)
|
||||||
colorator (~> 0.1)
|
colorator (~> 0.1)
|
||||||
jekyll-coffeescript (~> 1.0)
|
commander (~> 4.1.3)
|
||||||
jekyll-gist (~> 1.0)
|
liquid (~> 2.5.5)
|
||||||
jekyll-paginate (~> 1.0)
|
listen (~> 1.3)
|
||||||
jekyll-sass-converter (~> 1.0)
|
maruku (= 0.7.0)
|
||||||
jekyll-watch (~> 1.0)
|
pygments.rb (~> 0.5.0)
|
||||||
kramdown (~> 1.3)
|
redcarpet (~> 2.3.0)
|
||||||
liquid (~> 2.6.1)
|
|
||||||
mercenary (~> 0.3.3)
|
|
||||||
pygments.rb (~> 0.6.0)
|
|
||||||
redcarpet (~> 3.1)
|
|
||||||
safe_yaml (~> 1.0)
|
safe_yaml (~> 1.0)
|
||||||
toml (~> 0.1.0)
|
toml (~> 0.1.0)
|
||||||
jekyll-coffeescript (1.0.0)
|
liquid (2.5.5)
|
||||||
coffee-script (~> 2.2)
|
listen (1.3.1)
|
||||||
jekyll-gist (1.1.0)
|
|
||||||
jekyll-paginate (1.0.0)
|
|
||||||
jekyll-sass-converter (1.0.0)
|
|
||||||
sass (~> 3.2)
|
|
||||||
jekyll-watch (1.0.0)
|
|
||||||
listen (~> 2.7)
|
|
||||||
kramdown (1.4.0)
|
|
||||||
liquid (2.6.1)
|
|
||||||
listen (2.7.9)
|
|
||||||
celluloid (>= 0.15.2)
|
|
||||||
rb-fsevent (>= 0.9.3)
|
rb-fsevent (>= 0.9.3)
|
||||||
rb-inotify (>= 0.9)
|
rb-inotify (>= 0.9)
|
||||||
mercenary (0.3.3)
|
rb-kqueue (>= 0.2)
|
||||||
|
maruku (0.7.0)
|
||||||
mini_magick (3.7.0)
|
mini_magick (3.7.0)
|
||||||
subexec (~> 0.2.1)
|
subexec (~> 0.2.1)
|
||||||
parslet (1.5.0)
|
parslet (1.5.0)
|
||||||
blankslate (~> 2.0)
|
blankslate (~> 2.0)
|
||||||
posix-spawn (0.3.8)
|
posix-spawn (0.3.8)
|
||||||
pygments.rb (0.6.0)
|
pygments.rb (0.5.4)
|
||||||
posix-spawn (~> 0.3.6)
|
posix-spawn (~> 0.3.6)
|
||||||
yajl-ruby (~> 1.1.0)
|
yajl-ruby (~> 1.1.0)
|
||||||
rb-fsevent (0.9.4)
|
rb-fsevent (0.9.4)
|
||||||
rb-inotify (0.9.5)
|
rb-inotify (0.9.5)
|
||||||
ffi (>= 0.5.0)
|
ffi (>= 0.5.0)
|
||||||
redcarpet (3.1.2)
|
rb-kqueue (0.2.3)
|
||||||
|
ffi (>= 0.5.0)
|
||||||
|
redcarpet (2.3.0)
|
||||||
rmagick (2.13.2)
|
rmagick (2.13.2)
|
||||||
safe_yaml (1.0.3)
|
safe_yaml (1.0.3)
|
||||||
sass (3.3.9)
|
|
||||||
subexec (0.2.3)
|
subexec (0.2.3)
|
||||||
timers (1.1.0)
|
|
||||||
toml (0.1.1)
|
toml (0.1.1)
|
||||||
parslet (~> 1.5.0)
|
parslet (~> 1.5.0)
|
||||||
yajl-ruby (1.1.0)
|
yajl-ruby (1.1.0)
|
||||||
|
@ -72,5 +55,5 @@ PLATFORMS
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
fileutils (>= 0.7)
|
fileutils (>= 0.7)
|
||||||
jekyll (>= 2.0.0)
|
jekyll (= 1.5.1)
|
||||||
mini_magick (>= 3.6.0)
|
mini_magick (>= 3.6.0)
|
||||||
|
|
|
@ -33,6 +33,7 @@ category_title_prefix: ""
|
||||||
|
|
||||||
future: false
|
future: false
|
||||||
markdown: redcarpet
|
markdown: redcarpet
|
||||||
|
pygments: true
|
||||||
|
|
||||||
redcarpet:
|
redcarpet:
|
||||||
extensions: ['autolink', 'smart']
|
extensions: ['autolink', 'smart']
|
||||||
|
|
|
@ -5,74 +5,76 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
module Jekyll
|
module Jekyll
|
||||||
|
module Paginate
|
||||||
|
|
||||||
class Pagination < Generator
|
class Pagination < Generator
|
||||||
def generate(site)
|
def generate(site)
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
class CategoryPages < Generator
|
|
||||||
|
|
||||||
safe true
|
|
||||||
|
|
||||||
def generate(site)
|
|
||||||
|
|
||||||
site.pages.dup.each do |page|
|
|
||||||
paginate(site, page) if CategoryPager.pagination_enabled?(site.config, page)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def paginate(site, page)
|
class CategoryPages < Generator
|
||||||
|
|
||||||
# sort categories by descending date of publish
|
|
||||||
category_posts = site.categories[page.data['category']].sort_by { |p| -p.date.to_f }
|
|
||||||
|
|
||||||
# calculate total number of pages
|
safe true
|
||||||
pages = CategoryPager.calculate_pages(category_posts, site.config['paginate'].to_i)
|
|
||||||
|
|
||||||
# iterate over the total number of pages and create a physical page for each
|
def generate(site)
|
||||||
(1..pages).each do |num_page|
|
|
||||||
|
|
||||||
# the CategoryPager handles the paging and category data
|
|
||||||
pager = CategoryPager.new(site, num_page, category_posts, page.data['category'], pages)
|
|
||||||
|
|
||||||
if num_page > 1
|
site.pages.dup.each do |page|
|
||||||
newpage = Page.new(site, site.source, page.dir, page.name)
|
paginate(site, page) if CategoryPager.pagination_enabled?(site.config, page)
|
||||||
newpage.pager = pager
|
|
||||||
newpage.dir = File.join(page.dir, "/page/#{num_page}")
|
|
||||||
site.pages << newpage
|
|
||||||
else
|
|
||||||
page.pager = pager
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def paginate(site, page)
|
||||||
|
|
||||||
|
# sort categories by descending date of publish
|
||||||
|
category_posts = site.categories[page.data['category']].sort_by { |p| -p.date.to_f }
|
||||||
|
|
||||||
|
# calculate total number of pages
|
||||||
|
pages = CategoryPager.calculate_pages(category_posts, site.config['paginate'].to_i)
|
||||||
|
|
||||||
|
# iterate over the total number of pages and create a physical page for each
|
||||||
|
(1..pages).each do |num_page|
|
||||||
|
|
||||||
|
# the CategoryPager handles the paging and category data
|
||||||
|
pager = CategoryPager.new(site, num_page, category_posts, page.data['category'], pages)
|
||||||
|
|
||||||
|
if num_page > 1
|
||||||
|
newpage = Page.new(site, site.source, page.dir, page.name)
|
||||||
|
newpage.pager = pager
|
||||||
|
newpage.dir = File.join(page.dir, "/page/#{num_page}")
|
||||||
|
site.pages << newpage
|
||||||
|
else
|
||||||
|
page.pager = pager
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
class CategoryPager < Pager
|
||||||
|
|
||||||
|
attr_reader :category
|
||||||
|
|
||||||
|
def self.pagination_enabled?(config, page)
|
||||||
|
page.name == 'index.html' && page.data.key?('category') && !config['paginate'].nil?
|
||||||
|
end
|
||||||
|
|
||||||
|
# same as the base class, but includes the category value
|
||||||
|
def initialize(site, page, all_posts, category, num_pages = nil)
|
||||||
|
@category = category
|
||||||
|
super site, page, all_posts, num_pages
|
||||||
|
end
|
||||||
|
|
||||||
|
# use the original to_liquid method, but add in category info
|
||||||
|
alias_method :original_to_liquid, :to_liquid
|
||||||
|
def to_liquid
|
||||||
|
x = original_to_liquid
|
||||||
|
x['category'] = @category
|
||||||
|
x
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
class CategoryPager < Pager
|
|
||||||
|
|
||||||
attr_reader :category
|
|
||||||
|
|
||||||
def self.pagination_enabled?(config, page)
|
|
||||||
page.name == 'index.html' && page.data.key?('category') && !config['paginate'].nil?
|
|
||||||
end
|
|
||||||
|
|
||||||
# same as the base class, but includes the category value
|
|
||||||
def initialize(site, page, all_posts, category, num_pages = nil)
|
|
||||||
@category = category
|
|
||||||
super site, page, all_posts, num_pages
|
|
||||||
end
|
|
||||||
|
|
||||||
# use the original to_liquid method, but add in category info
|
|
||||||
alias_method :original_to_liquid, :to_liquid
|
|
||||||
def to_liquid
|
|
||||||
x = original_to_liquid
|
|
||||||
x['category'] = @category
|
|
||||||
x
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
Loading…
Reference in New Issue
Block a user