summaryrefslogtreecommitdiff
path: root/src/Hakyll/Core/Resource.hs
diff options
context:
space:
mode:
authorJasper Van der Jeugt <m@jaspervdj.be>2012-11-08 12:45:26 +0100
committerJasper Van der Jeugt <m@jaspervdj.be>2012-11-08 12:45:26 +0100
commit89f324f81b40d6818e6307794fe06b60053adbc0 (patch)
treee8c4f7fb869597ede5f283913cd0633be6830af6 /src/Hakyll/Core/Resource.hs
parente5c97d978bf34bdc98d97bf42ee2be29a5af4242 (diff)
downloadhakyll-89f324f81b40d6818e6307794fe06b60053adbc0.tar.gz
Pick metadata parsing from old develop
Diffstat (limited to 'src/Hakyll/Core/Resource.hs')
-rw-r--r--src/Hakyll/Core/Resource.hs40
1 files changed, 30 insertions, 10 deletions
diff --git a/src/Hakyll/Core/Resource.hs b/src/Hakyll/Core/Resource.hs
index 566bb26..0a43fc2 100644
--- a/src/Hakyll/Core/Resource.hs
+++ b/src/Hakyll/Core/Resource.hs
@@ -1,31 +1,51 @@
+--------------------------------------------------------------------------------
-- | Module exporting the simple 'Resource' type
---
module Hakyll.Core.Resource
- ( Resource
- , unResource
+ ( -- * Constructing and deconstructing resources
+ Resource
, resource
+ , unResource
+
+ -- * Conversions to and from identifiers
, fromIdentifier
, toIdentifier
+
+ -- * TODO: Move me
+ , Metadata
) where
-import Hakyll.Core.Identifier
+--------------------------------------------------------------------------------
+import Data.Map (Map)
+
+
+--------------------------------------------------------------------------------
+import Hakyll.Core.Identifier
+
+
+--------------------------------------------------------------------------------
-- | A resource
---
newtype Resource = Resource {unResource :: FilePath}
deriving (Eq, Show, Ord)
+
+--------------------------------------------------------------------------------
-- | Smart constructor to ensure we have @/@ as path separator
---
resource :: FilePath -> Resource
resource = fromIdentifier . parseIdentifier
--- | Create a resource from an identifier
---
+
+--------------------------------------------------------------------------------
+-- | Find the resource for an identifier
fromIdentifier :: Identifier a -> Resource
fromIdentifier = Resource . toFilePath
--- | Map the resource to an identifier. Note that the group will not be set!
---
+
+--------------------------------------------------------------------------------
+-- | Convert a resource to an identifier
toIdentifier :: Resource -> Identifier a
toIdentifier = parseIdentifier . unResource
+
+
+--------------------------------------------------------------------------------
+type Metadata = Map String String