Class: Octopress::Docs::Doc
- Inherits:
-
Object
- Object
- Octopress::Docs::Doc
- Defined in:
- lib/octopress-docs/doc.rb
Instance Attribute Summary collapse
-
#base_url ⇒ Object
readonly
Returns the value of attribute base_url.
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
-
#plugin_name ⇒ Object
readonly
Returns the value of attribute plugin_name.
Instance Method Summary collapse
-
#add ⇒ Object
Add doc page to Jekyll pages.
- #disabled? ⇒ Boolean
- #file ⇒ Object
- #info ⇒ Object
-
#initialize(options = {}) ⇒ Doc
constructor
A new instance of Doc.
- #page ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Doc
Returns a new instance of Doc.
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/octopress-docs/doc.rb', line 6 def initialize(={}) @file = [:file] @dir = [:dir] ||= '.' @file_dir = File.dirname(@file) @plugin_name = [:name] @plugin_slug = [:slug] @plugin_type = [:type] @base_url = [:base_url] @index = [:index] end |
Instance Attribute Details
#base_url ⇒ Object (readonly)
Returns the value of attribute base_url.
4 5 6 |
# File 'lib/octopress-docs/doc.rb', line 4 def base_url @base_url end |
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
4 5 6 |
# File 'lib/octopress-docs/doc.rb', line 4 def filename @filename end |
#plugin_name ⇒ Object (readonly)
Returns the value of attribute plugin_name.
4 5 6 |
# File 'lib/octopress-docs/doc.rb', line 4 def plugin_name @plugin_name end |
Instance Method Details
#add ⇒ Object
Add doc page to Jekyll pages
19 20 21 22 23 |
# File 'lib/octopress-docs/doc.rb', line 19 def add if Octopress.config['docs_mode'] Octopress.site.pages << page end end |
#disabled? ⇒ Boolean
25 26 27 |
# File 'lib/octopress-docs/doc.rb', line 25 def disabled? false end |
#file ⇒ Object
29 30 31 |
# File 'lib/octopress-docs/doc.rb', line 29 def file File.basename(@file) end |
#info ⇒ Object
33 34 35 |
# File 'lib/octopress-docs/doc.rb', line 33 def info " - #{permalink.ljust(35)}" end |
#page ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/octopress-docs/doc.rb', line 37 def page return @page if @page @page = Octopress::Docs::Page.new(Octopress.site, @dir, page_dir, file, {'path'=>@base_url}) @page.data['layout'] = 'docs' @page.data['plugin'] = { 'name' => @plugin_name, 'slug' => plugin_slug, 'docs_base_url' => @base_url } @page.data['dir'] = doc_dir @page.data['permalink'] = "/" if @index @page end |