on master help sign in
A little more documentation.
commitfbd9ff95bdd9c9bd904d87f2b2f2d88470c68173 authorJasper Van der Jeugt <jaspervdj@gmail.com> dateSun 31 Jan 2010, 13:40 (17 years ago) parent7afabf5
2 files changed+16−4
src/Text/Hakyll.hs+13−3 src/Text/Hakyll/File.hs+3−1
src/Text/Hakyll.hs+13−3
@@ -1,3 +1,12 @@
1+-- | This is the main Hakyll module, exporting the important @hakyl@ function.
2+--
3+-- Most configurations would use this @hakyll@ function more or less as the
4+-- main function:
5+--
6+-- > main = hakyll $ do
7+-- > directory css "css"
8+-- > directory static "images"
9+--
110module Text.Hakyll
211 ( defaultHakyllConfiguration
312 , hakyll
@@ -13,7 +22,7 @@ import System.Directory (doesDirectoryExist, removeDirectoryRecursive)
1322import Network.Hakyll.SimpleServer (simpleServer)
1423import Text.Hakyll.Hakyll
1524
16−-- | Default hakyll configuration.
25+-- | The default hakyll configuration.
1726defaultHakyllConfiguration :: HakyllConfiguration
1827defaultHakyllConfiguration = HakyllConfiguration
1928 { additionalContext = M.empty
@@ -21,11 +30,11 @@ defaultHakyllConfiguration = HakyllConfiguration
2130 , cacheDirectory = "_cache"
2231 }
2332
24−-- | Hakyll with a default configuration.
33+-- | Main function to run Hakyll with the default configuration.
2534hakyll :: Hakyll () -> IO ()
2635hakyll = hakyllWithConfiguration defaultHakyllConfiguration
2736
28−-- | Main function to run hakyll with a configuration.
37+-- | Main function to run hakyll with a custom configuration.
2938hakyllWithConfiguration :: HakyllConfiguration -> Hakyll () -> IO ()
3039hakyllWithConfiguration configuration buildFunction = do
3140 args <- getArgs
@@ -61,5 +70,6 @@ help = liftIO $ do
6170 ++ name ++ " preview [port] Generate site, then start a server.\n"
6271 ++ name ++ " server [port] Run a local test server.\n"
6372
73+-- | Start a server at the given port number.
6474server :: Integer -> Hakyll ()
6575server p = askHakyll siteDirectory >>= liftIO . simpleServer (fromIntegral p)
src/Text/Hakyll/File.hs+3−1
@@ -45,7 +45,9 @@ toCache :: FilePath -> Hakyll FilePath
4545toCache path = do dir <- askHakyll cacheDirectory
4646 return $ dir </> removeLeadingSeparator path
4747
48−-- | Get the url for a given page.
48+-- | Get the url for a given page. For most extensions, this would be the path
49+-- itself. It's only for rendered extensions (@.markdown@, @.rst@, @.lhs@ this
50+-- function returns a path with a @.html@ extension instead.
4951toUrl :: FilePath -> FilePath
5052toUrl path = if takeExtension path `elem` [ ".markdown"
5153 , ".md"