jekyll-paginate-v2 1.5.0 → 1.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +41 -43
  3. data/Rakefile +2 -2
  4. data/jekyll-paginate-v2.gemspec +3 -1
  5. data/lib/jekyll-paginate-v2.rb +12 -8
  6. data/lib/jekyll-paginate-v2/autopages/autoTagPages.rb +66 -0
  7. data/lib/jekyll-paginate-v2/autopages/defaults.rb +26 -0
  8. data/lib/jekyll-paginate-v2/autopages/utils.rb +21 -0
  9. data/lib/jekyll-paginate-v2/{compatibilityUtils.rb → generator/compatibilityUtils.rb} +4 -2
  10. data/lib/jekyll-paginate-v2/{defaults.rb → generator/defaults.rb} +3 -2
  11. data/lib/jekyll-paginate-v2/{paginationGenerator.rb → generator/paginationGenerator.rb} +14 -9
  12. data/lib/jekyll-paginate-v2/generator/paginationIndexer.rb +93 -0
  13. data/lib/jekyll-paginate-v2/{paginationModel.rb → generator/paginationModel.rb} +99 -120
  14. data/lib/jekyll-paginate-v2/{paginationPage.rb → generator/paginationPage.rb} +1 -1
  15. data/lib/jekyll-paginate-v2/{paginator.rb → generator/paginator.rb} +1 -1
  16. data/lib/jekyll-paginate-v2/{utils.rb → generator/utils.rb} +11 -4
  17. data/lib/jekyll-paginate-v2/version.rb +4 -4
  18. data/spec/{defaults_spec.rb → generator/defaults_spec.rb} +5 -3
  19. data/spec/generator/paginationPage_spec.rb +12 -0
  20. data/spec/{paginator_spec.rb → generator/paginator_spec.rb} +21 -18
  21. data/spec/generator/utils_spec.rb +90 -0
  22. data/spec/spec_helper.rb +8 -30
  23. metadata +41 -87
  24. data/examples/01-typicalblog/Gemfile +0 -28
  25. data/examples/01-typicalblog/README.md +0 -91
  26. data/examples/01-typicalblog/_config.yml +0 -51
  27. data/examples/01-typicalblog/_includes/header.html +0 -31
  28. data/examples/01-typicalblog/_layouts/home.html +0 -52
  29. data/examples/01-typicalblog/_posts/2016-11-20-geography-of-minneapolis.md +0 -29
  30. data/examples/01-typicalblog/_posts/2016-11-21-sailing-summer-olympics-1988.md +0 -15
  31. data/examples/01-typicalblog/_posts/2016-11-22-rotary-engine.md +0 -27
  32. data/examples/01-typicalblog/_posts/2016-11-23-luft-fahrzeug-gesellschaft.md +0 -27
  33. data/examples/01-typicalblog/_posts/2016-11-24-narcisse-snake-pits.md +0 -18
  34. data/examples/01-typicalblog/_posts/2016-11-25-tele7jours.md +0 -43
  35. data/examples/01-typicalblog/_posts/2016-11-26-columbia-river.md +0 -41
  36. data/examples/01-typicalblog/_posts/2016-11-27-welcome-to-jekyll-paginate-v2.md +0 -33
  37. data/examples/01-typicalblog/about.md +0 -15
  38. data/examples/01-typicalblog/index.html +0 -8
  39. data/examples/02-category/Gemfile +0 -28
  40. data/examples/02-category/README.md +0 -119
  41. data/examples/02-category/_config.yml +0 -47
  42. data/examples/02-category/_includes/header.html +0 -31
  43. data/examples/02-category/_layouts/home.html +0 -52
  44. data/examples/02-category/_posts/2016-10-27-welcome-to-jekyll-paginate-v2.md +0 -32
  45. data/examples/02-category/about.md +0 -15
  46. data/examples/02-category/cars/_posts/2016-10-18-Porsche-918-Spyder.md +0 -13
  47. data/examples/02-category/cars/_posts/2016-10-19-Porsche-964.md +0 -12
  48. data/examples/02-category/cars/_posts/2016-10-20-porsche-911-gt3.md +0 -13
  49. data/examples/02-category/cars/_posts/2016-10-21-porsche-911.md +0 -13
  50. data/examples/02-category/cars/_posts/2016-10-22-porsche-962.md +0 -18
  51. data/examples/02-category/cars/_posts/2016-10-23-Toyota-GT-One.md +0 -20
  52. data/examples/02-category/cars/_posts/2016-10-24-Mercedes-Benz-CLK-GTR.md +0 -40
  53. data/examples/02-category/cars/_posts/2016-10-25-rolls-royce-silver-ghost.md +0 -31
  54. data/examples/02-category/categories/byname.md +0 -11
  55. data/examples/02-category/categories/porsche.md +0 -10
  56. data/examples/02-category/index.md +0 -13
  57. data/examples/02-category/toyota/index.md +0 -7
  58. data/examples/03-tags/Gemfile +0 -28
  59. data/examples/03-tags/README.md +0 -67
  60. data/examples/03-tags/_biography/all/born-to-run.md +0 -26
  61. data/examples/03-tags/_biography/all/forty-autumns.md +0 -26
  62. data/examples/03-tags/_biography/all/life-in-questions-a.md +0 -27
  63. data/examples/03-tags/_biography/all/not-dead-yet.md +0 -24
  64. data/examples/03-tags/_biography/all/princess-diarist-the.md +0 -26
  65. data/examples/03-tags/_biography/all/when-breath-becomes-air.md +0 -24
  66. data/examples/03-tags/_biography/biography-musicians.md +0 -13
  67. data/examples/03-tags/_biography/index.md +0 -12
  68. data/examples/03-tags/_config.yml +0 -57
  69. data/examples/03-tags/_fantasy/all/harry-potter-deathly-hallows.md +0 -24
  70. data/examples/03-tags/_fantasy/all/harry-potter-philosophers-stone.md +0 -24
  71. data/examples/03-tags/_fantasy/all/mistborn-trilogy.md +0 -24
  72. data/examples/03-tags/_fantasy/all/ready-player-one.md +0 -24
  73. data/examples/03-tags/_fantasy/all/sword-of-destiny.md +0 -24
  74. data/examples/03-tags/_fantasy/all/terry-pratchet-diary-2017.md +0 -24
  75. data/examples/03-tags/_includes/header.html +0 -31
  76. data/examples/03-tags/_layouts/home.html +0 -51
  77. data/examples/03-tags/_layouts/post.html +0 -20
  78. data/examples/03-tags/_romance/all/breath-of-snow-and-ashes-a.md +0 -25
  79. data/examples/03-tags/_romance/all/dressmaker-the.md +0 -24
  80. data/examples/03-tags/_romance/all/fiery-cross-the.md +0 -26
  81. data/examples/03-tags/_romance/all/it-ends-with-us.md +0 -28
  82. data/examples/03-tags/_romance/all/outlander-novel.md +0 -34
  83. data/examples/03-tags/_romance/all/virgins-outlander-short-story.md +0 -26
  84. data/examples/03-tags/_romance/romance-historical.md +0 -14
  85. data/examples/03-tags/blog/_posts/2016-09-30-welcome-to-jekyll-paginate-v2.md +0 -32
  86. data/examples/03-tags/byisbn.md +0 -14
  87. data/examples/03-tags/index.md +0 -19
  88. data/examples/03-tags/tags/contemporary.md +0 -11
  89. data/examples/03-tags/tags/fantasy.md +0 -13
  90. data/examples/03-tags/tags/sci-fi.md +0 -16
  91. data/examples/README.md +0 -23
  92. data/examples/img/01-example-screenshot-main.png +0 -0
  93. data/examples/img/02-example-screenshot-main.png +0 -0
  94. data/examples/img/03-example-screenshot-main.png +0 -0
  95. data/spec/utils_spec.rb +0 -65
