lib/octopress-ink/assets/page.rb in octopress-ink-1.0.0.rc.11 vs lib/octopress-ink/assets/page.rb in octopress-ink-1.0.0.rc.13
- old
+ new
@@ -19,17 +19,30 @@
end
# Add page to Jekyll pages if no other page has a conflicting destination
#
def add
- if page.url && !Ink.config['docs_mode']
- Ink.site.pages << page unless Helpers::Path.find_page(page)
+ if page.url && !Octopress.config['docs_mode']
+ Octopress.site.pages << page unless find_page(page)
end
end
+ def find_page(page)
+ site_dir = Octopress.site.config['destination']
+ dest = page.destination(site_dir)
+
+ Octopress.site.pages.clone.each do |p|
+ return p if p.destination(site_dir) == dest
+ end
+ return false
+ end
+
def page
- @page ||= Page.new(Ink.site, source_dir, page_dir, file, plugin.config)
+ unless @page
+ @page = Page.new(Octopress.site, source_dir, page_dir, file, plugin.config)
+ end
+ @page
end
def info
message = super
message.ljust(25) + url_info
@@ -48,10 +61,10 @@
def url_info
"/#{page.url.sub(/^\//,'')}"
end
def user_dir
- File.join Ink.site.source, Plugins.custom_dir, plugin.slug, base
+ File.join Octopress.site.source, Plugins.custom_dir, plugin.slug, base
end
end
end
end