diff --git a/.gitignore b/.gitignore index 4781dbb..8492faf 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ tags tests/Main _cache _store +_site # Rest of the file: ignore examples web/_cache diff --git a/data/example/about.rst b/data/example/about.rst new file mode 100644 index 0000000..99af9e2 --- /dev/null +++ b/data/example/about.rst @@ -0,0 +1,17 @@ +--- +title: About +--- +Nullam imperdiet sodales orci vitae molestie. Nunc quam orci, pharetra a +rhoncus vitae, eleifend id felis. Suspendisse potenti. Etiam vitae urna orci. +Quisque pellentesque dignissim felis, egestas tempus urna luctus vitae. In hac +habitasse platea dictumst. Morbi fringilla mattis odio, et mattis tellus +accumsan vitae. + +1. Amamus Unicode 碁 +2. Interdum nex magna. + +Vivamus eget mauris sit amet nulla laoreet lobortis. Nulla in diam elementum +risus convallis commodo. Cras vehicula varius dui vitae facilisis. Proin +elementum libero eget leo aliquet quis euismod orci vestibulum. Duis rhoncus +lorem consequat tellus vestibulum aliquam. Quisque orci orci, malesuada porta +blandit et, interdum nec magna. diff --git a/data/example/code.lhs b/data/example/code.lhs new file mode 100644 index 0000000..e98ec85 --- /dev/null +++ b/data/example/code.lhs @@ -0,0 +1,21 @@ +--- +title: Code +--- +Etiam condimentum auctor semper. Donec lobortis, magna id sodales sollicitudin, +lectus mi egestas nulla, pulvinar lobortis nunc eros id nisl. Curabitur +imperdiet, erat at accumsan vulputate. + +> reverse' [] = [] +> reverse' (x:xs) = (reverse' xs) ++ [x] + +Purus nunc blandit nulla, dictum. + +vestibulum sem lorem eget ipsum. Nunc tincidunt, turpis ut fermentum dapibus, +justo tortor bibendum sem, at facilisis justo odio luctus lectus. Quisque nec +ligula ipsum. Nunc augue lacus, ullamcorper vel dapibus in, mattis eget elit. + +> main = print $ reverse' [1 .. 10] + +Integer ut dui eu felis mollis vestibulum. Etiam at nibh id diam aliquet +vestibulum sit amet a nibh. Aliquam erat volutpat. Etiam vitae nulla at dolor +fringilla tempor ut a nunc. Pellentesque elementum elit lorem. diff --git a/data/example/css/default.css b/data/example/css/default.css new file mode 100644 index 0000000..3bfeeaf --- /dev/null +++ b/data/example/css/default.css @@ -0,0 +1,27 @@ +body { + width: 600px; + margin: 0px auto 0px auto; +} + +div#navigation { + text-align: center; + border-bottom: 4px solid black; +} + +div#navigation a { + color: white; + text-decoration: none; + background-color: black; + padding: 3px 10px 3px 10px; + margin: 0px 10px 0px 10px; +} + +div.figure { + float: right; + margin: 20px 0px 20px 20px; +} + +div.figure p.caption { + text-align: center; + font-style: italic; +} diff --git a/data/example/css/syntax.css b/data/example/css/syntax.css new file mode 100644 index 0000000..1aed859 --- /dev/null +++ b/data/example/css/syntax.css @@ -0,0 +1,18 @@ +/* Generated by pandoc. */ +table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode, table.sourceCode pre + { margin: 0; padding: 0; border: 0; vertical-align: baseline; border: none; } +td.lineNumbers { border-right: 1px solid #AAAAAA; text-align: right; color: #AAAAAA; padding-right: 5px; padding-left: 5px; } +td.sourceCode { padding-left: 5px; } +pre.sourceCode span.kw { color: #007020; font-weight: bold; } +pre.sourceCode span.dt { color: #902000; } +pre.sourceCode span.dv { color: #40a070; } +pre.sourceCode span.bn { color: #40a070; } +pre.sourceCode span.fl { color: #40a070; } +pre.sourceCode span.ch { color: #4070a0; } +pre.sourceCode span.st { color: #4070a0; } +pre.sourceCode span.co { color: #60a0b0; font-style: italic; } +pre.sourceCode span.ot { color: #007020; } +pre.sourceCode span.al { color: red; font-weight: bold; } +pre.sourceCode span.fu { color: #06287e; } +pre.sourceCode span.re { } +pre.sourceCode span.er { color: red; font-weight: bold; } diff --git a/data/example/images/haskell-logo.png b/data/example/images/haskell-logo.png new file mode 100644 index 0000000..97c0937 Binary files /dev/null and b/data/example/images/haskell-logo.png differ diff --git a/data/example/index.markdown b/data/example/index.markdown new file mode 100644 index 0000000..96b63bd --- /dev/null +++ b/data/example/index.markdown @@ -0,0 +1,27 @@ +--- +title: Home +--- +Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce tempor, urna et +auctor tincidunt, eros mauris facilisis purus, eget sollicitudin leo massa sit +amet ipsum. Vivamus eu massa in urna vehicula rutrum eget sit amet purus. + +![Haskell logo](/images/haskell-logo.png) + +- Mauris sit amet justo mi. +- Curabitur vel quam felis. +- In hac habitasse platea dictumst. + +Etiam nec consequat risus. Donec consequat est vitae neque fermentum +feugiat nec ac nibh. Nulla rhoncus, odio quis scelerisque rutrum, metus sem +tempor ante, a ornare ipsum felis sed ligula. Morbi urna lectus, scelerisque +non pharetra in, rutrum quis ligula. Phasellus semper ullamcorper arcu eu +auctor. + +Aliquam sagittis tincidunt libero ut elementum. Ut sit amet vestibulum metus. +Ut aliquet congue neque eu tincidunt. Integer eu elit sed massa sollicitudin +vehicula nec ut sem. Cras euismod enim eget purus lacinia non feugiat urna +imperdiet. Aliquam justo sem, viverra eu vehicula vitae, imperdiet vel magna. + +Pellentesque enim dui, interdum elementum vehicula luctus, feugiat vitae arcu. +Vestibulum ut felis justo. Quisque vestibulum mauris eget ipsum luctus +consequat. diff --git a/data/example/site.hs b/data/example/site.hs new file mode 100644 index 0000000..df53095 --- /dev/null +++ b/data/example/site.hs @@ -0,0 +1,23 @@ +-------------------------------------------------------------------------------- +{-# LANGUAGE OverloadedStrings #-} +import Hakyll + + +-------------------------------------------------------------------------------- +main :: IO () +main = hakyll $ do + match "images/*" $ do + route idRoute + compile copyFileCompiler + + match "css/*" $ do + route idRoute + compile compressCssCompiler + + match (fromList ["about.rst", "index.markdown", "code.lhs"]) $ do + route $ setExtension "html" + compile $ pageCompiler + >>= requireApplyTemplate "templates/default.html" defaultContext + >>= relativizeUrls + + match "templates/*" $ compile templateCompiler diff --git a/data/example/templates/default.html b/data/example/templates/default.html new file mode 100644 index 0000000..44d1cd0 --- /dev/null +++ b/data/example/templates/default.html @@ -0,0 +1,21 @@ + + + + + + MyAweSomeCompany - $title$ + + + + +