@@ -1,32 +0,0 @@
1
- ---
2
- layout: post
3
- title: "Welcome to Jekyll Paginate V2!"
4
- date: 2016-10-27 19:16:49 +0100
5
- ---
6
- You’ll find this post in your `_posts` directory. This post along with all of the other example posts is paginated by the new [jekyll-paginate-v2 gem](https://github.com/sverrirs/jekyll-paginate-v2).
7
-
8
- This pagination gem is built specially for Jekyll 3 and newer and is intended to replace the now discontinuted jekyll-paginate gem.
9
-
10
- This v2 of the gem offers full backwards compatibility with the old gem and its site configuration. You can simply replace the old jekyll-paginate gem with this one and your sites will still work without any changes.
11
-
12
- However to access the new enhanced features of this gem, like pagination on categories, tags and locales, then you need to remove the old jekyll-paginate configuration and activate the new `pagination:` [site configuration](https://github.com/sverrirs/jekyll-paginate-v2#site-configuration).
13
-
14
- The [source code](https://github.com/sverrirs/jekyll-paginate-v2/tree/master/examples) for this example project will show you all the necessary steps.
15
-
16
- ## Installing
17
-
18
- Go ahead and install the latest version of the gem from [rubygems.org](https://rubygems.org/gems/jekyll-paginate-v2)
19
-
20
- ```
21
- gem install jekyll-paginate-v2
22
- ```
23
-
24
- Replace the `jekyll-paginate` gem with `jekyll-paginate-v2` in both your `_config.yml` and your `Gemfile`.
25
-
26
- Now go ahead and re-build your site to start running the new pagination logic. You can rebuild the site in many different ways, but the most common way is to run `jekyll serve`, which launches a web server and auto-regenerates your site when a file is updated.
27
-
28
- Please see the [GitHub repo](https://github.com/sverrirs/jekyll-paginate-v2) to learn how to get the most out of this new pagination gem. There we also discuss the gems more advanced features.
29
-
30
- Please file all bugs/feature requests in the issues section of the [GitHub repo](https://github.com/sverrirs/jekyll-paginate-v2/issues).
31
-
32
- Have a great day :)
@@ -1,14 +0,0 @@
1
- ---
2
- layout: home
3
- title: By ISBN
4
- permalink: /isbn/
5
- pagination:
6
- enabled: true
7
- collection: all
8
- permalink: '/:num/'
9
- sort_field: 'book:ISBN13'
10
- sort_reverse: false
11
- ---
12
-
13
-
14
- <p>This page lies in the root of the site (next to the index.md) and safely lists all books sorted by their _ISBN_ field</p>
@@ -1,19 +0,0 @@
1
- ---
2
- # You don't need to edit this file, it's empty on purpose.
3
- # Edit theme's home layout instead if you wanna make some changes
4
- # See: https://jekyllrb.com/docs/themes/#overriding-theme-defaults
5
- layout: home
6
- title: Home
7
- pagination:
8
- enabled: true
9
- collection: biography, fantasy, romance
10
- sort_field: 'title'
11
- sort_reverse: false
12
- ---
13
-
14
-
15
- <p>This page lists all posts available and paginates them in ascending order by title.</p>
16
-
17
-
18
- <p>Try clicking the category pages at the top of this page.</p>
19
-
@@ -1,11 +0,0 @@
1
- ---
2
- layout: home
3
- title: Contemporary
4
- pagination:
5
- enabled: true
6
- collection: all
7
- tag: contemporary
8
- permalink: /:num/
9
- ---
10
-
11
- All books tagged with _Contemporary_
@@ -1,13 +0,0 @@
1
- ---
2
- layout: home
3
- title: Fantasy
4
- pagination:
5
- enabled: true
6
- collection: all
7
- tag: fantasy
8
- permalink: /:num/
9
- sort_field: 'book:rank'
10
- sort_reverse: false
11
- ---
12
-
13
- All books tagged with _Fantasy_
@@ -1,16 +0,0 @@
1
- ---
2
- layout: home
3
- title: Sci-Fi
4
- pagination:
5
- enabled: true
6
- collection: fantasy,romance
7
- tag: Science, Fiction
8
- per_page: 2
9
- permalink: /:num/
10
- sort_field: 'book:rank'
11
- sort_reverse: false
12
- ---
13
-
14
- All books in the _fantasy_ and _romance_ collections that are tagged with _science_ and _fiction_
15
-
16
- This should exclude the Biography "The Princess Diarist"
@@ -1,23 +0,0 @@
1
- # Jekyll::Paginate V2::Examples
2
-
3
- Here are a few example sites that use the new jekyll-paginate-v2 gem. They can serve as a help and guide on the nitty gritty details of configuring the gem and leveraging its more advanced features.
4
-
5
- Please feel free to fork and play around with this code to quickly test out different scenarios and site structures.
6
-
7
- All examples are generated from running the `jekyll new .` command and they all use the [default `minima` theme](https://github.com/jekyll/minima).
8
-
9
- ## Example 1: Typical Blog
10
- Simple blog that only has one type of post pages. The index.html page does the pagination.
11
-
12
- This example also demonstrates how the page can operate as a zero-config replacement for the old [jekyll-paginate](https://github.com/jekyll/jekyll-paginate) gem.
13
-
14
- ## Example 2: Category Pagination
15
- Car site that has multiple paginated pages and multiple post categories.
16
-
17
- ## Example 3: Tag and Collection Pagination
18
- Book review site that organizes its content into collections and by tags. Uses the `pretty` permalink structure for the site.
19
-
20
- This site demonstrates how the pagination logic handles paginating across one or more collections at the same time. The pagination can also paginate over all collections.
21
-
22
- This site also demonstrates how to sort posts by nested front-matter attributes.
23
-
@@ -1,65 +0,0 @@
1
- require_relative 'spec_helper.rb'
2
-
3
- module Jekyll::PaginateV2
4
- describe Utils do
5
-
6
- it "should always replace num format with the specified number" do
7
- Utils.format_page_number( ":num", 7).must_equal "7"
8
- Utils.format_page_number( ":num", 13).must_equal "13"
9
- Utils.format_page_number( ":num", -2).must_equal "-2"
10
- Utils.format_page_number( ":num", 0).must_equal "0"
11
- Utils.format_page_number( ":num", 1000).must_equal "1000"
12
- end
13
-
14
- it "should always replace num format with the specified number and keep rest of formatting" do
15
- Utils.format_page_number( "/page:num/", 7).must_equal "/page7/"
16
- Utils.format_page_number( "/page:num/", 50).must_equal "/page50/"
17
- Utils.format_page_number( "/page:num/", -5).must_equal "/page-5/"
18
-
19
- Utils.format_page_number( "/car/:num/", 1).must_equal "/car/1/"
20
- Utils.format_page_number( "/car/:num", 1).must_equal "/car/1"
21
- Utils.format_page_number( "car/:num", 1).must_equal "car/1"
22
- Utils.format_page_number( "/car//:num", 1).must_equal "/car//1"
23
- end
24
-
25
- it "make sure there is a leading slash in path" do
26
- Utils.ensure_leading_slash("path/to/file/wow").must_equal "/path/to/file/wow"
27
- Utils.ensure_leading_slash("/no/place/wow/").must_equal "/no/place/wow/"
28
- Utils.ensure_leading_slash("/no").must_equal "/no"
29
- Utils.ensure_leading_slash("no").must_equal "/no"
30
- end
31
-
32
- it "make sure there is never a leading slash in path" do
33
- Utils.remove_leading_slash("path/to/file/wow").must_equal "path/to/file/wow"
34
- Utils.remove_leading_slash("/no/place/wow/").must_equal "no/place/wow/"
35
- Utils.remove_leading_slash("/no").must_equal "no"
36
- Utils.remove_leading_slash("no").must_equal "no"
37
- end
38
-
39
- it "paginate must return nil if cur_page_nr is nill" do
40
- Utils.paginate_path(nil, nil, nil).must_be_nil
41
- Utils.paginate_path("/index/moore", nil, "/page:num/").must_be_nil
42
- end
43
-
44
- it "paginate must return the url to the template if cur_page_nr is equal to 1" do
45
- Utils.paginate_path("/index/moore", 1, "/page:num/").must_equal "/index/moore"
46
- Utils.paginate_path("/index.html", 1, "/page/").must_equal "/index.html"
47
- end
48
-
49
- it "paginate must throw an error if the permalink path doesn't include :num" do
50
- err = ->{ Utils.paginate_path("/index.html", 3, "/page/")}.must_raise ArgumentError
51
- err.message.must_include ":num"
52
- end
53
-
54
- it "paginate must use the permalink value and format it based on the cur_page_nr" do
55
- Utils.paginate_path("/index.html", 3, "/page:num/").must_equal "/page3/"
56
- Utils.paginate_path("/index.html", 646, "/page/:num/").must_equal "/page/646/"
57
- end
58
-
59
- it "paginate must ensure a leading slash in the url it returns" do
60
- Utils.paginate_path("/index.html", 3, "page:num/").must_equal "/page3/"
61
- Utils.paginate_path("/index.html", 646, "page/:num/").must_equal "/page/646/"
62
- end
63
- end
64
- end
65
-