parent
ef027be97e
commit
36fbcaa863
|
@ -0,0 +1,29 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require 'benchmark/ips'
|
||||||
|
require 'jekyll'
|
||||||
|
require 'json'
|
||||||
|
|
||||||
|
DATA = {"foo"=>"bar", "alpha"=>{"beta"=>"gamma"}, "lipsum"=>["lorem", "ipsum", "dolor"]}
|
||||||
|
|
||||||
|
def local_require
|
||||||
|
require 'json'
|
||||||
|
JSON.pretty_generate(DATA)
|
||||||
|
end
|
||||||
|
|
||||||
|
def global_require
|
||||||
|
JSON.pretty_generate(DATA)
|
||||||
|
end
|
||||||
|
|
||||||
|
def graceful_require
|
||||||
|
Jekyll::External.require_with_graceful_fail("json")
|
||||||
|
JSON.pretty_generate(DATA)
|
||||||
|
end
|
||||||
|
|
||||||
|
Benchmark.ips do |x|
|
||||||
|
x.report("local-require") { local_require }
|
||||||
|
x.report("global-require") { global_require }
|
||||||
|
x.report("graceful-require") { graceful_require }
|
||||||
|
x.compare!
|
||||||
|
end
|
|
@ -18,7 +18,6 @@ end
|
||||||
require "rubygems"
|
require "rubygems"
|
||||||
|
|
||||||
# stdlib
|
# stdlib
|
||||||
require "pathutil"
|
|
||||||
require "forwardable"
|
require "forwardable"
|
||||||
require "fileutils"
|
require "fileutils"
|
||||||
require "time"
|
require "time"
|
||||||
|
@ -26,8 +25,12 @@ require "English"
|
||||||
require "pathname"
|
require "pathname"
|
||||||
require "logger"
|
require "logger"
|
||||||
require "set"
|
require "set"
|
||||||
|
require "csv"
|
||||||
|
require "json"
|
||||||
|
|
||||||
# 3rd party
|
# 3rd party
|
||||||
|
require "pathutil"
|
||||||
|
require "addressable/uri"
|
||||||
require "safe_yaml/load"
|
require "safe_yaml/load"
|
||||||
require "liquid"
|
require "liquid"
|
||||||
require "kramdown"
|
require "kramdown"
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require "set"
|
|
||||||
|
|
||||||
module Jekyll
|
module Jekyll
|
||||||
# Handles the cleanup of a site's destination before it is built.
|
# Handles the cleanup of a site's destination before it is built.
|
||||||
class Cleaner
|
class Cleaner
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require "addressable/uri"
|
|
||||||
|
|
||||||
module Jekyll
|
module Jekyll
|
||||||
module Commands
|
module Commands
|
||||||
class Doctor < Command
|
class Doctor < Command
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require "json"
|
|
||||||
require "em-websocket"
|
require "em-websocket"
|
||||||
|
|
||||||
require_relative "websockets"
|
require_relative "websockets"
|
||||||
|
|
|
@ -14,9 +14,6 @@ module Jekyll
|
||||||
}.freeze
|
}.freeze
|
||||||
|
|
||||||
def initialize(config)
|
def initialize(config)
|
||||||
unless defined?(Kramdown)
|
|
||||||
Jekyll::External.require_with_graceful_fail "kramdown"
|
|
||||||
end
|
|
||||||
@main_fallback_highlighter = config["highlighter"] || "rouge"
|
@main_fallback_highlighter = config["highlighter"] || "rouge"
|
||||||
@config = config["kramdown"] || {}
|
@config = config["kramdown"] || {}
|
||||||
@highlighter = nil
|
@highlighter = nil
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require "set"
|
|
||||||
|
|
||||||
# Convertible provides methods for converting a pagelike item
|
# Convertible provides methods for converting a pagelike item
|
||||||
# from a certain type of markup into actual content
|
# from a certain type of markup into actual content
|
||||||
#
|
#
|
||||||
|
|
|
@ -137,7 +137,6 @@ module Jekyll
|
||||||
#
|
#
|
||||||
# Returns a pretty generation of the hash representation of the Drop.
|
# Returns a pretty generation of the hash representation of the Drop.
|
||||||
def inspect
|
def inspect
|
||||||
require "json"
|
|
||||||
JSON.pretty_generate to_h
|
JSON.pretty_generate to_h
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -155,7 +154,6 @@ module Jekyll
|
||||||
#
|
#
|
||||||
# Returns a JSON representation of the Drop in a String.
|
# Returns a JSON representation of the Drop in a String.
|
||||||
def to_json(state = nil)
|
def to_json(state = nil)
|
||||||
require "json"
|
|
||||||
JSON.generate(hash_for_json(state), state)
|
JSON.generate(hash_for_json(state), state)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,6 @@ module Jekyll
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_json(state = nil)
|
def to_json(state = nil)
|
||||||
require "json"
|
|
||||||
JSON.generate(to_h, state)
|
JSON.generate(to_h, state)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require "addressable/uri"
|
|
||||||
require "json"
|
|
||||||
require "liquid"
|
|
||||||
|
|
||||||
require_all "jekyll/filters"
|
require_all "jekyll/filters"
|
||||||
|
|
||||||
module Jekyll
|
module Jekyll
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require "addressable/uri"
|
|
||||||
|
|
||||||
module Jekyll
|
module Jekyll
|
||||||
module Filters
|
module Filters
|
||||||
module URLFilters
|
module URLFilters
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require "csv"
|
|
||||||
|
|
||||||
module Jekyll
|
module Jekyll
|
||||||
class Reader
|
class Reader
|
||||||
attr_reader :site
|
attr_reader :site
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require "csv"
|
|
||||||
|
|
||||||
module Jekyll
|
module Jekyll
|
||||||
class Site
|
class Site
|
||||||
attr_reader :source, :dest, :config
|
attr_reader :source, :dest, :config
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require "addressable/uri"
|
|
||||||
|
|
||||||
# Public: Methods that generate a URL for a resource such as a Post or a Page.
|
# Public: Methods that generate a URL for a resource such as a Post or a Page.
|
||||||
#
|
#
|
||||||
# Examples
|
# Examples
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
Jekyll::External.require_with_graceful_fail("rouge")
|
||||||
|
|
||||||
module Jekyll
|
module Jekyll
|
||||||
module Utils
|
module Utils
|
||||||
module Rouge
|
module Rouge
|
||||||
|
|
||||||
def self.html_formatter(*args)
|
def self.html_formatter(*args)
|
||||||
Jekyll::External.require_with_graceful_fail("rouge") unless defined?(::Rouge)
|
|
||||||
if old_api?
|
if old_api?
|
||||||
::Rouge::Formatters::HTML.new(*args)
|
::Rouge::Formatters::HTML.new(*args)
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue