Skip to content

Commit

Permalink
Compound post files don't end up exactly parallel to their original l…
Browse files Browse the repository at this point in the history
…ocation.
  • Loading branch information
belkadan committed Apr 25, 2012
1 parent ed2a31b commit 248a954
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions _plugins/post_directories.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 248a954

Please sign in to comment.