spf13/hugo — pull request #590 by halostatue (2014-10-29 04:48:25+00:00)
Title: Change permalink validation and substitution.

Fixes #577.

- Uses `regexp` to match against attribute patterns, permitting
`/:year-:month/` as a valid path.

Note that this change __may not go far enough__. Once we’re using
`regexp.Regexp.FindAllStringSubmatches`, there’s no good reason to split on `/`
except to verify that there’s not an empty path portion (`//`).

It’s also a little less efficient than it might otherwise be in that using
`strings.Replace(s, old, new, -1)` would replace all forms of a string at once
rather than `strings.Replace(s, old, new, 1)` replacing them one-by-one (and a
callback being executed). With both this code and the current approach, a
permalink of `/:title/:title` will result in the `title` callback being called
twice, even though the title will not have changed between calls.