mojombo/jekyll — pull request #585 by sillylogger (2012-06-26 16:20:12+00:00)
Title: New Liquid tag for listing files: directory

This is a follow up to @mojombo's response to @robru's [gallery pull request](https://github.com/mojombo/jekyll/pull/303). I simplified the `name` and `dir` param to simply a `path` and changed the date-stamp files to use Jekyll's convention. Usage is similar to @robru pull request:

```liquid

{% directory path: images/vacation %}

{% enddirectory %}

```

It provides this data to the templates:

file.url # absolute path to file
file.name # basename
file.date # date extracted from beginning of filename, if present (optional)
file.slug # basename with the date and file extension stripped off
file.title # file.slug with hyphens converted to spaces, and put into Title Case

The `forloop` maintains [its usual context](http://wiki.shopify.com/UsingLiquid#For_loops).

My updates to this patch also removed the YAML globbing from files as that now throws errors for files without YAML. Lastly I added an `exclude` param that rejects files based on a RegExp. @mojombo wasn't a big fan of defaults, so the default exclusion of `/.html$/` might not fly...