commit
						5580972282
					
				| 
						 | 
				
			
			@ -1,7 +1,7 @@
 | 
			
		|||
#!/usr/bin/env ruby
 | 
			
		||||
STDOUT.sync = true
 | 
			
		||||
 | 
			
		||||
$:.unshift File.join(File.dirname(__FILE__), *%w{ .. lib })
 | 
			
		||||
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), *%w( .. lib ))
 | 
			
		||||
 | 
			
		||||
require 'jekyll'
 | 
			
		||||
require 'mercenary'
 | 
			
		||||
| 
						 | 
				
			
			@ -28,7 +28,7 @@ Mercenary.program(:jekyll) do |p|
 | 
			
		|||
 | 
			
		||||
  Jekyll::Command.subclasses.each { |c| c.init_with_program(p) }
 | 
			
		||||
 | 
			
		||||
  p.action do |args, options|
 | 
			
		||||
  p.action do |args, _|
 | 
			
		||||
    if args.empty?
 | 
			
		||||
      Jekyll.logger.error "A subcommand is required."
 | 
			
		||||
      puts p
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
$:.unshift File.dirname(__FILE__) # For use/testing when no gem is installed
 | 
			
		||||
$LOAD_PATH.unshift File.dirname(__FILE__) # For use/testing when no gem is installed
 | 
			
		||||
 | 
			
		||||
# Require all of the Ruby files in the given directory.
 | 
			
		||||
#
 | 
			
		||||
| 
						 | 
				
			
			@ -95,7 +95,7 @@ module Jekyll
 | 
			
		|||
    #            list of option names and their defaults.
 | 
			
		||||
    #
 | 
			
		||||
    # Returns the final configuration Hash.
 | 
			
		||||
    def configuration(override = Hash.new)
 | 
			
		||||
    def configuration(override = {})
 | 
			
		||||
      config = Configuration[Configuration::DEFAULTS]
 | 
			
		||||
      override = Configuration[override].stringify_keys
 | 
			
		||||
      unless override.delete('skip_config_files')
 | 
			
		||||
