add basename and name variables for static files
This commit is contained in:
		
							parent
							
								
									349569592e
								
							
						
					
					
						commit
						a9da814f17
					
				|  | @ -97,7 +97,8 @@ module Jekyll | |||
| 
 | ||||
|     def to_liquid | ||||
|       { | ||||
|         "name"          => File.basename(name, extname), | ||||
|         "basename"      => File.basename(name, extname), | ||||
|         "name"          => name, | ||||
|         "extname"       => extname, | ||||
|         "modified_time" => modified_time, | ||||
|         "path"          => File.join("", relative_path) | ||||
|  |  | |||
|  | @ -42,7 +42,15 @@ following metadata: | |||
|       <td><p><code>file.name</code></p></td> | ||||
|       <td><p> | ||||
| 
 | ||||
|         The string name of the file without the extension, e.g. <code>image</code> for <code>image.jpg</code> | ||||
|         The string name of the file e.g. <code>image.jpg</code> for <code>image.jpg</code> | ||||
| 
 | ||||
|       </p></td> | ||||
|     </tr> | ||||
|     <tr> | ||||
|       <td><p><code>file.basename</code></p></td> | ||||
|       <td><p> | ||||
| 
 | ||||
|         The string basename of the file e.g. <code>image</code> for <code>image.jpg</code> | ||||
| 
 | ||||
|       </p></td> | ||||
|     </tr> | ||||
|  |  | |||
|  | @ -134,7 +134,8 @@ class TestStaticFile < JekyllUnitTest | |||
| 
 | ||||
|     should "be able to convert to liquid" do | ||||
|       expected = { | ||||
|         "name"          => "static_file", | ||||
|         "basename"      => "static_file", | ||||
|         "name"          => "static_file.txt", | ||||
|         "extname"       => ".txt", | ||||
|         "modified_time" => @static_file.modified_time, | ||||
|         "path"          => "/static_file.txt" | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue