diff options
Diffstat (limited to 'src/Text/Hakyll')
-rw-r--r-- | src/Text/Hakyll/File.hs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Text/Hakyll/File.hs b/src/Text/Hakyll/File.hs index 992490c..4e7c10f 100644 --- a/src/Text/Hakyll/File.hs +++ b/src/Text/Hakyll/File.hs @@ -8,6 +8,7 @@ module Text.Hakyll.File , removeSpaces , makeDirectories , getRecursiveContents + , sortByBaseName , havingExtension , isMoreRecent , directory @@ -16,7 +17,7 @@ module Text.Hakyll.File import System.Directory import System.FilePath import Control.Monad -import Data.List (isPrefixOf) +import Data.List (isPrefixOf, sortBy) import Control.Monad.Reader (liftIO) import Text.Hakyll.Hakyll @@ -100,6 +101,12 @@ getRecursiveContents topdir = do where isProper = not . (== '.') . head +-- | Sort a list of filenames on the basename. +sortByBaseName :: [FilePath] -> [FilePath] +sortByBaseName = sortBy compareBaseName + where + compareBaseName f1 f2 = compare (takeFileName f1) (takeFileName f2) + -- | A filter that takes all file names with a given extension. Prefix the -- extension with a dot: -- |