Get static filename
This commit is contained in:
parent
594a6bf193
commit
87c00b2756
|
@ -1,6 +1,6 @@
|
||||||
module Jekyll
|
module Jekyll
|
||||||
class StaticFile
|
class StaticFile
|
||||||
attr_reader :relative_path, :extname
|
attr_reader :relative_path, :extname, :name
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
# The cache of last modification times [path] -> mtime.
|
# The cache of last modification times [path] -> mtime.
|
||||||
|
@ -97,6 +97,7 @@ module Jekyll
|
||||||
|
|
||||||
def to_liquid
|
def to_liquid
|
||||||
{
|
{
|
||||||
|
"filename" => File.basename(name, extname),
|
||||||
"extname" => extname,
|
"extname" => extname,
|
||||||
"modified_time" => modified_time,
|
"modified_time" => modified_time,
|
||||||
"path" => File.join("", relative_path)
|
"path" => File.join("", relative_path)
|
||||||
|
|
|
@ -134,6 +134,7 @@ class TestStaticFile < JekyllUnitTest
|
||||||
|
|
||||||
should "be able to convert to liquid" do
|
should "be able to convert to liquid" do
|
||||||
expected = {
|
expected = {
|
||||||
|
"filename" => "static_file",
|
||||||
"extname" => ".txt",
|
"extname" => ".txt",
|
||||||
"modified_time" => @static_file.modified_time,
|
"modified_time" => @static_file.modified_time,
|
||||||
"path" => "/static_file.txt"
|
"path" => "/static_file.txt"
|
||||||
|
|
Loading…
Reference in New Issue