get procedure for default excerpt separator for both cases site and page was
moved to the post's specific method :excerpt_separator.
This commit is contained in:
parent
54d0bf47e8
commit
a0f2b5f944
|
@ -105,10 +105,7 @@ module Jekyll
|
|||
#
|
||||
# Returns excerpt String
|
||||
def extract_excerpt(post_content)
|
||||
separator = !post.excerpt_separator.empty? &&
|
||||
post.excerpt_separator ||
|
||||
site.config['excerpt_separator']
|
||||
head, _, tail = post_content.to_s.partition(separator)
|
||||
head, _, tail = post_content.to_s.partition(post.excerpt_separator)
|
||||
|
||||
"" << head << "\n\n" << tail.scan(/^\[[^\]]+\]:.+$/).join("\n")
|
||||
end
|
||||
|
|
|
@ -119,11 +119,12 @@ module Jekyll
|
|||
data.fetch('title') { titleized_slug }
|
||||
end
|
||||
|
||||
# Public: the Post excerpt_separator, from the YAML Front-Matter or empty string
|
||||
# Public: the Post excerpt_separator, from the YAML Front-Matter or site default
|
||||
# excerpt_separator value
|
||||
#
|
||||
# Returns the post excerpt_separator
|
||||
def excerpt_separator
|
||||
data.fetch('excerpt_separator') { "" }
|
||||
data.fetch('excerpt_separator') { site.config['excerpt_separator'].to_s }
|
||||
end
|
||||
|
||||
# Turns the post slug into a suitable title
|
||||
|
@ -315,7 +316,7 @@ module Jekyll
|
|||
end
|
||||
|
||||
def generate_excerpt?
|
||||
!site.config['excerpt_separator'].to_s.empty? || !excerpt_separator.empty?
|
||||
!excerpt_separator.empty?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue