diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Hakyll/File.hs | 6 | ||||
-rw-r--r-- | src/Text/Hakyll/Internal/CompressCss.hs (renamed from src/Text/Hakyll/Internal/CompressCSS.hs) | 8 | ||||
-rw-r--r-- | src/Text/Hakyll/Internal/Render.hs | 2 | ||||
-rw-r--r-- | src/Text/Hakyll/Page.hs | 8 | ||||
-rw-r--r-- | src/Text/Hakyll/Render.hs | 6 | ||||
-rw-r--r-- | src/Text/Hakyll/Renderable.hs | 4 | ||||
-rw-r--r-- | src/Text/Hakyll/Renderables.hs | 24 | ||||
-rw-r--r-- | src/Text/Hakyll/Util.hs | 10 |
8 files changed, 34 insertions, 34 deletions
diff --git a/src/Text/Hakyll/File.hs b/src/Text/Hakyll/File.hs index 4e7c10f..a7ed7b3 100644 --- a/src/Text/Hakyll/File.hs +++ b/src/Text/Hakyll/File.hs @@ -3,7 +3,7 @@ module Text.Hakyll.File ( toDestination , toCache - , toURL + , toUrl , toRoot , removeSpaces , makeDirectories @@ -46,8 +46,8 @@ toCache path = do dir <- askHakyll cacheDirectory return $ dir </> removeLeadingSeparator path -- | Get the url for a given page. -toURL :: FilePath -> FilePath -toURL path = if takeExtension path `elem` [ ".markdown" +toUrl :: FilePath -> FilePath +toUrl path = if takeExtension path `elem` [ ".markdown" , ".md" , ".mdn" , ".mdwn" diff --git a/src/Text/Hakyll/Internal/CompressCSS.hs b/src/Text/Hakyll/Internal/CompressCss.hs index 7d52bef..4b19984 100644 --- a/src/Text/Hakyll/Internal/CompressCSS.hs +++ b/src/Text/Hakyll/Internal/CompressCss.hs @@ -1,7 +1,7 @@ -- | Module used for CSS compression. The compression is currently in a simple -- state, but would typically reduce the number of bytes by about 25%. -module Text.Hakyll.Internal.CompressCSS - ( compressCSS +module Text.Hakyll.Internal.CompressCss + ( compressCss ) where import Data.List (isPrefixOf) @@ -9,8 +9,8 @@ import Data.List (isPrefixOf) import Text.Hakyll.Regex (substituteRegex) -- | Compress CSS to speed up your site. -compressCSS :: String -> String -compressCSS = compressSeparators +compressCss :: String -> String +compressCss = compressSeparators . stripComments . compressWhitespace diff --git a/src/Text/Hakyll/Internal/Render.hs b/src/Text/Hakyll/Internal/Render.hs index a3d2d9b..167c58a 100644 --- a/src/Text/Hakyll/Internal/Render.hs +++ b/src/Text/Hakyll/Internal/Render.hs @@ -65,4 +65,4 @@ writePage page = do liftIO $ writeFile destination $ finalSubstitute (fromString $ getBody page) context where - url = getURL page + url = getUrl page diff --git a/src/Text/Hakyll/Page.hs b/src/Text/Hakyll/Page.hs index 39bb682..d557665 100644 --- a/src/Text/Hakyll/Page.hs +++ b/src/Text/Hakyll/Page.hs @@ -43,8 +43,8 @@ getValue str (Page page) = fromMaybe [] $ M.lookup str page -- | Get the URL for a certain page. This should always be defined. If -- not, it will error. -getPageURL :: Page -> String -getPageURL (Page page) = fromMaybe (error "No page url") $ M.lookup "url" page +getPageUrl :: Page -> String +getPageUrl (Page page) = fromMaybe (error "No page url") $ M.lookup "url" page -- | Get the original page path. getPagePath :: Page -> String @@ -134,7 +134,7 @@ readPageFromFile path = do return page where - url = toURL path + url = toUrl path category = let dirs = splitDirectories $ takeDirectory path in [("category", last dirs) | not (null dirs)] @@ -153,7 +153,7 @@ readPage path = do -- Make pages renderable. instance Renderable Page where getDependencies = (:[]) . getPagePath - getURL = getPageURL + getUrl = getPageUrl toContext (Page page) = return page -- Make pages serializable. diff --git a/src/Text/Hakyll/Render.hs b/src/Text/Hakyll/Render.hs index 0802330..e11879d 100644 --- a/src/Text/Hakyll/Render.hs +++ b/src/Text/Hakyll/Render.hs @@ -22,7 +22,7 @@ import Text.Hakyll.Page import Text.Hakyll.Renderable import Text.Hakyll.File import Text.Hakyll.Internal.Template (readTemplate) -import Text.Hakyll.Internal.CompressCSS +import Text.Hakyll.Internal.CompressCss import Text.Hakyll.Internal.Render -- | Execute an IO action only when the cache is invalid. @@ -101,7 +101,7 @@ renderChain = renderChainWith id renderChainWith :: Renderable a => ContextManipulation -> [FilePath] -> a -> Hakyll () renderChainWith manipulation templatePaths renderable = - depends (getURL renderable) dependencies render' + depends (getUrl renderable) dependencies render' where dependencies = getDependencies renderable ++ templatePaths render' = do @@ -126,4 +126,4 @@ css source = do destination <- toDestination source where css' destination = do contents <- liftIO $ readFile source makeDirectories destination - liftIO $ writeFile destination (compressCSS contents) + liftIO $ writeFile destination (compressCss contents) diff --git a/src/Text/Hakyll/Renderable.hs b/src/Text/Hakyll/Renderable.hs index bb4f71f..2fdeacd 100644 --- a/src/Text/Hakyll/Renderable.hs +++ b/src/Text/Hakyll/Renderable.hs @@ -1,5 +1,5 @@ module Text.Hakyll.Renderable - ( Renderable(toContext, getDependencies, getURL) + ( Renderable(toContext, getDependencies, getUrl) ) where import Text.Hakyll.Hakyll (Hakyll) @@ -15,4 +15,4 @@ class Renderable a where getDependencies :: a -> [FilePath] -- | Get the destination for the renderable. - getURL :: a -> FilePath + getUrl :: a -> FilePath diff --git a/src/Text/Hakyll/Renderables.hs b/src/Text/Hakyll/Renderables.hs index c6954b8..6f5bcfe 100644 --- a/src/Text/Hakyll/Renderables.hs +++ b/src/Text/Hakyll/Renderables.hs @@ -7,7 +7,7 @@ module Text.Hakyll.Renderables , createPagePath , CombinedRenderable , combine - , combineWithURL + , combineWithUrl ) where import qualified Data.Map as M @@ -25,7 +25,7 @@ import Text.Hakyll.Render -- | A custom page. data CustomPage = CustomPage - { customPageURL :: String, + { customPageUrl :: String, customPageDependencies :: [FilePath], customPageContext :: [(String, Either String (Hakyll String))] } @@ -85,11 +85,11 @@ createListingWith manipulation url template renderables additional = instance Renderable CustomPage where getDependencies = customPageDependencies - getURL = customPageURL + getUrl = customPageUrl toContext page = do values <- mapM (either return id . snd) (customPageContext page) let pairs = zip (map fst $ customPageContext page) values - return $ M.fromList $ ("url", customPageURL page) : pairs + return $ M.fromList $ ("url", customPageUrl page) : pairs -- | PagePath is a class that wraps a FilePath. This is used to render Pages -- without reading them first through use of caching. @@ -102,7 +102,7 @@ createPagePath = PagePath -- We can render filepaths instance Renderable PagePath where getDependencies (PagePath path) = return path - getURL (PagePath path) = toURL path + getUrl (PagePath path) = toUrl path toContext (PagePath path) = readPage path >>= toContext -- We can serialize filepaths @@ -112,7 +112,7 @@ instance Binary PagePath where -- | A combination of two other renderables. data CombinedRenderable a b = CombinedRenderable a b - | CombinedRenderableWithURL FilePath a b + | CombinedRenderableWithUrl FilePath a b -- | Combine two renderables. The url will always be taken from the first -- @Renderable@. Also, if a `$key` is present in both renderables, the @@ -125,12 +125,12 @@ combine = CombinedRenderable -- | Combine two renderables and set a custom URL. This behaves like @combine@, -- except that for the @url@ field, the given URL is always chosen. -combineWithURL :: (Renderable a, Renderable b) +combineWithUrl :: (Renderable a, Renderable b) => FilePath -> a -> b -> CombinedRenderable a b -combineWithURL = CombinedRenderableWithURL +combineWithUrl = CombinedRenderableWithUrl -- Render combinations. instance (Renderable a, Renderable b) @@ -139,18 +139,18 @@ instance (Renderable a, Renderable b) -- Add the dependencies. getDependencies (CombinedRenderable a b) = getDependencies a ++ getDependencies b - getDependencies (CombinedRenderableWithURL _ a b) = + getDependencies (CombinedRenderableWithUrl _ a b) = getDependencies a ++ getDependencies b -- Take the url from the first renderable, or the specified URL. - getURL (CombinedRenderable a _) = getURL a - getURL (CombinedRenderableWithURL url _ _) = url + getUrl (CombinedRenderable a _) = getUrl a + getUrl (CombinedRenderableWithUrl url _ _) = url -- Take a union of the contexts. toContext (CombinedRenderable a b) = do c1 <- toContext a c2 <- toContext b return $ c1 `M.union` c2 - toContext (CombinedRenderableWithURL url a b) = do + toContext (CombinedRenderableWithUrl url a b) = do c <- toContext (CombinedRenderable a b) return $ M.singleton "url" url `M.union` c diff --git a/src/Text/Hakyll/Util.hs b/src/Text/Hakyll/Util.hs index 358c60e..d900d6e 100644 --- a/src/Text/Hakyll/Util.hs +++ b/src/Text/Hakyll/Util.hs @@ -1,7 +1,7 @@ -- | Miscellaneous text manipulation functions. module Text.Hakyll.Util ( trim - , stripHTML + , stripHtml , link ) where @@ -14,11 +14,11 @@ trim = reverse . trim' . reverse . trim' trim' = dropWhile isSpace -- | Strip html tags from the given string. -stripHTML :: String -> String -stripHTML [] = [] -stripHTML str = let (beforeTag, rest) = break (== '<') str +stripHtml :: String -> String +stripHtml [] = [] +stripHtml str = let (beforeTag, rest) = break (== '<') str (_, afterTag) = break (== '>') rest - in beforeTag ++ stripHTML (tail' afterTag) + in beforeTag ++ stripHtml (tail' afterTag) where -- We need a failsafe tail function. tail' [] = [] |