jekyll-index-pages 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +13 -2
- data/lib/jekyll-index-pages.rb +0 -2
- data/lib/jekyll-index-pages/generator.rb +20 -6
- data/lib/jekyll-index-pages/index-page.rb +6 -5
- data/lib/jekyll-index-pages/version.rb +1 -1
- data/spec/fixtures/index-page/_config.yml +1 -0
- data/spec/fixtures/index-page/_locales/en-US.yml +213 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a25da1b24a53ee735e7cae9a3eb1d9ed5f49228f
|
4
|
+
data.tar.gz: 47db13f7f5bfaadc4adab6c3271537a8e8c49af0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57d5b0d80cd251773c2d791e5916ccb1cbe7585c473085b2869d68106dc3ed03665b2fb99b2457f0b8cfb8a48147e363d65f689861fd69717ea8d08c5fdf632a
|
7
|
+
data.tar.gz: c4c47471165ef78521ade61525b0724d260fd3c887e0070f43459c86697219dca8341e33139b8cf20dd556645e9ea81eb4afda77619c474b54b00cee2e5e0320
|
data/README.md
CHANGED
@@ -113,8 +113,8 @@ refers to any given year. For authors, `:label` is the author name. `:label`
|
|
113
113
|
value is slugified when composing the permalink.
|
114
114
|
|
115
115
|
Default value for layout depends on the type of index page. For collection
|
116
|
-
index pages, the default layout is the same as the custon name used to define
|
117
|
-
collection config:
|
116
|
+
index pages, the default layout is the same as the custon name used to define
|
117
|
+
the collection config:
|
118
118
|
|
119
119
|
```yaml
|
120
120
|
custom_name:
|
@@ -123,6 +123,17 @@ custom_name:
|
|
123
123
|
...
|
124
124
|
```
|
125
125
|
|
126
|
+
Beacuse this plugin [transliterates](http://stackoverflow.com/a/20586777) the
|
127
|
+
URL for generated pages, you need to define a language as follows:
|
128
|
+
|
129
|
+
```yaml
|
130
|
+
lang: en-US
|
131
|
+
```
|
132
|
+
|
133
|
+
Then get the specified locale file from
|
134
|
+
https://github.com/svenfuchs/rails-i18n/tree/master/rails/locale and add it to
|
135
|
+
the `_locales/` directory inside your site codebase.
|
136
|
+
|
126
137
|
### Including documents and pagination into templates
|
127
138
|
|
128
139
|
To include the paginated documents in your layouts, you can use the `pager`
|
data/lib/jekyll-index-pages.rb
CHANGED
@@ -2,6 +2,15 @@ module JekyllIndexPages
|
|
2
2
|
class Generator < Jekyll::Generator
|
3
3
|
safe true
|
4
4
|
|
5
|
+
Jekyll::Hooks.register :site, :after_init do |site|
|
6
|
+
if I18n.backend.send(:translations).empty?
|
7
|
+
I18n.backend.load_translations(
|
8
|
+
Dir[File.join(site.in_source_dir(),"_locales/*.yml")]
|
9
|
+
)
|
10
|
+
end
|
11
|
+
I18n.locale = site.config["lang"]
|
12
|
+
end
|
13
|
+
|
5
14
|
def generate(site)
|
6
15
|
config = site.config["index_pages"] || {}
|
7
16
|
config.each do |kind, item|
|
@@ -36,18 +45,23 @@ module JekyllIndexPages
|
|
36
45
|
|
37
46
|
pager = pagination.pager
|
38
47
|
|
39
|
-
label_slug =
|
48
|
+
label_slug =
|
49
|
+
I18n.transliterate(
|
50
|
+
Jekyll::Utils.slugify(label),
|
51
|
+
:locale => I18n.locale
|
52
|
+
)
|
40
53
|
dir =
|
41
54
|
File.join(
|
42
55
|
permalink.sub(":label", label_slug),
|
43
56
|
(pager.current_page > 1) ? pager.current_page.to_s : ""
|
44
57
|
)
|
45
58
|
|
46
|
-
base =
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
59
|
+
base =
|
60
|
+
if site.in_theme_dir()
|
61
|
+
site.in_theme_dir()
|
62
|
+
else
|
63
|
+
site.in_source_dir()
|
64
|
+
end
|
51
65
|
|
52
66
|
site.pages <<
|
53
67
|
IndexPage.new(site, base, dir, item, label, layout, pager)
|
@@ -9,11 +9,12 @@ module JekyllIndexPages
|
|
9
9
|
layout_dir = "_layouts"
|
10
10
|
layout_name = "#{layout}.html"
|
11
11
|
|
12
|
-
@path =
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
12
|
+
@path =
|
13
|
+
if site.in_theme_dir(base) == base
|
14
|
+
site.in_theme_dir(base, layout_dir, layout_name)
|
15
|
+
else
|
16
|
+
site.in_source_dir(base, layout_dir, layout_name)
|
17
|
+
end
|
17
18
|
|
18
19
|
title = config["title"] || ":label"
|
19
20
|
excerpt = config["excerpt"] || ":label"
|
@@ -0,0 +1,213 @@
|
|
1
|
+
---
|
2
|
+
en-US:
|
3
|
+
activerecord:
|
4
|
+
errors:
|
5
|
+
messages:
|
6
|
+
record_invalid: "Validation failed: %{errors}"
|
7
|
+
restrict_dependent_destroy:
|
8
|
+
has_one: "Cannot delete record because a dependent %{record} exists"
|
9
|
+
has_many: "Cannot delete record because dependent %{record} exist"
|
10
|
+
date:
|
11
|
+
abbr_day_names:
|
12
|
+
- Sun
|
13
|
+
- Mon
|
14
|
+
- Tue
|
15
|
+
- Wed
|
16
|
+
- Thu
|
17
|
+
- Fri
|
18
|
+
- Sat
|
19
|
+
abbr_month_names:
|
20
|
+
-
|
21
|
+
- Jan
|
22
|
+
- Feb
|
23
|
+
- Mar
|
24
|
+
- Apr
|
25
|
+
- May
|
26
|
+
- Jun
|
27
|
+
- Jul
|
28
|
+
- Aug
|
29
|
+
- Sep
|
30
|
+
- Oct
|
31
|
+
- Nov
|
32
|
+
- Dec
|
33
|
+
day_names:
|
34
|
+
- Sunday
|
35
|
+
- Monday
|
36
|
+
- Tuesday
|
37
|
+
- Wednesday
|
38
|
+
- Thursday
|
39
|
+
- Friday
|
40
|
+
- Saturday
|
41
|
+
formats:
|
42
|
+
default: "%m-%d-%Y"
|
43
|
+
long: "%B %d, %Y"
|
44
|
+
short: "%b %d"
|
45
|
+
month_names:
|
46
|
+
-
|
47
|
+
- January
|
48
|
+
- February
|
49
|
+
- March
|
50
|
+
- April
|
51
|
+
- May
|
52
|
+
- June
|
53
|
+
- July
|
54
|
+
- August
|
55
|
+
- September
|
56
|
+
- October
|
57
|
+
- November
|
58
|
+
- December
|
59
|
+
order:
|
60
|
+
- :month
|
61
|
+
- :day
|
62
|
+
- :year
|
63
|
+
datetime:
|
64
|
+
distance_in_words:
|
65
|
+
about_x_hours:
|
66
|
+
one: about 1 hour
|
67
|
+
other: about %{count} hours
|
68
|
+
about_x_months:
|
69
|
+
one: about 1 month
|
70
|
+
other: about %{count} months
|
71
|
+
about_x_years:
|
72
|
+
one: about 1 year
|
73
|
+
other: about %{count} years
|
74
|
+
almost_x_years:
|
75
|
+
one: almost 1 year
|
76
|
+
other: almost %{count} years
|
77
|
+
half_a_minute: half a minute
|
78
|
+
less_than_x_minutes:
|
79
|
+
one: less than a minute
|
80
|
+
other: less than %{count} minutes
|
81
|
+
less_than_x_seconds:
|
82
|
+
one: less than 1 second
|
83
|
+
other: less than %{count} seconds
|
84
|
+
over_x_years:
|
85
|
+
one: over 1 year
|
86
|
+
other: over %{count} years
|
87
|
+
x_days:
|
88
|
+
one: 1 day
|
89
|
+
other: "%{count} days"
|
90
|
+
x_minutes:
|
91
|
+
one: 1 minute
|
92
|
+
other: "%{count} minutes"
|
93
|
+
x_months:
|
94
|
+
one: 1 month
|
95
|
+
other: "%{count} months"
|
96
|
+
x_years:
|
97
|
+
one: 1 year
|
98
|
+
other: "%{count} years"
|
99
|
+
x_seconds:
|
100
|
+
one: 1 second
|
101
|
+
other: "%{count} seconds"
|
102
|
+
prompts:
|
103
|
+
day: Day
|
104
|
+
hour: Hour
|
105
|
+
minute: Minute
|
106
|
+
month: Month
|
107
|
+
second: Seconds
|
108
|
+
year: Year
|
109
|
+
errors:
|
110
|
+
format: "%{attribute} %{message}"
|
111
|
+
messages:
|
112
|
+
accepted: must be accepted
|
113
|
+
blank: can't be blank
|
114
|
+
present: must be blank
|
115
|
+
confirmation: doesn't match %{attribute}
|
116
|
+
empty: can't be empty
|
117
|
+
equal_to: must be equal to %{count}
|
118
|
+
even: must be even
|
119
|
+
exclusion: is reserved
|
120
|
+
greater_than: must be greater than %{count}
|
121
|
+
greater_than_or_equal_to: must be greater than or equal to %{count}
|
122
|
+
inclusion: is not included in the list
|
123
|
+
invalid: is invalid
|
124
|
+
less_than: must be less than %{count}
|
125
|
+
less_than_or_equal_to: must be less than or equal to %{count}
|
126
|
+
model_invalid: "Validation failed: %{errors}"
|
127
|
+
not_a_number: is not a number
|
128
|
+
not_an_integer: must be an integer
|
129
|
+
odd: must be odd
|
130
|
+
required: must exist
|
131
|
+
taken: has already been taken
|
132
|
+
too_long:
|
133
|
+
one: is too long (maximum is 1 character)
|
134
|
+
other: is too long (maximum is %{count} characters)
|
135
|
+
too_short:
|
136
|
+
one: is too short (minimum is 1 character)
|
137
|
+
other: is too short (minimum is %{count} characters)
|
138
|
+
wrong_length:
|
139
|
+
one: is the wrong length (should be 1 character)
|
140
|
+
other: is the wrong length (should be %{count} characters)
|
141
|
+
other_than: must be other than %{count}
|
142
|
+
template:
|
143
|
+
body: 'There were problems with the following fields:'
|
144
|
+
header:
|
145
|
+
one: 1 error prohibited this %{model} from being saved
|
146
|
+
other: "%{count} errors prohibited this %{model} from being saved"
|
147
|
+
helpers:
|
148
|
+
select:
|
149
|
+
prompt: Please select
|
150
|
+
submit:
|
151
|
+
create: Create %{model}
|
152
|
+
submit: Save %{model}
|
153
|
+
update: Update %{model}
|
154
|
+
number:
|
155
|
+
currency:
|
156
|
+
format:
|
157
|
+
delimiter: ","
|
158
|
+
format: "%u%n"
|
159
|
+
precision: 2
|
160
|
+
separator: "."
|
161
|
+
significant: false
|
162
|
+
strip_insignificant_zeros: false
|
163
|
+
unit: "$"
|
164
|
+
format:
|
165
|
+
delimiter: ","
|
166
|
+
precision: 3
|
167
|
+
separator: "."
|
168
|
+
significant: false
|
169
|
+
strip_insignificant_zeros: false
|
170
|
+
human:
|
171
|
+
decimal_units:
|
172
|
+
format: "%n %u"
|
173
|
+
units:
|
174
|
+
billion: Billion
|
175
|
+
million: Million
|
176
|
+
quadrillion: Quadrillion
|
177
|
+
thousand: Thousand
|
178
|
+
trillion: Trillion
|
179
|
+
unit: ''
|
180
|
+
format:
|
181
|
+
delimiter: ''
|
182
|
+
precision: 3
|
183
|
+
significant: true
|
184
|
+
strip_insignificant_zeros: true
|
185
|
+
storage_units:
|
186
|
+
format: "%n %u"
|
187
|
+
units:
|
188
|
+
byte:
|
189
|
+
one: Byte
|
190
|
+
other: Bytes
|
191
|
+
gb: GB
|
192
|
+
kb: KB
|
193
|
+
mb: MB
|
194
|
+
tb: TB
|
195
|
+
percentage:
|
196
|
+
format:
|
197
|
+
delimiter: ''
|
198
|
+
format: "%n%"
|
199
|
+
precision:
|
200
|
+
format:
|
201
|
+
delimiter: ''
|
202
|
+
support:
|
203
|
+
array:
|
204
|
+
last_word_connector: ", and "
|
205
|
+
two_words_connector: " and "
|
206
|
+
words_connector: ", "
|
207
|
+
time:
|
208
|
+
am: am
|
209
|
+
formats:
|
210
|
+
default: "%a, %d %b %Y %I:%M:%S %p %Z"
|
211
|
+
long: "%B %d, %Y %I:%M %p"
|
212
|
+
short: "%d %b %I:%M %p"
|
213
|
+
pm: pm
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-index-pages
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jose Miguel Venegas Mendoza
|
@@ -119,6 +119,7 @@ files:
|
|
119
119
|
- spec/fixtures/index-page/_layouts/default.html
|
120
120
|
- spec/fixtures/index-page/_layouts/posts.html
|
121
121
|
- spec/fixtures/index-page/_layouts/tags.html
|
122
|
+
- spec/fixtures/index-page/_locales/en-US.yml
|
122
123
|
- spec/fixtures/index-page/_posts/1966-09-08-star-trek-the-original-series.md
|
123
124
|
- spec/fixtures/index-page/_posts/1966-09-08-viaje-a-las-estrellas-la-serie-original.md
|
124
125
|
- spec/fixtures/index-page/_posts/1987-09-28-star-trek-the-next-generation.md
|
@@ -169,6 +170,7 @@ test_files:
|
|
169
170
|
- spec/fixtures/index-page/_layouts/default.html
|
170
171
|
- spec/fixtures/index-page/_layouts/posts.html
|
171
172
|
- spec/fixtures/index-page/_layouts/tags.html
|
173
|
+
- spec/fixtures/index-page/_locales/en-US.yml
|
172
174
|
- spec/fixtures/index-page/_posts/1966-09-08-star-trek-the-original-series.md
|
173
175
|
- spec/fixtures/index-page/_posts/1966-09-08-viaje-a-las-estrellas-la-serie-original.md
|
174
176
|
- spec/fixtures/index-page/_posts/1987-09-28-star-trek-the-next-generation.md
|