module Jekyll
Convertible
provides methods for converting a pagelike item from a certain type of markup into actual content
Requires
self.site -> Jekyll::Site self.content self.content= self.data= self.ext= self.output= self.name self.path self.type -> :page, :post or :draft
Public: Methods that generate a URL
for a resource such as a Post or a Page
.
Examples
URL.new({ :template => /:categories/:title.html", :placeholders => {:categories => "ruby", :title => "something"} }).to_s
Constants
- Generator
- VERSION
Public Class Methods
Source
# File lib/jekyll.rb, line 114 def configuration(override = {}) config = Configuration.new override = Configuration[override].stringify_keys unless override.delete("skip_config_files") config = config.read_config_files(config.config_files(override)) end # Merge DEFAULTS < _config.yml < override Configuration.from(Utils.deep_merge_hashes(config, override)).tap do |obj| set_timezone(obj["timezone"]) if obj["timezone"] end end
Public: Generate a Jekyll
configuration Hash by merging the default options with anything in _config.yml, and adding the given options on top.
override - A Hash of config directives that override any options in both
the defaults and the config file. See Jekyll::Configuration::DEFAULTS for a list of option names and their defaults.
Returns the final configuration Hash.
Source
# File lib/jekyll.rb, line 101 def env ENV["JEKYLL_ENV"] || "development" end
Public: Tells you which Jekyll
environment you are building in so you can skip tasks if you need to. This is useful when doing expensive compression tasks on css and images and allows you to skip that when working in development.
Source
# File lib/jekyll.rb, line 145 def logger @logger ||= LogAdapter.new(Stevenson.new, (ENV["JEKYLL_LOG_LEVEL"] || :info).to_sym) end
Public: Fetch the logger instance for this Jekyll
process.
Returns the LogAdapter
instance.
Source
# File lib/jekyll.rb, line 156 def logger=(writer) @logger = LogAdapter.new(writer, (ENV["JEKYLL_LOG_LEVEL"] || :info).to_sym) end
Public: Set the log writer.
New log writer must respond to the same methods as Ruby's internal Logger.
writer - the new Logger-compatible log transport
Returns the new logger.
Source
# File lib/jekyll.rb, line 174 def sanitized_path(base_directory, questionable_path) return base_directory if base_directory.eql?(questionable_path) return base_directory if questionable_path.nil? +Jekyll::PathManager.sanitized_path(base_directory, questionable_path) end
Public: Ensures the questionable path is prefixed with the base directory
and prepends the questionable path with the base directory if false.
base_directory - the directory with which to prefix the questionable path questionable_path - the path we’re unsure about, and want prefixed
Returns the sanitized path.
Source
# File lib/jekyll.rb, line 133 def set_timezone(timezone) ENV["TZ"] = if Utils::Platforms.really_windows? Utils::WinTZ.calculate(timezone) else timezone end end
Public: Set the TZ environment variable to use the timezone specified
timezone - the IANA Time Zone
Returns nothing rubocop:disable Naming/AccessorMethodName
Public Instance Methods
Source
# File lib/jekyll/entry_filter.rb, line 97 def glob_include?(enumerator, entry) entry_with_source = PathManager.join(site.source, entry) entry_is_directory = File.directory?(entry_with_source) enumerator.any? do |pattern| case pattern when String pattern_with_source = PathManager.join(site.source, pattern) File.fnmatch?(pattern_with_source, entry_with_source) || entry_with_source.start_with?(pattern_with_source) || (pattern_with_source == "#{entry_with_source}/" if entry_is_directory) when Regexp pattern.match?(entry_with_source) else false end end end
Check if an entry matches a specific pattern. Returns true if path matches against any glob pattern, else false.
Source
# File lib/jekyll/entry_filter.rb, line 84 def symlink?(entry) site.safe && File.symlink?(entry) && symlink_outside_site_source?(entry) end
– Check if a file is a symlink. NOTE: This can be converted to allowing even in safe,
since we use Pathutil#in_path? now.
–
Source
# File lib/jekyll/entry_filter.rb, line 91 def symlink_outside_site_source?(entry) !File.realpath(entry).start_with?(site.in_source_dir) end
– Check if given path is outside of current site’s configured source directory. –