@@ -1,8 +1,12 @@
1--------------------------------------------------------------------------------
1--------------------------------------------------------------------------------
2{-# LANGUAGE OverloadedStrings #-}
2{-# LANGUAGE OverloadedStrings #-}
3−import Control.Monad (forM_)
3+import Control.Applicative ((<$>))
4+import Control.Arrow (second)
5+import Control.Monad (forM_)
6+import Data.List (isPrefixOf)
4−import Data.Monoid (mappend)
7+import Data.Monoid (mappend)
5import Hakyll
8import Hakyll
9+import System.FilePath (dropTrailingPathSeparator, splitPath)
6import Text.Pandoc
10import Text.Pandoc
@@ -14,7 +18,17 @@ main = hakyllWith config $ do
14 compile compressCssCompiler
18 compile compressCssCompiler
16 -- Static directories
20 -- Static directories
17− forM_ ["images/*", "examples/*", "reference/**"] $ \f -> match f $ do
21+ forM_ ["images/*", "examples/*"] $ \f -> match f $ do
23+ compile copyFileCompiler
26+ match "reference/**.html" $ do
28+ compile $ fmap (withUrls hackage) <$> getResourceString
31+ match ("reference/**" `mappend` complement "**.html") $ do
18 route idRoute
32 route idRoute
19 compile copyFileCompiler
33 compile copyFileCompiler
@@ -69,3 +83,23 @@ config = defaultConfiguration
69 , deployCommand = "rsync --checksum -ave 'ssh -p 2222' \
83 , deployCommand = "rsync --checksum -ave 'ssh -p 2222' \
70 \_site/* jaspervdj@jaspervdj.be:jaspervdj.be/tmp/hakyll4"
84 \_site/* jaspervdj@jaspervdj.be:jaspervdj.be/tmp/hakyll4"
88+--------------------------------------------------------------------------------
91+-- > /usr/share/doc/ghc/html/libraries/base-4.6.0.0/Data-String.html
95+-- > http://hackage.haskell.org/packages/archive/base/4.6.0.0/doc/html/Data-String.html
96+hackage :: String -> String
98+ | "/usr" `isPrefixOf` url =
99+ "http://hackage.haskell.org/packages/archive/" ++
100+ packageName ++ "/" ++ version' ++ "/doc/html/" ++ baseName
103+ (packageName, version') = second (drop 1) $ break (== '-') package
104+ (baseName : package : _) = map dropTrailingPathSeparator $
105+ reverse $ splitPath url