|
1 | 1 | --------------------------------------------------------------------------------
|
2 |
| -{-# LANGUAGE TypeApplications #-} |
3 | 2 | {-# LANGUAGE OverloadedStrings #-}
|
| 3 | +{-# LANGUAGE TypeApplications #-} |
4 | 4 | import Data.Aeson
|
5 | 5 | import qualified Data.ByteString.Lazy as BL
|
6 | 6 | import Data.Monoid ((<>))
|
7 | 7 | import Data.Time.Calendar
|
8 | 8 | import Data.Time.Clock
|
| 9 | +import qualified GHC.IO.Encoding as Encoding |
9 | 10 | import Hakyll
|
10 | 11 | import Hakyll.Core.Compiler
|
11 | 12 | import Hakyll.Core.Compiler.Internal
|
12 | 13 | import Hakyll.Core.Provider
|
13 | 14 | import System.FilePath.Posix
|
14 | 15 | import Testimonial
|
15 | 16 |
|
16 |
| - |
17 | 17 | --------------------------------------------------------------------------------
|
18 | 18 | main :: IO ()
|
19 |
| -main = mkContext >>= \ctx -> hakyllWith configuration $ do |
20 |
| - match "testimonials/logos/*" $ do |
21 |
| - route idRoute |
22 |
| - compile copyFileCompiler |
23 |
| - |
24 |
| - match "testimonials/*.yaml" $ do |
25 |
| - compile parseTestimonialCompiler |
26 |
| - |
27 |
| - create ["testimonials.json"] $ do |
28 |
| - route idRoute |
29 |
| - compile $ do |
30 |
| - testimonials <- loadAll @Testimonial "testimonials/*.yaml" |
31 |
| - item <- (makeItem . BL.unpack . encode . map itemBody) testimonials |
32 |
| - saveSnapshot "_final" item |
33 |
| - pure item |
34 |
| - |
35 |
| - match "img/*" $ do |
36 |
| - route idRoute |
37 |
| - compile copyFileCompiler |
38 |
| - |
39 |
| - match "css/*" $ do |
40 |
| - route idRoute |
41 |
| - compile compressCssCompiler |
42 |
| - |
43 |
| - match "js/*" $ do |
44 |
| - route idRoute |
45 |
| - compile copyFileCompiler |
46 |
| - |
47 |
| - match "index.html" $ do |
48 |
| - route idRoute |
49 |
| - compile $ do |
50 |
| - testimonials <- loadAll @Testimonial "testimonials/*.yaml" |
51 |
| - let |
52 |
| - indexCtx = listField "testimonials" testimonialContext (pure testimonials) `mappend` |
53 |
| - ctx |
54 |
| - defCompiler indexCtx |
55 |
| - |
56 |
| - match ("**/*.markdown" .||. "*.markdown") $ do |
57 |
| - route cleanRoute |
58 |
| - compile $ mdCompiler ctx |
59 |
| - |
60 |
| - match "*.pdf" $ do |
61 |
| - route idRoute |
62 |
| - compile copyFileCompiler |
63 |
| - |
64 |
| - match "templates/*" $ |
65 |
| - compile templateCompiler |
| 19 | +main = do |
| 20 | + Encoding.setLocaleEncoding Encoding.utf8 |
| 21 | + ctx <- mkContext |
| 22 | + hakyllWith configuration $ do |
| 23 | + match "testimonials/logos/*" $ do |
| 24 | + route idRoute |
| 25 | + compile copyFileCompiler |
| 26 | + |
| 27 | + match "testimonials/*.yaml" $ do |
| 28 | + compile parseTestimonialCompiler |
| 29 | + |
| 30 | + create ["testimonials.json"] $ do |
| 31 | + route idRoute |
| 32 | + compile $ do |
| 33 | + testimonials <- loadAll @Testimonial "testimonials/*.yaml" |
| 34 | + item <- (makeItem . BL.unpack . encode . map itemBody) testimonials |
| 35 | + saveSnapshot "_final" item |
| 36 | + pure item |
| 37 | + |
| 38 | + match "img/*" $ do |
| 39 | + route idRoute |
| 40 | + compile copyFileCompiler |
| 41 | + |
| 42 | + match "css/*" $ do |
| 43 | + route idRoute |
| 44 | + compile compressCssCompiler |
| 45 | + |
| 46 | + match "js/*" $ do |
| 47 | + route idRoute |
| 48 | + compile copyFileCompiler |
| 49 | + |
| 50 | + match "index.html" $ do |
| 51 | + route idRoute |
| 52 | + compile $ do |
| 53 | + testimonials <- loadAll @Testimonial "testimonials/*.yaml" |
| 54 | + let |
| 55 | + indexCtx = listField "testimonials" testimonialContext (pure testimonials) `mappend` |
| 56 | + ctx |
| 57 | + defCompiler indexCtx |
| 58 | + |
| 59 | + match ("**/*.markdown" .||. "*.markdown") $ do |
| 60 | + route cleanRoute |
| 61 | + compile $ mdCompiler ctx |
| 62 | + |
| 63 | + match "*.pdf" $ do |
| 64 | + route idRoute |
| 65 | + compile copyFileCompiler |
| 66 | + |
| 67 | + match "templates/*" $ |
| 68 | + compile templateCompiler |
66 | 69 |
|
67 | 70 |
|
68 | 71 | configuration :: Configuration
|
|
0 commit comments