Add StaticFile#to_liquid['extname'] :)

This commit is contained in:
Parker Moore 2014-02-19 13:55:58 -05:00
parent 33490e4efc
commit e3dd908d55
3 changed files with 9 additions and 5 deletions

View File

@ -75,7 +75,8 @@ module Jekyll
def to_liquid
{
"path" => relative_path,
"modified_time" => mtime.to_s
"modified_time" => mtime.to_s,
"extname" => File.extname(relative_path)
}
end
end

View File

@ -1,6 +1,4 @@
---
---
{% for file in site.static_files %}
- {{ file.path }} last edited at {{ file.modified_time }}
{% endfor %}
- {{ file.path }} last edited at {{ file.modified_time }} with extname {{ file.extname }}{% endfor %}

View File

@ -46,7 +46,12 @@ class TestGeneratedSite < Test::Unit::TestCase
end
should "print a nice list of static files" do
assert_equal "", File.read(dest_dir('static_files.html'))
expected_output = Regexp.new <<-OUTPUT
- /css/screen.css last edited at \\d+ with extname .css
- /products.yml last edited at \\d+ with extname .yml
- /symlink-test/symlinked-dir/screen.css last edited at \\d+ with extname .css
OUTPUT
assert_match expected_output, File.read(dest_dir('static_files.html'))
end
end