Created
February 8, 2013 13:34
-
-
Save pragtich/4739071 to your computer and use it in GitHub Desktop.
Diff for postfiles.rb to work with categories containing spaces [Raw diff](https://github.com/pragtich/jekyll-postfiles/commit/ec519615501cbbc6d603854eaa463f1f9e0fe777/postfiles.rb.diff)
[Commit](https://github.com/pragtich/jekyll-postfiles/commit/ec519615501cbbc6d603854eaa463f1f9e0fe777.diff)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/_plugins/postfiles.rb b/_plugins/postfiles.rb | |
index 08c60bf..ce79b55 100644 | |
--- a/_plugins/postfiles.rb | |
+++ b/_plugins/postfiles.rb | |
@@ -20,13 +20,13 @@ def generate(site) | |
site.posts.each do |post| | |
# Go back to the single-file post name | |
- postfile_id = post.id.gsub(/[\s\w\/]*(\d{4})\/(\d\d)\/(\d\d)\/(.*)/, '\1-\2-\3-\4') | |
+ postfile_id = post.id.gsub(/[\s\w\/%]*(\d{4})\/(\d\d)\/(\d\d)\/(.*)/, '\1-\2-\3-\4') | |
# Get the directory that files from this post would be in | |
postfile_dir = File.join(site.config['source'], '_postfiles', postfile_id) | |
# Add a static file entry for each postfile, if any | |
Dir[File.join(postfile_dir, '/*')].each do |pf| | |
- site.static_files << PostFile.new(site, postfile_dir, post.url, File.basename(pf)) | |
+ site.static_files << PostFile.new(site, postfile_dir, CGI.unescape(post.url), File.basename(pf)) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment