jekyll 3.0.0.pre.beta10 → 3.0.0.pre.rc1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of jekyll might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/lib/jekyll.rb +1 -3
- data/lib/jekyll/cleaner.rb +3 -2
- data/lib/jekyll/collection.rb +20 -2
- data/lib/jekyll/command.rb +1 -1
- data/lib/jekyll/commands/build.rb +2 -2
- data/lib/jekyll/configuration.rb +36 -5
- data/lib/jekyll/convertible.rb +13 -10
- data/lib/jekyll/document.rb +173 -17
- data/lib/jekyll/excerpt.rb +45 -33
- data/lib/jekyll/hooks.rb +9 -7
- data/lib/jekyll/page.rb +1 -1
- data/lib/jekyll/publisher.rb +2 -2
- data/lib/jekyll/reader.rb +4 -4
- data/lib/jekyll/readers/collection_reader.rb +4 -2
- data/lib/jekyll/readers/post_reader.rb +35 -10
- data/lib/jekyll/regenerator.rb +4 -4
- data/lib/jekyll/related_posts.rb +3 -3
- data/lib/jekyll/renderer.rb +12 -2
- data/lib/jekyll/site.rb +16 -13
- data/lib/jekyll/tags/post_url.rb +4 -4
- data/lib/jekyll/utils.rb +12 -7
- data/lib/jekyll/version.rb +1 -1
- data/lib/site_template/_includes/footer.html +2 -19
- data/lib/site_template/_includes/icon-github.html +1 -0
- data/lib/site_template/_includes/icon-github.svg +1 -0
- data/lib/site_template/_includes/icon-twitter.html +1 -0
- data/lib/site_template/_includes/icon-twitter.svg +1 -0
- data/lib/site_template/_sass/_layout.scss +1 -0
- data/lib/site_template/_sass/_syntax-highlighting.scss +4 -0
- data/lib/site_template/about.md +6 -2
- data/lib/site_template/css/main.scss +1 -1
- metadata +6 -5
- data/lib/jekyll/draft.rb +0 -40
- data/lib/jekyll/post.rb +0 -334
- data/lib/jekyll/readers/draft_reader.rb +0 -37
data/lib/jekyll/excerpt.rb
CHANGED
@@ -2,46 +2,43 @@ require 'forwardable'
|
|
2
2
|
|
3
3
|
module Jekyll
|
4
4
|
class Excerpt
|
5
|
-
include Convertible
|
6
5
|
extend Forwardable
|
7
6
|
|
8
|
-
attr_accessor :
|
9
|
-
attr_accessor :content, :
|
7
|
+
attr_accessor :doc
|
8
|
+
attr_accessor :content, :ext
|
9
|
+
attr_writer :output
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
def_delegator :@post, :ext, :ext
|
11
|
+
def_delegators :@doc, :site, :name, :ext, :relative_path, :extname,
|
12
|
+
:render_with_liquid?, :collection, :related_posts
|
14
13
|
|
15
|
-
# Initialize this
|
14
|
+
# Initialize this Excerpt instance.
|
16
15
|
#
|
17
|
-
#
|
18
|
-
# base - The String path to the dir containing the post file.
|
19
|
-
# name - The String filename of the post file.
|
16
|
+
# doc - The Document.
|
20
17
|
#
|
21
|
-
# Returns the new
|
22
|
-
def initialize(
|
23
|
-
self.
|
24
|
-
self.content = extract_excerpt(
|
18
|
+
# Returns the new Excerpt.
|
19
|
+
def initialize(doc)
|
20
|
+
self.doc = doc
|
21
|
+
self.content = extract_excerpt(doc.content)
|
25
22
|
end
|
26
23
|
|
27
|
-
|
28
|
-
post.to_liquid(post.class::EXCERPT_ATTRIBUTES_FOR_LIQUID)
|
29
|
-
end
|
30
|
-
|
31
|
-
# Fetch YAML front-matter data from related post, without layout key
|
24
|
+
# Fetch YAML front-matter data from related doc, without layout key
|
32
25
|
#
|
33
|
-
# Returns Hash of
|
26
|
+
# Returns Hash of doc data
|
34
27
|
def data
|
35
|
-
@data ||=
|
28
|
+
@data ||= doc.data.dup
|
36
29
|
@data.delete("layout")
|
30
|
+
@data.delete("excerpt")
|
37
31
|
@data
|
38
32
|
end
|
39
33
|
|
34
|
+
def trigger_hooks(*)
|
35
|
+
end
|
36
|
+
|
40
37
|
# 'Path' of the excerpt.
|
41
38
|
#
|
42
|
-
# Returns the path for the
|
39
|
+
# Returns the path for the doc this excerpt belongs to with #excerpt appended
|
43
40
|
def path
|
44
|
-
File.join(
|
41
|
+
File.join(doc.path, "#excerpt")
|
45
42
|
end
|
46
43
|
|
47
44
|
# Check if excerpt includes a string
|
@@ -51,28 +48,43 @@ module Jekyll
|
|
51
48
|
(output && output.include?(something)) || content.include?(something)
|
52
49
|
end
|
53
50
|
|
54
|
-
# The UID for this
|
55
|
-
# e.g. /2008/11/05/my-awesome-
|
51
|
+
# The UID for this doc (useful in feeds).
|
52
|
+
# e.g. /2008/11/05/my-awesome-doc
|
56
53
|
#
|
57
54
|
# Returns the String UID.
|
58
55
|
def id
|
59
|
-
|
56
|
+
"#{doc.id}#excerpt"
|
60
57
|
end
|
61
58
|
|
62
59
|
def to_s
|
63
60
|
output || content
|
64
61
|
end
|
65
62
|
|
66
|
-
|
63
|
+
def to_liquid
|
64
|
+
doc.data['excerpt'] = nil
|
65
|
+
@to_liquid ||= doc.to_liquid
|
66
|
+
doc.data['excerpt'] = self
|
67
|
+
@to_liquid
|
68
|
+
end
|
69
|
+
|
70
|
+
# Returns the shorthand String identifier of this doc.
|
67
71
|
def inspect
|
68
72
|
"<Excerpt: #{self.id}>"
|
69
73
|
end
|
70
74
|
|
75
|
+
def output
|
76
|
+
@output ||= Renderer.new(doc.site, self, site.site_payload).run
|
77
|
+
end
|
78
|
+
|
79
|
+
def place_in_layout?
|
80
|
+
false
|
81
|
+
end
|
82
|
+
|
71
83
|
protected
|
72
84
|
|
73
85
|
# Internal: Extract excerpt from the content
|
74
86
|
#
|
75
|
-
# By default excerpt is your first paragraph of a
|
87
|
+
# By default excerpt is your first paragraph of a doc: everything before
|
76
88
|
# the first two new lines:
|
77
89
|
#
|
78
90
|
# ---
|
@@ -86,16 +98,16 @@ module Jekyll
|
|
86
98
|
# [1]: http://example.com/
|
87
99
|
#
|
88
100
|
# This is fairly good option for Markdown and Textile files. But might cause
|
89
|
-
# problems for HTML
|
101
|
+
# problems for HTML docs (which is quite unusual for Jekyll). If default
|
90
102
|
# excerpt delimiter is not good for you, you might want to set your own via
|
91
103
|
# configuration option `excerpt_separator`. For example, following is a good
|
92
|
-
# alternative for HTML
|
104
|
+
# alternative for HTML docs:
|
93
105
|
#
|
94
106
|
# # file: _config.yml
|
95
107
|
# excerpt_separator: "<!-- more -->"
|
96
108
|
#
|
97
109
|
# Notice that all markdown-style link references will be appended to the
|
98
|
-
# excerpt. So the example
|
110
|
+
# excerpt. So the example doc above will have this excerpt source:
|
99
111
|
#
|
100
112
|
# First paragraph with [link][1].
|
101
113
|
#
|
@@ -104,8 +116,8 @@ module Jekyll
|
|
104
116
|
# Excerpts are rendered same time as content is rendered.
|
105
117
|
#
|
106
118
|
# Returns excerpt String
|
107
|
-
def extract_excerpt(
|
108
|
-
head, _, tail =
|
119
|
+
def extract_excerpt(doc_content)
|
120
|
+
head, _, tail = doc_content.to_s.partition(doc.excerpt_separator)
|
109
121
|
|
110
122
|
if tail.empty?
|
111
123
|
head
|
data/lib/jekyll/hooks.rb
CHANGED
@@ -17,19 +17,19 @@ module Jekyll
|
|
17
17
|
pre_render: [],
|
18
18
|
post_write: [],
|
19
19
|
},
|
20
|
-
:
|
20
|
+
:pages => {
|
21
21
|
post_init: [],
|
22
22
|
pre_render: [],
|
23
23
|
post_render: [],
|
24
24
|
post_write: [],
|
25
25
|
},
|
26
|
-
:
|
26
|
+
:posts => {
|
27
27
|
post_init: [],
|
28
28
|
pre_render: [],
|
29
29
|
post_render: [],
|
30
30
|
post_write: [],
|
31
31
|
},
|
32
|
-
:
|
32
|
+
:documents => {
|
33
33
|
pre_render: [],
|
34
34
|
post_render: [],
|
35
35
|
post_write: [],
|
@@ -57,10 +57,12 @@ module Jekyll
|
|
57
57
|
|
58
58
|
# register a single hook to be called later, internal API
|
59
59
|
def self.register_one(owner, event, priority, &block)
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
60
|
+
@registry[owner] ||={
|
61
|
+
post_init: [],
|
62
|
+
pre_render: [],
|
63
|
+
post_render: [],
|
64
|
+
post_write: [],
|
65
|
+
}
|
64
66
|
|
65
67
|
unless @registry[owner][event]
|
66
68
|
raise NotAvailable, "Invalid hook. #{owner} supports only the " <<
|
data/lib/jekyll/page.rb
CHANGED
@@ -36,7 +36,7 @@ module Jekyll
|
|
36
36
|
site.frontmatter_defaults.find(File.join(dir, name), type, key)
|
37
37
|
end
|
38
38
|
|
39
|
-
Jekyll::Hooks.trigger :
|
39
|
+
Jekyll::Hooks.trigger :pages, :post_init, self
|
40
40
|
end
|
41
41
|
|
42
42
|
# The generated directory into which the page will be placed
|
data/lib/jekyll/publisher.rb
CHANGED
data/lib/jekyll/reader.rb
CHANGED
@@ -22,12 +22,12 @@ module Jekyll
|
|
22
22
|
|
23
23
|
# Sorts posts, pages, and static files.
|
24
24
|
def sort_files!
|
25
|
-
site.
|
25
|
+
site.collections.values.each{|c| c.docs.sort!}
|
26
26
|
site.pages.sort_by!(&:name)
|
27
27
|
site.static_files.sort_by!(&:relative_path)
|
28
28
|
end
|
29
29
|
|
30
|
-
# Recursively traverse directories to find
|
30
|
+
# Recursively traverse directories to find pages and static files
|
31
31
|
# that will become part of the site according to the rules in
|
32
32
|
# filter_entries.
|
33
33
|
#
|
@@ -56,8 +56,8 @@ module Jekyll
|
|
56
56
|
#
|
57
57
|
# Returns nothing.
|
58
58
|
def retrieve_posts(dir)
|
59
|
-
site.posts.concat(PostReader.new(site).
|
60
|
-
site.posts.concat(
|
59
|
+
site.posts.docs.concat(PostReader.new(site).read_posts(dir))
|
60
|
+
site.posts.docs.concat(PostReader.new(site).read_drafts(dir)) if site.show_drafts
|
61
61
|
end
|
62
62
|
|
63
63
|
# Recursively traverse directories with the read_directories function.
|
@@ -1,5 +1,7 @@
|
|
1
1
|
module Jekyll
|
2
2
|
class CollectionReader
|
3
|
+
SPECIAL_COLLECTIONS = %w{posts data}.freeze
|
4
|
+
|
3
5
|
attr_reader :site, :content
|
4
6
|
def initialize(site)
|
5
7
|
@site = site
|
@@ -11,9 +13,9 @@ module Jekyll
|
|
11
13
|
# Returns nothing.
|
12
14
|
def read
|
13
15
|
site.collections.each do |_, collection|
|
14
|
-
collection.read unless collection.label
|
16
|
+
collection.read unless SPECIAL_COLLECTIONS.include?(collection.label)
|
15
17
|
end
|
16
18
|
end
|
17
19
|
|
18
20
|
end
|
19
|
-
end
|
21
|
+
end
|
@@ -3,18 +3,40 @@ module Jekyll
|
|
3
3
|
attr_reader :site, :unfiltered_content
|
4
4
|
def initialize(site)
|
5
5
|
@site = site
|
6
|
-
@unfiltered_content = Array.new
|
7
6
|
end
|
8
7
|
|
9
|
-
# Read all the files in <source>/<dir>/
|
8
|
+
# Read all the files in <source>/<dir>/_drafts and create a new
|
9
|
+
# Document object with each one.
|
10
|
+
#
|
11
|
+
# dir - The String relative path of the directory to read.
|
12
|
+
#
|
13
|
+
# Returns nothing.
|
14
|
+
def read_drafts(dir)
|
15
|
+
read_publishable(dir, '_drafts', Document::DATELESS_FILENAME_MATCHER)
|
16
|
+
end
|
17
|
+
|
18
|
+
# Read all the files in <source>/<dir>/_posts and create a new Document
|
10
19
|
# object with each one.
|
11
20
|
#
|
12
21
|
# dir - The String relative path of the directory to read.
|
13
22
|
#
|
14
23
|
# Returns nothing.
|
15
|
-
def
|
16
|
-
|
17
|
-
|
24
|
+
def read_posts(dir)
|
25
|
+
read_publishable(dir, '_posts', Document::DATE_FILENAME_MATCHER)
|
26
|
+
end
|
27
|
+
|
28
|
+
# Read all the files in <source>/<dir>/<magic_dir> and create a new
|
29
|
+
# Document object with each one insofar as it matches the regexp matcher.
|
30
|
+
#
|
31
|
+
# dir - The String relative path of the directory to read.
|
32
|
+
#
|
33
|
+
# Returns nothing.
|
34
|
+
def read_publishable(dir, magic_dir, matcher)
|
35
|
+
read_content(dir, magic_dir, matcher).tap do |docs|
|
36
|
+
docs.each(&:read)
|
37
|
+
end.select do |doc|
|
38
|
+
site.publisher.publish?(doc)
|
39
|
+
end
|
18
40
|
end
|
19
41
|
|
20
42
|
# Read all the content files from <source>/<dir>/magic_dir
|
@@ -26,12 +48,15 @@ module Jekyll
|
|
26
48
|
# klass - The return type of the content.
|
27
49
|
#
|
28
50
|
# Returns klass type of content files
|
29
|
-
def read_content(dir, magic_dir)
|
51
|
+
def read_content(dir, magic_dir, matcher)
|
30
52
|
@site.reader.get_entries(dir, magic_dir).map do |entry|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
53
|
+
next unless entry =~ matcher
|
54
|
+
path = @site.in_source_dir(File.join(dir, magic_dir, entry))
|
55
|
+
Document.new(path, {
|
56
|
+
site: @site,
|
57
|
+
collection: @site.posts
|
58
|
+
})
|
59
|
+
end.reject(&:nil?)
|
35
60
|
end
|
36
61
|
end
|
37
62
|
end
|
data/lib/jekyll/regenerator.rb
CHANGED
@@ -17,8 +17,8 @@ module Jekyll
|
|
17
17
|
# Returns a boolean.
|
18
18
|
def regenerate?(document)
|
19
19
|
case document
|
20
|
-
when
|
21
|
-
document.asset_file? || document.data['regenerate'] ||
|
20
|
+
when Page
|
21
|
+
document.asset_file? || document.data['regenerate'] ||
|
22
22
|
source_modified_or_dest_missing?(
|
23
23
|
site.in_source_dir(document.relative_path), document.destination(@site.dest)
|
24
24
|
)
|
@@ -87,7 +87,7 @@ module Jekyll
|
|
87
87
|
return true if disabled?
|
88
88
|
|
89
89
|
# objects that don't have a path are always regenerated
|
90
|
-
return true if path.nil?
|
90
|
+
return true if path.nil?
|
91
91
|
|
92
92
|
# Check for path in cache
|
93
93
|
if cache.has_key? path
|
@@ -144,7 +144,7 @@ module Jekyll
|
|
144
144
|
#
|
145
145
|
# Returns a Boolean (true for disabled, false for enabled).
|
146
146
|
def disabled?
|
147
|
-
@disabled = site.
|
147
|
+
@disabled = !site.incremental? if @disabled.nil?
|
148
148
|
@disabled
|
149
149
|
end
|
150
150
|
|
data/lib/jekyll/related_posts.rb
CHANGED
@@ -14,7 +14,7 @@ module Jekyll
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def build
|
17
|
-
return [] unless site.posts.size > 1
|
17
|
+
return [] unless site.posts.docs.size > 1
|
18
18
|
|
19
19
|
if site.lsi
|
20
20
|
build_index
|
@@ -30,7 +30,7 @@ module Jekyll
|
|
30
30
|
lsi = ClassifierReborn::LSI.new(:auto_rebuild => false)
|
31
31
|
display("Populating LSI...")
|
32
32
|
|
33
|
-
site.posts.each do |x|
|
33
|
+
site.posts.docs.each do |x|
|
34
34
|
lsi.add_item(x)
|
35
35
|
end
|
36
36
|
|
@@ -46,7 +46,7 @@ module Jekyll
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def most_recent_posts
|
49
|
-
@most_recent_posts ||= (site.posts.reverse - [post]).first(10)
|
49
|
+
@most_recent_posts ||= (site.posts.docs.reverse - [post]).first(10)
|
50
50
|
end
|
51
51
|
|
52
52
|
def display(output)
|
data/lib/jekyll/renderer.rb
CHANGED
@@ -23,7 +23,7 @@ module Jekyll
|
|
23
23
|
#
|
24
24
|
# Returns the output extname including the leading period.
|
25
25
|
def output_ext
|
26
|
-
converters.first.output_ext(document.extname)
|
26
|
+
@output_ext ||= converters.first.output_ext(document.extname)
|
27
27
|
end
|
28
28
|
|
29
29
|
######################
|
@@ -31,11 +31,18 @@ module Jekyll
|
|
31
31
|
######################
|
32
32
|
|
33
33
|
def run
|
34
|
+
Jekyll.logger.debug "Rendering:", document.relative_path
|
35
|
+
|
34
36
|
payload = Utils.deep_merge_hashes({
|
35
37
|
"page" => document.to_liquid
|
36
38
|
}, site_payload || site.site_payload)
|
37
39
|
|
38
|
-
|
40
|
+
if document.collection.label == 'posts' && document.is_a?(Document)
|
41
|
+
payload['site']['related_posts'] = document.related_posts
|
42
|
+
end
|
43
|
+
|
44
|
+
Jekyll.logger.debug "Pre-Render Hooks:", document.relative_path
|
45
|
+
document.trigger_hooks(:pre_render, payload)
|
39
46
|
|
40
47
|
info = {
|
41
48
|
filters: [Jekyll::Filters],
|
@@ -49,13 +56,16 @@ module Jekyll
|
|
49
56
|
output = document.content
|
50
57
|
|
51
58
|
if document.render_with_liquid?
|
59
|
+
Jekyll.logger.debug "Rendering Liquid:", document.relative_path
|
52
60
|
output = render_liquid(output, payload, info, document.path)
|
53
61
|
end
|
54
62
|
|
63
|
+
Jekyll.logger.debug "Rendering Markup:", document.relative_path
|
55
64
|
output = convert(output)
|
56
65
|
document.content = output
|
57
66
|
|
58
67
|
if document.place_in_layout?
|
68
|
+
Jekyll.logger.debug "Rendering Layout:", document.relative_path
|
59
69
|
place_in_layouts(
|
60
70
|
output,
|
61
71
|
payload,
|
data/lib/jekyll/site.rb
CHANGED
@@ -4,7 +4,7 @@ require 'csv'
|
|
4
4
|
module Jekyll
|
5
5
|
class Site
|
6
6
|
attr_reader :source, :dest, :config
|
7
|
-
attr_accessor :layouts, :
|
7
|
+
attr_accessor :layouts, :pages, :static_files, :drafts,
|
8
8
|
:exclude, :include, :lsi, :highlighter, :permalink_style,
|
9
9
|
:time, :future, :unpublished, :safe, :plugins, :limit_posts,
|
10
10
|
:show_drafts, :keep_files, :baseurl, :data, :file_read_opts,
|
@@ -74,7 +74,6 @@ module Jekyll
|
|
74
74
|
def reset
|
75
75
|
self.time = (config['time'] ? Utils.parse_date(config['time'].to_s, "Invalid time in _config.yml.") : Time.now)
|
76
76
|
self.layouts = {}
|
77
|
-
self.posts = []
|
78
77
|
self.pages = []
|
79
78
|
self.static_files = []
|
80
79
|
self.data = {}
|
@@ -170,14 +169,14 @@ module Jekyll
|
|
170
169
|
collection.docs.each do |document|
|
171
170
|
if regenerator.regenerate?(document)
|
172
171
|
document.output = Jekyll::Renderer.new(self, document, payload).run
|
173
|
-
|
172
|
+
document.trigger_hooks(:post_render)
|
174
173
|
end
|
175
174
|
end
|
176
175
|
end
|
177
176
|
|
178
|
-
|
179
|
-
if regenerator.regenerate?(
|
180
|
-
|
177
|
+
pages.flatten.each do |page|
|
178
|
+
if regenerator.regenerate?(page)
|
179
|
+
page.render(layouts, payload)
|
181
180
|
end
|
182
181
|
end
|
183
182
|
rescue Errno::ENOENT
|
@@ -202,6 +201,10 @@ module Jekyll
|
|
202
201
|
Jekyll::Hooks.trigger :site, :post_write, self
|
203
202
|
end
|
204
203
|
|
204
|
+
def posts
|
205
|
+
collections['posts'] ||= Collection.new(self, 'posts')
|
206
|
+
end
|
207
|
+
|
205
208
|
# Construct a Hash of Posts indexed by the specified Post attribute.
|
206
209
|
#
|
207
210
|
# post_attr - The String name of the Post attribute.
|
@@ -219,7 +222,7 @@ module Jekyll
|
|
219
222
|
# Build a hash map based on the specified post attribute ( post attr =>
|
220
223
|
# array of posts ) then sort each array in reverse order.
|
221
224
|
hash = Hash.new { |h, key| h[key] = [] }
|
222
|
-
posts.each { |p| p.
|
225
|
+
posts.docs.each { |p| p.data[post_attr].each { |t| hash[t] << p } }
|
223
226
|
hash.values.each { |posts| posts.sort!.reverse! }
|
224
227
|
hash
|
225
228
|
end
|
@@ -262,7 +265,7 @@ module Jekyll
|
|
262
265
|
"site" => Utils.deep_merge_hashes(config,
|
263
266
|
Utils.deep_merge_hashes(Hash[collections.map{|label, coll| [label, coll.docs]}], {
|
264
267
|
"time" => time,
|
265
|
-
"posts" => posts.sort { |a, b| b <=> a },
|
268
|
+
"posts" => posts.docs.sort { |a, b| b <=> a },
|
266
269
|
"pages" => pages,
|
267
270
|
"static_files" => static_files,
|
268
271
|
"html_pages" => pages.select { |page| page.html? || page.url.end_with?("/") },
|
@@ -330,7 +333,7 @@ module Jekyll
|
|
330
333
|
end
|
331
334
|
|
332
335
|
def each_site_file
|
333
|
-
%w(
|
336
|
+
%w(pages static_files docs_to_write).each do |type|
|
334
337
|
send(type).each do |item|
|
335
338
|
yield item
|
336
339
|
end
|
@@ -348,8 +351,8 @@ module Jekyll
|
|
348
351
|
# Whether to perform a full rebuild without incremental regeneration
|
349
352
|
#
|
350
353
|
# Returns a Boolean: true for a full rebuild, false for normal build
|
351
|
-
def
|
352
|
-
override['
|
354
|
+
def incremental?(override = {})
|
355
|
+
override['incremental'] || config['incremental']
|
353
356
|
end
|
354
357
|
|
355
358
|
# Returns the publisher or creates a new publisher if it doesn't
|
@@ -391,8 +394,8 @@ module Jekyll
|
|
391
394
|
# Returns nothing
|
392
395
|
def limit_posts!
|
393
396
|
if limit_posts > 0
|
394
|
-
limit = posts.length < limit_posts ? posts.length : limit_posts
|
395
|
-
self.posts = posts[-limit, limit]
|
397
|
+
limit = posts.docs.length < limit_posts ? posts.docs.length : limit_posts
|
398
|
+
self.posts.docs = posts.docs[-limit, limit]
|
396
399
|
end
|
397
400
|
end
|
398
401
|
|