Class: Jekyll::Locale::Document
- Inherits:
-
Document
- Object
- Document
- Jekyll::Locale::Document
- Includes:
- Helper
- Defined in:
- lib/jekyll/locale/document.rb
Instance Attribute Summary
Attributes included from Helper
Instance Method Summary collapse
- #cleaned_relative_path ⇒ Object
-
#initialize(canon, locale) ⇒ Document
constructor
A new instance of Document.
- #url_template ⇒ Object
Methods included from Helper
#inspect, #permalink, #setup_hreflangs, #setup_hreflangs?
Constructor Details
#initialize(canon, locale) ⇒ Document
Returns a new instance of Document.
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/jekyll/locale/document.rb', line 7 def initialize(canon, locale) setup(canon, locale) @collection = canon.collection @extname = File.extname(relative_path) @has_yaml_header = nil read special_dir = draft? ? "_drafts" : @collection.relative_directory categories_from_path(special_dir) configure_data end |
Instance Method Details
#cleaned_relative_path ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/jekyll/locale/document.rb', line 20 def cleaned_relative_path @cleaned_relative_path ||= begin rel_path = relative_path[0..-extname.length - 1] rel_path.sub!(@locale_page_dir, "") rel_path.sub!(collection.relative_directory, "") rel_path.gsub!(%r!\.*\z!, "") rel_path end end |
#url_template ⇒ Object
30 31 32 |
# File 'lib/jekyll/locale/document.rb', line 30 def url_template @url_template ||= File.join("", locale, super) end |