MyAweSomeCompany - $title$

+ + + $body$ + + diff --git a/hakyll.cabal b/hakyll.cabal index 648c389..6c701ce 100644 --- a/hakyll.cabal +++ b/hakyll.cabal @@ -41,11 +41,19 @@ Cabal-Version: >= 1.8 Build-Type: Simple Data-Dir: data -Data-Files: - templates/atom.xml +Data-files: + example/about.rst + example/code.lhs + example/css/default.css + example/css/syntax.css + example/images/haskell-logo.png + example/index.markdown + example/site.hs + example/templates/default.html templates/atom-item.xml - templates/rss.xml + templates/atom.xml templates/rss-item.xml + templates/rss.xml Extra-source-files: tests/data/example.md @@ -214,3 +222,13 @@ Test-suite hakyll-tests Hakyll.Web.Urls.Relativize.Tests Hakyll.Web.Util.Html.Tests TestSuite.Util + +Executable hakyll-init + Ghc-options: -Wall + Hs-source-dirs: src + Main-is: Hakyll/Init.hs + + Build-depends: + base >= 4 && < 5, + directory >= 1.0 && < 1.3, + filepath >= 1.0 && < 1.4 diff --git a/src/Hakyll/Init.hs b/src/Hakyll/Init.hs new file mode 100644 index 0000000..974cacb --- /dev/null +++ b/src/Hakyll/Init.hs @@ -0,0 +1,23 @@ +-------------------------------------------------------------------------------- +module Main + ( main + ) where + + +-------------------------------------------------------------------------------- +import System.Directory (copyFile) + + +-------------------------------------------------------------------------------- +import Hakyll.Core.Util.File +import Paths_hakyll + + +-------------------------------------------------------------------------------- +main :: IO () +main = do + let dstDir = "." + srcDir <- getDataFileName "example" + files <- getRecursiveContents srcDir + print files + return () diff --git a/web/philosophy.markdown b/web/philosophy.markdown deleted file mode 100644 index 056472b..0000000 --- a/web/philosophy.markdown +++ /dev/null @@ -1,28 +0,0 @@ ---- -title: Philosophy ---- - -# Small-to-medium sites - -Hakyll was written to be used for small-to-medium sites. You can do some -advanced things with it, but don't use it to build a big online shop. - -# Hakyll.hs - -It should be possible to put all configuration in one file, so data and -configuration can be strictly separated. In addition, we think this file should -never exceed a 100 lines of code. - -# High-level - -Hakyll tries to provide as many high-level functions as possible for common -tasks, while the lower-level functions should also be accessible. If you think -you're writing something that can be used for many sites, please send a patch, -or your `hakyll.hs`, and we will see what we can do. - -# Well-documented - -A key to being easy-to-use is documentation. That's why we try to provide as -many working examples as possible. If you ever create a site using hakyll, -please consider open-sourcing it, as people might be able to learn from your -code. diff --git a/web/templates/default.html b/web/templates/default.html index 53add69..8a5059d 100644 --- a/web/templates/default.html +++ b/web/templates/default.html @@ -26,7 +26,6 @@ home tutorials reference - philosophy about faq examples