summaryrefslogtreecommitdiff
path: root/src/Hakyll/Web/Util/Url.hs
diff options
context:
space:
mode:
authorJasper Van der Jeugt <m@jaspervdj.be>2011-09-06 22:26:07 +0200
committerJasper Van der Jeugt <m@jaspervdj.be>2011-09-06 22:27:53 +0200
commit75f157ca8c319d770f02c38d65226bb3de495a0e (patch)
tree51c92ac2658e3f265dc3971651dd89817f4e6cc9 /src/Hakyll/Web/Util/Url.hs
parentbf4115eb0fad1a3b7a0ce5dc71b55045df30995b (diff)
downloadhakyll-75f157ca8c319d770f02c38d65226bb3de495a0e.tar.gz
Add some URL utilities
Diffstat (limited to 'src/Hakyll/Web/Util/Url.hs')
-rw-r--r--src/Hakyll/Web/Util/Url.hs35
1 files changed, 0 insertions, 35 deletions
diff --git a/src/Hakyll/Web/Util/Url.hs b/src/Hakyll/Web/Util/Url.hs
deleted file mode 100644
index 7ab6717..0000000
--- a/src/Hakyll/Web/Util/Url.hs
+++ /dev/null
@@ -1,35 +0,0 @@
--- | Miscellaneous URL manipulation functions.
---
-module Hakyll.Web.Util.Url
- ( toUrl
- , toSiteRoot
- ) where
-
-import System.FilePath (splitPath, takeDirectory, joinPath)
-
--- | Convert a filepath to an URL starting from the site root
---
--- Example:
---
--- > toUrl "foo/bar.html"
---
--- Result:
---
--- > "/foo/bar.html"
---
-toUrl :: FilePath -> String
-toUrl ('/' : xs) = '/' : xs
-toUrl url = '/' : url
-
--- | Get the relative url to the site root, for a given (absolute) url
---
-toSiteRoot :: String -> String
-toSiteRoot = emptyException . joinPath . map parent
- . filter relevant . splitPath . takeDirectory
- where
- parent = const ".."
- emptyException [] = "."
- emptyException x = x
- relevant "." = False
- relevant "/" = False
- relevant _ = True