mirror of
https://github.com/jekyll/jekyll.git
synced 2026-04-28 03:01:03 -04:00
Compare commits
19 Commits
docs-40
...
3.5-stable
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f8ae6be6c4 | ||
|
|
69659d6107 | ||
|
|
867fc4017e | ||
|
|
904eeee7a2 | ||
|
|
4500232274 | ||
|
|
ae46887375 | ||
|
|
27e4f75190 | ||
|
|
50453d218d | ||
|
|
e19bae814f | ||
|
|
1096b4218a | ||
|
|
a564b23ca5 | ||
|
|
7a928f2965 | ||
|
|
0ef29378f3 | ||
|
|
69e541b4eb | ||
|
|
a7807e65ba | ||
|
|
c1ac58dbb8 | ||
|
|
6554fb2a22 | ||
|
|
ddcb38db71 | ||
|
|
985f031126 |
@@ -1,3 +1,14 @@
|
||||
## 3.5.2 / 2017-08-12
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Backport #6281 for v3.5.x: Fix `Drop#key?` so it can handle a nil argument (#6288)
|
||||
* Backport #6280 for v3.5.x: Guard against type error in `absolute_url` (#6287)
|
||||
* Backport #6266 for v3.5.x: Memoize the return value of `Document#url` (#6301)
|
||||
* Backport #6273 for v3.5.x: delegate `StaticFile#to_json` to `StaticFile#to_liquid` (#6302)
|
||||
* Backport #6226 for v3.5.x: `Reader#read_directories`: guard against an entry not being a directory (#6304)
|
||||
* Backport #6247 for v3.5.x: kramdown: symbolize keys in-place (#6303)
|
||||
|
||||
## 3.5.1 / 2017-07-17
|
||||
|
||||
### Minor Enhancements
|
||||
|
||||
@@ -43,13 +43,9 @@ module Jekyll
|
||||
|
||||
private
|
||||
def make_accessible(hash = @config)
|
||||
proc_ = proc { |hash_, key| hash_[key.to_s] if key.is_a?(Symbol) }
|
||||
hash.default_proc = proc_
|
||||
|
||||
hash.each do |_, val|
|
||||
make_accessible val if val.is_a?(
|
||||
Hash
|
||||
)
|
||||
hash.keys.each do |key|
|
||||
hash[key.to_sym] = hash[key]
|
||||
make_accessible(hash[key]) if hash[key].is_a?(Hash)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -86,7 +82,7 @@ module Jekyll
|
||||
private
|
||||
def strip_coderay_prefix(hash)
|
||||
hash.each_with_object({}) do |(key, val), hsh|
|
||||
cleaned_key = key.gsub(%r!\Acoderay_!, "")
|
||||
cleaned_key = key.to_s.gsub(%r!\Acoderay_!, "")
|
||||
|
||||
if key != cleaned_key
|
||||
Jekyll::Deprecator.deprecation_message(
|
||||
|
||||
@@ -203,7 +203,7 @@ module Jekyll
|
||||
#
|
||||
# Returns the computed URL for the document.
|
||||
def url
|
||||
@url = URL.new({
|
||||
@url ||= URL.new({
|
||||
:template => url_template,
|
||||
:placeholders => url_placeholders,
|
||||
:permalink => permalink,
|
||||
|
||||
@@ -71,7 +71,7 @@ module Jekyll
|
||||
def []=(key, val)
|
||||
if respond_to?("#{key}=")
|
||||
public_send("#{key}=", val)
|
||||
elsif respond_to? key
|
||||
elsif respond_to?(key.to_s)
|
||||
if self.class.mutable?
|
||||
@mutations[key] = val
|
||||
else
|
||||
@@ -105,7 +105,7 @@ module Jekyll
|
||||
if self.class.mutable
|
||||
@mutations.key?(key)
|
||||
else
|
||||
respond_to?(key) || fallback_data.key?(key)
|
||||
!key.nil? && (respond_to?(key) || fallback_data.key?(key))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -10,10 +10,12 @@ module Jekyll
|
||||
# Returns the absolute URL as a String.
|
||||
def absolute_url(input)
|
||||
return if input.nil?
|
||||
return input if Addressable::URI.parse(input).absolute?
|
||||
return input if Addressable::URI.parse(input.to_s).absolute?
|
||||
site = @context.registers[:site]
|
||||
return relative_url(input).to_s if site.config["url"].nil?
|
||||
Addressable::URI.parse(site.config["url"] + relative_url(input)).normalize.to_s
|
||||
Addressable::URI.parse(
|
||||
site.config["url"].to_s + relative_url(input)
|
||||
).normalize.to_s
|
||||
end
|
||||
|
||||
# Produces a URL relative to the domain root based on site.baseurl.
|
||||
|
||||
@@ -39,6 +39,8 @@ module Jekyll
|
||||
def read_directories(dir = "")
|
||||
base = site.in_source_dir(dir)
|
||||
|
||||
return unless File.directory?(base)
|
||||
|
||||
dot = Dir.chdir(base) { filter_entries(Dir.entries("."), base) }
|
||||
dot_dirs = dot.select { |file| File.directory?(@site.in_source_dir(base, file)) }
|
||||
dot_files = (dot - dot_dirs)
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
module Jekyll
|
||||
class StaticFile
|
||||
extend Forwardable
|
||||
|
||||
attr_reader :relative_path, :extname, :name, :data
|
||||
|
||||
def_delegator :to_liquid, :to_json, :to_json
|
||||
|
||||
class << self
|
||||
# The cache of last modification times [path] -> mtime.
|
||||
def mtimes
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
module Jekyll
|
||||
VERSION = "3.5.1".freeze
|
||||
VERSION = "3.5.2".freeze
|
||||
end
|
||||
|
||||
@@ -13,6 +13,10 @@ class TestDrop < JekyllUnitTest
|
||||
@drop = @document.to_liquid
|
||||
end
|
||||
|
||||
should "reject 'nil' key" do
|
||||
refute @drop.key?(nil)
|
||||
end
|
||||
|
||||
should "raise KeyError if key is not found and no default provided" do
|
||||
assert_raises KeyError do
|
||||
@drop.fetch("not_existing_key")
|
||||
|
||||
@@ -13,6 +13,16 @@ class TestFilters < JekyllUnitTest
|
||||
end
|
||||
end
|
||||
|
||||
class Value
|
||||
def initialize(value)
|
||||
@value = value
|
||||
end
|
||||
|
||||
def to_s
|
||||
@value.respond_to?(:call) ? @value.call : @value.to_s
|
||||
end
|
||||
end
|
||||
|
||||
def make_filter_mock(opts = {})
|
||||
JekyllFilter.new(site_configuration(opts)).tap do |f|
|
||||
tz = f.site.config["timezone"]
|
||||
@@ -423,6 +433,16 @@ class TestFilters < JekyllUnitTest
|
||||
page_url = "http://example.com/"
|
||||
assert_equal "http://example.com/", @filter.absolute_url(page_url)
|
||||
end
|
||||
|
||||
should "transform the input URL to a string" do
|
||||
page_url = "/my-page.html"
|
||||
filter = make_filter_mock({ "url" => Value.new(proc { "http://example.org" }) })
|
||||
assert_equal "http://example.org#{page_url}", filter.absolute_url(page_url)
|
||||
end
|
||||
|
||||
should "not raise a TypeError when passed a hash" do
|
||||
assert @filter.absolute_url({ "foo" => "bar" })
|
||||
end
|
||||
end
|
||||
|
||||
context "relative_url filter" do
|
||||
@@ -500,6 +520,12 @@ class TestFilters < JekyllUnitTest
|
||||
url << "foo"
|
||||
assert_equal "/front_matter.erb", page.url
|
||||
end
|
||||
|
||||
should "transform the input baseurl to a string" do
|
||||
page_url = "/my-page.html"
|
||||
filter = make_filter_mock({ "baseurl" => Value.new(proc { "/baseurl/" }) })
|
||||
assert_equal "/baseurl#{page_url}", filter.relative_url(page_url)
|
||||
end
|
||||
end
|
||||
|
||||
context "strip_index filter" do
|
||||
|
||||
@@ -20,11 +20,33 @@ class TestKramdown < JekyllUnitTest
|
||||
},
|
||||
},
|
||||
}
|
||||
@kramdown_config_keys = @config["kramdown"].keys
|
||||
@syntax_highlighter_opts_config_keys = \
|
||||
@config["kramdown"]["syntax_highlighter_opts"].keys
|
||||
|
||||
@config = Jekyll.configuration(@config)
|
||||
@markdown = Converters::Markdown.new(
|
||||
@config
|
||||
)
|
||||
@markdown = Converters::Markdown.new(@config)
|
||||
@markdown.setup
|
||||
end
|
||||
|
||||
should "fill symbolized keys into config for compatibility with kramdown" do
|
||||
kramdown_config = @markdown.instance_variable_get(:@parser)
|
||||
.instance_variable_get(:@config)
|
||||
|
||||
@kramdown_config_keys.each do |key|
|
||||
assert kramdown_config.key?(key.to_sym),
|
||||
"Expected #{kramdown_config} to include key #{key.to_sym.inspect}"
|
||||
end
|
||||
|
||||
@syntax_highlighter_opts_config_keys.each do |key|
|
||||
assert kramdown_config["syntax_highlighter_opts"].key?(key.to_sym),
|
||||
"Expected #{kramdown_config["syntax_highlighter_opts"]} to include " \
|
||||
"key #{key.to_sym.inspect}"
|
||||
end
|
||||
|
||||
assert_equal kramdown_config["smart_quotes"], kramdown_config[:smart_quotes]
|
||||
assert_equal kramdown_config["syntax_highlighter_opts"]["css"],
|
||||
kramdown_config[:syntax_highlighter_opts][:css]
|
||||
end
|
||||
|
||||
should "run Kramdown" do
|
||||
|
||||
@@ -174,5 +174,9 @@ class TestStaticFile < JekyllUnitTest
|
||||
}
|
||||
assert_equal expected, @static_file.to_liquid.to_h
|
||||
end
|
||||
|
||||
should "jsonify its liquid drop instead of itself" do
|
||||
assert_equal @static_file.to_liquid.to_json, @static_file.to_json
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user