| 
						 | 
				
			
			@ -156,16 +156,15 @@ module Jekyll
 | 
			
		|||
      clean_path = File.expand_path(questionable_path, "/")
 | 
			
		||||
      clean_path = clean_path.sub(/\A\w\:\//, '/')
 | 
			
		||||
 | 
			
		||||
      unless clean_path.start_with?(base_directory.sub(/\A\w\:\//, '/'))
 | 
			
		||||
        File.join(base_directory, clean_path)
 | 
			
		||||
      else
 | 
			
		||||
      if clean_path.start_with?(base_directory.sub(/\A\w\:\//, '/'))
 | 
			
		||||
        clean_path
 | 
			
		||||
      else
 | 
			
		||||
        File.join(base_directory, clean_path)
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    # Conditional optimizations
 | 
			
		||||
    Jekyll::External.require_if_present('liquid-c')
 | 
			
		||||
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -13,7 +13,7 @@ module Jekyll
 | 
			
		|||
    # Cleans up the site's destination directory
 | 
			
		||||
    def cleanup!
 | 
			
		||||
      FileUtils.rm_rf(obsolete_files)
 | 
			
		||||
      FileUtils.rm_rf(metadata_file) if !@site.incremental?
 | 
			
		||||
      FileUtils.rm_rf(metadata_file) unless @site.incremental?
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    private
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -56,7 +56,7 @@ module Jekyll
 | 
			
		|||
        full_path = collection_dir(file_path)
 | 
			
		||||
        next if File.directory?(full_path)
 | 
			
		||||
        if Utils.has_yaml_header? full_path
 | 
			
		||||
          doc = Jekyll::Document.new(full_path, { site: site, collection: self })
 | 
			
		||||
          doc = Jekyll::Document.new(full_path, { :site => site, :collection => self })
 | 
			
		||||
          doc.read
 | 
			
		||||
          if site.publisher.publish?(doc) || !write?
 | 
			
		||||
            docs << doc
 | 
			
		||||
| 
						 | 
				
			
			@ -76,10 +76,11 @@ module Jekyll
 | 
			
		|||
    # Returns an Array of file paths to the documents in this collection
 | 
			
		||||
    #   relative to the collection's directory
 | 
			
		||||
    def entries
 | 
			
		||||
      return Array.new unless exists?
 | 
			
		||||
      return [] unless exists?
 | 
			
		||||
      @entries ||=
 | 
			
		||||
        Utils.safe_glob(collection_dir, ["**", "*.*"]).map do |entry|
 | 
			
		||||
          entry["#{collection_dir}/"] = ''; entry
 | 
			
		||||
          entry["#{collection_dir}/"] = ''
 | 
			
		||||
          entry
 | 
			
		||||
        end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -88,7 +89,7 @@ module Jekyll
 | 
			
		|||
    #
 | 
			
		||||
    # Returns a list of filtered entry paths.
 | 
			
		||||
    def filtered_entries
 | 
			
		||||
      return Array.new unless exists?
 | 
			
		||||
      return [] unless exists?
 | 
			
		||||
      @filtered_entries ||=
 | 
			
		||||
        Dir.chdir(directory) do
 | 
			
		||||
          entry_filter.filter(entries).reject do |f|
 | 
			
		||||
| 
						 | 
				
			
			@ -186,7 +187,7 @@ module Jekyll
 | 
			
		|||
    # Returns the URL template to render collection's documents at.
 | 
			
		||||
    def url_template
 | 
			
		||||
      metadata.fetch('permalink') do
 | 
			
		||||
          Utils.add_permalink_suffix("/:collection/:path", site.permalink_style)
 | 
			
		||||
        Utils.add_permalink_suffix("/:collection/:path", site.permalink_style)
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -195,7 +196,7 @@ module Jekyll
 | 
			
		|||
    # Returns the metadata for this collection
 | 
			
		||||
    def extract_metadata
 | 
			
		||||
      if site.config['collections'].is_a?(Hash)
 | 
			
		||||
        site.config['collections'][label] || Hash.new
 | 
			
		||||
        site.config['collections'][label] || {}
 | 
			
		||||
      else
 | 
			
		||||
        {}
 | 
			
		||||
      end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,8 +1,6 @@
 | 
			
		|||
module Jekyll
 | 
			
		||||
  class Command
 | 
			
		||||
 | 
			
		||||
    class << self
 | 
			
		||||
 | 
			
		||||
      # A list of subclasses of Jekyll::Command
 | 
			
		||||
      def subclasses
 | 
			
		||||
        @subclasses ||= []
 | 
			
		||||
| 
						 | 
				
			
			@ -62,8 +60,6 @@ module Jekyll
 | 
			
		|||
        c.option 'verbose', '-V', '--verbose', 'Print verbose output.'
 | 
			
		||||
        c.option 'incremental', '-I', '--incremental', 'Enable incremental rebuild.'
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,9 +1,7 @@
 | 
			
		|||
module Jekyll
 | 
			
		||||
  module Commands
 | 
			
		||||
    class Build < Command
 | 
			
		||||
 | 
			
		||||
      class << self
 | 
			
		||||
 | 
			
		||||
        # Create the Mercenary command for the Jekyll CLI for this Command
 | 
			
		||||
        def init_with_program(prog)
 | 
			
		||||
          prog.command(:build) do |c|
 | 
			
		||||
| 
						 | 
				
			
			@ -13,7 +11,7 @@ module Jekyll
 | 
			
		|||
 | 
			
		||||
            add_build_options(c)
 | 
			
		||||
 | 
			
		||||
            c.action do |args, options|
 | 
			
		||||
            c.action do |_, options|
 | 
			
		||||
              options["serving"] = false
 | 
			
		||||
              Jekyll::Commands::Build.process(options)
 | 
			
		||||
            end
 | 
			
		||||
| 
						 | 
				
			
			@ -67,13 +65,11 @@ module Jekyll
 | 
			
		|||
        # options - A Hash of options passed to the command
 | 
			
		||||
        #
 | 
			
		||||
        # Returns nothing.
 | 
			
		||||
        def watch(site, options)
 | 
			
		||||
        def watch(_site, options)
 | 
			
		||||
          External.require_with_graceful_fail 'jekyll-watch'
 | 
			
		||||
          Jekyll::Watcher.watch(options)
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
      end # end of class << self
 | 
			
		||||
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,7 +2,6 @@ module Jekyll
 | 
			
		|||
  module Commands
 | 
			
		||||
    class Clean < Command
 | 
			
		||||
      class << self
 | 
			
		||||
 | 
			
		||||
        def init_with_program(prog)
 | 
			
		||||
          prog.command(:clean) do |c|
 | 
			
		||||
            c.syntax 'clean [subcommand]'
 | 
			
		||||
| 
						 | 
				
			
			@ -10,7 +9,7 @@ module Jekyll
 | 
			
		|||
 | 
			
		||||
            add_build_options(c)
 | 
			
		||||
 | 
			
		||||
            c.action do |args, options|
 | 
			
		||||
            c.action do |_, options|
 | 
			
		||||
              Jekyll::Commands::Clean.process(options)
 | 
			
		||||
            end
 | 
			
		||||
          end
 | 
			
		||||
| 
						 | 
				
			
			@ -37,7 +36,6 @@ module Jekyll
 | 
			
		|||
            Jekyll.logger.info "Nothing to do for #{metadata_file}."
 | 
			
		||||
          end
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,7 +2,6 @@ module Jekyll
 | 
			
		|||
  module Commands
 | 
			
		||||
    class Doctor < Command
 | 
			
		||||
      class << self
 | 
			
		||||
 | 
			
		||||
        def init_with_program(prog)
 | 
			
		||||
          prog.command(:doctor) do |c|
 | 
			
		||||
            c.syntax 'doctor'
 | 
			
		||||
| 
						 | 
				
			
			@ -11,7 +10,7 @@ module Jekyll
 | 
			
		|||
 | 
			
		||||
            c.option '--config CONFIG_FILE[,CONFIG_FILE2,...]', Array, 'Custom configuration file'
 | 
			
		||||
 | 
			
		||||
            c.action do |args, options|
 | 
			
		||||
            c.action do |_, options|
 | 
			
		||||
              Jekyll::Commands::Doctor.process(options)
 | 
			
		||||
            end
 | 
			
		||||
          end
 | 
			
		||||
| 
						 | 
				
			
			@ -39,8 +38,8 @@ module Jekyll
 | 
			
		|||
 | 
			
		||||
        def deprecated_relative_permalinks(site)
 | 
			
		||||
          if site.config['relative_permalinks']
 | 
			
		||||
            Jekyll::Deprecator.deprecation_message "Your site still uses relative" +
 | 
			
		||||
                                " permalinks, which was removed in" +
 | 
			
		||||
            Jekyll::Deprecator.deprecation_message "Your site still uses relative" \
 | 
			
		||||
                                " permalinks, which was removed in" \
 | 
			
		||||
                                " Jekyll v3.0.0."
 | 
			
		||||
            return true
 | 
			
		||||
          end
 | 
			
		||||
| 
						 | 
				
			
			@ -52,17 +51,16 @@ module Jekyll
 | 
			
		|||
          urls = collect_urls(urls, site.pages, site.dest)
 | 
			
		||||
          urls = collect_urls(urls, site.posts.docs, site.dest)
 | 
			
		||||
          urls.each do |url, paths|
 | 
			
		||||
            if paths.size > 1
 | 
			
		||||
              conflicting_urls = true
 | 
			
		||||
              Jekyll.logger.warn "Conflict:", "The URL '#{url}' is the destination" +
 | 
			
		||||
                " for the following pages: #{paths.join(", ")}"
 | 
			
		||||
            end
 | 
			
		||||
            next unless paths.size > 1
 | 
			
		||||
            conflicting_urls = true
 | 
			
		||||
            Jekyll.logger.warn "Conflict:", "The URL '#{url}' is the destination" \
 | 
			
		||||
              " for the following pages: #{paths.join(", ")}"
 | 
			
		||||
          end
 | 
			
		||||
          conflicting_urls
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
        def fsnotify_buggy?(site)
 | 
			
		||||
          return true if !Utils::Platforms.osx?
 | 
			
		||||
        def fsnotify_buggy?(_site)
 | 
			
		||||
          return true unless Utils::Platforms.osx?
 | 
			
		||||
          if Dir.pwd != `pwd`.strip
 | 
			
		||||
            Jekyll.logger.error "  " + <<-STR.strip.gsub(/\n\s+/, "\n  ")
 | 
			
		||||
              We have detected that there might be trouble using fsevent on your
 | 
			
		||||
| 
						 | 
				
			
			@ -81,12 +79,11 @@ module Jekyll
 | 
			
		|||
          urls_only_differ_by_case = false
 | 
			
		||||
          urls = case_insensitive_urls(site.pages + site.docs_to_write, site.dest)
 | 
			
		||||
          urls.each do |case_insensitive_url, real_urls|
 | 
			
		||||
            if real_urls.uniq.size > 1
 | 
			
		||||
              urls_only_differ_by_case = true
 | 
			
		||||
              Jekyll.logger.warn "Warning:", "The following URLs only differ" +
 | 
			
		||||
                " by case. On a case-insensitive file system one of the URLs" +
 | 
			
		||||
                " will be overwritten by the other: #{real_urls.join(", ")}"
 | 
			
		||||
            end
 | 
			
		||||
            next unless real_urls.uniq.size > 1
 | 
			
		||||
            urls_only_differ_by_case = true
 | 
			
		||||
            Jekyll.logger.warn "Warning:", "The following URLs only differ" \
 | 
			
		||||
              " by case. On a case-insensitive file system one of the URLs" \
 | 
			
		||||
              " will be overwritten by the other: #{real_urls.join(", ")}"
 | 
			
		||||
          end
 | 
			
		||||
          urls_only_differ_by_case
 | 
			
		||||
        end
 | 
			
		||||
| 
						 | 
				
			
			@ -105,14 +102,13 @@ module Jekyll
 | 
			
		|||
        end
 | 
			
		||||
 | 
			
		||||
        def case_insensitive_urls(things, destination)
 | 
			
		||||
          things.inject(Hash.new) do |memo, thing|
 | 
			
		||||
          things.inject({}) do |memo, thing|
 | 
			
		||||
            dest = thing.destination(destination)
 | 
			
		||||
            (memo[dest.downcase] ||= []) << dest
 | 
			
		||||
            memo
 | 
			
		||||
          end
 | 
			
		||||
        end
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,7 +2,6 @@ module Jekyll
 | 
			
		|||
  module Commands
 | 
			
		||||
    class Help < Command
 | 
			
		||||
      class << self
 | 
			
		||||
 | 
			
		||||
        def init_with_program(prog)
 | 
			
		||||
          prog.command(:help) do |c|
 | 
			
		||||
            c.syntax 'help [subcommand]'
 | 
			
		||||
| 
						 | 
				
			
			@ -26,7 +25,6 @@ module Jekyll
 | 
			
		|||
          Jekyll.logger.error "Error:", "Hmm... we don't know what the '#{cmd}' command is."
 | 
			
		||||
          Jekyll.logger.info  "Valid commands:", prog.commands.keys.join(", ")
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -103,7 +103,7 @@ module Jekyll
 | 
			
		|||
          WEBrick::Config::FileHandler.merge({
 | 
			
		||||
            :FancyIndexing     => true,
 | 
			
		||||
            :NondisclosureName => [
 | 
			
		||||
              '.ht*','~*'
 | 
			
		||||
              '.ht*', '~*'
 | 
			
		||||
            ]
 | 
			
		||||
          })
 | 
			
		||||
        end
 | 
			
		||||
| 
						 | 
				
			
			@ -123,7 +123,14 @@ module Jekyll
 | 
			
		|||
 | 
			
		||||
        private
 | 
			
		||||
        def launch_browser(server, opts)
 | 
			
		||||
          command = Utils::Platforms.windows?? "start" : Utils::Platforms.osx?? "open" : "xdg-open"
 | 
			
		||||
          command =
 | 
			
		||||
            if Utils::Platforms.windows?
 | 
			
		||||
              "start"
 | 
			
		||||
            elsif Utils::Platforms.osx?
 | 
			
		||||
              "open"
 | 
			
		||||
            else
 | 
			
		||||
              "xdg-open"
 | 
			
		||||
            end
 | 
			
		||||
          system command, server_address(server, opts)
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -168,7 +175,8 @@ module Jekyll
 | 
			
		|||
            raise RuntimeError, "--ssl-cert or --ssl-key missing."
 | 
			
		||||
          end
 | 
			
		||||
 | 
			
		||||
          require "openssl"; require "webrick/https"
 | 
			
		||||
          require "openssl"
 | 
			
		||||
          require "webrick/https"
 | 
			
		||||
          source_key = Jekyll.sanitized_path(opts[:JekyllOptions]["source"], opts[:JekyllOptions]["ssl_key" ])
 | 
			
		||||
          source_certificate = Jekyll.sanitized_path(opts[:JekyllOptions]["source"], opts[:JekyllOptions]["ssl_cert"])
 | 
			
		||||
          opts[:SSLCertificate] = OpenSSL::X509::Certificate.new(File.read(source_certificate))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -37,7 +37,7 @@ module Jekyll
 | 
			
		|||
        #
 | 
			
		||||
 | 
			
		||||
        private
 | 
			
		||||
        def validate_and_ensure_charset(req, res)
 | 
			
		||||
        def validate_and_ensure_charset(_req, res)
 | 
			
		||||
          key = res.header.keys.grep(/content-type/i).first
 | 
			
		||||
          typ = res.header[key]
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -52,7 +52,7 @@ module Jekyll
 | 
			
		|||
        def set_defaults
 | 
			
		||||
          hash_ = @jekyll_opts.fetch("webrick", {}).fetch("headers", {})
 | 
			
		||||
          DEFAULTS.each_with_object(@headers = hash_) do |(key, val), hash|
 | 
			
		||||
            hash[key] = val if !hash.key?(key)
 | 
			
		||||
            hash[key] = val unless hash.key?(key)
 | 
			
		||||
          end
 | 
			
		||||
        end
 | 
			
		||||
      end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,7 +2,6 @@
 | 
			
		|||
 | 
			
		||||
module Jekyll
 | 
			
		||||
  class Configuration < Hash
 | 
			
		||||
 | 
			
		||||
    # Default options. Overridden by values in _config.yml.
 | 
			
		||||
    # Strings rather than symbols are used for compatibility with YAML.
 | 
			
		||||
    DEFAULTS = Configuration[{
 | 
			
		||||
| 
						 | 
				
			
			@ -19,7 +18,7 @@ module Jekyll
 | 
			
		|||
      'safe'          => false,
 | 
			
		||||
      'include'       => ['.htaccess'],
 | 
			
		||||
      'exclude'       => [],
 | 
			
		||||
      'keep_files'    => ['.git','.svn'],
 | 
			
		||||
      'keep_files'    => ['.git', '.svn'],
 | 
			
		||||
      'encoding'      => 'utf-8',
 | 
			
		||||
      'markdown_ext'  => 'markdown,mkdown,mkdn,mkd,md',
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -78,7 +77,7 @@ module Jekyll
 | 
			
		|||
    #
 | 
			
		||||
    # Return a copy of the hash where all its keys are strings
 | 
			
		||||
    def stringify_keys
 | 
			
		||||
      reduce({}) { |hsh,(k,v)| hsh.merge(k.to_s => v) }
 | 
			
		||||
      reduce({}) { |hsh, (k, v)| hsh.merge(k.to_s => v) }
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def get_config_value_with_override(config_key, override)
 | 
			
		||||
| 
						 | 
				
			
			@ -128,7 +127,7 @@ module Jekyll
 | 
			
		|||
      # Get configuration from <source>/_config.yml or <source>/<config_file>
 | 
			
		||||
      config_files = override.delete('config')
 | 
			
		||||
      if config_files.to_s.empty?
 | 
			
		||||
        default = %w[yml yaml].find(Proc.new { 'yml' }) do |ext|
 | 
			
		||||
        default = %w(yml yaml).find(-> { 'yml' }) do |ext|
 | 
			
		||||
          File.exist?(Jekyll.sanitized_path(source(override), "_config.#{ext}"))
 | 
			
		||||
        end
 | 
			
		||||
        config_files = Jekyll.sanitized_path(source(override), "_config.#{default}")
 | 
			
		||||
| 
						 | 
				
			
			@ -173,7 +172,7 @@ module Jekyll
 | 
			
		|||
          configuration = Utils.deep_merge_hashes(configuration, new_config)
 | 
			
		||||
        end
 | 
			
		||||
      rescue ArgumentError => err
 | 
			
		||||
        Jekyll.logger.warn "WARNING:", "Error reading configuration. " +
 | 
			
		||||
        Jekyll.logger.warn "WARNING:", "Error reading configuration. " \
 | 
			
		||||
                     "Using defaults (and options)."
 | 
			
		||||
        $stderr.puts "#{err}"
 | 
			
		||||
      end
 | 
			
		||||
| 
						 | 
				
			
			@ -198,16 +197,16 @@ module Jekyll
 | 
			
		|||
      config = clone
 | 
			
		||||
      # Provide backwards-compatibility
 | 
			
		||||
      if config.key?('auto') || config.key?('watch')
 | 
			
		||||
        Jekyll::Deprecator.deprecation_message "Auto-regeneration can no longer" +
 | 
			
		||||
                            " be set from your configuration file(s). Use the"+
 | 
			
		||||
        Jekyll::Deprecator.deprecation_message "Auto-regeneration can no longer" \
 | 
			
		||||
                            " be set from your configuration file(s). Use the"\
 | 
			
		||||
                            " --[no-]watch/-w command-line option instead."
 | 
			
		||||
        config.delete('auto')
 | 
			
		||||
        config.delete('watch')
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      if config.key? 'server'
 | 
			
		||||
        Jekyll::Deprecator.deprecation_message "The 'server' configuration option" +
 | 
			
		||||
                            " is no longer accepted. Use the 'jekyll serve'" +
 | 
			
		||||
        Jekyll::Deprecator.deprecation_message "The 'server' configuration option" \
 | 
			
		||||
                            " is no longer accepted. Use the 'jekyll serve'" \
 | 
			
		||||
                            " subcommand to serve your site with WEBrick."
 | 
			
		||||
        config.delete('server')
 | 
			
		||||
      end
 | 
			
		||||
| 
						 | 
				
			
			@ -218,21 +217,21 @@ module Jekyll
 | 
			
		|||
      renamed_key 'data_source', 'data_dir', config
 | 
			
		||||
 | 
			
		||||
      if config.key? 'pygments'
 | 
			
		||||
        Jekyll::Deprecator.deprecation_message "The 'pygments' configuration option" +
 | 
			
		||||
                            " has been renamed to 'highlighter'. Please update your" +
 | 
			
		||||
                            " config file accordingly. The allowed values are 'rouge', " +
 | 
			
		||||
        Jekyll::Deprecator.deprecation_message "The 'pygments' configuration option" \
 | 
			
		||||
                            " has been renamed to 'highlighter'. Please update your" \
 | 
			
		||||
                            " config file accordingly. The allowed values are 'rouge', " \
 | 
			
		||||
                            "'pygments' or null."
 | 
			
		||||
 | 
			
		||||
        config['highlighter'] = 'pygments' if config['pygments']
 | 
			
		||||
        config.delete('pygments')
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      %w[include exclude].each do |option|
 | 
			
		||||
      %w(include exclude).each do |option|
 | 
			
		||||
        config[option] ||= []
 | 
			
		||||
        if config[option].is_a?(String)
 | 
			
		||||
          Jekyll::Deprecator.deprecation_message "The '#{option}' configuration option" +
 | 
			
		||||
            " must now be specified as an array, but you specified" +
 | 
			
		||||
            " a string. For now, we've treated the string you provided" +
 | 
			
		||||
          Jekyll::Deprecator.deprecation_message "The '#{option}' configuration option" \
 | 
			
		||||
            " must now be specified as an array, but you specified" \
 | 
			
		||||
            " a string. For now, we've treated the string you provided" \
 | 
			
		||||
            " as a list of comma-separated values."
 | 
			
		||||
          config[option] = csv_to_array(config[option])
 | 
			
		||||
        end
 | 
			
		||||
| 
						 | 
				
			
			@ -240,16 +239,16 @@ module Jekyll
 | 
			
		|||
      end
 | 
			
		||||
 | 
			
		||||
      if (config['kramdown'] || {}).key?('use_coderay')
 | 
			
		||||
        Jekyll::Deprecator.deprecation_message "Please change 'use_coderay'" +
 | 
			
		||||
        Jekyll::Deprecator.deprecation_message "Please change 'use_coderay'" \
 | 
			
		||||
          " to 'enable_coderay' in your configuration file."
 | 
			
		||||
        config['kramdown']['use_coderay'] = config['kramdown'].delete('enable_coderay')
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      if config.fetch('markdown', 'kramdown').to_s.downcase.eql?("maruku")
 | 
			
		||||
        Jekyll.logger.abort_with "Error:", "You're using the 'maruku' " +
 | 
			
		||||
          "Markdown processor, which has been removed as of 3.0.0. " +
 | 
			
		||||
          "We recommend you switch to Kramdown. To do this, replace " +
 | 
			
		||||
          "`markdown: maruku` with `markdown: kramdown` in your " +
 | 
			
		||||
        Jekyll.logger.abort_with "Error:", "You're using the 'maruku' " \
 | 
			
		||||
          "Markdown processor, which has been removed as of 3.0.0. " \
 | 
			
		||||
          "We recommend you switch to Kramdown. To do this, replace " \
 | 
			
		||||
          "`markdown: maruku` with `markdown: kramdown` in your " \
 | 
			
		||||
          "`_config.yml` file."
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -260,7 +259,7 @@ module Jekyll
 | 
			
		|||
      config = clone
 | 
			
		||||
 | 
			
		||||
      if config.key?('paginate') && (!config['paginate'].is_a?(Integer) || config['paginate'] < 1)
 | 
			
		||||
        Jekyll.logger.warn "Config Warning:", "The `paginate` key must be a" +
 | 
			
		||||
        Jekyll.logger.warn "Config Warning:", "The `paginate` key must be a" \
 | 
			
		||||
          " positive integer or nil. It's currently set to '#{config['paginate'].inspect}'."
 | 
			
		||||
        config['paginate'] = nil
 | 
			
		||||
      end
 | 
			
		||||
| 
						 | 
				
			
			@ -274,7 +273,7 @@ module Jekyll
 | 
			
		|||
      return config if config['collections'].nil?
 | 
			
		||||
 | 
			
		||||
      if config['collections'].is_a?(Array)
 | 
			
		||||
        config['collections'] = Hash[config['collections'].map{|c| [c, {}]}]
 | 
			
		||||
        config['collections'] = Hash[config['collections'].map { |c| [c, {}] }]
 | 
			
		||||
      end
 | 
			
		||||
      config['collections']['posts'] ||= {}
 | 
			
		||||
      config['collections']['posts']['output'] = true
 | 
			
		||||
| 
						 | 
				
			
			@ -283,10 +282,10 @@ module Jekyll
 | 
			
		|||
      config
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def renamed_key(old, new, config, allowed_values = nil)
 | 
			
		||||
    def renamed_key(old, new, config, _ = nil)
 | 
			
		||||
      if config.key?(old)
 | 
			
		||||
        Jekyll::Deprecator.deprecation_message "The '#{old}' configuration" +
 | 
			
		||||
          "option has been renamed to '#{new}'. Please update your config " +
 | 
			
		||||
        Jekyll::Deprecator.deprecation_message "The '#{old}' configuration" \
 | 
			
		||||
          "option has been renamed to '#{new}'. Please update your config " \
 | 
			
		||||
          "file accordingly."
 | 
			
		||||
        config[new] = config.delete(old)
 | 
			
		||||
      end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,7 +5,7 @@ module Jekyll
 | 
			
		|||
 | 
			
		||||
      priority :lowest
 | 
			
		||||
 | 
			
		||||
      def matches(ext)
 | 
			
		||||
      def matches(_ext)
 | 
			
		||||
        true
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,7 +7,7 @@ module Jekyll
 | 
			
		|||
 | 
			
		||||
      def setup
 | 
			
		||||
        return if @setup
 | 
			
		||||
        if (!@parser = get_processor)
 | 
			
		||||
        unless (@parser = get_processor)
 | 
			
		||||
          Jekyll.logger.error "Invalid Markdown processor given:", @config["markdown"]
 | 
			
		||||
          Jekyll.logger.info  "", "Custom processors are not loaded in safe mode" if @config["safe"]
 | 
			
		||||
          Jekyll.logger.error "", "Available processors are: #{valid_processors.join(", ")}"
 | 
			
		||||
| 
						 | 
				
			
			@ -19,9 +19,9 @@ module Jekyll
 | 
			
		|||
 | 
			
		||||
      def get_processor
 | 
			
		||||
        case @config["markdown"].downcase
 | 
			
		||||
          when "redcarpet" then return RedcarpetParser.new(@config)
 | 
			
		||||
          when "kramdown"  then return KramdownParser.new(@config)
 | 
			
		||||
          when "rdiscount" then return RDiscountParser.new(@config)
 | 
			
		||||
        when "redcarpet" then return RedcarpetParser.new(@config)
 | 
			
		||||
        when "kramdown"  then return KramdownParser.new(@config)
 | 
			
		||||
        when "rdiscount" then return RDiscountParser.new(@config)
 | 
			
		||||
        else
 | 
			
		||||
          get_custom_processor
 | 
			
		||||
        end
 | 
			
		||||
| 
						 | 
				
			
			@ -41,7 +41,7 @@ module Jekyll
 | 
			
		|||
 | 
			
		||||
      def third_party_processors
 | 
			
		||||
        self.class.constants - \
 | 
			
		||||
        %w[KramdownParser RDiscountParser RedcarpetParser PRIORITIES].map(
 | 
			
		||||
        %w(KramdownParser RDiscountParser RedcarpetParser PRIORITIES).map(
 | 
			
		||||
          &:to_sym
 | 
			
		||||
        )
 | 
			
		||||
      end
 | 
			
		||||
| 
						 | 
				
			
			@ -56,7 +56,7 @@ module Jekyll
 | 
			
		|||
        extname_list.include?(ext.downcase)
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      def output_ext(ext)
 | 
			
		||||
      def output_ext(_ext)
 | 
			
		||||
        ".html"
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,7 +5,7 @@ module Jekyll
 | 
			
		|||
        def initialize(config)
 | 
			
		||||
          Jekyll::External.require_with_graceful_fail "rdiscount"
 | 
			
		||||
          @config = config
 | 
			
		||||
          @rdiscount_extensions = @config['rdiscount']['extensions'].map { |e| e.to_sym }
 | 
			
		||||
          @rdiscount_extensions = @config['rdiscount']['extensions'].map(&:to_sym)
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
        def convert(content)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,12 +2,12 @@ module Jekyll
 | 
			
		|||
  module Converters
 | 
			
		||||
    class Markdown
 | 
			
		||||
      class RedcarpetParser
 | 
			
		||||
 | 
			
		||||
        module CommonMethods
 | 
			
		||||
          def add_code_tags(code, lang)
 | 
			
		||||
            code = code.to_s
 | 
			
		||||
            code = code.sub(/<pre>/, "<pre><code class=\"language-#{lang}\" data-lang=\"#{lang}\">")
 | 
			
		||||
            code = code.sub(/<\/pre>/,"</code></pre>")
 | 
			
		||||
            code = code.sub(/<\/pre>/, "</code></pre>")
 | 
			
		||||
            code
 | 
			
		||||
          end
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -48,12 +48,11 @@ module Jekyll
 | 
			
		|||
          end
 | 
			
		||||
 | 
			
		||||
          protected
 | 
			
		||||
          def rouge_formatter(lexer)
 | 
			
		||||
          def rouge_formatter(_lexer)
 | 
			
		||||
            Rouge::Formatters::HTML.new(:wrap => false)
 | 
			
		||||
          end
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        def initialize(config)
 | 
			
		||||
          External.require_with_graceful_fail("redcarpet")
 | 
			
		||||
          @config = config
 | 
			
		||||
| 
						 | 
				
			
			@ -71,10 +70,10 @@ module Jekyll
 | 
			
		|||
            end
 | 
			
		||||
          when "rouge"
 | 
			
		||||
            Class.new(Redcarpet::Render::HTML) do
 | 
			
		||||
              Jekyll::External.require_with_graceful_fail(%w[
 | 
			
		||||
              Jekyll::External.require_with_graceful_fail(%w(
 | 
			
		||||
                rouge
 | 
			
		||||
                rouge/plugins/redcarpet
 | 
			
		||||
              ])
 | 
			
		||||
              ))
 | 
			
		||||
 | 
			
		||||
              unless Gem::Version.new(Rouge.version) > Gem::Version.new("1.3.0")
 | 
			
		||||
                abort "Please install Rouge 1.3.0 or greater and try running Jekyll again."
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -47,7 +47,7 @@ module Jekyll
 | 
			
		|||
                                 merged_file_read_opts(opts))
 | 
			
		||||
        if content =~ /\A(---\s*\n.*?\n?)^((---|\.\.\.)\s*$\n?)/m
 | 
			
		||||
          self.content = $POSTMATCH
 | 
			
		||||
          self.data = SafeYAML.load($1)
 | 
			
		||||
          self.data = SafeYAML.load(Regexp.last_match(1))
 | 
			
		||||
        end
 | 
			
		||||
      rescue SyntaxError => e
 | 
			
		||||
        Jekyll.logger.warn "YAML Exception reading #{File.join(base, name)}: #{e.message}"
 | 
			
		||||
| 
						 | 
				
			
			@ -87,9 +87,9 @@ module Jekyll
 | 
			
		|||
      if converters.all? { |c| c.is_a?(Jekyll::Converters::Identity) }
 | 
			
		||||
        ext
 | 
			
		||||
      else
 | 
			
		||||
        converters.map { |c|
 | 
			
		||||
        converters.map do |c|
 | 
			
		||||
          c.output_ext(ext) unless c.is_a?(Jekyll::Converters::Identity)
 | 
			
		||||
        }.compact.last
 | 
			
		||||
        end.compact.last
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -122,9 +122,9 @@ module Jekyll
 | 
			
		|||
    #
 | 
			
		||||
    # Returns the Hash representation of this Convertible.
 | 
			
		||||
    def to_liquid(attrs = nil)
 | 
			
		||||
      further_data = Hash[(attrs || self.class::ATTRIBUTES_FOR_LIQUID).map { |attribute|
 | 
			
		||||
      further_data = Hash[(attrs || self.class::ATTRIBUTES_FOR_LIQUID).map do |attribute|
 | 
			
		||||
        [attribute, send(attribute)]
 | 
			
		||||
      }]
 | 
			
		||||
      end]
 | 
			
		||||
 | 
			
		||||
      defaults = site.frontmatter_defaults.all(relative_path, type)
 | 
			
		||||
      Utils.deep_merge_hashes defaults, Utils.deep_merge_hashes(data, further_data)
 | 
			
		||||
| 
						 | 
				
			
			@ -160,7 +160,7 @@ module Jekyll
 | 
			
		|||
    #
 | 
			
		||||
    # Returns true if extname == .sass or .scss, false otherwise.
 | 
			
		||||
    def sass_file?
 | 
			
		||||
      %w[.sass .scss].include?(ext)
 | 
			
		||||
      %w(.sass .scss).include?(ext)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    # Determine whether the document is a CoffeeScript file.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -21,7 +21,7 @@ module Jekyll
 | 
			
		|||
    end
 | 
			
		||||
 | 
			
		||||
    def no_subcommand(args)
 | 
			
		||||
      if args.size > 0 && args.first =~ /^--/ && !%w[--help --version].include?(args.first)
 | 
			
		||||
      if args.size > 0 && args.first =~ /^--/ && !%w(--help --version).include?(args.first)
 | 
			
		||||
        deprecation_message "Jekyll now uses subcommands instead of just switches. Run `jekyll --help` to find out more."
 | 
			
		||||
        abort
 | 
			
		||||
      end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,7 +4,8 @@ module Jekyll
 | 
			
		|||
  class Document
 | 
			
		||||
    include Comparable
 | 
			
		||||
 | 
			
		||||
    attr_reader :path, :site, :extname, :output_ext, :content, :output, :collection
 | 
			
		||||
    attr_reader :path, :site, :extname, :output_ext, :collection
 | 
			
		||||
    attr_accessor :content, :output
 | 
			
		||||
 | 
			
		||||
    YAML_FRONT_MATTER_REGEXP = /\A(---\s*\n.*?\n?)^((---|\.\.\.)\s*$\n?)/m
 | 
			
		||||
    DATELESS_FILENAME_MATCHER = /^(.*)(\.[^.]+)$/
 | 
			
		||||
| 
						 | 
				
			
			@ -32,27 +33,19 @@ module Jekyll
 | 
			
		|||
        categories_from_path(collection.relative_directory)
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      data.default_proc = proc do |hash, key|
 | 
			
		||||
      data.default_proc = proc do |_, key|
 | 
			
		||||
        site.frontmatter_defaults.find(relative_path, collection.label, key)
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      trigger_hooks(:post_init)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def output=(output)
 | 
			
		||||
      @output = output
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def content=(content)
 | 
			
		||||
      @content = content
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    # Fetch the Document's data.
 | 
			
		||||
    #
 | 
			
		||||
    # Returns a Hash containing the data. An empty hash is returned if
 | 
			
		||||
    #   no data was read.
 | 
			
		||||
    def data
 | 
			
		||||
      @data ||= Hash.new
 | 
			
		||||
      @data ||= {}
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    # Merge some data in with this document's data.
 | 
			
		||||
| 
						 | 
				
			
			@ -67,7 +60,7 @@ module Jekyll
 | 
			
		|||
      end
 | 
			
		||||
      Utils.deep_merge_hashes!(data, other)
 | 
			
		||||
      if data.key?('date') && !data['date'].is_a?(Time)
 | 
			
		||||
         data['date'] = Utils.parse_date(data['date'].to_s, "Document '#{relative_path}' does not have a valid date in the YAML front matter.")
 | 
			
		||||
        data['date'] = Utils.parse_date(data['date'].to_s, "Document '#{relative_path}' does not have a valid date in the YAML front matter.")
 | 
			
		||||
      end
 | 
			
		||||
      data
 | 
			
		||||
    end
 | 
			
		||||
| 
						 | 
				
			
			@ -120,14 +113,14 @@ module Jekyll
 | 
			
		|||
    # Returns the cleaned relative path of the document.
 | 
			
		||||
    def cleaned_relative_path
 | 
			
		||||
      @cleaned_relative_path ||=
 | 
			
		||||
        relative_path[0 .. -extname.length - 1].sub(collection.relative_directory, "")
 | 
			
		||||
        relative_path[0..-extname.length - 1].sub(collection.relative_directory, "")
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    # Determine whether the document is a YAML file.
 | 
			
		||||
    #
 | 
			
		||||
    # Returns true if the extname is either .yml or .yaml, false otherwise.
 | 
			
		||||
    def yaml_file?
 | 
			
		||||
      %w[.yaml .yml].include?(extname)
 | 
			
		||||
      %w(.yaml .yml).include?(extname)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    # Determine whether the document is an asset file.
 | 
			
		||||
| 
						 | 
				
			
			@ -143,7 +136,7 @@ module Jekyll
 | 
			
		|||
    #
 | 
			
		||||
    # Returns true if extname == .sass or .scss, false otherwise.
 | 
			
		||||
    def sass_file?
 | 
			
		||||
      %w[.sass .scss].include?(extname)
 | 
			
		||||
      %w(.sass .scss).include?(extname)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    # Determine whether the document is a CoffeeScript file.
 | 
			
		||||
| 
						 | 
				
			
			@ -197,9 +190,9 @@ module Jekyll
 | 
			
		|||
    # Returns the computed URL for the document.
 | 
			
		||||
    def url
 | 
			
		||||
      @url = URL.new({
 | 
			
		||||
        template:     url_template,
 | 
			
		||||
        placeholders: url_placeholders,
 | 
			
		||||
        permalink:    permalink
 | 
			
		||||
        :template => url_template,
 | 
			
		||||
        :placeholders => url_placeholders,
 | 
			
		||||
        :permalink => permalink
 | 
			
		||||
      }).to_s
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -270,7 +263,7 @@ module Jekyll
 | 
			
		|||
          self.content = File.read(path, merged_file_read_opts(opts))
 | 
			
		||||
          if content =~ YAML_FRONT_MATTER_REGEXP
 | 
			
		||||
            self.content = $POSTMATCH
 | 
			
		||||
            data_file = SafeYAML.load($1)
 | 
			
		||||
            data_file = SafeYAML.load(Regexp.last_match(1))
 | 
			
		||||
            merge_data!(data_file) if data_file
 | 
			
		||||
          end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -285,13 +278,13 @@ module Jekyll
 | 
			
		|||
 | 
			
		||||
    def post_read
 | 
			
		||||
      if DATE_FILENAME_MATCHER =~ relative_path
 | 
			
		||||
        m, cats, date, slug, ext = *relative_path.match(DATE_FILENAME_MATCHER)
 | 
			
		||||
        _, _, date, slug, ext = *relative_path.match(DATE_FILENAME_MATCHER)
 | 
			
		||||
        merge_data!({
 | 
			
		||||
          "slug" => slug,
 | 
			
		||||
          "ext"  => ext
 | 
			
		||||
        })
 | 
			
		||||
        merge_data!({"date" => date}) if data['date'].nil? || data['date'].to_i == site.time.to_i
 | 
			
		||||
        data['title'] ||= slug.split('-').select {|w| w.capitalize! || w }.join(' ')
 | 
			
		||||
        merge_data!({ "date" => date }) if data['date'].nil? || data['date'].to_i == site.time.to_i
 | 
			
		||||
        data['title'] ||= slug.split('-').select(&:capitalize).join(' ')
 | 
			
		||||
      end
 | 
			
		||||
      populate_categories
 | 
			
		||||
      populate_tags
 | 
			
		||||
| 
						 | 
				
			
			@ -317,7 +310,7 @@ module Jekyll
 | 
			
		|||
      merge_data!({
 | 
			
		||||
        'categories' => (
 | 
			
		||||
          Array(data['categories']) + Utils.pluralized_array_from_hash(data, 'category', 'categories')
 | 
			
		||||
        ).map { |c| c.to_s }.flatten.uniq
 | 
			
		||||
        ).map(&:to_s).flatten.uniq
 | 
			
		||||
      })
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -386,7 +379,7 @@ module Jekyll
 | 
			
		|||
    end
 | 
			
		||||
 | 
			
		||||
    def next_doc
 | 
			
		||||
      pos = collection.docs.index {|post| post.equal?(self) }
 | 
			
		||||
      pos = collection.docs.index { |post| post.equal?(self) }
 | 
			
		||||
      if pos && pos < collection.docs.length - 1
 | 
			
		||||
        collection.docs[pos + 1]
 | 
			
		||||
      else
 | 
			
		||||
| 
						 | 
				
			
			@ -395,7 +388,7 @@ module Jekyll
 | 
			
		|||
    end
 | 
			
		||||
 | 
			
		||||
    def previous_doc
 | 
			
		||||
      pos = collection.docs.index {|post| post.equal?(self) }
 | 
			
		||||
      pos = collection.docs.index { |post| post.equal?(self) }
 | 
			
		||||
      if pos && pos > 0
 | 
			
		||||
        collection.docs[pos - 1]
 | 
			
		||||
      else
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,7 +17,6 @@ module Jekyll
 | 
			
		|||
 | 
			
		||||
      private
 | 
			
		||||
      def_delegator :@obj, :metadata, :fallback_data
 | 
			
		||||
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -22,7 +22,6 @@ module Jekyll
 | 
			
		|||
 | 
			
		||||
      private
 | 
			
		||||
      def_delegator :@obj, :data, :fallback_data
 | 
			
		||||
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -83,6 +83,19 @@ module Jekyll
 | 
			
		|||
        end
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      # Check if key exists in Drop
 | 
			
		||||
      #
 | 
			
		||||
      # key - the string key whose value to fetch
 | 
			
		||||
      #
 | 
			
		||||
      # Returns true if the given key is present
 | 
			
		||||
      def key?(key)
 | 
			
		||||
        if self.class.mutable && @mutations.key?(key)
 | 
			
		||||
          true
 | 
			
		||||
        else
 | 
			
		||||
          respond_to?(key) || fallback_data.key?(key)
 | 
			
		||||
        end
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      # Generates a list of keys with user content as their values.
 | 
			
		||||
      # This gathers up the Drop methods and keys of the mutations and
 | 
			
		||||
      # underlying data hashes and performs a set union to ensure a list
 | 
			
		||||
| 
						 | 
				
			
			@ -101,7 +114,7 @@ module Jekyll
 | 
			
		|||
      #
 | 
			
		||||
      # Returns a Hash with all the keys and values resolved.
 | 
			
		||||
      def to_h
 | 
			
		||||
        keys.each_with_object({}) do |(key, val), result|
 | 
			
		||||
        keys.each_with_object({}) do |(key, _), result|
 | 
			
		||||
          result[key] = self[key]
 | 
			
		||||
        end
 | 
			
		||||
      end
 | 
			
		||||
| 
						 | 
				
			
			@ -122,7 +135,6 @@ module Jekyll
 | 
			
		|||
      def each_key(&block)
 | 
			
		||||
        keys.each(&block)
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -33,7 +33,6 @@ module Jekyll
 | 
			
		|||
 | 
			
		||||
      private
 | 
			
		||||
      def_delegator :@obj, :config, :fallback_data
 | 
			
		||||
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -20,7 +20,6 @@ module Jekyll
 | 
			
		|||
      def fallback_data
 | 
			
		||||
        @fallback_data ||= {}
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -19,8 +19,8 @@ module Jekyll
 | 
			
		|||
      end
 | 
			
		||||
 | 
			
		||||
      def title
 | 
			
		||||
        Utils.slugify(@obj.data['slug'], mode: "pretty", cased: true) ||
 | 
			
		||||
          Utils.slugify(@obj.basename_without_ext, mode: "pretty", cased: true)
 | 
			
		||||
        Utils.slugify(@obj.data['slug'], :mode => "pretty", :cased => true) ||
 | 
			
		||||
          Utils.slugify(@obj.basename_without_ext, :mode => "pretty", :cased => true)
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      def slug
 | 
			
		||||
| 
						 | 
				
			
			@ -35,17 +35,49 @@ module Jekyll
 | 
			
		|||
        category_set.to_a.join('/')
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      def year;        @obj.date.strftime("%Y"); end
 | 
			
		||||
      def month;       @obj.date.strftime("%m"); end
 | 
			
		||||
      def day;         @obj.date.strftime("%d"); end
 | 
			
		||||
      def hour;        @obj.date.strftime("%H"); end
 | 
			
		||||
      def minute;      @obj.date.strftime("%M"); end
 | 
			
		||||
      def second;      @obj.date.strftime("%S"); end
 | 
			
		||||
      def i_day;       @obj.date.strftime("%-d"); end
 | 
			
		||||
      def i_month;     @obj.date.strftime("%-m"); end
 | 
			
		||||
      def short_month; @obj.date.strftime("%b"); end
 | 
			
		||||
      def short_year;  @obj.date.strftime("%y"); end
 | 
			
		||||
      def y_day;       @obj.date.strftime("%j"); end
 | 
			
		||||
      def year
 | 
			
		||||
        @obj.date.strftime("%Y")
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      def month
 | 
			
		||||
        @obj.date.strftime("%m")
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      def day
 | 
			
		||||
        @obj.date.strftime("%d")
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      def hour
 | 
			
		||||
        @obj.date.strftime("%H")
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      def minute
 | 
			
		||||
        @obj.date.strftime("%M")
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      def second
 | 
			
		||||
        @obj.date.strftime("%S")
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      def i_day
 | 
			
		||||
        @obj.date.strftime("%-d")
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      def i_month
 | 
			
		||||
        @obj.date.strftime("%-m")
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      def short_month
 | 
			
		||||
        @obj.date.strftime("%b")
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      def short_year
 | 
			
		||||
        @obj.date.strftime("%y")
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      def y_day
 | 
			
		||||
        @obj.date.strftime("%j")
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,16 +1,15 @@
 | 
			
		|||
module Jekyll
 | 
			
		||||
  module External
 | 
			
		||||
    class << self
 | 
			
		||||
 | 
			
		||||
      #
 | 
			
		||||
      # Gems that, if installed, should be loaded.
 | 
			
		||||
      # Usually contain subcommands.
 | 
			
		||||
      #
 | 
			
		||||
      def blessed_gems
 | 
			
		||||
        %w{
 | 
			
		||||
        %w(
 | 
			
		||||
          jekyll-docs
 | 
			
		||||
          jekyll-import
 | 
			
		||||
        }
 | 
			
		||||
        )
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      #
 | 
			
		||||
| 
						 | 
				
			
			@ -54,7 +53,6 @@ If you run into trouble, you can find helpful resources at http://jekyllrb.com/h
 | 
			
		|||
          end
 | 
			
		||||
        end
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -45,7 +45,7 @@ module Jekyll
 | 
			
		|||
    # Returns the given filename or title as a lowercase URL String.
 | 
			
		||||
    # See Utils.slugify for more detail.
 | 
			
		||||
    def slugify(input, mode=nil)
 | 
			
		||||
      Utils.slugify(input, mode: mode)
 | 
			
		||||
      Utils.slugify(input, :mode => mode)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    # Format a date in short format e.g. "27 Jan 2011".
 | 
			
		||||
| 
						 | 
				
			
			@ -194,7 +194,7 @@ module Jekyll
 | 
			
		|||
        input.group_by do |item|
 | 
			
		||||
          item_property(item, property).to_s
 | 
			
		||||
        end.inject([]) do |memo, i|
 | 
			
		||||
          memo << {"name" => i.first, "items" => i.last}
 | 
			
		||||
          memo << { "name" => i.first, "items" => i.last }
 | 
			
		||||
        end
 | 
			
		||||
      else
 | 
			
		||||
        input
 | 
			
		||||
| 
						 | 
				
			
			@ -223,7 +223,7 @@ module Jekyll
 | 
			
		|||
    # Returns the filtered array of objects
 | 
			
		||||
    def sort(input, property = nil, nils = "first")
 | 
			
		||||
      if input.nil?
 | 
			
		||||
          raise ArgumentError.new("Cannot sort a null object.")
 | 
			
		||||
        raise ArgumentError.new("Cannot sort a null object.")
 | 
			
		||||
      end
 | 
			
		||||
      if property.nil?
 | 
			
		||||
        input.sort
 | 
			
		||||
| 
						 | 
				
			
			@ -234,11 +234,11 @@ module Jekyll
 | 
			
		|||
        when nils == "last"
 | 
			
		||||
          order = + 1
 | 
			
		||||
        else
 | 
			
		||||
          raise ArgumentError.new("Invalid nils order: " +
 | 
			
		||||
          raise ArgumentError.new("Invalid nils order: " \
 | 
			
		||||
            "'#{nils}' is not a valid nils order. It must be 'first' or 'last'.")
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
        input.sort { |apple, orange|
 | 
			
		||||
        input.sort do |apple, orange|
 | 
			
		||||
          apple_property = item_property(apple, property)
 | 
			
		||||
          orange_property = item_property(orange, property)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -249,7 +249,7 @@ module Jekyll
 | 
			
		|||
          else
 | 
			
		||||
            apple_property <=> orange_property
 | 
			
		||||
          end
 | 
			
		||||
        }
 | 
			
		||||
        end
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -337,7 +337,7 @@ module Jekyll
 | 
			
		|||
        pairs = item.map { |k, v| as_liquid([k, v]) }
 | 
			
		||||
        Hash[pairs]
 | 
			
		||||
      when Array
 | 
			
		||||
        item.map{ |i| as_liquid(i) }
 | 
			
		||||
        item.map { |i| as_liquid(i) }
 | 
			
		||||
      else
 | 
			
		||||
        if item.respond_to?(:to_liquid)
 | 
			
		||||
          liquidated = item.to_liquid
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -13,19 +13,20 @@ module Jekyll
 | 
			
		|||
    def update_deprecated_types(set)
 | 
			
		||||
      return set unless set.key?('scope') && set['scope'].key?('type')
 | 
			
		||||
 | 
			
		||||
      set['scope']['type'] = case set['scope']['type']
 | 
			
		||||
      when 'page'
 | 
			
		||||
        Deprecator.defaults_deprecate_type('page', 'pages')
 | 
			
		||||
        'pages'
 | 
			
		||||
      when 'post'
 | 
			
		||||
        Deprecator.defaults_deprecate_type('post', 'posts')
 | 
			
		||||
        'posts'
 | 
			
		||||
      when 'draft'
 | 
			
		||||
        Deprecator.defaults_deprecate_type('draft', 'drafts')
 | 
			
		||||
        'drafts'
 | 
			
		||||
      else
 | 
			
		||||
        set['scope']['type']
 | 
			
		||||
      end
 | 
			
		||||
      set['scope']['type'] =
 | 
			
		||||
        case set['scope']['type']
 | 
			
		||||
        when 'page'
 | 
			
		||||
          Deprecator.defaults_deprecate_type('page', 'pages')
 | 
			
		||||
          'pages'
 | 
			
		||||
        when 'post'
 | 
			
		||||
          Deprecator.defaults_deprecate_type('post', 'posts')
 | 
			
		||||
          'posts'
 | 
			
		||||
        when 'draft'
 | 
			
		||||
          Deprecator.defaults_deprecate_type('draft', 'drafts')
 | 
			
		||||
          'drafts'
 | 
			
		||||
        else
 | 
			
		||||
          set['scope']['type']
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
      set
 | 
			
		||||
    end
 | 
			
		||||
| 
						 | 
				
			
			@ -90,7 +91,7 @@ module Jekyll
 | 
			
		|||
    end
 | 
			
		||||
 | 
			
		||||
    def applies_path?(scope, path)
 | 
			
		||||
      return true if !scope.has_key?('path') || scope['path'].empty?
 | 
			
		||||
      return true if !scope.key?('path') || scope['path'].empty?
 | 
			
		||||
 | 
			
		||||
      scope_path = Pathname.new(scope['path'])
 | 
			
		||||
      Pathname.new(sanitize_path(path)).ascend do |path|
 | 
			
		||||
| 
						 | 
				
			
			@ -150,7 +151,7 @@ module Jekyll
 | 
			
		|||
    # Returns an array of hashes
 | 
			
		||||
    def matching_sets(path, type)
 | 
			
		||||
      valid_sets.select do |set|
 | 
			
		||||
        !set.has_key?('scope') || applies?(set['scope'], path, type)
 | 
			
		||||
        !set.key?('scope') || applies?(set['scope'], path, type)
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,38 +4,38 @@ module Jekyll
 | 
			
		|||
 | 
			
		||||
    # compatibility layer for octopress-hooks users
 | 
			
		||||
    PRIORITY_MAP = {
 | 
			
		||||
      low: 10,
 | 
			
		||||
      normal: 20,
 | 
			
		||||
      high: 30,
 | 
			
		||||
      :low => 10,
 | 
			
		||||
      :normal => 20,
 | 
			
		||||
      :high => 30
 | 
			
		||||
    }.freeze
 | 
			
		||||
 | 
			
		||||
    # initial empty hooks
 | 
			
		||||
    @registry = {
 | 
			
		||||
      :site => {
 | 
			
		||||
        after_reset: [],
 | 
			
		||||
        post_read: [],
 | 
			
		||||
        pre_render: [],
 | 
			
		||||
        post_render: [],
 | 
			
		||||
        post_write: [],
 | 
			
		||||
        :after_reset => [],
 | 
			
		||||
        :post_read => [],
 | 
			
		||||
        :pre_render => [],
 | 
			
		||||
        :post_render => [],
 | 
			
		||||
        :post_write => []
 | 
			
		||||
      },
 | 
			
		||||
      :pages => {
 | 
			
		||||
        post_init: [],
 | 
			
		||||
        pre_render: [],
 | 
			
		||||
        post_render: [],
 | 
			
		||||
        post_write: [],
 | 
			
		||||
        :post_init => [],
 | 
			
		||||
        :pre_render => [],
 | 
			
		||||
        :post_render => [],
 | 
			
		||||
        :post_write => []
 | 
			
		||||
      },
 | 
			
		||||
      :posts => {
 | 
			
		||||
        post_init: [],
 | 
			
		||||
        pre_render: [],
 | 
			
		||||
        post_render: [],
 | 
			
		||||
        post_write: [],
 | 
			
		||||
        :post_init => [],
 | 
			
		||||
        :pre_render => [],
 | 
			
		||||
        :post_render => [],
 | 
			
		||||
        :post_write => []
 | 
			
		||||
      },
 | 
			
		||||
      :documents => {
 | 
			
		||||
        post_init: [],
 | 
			
		||||
        pre_render: [],
 | 
			
		||||
        post_render: [],
 | 
			
		||||
        post_write: [],
 | 
			
		||||
      },
 | 
			
		||||
        :post_init => [],
 | 
			
		||||
        :pre_render => [],
 | 
			
		||||
        :post_render => [],
 | 
			
		||||
        :post_write => []
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    # map of all hooks and their priorities
 | 
			
		||||
| 
						 | 
				
			
			@ -60,14 +60,14 @@ module Jekyll
 | 
			
		|||
    # register a single hook to be called later, internal API
 | 
			
		||||
    def self.register_one(owner, event, priority, &block)
 | 
			
		||||
      @registry[owner] ||={
 | 
			
		||||
        post_init: [],
 | 
			
		||||
        pre_render: [],
 | 
			
		||||
        post_render: [],
 | 
			
		||||
        post_write: [],
 | 
			
		||||
        :post_init => [],
 | 
			
		||||
        :pre_render => [],
 | 
			
		||||
        :post_render => [],
 | 
			
		||||
        :post_write => []
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      unless @registry[owner][event]
 | 
			
		||||
        raise NotAvailable, "Invalid hook. #{owner} supports only the " <<
 | 
			
		||||
        raise NotAvailable, "Invalid hook. #{owner} supports only the " \
 | 
			
		||||
          "following hooks #{@registry[owner].keys.inspect}"
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -15,7 +15,7 @@ module Jekyll
 | 
			
		|||
    def file(filename)
 | 
			
		||||
      filename = @site.in_source_dir(filename).sub(/\A#{Regexp.escape(@site.source)}\//, '')
 | 
			
		||||
 | 
			
		||||
      LiquidRenderer::File.new(self, filename).tap do |file|
 | 
			
		||||
      LiquidRenderer::File.new(self, filename).tap do
 | 
			
		||||
        @stats[filename] ||= {}
 | 
			
		||||
        @stats[filename][:count] ||= 0
 | 
			
		||||
        @stats[filename][:count] += 1
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -69,10 +69,10 @@ module Jekyll
 | 
			
		|||
    end
 | 
			
		||||
 | 
			
		||||
    def data_for_table(n)
 | 
			
		||||
      sorted = @stats.sort_by{ |filename, file_stats| -file_stats[:time] }
 | 
			
		||||
      sorted = @stats.sort_by { |_, file_stats| -file_stats[:time] }
 | 
			
		||||
      sorted = sorted.slice(0, n)
 | 
			
		||||
 | 
			
		||||
      table = [[ 'Filename', 'Count', 'Bytes', 'Time' ]]
 | 
			
		||||
      table = [%w(Filename Count Bytes Time)]
 | 
			
		||||
 | 
			
		||||
      sorted.each do |filename, file_stats|
 | 
			
		||||
        row = []
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,13 +8,13 @@ module Jekyll
 | 
			
		|||
    attr_accessor :data, :content, :output
 | 
			
		||||
 | 
			
		||||
    # Attributes for Liquid templates
 | 
			
		||||
    ATTRIBUTES_FOR_LIQUID = %w[
 | 
			
		||||
    ATTRIBUTES_FOR_LIQUID = %w(
 | 
			
		||||
      content
 | 
			
		||||
      dir
 | 
			
		||||
      name
 | 
			
		||||
      path
 | 
			
		||||
      url
 | 
			
		||||
    ]
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
    # A set of extensions that are considered HTML or HTML-like so we
 | 
			
		||||
    # should not alter them,  this includes .xhtml through XHTM5.
 | 
			
		||||
| 
						 | 
				
			
			@ -37,11 +37,10 @@ module Jekyll
 | 
			
		|||
      @dir  = dir
 | 
			
		||||
      @name = name
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
      process(name)
 | 
			
		||||
      read_yaml(File.join(base, dir), name)
 | 
			
		||||
 | 
			
		||||
      data.default_proc = proc do |hash, key|
 | 
			
		||||
      data.default_proc = proc do |_, key|
 | 
			
		||||
        site.frontmatter_defaults.find(File.join(dir, name), type, key)
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -107,7 +106,7 @@ module Jekyll
 | 
			
		|||
    # Returns nothing.
 | 
			
		||||
    def process(name)
 | 
			
		||||
      self.ext = File.extname(name)
 | 
			
		||||
      self.basename = name[0 .. -ext.length - 1]
 | 
			
		||||
      self.basename = name[0..-ext.length - 1]
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    # Add any necessary layouts to this post
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -76,7 +76,7 @@ module Jekyll
 | 
			
		|||
    #
 | 
			
		||||
    # Returns an Array of plugin search paths
 | 
			
		||||
    def plugins_path
 | 
			
		||||
      if (site.config['plugins_dir'] == Jekyll::Configuration::DEFAULTS['plugins_dir'])
 | 
			
		||||
      if site.config['plugins_dir'] == Jekyll::Configuration::DEFAULTS['plugins_dir']
 | 
			
		||||
        [site.in_source_dir(site.config['plugins_dir'])]
 | 
			
		||||
      else
 | 
			
		||||
        Array(site.config['plugins_dir']).map { |d| File.expand_path(d) }
 | 
			
		||||
| 
						 | 
				
			
			@ -86,11 +86,10 @@ module Jekyll
 | 
			
		|||
    def deprecation_checks
 | 
			
		||||
      pagination_included = (site.config['gems'] || []).include?('jekyll-paginate') || defined?(Jekyll::Paginate)
 | 
			
		||||
      if site.config['paginate'] && !pagination_included
 | 
			
		||||
        Jekyll::Deprecator.deprecation_message "You appear to have pagination " +
 | 
			
		||||
          "turned on, but you haven't included the `jekyll-paginate` gem. " +
 | 
			
		||||
        Jekyll::Deprecator.deprecation_message "You appear to have pagination " \
 | 
			
		||||
          "turned on, but you haven't included the `jekyll-paginate` gem. " \
 | 
			
		||||
          "Ensure you have `gems: [jekyll-paginate]` in your configuration file."
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -22,7 +22,7 @@ module Jekyll
 | 
			
		|||
 | 
			
		||||
    # Sorts posts, pages, and static files.
 | 
			
		||||
    def sort_files!
 | 
			
		||||
      site.collections.values.each{|c| c.docs.sort!}
 | 
			
		||||
      site.collections.values.each { |c| c.docs.sort! }
 | 
			
		||||
      site.pages.sort_by!(&:name)
 | 
			
		||||
      site.static_files.sort_by!(&:relative_path)
 | 
			
		||||
    end
 | 
			
		||||
| 
						 | 
				
			
			@ -38,9 +38,9 @@ module Jekyll
 | 
			
		|||
      base = site.in_source_dir(dir)
 | 
			
		||||
 | 
			
		||||
      dot = Dir.chdir(base) { filter_entries(Dir.entries('.'), base) }
 | 
			
		||||
      dot_dirs = dot.select{ |file| File.directory?(@site.in_source_dir(base,file)) }
 | 
			
		||||
      dot_dirs = dot.select { |file| File.directory?(@site.in_source_dir(base, file)) }
 | 
			
		||||
      dot_files = (dot - dot_dirs)
 | 
			
		||||
      dot_pages = dot_files.select{ |file| Utils.has_yaml_header?(@site.in_source_dir(base,file)) }
 | 
			
		||||
      dot_pages = dot_files.select { |file| Utils.has_yaml_header?(@site.in_source_dir(base, file)) }
 | 
			
		||||
      dot_static_files = dot_files - dot_pages
 | 
			
		||||
 | 
			
		||||
      retrieve_posts(dir)
 | 
			
		||||
| 
						 | 
				
			
			@ -67,12 +67,12 @@ module Jekyll
 | 
			
		|||
    # dot_dirs - The Array of subdirectories in the dir.
 | 
			
		||||
    #
 | 
			
		||||
    # Returns nothing.
 | 
			
		||||
    def retrieve_dirs(base, dir, dot_dirs)
 | 
			
		||||
      dot_dirs.map { |file|
 | 
			
		||||
        dir_path = site.in_source_dir(dir,file)
 | 
			
		||||
    def retrieve_dirs(_base, dir, dot_dirs)
 | 
			
		||||
      dot_dirs.map do |file|
 | 
			
		||||
        dir_path = site.in_source_dir(dir, file)
 | 
			
		||||
        rel_path = File.join(dir, file)
 | 
			
		||||
        @site.reader.read_directories(rel_path) unless @site.dest.sub(/\/$/, '') == dir_path
 | 
			
		||||
      }
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    # Retrieve all the pages from the current directory,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,6 @@
 | 
			
		|||
module Jekyll
 | 
			
		||||
  class CollectionReader
 | 
			
		||||
    SPECIAL_COLLECTIONS = %w{posts data}.freeze
 | 
			
		||||
    SPECIAL_COLLECTIONS = %w(posts data).freeze
 | 
			
		||||
 | 
			
		||||
    attr_reader :site, :content
 | 
			
		||||
    def initialize(site)
 | 
			
		||||
| 
						 | 
				
			
			@ -16,6 +16,5 @@ module Jekyll
 | 
			
		|||
        collection.read unless SPECIAL_COLLECTIONS.include?(collection.label)
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -50,13 +50,13 @@ module Jekyll
 | 
			
		|||
    # Returns the contents of the data file.
 | 
			
		||||
    def read_data_file(path)
 | 
			
		||||
      case File.extname(path).downcase
 | 
			
		||||
        when '.csv'
 | 
			
		||||
          CSV.read(path, {
 | 
			
		||||
                           :headers => true,
 | 
			
		||||
                           :encoding => site.config['encoding']
 | 
			
		||||
                       }).map(&:to_hash)
 | 
			
		||||
        else
 | 
			
		||||
          SafeYAML.load_file(path)
 | 
			
		||||
      when '.csv'
 | 
			
		||||
        CSV.read(path, {
 | 
			
		||||
                         :headers => true,
 | 
			
		||||
                         :encoding => site.config['encoding']
 | 
			
		||||
                     }).map(&:to_hash)
 | 
			
		||||
      else
 | 
			
		||||
        SafeYAML.load_file(path)
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,7 +4,7 @@ module Jekyll
 | 
			
		|||
    def initialize(site, dir)
 | 
			
		||||
      @site = site
 | 
			
		||||
      @dir = dir
 | 
			
		||||
      @unfiltered_content = Array.new
 | 
			
		||||
      @unfiltered_content = []
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    # Read all the files in <source>/<dir>/ for Yaml header and create a new Page
 | 
			
		||||
| 
						 | 
				
			
			@ -14,8 +14,8 @@ module Jekyll
 | 
			
		|||
    #
 | 
			
		||||
    # Returns an array of static pages.
 | 
			
		||||
    def read(files)
 | 
			
		||||
      files.map{ |page| @unfiltered_content << Page.new(@site, @site.source, @dir, page) }
 | 
			
		||||
      @unfiltered_content.select{ |page| site.publisher.publish?(page) }
 | 
			
		||||
      files.map { |page| @unfiltered_content << Page.new(@site, @site.source, @dir, page) }
 | 
			
		||||
      @unfiltered_content.select { |page| site.publisher.publish?(page) }
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -53,8 +53,8 @@ module Jekyll
 | 
			
		|||
        next unless entry =~ matcher
 | 
			
		||||
        path = @site.in_source_dir(File.join(dir, magic_dir, entry))
 | 
			
		||||
        Document.new(path, {
 | 
			
		||||
          site: @site,
 | 
			
		||||
          collection: @site.posts
 | 
			
		||||
          :site => @site,
 | 
			
		||||
          :collection => @site.posts
 | 
			
		||||
        })
 | 
			
		||||
      end.reject(&:nil?)
 | 
			
		||||
    end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,7 +4,7 @@ module Jekyll
 | 
			
		|||
    def initialize(site, dir)
 | 
			
		||||
      @site = site
 | 
			
		||||
      @dir = dir
 | 
			
		||||
      @unfiltered_content = Array.new
 | 
			
		||||
      @unfiltered_content = []
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    # Read all the files in <source>/<dir>/ for Yaml header and create a new Page
 | 
			
		||||
| 
						 | 
				
			
			@ -14,7 +14,7 @@ module Jekyll
 | 
			
		|||
    #
 | 
			
		||||
    # Returns an array of static files.
 | 
			
		||||
    def read(files)
 | 
			
		||||
      files.map{ |file| @unfiltered_content << StaticFile.new(@site, @site.source, @dir, file)}
 | 
			
		||||
      files.map { |file| @unfiltered_content << StaticFile.new(@site, @site.source, @dir, file) }
 | 
			
		||||
      @unfiltered_content
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -62,7 +62,6 @@ module Jekyll
 | 
			
		|||
      clear_cache
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    # Clear just the cache
 | 
			
		||||
    #
 | 
			
		||||
    # Returns nothing
 | 
			
		||||
| 
						 | 
				
			
			@ -70,13 +69,12 @@ module Jekyll
 | 
			
		|||
      @cache = {}
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    # Checks if the source has been modified or the
 | 
			
		||||
    # destination is missing
 | 
			
		||||
    #
 | 
			
		||||
    # returns a boolean
 | 
			
		||||
    def source_modified_or_dest_missing?(source_path, dest_path)
 | 
			
		||||
      modified?(source_path) || (dest_path and !File.exist?(dest_path))
 | 
			
		||||
      modified?(source_path) || (dest_path && !File.exist?(dest_path))
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    # Checks if a path's (or one of its dependencies)
 | 
			
		||||
| 
						 | 
				
			
			@ -90,7 +88,7 @@ module Jekyll
 | 
			
		|||
      return true if path.nil?
 | 
			
		||||
 | 
			
		||||
      # Check for path in cache
 | 
			
		||||
      if cache.has_key? path
 | 
			
		||||
      if cache.key? path
 | 
			
		||||
        return cache[path]
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -117,9 +115,9 @@ module Jekyll
 | 
			
		|||
    #
 | 
			
		||||
    # Returns nothing.
 | 
			
		||||
    def add_dependency(path, dependency)
 | 
			
		||||
      return if (metadata[path].nil? || @disabled)
 | 
			
		||||
      return if metadata[path].nil? || @disabled
 | 
			
		||||
 | 
			
		||||
      if !metadata[path]["deps"].include? dependency
 | 
			
		||||
      unless metadata[path]["deps"].include? dependency
 | 
			
		||||
        metadata[path]["deps"] << dependency
 | 
			
		||||
        add(dependency) unless metadata.include?(dependency)
 | 
			
		||||
      end
 | 
			
		||||
| 
						 | 
				
			
			@ -157,20 +155,21 @@ module Jekyll
 | 
			
		|||
    #
 | 
			
		||||
    # Returns the read metadata.
 | 
			
		||||
    def read_metadata
 | 
			
		||||
      @metadata = if !disabled? && File.file?(metadata_file)
 | 
			
		||||
        content = File.binread(metadata_file)
 | 
			
		||||
      @metadata =
 | 
			
		||||
        if !disabled? && File.file?(metadata_file)
 | 
			
		||||
          content = File.binread(metadata_file)
 | 
			
		||||
 | 
			
		||||
        begin
 | 
			
		||||
          Marshal.load(content)
 | 
			
		||||
        rescue TypeError
 | 
			
		||||
          SafeYAML.load(content)
 | 
			
		||||
        rescue ArgumentError => e
 | 
			
		||||
          Jekyll.logger.warn("Failed to load #{metadata_file}: #{e}")
 | 
			
		||||
          begin
 | 
			
		||||
            Marshal.load(content)
 | 
			
		||||
          rescue TypeError
 | 
			
		||||
            SafeYAML.load(content)
 | 
			
		||||
          rescue ArgumentError => e
 | 
			
		||||
            Jekyll.logger.warn("Failed to load #{metadata_file}: #{e}")
 | 
			
		||||
            {}
 | 
			
		||||
          end
 | 
			
		||||
        else
 | 
			
		||||
          {}
 | 
			
		||||
        end
 | 
			
		||||
      else
 | 
			
		||||
        {}
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,5 @@
 | 
			
		|||
module Jekyll
 | 
			
		||||
  class RelatedPosts
 | 
			
		||||
 | 
			
		||||
    class << self
 | 
			
		||||
      attr_accessor :lsi
 | 
			
		||||
    end
 | 
			
		||||
| 
						 | 
				
			
			@ -24,7 +23,6 @@ module Jekyll
 | 
			
		|||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    def build_index
 | 
			
		||||
      self.class.lsi ||= begin
 | 
			
		||||
        lsi = ClassifierReborn::LSI.new(:auto_rebuild => false)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,7 +2,6 @@
 | 
			
		|||
 | 
			
		||||
module Jekyll
 | 
			
		||||
  class Renderer
 | 
			
		||||
 | 
			
		||||
    attr_reader :document, :site, :payload
 | 
			
		||||
 | 
			
		||||
    def initialize(site, document, site_payload = nil)
 | 
			
		||||
| 
						 | 
				
			
			@ -43,8 +42,8 @@ module Jekyll
 | 
			
		|||
      document.trigger_hooks(:pre_render, payload)
 | 
			
		||||
 | 
			
		||||
      info = {
 | 
			
		||||
        filters:   [Jekyll::Filters],
 | 
			
		||||
        registers: { :site => site, :page => payload.page }
 | 
			
		||||
        :filters => [Jekyll::Filters],
 | 
			
		||||
        :registers => { :site => site, :page => payload.page }
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      # render and transform content (this becomes the final content of the object)
 | 
			
		||||
| 
						 | 
				
			
			@ -161,6 +160,5 @@ module Jekyll
 | 
			
		|||
 | 
			
		||||
      output
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -19,8 +19,8 @@ module Jekyll
 | 
			
		|||
    def initialize(config)
 | 
			
		||||
      @config = config.clone
 | 
			
		||||
 | 
			
		||||
      %w[safe lsi highlighter baseurl exclude include future unpublished
 | 
			
		||||
        show_drafts limit_posts keep_files gems].each do |opt|
 | 
			
		||||
      %w(safe lsi highlighter baseurl exclude include future unpublished
 | 
			
		||||
        show_drafts limit_posts keep_files gems).each do |opt|
 | 
			
		||||
        self.send("#{opt}=", config[opt])
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -165,7 +165,7 @@ module Jekyll
 | 
			
		|||
 | 
			
		||||
      Jekyll::Hooks.trigger :site, :pre_render, self, payload
 | 
			
		||||
 | 
			
		||||
      collections.each do |label, collection|
 | 
			
		||||
      collections.each do |_, collection|
 | 
			
		||||
        collection.docs.each do |document|
 | 
			
		||||
          if regenerator.regenerate?(document)
 | 
			
		||||
            document.output = Jekyll::Renderer.new(self, document, payload).run
 | 
			
		||||
| 
						 | 
				
			
			@ -196,9 +196,9 @@ module Jekyll
 | 
			
		|||
    #
 | 
			
		||||
    # Returns nothing.
 | 
			
		||||
    def write
 | 
			
		||||
      each_site_file { |item|
 | 
			
		||||
      each_site_file do |item|
 | 
			
		||||
        item.write(dest) if regenerator.regenerate?(item)
 | 
			
		||||
      }
 | 
			
		||||
      end
 | 
			
		||||
      regenerator.write_metadata
 | 
			
		||||
      Jekyll::Hooks.trigger :site, :post_write, self
 | 
			
		||||
    end
 | 
			
		||||
| 
						 | 
				
			
			@ -292,10 +292,10 @@ module Jekyll
 | 
			
		|||
    # Returns
 | 
			
		||||
    def relative_permalinks_are_deprecated
 | 
			
		||||
      if config['relative_permalinks']
 | 
			
		||||
        Jekyll.logger.abort_with "Since v3.0, permalinks for pages" +
 | 
			
		||||
                                " in subfolders must be relative to the" +
 | 
			
		||||
                                " site source directory, not the parent" +
 | 
			
		||||
                                " directory. Check http://jekyllrb.com/docs/upgrading/"+
 | 
			
		||||
        Jekyll.logger.abort_with "Since v3.0, permalinks for pages" \
 | 
			
		||||
                                " in subfolders must be relative to the" \
 | 
			
		||||
                                " site source directory, not the parent" \
 | 
			
		||||
                                " directory. Check http://jekyllrb.com/docs/upgrading/"\
 | 
			
		||||
                                " for more info."
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,7 +1,7 @@
 | 
			
		|||
module Jekyll
 | 
			
		||||
  class StaticFile
 | 
			
		||||
    # The cache of last modification times [path] -> mtime.
 | 
			
		||||
    @@mtimes = Hash.new
 | 
			
		||||
    @@mtimes = {}
 | 
			
		||||
 | 
			
		||||
    attr_reader :relative_path, :extname
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -75,7 +75,7 @@ module Jekyll
 | 
			
		|||
    def write(dest)
 | 
			
		||||
      dest_path = destination(dest)
 | 
			
		||||
 | 
			
		||||
      return false if File.exist?(dest_path) and !modified?
 | 
			
		||||
      return false if File.exist?(dest_path) && !modified?
 | 
			
		||||
      @@mtimes[path] = mtime
 | 
			
		||||
 | 
			
		||||
      FileUtils.mkdir_p(File.dirname(dest_path))
 | 
			
		||||
| 
						 | 
				
			
			@ -90,7 +90,7 @@ module Jekyll
 | 
			
		|||
    #
 | 
			
		||||
    # Returns nothing.
 | 
			
		||||
    def self.reset_cache
 | 
			
		||||
      @@mtimes = Hash.new
 | 
			
		||||
      @@mtimes = {}
 | 
			
		||||
      nil
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -104,12 +104,12 @@ module Jekyll
 | 
			
		|||
 | 
			
		||||
    def placeholders
 | 
			
		||||
      {
 | 
			
		||||
        collection: @collection.label,
 | 
			
		||||
        path: relative_path[
 | 
			
		||||
        :collection => @collection.label,
 | 
			
		||||
        :path => relative_path[
 | 
			
		||||
          @collection.relative_directory.size..relative_path.size],
 | 
			
		||||
        output_ext: '',
 | 
			
		||||
        name: '',
 | 
			
		||||
        title: '',
 | 
			
		||||
        :output_ext => '',
 | 
			
		||||
        :name => '',
 | 
			
		||||
        :title => ''
 | 
			
		||||
      }
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -118,13 +118,13 @@ module Jekyll
 | 
			
		|||
    # be overriden in the collection's configuration in _config.yml.
 | 
			
		||||
    def url
 | 
			
		||||
      @url ||= if @collection.nil?
 | 
			
		||||
        relative_path
 | 
			
		||||
      else
 | 
			
		||||
        ::Jekyll::URL.new({
 | 
			
		||||
          template:  @collection.url_template,
 | 
			
		||||
          placeholders: placeholders,
 | 
			
		||||
        })
 | 
			
		||||
      end.to_s.gsub /\/$/, ''
 | 
			
		||||
                 relative_path
 | 
			
		||||
               else
 | 
			
		||||
                 ::Jekyll::URL.new({
 | 
			
		||||
                   :template => @collection.url_template,
 | 
			
		||||
                   :placeholders => placeholders
 | 
			
		||||
                 })
 | 
			
		||||
               end.to_s.gsub(/\/$/, '')
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    # Returns the type of the collection if present, nil otherwise.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,7 +5,7 @@ module Jekyll
 | 
			
		|||
      @level = DEBUG
 | 
			
		||||
      @default_formatter = Formatter.new
 | 
			
		||||
      @logdev = $stdout
 | 
			
		||||
      @formatter = proc do |severity, datetime, progname, msg|
 | 
			
		||||
      @formatter = proc do |_, _, _, msg|
 | 
			
		||||
        "#{msg}"
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
| 
						 | 
				
			
			@ -14,7 +14,7 @@ module Jekyll
 | 
			
		|||
      severity ||= UNKNOWN
 | 
			
		||||
      @logdev = set_logdevice(severity)
 | 
			
		||||
 | 
			
		||||
      if @logdev.nil? or severity < @level
 | 
			
		||||
      if @logdev.nil? || severity < @level
 | 
			
		||||
        return true
 | 
			
		||||
      end
 | 
			
		||||
      progname ||= @progname
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -13,21 +13,21 @@ module Jekyll
 | 
			
		|||
      def initialize(tag_name, markup, tokens)
 | 
			
		||||
        super
 | 
			
		||||
        if markup.strip =~ SYNTAX
 | 
			
		||||
          @lang = $1.downcase
 | 
			
		||||
          @lang = Regexp.last_match(1).downcase
 | 
			
		||||
          @highlight_options = {}
 | 
			
		||||
          if defined?($2) && $2 != ''
 | 
			
		||||
          if defined?(Regexp.last_match(2)) && Regexp.last_match(2) != ''
 | 
			
		||||
            # Split along 3 possible forms -- key="<quoted list>", key=value, or key
 | 
			
		||||
            $2.scan(/(?:\w="[^"]*"|\w=\w|\w)+/) do |opt|
 | 
			
		||||
            Regexp.last_match(2).scan(/(?:\w="[^"]*"|\w=\w|\w)+/) do |opt|
 | 
			
		||||
              key, value = opt.split('=')
 | 
			
		||||
              # If a quoted list, convert to array
 | 
			
		||||
              if value && value.include?("\"")
 | 
			
		||||
                  value.gsub!(/"/, "")
 | 
			
		||||
                value.delete!('"')
 | 
			
		||||
                  value = value.split
 | 
			
		||||
              end
 | 
			
		||||
              @highlight_options[key.to_sym] = value || true
 | 
			
		||||
            end
 | 
			
		||||
          end
 | 
			
		||||
          @highlight_options[:linenos] = "inline" if @highlight_options.key?(:linenos) and @highlight_options[:linenos] == true
 | 
			
		||||
          @highlight_options[:linenos] = "inline" if @highlight_options.key?(:linenos) && @highlight_options[:linenos] == true
 | 
			
		||||
        else
 | 
			
		||||
          raise SyntaxError.new <<-eos
 | 
			
		||||
Syntax Error in tag 'highlight' while parsing the following markup:
 | 
			
		||||
| 
						 | 
				
			
			@ -68,7 +68,7 @@ eos
 | 
			
		|||
            [:linenos,     opts.fetch(:linenos, nil)],
 | 
			
		||||
            [:encoding,    opts.fetch(:encoding, 'utf-8')],
 | 
			
		||||
            [:cssclass,    opts.fetch(:cssclass, nil)]
 | 
			
		||||
          ].reject {|f| f.last.nil? }]
 | 
			
		||||
          ].reject { |f| f.last.nil? }]
 | 
			
		||||
        else
 | 
			
		||||
          opts
 | 
			
		||||
        end
 | 
			
		||||
| 
						 | 
				
			
			@ -88,7 +88,7 @@ eos
 | 
			
		|||
          puts
 | 
			
		||||
          Jekyll.logger.error code
 | 
			
		||||
          puts
 | 
			
		||||
          Jekyll.logger.error "While attempting to convert the above code, Pygments.rb" +
 | 
			
		||||
          Jekyll.logger.error "While attempting to convert the above code, Pygments.rb" \
 | 
			
		||||
            " returned an unacceptable value."
 | 
			
		||||
          Jekyll.logger.error "This is usually a timeout problem solved by running `jekyll build` again."
 | 
			
		||||
          raise ArgumentError.new("Pygments.rb returned an unacceptable value when attempting to highlight some code.")
 | 
			
		||||
| 
						 | 
				
			
			@ -99,7 +99,7 @@ eos
 | 
			
		|||
 | 
			
		||||
      def render_rouge(code)
 | 
			
		||||
        Jekyll::External.require_with_graceful_fail('rouge')
 | 
			
		||||
        formatter = Rouge::Formatters::HTML.new(line_numbers: @highlight_options[:linenos], wrap: false)
 | 
			
		||||
        formatter = Rouge::Formatters::HTML.new(:line_numbers => @highlight_options[:linenos], :wrap => false)
 | 
			
		||||
        lexer = Rouge::Lexer.find_fancy(@lang, code) || Rouge::Lexers::PlainText
 | 
			
		||||
        formatter.format(lexer.lex(code))
 | 
			
		||||
      end
 | 
			
		||||
| 
						 | 
				
			
			@ -110,12 +110,11 @@ eos
 | 
			
		|||
 | 
			
		||||
      def add_code_tag(code)
 | 
			
		||||
        code_attributes = [
 | 
			
		||||
          "class=\"language-#{@lang.to_s.gsub('+', '-')}\"",
 | 
			
		||||
          "data-lang=\"#{@lang.to_s}\""
 | 
			
		||||
          "class=\"language-#{@lang.to_s.tr('+', '-')}\"",
 | 
			
		||||
          "data-lang=\"#{@lang}\""
 | 
			
		||||
        ].join(" ")
 | 
			
		||||
        "<figure class=\"highlight\"><pre><code #{code_attributes}>#{code.chomp}</code></pre></figure>"
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -12,7 +12,6 @@ module Jekyll
 | 
			
		|||
    end
 | 
			
		||||
 | 
			
		||||
    class IncludeTag < Liquid::Tag
 | 
			
		||||
 | 
			
		||||
      attr_reader :includes_dir
 | 
			
		||||
 | 
			
		||||
      VALID_SYNTAX = /([\w-]+)\s*=\s*(?:"([^"\\]*(?:\\.[^"\\]*)*)"|'([^'\\]*(?:\\.[^'\\]*)*)'|([\w\.-]+))/
 | 
			
		||||
| 
						 | 
				
			
			@ -25,7 +24,7 @@ module Jekyll
 | 
			
		|||
          @file = matched['variable'].strip
 | 
			
		||||
          @params = matched['params'].strip
 | 
			
		||||
        else
 | 
			
		||||
          @file, @params = markup.strip.split(' ', 2);
 | 
			
		||||
          @file, @params = markup.strip.split(' ', 2)
 | 
			
		||||
        end
 | 
			
		||||
        validate_params if @params
 | 
			
		||||
        @tag_name = tag_name
 | 
			
		||||
| 
						 | 
				
			
			@ -43,12 +42,12 @@ module Jekyll
 | 
			
		|||
          markup = markup[match.end(0)..-1]
 | 
			
		||||
 | 
			
		||||
          value = if match[2]
 | 
			
		||||
            match[2].gsub(/\\"/, '"')
 | 
			
		||||
          elsif match[3]
 | 
			
		||||
            match[3].gsub(/\\'/, "'")
 | 
			
		||||
          elsif match[4]
 | 
			
		||||
            context[match[4]]
 | 
			
		||||
          end
 | 
			
		||||
                    match[2].gsub(/\\"/, '"')
 | 
			
		||||
                  elsif match[3]
 | 
			
		||||
                    match[3].gsub(/\\'/, "'")
 | 
			
		||||
                  elsif match[4]
 | 
			
		||||
                    context[match[4]]
 | 
			
		||||
                  end
 | 
			
		||||
 | 
			
		||||
          params[match[1]] = value
 | 
			
		||||
        end
 | 
			
		||||
| 
						 | 
				
			
			@ -57,7 +56,7 @@ module Jekyll
 | 
			
		|||
 | 
			
		||||
      def validate_file_name(file)
 | 
			
		||||
        if file !~ /^[a-zA-Z0-9_\/\.-]+$/ || file =~ /\.\// || file =~ /\/\./
 | 
			
		||||
            raise ArgumentError.new <<-eos
 | 
			
		||||
          raise ArgumentError.new <<-eos
 | 
			
		||||
Invalid syntax for include tag. File contains invalid characters or sequences:
 | 
			
		||||
 | 
			
		||||
  #{file}
 | 
			
		||||
| 
						 | 
				
			
			@ -115,7 +114,7 @@ eos
 | 
			
		|||
        validate_path(path, dir, site.safe)
 | 
			
		||||
 | 
			
		||||
        # Add include to dependency tree
 | 
			
		||||
        if context.registers[:page] and context.registers[:page].has_key? "path"
 | 
			
		||||
        if context.registers[:page] && context.registers[:page].key?("path")
 | 
			
		||||
          site.regenerator.add_dependency(
 | 
			
		||||
            site.in_source_dir(context.registers[:page]["path"]),
 | 
			
		||||
            path
 | 
			
		||||
| 
						 | 
				
			
			@ -138,7 +137,7 @@ eos
 | 
			
		|||
        context.registers[:cached_partials] ||= {}
 | 
			
		||||
        cached_partial = context.registers[:cached_partials]
 | 
			
		||||
 | 
			
		||||
        if cached_partial.has_key?(path)
 | 
			
		||||
        if cached_partial.key?(path)
 | 
			
		||||
          cached_partial[path]
 | 
			
		||||
        else
 | 
			
		||||
          cached_partial[path] = context.registers[:site].liquid_renderer.file(path).parse(read_file(path, context))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -60,22 +60,19 @@ eos
 | 
			
		|||
        site = context.registers[:site]
 | 
			
		||||
 | 
			
		||||
        site.posts.docs.each do |p|
 | 
			
		||||
          if @post == p
 | 
			
		||||
            return p.url
 | 
			
		||||
          end
 | 
			
		||||
          return p.url if @post == p
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
        # New matching method did not match, fall back to old method
 | 
			
		||||
        # with deprecation warning if this matches
 | 
			
		||||
 | 
			
		||||
        site.posts.docs.each do |p|
 | 
			
		||||
          if @post.deprecated_equality p
 | 
			
		||||
            Jekyll::Deprecator.deprecation_message "A call to '{{ post_url #{@post.name} }}' did not match " +
 | 
			
		||||
              "a post using the new matching method of checking name " +
 | 
			
		||||
              "(path-date-slug) equality. Please make sure that you " +
 | 
			
		||||
              "change this tag to match the post's name exactly."
 | 
			
		||||
            return p.url
 | 
			
		||||
          end
 | 
			
		||||
          next unless @post.deprecated_equality p
 | 
			
		||||
          Jekyll::Deprecator.deprecation_message "A call to '{{ post_url #{@post.name} }}' did not match " \
 | 
			
		||||
            "a post using the new matching method of checking name " \
 | 
			
		||||
            "(path-date-slug) equality. Please make sure that you " \
 | 
			
		||||
            "change this tag to match the post's name exactly."
 | 
			
		||||
          return p.url
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
        raise ArgumentError.new <<-eos
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,7 +11,6 @@ require 'uri'
 | 
			
		|||
#
 | 
			
		||||
module Jekyll
 | 
			
		||||
  class URL
 | 
			
		||||
 | 
			
		||||
    # options - One of :permalink or :template must be supplied.
 | 
			
		||||
    #           :template     - The String used as template for URL generation,
 | 
			
		||||
    #                           for example "/:path/:basename:output_ext", where
 | 
			
		||||
| 
						 | 
				
			
			@ -93,7 +92,7 @@ module Jekyll
 | 
			
		|||
    # as well as the beginning "/" so we can enforce and ensure it.
 | 
			
		||||
 | 
			
		||||
    def sanitize_url(str)
 | 
			
		||||
      "/" + str.gsub(/\/{2,}/, "/").gsub(%r!\.+\/|\A/+!, "")
 | 
			
		||||
      "/" + str.gsub(/\/{2,}/, "/").gsub(/\.+\/|\A\/+/, "")
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    # Escapes a path to be a valid URL path segment
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,7 +4,7 @@ module Jekyll
 | 
			
		|||
    autoload :Ansi, "jekyll/utils/ansi"
 | 
			
		||||
 | 
			
		||||
    # Constants for use in #slugify
 | 
			
		||||
    SLUGIFY_MODES = %w{raw default pretty}
 | 
			
		||||
    SLUGIFY_MODES = %w(raw default pretty)
 | 
			
		||||
    SLUGIFY_RAW_REGEXP = Regexp.new('\\s+').freeze
 | 
			
		||||
    SLUGIFY_DEFAULT_REGEXP = Regexp.new('[^[:alnum:]]+').freeze
 | 
			
		||||
    SLUGIFY_PRETTY_REGEXP = Regexp.new("[^[:alnum:]._~!$&'()+,;=@]+").freeze
 | 
			
		||||
| 
						 | 
				
			
			@ -31,8 +31,8 @@ module Jekyll
 | 
			
		|||
    # Thanks to whoever made it.
 | 
			
		||||
    def deep_merge_hashes!(target, overwrite)
 | 
			
		||||
      overwrite.each_key do |key|
 | 
			
		||||
        if (overwrite[key].is_a?(Hash) or overwrite[key].is_a?(Drops::Drop)) and
 | 
			
		||||
            (target[key].is_a?(Hash) or target[key].is_a?(Drops::Drop))
 | 
			
		||||
        if (overwrite[key].is_a?(Hash) || overwrite[key].is_a?(Drops::Drop)) &&
 | 
			
		||||
            (target[key].is_a?(Hash) || target[key].is_a?(Drops::Drop))
 | 
			
		||||
          target[key] = Utils.deep_merge_hashes(target[key], overwrite[key])
 | 
			
		||||
          next
 | 
			
		||||
        end
 | 
			
		||||
| 
						 | 
				
			
			@ -62,7 +62,7 @@ module Jekyll
 | 
			
		|||
    end
 | 
			
		||||
 | 
			
		||||
    def value_from_singular_key(hash, key)
 | 
			
		||||
      hash[key] if (hash.key?(key) || (hash.default_proc && hash[key]))
 | 
			
		||||
      hash[key] if hash.key?(key) || (hash.default_proc && hash[key])
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def value_from_plural_key(hash, key)
 | 
			
		||||
| 
						 | 
				
			
			@ -164,16 +164,17 @@ module Jekyll
 | 
			
		|||
      end
 | 
			
		||||
 | 
			
		||||
      # Replace each character sequence with a hyphen
 | 
			
		||||
      re = case mode
 | 
			
		||||
      when 'raw'
 | 
			
		||||
        SLUGIFY_RAW_REGEXP
 | 
			
		||||
      when 'default'
 | 
			
		||||
        SLUGIFY_DEFAULT_REGEXP
 | 
			
		||||
      when 'pretty'
 | 
			
		||||
        # "._~!$&'()+,;=@" is human readable (not URI-escaped) in URL
 | 
			
		||||
        # and is allowed in both extN and NTFS.
 | 
			
		||||
        SLUGIFY_PRETTY_REGEXP
 | 
			
		||||
      end
 | 
			
		||||
      re =
 | 
			
		||||
        case mode
 | 
			
		||||
        when 'raw'
 | 
			
		||||
          SLUGIFY_RAW_REGEXP
 | 
			
		||||
        when 'default'
 | 
			
		||||
          SLUGIFY_DEFAULT_REGEXP
 | 
			
		||||
        when 'pretty'
 | 
			
		||||
          # "._~!$&'()+,;=@" is human readable (not URI-escaped) in URL
 | 
			
		||||
          # and is allowed in both extN and NTFS.
 | 
			
		||||
          SLUGIFY_PRETTY_REGEXP
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
      # Strip according to the mode
 | 
			
		||||
      slug = string.gsub(re, '-')
 | 
			
		||||
| 
						 | 
				
			
			@ -225,7 +226,6 @@ module Jekyll
 | 
			
		|||
      template
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    # Work the same way as Dir.glob but seperating the input into two parts
 | 
			
		||||
    # ('dir' + '/' + 'pattern') to make sure the first part('dir') does not act
 | 
			
		||||
    # as a pattern.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -33,7 +33,7 @@ module Jekyll
 | 
			
		|||
      def has?(str)
 | 
			
		||||
        !!(str =~ MATCH)
 | 
			
		||||
      end
 | 
			
		||||
      
 | 
			
		||||
 | 
			
		||||
      # Reset the color back to the default color so that you do not leak any
 | 
			
		||||
      # colors when you move onto the next line. This is probably normally
 | 
			
		||||
      # used as part of a wrapper so that we don't leak colors.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -19,7 +19,6 @@ module Jekyll
 | 
			
		|||
 | 
			
		||||
      { :windows? => /mswin|mingw|cygwin/, :linux? => /linux/, \
 | 
			
		||||
          :osx? => /darwin|mac os/, :unix? => /solaris|bsd/ }.each do |k, v|
 | 
			
		||||
 | 
			
		||||
        define_method k do
 | 
			
		||||
          !!(
 | 
			
		||||
            RbConfig::CONFIG["host_os"] =~ v
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue