Automatically convert tabbed indentation to spaces
This commit is contained in:
parent
2f7c0124eb
commit
6cc3a082a1
|
@ -13,6 +13,20 @@ Feature: Jekyll responsive_image_block tag
|
|||
When I run Jekyll
|
||||
Then I should see "<img alt=\"Lorem ipsum\" src=\"/assets/everybody-loves-jalapeño-pineapple-cornbread.png\" title=\"Magic rainbow adventure!\"" in "_site/index.html"
|
||||
|
||||
Scenario: Tabs for indentation
|
||||
Given I have a responsive_image configuration with "template" set to "_includes/responsive-image.html"
|
||||
And I have a file "index.html" with:
|
||||
"""
|
||||
{% assign path = 'assets/everybody-loves-jalapeño-pineapple-cornbread.png' %}
|
||||
{% responsive_image_block %}
|
||||
path: {{ path }}
|
||||
title: Magic rainbow adventure!
|
||||
alt: Lorem ipsum
|
||||
{% endresponsive_image_block %}
|
||||
"""
|
||||
When I run Jekyll
|
||||
Then I should see "<img alt=\"Lorem ipsum\" src=\"/assets/everybody-loves-jalapeño-pineapple-cornbread.png\" title=\"Magic rainbow adventure!\"" in "_site/index.html"
|
||||
|
||||
Scenario: Global variables available in templates
|
||||
Given I have a file "index.html" with:
|
||||
"""
|
||||
|
|
|
@ -4,7 +4,13 @@ module Jekyll
|
|||
include Jekyll::ResponsiveImage::Utils
|
||||
|
||||
def render(context)
|
||||
attributes = YAML.load(super)
|
||||
content = super
|
||||
|
||||
if content.include?("\t")
|
||||
content = content.lines.map {|line| line.gsub(/\G[\t ]/, " ")}.join("\n")
|
||||
end
|
||||
|
||||
attributes = YAML.load(content)
|
||||
Renderer.new(context.registers[:site], attributes).render_responsive_image
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue