hugo/helpers
Owen Waller f81f9ceb40 Fix: rewrite FileAndExt
FileAndExt has now be completely rewritten and now works as may
reasonably be expected. The test cases for:

ReplaceExtension
Filename
FileAndExt

now all pass.

The problem was the way path.Base was being used.
Firstly Base returns "." if the directory is empty, but it can also
return "." for the current directory, or ".." for the parent directory,
if these are the last elements in the path. Simply detecting the
presence of a "." in the returned string and truncating before the "."
does not therefore always result in a valid filename.
Secondly, Base strips any trailing slashes making is more difficult to
detect when the path does not end in a filename but in a directory name
i.e. a no filename case. Not detecting this incorrectly results in the
last directory name being returned as the filename.

The code has been updated to take account of of both situations so that:
1) An empty string for both the filename and extension is returned if the
path does not contain a filename (plus an optional extension). This
includes both the empty path case, and the ends in a directory case.
2) If the path represents a filename with an extension then both the
filename and the extension (minus any dots) are returned as non empty
strings.
3) If the path represents a filename without an extension then filename
will be returned as a non empty string (minus any dot) and the extension
will be returned as an empty string.
2014-11-04 19:19:19 -05:00
..
content.go Added the general modules test files 2014-11-04 11:13:41 -05:00
general.go Adding ReaderTo and ToReader helper functions 2014-11-04 00:26:56 -05:00
general_test.go Added the general modules test files 2014-11-04 11:13:41 -05:00
path.go Fix: rewrite FileAndExt 2014-11-04 19:19:19 -05:00
path_test.go Fix: remove the unnecessary dot in an extension 2014-11-04 19:19:09 -05:00
pygments.go Add pygmentsstyle and pygmentsuseclasses options 2014-05-09 23:20:11 -04:00
url.go Added the url modules test files. 2014-11-04 19:16:07 -05:00
url_test.go Added the url modules test files. 2014-11-04 19:16:07 -05:00