Fix regression in Convertible module from v4.2.0 (#8786)
Merge pull request 8786
This commit is contained in:
parent
493b800edb
commit
eca450454f
|
@ -207,3 +207,35 @@ Feature: Rendering
|
|||
And I should see "series named {{ site.title }}" in "_site/index.html"
|
||||
And I should see "{% link series/first-part.md %}" in "_site/index.html"
|
||||
And I should see "{% link series/last-part.md %}" in "_site/index.html"
|
||||
|
||||
Scenario: Render content of another page
|
||||
Given I have an "index.md" page that contains "__Hello World__"
|
||||
And I have an "about.md" page that contains "{{ page.name }}"
|
||||
And I have a "test.json" file with content:
|
||||
"""
|
||||
---
|
||||
---
|
||||
|
||||
{
|
||||
"hpages": [
|
||||
{%- for page in site.html_pages %}
|
||||
{
|
||||
"url" : {{ page.url | jsonify }},
|
||||
"name" : {{ page.name | jsonify }},
|
||||
"path" : {{ page.path | jsonify }},
|
||||
"title" : {{ page.title | jsonify }},
|
||||
"layout" : {{ page.layout | jsonify }},
|
||||
"content": {{ page.content | jsonify }},
|
||||
"excerpt": {{ page.excerpt | jsonify }}
|
||||
}{% unless forloop.last %},{% endunless -%}
|
||||
{% endfor %}
|
||||
]
|
||||
}
|
||||
"""
|
||||
When I run jekyll build
|
||||
Then I should get a zero exit status
|
||||
And the _site directory should exist
|
||||
But I should not see "content\": \"{{ page.name }}" in "_site/test.json"
|
||||
And I should not see "content\": \"__Hello World__" in "_site/test.json"
|
||||
But I should see "content\": \"<p>about.md</p>" in "_site/test.json"
|
||||
And I should see "content\": \"<p><strong>Hello World</strong></p>" in "_site/test.json"
|
||||
|
|
|
@ -112,7 +112,11 @@ module Jekyll
|
|||
#
|
||||
# Returns the Hash representation of this Convertible.
|
||||
def to_liquid(attrs = nil)
|
||||
further_data = attribute_hash(attrs || self.class::ATTRIBUTES_FOR_LIQUID)
|
||||
further_data = \
|
||||
(attrs || self.class::ATTRIBUTES_FOR_LIQUID).each_with_object({}) do |attribute, hsh|
|
||||
hsh[attribute] = send(attribute)
|
||||
end
|
||||
|
||||
Utils.deep_merge_hashes defaults, Utils.deep_merge_hashes(data, further_data)
|
||||
end
|
||||
|
||||
|
@ -246,13 +250,6 @@ module Jekyll
|
|||
@defaults ||= site.frontmatter_defaults.all(relative_path, type)
|
||||
end
|
||||
|
||||
def attribute_hash(attrs)
|
||||
@attribute_hash ||= {}
|
||||
@attribute_hash[attrs] ||= attrs.each_with_object({}) do |attribute, hsh|
|
||||
hsh[attribute] = send(attribute)
|
||||
end
|
||||
end
|
||||
|
||||
def no_layout?
|
||||
data["layout"] == "none"
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue