From 248a954d477d1c5216f6b42b5cc51dc38562e0d5 Mon Sep 17 00:00:00 2001 From: Jordy Rose Date: Wed, 25 Apr 2012 17:31:32 -0400 Subject: [PATCH] Compound post files don't end up exactly parallel to their original location. --- _plugins/post_directories.rb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/_plugins/post_directories.rb b/_plugins/post_directories.rb index beedf76..129c8da 100644 --- a/_plugins/post_directories.rb +++ b/_plugins/post_directories.rb @@ -71,6 +71,15 @@ def process(name) end end + class CompoundPostResource < StaticFile + def destination(dest) + base_post = @site.shadowbox_dirposts_rewritten_dirs[File.dirname(@name)] + raise FatalException.new("Cannot have post resources without a primary post: " + @shadowbox_dirposts_id) if base_post.nil? + + File.join(dest, base_post.url, File.basename(@name)) + end + end + class Site def shadowbox_dirposts_rewritten_dirs @shadowbox_dirposts_rewritten_dirs = {} if not @shadowbox_dirposts_rewritten_dirs @@ -88,8 +97,8 @@ def read_posts(dir) # can be loaded before the base post (index). next unless p.published if p.data.empty? - # StaticFile never reads the files into memory. - static_files << StaticFile.new(self, self.source, posts_path, p.name) + # Don't read the file into memory. + static_files << CompoundPostResource.new(self, self.source, posts_path, p.name) else pages << p end