diff options
Diffstat (limited to 'src/Hakyll')
-rw-r--r-- | src/Hakyll/Core/Compiler.hs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/Hakyll/Core/Compiler.hs b/src/Hakyll/Core/Compiler.hs index 9a8f923..9fec69b 100644 --- a/src/Hakyll/Core/Compiler.hs +++ b/src/Hakyll/Core/Compiler.hs @@ -4,6 +4,7 @@ module Hakyll.Core.Compiler ( Compiler , getUnderlying + , getUnderlyingExtension , makeItem , getRoute , getResourceBody @@ -31,8 +32,8 @@ import Control.Applicative ((<$>)) import Data.Binary (Binary) import Data.ByteString.Lazy (ByteString) import Data.Typeable (Typeable) -import Prelude hiding (id, (.)) import System.Environment (getProgName) +import System.FilePath (takeExtension) -------------------------------------------------------------------------------- @@ -53,6 +54,13 @@ getUnderlying = compilerUnderlying <$> compilerAsk -------------------------------------------------------------------------------- +-- | Get the extension of the underlying identifier. Returns something like +-- @".html"@ +getUnderlyingExtension :: Compiler String +getUnderlyingExtension = takeExtension . toFilePath <$> getUnderlying + + +-------------------------------------------------------------------------------- makeItem :: a -> Compiler (Item a) makeItem x = do identifier <- getUnderlying |