lib/octopress/docs/doc.rb in octopress-3.0.0.rc.24 vs lib/octopress/docs/doc.rb in octopress-3.0.0.rc.25
- old
+ new
@@ -1,21 +1,23 @@
module Octopress
module Docs
class Doc
- attr_reader :filename, :plugin_name, :plugin_slug, :base_url, :plugin_type, :description, :source_url
+ attr_reader :filename, :name, :slug, :base_url, :type, :description, :source_url, :version, :gem
def initialize(options={})
@file = options[:file]
@path = options[:path] ||= '.'
@file_dir = File.dirname(@file)
- @plugin_name = options[:name]
- @plugin_slug = options[:slug]
- @plugin_type = options[:type]
+ @name = options[:name]
+ @slug = options[:slug]
+ @type = options[:type]
@base_url = options[:base_url]
@source_url = options[:source_url]
@description = options[:description]
@data = options[:data] || {}
+ @gem = options[:gem]
+ @version = options[:version]
end
# Add doc page to Jekyll pages
#
def add
@@ -39,16 +41,18 @@
p = Octopress::Docs::Page.new(Octopress.site, @path, page_dir, file, {'path'=>@base_url})
p.data['layout'] = 'docs'
p.data['escape_code'] = true
p.data['plugin'] = {
- 'name' => @plugin_name,
- 'slug' => @plugin_slug,
- 'type' => @plugin_type,
+ 'name' => @name,
+ 'slug' => @slug,
+ 'type' => @type,
'source_url' => @source_url,
'description' => @description,
- 'url' => @base_url
+ 'url' => @base_url,
+ 'version' => @version,
+ 'gem' => @gem,
}
p.data['dir'] = doc_dir
p.data = @data.merge(p.data)
p.data.merge!(comment_yaml(p.content))
@@ -65,10 +69,10 @@
def read
File.open(File.join(@path, @file)).read
end
def plugin_slug
- Jekyll::Utils.slugify(@plugin_type == 'theme' ? 'theme' : @plugin_slug)
+ Jekyll::Utils.slugify(@type == 'theme' ? 'theme' : @slug)
end
def page_dir
@file_dir == '.' ? '' : @file_dir
end