Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added henrik's multiviews feature to jekyll 0.10.0 and before_fold.

  • Loading branch information...
commit b943d45e8f1f45351a0121dfb734762e8888abeb 1 parent 13df722
@stammy authored
View
8 bin/jekyll
@@ -72,6 +72,14 @@ opts = OptionParser.new do |opts|
options['permalink'] = style unless style.nil?
end
+ opts.on("--multiviews", "Don't use .html in links since Apache has 'Options +MultiViews'") do |style|
+ options['multiviews'] = true
+ end
+
+ opts.on("--sass", "Use Sass from haml gem for CSS generation") do
+ options['sass'] = true
+ end
+
opts.on("--paginate [POSTS_PER_PAGE]", "Paginate a blog's posts") do |per_page|
begin
options['paginate'] = per_page.to_i
View
8 lib/jekyll/filters.rb
@@ -4,6 +4,7 @@ module Jekyll
module Filters
def textilize(input)
+ #RedCloth.new(input).to_html
TextileConverter.new.convert(input)
end
@@ -34,6 +35,13 @@ def uri_escape(input)
def number_of_words(input)
input.split.length
end
+
+ # Returns all content before the first-encountered WP-style MORE tag.
+ # Allows authors to mark the fold with an <!--more--> in their drafts.
+ # e.g. {{ content | before_fold }}
+ def before_fold(input)
+ input.split("<!--more-->").first
+ end
def array_to_sentence_string(array)
connector = "and"
View
17 lib/jekyll/post.rb
@@ -87,7 +87,7 @@ def process(name)
#
# Returns <String>
def dir
- File.dirname(url)
+ File.dirname(generated_path)
end
# The full path and filename of the post.
@@ -116,10 +116,10 @@ def template
# e.g. /2008/11/05/my-awesome-post.html
#
# Returns <String>
- def url
+ def generated_path
return permalink if permalink
- @url ||= {
+ @generated_path ||= {
"year" => date.strftime("%Y"),
"month" => date.strftime("%m"),
"day" => date.strftime("%d"),
@@ -132,6 +132,14 @@ def url
result.gsub(/:#{Regexp.escape token.first}/, token.last)
}.gsub(/\/\//, "/")
end
+
+ # The generated relative url of this post
+ # e.g. /2008/11/05/my-awesome-post
+ #
+ # Returns <String>
+ def url
+ site.config['multiviews'] ? generated_path.sub(/\.html$/, '') : generated_path
+ end
# The UID for this post (useful in feeds)
# e.g. /2008/11/05/my-awesome-post
@@ -184,7 +192,7 @@ def render(layouts, site_payload)
# Returns destination file path.
def destination(dest)
# The url needs to be unescaped in order to preserve the correct filename
- path = File.join(dest, CGI.unescape(self.url))
+ path = File.join(dest, CGI.unescape(self.generated_path))
path = File.join(path, "index.html") if template[/\.html$/].nil?
path
end
@@ -211,6 +219,7 @@ def to_liquid
"date" => self.date,
"id" => self.id,
"categories" => self.categories,
+ "folded" => (self.content.match("<!--more-->") ? true : false),
"next" => self.next,
"previous" => self.previous,
"tags" => self.tags,
View
3  lib/jekyll/site.rb
@@ -47,7 +47,7 @@ def reset
def setup
require 'classifier' if self.lsi
-
+
# If safe mode is off, load in any ruby files under the plugins
# directory.
unless self.safe
@@ -228,6 +228,7 @@ def read_directories(dir = '')
end
end
end
+
# Constructs a hash map of Posts indexed by the specified Post attribute
#
Please sign in to comment.
Something went wrong with that request. Please try again.