alula 0.4.14 → 0.4.15
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/alula/cli.rb +1 -1
- data/lib/alula/generators/archive.rb +8 -20
- data/lib/alula/generators/paginate.rb +3 -19
- data/lib/alula/site.rb +1 -0
- data/lib/alula/version.rb +1 -1
- metadata +2 -2
data/lib/alula/cli.rb
CHANGED
@@ -18,9 +18,11 @@ module Alula
|
|
18
18
|
options.templates.collect do |template|
|
19
19
|
posts.collect do |post|
|
20
20
|
archives[post.substitude(template, lang)] ||= {}
|
21
|
-
|
22
|
-
|
23
|
-
archives[post.substitude(template, lang)][:
|
21
|
+
title_key = "archive.title." + template.scan(/:(\w+)*/).flatten.join('-')
|
22
|
+
description_key = "archive.description." + template.scan(/:(\w+)*/).flatten.join('-')
|
23
|
+
archives[post.substitude(template, lang)][:title] ||= I18n.t(title_key, Hash[post.substitutes(lang).map{|k,v|[k.to_sym,v]}].merge(locale: lang))
|
24
|
+
archives[post.substitude(template, lang)][:description] ||= I18n.t(description_key, Hash[post.substitutes(lang).map{|k,v|[k.to_sym,v]}].merge(locale: lang))
|
25
|
+
archives[post.substitude(template, lang)][:key] ||= title_key
|
24
26
|
archives[post.substitude(template, lang)][:content] ||= {}
|
25
27
|
archives[post.substitude(template, lang)][:content][lang] ||= []
|
26
28
|
archives[post.substitude(template, lang)][:content][lang] << post
|
@@ -32,7 +34,8 @@ module Alula
|
|
32
34
|
self.site.content.pages << Alula::Content::Page.new({
|
33
35
|
generator: self,
|
34
36
|
posts: archive[:content],
|
35
|
-
title: archive[:title]
|
37
|
+
title: archive[:title],
|
38
|
+
description: archive[:description],
|
36
39
|
name: name,
|
37
40
|
slug: name,
|
38
41
|
sidebar: false,
|
@@ -41,22 +44,7 @@ module Alula
|
|
41
44
|
view: "archive",
|
42
45
|
key: archive[:key],
|
43
46
|
},
|
44
|
-
|
45
|
-
# pos = self.navigation(locale).index(self)
|
46
|
-
# if pos and pos < (self.navigation(locale).count - 1)
|
47
|
-
# self.navigation(locale)[pos + 1]
|
48
|
-
# else
|
49
|
-
# nil
|
50
|
-
# end
|
51
|
-
# },
|
52
|
-
# :next => ->(hook, locale = nil) {
|
53
|
-
# pos = self.navigation(locale).index(self)
|
54
|
-
# if pos and pos > 0
|
55
|
-
# self.navigation(locale)[pos - 1]
|
56
|
-
# else
|
57
|
-
# nil
|
58
|
-
# end
|
59
|
-
# },
|
47
|
+
|
60
48
|
:navigation => ->(hook, locale = nil) {
|
61
49
|
locale ||= self.current_locale || self.site.config.locale
|
62
50
|
@navigation[locale] ||= self.site.content.pages.select { |item|
|
@@ -23,9 +23,8 @@ module Alula
|
|
23
23
|
[ lang, posts.slice(page * self.options.items, self.options.items) ]
|
24
24
|
end
|
25
25
|
]
|
26
|
-
titles = Hash[
|
27
|
-
|
28
|
-
]
|
26
|
+
titles = Hash[languages.collect {|lang, x| [lang, I18n.t("paginate.title", locale: lang, page: (page + 1))]}]
|
27
|
+
descriptions = Hash[languages.collect {|lang, x| [lang, I18n.t("paginate.description", locale: lang, page: (page + 1))]}]
|
29
28
|
|
30
29
|
self.site.content.pages << Alula::Content::Page.new({
|
31
30
|
generator: self,
|
@@ -33,6 +32,7 @@ module Alula
|
|
33
32
|
pagenum: (page + 1),
|
34
33
|
pages: (pages + 1),
|
35
34
|
title: titles,
|
35
|
+
description: descriptions,
|
36
36
|
name: "page-#{(page + 1)}",
|
37
37
|
slug: "page-#{(page + 1)}",
|
38
38
|
sidebar: false,
|
@@ -40,22 +40,6 @@ module Alula
|
|
40
40
|
site: self.site,
|
41
41
|
view: self.options.view || "paginate",
|
42
42
|
},
|
43
|
-
# :previous => ->(hook, locale = nil) {
|
44
|
-
# pos = self.navigation(locale).index(self)
|
45
|
-
# if pos and pos < (self.navigation(locale).count - 1)
|
46
|
-
# self.navigation(locale)[pos + 1]
|
47
|
-
# else
|
48
|
-
# nil
|
49
|
-
# end
|
50
|
-
# },
|
51
|
-
# :next => ->(hook, locale = nil) {
|
52
|
-
# pos = self.navigation(locale).index(self)
|
53
|
-
# if pos and pos > 0
|
54
|
-
# self.navigation(locale)[pos - 1]
|
55
|
-
# else
|
56
|
-
# nil
|
57
|
-
# end
|
58
|
-
# },
|
59
43
|
:navigation => ->(hook, locale = nil) {
|
60
44
|
locale ||= self.current_locale || self.site.config.locale
|
61
45
|
@navigation[locale] ||= self.site.content.pages.select { |item| item.metadata.generator == self.generator and item.languages.include?(locale) }
|
data/lib/alula/site.rb
CHANGED
@@ -277,6 +277,7 @@ module Alula
|
|
277
277
|
index_page.metadata.slug = "index"
|
278
278
|
index_page.metadata.template = "/:locale/:slug"
|
279
279
|
index_page.metadata.title = Hash[index_page.metadata.languages.collect{|lang| [lang, metadata.title(lang)]}]
|
280
|
+
index_page.metadata.description = Hash[index_page.metadata.languages.collect{|lang| [lang, metadata.description(lang)]}]
|
280
281
|
end
|
281
282
|
end
|
282
283
|
end
|
data/lib/alula/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alula
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.15
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-08-
|
12
|
+
date: 2012-08-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: hashie
|