From a0f2b5f944cee9648e5931bd6d2502ce74af6d84 Mon Sep 17 00:00:00 2001 From: Malo Skrylevo Date: Sat, 10 Jan 2015 03:58:02 +0300 Subject: [PATCH] get procedure for default excerpt separator for both cases site and page was moved to the post's specific method :excerpt_separator. --- lib/jekyll/excerpt.rb | 5 +---- lib/jekyll/post.rb | 7 ++++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/jekyll/excerpt.rb b/lib/jekyll/excerpt.rb index 6e328a30..347be217 100644 --- a/lib/jekyll/excerpt.rb +++ b/lib/jekyll/excerpt.rb @@ -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 diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index 89d1c01a..c94d66b6 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -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